@adapty/capacitor 3.16.0-beta.0 → 3.16.0

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.
@@ -1,3 +1,4 @@
1
+ import { Log } from '../shared/logger';
1
2
  /**
2
3
  * Default event handlers that provide standard closing behavior
3
4
  */
@@ -6,7 +7,12 @@ export const DEFAULT_EVENT_HANDLERS = {
6
7
  onAndroidSystemBack: () => true,
7
8
  onUrlPress: (url) => {
8
9
  if (typeof window !== 'undefined') {
9
- window.open(url, '_blank');
10
+ try {
11
+ window.open(new URL(url), '_blank');
12
+ }
13
+ catch (_a) {
14
+ Log.warn('onUrlPress', () => `Invalid URL: ${url}`);
15
+ }
10
16
  }
11
17
  return false;
12
18
  },
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ui-builder/types.ts"],"names":[],"mappings":"AAiNA;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC9B,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC/B,UAAU,EAAE,CAAC,GAAW,EAAE,EAAE;QAC1B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK;IAC3B,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC9B,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC9B,mBAAmB,EAAE,CAAC,cAAoC,EAAE,EAAE,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,MAAK,gBAAgB;IACxG,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC7B,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC7B,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC9B,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK;IAC5B,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK;IACvB,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;IAC1B,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC7B,uBAAuB,EAAE,GAAG,EAAE,CAAC,KAAK;IACpC,8BAA8B,EAAE,GAAG,EAAE,CAAC,KAAK;CAC5C,CAAC;AA0DF,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC;IACpD,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;CACvB,CAAC,CAAC;AA8EH,MAAM,CAAC,MAAM,iCAAiC,GAAqC;IACjF,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;CACpB,CAAC","sourcesContent":["import type {\n AdaptyPaywallProduct,\n AdaptyProductIdentifier,\n AdaptyProfile,\n AdaptyPurchaseResult,\n WebPresentation,\n} from '../shared/types';\nimport type { FileLocation, MakePurchaseParamsInput } from '../shared/types/inputs';\nimport type { AdaptyError } from '../shared/types/method-types';\n\n/**\n * @internal\n */\nexport type ArgType<T> = T extends () => any ? void : T extends (arg: infer U) => any ? U : void;\n\n/**\n * EventHandler callback should not return a promise,\n * because using `await` may postpone closing a paywall view.\n *\n * We don't want to block the UI thread.\n */\nexport type EventHandlerResult = boolean | void;\n\n/**\n * Purchase parameters keyed by AdaptyProductIdentifier objects\n */\nexport type ProductPurchaseParams = {\n productId: AdaptyProductIdentifier;\n params: MakePurchaseParamsInput;\n}[];\n\nexport type AdaptyCustomAsset =\n | AdaptyCustomImageAsset\n | AdaptyCustomVideoAsset\n | AdaptyCustomColorAsset\n | AdaptyCustomGradientAsset;\n\nexport type AdaptyCustomImageAsset =\n | { type: 'image'; base64: string }\n | { type: 'image'; relativeAssetPath: string } // shorthand: uses same path for both iOS fileName and Android relativeAssetPath\n | { type: 'image'; fileLocation: FileLocation }; // full control for platform-specific paths\n\nexport type AdaptyCustomVideoAsset =\n | { type: 'video'; relativeAssetPath: string } // shorthand: uses same path for both iOS fileName and Android relativeAssetPath\n | { type: 'video'; fileLocation: FileLocation }; // full control for platform-specific paths\n\nexport type AdaptyCustomColorAsset =\n | { type: 'color'; argb: number /* e.g. 0xFFFF0000 (opaque red) */ }\n | { type: 'color'; rgb: number /* e.g. 0xFF0000 (red) */ }\n | { type: 'color'; rgba: number /* e.g. 0xFF0000FF (opaque red) */ };\n\nexport type AdaptyCustomGradientAsset = {\n type: 'linear-gradient';\n values: ({ p: number; argb: number } | { p: number; rgb: number } | { p: number; rgba: number })[];\n points?: { x0?: number; y0?: number; x1?: number; y1?: number };\n};\n\nexport type AdaptyUiOnboardingMeta = {\n onboardingId: string;\n screenClientId: string;\n screenIndex: number;\n totalScreens: number;\n};\n\nexport type AdaptyUiOnboardingStateParams = {\n id: string;\n value: string;\n label: string;\n};\n\n/**\n * Paywall event handlers configuration\n *\n * @see {@link https://adapty.io/docs/capacitor-handling-events | [DOC] Handling View Events}\n */\nexport interface EventHandlers {\n /**\n * Called when a user taps the close button on the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n */\n onCloseButtonPress: () => EventHandlerResult;\n /**\n * Called when a user navigates back on Android\n *\n * If you return `true`, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n */\n onAndroidSystemBack: () => EventHandlerResult;\n /**\n * Called when a user taps an URL in the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onUrlPress: (url: string) => EventHandlerResult;\n /**\n * Called when a user performs a custom action in the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onCustomAction: (actionId: string) => EventHandlerResult;\n /**\n * Called when a user selects a product in the paywall view\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onProductSelected: (productId: string) => EventHandlerResult;\n /**\n * Called when a purchase process starts\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onPurchaseStarted: (product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called when the purchase succeeds, the user cancels their purchase, or the purchase appears to be pending\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * We strongly recommend returning `purchaseResult.type !== 'user_cancelled'` in this case.\n * @default `purchaseResult.type !== 'user_cancelled'`\n *\n * @param purchaseResult - object, which provides details about the purchase.\n * If the result is `'success'`, it also includes the updated user's profile.\n */\n onPurchaseCompleted: (purchaseResult: AdaptyPurchaseResult, product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called if a purchase fails after a user taps the purchase button\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onPurchaseFailed: (error: AdaptyError, product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called when a user taps the restore button in the paywall view\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onRestoreStarted: () => EventHandlerResult;\n /**\n * Called when a purchase is completed\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n *\n * @param profile - updated user profile\n */\n onRestoreCompleted: (profile: AdaptyProfile) => EventHandlerResult;\n /**\n * Called if a restore fails after a user taps the restore button\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onRestoreFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called when the paywall view appears\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onAppeared: () => EventHandlerResult;\n /**\n * Called when the paywall view disappears\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onDisappeared: () => EventHandlerResult;\n /**\n * Called if a paywall view fails to render.\n * This should not ever happen, but if it does, feel free to report it to us.\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default true\n *\n * @param error - AdaptyError object with error code and message\n */\n onRenderingFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called if a product list fails to load on a presented view,\n * for example, if there is no internet connection\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onLoadingProductsFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called when web payment navigation finishes\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onWebPaymentNavigationFinished: (product?: AdaptyPaywallProduct, error?: AdaptyError) => EventHandlerResult;\n}\n\n/**\n * Default event handlers that provide standard closing behavior\n */\nexport const DEFAULT_EVENT_HANDLERS: EventHandlers = {\n onCloseButtonPress: () => true,\n onAndroidSystemBack: () => true,\n onUrlPress: (url: string) => {\n if (typeof window !== 'undefined') {\n window.open(url, '_blank');\n }\n return false;\n },\n onCustomAction: () => false,\n onProductSelected: () => false,\n onPurchaseStarted: () => false,\n onPurchaseCompleted: (purchaseResult: AdaptyPurchaseResult) => purchaseResult?.type !== 'user_cancelled',\n onPurchaseFailed: () => false,\n onRestoreStarted: () => false,\n onRestoreCompleted: () => true,\n onRestoreFailed: () => false,\n onAppeared: () => false,\n onDisappeared: () => false,\n onRenderingFailed: () => true,\n onLoadingProductsFailed: () => false,\n onWebPaymentNavigationFinished: () => false,\n};\n\nexport type OnboardingStateUpdatedAction =\n | {\n elementId: string;\n elementType: 'select';\n value: AdaptyUiOnboardingStateParams;\n }\n | {\n elementId: string;\n elementType: 'multi_select';\n value: AdaptyUiOnboardingStateParams[];\n }\n | {\n elementId: string;\n elementType: 'input';\n value: { type: 'text' | 'email'; value: string } | { type: 'number'; value: number };\n }\n | {\n elementId: string;\n elementType: 'date_picker';\n value: {\n day?: number;\n month?: number;\n year?: number;\n };\n };\n\nexport interface AdaptyUiView {\n id: string;\n}\n\nexport interface AdaptyUiMediaCache {\n memoryStorageTotalCostLimit?: number;\n memoryStorageCountLimit?: number;\n diskStorageSizeLimit?: number;\n}\n\nexport interface AdaptyUiDialogConfig {\n /**\n * The action title to display as part of the dialog. If you provide two actions,\n * be sure `primaryAction` cancels the operation and leaves things unchanged.\n */\n primaryActionTitle: string;\n /**\n * The secondary action title to display as part of the dialog.\n */\n secondaryActionTitle?: string;\n /**\n * The title of the dialog.\n */\n title?: string;\n /**\n * Descriptive text that provides additional details about the reason for the dialog.\n */\n content?: string;\n}\n\nexport const AdaptyUiDialogActionType = Object.freeze({\n primary: 'primary',\n secondary: 'secondary',\n});\n\nexport type AdaptyUiDialogActionType = (typeof AdaptyUiDialogActionType)[keyof typeof AdaptyUiDialogActionType];\n\n/**\n * Additional options for creating a paywall view\n *\n * @see {@link https://adapty.io/docs/capacitor-present-paywalls | [DOC] Creating Paywall View}\n */\nexport interface CreatePaywallViewParamsInput {\n /**\n * `true` if you want to prefetch products before presenting a paywall view.\n */\n prefetchProducts?: boolean;\n /**\n * This value limits the timeout (in milliseconds) for this method.\n */\n loadTimeoutMs?: number;\n /**\n * If you are going to use custom tags functionality, pass an object with tags and corresponding replacement values\n *\n * ```\n * {\n * 'USERNAME': 'Bruce',\n * 'CITY': 'Philadelphia'\n * }\n * ```\n */\n customTags?: Record<string, string>;\n /**\n * If you are going to use custom timer functionality, pass an object with timer ids and corresponding dates the timers should end at\n */\n customTimers?: Record<string, Date>;\n /**\n * Use this when you need to override paywall assets with your own\n */\n customAssets?: Record<string, AdaptyCustomAsset>;\n /**\n * Provide per-product purchase parameters keyed by Adapty product identifier\n */\n productPurchaseParams?: ProductPurchaseParams;\n}\n\n/**\n * Additional options for creating an onboarding view\n *\n * @see {@link https://adapty.io/docs/capacitor-get-onboardings | [DOC] Creating Onboarding View}\n */\nexport interface CreateOnboardingViewParamsInput {\n /**\n * If you want to change the presentation behavior of external URLs, pass a preferred value.\n *\n * @default {@link WebPresentation.BrowserInApp}\n */\n externalUrlsPresentation?: WebPresentation;\n}\n\nexport interface OnboardingEventHandlers {\n onClose: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onCustom: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onPaywall: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onStateUpdated: (action: OnboardingStateUpdatedAction, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onFinishedLoading: (meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onAnalytics: (\n event: {\n name: string;\n /**\n * @deprecated Use `elementId` instead\n */\n element_id?: string;\n elementId?: string;\n reply?: string;\n },\n meta: AdaptyUiOnboardingMeta,\n ) => EventHandlerResult;\n onError: (error: AdaptyError) => EventHandlerResult;\n}\n\nexport const DEFAULT_ONBOARDING_EVENT_HANDLERS: Partial<OnboardingEventHandlers> = {\n onClose: () => true,\n};\n\n/**\n * iOS presentation style for paywall and onboarding views\n * @platform ios\n */\nexport type AdaptyIOSPresentationStyle = 'full_screen' | 'page_sheet';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ui-builder/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAkNvC;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC9B,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC/B,UAAU,EAAE,CAAC,GAAW,EAAE,EAAE;QAC1B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,IAAI,CAAC;gBACH,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC;YACtC,CAAC;YAAC,WAAM,CAAC;gBACP,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK;IAC3B,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC9B,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC9B,mBAAmB,EAAE,CAAC,cAAoC,EAAE,EAAE,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,MAAK,gBAAgB;IACxG,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC7B,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC7B,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC9B,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK;IAC5B,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK;IACvB,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;IAC1B,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC7B,uBAAuB,EAAE,GAAG,EAAE,CAAC,KAAK;IACpC,8BAA8B,EAAE,GAAG,EAAE,CAAC,KAAK;CAC5C,CAAC;AA0DF,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC;IACpD,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;CACvB,CAAC,CAAC;AA8EH,MAAM,CAAC,MAAM,iCAAiC,GAAqC;IACjF,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;CACpB,CAAC","sourcesContent":["import { Log } from '../shared/logger';\nimport type {\n AdaptyPaywallProduct,\n AdaptyProductIdentifier,\n AdaptyProfile,\n AdaptyPurchaseResult,\n WebPresentation,\n} from '../shared/types';\nimport type { FileLocation, MakePurchaseParamsInput } from '../shared/types/inputs';\nimport type { AdaptyError } from '../shared/types/method-types';\n\n/**\n * @internal\n */\nexport type ArgType<T> = T extends () => any ? void : T extends (arg: infer U) => any ? U : void;\n\n/**\n * EventHandler callback should not return a promise,\n * because using `await` may postpone closing a paywall view.\n *\n * We don't want to block the UI thread.\n */\nexport type EventHandlerResult = boolean | void;\n\n/**\n * Purchase parameters keyed by AdaptyProductIdentifier objects\n */\nexport type ProductPurchaseParams = {\n productId: AdaptyProductIdentifier;\n params: MakePurchaseParamsInput;\n}[];\n\nexport type AdaptyCustomAsset =\n | AdaptyCustomImageAsset\n | AdaptyCustomVideoAsset\n | AdaptyCustomColorAsset\n | AdaptyCustomGradientAsset;\n\nexport type AdaptyCustomImageAsset =\n | { type: 'image'; base64: string }\n | { type: 'image'; relativeAssetPath: string } // shorthand: uses same path for both iOS fileName and Android relativeAssetPath\n | { type: 'image'; fileLocation: FileLocation }; // full control for platform-specific paths\n\nexport type AdaptyCustomVideoAsset =\n | { type: 'video'; relativeAssetPath: string } // shorthand: uses same path for both iOS fileName and Android relativeAssetPath\n | { type: 'video'; fileLocation: FileLocation }; // full control for platform-specific paths\n\nexport type AdaptyCustomColorAsset =\n | { type: 'color'; argb: number /* e.g. 0xFFFF0000 (opaque red) */ }\n | { type: 'color'; rgb: number /* e.g. 0xFF0000 (red) */ }\n | { type: 'color'; rgba: number /* e.g. 0xFF0000FF (opaque red) */ };\n\nexport type AdaptyCustomGradientAsset = {\n type: 'linear-gradient';\n values: ({ p: number; argb: number } | { p: number; rgb: number } | { p: number; rgba: number })[];\n points?: { x0?: number; y0?: number; x1?: number; y1?: number };\n};\n\nexport type AdaptyUiOnboardingMeta = {\n onboardingId: string;\n screenClientId: string;\n screenIndex: number;\n totalScreens: number;\n};\n\nexport type AdaptyUiOnboardingStateParams = {\n id: string;\n value: string;\n label: string;\n};\n\n/**\n * Paywall event handlers configuration\n *\n * @see {@link https://adapty.io/docs/capacitor-handling-events | [DOC] Handling View Events}\n */\nexport interface EventHandlers {\n /**\n * Called when a user taps the close button on the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n */\n onCloseButtonPress: () => EventHandlerResult;\n /**\n * Called when a user navigates back on Android\n *\n * If you return `true`, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n */\n onAndroidSystemBack: () => EventHandlerResult;\n /**\n * Called when a user taps an URL in the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onUrlPress: (url: string) => EventHandlerResult;\n /**\n * Called when a user performs a custom action in the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onCustomAction: (actionId: string) => EventHandlerResult;\n /**\n * Called when a user selects a product in the paywall view\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onProductSelected: (productId: string) => EventHandlerResult;\n /**\n * Called when a purchase process starts\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onPurchaseStarted: (product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called when the purchase succeeds, the user cancels their purchase, or the purchase appears to be pending\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * We strongly recommend returning `purchaseResult.type !== 'user_cancelled'` in this case.\n * @default `purchaseResult.type !== 'user_cancelled'`\n *\n * @param purchaseResult - object, which provides details about the purchase.\n * If the result is `'success'`, it also includes the updated user's profile.\n */\n onPurchaseCompleted: (purchaseResult: AdaptyPurchaseResult, product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called if a purchase fails after a user taps the purchase button\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onPurchaseFailed: (error: AdaptyError, product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called when a user taps the restore button in the paywall view\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onRestoreStarted: () => EventHandlerResult;\n /**\n * Called when a purchase is completed\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n *\n * @param profile - updated user profile\n */\n onRestoreCompleted: (profile: AdaptyProfile) => EventHandlerResult;\n /**\n * Called if a restore fails after a user taps the restore button\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onRestoreFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called when the paywall view appears\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onAppeared: () => EventHandlerResult;\n /**\n * Called when the paywall view disappears\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onDisappeared: () => EventHandlerResult;\n /**\n * Called if a paywall view fails to render.\n * This should not ever happen, but if it does, feel free to report it to us.\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default true\n *\n * @param error - AdaptyError object with error code and message\n */\n onRenderingFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called if a product list fails to load on a presented view,\n * for example, if there is no internet connection\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onLoadingProductsFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called when web payment navigation finishes\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onWebPaymentNavigationFinished: (product?: AdaptyPaywallProduct, error?: AdaptyError) => EventHandlerResult;\n}\n\n/**\n * Default event handlers that provide standard closing behavior\n */\nexport const DEFAULT_EVENT_HANDLERS: EventHandlers = {\n onCloseButtonPress: () => true,\n onAndroidSystemBack: () => true,\n onUrlPress: (url: string) => {\n if (typeof window !== 'undefined') {\n try {\n window.open(new URL(url), '_blank');\n } catch {\n Log.warn('onUrlPress', () => `Invalid URL: ${url}`);\n }\n }\n return false;\n },\n onCustomAction: () => false,\n onProductSelected: () => false,\n onPurchaseStarted: () => false,\n onPurchaseCompleted: (purchaseResult: AdaptyPurchaseResult) => purchaseResult?.type !== 'user_cancelled',\n onPurchaseFailed: () => false,\n onRestoreStarted: () => false,\n onRestoreCompleted: () => true,\n onRestoreFailed: () => false,\n onAppeared: () => false,\n onDisappeared: () => false,\n onRenderingFailed: () => true,\n onLoadingProductsFailed: () => false,\n onWebPaymentNavigationFinished: () => false,\n};\n\nexport type OnboardingStateUpdatedAction =\n | {\n elementId: string;\n elementType: 'select';\n value: AdaptyUiOnboardingStateParams;\n }\n | {\n elementId: string;\n elementType: 'multi_select';\n value: AdaptyUiOnboardingStateParams[];\n }\n | {\n elementId: string;\n elementType: 'input';\n value: { type: 'text' | 'email'; value: string } | { type: 'number'; value: number };\n }\n | {\n elementId: string;\n elementType: 'date_picker';\n value: {\n day?: number;\n month?: number;\n year?: number;\n };\n };\n\nexport interface AdaptyUiView {\n id: string;\n}\n\nexport interface AdaptyUiMediaCache {\n memoryStorageTotalCostLimit?: number;\n memoryStorageCountLimit?: number;\n diskStorageSizeLimit?: number;\n}\n\nexport interface AdaptyUiDialogConfig {\n /**\n * The action title to display as part of the dialog. If you provide two actions,\n * be sure `primaryAction` cancels the operation and leaves things unchanged.\n */\n primaryActionTitle: string;\n /**\n * The secondary action title to display as part of the dialog.\n */\n secondaryActionTitle?: string;\n /**\n * The title of the dialog.\n */\n title?: string;\n /**\n * Descriptive text that provides additional details about the reason for the dialog.\n */\n content?: string;\n}\n\nexport const AdaptyUiDialogActionType = Object.freeze({\n primary: 'primary',\n secondary: 'secondary',\n});\n\nexport type AdaptyUiDialogActionType = (typeof AdaptyUiDialogActionType)[keyof typeof AdaptyUiDialogActionType];\n\n/**\n * Additional options for creating a paywall view\n *\n * @see {@link https://adapty.io/docs/capacitor-present-paywalls | [DOC] Creating Paywall View}\n */\nexport interface CreatePaywallViewParamsInput {\n /**\n * `true` if you want to prefetch products before presenting a paywall view.\n */\n prefetchProducts?: boolean;\n /**\n * This value limits the timeout (in milliseconds) for this method.\n */\n loadTimeoutMs?: number;\n /**\n * If you are going to use custom tags functionality, pass an object with tags and corresponding replacement values\n *\n * ```\n * {\n * 'USERNAME': 'Bruce',\n * 'CITY': 'Philadelphia'\n * }\n * ```\n */\n customTags?: Record<string, string>;\n /**\n * If you are going to use custom timer functionality, pass an object with timer ids and corresponding dates the timers should end at\n */\n customTimers?: Record<string, Date>;\n /**\n * Use this when you need to override paywall assets with your own\n */\n customAssets?: Record<string, AdaptyCustomAsset>;\n /**\n * Provide per-product purchase parameters keyed by Adapty product identifier\n */\n productPurchaseParams?: ProductPurchaseParams;\n}\n\n/**\n * Additional options for creating an onboarding view\n *\n * @see {@link https://adapty.io/docs/capacitor-get-onboardings | [DOC] Creating Onboarding View}\n */\nexport interface CreateOnboardingViewParamsInput {\n /**\n * If you want to change the presentation behavior of external URLs, pass a preferred value.\n *\n * @default {@link WebPresentation.BrowserInApp}\n */\n externalUrlsPresentation?: WebPresentation;\n}\n\nexport interface OnboardingEventHandlers {\n onClose: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onCustom: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onPaywall: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onStateUpdated: (action: OnboardingStateUpdatedAction, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onFinishedLoading: (meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onAnalytics: (\n event: {\n name: string;\n /**\n * @deprecated Use `elementId` instead\n */\n element_id?: string;\n elementId?: string;\n reply?: string;\n },\n meta: AdaptyUiOnboardingMeta,\n ) => EventHandlerResult;\n onError: (error: AdaptyError) => EventHandlerResult;\n}\n\nexport const DEFAULT_ONBOARDING_EVENT_HANDLERS: Partial<OnboardingEventHandlers> = {\n onClose: () => true,\n};\n\n/**\n * iOS presentation style for paywall and onboarding views\n * @platform ios\n */\nexport type AdaptyIOSPresentationStyle = 'full_screen' | 'page_sheet';\n"]}
@@ -1,2 +1,2 @@
1
- declare const _default: "3.16.0-beta.0";
1
+ declare const _default: "3.16.0";
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- export default '3.16.0-beta.0';
1
+ export default '3.16.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAe,eAAe,CAAC","sourcesContent":["export default '3.16.0-beta.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAe,QAAQ,CAAC","sourcesContent":["export default '3.16.0';\n"]}
@@ -1746,7 +1746,7 @@ const consoleLogSink = {
1746
1746
  },
1747
1747
  };
1748
1748
 
1749
- var version = '3.16.0-beta.0';
1749
+ var version = '3.16.0';
1750
1750
 
1751
1751
  class Log {
1752
1752
  // Formats a message for logging
@@ -4425,7 +4425,12 @@ const DEFAULT_EVENT_HANDLERS = {
4425
4425
  onAndroidSystemBack: () => true,
4426
4426
  onUrlPress: (url) => {
4427
4427
  if (typeof window !== 'undefined') {
4428
- window.open(url, '_blank');
4428
+ try {
4429
+ window.open(new URL(url), '_blank');
4430
+ }
4431
+ catch (_a) {
4432
+ Log.warn('onUrlPress', () => `Invalid URL: ${url}`);
4433
+ }
4429
4434
  }
4430
4435
  return false;
4431
4436
  },