@leisuresaas/react-native 0.6.12-dev.3 → 0.6.12

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.3",
3
+ "version": "0.6.12",
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
@@ -67,6 +67,10 @@ export const ErrorReason = {
67
67
  OfferCodeRateLimited: "OFFER_CODE_RATE_LIMITED",
68
68
  OfferCodeRequired: "OFFER_CODE_REQUIRED",
69
69
  OfferPoolExhausted: "OFFER_POOL_EXHAUSTED",
70
+ /** P5: the campaign's Apple code pools are not for the user's App Store subscription. */
71
+ OfferAppleCodePoolNotEligible: "OFFER_APPLE_CODE_POOL_NOT_ELIGIBLE",
72
+ /** P5: a code entered in the iOS app while the platform has in-app code entry off; hide the field. */
73
+ OfferInAppCodeEntryDisabled: "OFFER_IN_APP_CODE_ENTRY_DISABLED",
70
74
  OfferAppleCodePoolNewUsersOnly: "OFFER_APPLE_CODE_POOL_NEW_USERS_ONLY",
71
75
  // apple_intro claim: the product has no App Store In-App Purchase key.
72
76
  StoreNotConfigured: "STORE_NOT_CONFIGURED",
package/src/index.ts CHANGED
@@ -231,6 +231,10 @@ export type {
231
231
  OfferList,
232
232
  OfferCodeResult,
233
233
  OfferCodeValidation,
234
+ OfferCodeSource,
235
+ AppleCategory,
236
+ OfferApplies,
237
+ OfferRedeemOn,
234
238
  OfferMethod,
235
239
  OfferRedemption,
236
240
  Plan,
package/src/types.ts CHANGED
@@ -124,9 +124,19 @@ export type Offer = {
124
124
  promotional_signature?: ApplePromotionalSignature;
125
125
  /** apple_promotional: for `promotionalOffer(_:compactJWS:)`. */
126
126
  promotional_offer_jws?: string;
127
- /** apple_offer_code_pool code redeem only (on the website): App Store link for `apple_code`. */
127
+ /**
128
+ * apple_offer_code_pool code redeem only: App Store link for `apple_code`. In the app (R-1125-1
129
+ * P5): production opens `redeem_url` (`Linking.openURL`); sandbox codes do not work in the link,
130
+ * so copy `apple_code` and show Apple's offer code redeem sheet from your StoreKit library.
131
+ */
128
132
  redeem_url?: string;
129
133
  apple_code?: string;
134
+ /** P5, apple_offer_code_pool: the user's App Store category the pool was picked by. */
135
+ apple_category?: AppleCategory;
136
+ /** P5: when the offer starts once bought or redeemed; say so before opening the App Store. */
137
+ applies?: OfferApplies;
138
+ /** P5: with `next_renewal`, the current App Store period end. */
139
+ applies_at_unix?: number;
130
140
  };
131
141
  /**
132
142
  * Claims on ios / android: the user's fixed account token for the product (lowercase UUID). Pass it
@@ -142,9 +152,29 @@ export type Offer = {
142
152
  code?: { display: string };
143
153
  };
144
154
 
155
+ /** Where the user entered a promo code (R-1125-1 P5). Send `app` from an in-app code field. */
156
+ export type OfferCodeSource = "app" | "web";
157
+
158
+ /** Apple customer category of an offer code (new, current or expired subscriber). */
159
+ export type AppleCategory = "new" | "existing" | "expired";
160
+
161
+ /** `next_renewal`: a current App Store subscriber's code or promotional offer starts at the renewal. */
162
+ export type OfferApplies = "now" | "next_renewal";
163
+
164
+ /**
165
+ * ios `redeem_on`: `web` (Apple code pool link on the website), `app` (signed purchase in the app),
166
+ * `app_store` (P5, `source: app`: the app opens the App Store redeem page).
167
+ */
168
+ export type OfferRedeemOn = "web" | "app" | "app_store";
169
+
145
170
  /** `GET /v1/billing/offers` response. */
146
171
  export type OfferList = {
147
172
  offers: Offer[];
173
+ /**
174
+ * P5, ios with the app's bundle id: whether the platform lets this App Store app take promo codes
175
+ * (`source: app`). Show a code field only when true.
176
+ */
177
+ ios_in_app_code_entry?: boolean;
148
178
  /** ios with `app_transaction_id` and no `apple_intro` offer: a "no trial" JWS per App Store product. */
149
179
  apple_intro_ineligible?: { store_product_id: string; jws: string }[];
150
180
  };
@@ -169,32 +199,37 @@ export type OfferRedemption = {
169
199
  /** Promo code campaigns: the code redeemed and its masked display. */
170
200
  code_id?: string;
171
201
  code_display?: string;
202
+ /** P5: where the code was entered. */
203
+ source?: OfferCodeSource;
204
+ apple_category?: AppleCategory;
205
+ applies?: OfferApplies;
206
+ applies_at_unix?: number;
172
207
  };
173
208
 
174
209
  /**
175
- * One platform's answer for a promo code (`POST /v1/billing/offers/codes/validate`, for an Android
176
- * app that lets users enter codes). `redeem_on` is ios only: `web` (Apple code pool link on the
177
- * website) or `app` (redeem on the website, then claim in the app).
210
+ * One platform's answer for a promo code (`POST /v1/billing/offers/codes/validate`). `redeem_on` is
211
+ * ios only (`OfferRedeemOn`).
178
212
  */
179
213
  export type OfferCodeResult = {
180
214
  eligible: boolean;
181
215
  reason?: string | null;
182
216
  method?: OfferMethod | null;
183
- redeem_on?: "web" | "app";
217
+ redeem_on?: OfferRedeemOn;
184
218
  };
185
219
 
186
220
  /**
187
221
  * Validate response as the BFF passes it through from sdk/go `ValidateOfferCode`. Always 200: an
188
222
  * unusable code is `eligible: false` with a `reason`. With `platform` the top-level fields are that
189
- * platform's; `code`, `campaign`, `plan_ids`, `platforms` are absent for `OFFER_CODE_INVALID`. Do not
190
- * add a code field to an iOS app (App Store 3.1.1); iOS users enter codes on the website.
223
+ * platform's; `code`, `campaign`, `plan_ids`, `platforms` are absent for `OFFER_CODE_INVALID`. An
224
+ * iOS app may have a code field only while `OfferList.ios_in_app_code_entry` is true (R-1125-1 P5);
225
+ * with `source: app` and the switch off the answer is `OFFER_IN_APP_CODE_ENTRY_DISABLED`.
191
226
  */
192
227
  export type OfferCodeValidation = {
193
228
  eligible?: boolean;
194
229
  reason?: string | null;
195
230
  platform?: "web" | "ios" | "android";
196
231
  method?: OfferMethod | null;
197
- redeem_on?: "web" | "app";
232
+ redeem_on?: OfferRedeemOn;
198
233
  code?: { display: string; kind: "single_use" | "shared"; expires_at_unix?: number };
199
234
  campaign?: OfferCampaign;
200
235
  plan_ids?: string[];