From ba1b7ef92c818cd91f3f092849e239c12ac865a9 Mon Sep 17 00:00:00 2001 From: Shaw-Signaturize <55977372+Shaw-Signaturize@users.noreply.github.com> Date: Fri, 15 Dec 2023 15:17:53 +0000 Subject: [PATCH] fix: add missing conn for SK2 intro offers (#2630) Adding missing mapping for intro offers in storekit2 on existing type --- 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;