@leisuresaas/react-native 0.6.12-dev.1 → 0.6.12-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leisuresaas/react-native",
3
- "version": "0.6.12-dev.1",
3
+ "version": "0.6.12-dev.2",
4
4
  "description": "React Native SDK for LeisureSaas: OAuth, Public Ads/App Config, Drive User Plane (publishable keys). Frontend-only — no Integration Key.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/errors.ts CHANGED
@@ -52,6 +52,12 @@ export const ErrorReason = {
52
52
  OfferLimitReached: "OFFER_LIMIT_REACHED",
53
53
  OfferNotFound: "OFFER_NOT_FOUND",
54
54
  OfferRedemptionNotHeld: "OFFER_REDEMPTION_NOT_HELD",
55
+ // Targeted offers (R-1125-1 P3): for current or former subscribers only (on ios an Apple
56
+ // promotional offer also needs an App Store subscription before) / for the campaign's audience list
57
+ // only / web offers are new purchases and the workspace has an active paid subscription.
58
+ OfferNotASubscriber: "OFFER_NOT_A_SUBSCRIBER",
59
+ OfferNotInList: "OFFER_NOT_IN_LIST",
60
+ OfferAlreadySubscribed: "OFFER_ALREADY_SUBSCRIBED",
55
61
  // apple_intro claim: the product has no App Store In-App Purchase key.
56
62
  StoreNotConfigured: "STORE_NOT_CONFIGURED",
57
63
  // The token's workspace is no longer the user's active one: refresh the token, then retry.
package/src/index.ts CHANGED
@@ -218,6 +218,7 @@ export type {
218
218
  AdFeedRotation,
219
219
  AdFeedSource,
220
220
  AdsFeedResponse,
221
+ ApplePromotionalSignature,
221
222
  AuthConfig,
222
223
  ClaimOfferResult,
223
224
  EnablePushOptions,
package/src/types.ts CHANGED
@@ -42,7 +42,8 @@ export type SubscriptionOffer = {
42
42
  | "offer"
43
43
  | "promo_code"
44
44
  | "platform_offer"
45
- | "stripe_trial";
45
+ | "stripe_trial"
46
+ | "stripe_coupon";
46
47
  id?: string;
47
48
  phase?: "" | "trial" | "intro";
48
49
  phase_ends_at_unix?: number;
@@ -52,10 +53,31 @@ export type SubscriptionOffer = {
52
53
  };
53
54
 
54
55
  /**
55
- * How an offer is used: `platform_grant` / `stripe_trial` (web), `google_offer` (android: buy with
56
- * the Play offer), `apple_intro` (ios: buy with `ios.intro_eligibility_jws`).
56
+ * How an offer is used: `platform_grant` / `stripe_trial` / `stripe_coupon` (web), `google_offer`
57
+ * (android: buy with the Play offer), `apple_intro` (ios: buy with `ios.intro_eligibility_jws`),
58
+ * `apple_promotional` (ios: buy with `ios.promotional_offer_id` + signature or JWS and
59
+ * `appAccountToken = account_token`).
57
60
  */
58
- export type OfferMethod = "platform_grant" | "stripe_trial" | "google_offer" | "apple_intro";
61
+ export type OfferMethod =
62
+ | "platform_grant"
63
+ | "stripe_trial"
64
+ | "stripe_coupon"
65
+ | "google_offer"
66
+ | "apple_intro"
67
+ | "apple_promotional";
68
+
69
+ /**
70
+ * Classic Apple promotional offer signature (`ios.promotional_signature`), for
71
+ * `promotionalOffer(offerID:keyID:nonce:signature:timestamp:)`. Valid 24 hours, single use.
72
+ */
73
+ export type ApplePromotionalSignature = {
74
+ key_id: string;
75
+ /** Lowercase UUID. */
76
+ nonce: string;
77
+ timestamp_ms: number;
78
+ /** Base64. */
79
+ signature: string;
80
+ };
59
81
 
60
82
  export type OfferBenefit = {
61
83
  type: "free_days" | "percent_off" | "amount_off";
@@ -90,8 +112,22 @@ export type Offer = {
90
112
  held_until_unix?: number;
91
113
  price_id?: string;
92
114
  android?: { package_name?: string; store_product_id: string; base_plan_id: string; offer_id: string };
93
- /** `intro_eligibility_jws` is set on claims only. */
94
- ios?: { bundle_id?: string; store_product_id: string; intro_eligibility_jws?: string };
115
+ /** `intro_eligibility_jws`, `promotional_signature` and `promotional_offer_jws` are set on claims only. */
116
+ ios?: {
117
+ bundle_id?: string;
118
+ store_product_id: string;
119
+ intro_eligibility_jws?: string;
120
+ /** apple_promotional: the promotional offer identifier in App Store Connect. */
121
+ promotional_offer_id?: string;
122
+ promotional_signature?: ApplePromotionalSignature;
123
+ /** apple_promotional: for `promotionalOffer(_:compactJWS:)`. */
124
+ promotional_offer_jws?: string;
125
+ };
126
+ /**
127
+ * Claims on ios / android: the user's fixed account token for the product (lowercase UUID). Pass it
128
+ * as Apple `appAccountToken` / Google `obfuscatedAccountId` on every purchase.
129
+ */
130
+ account_token?: string;
95
131
  };
96
132
 
97
133
  /** `GET /v1/billing/offers` response. */