From 00a0e522280a6618697e09880d1d22eaed61a801 Mon Sep 17 00:00:00 2001 From: Shaw Date: Mon, 27 Nov 2023 12:38:21 +0000 Subject: [PATCH] fix: Adding missing connection for SK2 intro offers --- src/types/appleSk2.ts | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/types/appleSk2.ts b/src/types/appleSk2.ts index 0049148c7..ecc5ea138 100644 --- a/src/types/appleSk2.ts +++ b/src/types/appleSk2.ts @@ -52,7 +52,7 @@ export const productSk2Map = ({ description, displayName, price, - currency, + currency, displayPrice, }: ProductSk2): ProductIOS => { const prod: ProductIOS = { @@ -62,7 +62,7 @@ export const productSk2Map = ({ type: 'iap', price: String(price), localizedPrice: displayPrice, - currency + currency, }; return prod; }; @@ -88,6 +88,17 @@ export const subscriptionSk2Map = ({ subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`, subscriptionPeriodUnitIOS: subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod, + introductoryPriceAsAmountIOS: subscription?.introductoryOffer?.displayPrice, + introductoryPricePaymentModeIOS: + subscription?.introductoryOffer?.paymentMode.toUpperCase() as + | '' + | 'FREETRIAL' + | 'PAYASYOUGO' + | 'PAYUPFRONT', + introductoryPriceNumberOfPeriodsIOS: + subscription?.introductoryOffer?.period?.value?.toString(), + introductoryPriceSubscriptionPeriodIOS: subscription?.introductoryOffer + ?.period?.unit as SubscriptionIosPeriod, }; return prod; }; @@ -138,12 +149,12 @@ export type SubscriptionStatus = | 'subscribed'; /** -* Renewal info for whole subscription group. -* see: https://developer.apple.com/documentation/storekit/product/subscriptioninfo/status/3822294-renewalinfo -* WARN: -* - autoRenewPreference is serialised as autoRenewProductId in jsonRepresentation -* - renewalDate is available in jsonRepresentation (will change with Xcode 15 https://developer.apple.com/forums/thread/738833) -*/ + * Renewal info for whole subscription group. + * see: https://developer.apple.com/documentation/storekit/product/subscriptioninfo/status/3822294-renewalinfo + * WARN: + * - autoRenewPreference is serialised as autoRenewProductId in jsonRepresentation + * - renewalDate is available in jsonRepresentation (will change with Xcode 15 https://developer.apple.com/forums/thread/738833) + */ export type RenewalInfo = { jsonRepresentation?: string; willAutoRenew: boolean;