@adapty/capacitor 3.12.0-beta.1 → 3.15.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.
- package/AdaptyCapacitor.podspec +3 -3
- package/Package.swift +1 -1
- package/README.md +24 -11
- package/android/build.gradle +4 -3
- package/android/src/main/kotlin/com/adapty/plugin/capacitor/AdaptyCapacitorImplementation.kt +2 -0
- package/dist/esm/adapty.d.ts +2 -1
- package/dist/esm/adapty.js +2 -2
- package/dist/esm/adapty.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/shared/coders/adapty-configuration.js +12 -17
- package/dist/esm/shared/coders/adapty-configuration.js.map +1 -1
- package/dist/esm/shared/coders/adapty-purchase-result.js +3 -3
- package/dist/esm/shared/coders/adapty-purchase-result.js.map +1 -1
- package/dist/esm/shared/coders/adapty-ui-create-onboarding-view-params.d.ts +8 -0
- package/dist/esm/shared/coders/adapty-ui-create-onboarding-view-params.js +10 -0
- package/dist/esm/shared/coders/adapty-ui-create-onboarding-view-params.js.map +1 -0
- package/dist/esm/shared/coders/adapty-ui-create-paywall-view-params.d.ts +18 -0
- package/dist/esm/shared/coders/adapty-ui-create-paywall-view-params.js +142 -0
- package/dist/esm/shared/coders/adapty-ui-create-paywall-view-params.js.map +1 -0
- package/dist/esm/shared/coders/parse-onboarding.d.ts +3 -0
- package/dist/esm/shared/coders/parse-onboarding.js +86 -0
- package/dist/esm/shared/coders/parse-onboarding.js.map +1 -0
- package/dist/esm/shared/coders/parse-paywall.d.ts +4 -0
- package/dist/esm/shared/coders/parse-paywall.js +141 -0
- package/dist/esm/shared/coders/parse-paywall.js.map +1 -0
- package/dist/esm/shared/coders/parse.d.ts +0 -2
- package/dist/esm/shared/coders/parse.js +0 -75
- package/dist/esm/shared/coders/parse.js.map +1 -1
- package/dist/esm/shared/coders/utils.d.ts +18 -0
- package/dist/esm/shared/coders/utils.js +50 -0
- package/dist/esm/shared/coders/utils.js.map +1 -0
- package/dist/esm/shared/types/index.d.ts +6 -0
- package/dist/esm/shared/types/index.js +5 -0
- package/dist/esm/shared/types/index.js.map +1 -1
- package/dist/esm/shared/types/inputs.d.ts +12 -4
- package/dist/esm/shared/types/inputs.js.map +1 -1
- package/dist/esm/shared/types/onboarding-events.d.ts +60 -0
- package/dist/esm/shared/types/onboarding-events.js +11 -0
- package/dist/esm/shared/types/onboarding-events.js.map +1 -0
- package/dist/esm/shared/types/paywall-events.d.ts +84 -0
- package/dist/esm/shared/types/paywall-events.js +16 -0
- package/dist/esm/shared/types/paywall-events.js.map +1 -0
- package/dist/esm/types/adapty-plugin.d.ts +2 -1
- package/dist/esm/types/adapty-plugin.js.map +1 -1
- package/dist/esm/ui-builder/base-view-emitter.d.ts +14 -20
- package/dist/esm/ui-builder/base-view-emitter.js +95 -73
- package/dist/esm/ui-builder/base-view-emitter.js.map +1 -1
- package/dist/esm/ui-builder/create-onboarding-view.d.ts +32 -0
- package/dist/esm/ui-builder/create-onboarding-view.js +36 -0
- package/dist/esm/ui-builder/create-onboarding-view.js.map +1 -0
- package/dist/esm/ui-builder/create-paywall-view.d.ts +25 -0
- package/dist/esm/ui-builder/create-paywall-view.js +29 -0
- package/dist/esm/ui-builder/create-paywall-view.js.map +1 -0
- package/dist/esm/ui-builder/index.d.ts +6 -37
- package/dist/esm/ui-builder/index.js +4 -41
- package/dist/esm/ui-builder/index.js.map +1 -1
- package/dist/esm/ui-builder/onboarding-view-controller.d.ts +3 -2
- package/dist/esm/ui-builder/onboarding-view-controller.js +11 -6
- package/dist/esm/ui-builder/onboarding-view-controller.js.map +1 -1
- package/dist/esm/ui-builder/onboarding-view-emitter.d.ts +10 -24
- package/dist/esm/ui-builder/onboarding-view-emitter.js +49 -56
- package/dist/esm/ui-builder/onboarding-view-emitter.js.map +1 -1
- package/dist/esm/ui-builder/paywall-view-controller.d.ts +1 -0
- package/dist/esm/ui-builder/paywall-view-controller.js +12 -41
- package/dist/esm/ui-builder/paywall-view-controller.js.map +1 -1
- package/dist/esm/ui-builder/paywall-view-emitter.d.ts +8 -28
- package/dist/esm/ui-builder/paywall-view-emitter.js +86 -118
- package/dist/esm/ui-builder/paywall-view-emitter.js.map +1 -1
- package/dist/esm/ui-builder/types.d.ts +84 -4
- package/dist/esm/ui-builder/types.js +3 -3
- package/dist/esm/ui-builder/types.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/plugin.cjs.js +938 -594
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +938 -594
- package/dist/plugin.js.map +1 -1
- package/package.json +2 -2
|
@@ -93,81 +93,6 @@ export function parseCommonEvent(event, input, ctx) {
|
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
export function parsePaywallEvent(input, ctx) {
|
|
97
|
-
var _a, _b, _c, _d;
|
|
98
|
-
const log = ctx === null || ctx === void 0 ? void 0 : ctx.decode({ methodName: 'parsePaywallEvent' });
|
|
99
|
-
log === null || log === void 0 ? void 0 : log.start(() => ({ input }));
|
|
100
|
-
let obj;
|
|
101
|
-
try {
|
|
102
|
-
obj = JSON.parse(input);
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
throw AdaptyError.failedToDecode(`Failed to decode event: ${error === null || error === void 0 ? void 0 : error.message}`);
|
|
106
|
-
}
|
|
107
|
-
const result = {};
|
|
108
|
-
if (obj.hasOwnProperty('id')) {
|
|
109
|
-
result['id'] = obj['id'];
|
|
110
|
-
}
|
|
111
|
-
if (obj.hasOwnProperty('profile')) {
|
|
112
|
-
result['profile'] = (_a = getCoder('AdaptyProfile', ctx)) === null || _a === void 0 ? void 0 : _a.decode(obj['profile']);
|
|
113
|
-
}
|
|
114
|
-
if (obj.hasOwnProperty('product')) {
|
|
115
|
-
result['product'] = (_b = getCoder('AdaptyPaywallProduct', ctx)) === null || _b === void 0 ? void 0 : _b.decode(obj['product']);
|
|
116
|
-
}
|
|
117
|
-
if (obj.hasOwnProperty('error')) {
|
|
118
|
-
result['error'] = (_c = getCoder('AdaptyError', ctx)) === null || _c === void 0 ? void 0 : _c.decode(obj['error']);
|
|
119
|
-
}
|
|
120
|
-
if (obj.hasOwnProperty('action')) {
|
|
121
|
-
result['action'] = obj['action'];
|
|
122
|
-
}
|
|
123
|
-
if (obj.hasOwnProperty('view')) {
|
|
124
|
-
result['view'] = obj['view'];
|
|
125
|
-
}
|
|
126
|
-
if (obj.hasOwnProperty('product_id')) {
|
|
127
|
-
result['product_id'] = obj['product_id'];
|
|
128
|
-
}
|
|
129
|
-
if (obj.hasOwnProperty('purchased_result')) {
|
|
130
|
-
result['purchased_result'] = (_d = getCoder('AdaptyPurchaseResult', ctx)) === null || _d === void 0 ? void 0 : _d.decode(obj['purchased_result']);
|
|
131
|
-
}
|
|
132
|
-
return result;
|
|
133
|
-
}
|
|
134
|
-
export function parseOnboardingEvent(input, ctx) {
|
|
135
|
-
var _a, _b, _c;
|
|
136
|
-
const log = ctx === null || ctx === void 0 ? void 0 : ctx.decode({ methodName: 'parseOnboardingEvent' });
|
|
137
|
-
log === null || log === void 0 ? void 0 : log.start(() => ({ input }));
|
|
138
|
-
let obj;
|
|
139
|
-
try {
|
|
140
|
-
obj = JSON.parse(input);
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
throw AdaptyError.failedToDecode(`Failed to decode event: ${error === null || error === void 0 ? void 0 : error.message}`);
|
|
144
|
-
}
|
|
145
|
-
const result = {};
|
|
146
|
-
if (obj.hasOwnProperty('view')) {
|
|
147
|
-
result['view'] = obj['view'];
|
|
148
|
-
}
|
|
149
|
-
if (obj.hasOwnProperty('meta')) {
|
|
150
|
-
result['meta'] = (_a = getCoder('AdaptyUiOnboardingMeta', ctx)) === null || _a === void 0 ? void 0 : _a.decode(obj['meta']);
|
|
151
|
-
}
|
|
152
|
-
if (obj.hasOwnProperty('event')) {
|
|
153
|
-
result['event'] = obj['event'];
|
|
154
|
-
}
|
|
155
|
-
if (obj.hasOwnProperty('action_id')) {
|
|
156
|
-
result['id'] = obj['action_id'];
|
|
157
|
-
}
|
|
158
|
-
if (obj.hasOwnProperty('action')) {
|
|
159
|
-
try {
|
|
160
|
-
result['action'] = (_b = getCoder('AdaptyUiOnboardingStateUpdatedAction', ctx)) === null || _b === void 0 ? void 0 : _b.decode(obj['action']);
|
|
161
|
-
}
|
|
162
|
-
catch (_e) {
|
|
163
|
-
result['action'] = obj['action'];
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (obj.hasOwnProperty('error')) {
|
|
167
|
-
result['error'] = (_c = getCoder('AdaptyError', ctx)) === null || _c === void 0 ? void 0 : _c.decode(obj['error']);
|
|
168
|
-
}
|
|
169
|
-
return result;
|
|
170
|
-
}
|
|
171
96
|
function getCoder(type, ctx) {
|
|
172
97
|
ctx === null || ctx === void 0 ? void 0 : ctx.stack;
|
|
173
98
|
switch (type) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/shared/coders/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA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;YAClC,OAAO,IAAI,kCAAkC,EAAE,CAAC;QAClD,KAAK,sCAAsC;YACzC,OAAO,IAAI,yCAAyC,EAAE,CAAC;QACzD,KAAK,aAAa;YAChB,OAAO,IAAI,gBAAgB,EAAE,CAAC;QAChC,KAAK,6BAA6B;YAChC,OAAO,IAAI,UAAU,CAAC,yBAAgC,CAAC,CAAC;QAC1D,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC;KACf;IACD,aAAa;IACb,MAAM,WAAW,CAAC,cAAc,CAC9B,8EAA8E,IAAI,EAAE,CACrF,CAAC;AACJ,CAAC","sourcesContent":["import { AdaptyError } from '../adapty-error';\nimport { LogContext } from '../logger';\nimport { AdaptyNativeErrorCoder } from './adapty-native-error';\nimport { AdaptyPaywallCoder } from './adapty-paywall';\nimport { AdaptyPaywallProductCoder } from './adapty-paywall-product';\nimport { AdaptyProfileCoder } from './adapty-profile';\nimport { ArrayCoder } from './array';\nimport { BridgeErrorCoder } from './bridge-error';\nimport { ErrorConverter } from './error-coder';\nimport type { Converter } from './types';\nimport { AdaptyRemoteConfigCoder } from './adapty-remote-config';\nimport { AdaptyPaywallBuilderCoder } from './adapty-paywall-builder';\nimport { AdaptyPurchaseResultCoder } from './adapty-purchase-result';\nimport { AdaptyOnboardingCoder } from './adapty-onboarding';\nimport { AdaptyUiOnboardingMetaCoder } from './adapty-ui-onboarding-meta';\nimport { AdaptyUiOnboardingStateParamsCoder } from './adapty-ui-onboarding-state-params';\nimport { AdaptyUiOnboardingStateUpdatedActionCoder } from './adapty-ui-onboarding-state-updated-action';\nimport { AdaptyInstallationStatusCoder } from './adapty-installation-status';\nimport { AdaptyInstallationDetailsCoder } from './adapty-installation-details';\n\nconst AdaptyTypes = [\n 'AdaptyError',\n 'AdaptyProfile',\n 'AdaptyPurchaseResult',\n 'AdaptyPaywall',\n 'AdaptyPaywallProduct',\n 'AdaptyOnboarding',\n 'AdaptyRemoteConfig',\n 'AdaptyPaywallBuilder',\n 'AdaptyInstallationStatus',\n 'AdaptyInstallationDetails',\n 'AdaptyUiView',\n 'AdaptyUiDialogActionType',\n 'AdaptyUiOnboardingMeta',\n 'AdaptyUiOnboardingStateParams',\n 'AdaptyUiOnboardingStateUpdatedAction',\n 'Array<AdaptyPaywallProduct>',\n 'BridgeError',\n 'String',\n 'Boolean',\n 'Void',\n] as const;\n\nexport type AdaptyType = (typeof AdaptyTypes)[number];\n\ninterface AdaptyResult<T> {\n success?: T;\n error?: AdaptyResultError;\n}\n\ninterface AdaptyResultError {\n adaptyCode: number;\n message: string;\n detail?: string;\n}\n\nexport function parseMethodResult<T>(\n input: string,\n resultType: AdaptyType,\n ctx?: LogContext,\n): T {\n const log = ctx?.decode({ methodName: 'parseMethodResult' });\n log?.start(() => ({ input }));\n\n let obj: AdaptyResult<unknown>;\n\n // Attempt to parse the input into a JSON object\n try {\n obj = JSON.parse(input);\n } catch (error) {\n const adaptyError = AdaptyError.failedToDecode(\n `Failed to decode native response. JSON.parse raised an error: ${\n (error as Error)?.message || ''\n }`,\n );\n\n log?.failed(() => ({ adaptyError }));\n throw adaptyError;\n }\n\n if (obj.hasOwnProperty('success')) {\n if (\n [\n 'String',\n 'Boolean',\n 'Void',\n 'AdaptyUiView',\n 'AdaptyUiDialogActionType',\n ].includes(resultType)\n ) {\n return obj.success as T;\n }\n\n const coder = getCoder(resultType, ctx);\n return coder?.decode(obj.success);\n } else if (obj.hasOwnProperty('error')) {\n const coder = getCoder('AdaptyError', ctx);\n const errorData = coder?.decode(obj.error);\n throw (coder as ErrorConverter<any>).getError(errorData);\n } else {\n const adaptyError = AdaptyError.failedToDecode(\n `Failed to decode native response. Response does not have expected \"success\" or \"error\" property`,\n );\n log?.failed(() => ({ adaptyError }));\n throw adaptyError;\n }\n}\n\nexport function parseCommonEvent(\n event: string,\n input: string,\n ctx?: LogContext,\n) {\n let obj: Record<string, unknown>;\n try {\n obj = JSON.parse(input);\n } catch (error) {\n throw AdaptyError.failedToDecode(\n `Failed to decode event: ${(error as Error)?.message}`,\n );\n }\n switch (event) {\n case 'did_load_latest_profile':\n return getCoder('AdaptyProfile', ctx)?.decode(obj['profile']);\n case 'on_installation_details_success':\n return getCoder('AdaptyInstallationDetails', ctx)?.decode(obj['details']);\n case 'on_installation_details_fail':\n return getCoder('AdaptyError', ctx)?.decode(obj['error']);\n default:\n return null;\n }\n}\n\nexport function parsePaywallEvent(\n input: string,\n ctx?: LogContext,\n): Record<string, any> {\n const log = ctx?.decode({ methodName: 'parsePaywallEvent' });\n log?.start(() => ({ input }));\n\n let obj: Record<string, unknown>;\n try {\n obj = JSON.parse(input);\n } catch (error) {\n throw AdaptyError.failedToDecode(\n `Failed to decode event: ${(error as Error)?.message}`,\n );\n }\n\n const result: Record<string, any> = {};\n\n if (obj.hasOwnProperty('id')) {\n result['id'] = obj['id'];\n }\n if (obj.hasOwnProperty('profile')) {\n result['profile'] = getCoder('AdaptyProfile', ctx)?.decode(obj['profile']);\n }\n if (obj.hasOwnProperty('product')) {\n result['product'] = getCoder('AdaptyPaywallProduct', ctx)?.decode(\n obj['product'],\n );\n }\n if (obj.hasOwnProperty('error')) {\n result['error'] = getCoder('AdaptyError', ctx)?.decode(obj['error']);\n }\n if (obj.hasOwnProperty('action')) {\n result['action'] = obj['action'];\n }\n if (obj.hasOwnProperty('view')) {\n result['view'] = obj['view'];\n }\n if (obj.hasOwnProperty('product_id')) {\n result['product_id'] = obj['product_id'];\n }\n if (obj.hasOwnProperty('purchased_result')) {\n result['purchased_result'] = getCoder('AdaptyPurchaseResult', ctx)?.decode(\n obj['purchased_result'],\n );\n }\n\n return result;\n}\n\nexport function parseOnboardingEvent(\n input: string,\n ctx?: LogContext,\n): Record<string, any> {\n const log = ctx?.decode({ methodName: 'parseOnboardingEvent' });\n log?.start(() => ({ input }));\n\n let obj: Record<string, unknown>;\n try {\n obj = JSON.parse(input);\n } catch (error) {\n throw AdaptyError.failedToDecode(\n `Failed to decode event: ${(error as Error)?.message}`,\n );\n }\n\n const result: Record<string, any> = {};\n\n if (obj.hasOwnProperty('view')) {\n result['view'] = obj['view'];\n }\n\n if (obj.hasOwnProperty('meta')) {\n result['meta'] = getCoder('AdaptyUiOnboardingMeta', ctx)?.decode(\n obj['meta'],\n );\n }\n\n if (obj.hasOwnProperty('event')) {\n result['event'] = obj['event'];\n }\n\n if (obj.hasOwnProperty('action_id')) {\n result['id'] = obj['action_id'];\n }\n\n if (obj.hasOwnProperty('action')) {\n try {\n result['action'] = getCoder(\n 'AdaptyUiOnboardingStateUpdatedAction',\n ctx,\n )?.decode(obj['action']);\n } catch (_e) {\n result['action'] = obj['action'];\n }\n }\n\n if (obj.hasOwnProperty('error')) {\n result['error'] = getCoder('AdaptyError', ctx)?.decode(obj['error']);\n }\n\n return result;\n}\n\nfunction getCoder(\n type: AdaptyType,\n ctx?: LogContext,\n): Converter<any, any> | ErrorConverter<any> | null {\n ctx?.stack;\n\n switch (type as AdaptyType) {\n case 'AdaptyError':\n return new AdaptyNativeErrorCoder();\n case 'AdaptyProfile':\n return new AdaptyProfileCoder();\n case 'AdaptyPaywall':\n return new AdaptyPaywallCoder();\n case 'AdaptyPaywallProduct':\n return new AdaptyPaywallProductCoder();\n case 'AdaptyRemoteConfig':\n return new AdaptyRemoteConfigCoder();\n case 'AdaptyPaywallBuilder':\n return new AdaptyPaywallBuilderCoder();\n case 'AdaptyOnboarding':\n return new AdaptyOnboardingCoder();\n case 'AdaptyPurchaseResult':\n return new AdaptyPurchaseResultCoder();\n case 'AdaptyInstallationStatus':\n return new AdaptyInstallationStatusCoder();\n case 'AdaptyInstallationDetails':\n return new AdaptyInstallationDetailsCoder();\n case 'AdaptyUiOnboardingMeta':\n return new AdaptyUiOnboardingMetaCoder();\n case 'AdaptyUiOnboardingStateParams':\n return new AdaptyUiOnboardingStateParamsCoder();\n case 'AdaptyUiOnboardingStateUpdatedAction':\n return new AdaptyUiOnboardingStateUpdatedActionCoder();\n case 'BridgeError':\n return new BridgeErrorCoder();\n case 'Array<AdaptyPaywallProduct>':\n return new ArrayCoder(AdaptyPaywallProductCoder as any);\n case 'String':\n return null;\n }\n // @ts-ignore\n throw AdaptyError.failedToDecode(\n `Failed to decode native response. Response has unexpected \"type\" property: ${type}`,\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/shared/coders/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AACzF,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AACxG,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAE/E,MAAM,WAAW,GAAG;IAClB,aAAa;IACb,eAAe;IACf,sBAAsB;IACtB,eAAe;IACf,sBAAsB;IACtB,kBAAkB;IAClB,oBAAoB;IACpB,sBAAsB;IACtB,0BAA0B;IAC1B,2BAA2B;IAC3B,cAAc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from '../adapty-error';\nimport { LogContext } from '../logger';\nimport { AdaptyNativeErrorCoder } from './adapty-native-error';\nimport { AdaptyPaywallCoder } from './adapty-paywall';\nimport { AdaptyPaywallProductCoder } from './adapty-paywall-product';\nimport { AdaptyProfileCoder } from './adapty-profile';\nimport { ArrayCoder } from './array';\nimport { BridgeErrorCoder } from './bridge-error';\nimport { ErrorConverter } from './error-coder';\nimport type { Converter } from './types';\nimport { AdaptyRemoteConfigCoder } from './adapty-remote-config';\nimport { AdaptyPaywallBuilderCoder } from './adapty-paywall-builder';\nimport { AdaptyPurchaseResultCoder } from './adapty-purchase-result';\nimport { AdaptyOnboardingCoder } from './adapty-onboarding';\nimport { AdaptyUiOnboardingMetaCoder } from './adapty-ui-onboarding-meta';\nimport { AdaptyUiOnboardingStateParamsCoder } from './adapty-ui-onboarding-state-params';\nimport { AdaptyUiOnboardingStateUpdatedActionCoder } from './adapty-ui-onboarding-state-updated-action';\nimport { AdaptyInstallationStatusCoder } from './adapty-installation-status';\nimport { AdaptyInstallationDetailsCoder } from './adapty-installation-details';\n\nconst AdaptyTypes = [\n 'AdaptyError',\n 'AdaptyProfile',\n 'AdaptyPurchaseResult',\n 'AdaptyPaywall',\n 'AdaptyPaywallProduct',\n 'AdaptyOnboarding',\n 'AdaptyRemoteConfig',\n 'AdaptyPaywallBuilder',\n 'AdaptyInstallationStatus',\n 'AdaptyInstallationDetails',\n 'AdaptyUiView',\n 'AdaptyUiDialogActionType',\n 'AdaptyUiOnboardingMeta',\n 'AdaptyUiOnboardingStateParams',\n 'AdaptyUiOnboardingStateUpdatedAction',\n 'Array<AdaptyPaywallProduct>',\n 'BridgeError',\n 'String',\n 'Boolean',\n 'Void',\n] as const;\n\nexport type AdaptyType = (typeof AdaptyTypes)[number];\n\ninterface AdaptyResult<T> {\n success?: T;\n error?: AdaptyResultError;\n}\n\ninterface AdaptyResultError {\n adaptyCode: number;\n message: string;\n detail?: string;\n}\n\nexport function parseMethodResult<T>(\n input: string,\n resultType: AdaptyType,\n ctx?: LogContext,\n): T {\n const log = ctx?.decode({ methodName: 'parseMethodResult' });\n log?.start(() => ({ input }));\n\n let obj: AdaptyResult<unknown>;\n\n // Attempt to parse the input into a JSON object\n try {\n obj = JSON.parse(input);\n } catch (error) {\n const adaptyError = AdaptyError.failedToDecode(\n `Failed to decode native response. JSON.parse raised an error: ${\n (error as Error)?.message || ''\n }`,\n );\n\n log?.failed(() => ({ adaptyError }));\n throw adaptyError;\n }\n\n if (obj.hasOwnProperty('success')) {\n if (\n [\n 'String',\n 'Boolean',\n 'Void',\n 'AdaptyUiView',\n 'AdaptyUiDialogActionType',\n ].includes(resultType)\n ) {\n return obj.success as T;\n }\n\n const coder = getCoder(resultType, ctx);\n return coder?.decode(obj.success);\n } else if (obj.hasOwnProperty('error')) {\n const coder = getCoder('AdaptyError', ctx);\n const errorData = coder?.decode(obj.error);\n throw (coder as ErrorConverter<any>).getError(errorData);\n } else {\n const adaptyError = AdaptyError.failedToDecode(\n `Failed to decode native response. Response does not have expected \"success\" or \"error\" property`,\n );\n log?.failed(() => ({ adaptyError }));\n throw adaptyError;\n }\n}\n\nexport function parseCommonEvent(\n event: string,\n input: string,\n ctx?: LogContext,\n) {\n let obj: Record<string, unknown>;\n try {\n obj = JSON.parse(input);\n } catch (error) {\n throw AdaptyError.failedToDecode(\n `Failed to decode event: ${(error as Error)?.message}`,\n );\n }\n switch (event) {\n case 'did_load_latest_profile':\n return getCoder('AdaptyProfile', ctx)?.decode(obj['profile']);\n case 'on_installation_details_success':\n return getCoder('AdaptyInstallationDetails', ctx)?.decode(obj['details']);\n case 'on_installation_details_fail':\n return getCoder('AdaptyError', ctx)?.decode(obj['error']);\n default:\n return null;\n }\n}\n\nfunction getCoder(\n type: AdaptyType,\n ctx?: LogContext,\n): Converter<any, any> | ErrorConverter<any> | null {\n ctx?.stack;\n\n switch (type as AdaptyType) {\n case 'AdaptyError':\n return new AdaptyNativeErrorCoder();\n case 'AdaptyProfile':\n return new AdaptyProfileCoder();\n case 'AdaptyPaywall':\n return new AdaptyPaywallCoder();\n case 'AdaptyPaywallProduct':\n return new AdaptyPaywallProductCoder();\n case 'AdaptyRemoteConfig':\n return new AdaptyRemoteConfigCoder();\n case 'AdaptyPaywallBuilder':\n return new AdaptyPaywallBuilderCoder();\n case 'AdaptyOnboarding':\n return new AdaptyOnboardingCoder();\n case 'AdaptyPurchaseResult':\n return new AdaptyPurchaseResultCoder();\n case 'AdaptyInstallationStatus':\n return new AdaptyInstallationStatusCoder();\n case 'AdaptyInstallationDetails':\n return new AdaptyInstallationDetailsCoder();\n case 'AdaptyUiOnboardingMeta':\n return new AdaptyUiOnboardingMetaCoder();\n case 'AdaptyUiOnboardingStateParams':\n return new AdaptyUiOnboardingStateParamsCoder();\n case 'AdaptyUiOnboardingStateUpdatedAction':\n return new AdaptyUiOnboardingStateUpdatedActionCoder();\n case 'BridgeError':\n return new BridgeErrorCoder();\n case 'Array<AdaptyPaywallProduct>':\n return new ArrayCoder(AdaptyPaywallProductCoder as any);\n case 'String':\n return null;\n }\n // @ts-ignore\n throw AdaptyError.failedToDecode(\n `Failed to decode native response. Response has unexpected \"type\" property: ${type}`,\n );\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FileLocation } from '../types/inputs';
|
|
2
|
+
export declare const formatDateUTC: (date: Date) => string;
|
|
3
|
+
export declare const colorToHex: {
|
|
4
|
+
fromARGB(value: number): string;
|
|
5
|
+
fromRGBA(value: number): string;
|
|
6
|
+
fromRGB(value: number): string;
|
|
7
|
+
};
|
|
8
|
+
export declare const extractBase64Data: (input: string) => string;
|
|
9
|
+
type PlatformSelector<T> = {
|
|
10
|
+
ios: T;
|
|
11
|
+
android: T;
|
|
12
|
+
};
|
|
13
|
+
export declare const resolveAssetId: (asset: {
|
|
14
|
+
relativeAssetPath: string;
|
|
15
|
+
} | {
|
|
16
|
+
fileLocation: FileLocation;
|
|
17
|
+
}, select: <T>(spec: PlatformSelector<T>) => T | undefined) => string;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const formatDateUTC = (date) => {
|
|
2
|
+
const pad = (num, digits = 2) => {
|
|
3
|
+
const str = num.toString();
|
|
4
|
+
const paddingLength = digits - str.length;
|
|
5
|
+
return paddingLength > 0 ? '0'.repeat(paddingLength) + str : str;
|
|
6
|
+
};
|
|
7
|
+
const year = date.getUTCFullYear();
|
|
8
|
+
const month = pad(date.getUTCMonth() + 1);
|
|
9
|
+
const day = pad(date.getUTCDate());
|
|
10
|
+
const hours = pad(date.getUTCHours());
|
|
11
|
+
const minutes = pad(date.getUTCMinutes());
|
|
12
|
+
const seconds = pad(date.getUTCSeconds());
|
|
13
|
+
const millis = pad(date.getUTCMilliseconds(), 3);
|
|
14
|
+
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${millis}Z`;
|
|
15
|
+
};
|
|
16
|
+
export const colorToHex = {
|
|
17
|
+
fromARGB(value) {
|
|
18
|
+
const hex = value.toString(16).padStart(8, '0');
|
|
19
|
+
return `#${hex.slice(2)}${hex.slice(0, 2)}`;
|
|
20
|
+
},
|
|
21
|
+
fromRGBA(value) {
|
|
22
|
+
return `#${value.toString(16).padStart(8, '0')}`;
|
|
23
|
+
},
|
|
24
|
+
fromRGB(value) {
|
|
25
|
+
return `#${value.toString(16).padStart(6, '0')}ff`;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const extractBase64Data = (input) => {
|
|
29
|
+
const commaIndex = input.indexOf(',');
|
|
30
|
+
if (input.startsWith('data:') && commaIndex !== -1) {
|
|
31
|
+
return input.slice(commaIndex + 1);
|
|
32
|
+
}
|
|
33
|
+
return input;
|
|
34
|
+
};
|
|
35
|
+
export const resolveAssetId = (asset, select) => {
|
|
36
|
+
if ('relativeAssetPath' in asset) {
|
|
37
|
+
return (select({
|
|
38
|
+
ios: asset.relativeAssetPath,
|
|
39
|
+
android: `${asset.relativeAssetPath}a`,
|
|
40
|
+
}) || '');
|
|
41
|
+
}
|
|
42
|
+
const fileLocation = asset.fileLocation;
|
|
43
|
+
return (select({
|
|
44
|
+
ios: fileLocation.ios.fileName,
|
|
45
|
+
android: 'relativeAssetPath' in fileLocation.android
|
|
46
|
+
? `${fileLocation.android.relativeAssetPath}a`
|
|
47
|
+
: `${fileLocation.android.rawResName}r`,
|
|
48
|
+
}) || '');
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/shared/coders/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAU,EAAU,EAAE;IAClD,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,MAAM,GAAG,CAAC,EAAU,EAAE;QAC9C,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,aAAa,GAAG,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1C,OAAO,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACnE,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC;IAC1C,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,GAAG,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;QAChC,OAAO,CACL,MAAM,CAAC;YACL,GAAG,EAAE,KAAK,CAAC,iBAAiB;YAC5B,OAAO,EAAE,GAAG,KAAK,CAAC,iBAAiB,GAAG;SACvC,CAAC,IAAI,EAAE,CACT,CAAC;KACH;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IACxC,OAAO,CACL,MAAM,CAAC;QACL,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC,QAAQ;QAC9B,OAAO,EACL,mBAAmB,IAAI,YAAY,CAAC,OAAO;YACzC,CAAC,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,iBAAiB,GAAG;YAC9C,CAAC,CAAC,GAAI,YAAY,CAAC,OAAe,CAAC,UAAU,GAAG;KACrD,CAAC,IAAI,EAAE,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { FileLocation } from '../types/inputs';\n\nexport const formatDateUTC = (date: Date): string => {\n const pad = (num: number, digits = 2): string => {\n const str = num.toString();\n const paddingLength = digits - str.length;\n return paddingLength > 0 ? '0'.repeat(paddingLength) + str : str;\n };\n\n const year = date.getUTCFullYear();\n const month = pad(date.getUTCMonth() + 1);\n const day = pad(date.getUTCDate());\n const hours = pad(date.getUTCHours());\n const minutes = pad(date.getUTCMinutes());\n const seconds = pad(date.getUTCSeconds());\n const millis = pad(date.getUTCMilliseconds(), 3);\n\n return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${millis}Z`;\n};\n\nexport const colorToHex = {\n fromARGB(value: number): string {\n const hex = value.toString(16).padStart(8, '0');\n return `#${hex.slice(2)}${hex.slice(0, 2)}`;\n },\n fromRGBA(value: number): string {\n return `#${value.toString(16).padStart(8, '0')}`;\n },\n fromRGB(value: number): string {\n return `#${value.toString(16).padStart(6, '0')}ff`;\n },\n};\n\nexport const extractBase64Data = (input: string): string => {\n const commaIndex = input.indexOf(',');\n if (input.startsWith('data:') && commaIndex !== -1) {\n return input.slice(commaIndex + 1);\n }\n return input;\n};\n\ntype PlatformSelector<T> = { ios: T; android: T };\n\nexport const resolveAssetId = (\n asset: { relativeAssetPath: string } | { fileLocation: FileLocation },\n select: <T>(spec: PlatformSelector<T>) => T | undefined,\n): string => {\n if ('relativeAssetPath' in asset) {\n return (\n select({\n ios: asset.relativeAssetPath,\n android: `${asset.relativeAssetPath}a`,\n }) || ''\n );\n }\n\n const fileLocation = asset.fileLocation;\n return (\n select({\n ios: fileLocation.ios.fileName,\n android:\n 'relativeAssetPath' in fileLocation.android\n ? `${fileLocation.android.relativeAssetPath}a`\n : `${(fileLocation.android as any).rawResName}r`,\n }) || ''\n );\n};\n"]}
|
|
@@ -2,6 +2,7 @@ import { VendorStore, OfferType, CancellationReason, Gender, AppTrackingTranspar
|
|
|
2
2
|
export * from './error';
|
|
3
3
|
export * from './inputs';
|
|
4
4
|
export * from '../constants';
|
|
5
|
+
export * from './paywall-events';
|
|
5
6
|
export interface AdaptyPrice {
|
|
6
7
|
/**
|
|
7
8
|
* Price as number
|
|
@@ -676,6 +677,11 @@ export interface AdaptyProductIdentifier {
|
|
|
676
677
|
*/
|
|
677
678
|
readonly adaptyProductId: string;
|
|
678
679
|
}
|
|
680
|
+
export declare const WebPresentation: Readonly<{
|
|
681
|
+
BrowserOutApp: "browser_out_app";
|
|
682
|
+
BrowserInApp: "browser_in_app";
|
|
683
|
+
}>;
|
|
684
|
+
export type WebPresentation = (typeof WebPresentation)[keyof typeof WebPresentation];
|
|
679
685
|
export declare const RefundPreference: Readonly<{
|
|
680
686
|
NoPreference: "no_preference";
|
|
681
687
|
Grant: "grant";
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export * from './error';
|
|
2
2
|
export * from './inputs';
|
|
3
3
|
export * from '../constants';
|
|
4
|
+
export * from './paywall-events';
|
|
5
|
+
export const WebPresentation = Object.freeze({
|
|
6
|
+
BrowserOutApp: 'browser_out_app',
|
|
7
|
+
BrowserInApp: 'browser_in_app',
|
|
8
|
+
});
|
|
4
9
|
export const RefundPreference = Object.freeze({
|
|
5
10
|
NoPreference: 'no_preference',
|
|
6
11
|
Grant: 'grant',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared/types/index.ts"],"names":[],"mappings":"AASA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAovB7B,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,YAAY,EAAE,eAAe;IAC7B,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACnB,CAAC,CAAC","sourcesContent":["import {\n VendorStore,\n OfferType,\n CancellationReason,\n Gender,\n AppTrackingTransparencyStatus,\n ProductPeriod,\n} from '../constants';\n\nexport * from './error';\nexport * from './inputs';\nexport * from '../constants';\n\nexport interface AdaptyPrice {\n /**\n * Price as number\n */\n amount: number;\n /**\n * The currency code of the locale\n * used to format the price of the product.\n * The ISO 4217 (USD, EUR).\n */\n currencyCode?: string;\n /**\n * The currency symbol of the locale\n * used to format the price of the product.\n * ($, €).\n */\n currencySymbol?: string;\n /**\n * A price’s language is determined\n * by the preferred language set on the device.\n * On Android, the formatted price from Google Play as is.\n */\n localizedString?: string;\n}\n\n/**\n * Describes an object that represents a paywall.\n * Used in {@link Adapty.getPaywall} method.\n * @public\n */\nexport interface AdaptyPaywall {\n readonly placement: AdaptyPlacement;\n\n /**\n * If `true`, it is possible to fetch the view object\n * and use it with AdaptyUI library.\n * @readonly\n */\n readonly hasViewConfiguration: boolean;\n\n /**\n * A paywall name.\n * @readonly\n */\n readonly name: string;\n /**\n * A remote config configured in Adapty Dashboard for this paywall.\n * @readonly\n */\n readonly remoteConfig?: AdaptyRemoteConfig;\n /**\n * An identifier of a variation,\n * used to attribute purchases to this paywall.\n * @readonly\n */\n readonly variationId: string;\n /**\n * Array of initial products info\n * @readonly\n * @deprecated Use {@link AdaptyPaywall.productIdentifiers} instead\n */\n readonly products: ProductReference[];\n\n /**\n * Array of product identifiers for this paywall\n * @readonly\n */\n readonly productIdentifiers: AdaptyProductIdentifier[];\n\n id: string;\n version?: number;\n webPurchaseUrl?: string;\n payloadData?: string;\n /**\n * @internal Used internally by the SDK\n */\n requestLocale: string;\n paywallBuilder?: AdaptyPaywallBuilder;\n}\n\nexport interface AdaptyOnboarding {\n readonly placement: AdaptyPlacement;\n /**\n * If `true`, it is possible to fetch the view object\n * and use it with AdaptyUI library.\n * @readonly\n */\n readonly hasViewConfiguration: boolean;\n\n /**\n * A paywall name.\n * @readonly\n */\n readonly name: string;\n /**\n * A remote config configured in Adapty Dashboard for this paywall.\n * @readonly\n */\n readonly remoteConfig?: AdaptyRemoteConfig;\n /**\n * An identifier of a variation,\n * used to attribute purchases to this paywall.\n * @readonly\n */\n readonly variationId: string;\n\n id: string;\n version?: number;\n payloadData?: string;\n /**\n * @internal Used internally by the SDK\n */\n requestLocale: string;\n onboardingBuilder?: AdaptyOnboardingBuilder;\n}\n\nexport interface AdaptyPlacement {\n /**\n * Parent A/B test name.\n * @readonly\n */\n readonly abTestName: string;\n\n /**\n * A name of an audience to which the paywall belongs.\n * @readonly\n */\n readonly audienceName: string;\n /**\n * ID of a placement configured in Adapty Dashboard.\n * @readonly\n */\n readonly id: string;\n /**\n * Current revision (version) of a paywall.\n * Every change within a paywall creates a new revision.\n * @readonly\n */\n readonly revision: number;\n\n isTrackingPurchases?: boolean;\n audienceVersionId: string;\n}\n\n/**\n * Describes an object that represents a remote config of a paywall.\n * @public\n */\nexport interface AdaptyRemoteConfig {\n /**\n * Identifier of a paywall locale.\n * @readonly\n */\n readonly lang: string;\n /**\n * A custom dictionary configured in Adapty Dashboard for this paywall.\n * @readonly\n */\n readonly data: Record<string, any>;\n /**\n * A custom JSON string configured in Adapty Dashboard for this paywall.\n * @readonly\n */\n readonly dataString: string;\n}\n\nexport interface AdaptyPaywallBuilder {\n readonly id: string;\n readonly lang: string;\n}\n\nexport interface AdaptyOnboardingBuilder {\n readonly url: string;\n}\n\nexport type AdaptyPurchaseResult =\n | {\n type: 'pending' | 'user_cancelled';\n }\n | {\n type: 'success';\n profile: AdaptyProfile;\n ios?: {\n jwsTransaction?: string;\n };\n android?: {\n purchaseToken?: string;\n };\n };\n\n/**\n * Interface representing a user profile in Adapty,\n * including details about the user's subscriptions and consumable products.\n * @public\n */\nexport interface AdaptyProfile {\n /**\n * Object that maps access level identifiers (configured by you in Adapty Dashboard)\n * to the corresponding access level details. The value can be `null`\n * if the user does not have any access levels.\n * @readonly\n */\n readonly accessLevels?: Record<string, AdaptyAccessLevel>;\n\n /**\n * Object representing custom attributes set for the user using\n * the {@link Adapty.updateProfile} method.\n * @readonly\n */\n readonly customAttributes?: Record<string, any>;\n\n /**\n * The identifier for a user in your system.\n * @readonly\n */\n readonly customerUserId?: string;\n\n /**\n * Object that maps product ids from the store to an array of\n * information about the user's non-subscription purchases.\n * The value can be `null` if the user does not have any purchases.\n * @readonly\n */\n readonly nonSubscriptions?: Record<string, AdaptyNonSubscription[]>;\n\n /**\n * The identifier for a user in Adapty.\n */\n readonly profileId: string;\n\n /**\n * Object that maps product ids from a store to\n * information about the user's subscriptions.\n * The value can be `null` if the user does not have any subscriptions.\n * @readonly\n */\n readonly subscriptions?: Record<string, AdaptySubscription>;\n}\n\n/**\n * Interface representing access level details of a user.\n * @public\n */\nexport interface AdaptyAccessLevel {\n /**\n * The date and time when the access level was activated.\n * @readonly\n */\n readonly activatedAt: Date;\n\n /**\n * Type of active introductory offer, if any.\n * @readonly\n */\n readonly activeIntroductoryOfferType?: OfferType;\n\n /**\n * Identifier of the active promotional offer, if any.\n * @readonly\n */\n readonly activePromotionalOfferId?: string;\n\n /**\n * Type of the active promotional offer, if any.\n * @readonly\n */\n readonly activePromotionalOfferType?: OfferType;\n\n /**\n * The date and time when a billing issue was detected.\n * @readonly\n */\n readonly billingIssueDetectedAt?: Date;\n\n /**\n * The reason for the cancellation of the subscription.\n * @readonly\n */\n readonly cancellationReason?: CancellationReason;\n\n /**\n * The expiration date of the access level, if applicable.\n * @readonly\n */\n readonly expiresAt?: Date;\n\n /**\n * Unique identifier of the access level\n * configured by you in Adapty Dashboard.\n * @readonly\n */\n readonly id: string;\n\n /**\n * Flag indicating whether the access level is currently active.\n * @readonly\n */\n readonly isActive: boolean;\n\n /**\n * Flag indicating whether this auto-renewable subscription is in the grace period.\n * @readonly\n */\n readonly isInGracePeriod: boolean;\n\n /**\n * Flag indicating whether this access level is active for a lifetime.\n * @readonly\n */\n readonly isLifetime: boolean;\n\n /**\n * Flag indicating whether this purchase was refunded.\n * @readonly\n */\n readonly isRefund: boolean;\n\n /**\n * The date and time when the access level was renewed.\n * @readonly\n */\n readonly renewedAt?: Date;\n\n /**\n * The start date of this access level.\n * @readonly\n */\n readonly startsAt?: Date;\n\n /**\n * The store where the purchase that unlocked this access level was made.\n * @readonly\n */\n readonly store: VendorStore;\n\n /**\n * The date and time when the auto-renewable subscription was cancelled.\n * @readonly\n */\n readonly unsubscribedAt?: Date;\n\n /**\n * The identifier of the product in the store that unlocked this access level.\n * @readonly\n */\n readonly vendorProductId: string;\n\n /**\n * Flag indicating whether this auto-renewable subscription is set to renew.\n * @readonly\n */\n readonly willRenew: boolean;\n\n android?: {\n offerId?: string;\n };\n}\n\n/**\n * Interface representing a consumable or non-subscription purchase made by the user.\n * @public\n */\nexport interface AdaptyNonSubscription {\n /**\n * Flag indicating whether the product is consumable.\n * @readonly\n */\n readonly isConsumable: boolean;\n\n /**\n * Flag indicating whether the purchase was refunded.\n * @readonly\n */\n readonly isRefund: boolean;\n\n /**\n * Flag indicating whether the product was purchased in a sandbox environment.\n * @readonly\n */\n readonly isSandbox: boolean;\n\n /**\n * The date and time when the purchase was made.\n * @readonly\n */\n readonly purchasedAt: Date;\n\n /**\n * The identifier of the product in the store that was purchased.\n * @readonly\n */\n readonly vendorProductId: string;\n /**\n * The identifier of the product in the store that was purchased.\n * @readonly\n */\n readonly vendorTransactionId?: string;\n\n /**\n * The store where the purchase was made.\n * @readonly\n */\n readonly store: VendorStore;\n\n /**\n * An identifier of the purchase in Adapty.\n * You can use it to ensure that you've already processed this purchase\n * (for example tracking one time products).\n * @readonly\n */\n readonly purchaseId: string;\n}\n\n/**\n * Interface representing details about a user's subscription.\n * @public\n */\nexport interface AdaptySubscription {\n /**\n * The date and time when the subscription was activated.\n * @readonly\n */\n readonly activatedAt: Date;\n\n /**\n * Type of active introductory offer, if any.\n * @readonly\n */\n readonly activeIntroductoryOfferType?: OfferType;\n\n /**\n * Identifier of the active promotional offer, if any.\n * @readonly\n */\n readonly activePromotionalOfferId?: string;\n\n /**\n * Type of the active promotional offer, if any.\n * @readonly\n */\n readonly activePromotionalOfferType?: OfferType;\n\n /**\n * The date and time when a billing issue was detected.\n * @readonly\n */\n readonly billingIssueDetectedAt?: Date;\n\n /**\n * The reason for the cancellation of the subscription.\n * @readonly\n */\n readonly cancellationReason?: CancellationReason;\n\n /**\n * The expiration date of the subscription, if applicable.\n * @readonly\n */\n readonly expiresAt?: Date;\n\n /**\n * Flag indicating whether the subscription is currently active.\n * @readonly\n */\n readonly isActive: boolean;\n\n /**\n * Flag indicating whether the subscription is in the grace period.\n * @readonly\n */\n readonly isInGracePeriod: boolean;\n\n /**\n * Flag indicating whether the subscription is set for a lifetime.\n * @readonly\n */\n readonly isLifetime: boolean;\n\n /**\n * Flag indicating whether the subscription was refunded.\n * @readonly\n */\n readonly isRefund: boolean;\n\n /**\n * Flag indicating whether the subscription was purchased in a sandbox environment.\n * @readonly\n */\n readonly isSandbox: boolean;\n\n /**\n * The date and time when the subscription was renewed.\n * @readonly\n */\n readonly renewedAt?: Date;\n\n /**\n * The date and time when the subscription starts.\n * @readonly\n */\n readonly startsAt?: Date;\n\n /**\n * The store where the subscription was made.\n * @readonly\n */\n readonly store: VendorStore;\n\n /**\n * The date and time when the subscription was cancelled.\n * @readonly\n */\n readonly unsubscribedAt?: Date;\n\n /**\n * The identifier of the product in the store that was subscribed to.\n * @readonly\n */\n readonly vendorProductId: string;\n\n /**\n * The identifier of the product in the store that was subscribed to.\n * @readonly\n */\n readonly vendorTransactionId: string;\n /**\n * An original transaction id of the purchase in a store that unlocked this subscription.\n * For auto-renewable subscription, this will be an id of the first transaction in this subscription.\n * @readonly\n */\n readonly vendorOriginalTransactionId: string;\n /**\n * Flag indicating whether the subscription is set to auto-renew.\n * @readonly\n */\n readonly willRenew: boolean;\n}\n\n/**\n * Describes an object that represents a product.\n * Used in {@link Adapty.getPaywallProducts} method and in {@link Adapty.makePurchase} method.\n * @public\n */\nexport interface AdaptyPaywallProduct {\n /**\n * A description of the product.\n */\n readonly localizedDescription: string;\n /**\n * The region code of the locale used to format the price of the product.\n * ISO 3166 ALPHA-2 (US, DE)\n */\n readonly regionCode?: string;\n /**\n * The name of the product.\n */\n readonly localizedTitle: string;\n /**\n * Same as `abTestName` property of the parent {@link AdaptyPaywall}.\n */\n readonly paywallABTestName: string;\n /**\n * Same as `name` property of the parent {@link AdaptyPaywall}.\n */\n readonly paywallName: string;\n /**\n * The cost of the product in the local currency\n */\n readonly price?: AdaptyPrice;\n readonly adaptyId: string;\n readonly accessLevelId: string;\n readonly productType: string;\n /**\n * Same as `variationId` property of the parent {@link AdaptyPaywall}.\n */\n readonly variationId: string;\n /**\n * Unique identifier of a product\n * from App Store Connect or Google Play Console\n */\n readonly vendorProductId: string;\n paywallProductIndex: number;\n webPurchaseUrl?: string;\n payloadData?: string;\n subscription?: AdaptySubscriptionDetails;\n ios?: {\n /**\n * Boolean value that indicates\n * whether the product is available for family sharing\n * in App Store Connect.\n * Will be `false` for iOS version below 14.0 and macOS version below 11.0.\n * @see {@link https://developer.apple.com/documentation/storekit/skproduct/3564805-isfamilyshareable}\n */\n readonly isFamilyShareable: boolean;\n };\n}\n\nexport interface AdaptySubscriptionDetails {\n /**\n * The period details for products that are subscriptions.\n * Will be `null` for iOS version below 11.2 and macOS version below 10.14.4.\n */\n subscriptionPeriod: AdaptySubscriptionPeriod;\n /**\n * The period’s language is determined\n * by the preferred language set on the device.\n */\n localizedSubscriptionPeriod?: string;\n /**\n * A subscription offer if available for the auto-renewable subscription.\n */\n offer?: AdaptySubscriptionOffer;\n\n ios?: {\n /**\n * An identifier of the subscription group\n * to which the subscription belongs.\n * Will be `null` for iOS version below 12.0 and macOS version below 10.14.\n */\n subscriptionGroupIdentifier?: string;\n };\n\n android?: {\n basePlanId: string;\n renewalType?: 'prepaid' | 'autorenewable';\n };\n}\n\n/**\n * Subscription offer model to products\n * @see {@link https://adapty.io/docs/capacitor-sdk-models | [DOC] SDK Models}\n */\nexport interface AdaptySubscriptionOffer {\n readonly identifier: AdaptySubscriptionOfferId;\n\n phases: AdaptyDiscountPhase[];\n\n android?: {\n offerTags?: string[];\n };\n}\n\nexport type AdaptySubscriptionOfferId =\n | { id?: string; type: 'introductory' }\n | { id: string; type: 'promotional' | 'win_back' };\n\n/**\n * Discount model to products\n * @see {@link https://adapty.io/docs/capacitor-sdk-models | [DOC] SDK Models}\n */\nexport interface AdaptyDiscountPhase {\n /**\n * A formatted number of periods of a discount for a user’s locale.\n * @readonly\n */\n readonly localizedNumberOfPeriods?: string;\n /**\n * A formatted subscription period of a discount for a user’s locale.\n * @readonly\n */\n readonly localizedSubscriptionPeriod?: string;\n /**\n * A number of periods this product discount is available.\n * @readonly\n */\n readonly numberOfPeriods: number;\n /**\n * Discount price of a product in a local currency.\n * @readonly\n */\n readonly price: AdaptyPrice;\n /**\n * An information about period for a product discount.\n * @readonly\n */\n readonly subscriptionPeriod: AdaptySubscriptionPeriod;\n\n /**\n * A payment mode for this product discount.\n * @readonly\n */\n readonly paymentMode: OfferType;\n}\n\n/**\n * An object containing information about a subscription period.\n * @public\n */\nexport interface AdaptySubscriptionPeriod {\n /**\n * A number of period units.\n * @readonly\n */\n readonly numberOfUnits: number;\n /**\n * A unit of time that a subscription period is specified in.\n * @readonly\n */\n readonly unit: ProductPeriod;\n}\n\nexport interface AdaptyProfileParameters {\n analyticsDisabled?: boolean;\n codableCustomAttributes?: { [key: string]: any };\n appTrackingTransparencyStatus?: AppTrackingTransparencyStatus;\n firstName?: string;\n lastName?: string;\n gender?: Gender;\n birthday?: string;\n email?: string;\n phoneNumber?: string;\n}\n\nexport interface ProductReference {\n vendorId: string;\n adaptyId: string;\n accessLevelId: string;\n productType: string;\n\n ios?: {\n promotionalOfferId?: string;\n winBackOfferId?: string;\n };\n\n android?: {\n basePlanId?: string;\n offerId?: string;\n };\n}\n\n/**\n * Interface representing a product identifier with vendor and platform-specific information.\n * @public\n */\nexport interface AdaptyProductIdentifier {\n /**\n * The vendor-specific product identifier (e.g., App Store or Google Play product ID).\n * @readonly\n */\n readonly vendorProductId: string;\n\n /**\n * The base plan identifier for Google Play subscriptions (Android only).\n * @readonly\n */\n readonly basePlanId?: string;\n\n /**\n * Internal Adapty product identifier.\n * @readonly\n */\n readonly adaptyProductId: string;\n}\n\nexport const RefundPreference = Object.freeze({\n NoPreference: 'no_preference',\n Grant: 'grant',\n Decline: 'decline',\n});\nexport type RefundPreference =\n (typeof RefundPreference)[keyof typeof RefundPreference];\n\nexport type AdaptyInstallationStatus =\n | {\n status: 'not_available' | 'not_determined';\n }\n | {\n status: 'determined';\n details: AdaptyInstallationDetails;\n };\n\nexport interface AdaptyInstallationDetails {\n /**\n * A unique identifier for this installation.\n * @readonly\n */\n readonly installId?: string;\n /**\n * The date and time when the app was installed.\n * @readonly\n */\n readonly installTime: Date;\n /**\n * The total number of times the app has been launched.\n * @readonly\n */\n readonly appLaunchCount: number;\n /**\n * Custom payload data associated with the installation.\n * @readonly\n */\n readonly payload?: string;\n}\n\n\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared/types/index.ts"],"names":[],"mappings":"AASA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AAovBjC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,aAAa,EAAE,iBAAiB;IAChC,YAAY,EAAE,gBAAgB;CAC/B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,YAAY,EAAE,eAAe;IAC7B,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACnB,CAAC,CAAC","sourcesContent":["import {\n VendorStore,\n OfferType,\n CancellationReason,\n Gender,\n AppTrackingTransparencyStatus,\n ProductPeriod,\n} from '../constants';\n\nexport * from './error';\nexport * from './inputs';\nexport * from '../constants';\nexport * from './paywall-events';\n\nexport interface AdaptyPrice {\n /**\n * Price as number\n */\n amount: number;\n /**\n * The currency code of the locale\n * used to format the price of the product.\n * The ISO 4217 (USD, EUR).\n */\n currencyCode?: string;\n /**\n * The currency symbol of the locale\n * used to format the price of the product.\n * ($, €).\n */\n currencySymbol?: string;\n /**\n * A price’s language is determined\n * by the preferred language set on the device.\n * On Android, the formatted price from Google Play as is.\n */\n localizedString?: string;\n}\n\n/**\n * Describes an object that represents a paywall.\n * Used in {@link Adapty.getPaywall} method.\n * @public\n */\nexport interface AdaptyPaywall {\n readonly placement: AdaptyPlacement;\n\n /**\n * If `true`, it is possible to fetch the view object\n * and use it with AdaptyUI library.\n * @readonly\n */\n readonly hasViewConfiguration: boolean;\n\n /**\n * A paywall name.\n * @readonly\n */\n readonly name: string;\n /**\n * A remote config configured in Adapty Dashboard for this paywall.\n * @readonly\n */\n readonly remoteConfig?: AdaptyRemoteConfig;\n /**\n * An identifier of a variation,\n * used to attribute purchases to this paywall.\n * @readonly\n */\n readonly variationId: string;\n /**\n * Array of initial products info\n * @readonly\n * @deprecated Use {@link AdaptyPaywall.productIdentifiers} instead\n */\n readonly products: ProductReference[];\n\n /**\n * Array of product identifiers for this paywall\n * @readonly\n */\n readonly productIdentifiers: AdaptyProductIdentifier[];\n\n id: string;\n version?: number;\n webPurchaseUrl?: string;\n payloadData?: string;\n /**\n * @internal Used internally by the SDK\n */\n requestLocale: string;\n paywallBuilder?: AdaptyPaywallBuilder;\n}\n\nexport interface AdaptyOnboarding {\n readonly placement: AdaptyPlacement;\n /**\n * If `true`, it is possible to fetch the view object\n * and use it with AdaptyUI library.\n * @readonly\n */\n readonly hasViewConfiguration: boolean;\n\n /**\n * A paywall name.\n * @readonly\n */\n readonly name: string;\n /**\n * A remote config configured in Adapty Dashboard for this paywall.\n * @readonly\n */\n readonly remoteConfig?: AdaptyRemoteConfig;\n /**\n * An identifier of a variation,\n * used to attribute purchases to this paywall.\n * @readonly\n */\n readonly variationId: string;\n\n id: string;\n version?: number;\n payloadData?: string;\n /**\n * @internal Used internally by the SDK\n */\n requestLocale: string;\n onboardingBuilder?: AdaptyOnboardingBuilder;\n}\n\nexport interface AdaptyPlacement {\n /**\n * Parent A/B test name.\n * @readonly\n */\n readonly abTestName: string;\n\n /**\n * A name of an audience to which the paywall belongs.\n * @readonly\n */\n readonly audienceName: string;\n /**\n * ID of a placement configured in Adapty Dashboard.\n * @readonly\n */\n readonly id: string;\n /**\n * Current revision (version) of a paywall.\n * Every change within a paywall creates a new revision.\n * @readonly\n */\n readonly revision: number;\n\n isTrackingPurchases?: boolean;\n audienceVersionId: string;\n}\n\n/**\n * Describes an object that represents a remote config of a paywall.\n * @public\n */\nexport interface AdaptyRemoteConfig {\n /**\n * Identifier of a paywall locale.\n * @readonly\n */\n readonly lang: string;\n /**\n * A custom dictionary configured in Adapty Dashboard for this paywall.\n * @readonly\n */\n readonly data: Record<string, any>;\n /**\n * A custom JSON string configured in Adapty Dashboard for this paywall.\n * @readonly\n */\n readonly dataString: string;\n}\n\nexport interface AdaptyPaywallBuilder {\n readonly id: string;\n readonly lang: string;\n}\n\nexport interface AdaptyOnboardingBuilder {\n readonly url: string;\n}\n\nexport type AdaptyPurchaseResult =\n | {\n type: 'pending' | 'user_cancelled';\n }\n | {\n type: 'success';\n profile: AdaptyProfile;\n ios?: {\n jwsTransaction?: string;\n };\n android?: {\n purchaseToken?: string;\n };\n };\n\n/**\n * Interface representing a user profile in Adapty,\n * including details about the user's subscriptions and consumable products.\n * @public\n */\nexport interface AdaptyProfile {\n /**\n * Object that maps access level identifiers (configured by you in Adapty Dashboard)\n * to the corresponding access level details. The value can be `null`\n * if the user does not have any access levels.\n * @readonly\n */\n readonly accessLevels?: Record<string, AdaptyAccessLevel>;\n\n /**\n * Object representing custom attributes set for the user using\n * the {@link Adapty.updateProfile} method.\n * @readonly\n */\n readonly customAttributes?: Record<string, any>;\n\n /**\n * The identifier for a user in your system.\n * @readonly\n */\n readonly customerUserId?: string;\n\n /**\n * Object that maps product ids from the store to an array of\n * information about the user's non-subscription purchases.\n * The value can be `null` if the user does not have any purchases.\n * @readonly\n */\n readonly nonSubscriptions?: Record<string, AdaptyNonSubscription[]>;\n\n /**\n * The identifier for a user in Adapty.\n */\n readonly profileId: string;\n\n /**\n * Object that maps product ids from a store to\n * information about the user's subscriptions.\n * The value can be `null` if the user does not have any subscriptions.\n * @readonly\n */\n readonly subscriptions?: Record<string, AdaptySubscription>;\n}\n\n/**\n * Interface representing access level details of a user.\n * @public\n */\nexport interface AdaptyAccessLevel {\n /**\n * The date and time when the access level was activated.\n * @readonly\n */\n readonly activatedAt: Date;\n\n /**\n * Type of active introductory offer, if any.\n * @readonly\n */\n readonly activeIntroductoryOfferType?: OfferType;\n\n /**\n * Identifier of the active promotional offer, if any.\n * @readonly\n */\n readonly activePromotionalOfferId?: string;\n\n /**\n * Type of the active promotional offer, if any.\n * @readonly\n */\n readonly activePromotionalOfferType?: OfferType;\n\n /**\n * The date and time when a billing issue was detected.\n * @readonly\n */\n readonly billingIssueDetectedAt?: Date;\n\n /**\n * The reason for the cancellation of the subscription.\n * @readonly\n */\n readonly cancellationReason?: CancellationReason;\n\n /**\n * The expiration date of the access level, if applicable.\n * @readonly\n */\n readonly expiresAt?: Date;\n\n /**\n * Unique identifier of the access level\n * configured by you in Adapty Dashboard.\n * @readonly\n */\n readonly id: string;\n\n /**\n * Flag indicating whether the access level is currently active.\n * @readonly\n */\n readonly isActive: boolean;\n\n /**\n * Flag indicating whether this auto-renewable subscription is in the grace period.\n * @readonly\n */\n readonly isInGracePeriod: boolean;\n\n /**\n * Flag indicating whether this access level is active for a lifetime.\n * @readonly\n */\n readonly isLifetime: boolean;\n\n /**\n * Flag indicating whether this purchase was refunded.\n * @readonly\n */\n readonly isRefund: boolean;\n\n /**\n * The date and time when the access level was renewed.\n * @readonly\n */\n readonly renewedAt?: Date;\n\n /**\n * The start date of this access level.\n * @readonly\n */\n readonly startsAt?: Date;\n\n /**\n * The store where the purchase that unlocked this access level was made.\n * @readonly\n */\n readonly store: VendorStore;\n\n /**\n * The date and time when the auto-renewable subscription was cancelled.\n * @readonly\n */\n readonly unsubscribedAt?: Date;\n\n /**\n * The identifier of the product in the store that unlocked this access level.\n * @readonly\n */\n readonly vendorProductId: string;\n\n /**\n * Flag indicating whether this auto-renewable subscription is set to renew.\n * @readonly\n */\n readonly willRenew: boolean;\n\n android?: {\n offerId?: string;\n };\n}\n\n/**\n * Interface representing a consumable or non-subscription purchase made by the user.\n * @public\n */\nexport interface AdaptyNonSubscription {\n /**\n * Flag indicating whether the product is consumable.\n * @readonly\n */\n readonly isConsumable: boolean;\n\n /**\n * Flag indicating whether the purchase was refunded.\n * @readonly\n */\n readonly isRefund: boolean;\n\n /**\n * Flag indicating whether the product was purchased in a sandbox environment.\n * @readonly\n */\n readonly isSandbox: boolean;\n\n /**\n * The date and time when the purchase was made.\n * @readonly\n */\n readonly purchasedAt: Date;\n\n /**\n * The identifier of the product in the store that was purchased.\n * @readonly\n */\n readonly vendorProductId: string;\n /**\n * The identifier of the product in the store that was purchased.\n * @readonly\n */\n readonly vendorTransactionId?: string;\n\n /**\n * The store where the purchase was made.\n * @readonly\n */\n readonly store: VendorStore;\n\n /**\n * An identifier of the purchase in Adapty.\n * You can use it to ensure that you've already processed this purchase\n * (for example tracking one time products).\n * @readonly\n */\n readonly purchaseId: string;\n}\n\n/**\n * Interface representing details about a user's subscription.\n * @public\n */\nexport interface AdaptySubscription {\n /**\n * The date and time when the subscription was activated.\n * @readonly\n */\n readonly activatedAt: Date;\n\n /**\n * Type of active introductory offer, if any.\n * @readonly\n */\n readonly activeIntroductoryOfferType?: OfferType;\n\n /**\n * Identifier of the active promotional offer, if any.\n * @readonly\n */\n readonly activePromotionalOfferId?: string;\n\n /**\n * Type of the active promotional offer, if any.\n * @readonly\n */\n readonly activePromotionalOfferType?: OfferType;\n\n /**\n * The date and time when a billing issue was detected.\n * @readonly\n */\n readonly billingIssueDetectedAt?: Date;\n\n /**\n * The reason for the cancellation of the subscription.\n * @readonly\n */\n readonly cancellationReason?: CancellationReason;\n\n /**\n * The expiration date of the subscription, if applicable.\n * @readonly\n */\n readonly expiresAt?: Date;\n\n /**\n * Flag indicating whether the subscription is currently active.\n * @readonly\n */\n readonly isActive: boolean;\n\n /**\n * Flag indicating whether the subscription is in the grace period.\n * @readonly\n */\n readonly isInGracePeriod: boolean;\n\n /**\n * Flag indicating whether the subscription is set for a lifetime.\n * @readonly\n */\n readonly isLifetime: boolean;\n\n /**\n * Flag indicating whether the subscription was refunded.\n * @readonly\n */\n readonly isRefund: boolean;\n\n /**\n * Flag indicating whether the subscription was purchased in a sandbox environment.\n * @readonly\n */\n readonly isSandbox: boolean;\n\n /**\n * The date and time when the subscription was renewed.\n * @readonly\n */\n readonly renewedAt?: Date;\n\n /**\n * The date and time when the subscription starts.\n * @readonly\n */\n readonly startsAt?: Date;\n\n /**\n * The store where the subscription was made.\n * @readonly\n */\n readonly store: VendorStore;\n\n /**\n * The date and time when the subscription was cancelled.\n * @readonly\n */\n readonly unsubscribedAt?: Date;\n\n /**\n * The identifier of the product in the store that was subscribed to.\n * @readonly\n */\n readonly vendorProductId: string;\n\n /**\n * The identifier of the product in the store that was subscribed to.\n * @readonly\n */\n readonly vendorTransactionId: string;\n /**\n * An original transaction id of the purchase in a store that unlocked this subscription.\n * For auto-renewable subscription, this will be an id of the first transaction in this subscription.\n * @readonly\n */\n readonly vendorOriginalTransactionId: string;\n /**\n * Flag indicating whether the subscription is set to auto-renew.\n * @readonly\n */\n readonly willRenew: boolean;\n}\n\n/**\n * Describes an object that represents a product.\n * Used in {@link Adapty.getPaywallProducts} method and in {@link Adapty.makePurchase} method.\n * @public\n */\nexport interface AdaptyPaywallProduct {\n /**\n * A description of the product.\n */\n readonly localizedDescription: string;\n /**\n * The region code of the locale used to format the price of the product.\n * ISO 3166 ALPHA-2 (US, DE)\n */\n readonly regionCode?: string;\n /**\n * The name of the product.\n */\n readonly localizedTitle: string;\n /**\n * Same as `abTestName` property of the parent {@link AdaptyPaywall}.\n */\n readonly paywallABTestName: string;\n /**\n * Same as `name` property of the parent {@link AdaptyPaywall}.\n */\n readonly paywallName: string;\n /**\n * The cost of the product in the local currency\n */\n readonly price?: AdaptyPrice;\n readonly adaptyId: string;\n readonly accessLevelId: string;\n readonly productType: string;\n /**\n * Same as `variationId` property of the parent {@link AdaptyPaywall}.\n */\n readonly variationId: string;\n /**\n * Unique identifier of a product\n * from App Store Connect or Google Play Console\n */\n readonly vendorProductId: string;\n paywallProductIndex: number;\n webPurchaseUrl?: string;\n payloadData?: string;\n subscription?: AdaptySubscriptionDetails;\n ios?: {\n /**\n * Boolean value that indicates\n * whether the product is available for family sharing\n * in App Store Connect.\n * Will be `false` for iOS version below 14.0 and macOS version below 11.0.\n * @see {@link https://developer.apple.com/documentation/storekit/skproduct/3564805-isfamilyshareable}\n */\n readonly isFamilyShareable: boolean;\n };\n}\n\nexport interface AdaptySubscriptionDetails {\n /**\n * The period details for products that are subscriptions.\n * Will be `null` for iOS version below 11.2 and macOS version below 10.14.4.\n */\n subscriptionPeriod: AdaptySubscriptionPeriod;\n /**\n * The period’s language is determined\n * by the preferred language set on the device.\n */\n localizedSubscriptionPeriod?: string;\n /**\n * A subscription offer if available for the auto-renewable subscription.\n */\n offer?: AdaptySubscriptionOffer;\n\n ios?: {\n /**\n * An identifier of the subscription group\n * to which the subscription belongs.\n * Will be `null` for iOS version below 12.0 and macOS version below 10.14.\n */\n subscriptionGroupIdentifier?: string;\n };\n\n android?: {\n basePlanId: string;\n renewalType?: 'prepaid' | 'autorenewable';\n };\n}\n\n/**\n * Subscription offer model to products\n * @see {@link https://adapty.io/docs/capacitor-sdk-models | [DOC] SDK Models}\n */\nexport interface AdaptySubscriptionOffer {\n readonly identifier: AdaptySubscriptionOfferId;\n\n phases: AdaptyDiscountPhase[];\n\n android?: {\n offerTags?: string[];\n };\n}\n\nexport type AdaptySubscriptionOfferId =\n | { id?: string; type: 'introductory' }\n | { id: string; type: 'promotional' | 'win_back' };\n\n/**\n * Discount model to products\n * @see {@link https://adapty.io/docs/capacitor-sdk-models | [DOC] SDK Models}\n */\nexport interface AdaptyDiscountPhase {\n /**\n * A formatted number of periods of a discount for a user’s locale.\n * @readonly\n */\n readonly localizedNumberOfPeriods?: string;\n /**\n * A formatted subscription period of a discount for a user’s locale.\n * @readonly\n */\n readonly localizedSubscriptionPeriod?: string;\n /**\n * A number of periods this product discount is available.\n * @readonly\n */\n readonly numberOfPeriods: number;\n /**\n * Discount price of a product in a local currency.\n * @readonly\n */\n readonly price: AdaptyPrice;\n /**\n * An information about period for a product discount.\n * @readonly\n */\n readonly subscriptionPeriod: AdaptySubscriptionPeriod;\n\n /**\n * A payment mode for this product discount.\n * @readonly\n */\n readonly paymentMode: OfferType;\n}\n\n/**\n * An object containing information about a subscription period.\n * @public\n */\nexport interface AdaptySubscriptionPeriod {\n /**\n * A number of period units.\n * @readonly\n */\n readonly numberOfUnits: number;\n /**\n * A unit of time that a subscription period is specified in.\n * @readonly\n */\n readonly unit: ProductPeriod;\n}\n\nexport interface AdaptyProfileParameters {\n analyticsDisabled?: boolean;\n codableCustomAttributes?: { [key: string]: any };\n appTrackingTransparencyStatus?: AppTrackingTransparencyStatus;\n firstName?: string;\n lastName?: string;\n gender?: Gender;\n birthday?: string;\n email?: string;\n phoneNumber?: string;\n}\n\nexport interface ProductReference {\n vendorId: string;\n adaptyId: string;\n accessLevelId: string;\n productType: string;\n\n ios?: {\n promotionalOfferId?: string;\n winBackOfferId?: string;\n };\n\n android?: {\n basePlanId?: string;\n offerId?: string;\n };\n}\n\n/**\n * Interface representing a product identifier with vendor and platform-specific information.\n * @public\n */\nexport interface AdaptyProductIdentifier {\n /**\n * The vendor-specific product identifier (e.g., App Store or Google Play product ID).\n * @readonly\n */\n readonly vendorProductId: string;\n\n /**\n * The base plan identifier for Google Play subscriptions (Android only).\n * @readonly\n */\n readonly basePlanId?: string;\n\n /**\n * Internal Adapty product identifier.\n * @readonly\n */\n readonly adaptyProductId: string;\n}\n\nexport const WebPresentation = Object.freeze({\n BrowserOutApp: 'browser_out_app',\n BrowserInApp: 'browser_in_app',\n});\nexport type WebPresentation =\n (typeof WebPresentation)[keyof typeof WebPresentation];\n\nexport const RefundPreference = Object.freeze({\n NoPreference: 'no_preference',\n Grant: 'grant',\n Decline: 'decline',\n});\nexport type RefundPreference =\n (typeof RefundPreference)[keyof typeof RefundPreference];\n\nexport type AdaptyInstallationStatus =\n | {\n status: 'not_available' | 'not_determined';\n }\n | {\n status: 'determined';\n details: AdaptyInstallationDetails;\n };\n\nexport interface AdaptyInstallationDetails {\n /**\n * A unique identifier for this installation.\n * @readonly\n */\n readonly installId?: string;\n /**\n * The date and time when the app was installed.\n * @readonly\n */\n readonly installTime: Date;\n /**\n * The total number of times the app has been launched.\n * @readonly\n */\n readonly appLaunchCount: number;\n /**\n * Custom payload data associated with the installation.\n * @readonly\n */\n readonly payload?: string;\n}\n\n\n"]}
|
|
@@ -102,10 +102,6 @@ export interface ActivateParamsInput {
|
|
|
102
102
|
*/
|
|
103
103
|
logLevel?: LogLevel;
|
|
104
104
|
serverCluster?: 'default' | 'eu' | 'cn';
|
|
105
|
-
backendBaseUrl?: string;
|
|
106
|
-
backendFallbackBaseUrl?: string;
|
|
107
|
-
backendConfigsBaseUrl?: string;
|
|
108
|
-
backendUABaseUrl?: string;
|
|
109
105
|
backendProxyHost?: string;
|
|
110
106
|
backendProxyPort?: number;
|
|
111
107
|
activateUi?: boolean;
|
|
@@ -142,6 +138,12 @@ export interface ActivateParamsInput {
|
|
|
142
138
|
* @platform ios
|
|
143
139
|
*/
|
|
144
140
|
appAccountToken?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Controls whether the SDK will create a new profile when the app is restored from an iCloud backup
|
|
143
|
+
* @defaultValue `false`
|
|
144
|
+
* @platform ios
|
|
145
|
+
*/
|
|
146
|
+
clearDataOnBackup?: boolean;
|
|
145
147
|
};
|
|
146
148
|
android?: {
|
|
147
149
|
/**
|
|
@@ -155,6 +157,12 @@ export interface ActivateParamsInput {
|
|
|
155
157
|
* @default false
|
|
156
158
|
*/
|
|
157
159
|
pendingPrepaidPlansEnabled?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Allows using local access level data on Android when available
|
|
162
|
+
* @platform android
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
localAccessLevelAllowed?: boolean;
|
|
158
166
|
/**
|
|
159
167
|
* Obfuscated account ID
|
|
160
168
|
* @platform android
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../../../src/shared/types/inputs.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC;;;OAGG;IACH,OAAO,EAAE,SAAS;IAClB;;OAEG;IACH,KAAK,EAAE,OAAO;IACd;;;;OAIG;IACH,IAAI,EAAE,MAAM;IACZ;;;OAGG;IACH,IAAI,EAAE,MAAM;CACb,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IACvC,2BAA2B,EAAE,gCAAgC;IAC7D,uBAAuB,EAAE,6BAA6B;IACtD,mCAAmC,EACjC,4CAA4C;CAC/C,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../../../src/shared/types/inputs.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC;;;OAGG;IACH,OAAO,EAAE,SAAS;IAClB;;OAEG;IACH,KAAK,EAAE,OAAO;IACd;;;;OAIG;IACH,IAAI,EAAE,MAAM;IACZ;;;OAGG;IACH,IAAI,EAAE,MAAM;CACb,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IACvC,2BAA2B,EAAE,gCAAgC;IAC7D,uBAAuB,EAAE,6BAA6B;IACtD,mCAAmC,EACjC,4CAA4C;CAC/C,CAAC,CAAC;AA8KH,MAAM,CAAC,MAAM,8CAA8C,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1E,eAAe,EAAE,mBAAmB;IACpC,QAAQ,EAAE,UAAU;IACpB,gBAAgB,EAAE,mBAAmB;IACrC,mBAAmB,EAAE,uBAAuB;IAC5C,iBAAiB,EAAE,qBAAqB;CACzC,CAAC,CAAC","sourcesContent":["import { AdaptyUiMediaCache } from '../../ui-builder/types';\n/**\n * Log levels for the SDK\n *\n * @remarks\n * Logging is performed on a native side.\n * So you are expected to watch logs in Xcode or Android Studio.\n */\nexport const LogLevel = Object.freeze({\n /**\n * Logs any additional information that may be useful during debugging,\n * such as function calls, API queries, etc.\n */\n VERBOSE: 'verbose',\n /**\n * Logs only errors\n */\n ERROR: 'error',\n /**\n * Logs messages from the SDK\n * that do not cause critical errors,\n * but are worth paying attention to\n */\n WARN: 'warn',\n /**\n * Logs various information messages,\n * such as those that log the lifecycle of various modules\n */\n INFO: 'info',\n});\n\nexport type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];\n\nexport const FetchPolicy = Object.freeze({\n ReloadRevalidatingCacheData: 'reload_revalidating_cache_data',\n ReturnCacheDataElseLoad: 'return_cache_data_else_load',\n ReturnCacheDataIfNotExpiredElseLoad:\n 'return_cache_data_if_not_expired_else_load',\n});\nexport type FetchPolicy = (typeof FetchPolicy)[keyof typeof FetchPolicy];\n\nexport type GetPlacementParamsInput =\n GetPlacementForDefaultAudienceParamsInput & {\n /**\n * This value limits the timeout (in milliseconds) for this method.\n *\n * @remarks\n * If the timeout is reached, cached data or local fallback will be returned.\n */\n loadTimeoutMs?: number;\n };\n\nexport type GetPlacementForDefaultAudienceParamsInput =\n | {\n /**\n * Fetch policy\n *\n * @remarks\n * By default SDK will try to load data from server and will return cached data in case of failure.\n * Otherwise use `'return_cache_data_else_load'` to return cached data if it exists.\n */\n fetchPolicy?: Exclude<\n FetchPolicy,\n 'return_cache_data_if_not_expired_else_load'\n >;\n }\n | {\n /**\n * Fetch policy\n *\n * @remarks\n * By default SDK will try to load data from server and will return cached data in case of failure.\n * Otherwise use `'return_cache_data_else_load'` to return cached data if it exists.\n */\n fetchPolicy: Extract<\n FetchPolicy,\n 'return_cache_data_if_not_expired_else_load'\n >;\n /**\n * Max age for cached data.\n *\n * @remarks\n * Max time (in seconds) the cache is valid in case of `'return_cache_data_if_not_expired_else_load'` fetch policy.\n */\n maxAgeSeconds: number;\n };\n\n/**\n * Describes optional parameters for the {@link activate} method.\n */\nexport interface ActivateParamsInput {\n /**\n * Turn it on if you handle purchases and subscription status yourself\n * and use Adapty for sending subscription events and analytics\n *\n * @defaultValue `false`\n */\n observerMode?: boolean;\n /**\n * User identifier in your system\n *\n * @remarks\n * If none of the parameters are passed, the SDK will generate an ID\n * and use it for a current device.\n * Use your own ID:\n * 1. If you want to support a cross-device experience\n * 2. If you have your own authentication system,\n * and you want to associate adapty profile with your user\n */\n customerUserId?: string;\n /**\n * Log level for the SDK\n *\n * @remarks\n * Logging is performed on a native side.\n * So you are expected to watch logs in Xcode or Android Studio.\n */\n logLevel?: LogLevel;\n\n serverCluster?: 'default' | 'eu' | 'cn';\n backendProxyHost?: string;\n backendProxyPort?: number;\n activateUi?: boolean;\n mediaCache?: AdaptyUiMediaCache;\n\n /**\n * Locks methods threads until the SDK is ready.\n * @defaultValue `false`\n * @deprecated Turned on by default\n */\n lockMethodsUntilReady?: boolean;\n /**\n * Does not activate SDK until any other method is called\n * Fixes annoying iOS simulator auhtentication\n */\n __debugDeferActivation?: boolean;\n /**\n * Ignores multiple activation attempts on fast refresh.\n * If true, skips activation if SDK is already activated.\n */\n __ignoreActivationOnFastRefresh?: boolean;\n /**\n * Disables IP address collection\n * @defaultValue `false`\n */\n ipAddressCollectionDisabled?: boolean;\n ios?: {\n /**\n * Disables IDFA collection\n * @default false\n */\n idfaCollectionDisabled?: boolean;\n /**\n * App account token for iOS\n * @platform ios\n */\n appAccountToken?: string;\n /**\n * Controls whether the SDK will create a new profile when the app is restored from an iCloud backup\n * @defaultValue `false`\n * @platform ios\n */\n clearDataOnBackup?: boolean;\n };\n android?: {\n /**\n * Disables Google AdvertisingID collection\n * @default false\n */\n adIdCollectionDisabled?: boolean;\n /**\n * Enable pending prepaid plans for Android\n * @platform android\n * @default false\n */\n pendingPrepaidPlansEnabled?: boolean;\n /**\n * Allows using local access level data on Android when available\n * @platform android\n * @default false\n */\n localAccessLevelAllowed?: boolean;\n /**\n * Obfuscated account ID\n * @platform android\n */\n obfuscatedAccountId?: string;\n };\n}\n\n/**\n * Describes optional parameters for the {@link identify} method.\n */\nexport interface IdentifyParamsInput {\n ios?: {\n /**\n * App account token for iOS\n * @platform ios\n */\n appAccountToken?: string;\n };\n android?: {\n /**\n * Obfuscated account ID\n * @platform android\n */\n obfuscatedAccountId?: string;\n };\n}\n\nexport interface GetPaywallProductsParamsInput {}\n\nexport const AdaptyAndroidSubscriptionUpdateReplacementMode = Object.freeze({\n ChargeFullPrice: 'charge_full_price',\n Deferred: 'deferred',\n WithoutProration: 'without_proration',\n ChargeProratedPrice: 'charge_prorated_price',\n WithTimeProration: 'with_time_proration',\n});\n// satisfies Record<\n// string,\n// Schema['Input.AdaptyAndroidSubscriptionUpdateParameters']['replacement_mode']\n// >;\n\nexport type AdaptyAndroidSubscriptionUpdateReplacementMode =\n (typeof AdaptyAndroidSubscriptionUpdateReplacementMode)[keyof typeof AdaptyAndroidSubscriptionUpdateReplacementMode];\n\nexport interface AdaptyAndroidSubscriptionUpdateParameters {\n oldSubVendorProductId: string;\n prorationMode: AdaptyAndroidSubscriptionUpdateReplacementMode;\n}\n\nexport interface AdaptyAndroidPurchaseParams {\n /**\n * Subscription update parameters\n * @platform android\n */\n subscriptionUpdateParams?: {\n oldSubVendorProductId: string;\n prorationMode: AdaptyAndroidSubscriptionUpdateReplacementMode;\n };\n /**\n * Whether the offer is personalized\n * @platform android\n * @see {@link https://developer.android.com/google/play/billing/integrate#personalized-price}\n */\n isOfferPersonalized?: boolean;\n}\n\nexport type MakePurchaseParamsInput = {\n /**\n * Android purchase parameters\n * @platform android\n */\n android?: AdaptyAndroidPurchaseParams;\n };\n\nexport type FileLocation = {\n ios: {\n fileName: string;\n };\n android:\n | {\n relativeAssetPath: string;\n }\n | {\n rawResName: string;\n };\n};\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { AdaptyError } from './method-types';
|
|
2
|
+
import type { AdaptyUiOnboardingMeta, OnboardingStateUpdatedAction } from '../../ui-builder/types';
|
|
3
|
+
export declare const OnboardingEventId: {
|
|
4
|
+
readonly Close: "onboarding_on_close_action";
|
|
5
|
+
readonly Custom: "onboarding_on_custom_action";
|
|
6
|
+
readonly Paywall: "onboarding_on_paywall_action";
|
|
7
|
+
readonly StateUpdated: "onboarding_on_state_updated_action";
|
|
8
|
+
readonly FinishedLoading: "onboarding_did_finish_loading";
|
|
9
|
+
readonly Analytics: "onboarding_on_analytics_action";
|
|
10
|
+
readonly Error: "onboarding_did_fail_with_error";
|
|
11
|
+
};
|
|
12
|
+
export type OnboardingEventIdType = (typeof OnboardingEventId)[keyof typeof OnboardingEventId];
|
|
13
|
+
export interface OnboardingEventView {
|
|
14
|
+
id: string;
|
|
15
|
+
placementId?: string;
|
|
16
|
+
variationId?: string;
|
|
17
|
+
}
|
|
18
|
+
interface BaseOnboardingEvent {
|
|
19
|
+
id: OnboardingEventIdType;
|
|
20
|
+
view: OnboardingEventView;
|
|
21
|
+
}
|
|
22
|
+
export interface OnboardingCloseEvent extends BaseOnboardingEvent {
|
|
23
|
+
id: typeof OnboardingEventId.Close;
|
|
24
|
+
actionId: string;
|
|
25
|
+
meta: AdaptyUiOnboardingMeta;
|
|
26
|
+
}
|
|
27
|
+
export interface OnboardingCustomEvent extends BaseOnboardingEvent {
|
|
28
|
+
id: typeof OnboardingEventId.Custom;
|
|
29
|
+
actionId: string;
|
|
30
|
+
meta: AdaptyUiOnboardingMeta;
|
|
31
|
+
}
|
|
32
|
+
export interface OnboardingPaywallEvent extends BaseOnboardingEvent {
|
|
33
|
+
id: typeof OnboardingEventId.Paywall;
|
|
34
|
+
actionId: string;
|
|
35
|
+
meta: AdaptyUiOnboardingMeta;
|
|
36
|
+
}
|
|
37
|
+
export interface OnboardingStateUpdatedEvent extends BaseOnboardingEvent {
|
|
38
|
+
id: typeof OnboardingEventId.StateUpdated;
|
|
39
|
+
action: OnboardingStateUpdatedAction;
|
|
40
|
+
meta: AdaptyUiOnboardingMeta;
|
|
41
|
+
}
|
|
42
|
+
export interface OnboardingFinishedLoadingEvent extends BaseOnboardingEvent {
|
|
43
|
+
id: typeof OnboardingEventId.FinishedLoading;
|
|
44
|
+
meta: AdaptyUiOnboardingMeta;
|
|
45
|
+
}
|
|
46
|
+
export interface OnboardingAnalyticsEvent extends BaseOnboardingEvent {
|
|
47
|
+
id: typeof OnboardingEventId.Analytics;
|
|
48
|
+
event: {
|
|
49
|
+
name: string;
|
|
50
|
+
elementId?: string;
|
|
51
|
+
reply?: string;
|
|
52
|
+
};
|
|
53
|
+
meta: AdaptyUiOnboardingMeta;
|
|
54
|
+
}
|
|
55
|
+
export interface OnboardingErrorEvent extends BaseOnboardingEvent {
|
|
56
|
+
id: typeof OnboardingEventId.Error;
|
|
57
|
+
error: AdaptyError;
|
|
58
|
+
}
|
|
59
|
+
export type ParsedOnboardingEvent = OnboardingCloseEvent | OnboardingCustomEvent | OnboardingPaywallEvent | OnboardingStateUpdatedEvent | OnboardingFinishedLoadingEvent | OnboardingAnalyticsEvent | OnboardingErrorEvent;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Onboarding Event IDs
|
|
2
|
+
export const OnboardingEventId = {
|
|
3
|
+
Close: 'onboarding_on_close_action',
|
|
4
|
+
Custom: 'onboarding_on_custom_action',
|
|
5
|
+
Paywall: 'onboarding_on_paywall_action',
|
|
6
|
+
StateUpdated: 'onboarding_on_state_updated_action',
|
|
7
|
+
FinishedLoading: 'onboarding_did_finish_loading',
|
|
8
|
+
Analytics: 'onboarding_on_analytics_action',
|
|
9
|
+
Error: 'onboarding_did_fail_with_error',
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=onboarding-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding-events.js","sourceRoot":"","sources":["../../../../src/shared/types/onboarding-events.ts"],"names":[],"mappings":"AAGA,uBAAuB;AACvB,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,KAAK,EAAE,4BAA4B;IACnC,MAAM,EAAE,6BAA6B;IACrC,OAAO,EAAE,8BAA8B;IACvC,YAAY,EAAE,oCAAoC;IAClD,eAAe,EAAE,+BAA+B;IAChD,SAAS,EAAE,gCAAgC;IAC3C,KAAK,EAAE,gCAAgC;CAC/B,CAAC","sourcesContent":["import type { AdaptyError } from './method-types';\nimport type { AdaptyUiOnboardingMeta, OnboardingStateUpdatedAction } from '../../ui-builder/types';\n\n// Onboarding Event IDs\nexport const OnboardingEventId = {\n Close: 'onboarding_on_close_action',\n Custom: 'onboarding_on_custom_action',\n Paywall: 'onboarding_on_paywall_action',\n StateUpdated: 'onboarding_on_state_updated_action',\n FinishedLoading: 'onboarding_did_finish_loading',\n Analytics: 'onboarding_on_analytics_action',\n Error: 'onboarding_did_fail_with_error',\n} as const;\n\nexport type OnboardingEventIdType = (typeof OnboardingEventId)[keyof typeof OnboardingEventId];\n\n// Event View\nexport interface OnboardingEventView {\n id: string;\n placementId?: string;\n variationId?: string;\n}\n\n// Base Event\ninterface BaseOnboardingEvent {\n id: OnboardingEventIdType;\n view: OnboardingEventView;\n}\n\n// Event Types\nexport interface OnboardingCloseEvent extends BaseOnboardingEvent {\n id: typeof OnboardingEventId.Close;\n actionId: string;\n meta: AdaptyUiOnboardingMeta;\n}\n\nexport interface OnboardingCustomEvent extends BaseOnboardingEvent {\n id: typeof OnboardingEventId.Custom;\n actionId: string;\n meta: AdaptyUiOnboardingMeta;\n}\n\nexport interface OnboardingPaywallEvent extends BaseOnboardingEvent {\n id: typeof OnboardingEventId.Paywall;\n actionId: string;\n meta: AdaptyUiOnboardingMeta;\n}\n\nexport interface OnboardingStateUpdatedEvent extends BaseOnboardingEvent {\n id: typeof OnboardingEventId.StateUpdated;\n action: OnboardingStateUpdatedAction;\n meta: AdaptyUiOnboardingMeta;\n}\n\nexport interface OnboardingFinishedLoadingEvent extends BaseOnboardingEvent {\n id: typeof OnboardingEventId.FinishedLoading;\n meta: AdaptyUiOnboardingMeta;\n}\n\nexport interface OnboardingAnalyticsEvent extends BaseOnboardingEvent {\n id: typeof OnboardingEventId.Analytics;\n event: { name: string; elementId?: string; reply?: string };\n meta: AdaptyUiOnboardingMeta;\n}\n\nexport interface OnboardingErrorEvent extends BaseOnboardingEvent {\n id: typeof OnboardingEventId.Error;\n error: AdaptyError;\n}\n\nexport type ParsedOnboardingEvent =\n | OnboardingCloseEvent\n | OnboardingCustomEvent\n | OnboardingPaywallEvent\n | OnboardingStateUpdatedEvent\n | OnboardingFinishedLoadingEvent\n | OnboardingAnalyticsEvent\n | OnboardingErrorEvent;\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { AdaptyPaywallProduct, AdaptyProfile, AdaptyPurchaseResult } from './';
|
|
2
|
+
import type { AdaptyError } from './method-types';
|
|
3
|
+
export declare const PaywallEventId: {
|
|
4
|
+
readonly DidAppear: "paywall_view_did_appear";
|
|
5
|
+
readonly DidDisappear: "paywall_view_did_disappear";
|
|
6
|
+
readonly DidPerformAction: "paywall_view_did_perform_action";
|
|
7
|
+
readonly DidSelectProduct: "paywall_view_did_select_product";
|
|
8
|
+
readonly DidStartPurchase: "paywall_view_did_start_purchase";
|
|
9
|
+
readonly DidFinishPurchase: "paywall_view_did_finish_purchase";
|
|
10
|
+
readonly DidFailPurchase: "paywall_view_did_fail_purchase";
|
|
11
|
+
readonly DidStartRestore: "paywall_view_did_start_restore";
|
|
12
|
+
readonly DidFinishRestore: "paywall_view_did_finish_restore";
|
|
13
|
+
readonly DidFailRestore: "paywall_view_did_fail_restore";
|
|
14
|
+
readonly DidFailRendering: "paywall_view_did_fail_rendering";
|
|
15
|
+
readonly DidFailLoadingProducts: "paywall_view_did_fail_loading_products";
|
|
16
|
+
readonly DidFinishWebPaymentNavigation: "paywall_view_did_finish_web_payment_navigation";
|
|
17
|
+
};
|
|
18
|
+
export type PaywallEventIdType = (typeof PaywallEventId)[keyof typeof PaywallEventId];
|
|
19
|
+
export interface PaywallEventView {
|
|
20
|
+
id: string;
|
|
21
|
+
placementId?: string;
|
|
22
|
+
variationId?: string;
|
|
23
|
+
}
|
|
24
|
+
interface BasePaywallEvent {
|
|
25
|
+
id: PaywallEventIdType;
|
|
26
|
+
view: PaywallEventView;
|
|
27
|
+
}
|
|
28
|
+
export interface PaywallDidAppearEvent extends BasePaywallEvent {
|
|
29
|
+
id: typeof PaywallEventId.DidAppear;
|
|
30
|
+
}
|
|
31
|
+
export interface PaywallDidDisappearEvent extends BasePaywallEvent {
|
|
32
|
+
id: typeof PaywallEventId.DidDisappear;
|
|
33
|
+
}
|
|
34
|
+
export interface PaywallDidPerformActionEvent extends BasePaywallEvent {
|
|
35
|
+
id: typeof PaywallEventId.DidPerformAction;
|
|
36
|
+
action: {
|
|
37
|
+
type: 'close' | 'system_back' | 'open_url' | 'custom';
|
|
38
|
+
value?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface PaywallDidSelectProductEvent extends BasePaywallEvent {
|
|
42
|
+
id: typeof PaywallEventId.DidSelectProduct;
|
|
43
|
+
productId: string;
|
|
44
|
+
}
|
|
45
|
+
export interface PaywallDidStartPurchaseEvent extends BasePaywallEvent {
|
|
46
|
+
id: typeof PaywallEventId.DidStartPurchase;
|
|
47
|
+
product: AdaptyPaywallProduct;
|
|
48
|
+
}
|
|
49
|
+
export interface PaywallDidFinishPurchaseEvent extends BasePaywallEvent {
|
|
50
|
+
id: typeof PaywallEventId.DidFinishPurchase;
|
|
51
|
+
purchaseResult: AdaptyPurchaseResult;
|
|
52
|
+
product: AdaptyPaywallProduct;
|
|
53
|
+
}
|
|
54
|
+
export interface PaywallDidFailPurchaseEvent extends BasePaywallEvent {
|
|
55
|
+
id: typeof PaywallEventId.DidFailPurchase;
|
|
56
|
+
error: AdaptyError;
|
|
57
|
+
product: AdaptyPaywallProduct;
|
|
58
|
+
}
|
|
59
|
+
export interface PaywallDidStartRestoreEvent extends BasePaywallEvent {
|
|
60
|
+
id: typeof PaywallEventId.DidStartRestore;
|
|
61
|
+
}
|
|
62
|
+
export interface PaywallDidFinishRestoreEvent extends BasePaywallEvent {
|
|
63
|
+
id: typeof PaywallEventId.DidFinishRestore;
|
|
64
|
+
profile: AdaptyProfile;
|
|
65
|
+
}
|
|
66
|
+
export interface PaywallDidFailRestoreEvent extends BasePaywallEvent {
|
|
67
|
+
id: typeof PaywallEventId.DidFailRestore;
|
|
68
|
+
error: AdaptyError;
|
|
69
|
+
}
|
|
70
|
+
export interface PaywallDidFailRenderingEvent extends BasePaywallEvent {
|
|
71
|
+
id: typeof PaywallEventId.DidFailRendering;
|
|
72
|
+
error: AdaptyError;
|
|
73
|
+
}
|
|
74
|
+
export interface PaywallDidFailLoadingProductsEvent extends BasePaywallEvent {
|
|
75
|
+
id: typeof PaywallEventId.DidFailLoadingProducts;
|
|
76
|
+
error: AdaptyError;
|
|
77
|
+
}
|
|
78
|
+
export interface PaywallDidFinishWebPaymentNavigationEvent extends BasePaywallEvent {
|
|
79
|
+
id: typeof PaywallEventId.DidFinishWebPaymentNavigation;
|
|
80
|
+
product?: AdaptyPaywallProduct;
|
|
81
|
+
error?: AdaptyError;
|
|
82
|
+
}
|
|
83
|
+
export type ParsedPaywallEvent = PaywallDidAppearEvent | PaywallDidDisappearEvent | PaywallDidPerformActionEvent | PaywallDidSelectProductEvent | PaywallDidStartPurchaseEvent | PaywallDidFinishPurchaseEvent | PaywallDidFailPurchaseEvent | PaywallDidStartRestoreEvent | PaywallDidFinishRestoreEvent | PaywallDidFailRestoreEvent | PaywallDidFailRenderingEvent | PaywallDidFailLoadingProductsEvent | PaywallDidFinishWebPaymentNavigationEvent;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const PaywallEventId = {
|
|
2
|
+
DidAppear: 'paywall_view_did_appear',
|
|
3
|
+
DidDisappear: 'paywall_view_did_disappear',
|
|
4
|
+
DidPerformAction: 'paywall_view_did_perform_action',
|
|
5
|
+
DidSelectProduct: 'paywall_view_did_select_product',
|
|
6
|
+
DidStartPurchase: 'paywall_view_did_start_purchase',
|
|
7
|
+
DidFinishPurchase: 'paywall_view_did_finish_purchase',
|
|
8
|
+
DidFailPurchase: 'paywall_view_did_fail_purchase',
|
|
9
|
+
DidStartRestore: 'paywall_view_did_start_restore',
|
|
10
|
+
DidFinishRestore: 'paywall_view_did_finish_restore',
|
|
11
|
+
DidFailRestore: 'paywall_view_did_fail_restore',
|
|
12
|
+
DidFailRendering: 'paywall_view_did_fail_rendering',
|
|
13
|
+
DidFailLoadingProducts: 'paywall_view_did_fail_loading_products',
|
|
14
|
+
DidFinishWebPaymentNavigation: 'paywall_view_did_finish_web_payment_navigation',
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=paywall-events.js.map
|