Skip to content

Commit

Permalink
fix: add missing conn for SK2 intro offers (#2630)
Browse files Browse the repository at this point in the history
Adding missing mapping for intro offers in storekit2 on existing type
  • Loading branch information
Shaw-Signaturize authored Dec 15, 2023
1 parent e67a52e commit ba1b7ef
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/types/appleSk2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const productSk2Map = ({
description,
displayName,
price,
currency,
currency,
displayPrice,
}: ProductSk2): ProductIOS => {
const prod: ProductIOS = {
Expand All @@ -62,7 +62,7 @@ export const productSk2Map = ({
type: 'iap',
price: String(price),
localizedPrice: displayPrice,
currency
currency,
};
return prod;
};
Expand All @@ -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;
};
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ba1b7ef

Please sign in to comment.