@adapty/core 3.15.0 → 3.17.0-dev.2cd14ddac1a5989c081883c6f0cac85780d14d4d

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/dist/index.cjs CHANGED
@@ -288,7 +288,7 @@ var DefaultLoggerAdapter = class {
288
288
 
289
289
  //#endregion
290
290
  //#region src/types/error.ts
291
- const ErrorCode = Object.freeze({
291
+ const ErrorCodeMapping = Object.freeze({
292
292
  0: "unknown",
293
293
  1: "clientInvalid",
294
294
  3: "paymentInvalid",
@@ -339,6 +339,58 @@ const ErrorCode = Object.freeze({
339
339
  3101: "fetchTimeoutError",
340
340
  9e3: "operationInterrupted"
341
341
  });
342
+ const ErrorCode = ErrorCodeMapping;
343
+ const ErrorCodeName = Object.freeze({
344
+ unknown: 0,
345
+ clientInvalid: 1,
346
+ paymentInvalid: 3,
347
+ paymentNotAllowed: 4,
348
+ storeProductNotAvailable: 5,
349
+ cloudServicePermissionDenied: 6,
350
+ cloudServiceNetworkConnectionFailed: 7,
351
+ cloudServiceRevoked: 8,
352
+ privacyAcknowledgementRequired: 9,
353
+ unauthorizedRequestData: 10,
354
+ invalidOfferIdentifier: 11,
355
+ invalidSignature: 12,
356
+ missingOfferParams: 13,
357
+ invalidOfferPrice: 14,
358
+ adaptyNotInitialized: 20,
359
+ productNotFound: 22,
360
+ currentSubscriptionToUpdateNotFoundInHistory: 24,
361
+ billingServiceTimeout: 97,
362
+ featureNotSupported: 98,
363
+ billingServiceDisconnected: 99,
364
+ billingServiceUnavailable: 102,
365
+ billingUnavailable: 103,
366
+ developerError: 105,
367
+ billingError: 106,
368
+ itemAlreadyOwned: 107,
369
+ itemNotOwned: 108,
370
+ billingNetworkError: 112,
371
+ noProductIDsFound: 1e3,
372
+ productRequestFailed: 1002,
373
+ cantMakePayments: 1003,
374
+ noPurchasesToRestore: 1004,
375
+ cantReadReceipt: 1005,
376
+ productPurchaseFailed: 1006,
377
+ refreshReceiptFailed: 1010,
378
+ receiveRestoredTransactionsFailed: 1011,
379
+ notActivated: 2002,
380
+ badRequest: 2003,
381
+ serverError: 2004,
382
+ networkFailed: 2005,
383
+ decodingFailed: 2006,
384
+ encodingFailed: 2009,
385
+ analyticsDisabled: 3e3,
386
+ wrongParam: 3001,
387
+ activateOnceError: 3005,
388
+ profileWasChanged: 3006,
389
+ unsupportedData: 3007,
390
+ persistingDataError: 3100,
391
+ fetchTimeoutError: 3101,
392
+ operationInterrupted: 9e3
393
+ });
342
394
  function getErrorCode(error) {
343
395
  const errorCode = Object.keys(ErrorCode).find((keyStr) => {
344
396
  const key = Number(keyStr);
@@ -1071,7 +1123,7 @@ var AdaptyOnboardingCoder = class extends Coder {
1071
1123
  },
1072
1124
  onboardingBuilder: {
1073
1125
  key: "onboarding_builder",
1074
- required: false,
1126
+ required: true,
1075
1127
  type: "object",
1076
1128
  converter: new AdaptyOnboardingBuilderCoder()
1077
1129
  },
@@ -2482,7 +2534,8 @@ function extractPaywallCallbackArgs(handlerName, event) {
2482
2534
  case PaywallEventId.DidFailRendering:
2483
2535
  case PaywallEventId.DidFailLoadingProducts: return [event.error];
2484
2536
  case PaywallEventId.DidPerformAction:
2485
- if (handlerName === "onUrlPress" || handlerName === "onCustomAction") return [event.action.value ?? ""];
2537
+ if (handlerName === "onUrlPress" && event.action.type === "open_url") return [event.action.value, event.action.openIn];
2538
+ if (handlerName === "onCustomAction" && event.action.type === "custom") return [event.action.value];
2486
2539
  return [];
2487
2540
  case PaywallEventId.DidFinishWebPaymentNavigation: return [event.product, event.error];
2488
2541
  case PaywallEventId.DidAppear:
@@ -2640,10 +2693,7 @@ function parsePaywallEvent(factory, input, ctx) {
2640
2693
  return {
2641
2694
  id: eventId,
2642
2695
  view,
2643
- action: {
2644
- type: actionObj["type"],
2645
- value: actionObj["value"]
2646
- }
2696
+ action: parsePaywallUserAction(actionObj)
2647
2697
  };
2648
2698
  }
2649
2699
  case PaywallEventId.DidSelectProduct: return {
@@ -2721,6 +2771,22 @@ function parsePaywallEvent(factory, input, ctx) {
2721
2771
  default: return null;
2722
2772
  }
2723
2773
  }
2774
+ function parsePaywallUserAction(actionObj) {
2775
+ const type = actionObj["type"];
2776
+ switch (type) {
2777
+ case "open_url": return {
2778
+ type,
2779
+ value: actionObj["value"],
2780
+ openIn: actionObj["open_in"]
2781
+ };
2782
+ case "custom": return {
2783
+ type,
2784
+ value: actionObj["value"]
2785
+ };
2786
+ case "close":
2787
+ case "system_back": return { type };
2788
+ }
2789
+ }
2724
2790
  function getPaywallCoder(factory, type, _ctx) {
2725
2791
  switch (type) {
2726
2792
  case "product": return factory.createPaywallProductCoder();
@@ -2932,6 +2998,7 @@ exports.DefaultLoggerAdapter = DefaultLoggerAdapter
2932
2998
  exports.DefaultPlatformAdapter = DefaultPlatformAdapter
2933
2999
  exports.DefaultSdkMetadataAdapter = DefaultSdkMetadataAdapter
2934
3000
  exports.ErrorCode = ErrorCode
3001
+ exports.ErrorCodeName = ErrorCodeName
2935
3002
  exports.FetchPolicy = FetchPolicy
2936
3003
  exports.Gender = Gender
2937
3004
  exports.HANDLER_TO_EVENT_CONFIG = HANDLER_TO_EVENT_CONFIG