@adapty/core 3.15.0-dev.c9adddea2ef565925a6ee9343c88de4abc7c272e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2249 @@
1
+ //#region src/platform.ts
2
+ var Platform = class Platform {
3
+ static get OS() {
4
+ return Platform._os;
5
+ }
6
+ static set OS(value) {
7
+ Platform._os = value;
8
+ }
9
+ };
10
+ Platform._os = "unknown";
11
+
12
+ //#endregion
13
+ //#region src/logger/index.ts
14
+ /**
15
+ * LogScope provides methods for logging at different stages of execution
16
+ */
17
+ var LogScope = class {
18
+ start(_payload) {}
19
+ failed(_message) {}
20
+ success(_payload) {}
21
+ };
22
+ /**
23
+ * LogContext accumulates logs for each step of a call
24
+ */
25
+ var LogContext = class {
26
+ constructor() {
27
+ this.stack = [];
28
+ }
29
+ decode(_args) {
30
+ return new LogScope();
31
+ }
32
+ encode(_args) {
33
+ return new LogScope();
34
+ }
35
+ call(_args) {
36
+ return new LogScope();
37
+ }
38
+ bridge(_args) {
39
+ return new LogScope();
40
+ }
41
+ event(_args) {
42
+ return new LogScope();
43
+ }
44
+ };
45
+ /**
46
+ * Noop logger adapter - doesn't log anything
47
+ */
48
+ var NoopLoggerAdapter = class {
49
+ createContext() {
50
+ return new LogContext();
51
+ }
52
+ };
53
+
54
+ //#endregion
55
+ //#region src/adapters/defaults.ts
56
+ /**
57
+ * Default platform adapter with unknown OS
58
+ */
59
+ var DefaultPlatformAdapter = class {
60
+ get OS() {
61
+ return Platform.OS;
62
+ }
63
+ set OS(value) {
64
+ Platform.OS = value;
65
+ }
66
+ };
67
+ /**
68
+ * Default SDK metadata adapter
69
+ */
70
+ var DefaultSdkMetadataAdapter = class {
71
+ constructor(sdkName = "unknown", sdkVersion = "0.0.0") {
72
+ this.sdkName = sdkName;
73
+ this.sdkVersion = sdkVersion;
74
+ }
75
+ };
76
+
77
+ //#endregion
78
+ //#region src/types/error.ts
79
+ const ErrorCode = Object.freeze({
80
+ 0: "unknown",
81
+ 1: "clientInvalid",
82
+ 3: "paymentInvalid",
83
+ 4: "paymentNotAllowed",
84
+ 5: "storeProductNotAvailable",
85
+ 6: "cloudServicePermissionDenied",
86
+ 7: "cloudServiceNetworkConnectionFailed",
87
+ 8: "cloudServiceRevoked",
88
+ 9: "privacyAcknowledgementRequired",
89
+ 10: "unauthorizedRequestData",
90
+ 11: "invalidOfferIdentifier",
91
+ 12: "invalidSignature",
92
+ 13: "missingOfferParams",
93
+ 14: "invalidOfferPrice",
94
+ 20: "adaptyNotInitialized",
95
+ 22: "productNotFound",
96
+ 24: "currentSubscriptionToUpdateNotFoundInHistory",
97
+ 97: "billingServiceTimeout",
98
+ 98: "featureNotSupported",
99
+ 99: "billingServiceDisconnected",
100
+ 102: "billingServiceUnavailable",
101
+ 103: "billingUnavailable",
102
+ 105: "developerError",
103
+ 106: "billingError",
104
+ 107: "itemAlreadyOwned",
105
+ 108: "itemNotOwned",
106
+ 112: "billingNetworkError",
107
+ 1e3: "noProductIDsFound",
108
+ 1002: "productRequestFailed",
109
+ 1003: "cantMakePayments",
110
+ 1004: "noPurchasesToRestore",
111
+ 1005: "cantReadReceipt",
112
+ 1006: "productPurchaseFailed",
113
+ 1010: "refreshReceiptFailed",
114
+ 1011: "receiveRestoredTransactionsFailed",
115
+ 2002: "notActivated",
116
+ 2003: "badRequest",
117
+ 2004: "serverError",
118
+ 2005: "networkFailed",
119
+ 2006: "decodingFailed",
120
+ 2009: "encodingFailed",
121
+ 3e3: "analyticsDisabled",
122
+ 3001: "wrongParam",
123
+ 3005: "activateOnceError",
124
+ 3006: "profileWasChanged",
125
+ 3007: "unsupportedData",
126
+ 3100: "persistingDataError",
127
+ 3101: "fetchTimeoutError",
128
+ 9e3: "operationInterrupted"
129
+ });
130
+ function getErrorCode(error) {
131
+ const errorCode = Object.keys(ErrorCode).find((keyStr) => {
132
+ const key = Number(keyStr);
133
+ return ErrorCode[key] === error;
134
+ });
135
+ if (!errorCode) return void 0;
136
+ return Number(errorCode);
137
+ }
138
+ function getErrorPrompt(code) {
139
+ const prompt = ErrorCode[code];
140
+ if (!prompt) return `Unknown code: ${code}`;
141
+ return prompt;
142
+ }
143
+
144
+ //#endregion
145
+ //#region src/adapty-error.ts
146
+ var AdaptyError = class AdaptyError extends Error {
147
+ constructor(input) {
148
+ super(AdaptyError.getMessage(input));
149
+ this.adaptyCode = void 0;
150
+ this.localizedDescription = void 0;
151
+ this.detail = void 0;
152
+ this.adaptyCode = input.adaptyCode;
153
+ this.localizedDescription = input.message;
154
+ this.detail = input.detail;
155
+ if (AdaptyError.middleware) AdaptyError.middleware(this);
156
+ }
157
+ static set onError(callback) {
158
+ AdaptyError.middleware = callback;
159
+ }
160
+ static failedToDecodeNativeError(message, error) {
161
+ return new AdaptyError({
162
+ adaptyCode: 0,
163
+ message,
164
+ detail: JSON.stringify(error)
165
+ });
166
+ }
167
+ static failedToEncode(message) {
168
+ return new AdaptyError({
169
+ adaptyCode: 2009,
170
+ message
171
+ });
172
+ }
173
+ static failedToDecode(message) {
174
+ return new AdaptyError({
175
+ adaptyCode: 2006,
176
+ message
177
+ });
178
+ }
179
+ static getMessage(input) {
180
+ const code = input.adaptyCode;
181
+ const codeText = ErrorCode[code];
182
+ let message = `#${code} (${codeText}): ${input.message}`;
183
+ if (AdaptyError.prefix) message = `${AdaptyError.prefix} ${message}`;
184
+ return message;
185
+ }
186
+ };
187
+ AdaptyError.prefix = "";
188
+ AdaptyError.middleware = void 0;
189
+
190
+ //#endregion
191
+ //#region src/coders/coder.ts
192
+ var Coder = class {
193
+ constructor(platform = new DefaultPlatformAdapter()) {
194
+ this.platform = void 0;
195
+ this.platform = platform;
196
+ }
197
+ encode(data) {
198
+ return this.encodeWithProperties(data, this.properties);
199
+ }
200
+ decode(data) {
201
+ return this.decodeWithProperties(data, this.properties);
202
+ }
203
+ isType(value, type) {
204
+ switch (type) {
205
+ case "string":
206
+ case "boolean":
207
+ case "number": return typeof value === type;
208
+ case "object": return value !== null && typeof value === "object";
209
+ case "array": return Array.isArray(value);
210
+ }
211
+ }
212
+ getNestedValue(obj, key) {
213
+ const keys = key.split(".");
214
+ let current;
215
+ if (typeof obj === "string") try {
216
+ current = JSON.parse(obj);
217
+ } catch (error) {
218
+ return void 0;
219
+ }
220
+ else current = obj;
221
+ for (let i = 0; i < keys.length; i++) {
222
+ const key$1 = keys[i];
223
+ if (current[key$1] !== void 0) current = current[key$1];
224
+ else return void 0;
225
+ }
226
+ return current;
227
+ }
228
+ assignNestedValue(obj, key, value) {
229
+ const keys = String(key).split(".");
230
+ let currentObj = obj;
231
+ for (let i = 0; i < keys.length - 1; i++) {
232
+ const key$1 = keys[i];
233
+ if (currentObj[key$1] === void 0) currentObj[key$1] = {};
234
+ currentObj = currentObj[key$1];
235
+ }
236
+ currentObj[keys[keys.length - 1]] = value;
237
+ return obj;
238
+ }
239
+ encodeWithProperties(data, properties) {
240
+ const result = {};
241
+ for (const key in data) {
242
+ if (key === "ios" || key === "android") {
243
+ const platformResult = this.encodeWithProperties(data[key], properties[key]);
244
+ Object.assign(result, platformResult);
245
+ continue;
246
+ }
247
+ const property = properties[key];
248
+ if (!property) throw AdaptyError.failedToEncode(`Failed to find encoder for property "${key}"`);
249
+ const converter = property.converter;
250
+ this.assignNestedValue(result, property.key, converter ? converter.encode(data[key]) : data[key]);
251
+ }
252
+ return result;
253
+ }
254
+ decodeWithProperties(data, properties, platform) {
255
+ const result = {};
256
+ for (const key in properties) {
257
+ if (key === "android" || key === "ios") {
258
+ result[key] = this.decodeWithProperties(data, properties[key], key);
259
+ continue;
260
+ }
261
+ const property = properties[key];
262
+ if (!property) throw AdaptyError.failedToDecode(`Failed to find decoder for property "${key}"`);
263
+ const value = this.getNestedValue(data, property.key);
264
+ if (property.required && value === void 0 && (!platform || platform == this.platform.OS)) throw AdaptyError.failedToDecode(`Failed to decode native response, because it is missing required property "${key}"`);
265
+ if (value == null) continue;
266
+ if (!this.isType(value, property.type)) throw AdaptyError.failedToDecode(`Failed to decode native response, because its property "${key}" has invalid type. Expected type: ${property.type}. Received type: ${typeof value}`);
267
+ result[key] = property.converter ? property.converter.decode(value) : value;
268
+ }
269
+ return result;
270
+ }
271
+ };
272
+ var SimpleCoder = class extends Coder {};
273
+
274
+ //#endregion
275
+ //#region src/coders/date.ts
276
+ /**
277
+ * Format: yyyy-MM-dd'T'HH:mm:ss.SSSZ
278
+ * OpenAPI: Output.Date
279
+ */
280
+ var DateCoder = class {
281
+ decode(input) {
282
+ let pureValue = input;
283
+ if (!input.endsWith("Z")) {
284
+ const dateParts = input.split(/[-T:.Z]/);
285
+ const date = new Date(Date.UTC(parseInt(dateParts[0] ?? "0", 10), parseInt(dateParts[1] ?? "0", 10) - 1, parseInt(dateParts[2] ?? "0", 10), parseInt(dateParts[3] ?? "0", 10), parseInt(dateParts[4] ?? "0", 10), parseInt(dateParts[5] ?? "0", 10)));
286
+ pureValue = date.toISOString();
287
+ }
288
+ const parsedValue = Date.parse(pureValue);
289
+ if (isNaN(parsedValue)) throw AdaptyError.failedToDecode(`Failed to decode a date string into JS Date. String value: ${pureValue}`);
290
+ return new Date(parsedValue);
291
+ }
292
+ encode(value) {
293
+ return value.toISOString();
294
+ }
295
+ };
296
+
297
+ //#endregion
298
+ //#region src/coders/adapty-access-level.ts
299
+ var AdaptyAccessLevelCoder = class extends SimpleCoder {
300
+ constructor(..._args) {
301
+ super(..._args);
302
+ this.properties = {
303
+ activatedAt: {
304
+ key: "activated_at",
305
+ required: true,
306
+ type: "string",
307
+ converter: new DateCoder()
308
+ },
309
+ activeIntroductoryOfferType: {
310
+ key: "active_introductory_offer_type",
311
+ required: false,
312
+ type: "string"
313
+ },
314
+ activePromotionalOfferId: {
315
+ key: "active_promotional_offer_id",
316
+ required: false,
317
+ type: "string"
318
+ },
319
+ activePromotionalOfferType: {
320
+ key: "active_promotional_offer_type",
321
+ required: false,
322
+ type: "string"
323
+ },
324
+ billingIssueDetectedAt: {
325
+ key: "billing_issue_detected_at",
326
+ required: false,
327
+ type: "string",
328
+ converter: new DateCoder()
329
+ },
330
+ cancellationReason: {
331
+ key: "cancellation_reason",
332
+ required: false,
333
+ type: "string"
334
+ },
335
+ expiresAt: {
336
+ key: "expires_at",
337
+ required: false,
338
+ type: "string",
339
+ converter: new DateCoder()
340
+ },
341
+ id: {
342
+ key: "id",
343
+ required: true,
344
+ type: "string"
345
+ },
346
+ isActive: {
347
+ key: "is_active",
348
+ required: true,
349
+ type: "boolean"
350
+ },
351
+ isInGracePeriod: {
352
+ key: "is_in_grace_period",
353
+ required: true,
354
+ type: "boolean"
355
+ },
356
+ isLifetime: {
357
+ key: "is_lifetime",
358
+ required: true,
359
+ type: "boolean"
360
+ },
361
+ isRefund: {
362
+ key: "is_refund",
363
+ required: true,
364
+ type: "boolean"
365
+ },
366
+ renewedAt: {
367
+ key: "renewed_at",
368
+ required: false,
369
+ type: "string",
370
+ converter: new DateCoder()
371
+ },
372
+ startsAt: {
373
+ key: "starts_at",
374
+ required: false,
375
+ type: "string",
376
+ converter: new DateCoder()
377
+ },
378
+ store: {
379
+ key: "store",
380
+ required: true,
381
+ type: "string"
382
+ },
383
+ unsubscribedAt: {
384
+ key: "unsubscribed_at",
385
+ required: false,
386
+ type: "string",
387
+ converter: new DateCoder()
388
+ },
389
+ vendorProductId: {
390
+ key: "vendor_product_id",
391
+ required: true,
392
+ type: "string"
393
+ },
394
+ willRenew: {
395
+ key: "will_renew",
396
+ required: true,
397
+ type: "boolean"
398
+ },
399
+ android: { offerId: {
400
+ key: "offer_id",
401
+ required: false,
402
+ type: "string"
403
+ } }
404
+ };
405
+ }
406
+ };
407
+
408
+ //#endregion
409
+ //#region src/coders/adapty-ui-media-cache.ts
410
+ var AdaptyUiMediaCacheCoder = class extends SimpleCoder {
411
+ constructor(..._args) {
412
+ super(..._args);
413
+ this.properties = {
414
+ memoryStorageTotalCostLimit: {
415
+ key: "memory_storage_total_cost_limit",
416
+ required: false,
417
+ type: "number"
418
+ },
419
+ memoryStorageCountLimit: {
420
+ key: "memory_storage_count_limit",
421
+ required: false,
422
+ type: "number"
423
+ },
424
+ diskStorageSizeLimit: {
425
+ key: "disk_storage_size_limit",
426
+ required: false,
427
+ type: "number"
428
+ }
429
+ };
430
+ }
431
+ };
432
+
433
+ //#endregion
434
+ //#region src/coders/adapty-configuration.ts
435
+ var AdaptyConfigurationCoder = class {
436
+ constructor(platform, sdkMetadata) {
437
+ this.platform = platform;
438
+ this.sdkMetadata = sdkMetadata;
439
+ }
440
+ encode(apiKey, params) {
441
+ const config = {
442
+ api_key: apiKey,
443
+ cross_platform_sdk_name: this.sdkMetadata.sdkName,
444
+ cross_platform_sdk_version: this.sdkMetadata.sdkVersion
445
+ };
446
+ if (params.customerUserId) config["customer_user_id"] = params.customerUserId;
447
+ config["observer_mode"] = params.observerMode ?? false;
448
+ config["ip_address_collection_disabled"] = params.ipAddressCollectionDisabled ?? false;
449
+ if (params.logLevel) config["log_level"] = params.logLevel;
450
+ config["server_cluster"] = params.serverCluster ?? "default";
451
+ if (params.backendProxyHost) config["backend_proxy_host"] = params.backendProxyHost;
452
+ if (params.backendProxyPort) config["backend_proxy_port"] = params.backendProxyPort;
453
+ config["activate_ui"] = params.activateUi ?? true;
454
+ const mediaCacheCoder = new AdaptyUiMediaCacheCoder();
455
+ config["media_cache"] = mediaCacheCoder.encode(params.mediaCache ?? {
456
+ memoryStorageTotalCostLimit: 100 * 1024 * 1024,
457
+ memoryStorageCountLimit: 2147483647,
458
+ diskStorageSizeLimit: 100 * 1024 * 1024
459
+ });
460
+ if (this.platform.OS === "ios") {
461
+ config["apple_idfa_collection_disabled"] = params.ios?.idfaCollectionDisabled ?? false;
462
+ if (params.ios?.appAccountToken) config["customer_identity_parameters"] = { app_account_token: params.ios.appAccountToken };
463
+ if (params.ios?.clearDataOnBackup !== void 0) config["clear_data_on_backup"] = params.ios.clearDataOnBackup;
464
+ }
465
+ if (this.platform.OS === "android") {
466
+ config["google_adid_collection_disabled"] = params.android?.adIdCollectionDisabled ?? false;
467
+ config["google_enable_pending_prepaid_plans"] = params.android?.pendingPrepaidPlansEnabled ?? false;
468
+ config["google_local_access_level_allowed"] = params.android?.localAccessLevelAllowed ?? false;
469
+ if (params.android?.obfuscatedAccountId) config["customer_identity_parameters"] = { obfuscated_account_id: params.android.obfuscatedAccountId };
470
+ }
471
+ return config;
472
+ }
473
+ };
474
+
475
+ //#endregion
476
+ //#region src/coders/adapty-subscription-period.ts
477
+ var AdaptySubscriptionPeriodCoder = class extends SimpleCoder {
478
+ constructor(..._args) {
479
+ super(..._args);
480
+ this.properties = {
481
+ unit: {
482
+ key: "unit",
483
+ required: true,
484
+ type: "string"
485
+ },
486
+ numberOfUnits: {
487
+ key: "number_of_units",
488
+ required: true,
489
+ type: "number"
490
+ }
491
+ };
492
+ }
493
+ };
494
+
495
+ //#endregion
496
+ //#region src/coders/adapty-price.ts
497
+ var AdaptyPriceCoder = class extends SimpleCoder {
498
+ constructor(..._args) {
499
+ super(..._args);
500
+ this.properties = {
501
+ amount: {
502
+ key: "amount",
503
+ required: true,
504
+ type: "number"
505
+ },
506
+ currencyCode: {
507
+ key: "currency_code",
508
+ required: false,
509
+ type: "string"
510
+ },
511
+ currencySymbol: {
512
+ key: "currency_symbol",
513
+ required: false,
514
+ type: "string"
515
+ },
516
+ localizedString: {
517
+ key: "localized_string",
518
+ required: false,
519
+ type: "string"
520
+ }
521
+ };
522
+ }
523
+ };
524
+
525
+ //#endregion
526
+ //#region src/coders/adapty-discount-phase.ts
527
+ var AdaptyDiscountPhaseCoder = class extends SimpleCoder {
528
+ constructor(..._args) {
529
+ super(..._args);
530
+ this.properties = {
531
+ localizedNumberOfPeriods: {
532
+ key: "localized_number_of_periods",
533
+ required: false,
534
+ type: "string"
535
+ },
536
+ localizedSubscriptionPeriod: {
537
+ key: "localized_subscription_period",
538
+ required: false,
539
+ type: "string"
540
+ },
541
+ numberOfPeriods: {
542
+ key: "number_of_periods",
543
+ required: true,
544
+ type: "number"
545
+ },
546
+ paymentMode: {
547
+ key: "payment_mode",
548
+ required: true,
549
+ type: "string"
550
+ },
551
+ price: {
552
+ key: "price",
553
+ required: true,
554
+ type: "object",
555
+ converter: new AdaptyPriceCoder()
556
+ },
557
+ subscriptionPeriod: {
558
+ key: "subscription_period",
559
+ required: true,
560
+ type: "object",
561
+ converter: new AdaptySubscriptionPeriodCoder()
562
+ }
563
+ };
564
+ }
565
+ };
566
+
567
+ //#endregion
568
+ //#region src/coders/adapty-identify-params.ts
569
+ var AdaptyIdentifyParamsCoder = class {
570
+ constructor(platform) {
571
+ this.platform = platform;
572
+ }
573
+ encode(params) {
574
+ if (!params) return void 0;
575
+ const result = {};
576
+ if (this.platform.OS === "ios" && params.ios?.appAccountToken) result.app_account_token = params.ios.appAccountToken;
577
+ if (this.platform.OS === "android" && params.android?.obfuscatedAccountId) result.obfuscated_account_id = params.android.obfuscatedAccountId;
578
+ return Object.keys(result).length > 0 ? result : void 0;
579
+ }
580
+ };
581
+
582
+ //#endregion
583
+ //#region src/coders/adapty-installation-details.ts
584
+ var AdaptyInstallationDetailsCoder = class {
585
+ encode(model) {
586
+ const result = {
587
+ install_time: new DateCoder().encode(model.installTime),
588
+ app_launch_count: model.appLaunchCount
589
+ };
590
+ if (model.installId) result.install_id = model.installId;
591
+ if (model.payload) result.payload = model.payload;
592
+ return result;
593
+ }
594
+ decode(json) {
595
+ return {
596
+ installTime: new DateCoder().decode(json.install_time),
597
+ appLaunchCount: json.app_launch_count,
598
+ installId: json.install_id,
599
+ payload: json.payload
600
+ };
601
+ }
602
+ };
603
+
604
+ //#endregion
605
+ //#region src/coders/adapty-installation-status.ts
606
+ var AdaptyInstallationStatusCoder = class {
607
+ encode(model) {
608
+ if (model.status === "determined") {
609
+ const details = {
610
+ install_time: new DateCoder().encode(model.details.installTime),
611
+ app_launch_count: model.details.appLaunchCount
612
+ };
613
+ if (model.details.installId) details.install_id = model.details.installId;
614
+ if (model.details.payload) details.payload = model.details.payload;
615
+ return {
616
+ status: "determined",
617
+ details
618
+ };
619
+ }
620
+ return { status: model.status };
621
+ }
622
+ decode(json) {
623
+ if (json.status === "determined") {
624
+ const details = {
625
+ installTime: new DateCoder().decode(json.details.install_time),
626
+ appLaunchCount: json.details.app_launch_count,
627
+ installId: json.details.install_id,
628
+ payload: json.details.payload
629
+ };
630
+ return {
631
+ status: "determined",
632
+ details
633
+ };
634
+ }
635
+ return { status: json.status };
636
+ }
637
+ };
638
+
639
+ //#endregion
640
+ //#region src/coders/adapty-native-error.ts
641
+ var AdaptyNativeErrorCoder = class extends SimpleCoder {
642
+ constructor(..._args) {
643
+ super(..._args);
644
+ this.type = "error";
645
+ this.properties = {
646
+ adaptyCode: {
647
+ key: "adapty_code",
648
+ required: true,
649
+ type: "number"
650
+ },
651
+ message: {
652
+ key: "message",
653
+ required: true,
654
+ type: "string"
655
+ },
656
+ detail: {
657
+ key: "detail",
658
+ required: false,
659
+ type: "string"
660
+ }
661
+ };
662
+ }
663
+ getError(data) {
664
+ return new AdaptyError({
665
+ adaptyCode: data.adaptyCode,
666
+ message: data.message,
667
+ detail: data.detail
668
+ });
669
+ }
670
+ };
671
+
672
+ //#endregion
673
+ //#region src/coders/adapty-non-subscription.ts
674
+ var AdaptyNonSubscriptionCoder = class extends SimpleCoder {
675
+ constructor(..._args) {
676
+ super(..._args);
677
+ this.properties = {
678
+ isConsumable: {
679
+ key: "is_consumable",
680
+ required: true,
681
+ type: "boolean"
682
+ },
683
+ isRefund: {
684
+ key: "is_refund",
685
+ required: true,
686
+ type: "boolean"
687
+ },
688
+ isSandbox: {
689
+ key: "is_sandbox",
690
+ required: true,
691
+ type: "boolean"
692
+ },
693
+ purchasedAt: {
694
+ key: "purchased_at",
695
+ required: true,
696
+ type: "string",
697
+ converter: new DateCoder()
698
+ },
699
+ purchaseId: {
700
+ key: "purchase_id",
701
+ required: true,
702
+ type: "string"
703
+ },
704
+ store: {
705
+ key: "store",
706
+ required: true,
707
+ type: "string"
708
+ },
709
+ vendorProductId: {
710
+ key: "vendor_product_id",
711
+ required: true,
712
+ type: "string"
713
+ },
714
+ vendorTransactionId: {
715
+ key: "vendor_transaction_id",
716
+ required: false,
717
+ type: "string"
718
+ }
719
+ };
720
+ }
721
+ };
722
+
723
+ //#endregion
724
+ //#region src/coders/adapty-onboarding-builder.ts
725
+ var AdaptyOnboardingBuilderCoder = class extends SimpleCoder {
726
+ constructor(..._args) {
727
+ super(..._args);
728
+ this.properties = { url: {
729
+ key: "config_url",
730
+ required: true,
731
+ type: "string"
732
+ } };
733
+ }
734
+ };
735
+
736
+ //#endregion
737
+ //#region src/coders/json.ts
738
+ var JSONCoder = class {
739
+ decode(input) {
740
+ if (!input) return {};
741
+ return JSON.parse(input);
742
+ }
743
+ encode(value) {
744
+ if (Object.keys(value).length === 0) return "";
745
+ return JSON.stringify(value);
746
+ }
747
+ };
748
+
749
+ //#endregion
750
+ //#region src/coders/adapty-remote-config.ts
751
+ var AdaptyRemoteConfigCoder = class extends Coder {
752
+ constructor(..._args) {
753
+ super(..._args);
754
+ this.properties = {
755
+ data: {
756
+ key: "data",
757
+ required: true,
758
+ type: "string",
759
+ converter: new JSONCoder()
760
+ },
761
+ lang: {
762
+ key: "lang",
763
+ required: true,
764
+ type: "string"
765
+ }
766
+ };
767
+ }
768
+ decode(data) {
769
+ const codablePart = super.decode(data);
770
+ const dataString = JSON.stringify(codablePart.data);
771
+ return {
772
+ ...codablePart,
773
+ dataString: dataString.length < 4 ? "" : dataString
774
+ };
775
+ }
776
+ encode(data) {
777
+ const { dataString,...codablePart } = data;
778
+ return super.encode(codablePart);
779
+ }
780
+ };
781
+
782
+ //#endregion
783
+ //#region src/coders/adapty-placement.ts
784
+ var AdaptyPlacementCoder = class extends SimpleCoder {
785
+ constructor(..._args) {
786
+ super(..._args);
787
+ this.properties = {
788
+ abTestName: {
789
+ key: "ab_test_name",
790
+ required: true,
791
+ type: "string"
792
+ },
793
+ audienceName: {
794
+ key: "audience_name",
795
+ required: true,
796
+ type: "string"
797
+ },
798
+ id: {
799
+ key: "developer_id",
800
+ required: true,
801
+ type: "string"
802
+ },
803
+ revision: {
804
+ key: "revision",
805
+ required: true,
806
+ type: "number"
807
+ },
808
+ audienceVersionId: {
809
+ key: "placement_audience_version_id",
810
+ required: true,
811
+ type: "string"
812
+ },
813
+ isTrackingPurchases: {
814
+ key: "is_tracking_purchases",
815
+ required: false,
816
+ type: "boolean"
817
+ }
818
+ };
819
+ }
820
+ };
821
+
822
+ //#endregion
823
+ //#region src/coders/adapty-onboarding.ts
824
+ var AdaptyOnboardingCoder = class extends Coder {
825
+ constructor(..._args) {
826
+ super(..._args);
827
+ this.properties = {
828
+ placement: {
829
+ key: "placement",
830
+ required: true,
831
+ type: "object",
832
+ converter: new AdaptyPlacementCoder()
833
+ },
834
+ id: {
835
+ key: "onboarding_id",
836
+ required: true,
837
+ type: "string"
838
+ },
839
+ name: {
840
+ key: "onboarding_name",
841
+ required: true,
842
+ type: "string"
843
+ },
844
+ remoteConfig: {
845
+ key: "remote_config",
846
+ required: false,
847
+ type: "object",
848
+ converter: new AdaptyRemoteConfigCoder()
849
+ },
850
+ variationId: {
851
+ key: "variation_id",
852
+ required: true,
853
+ type: "string"
854
+ },
855
+ version: {
856
+ key: "response_created_at",
857
+ required: false,
858
+ type: "number"
859
+ },
860
+ onboardingBuilder: {
861
+ key: "onboarding_builder",
862
+ required: false,
863
+ type: "object",
864
+ converter: new AdaptyOnboardingBuilderCoder()
865
+ },
866
+ payloadData: {
867
+ key: "payload_data",
868
+ required: false,
869
+ type: "string"
870
+ },
871
+ requestLocale: {
872
+ key: "request_locale",
873
+ required: true,
874
+ type: "string"
875
+ }
876
+ };
877
+ }
878
+ decode(data) {
879
+ const codablePart = super.decode(data);
880
+ return {
881
+ ...codablePart,
882
+ hasViewConfiguration: codablePart.onboardingBuilder !== void 0
883
+ };
884
+ }
885
+ encode(data) {
886
+ const { hasViewConfiguration,...codablePart } = data;
887
+ return super.encode(codablePart);
888
+ }
889
+ };
890
+
891
+ //#endregion
892
+ //#region src/coders/adapty-paywall-builder.ts
893
+ var AdaptyPaywallBuilderCoder = class extends SimpleCoder {
894
+ constructor(..._args) {
895
+ super(..._args);
896
+ this.properties = {
897
+ id: {
898
+ key: "paywall_builder_id",
899
+ required: true,
900
+ type: "string"
901
+ },
902
+ lang: {
903
+ key: "lang",
904
+ required: true,
905
+ type: "string"
906
+ }
907
+ };
908
+ }
909
+ };
910
+
911
+ //#endregion
912
+ //#region src/coders/adapty-subscription-offer-identifier.ts
913
+ var AdaptySubscriptionOfferIdCoder = class extends SimpleCoder {
914
+ constructor(..._args) {
915
+ super(..._args);
916
+ this.properties = {
917
+ type: {
918
+ key: "type",
919
+ required: true,
920
+ type: "string"
921
+ },
922
+ id: {
923
+ key: "id",
924
+ required: false,
925
+ type: "string"
926
+ }
927
+ };
928
+ }
929
+ };
930
+
931
+ //#endregion
932
+ //#region src/coders/array.ts
933
+ var ArrayCoder = class {
934
+ constructor(coderFactory) {
935
+ this.coderFactory = coderFactory;
936
+ }
937
+ decode(input) {
938
+ const coder = this.coderFactory();
939
+ return input.map((item) => coder.decode(item));
940
+ }
941
+ encode(value) {
942
+ const coder = this.coderFactory();
943
+ return value.map((item) => coder.encode(item));
944
+ }
945
+ };
946
+
947
+ //#endregion
948
+ //#region src/coders/adapty-subscription-offer.ts
949
+ var AdaptySubscriptionOfferCoder = class extends SimpleCoder {
950
+ constructor(..._args) {
951
+ super(..._args);
952
+ this.properties = {
953
+ identifier: {
954
+ key: "offer_identifier",
955
+ required: true,
956
+ type: "object",
957
+ converter: new AdaptySubscriptionOfferIdCoder()
958
+ },
959
+ phases: {
960
+ key: "phases",
961
+ required: true,
962
+ type: "array",
963
+ converter: new ArrayCoder(() => new AdaptyDiscountPhaseCoder())
964
+ },
965
+ android: { offerTags: {
966
+ key: "offer_tags",
967
+ required: false,
968
+ type: "array"
969
+ } }
970
+ };
971
+ }
972
+ decode(data) {
973
+ const baseResult = super.decode(data);
974
+ if (!data.offer_tags) {
975
+ const { android,...partialData } = baseResult;
976
+ return partialData;
977
+ }
978
+ return baseResult;
979
+ }
980
+ };
981
+
982
+ //#endregion
983
+ //#region src/coders/adapty-subscription-details.ts
984
+ var AdaptySubscriptionDetailsCoder = class extends SimpleCoder {
985
+ constructor(..._args) {
986
+ super(..._args);
987
+ this.properties = {
988
+ subscriptionPeriod: {
989
+ key: "period",
990
+ required: true,
991
+ type: "object",
992
+ converter: new AdaptySubscriptionPeriodCoder()
993
+ },
994
+ localizedSubscriptionPeriod: {
995
+ key: "localized_period",
996
+ required: false,
997
+ type: "string"
998
+ },
999
+ offer: {
1000
+ key: "offer",
1001
+ required: false,
1002
+ type: "object",
1003
+ converter: new AdaptySubscriptionOfferCoder()
1004
+ },
1005
+ ios: { subscriptionGroupIdentifier: {
1006
+ key: "group_identifier",
1007
+ required: false,
1008
+ type: "string"
1009
+ } },
1010
+ android: {
1011
+ basePlanId: {
1012
+ key: "base_plan_id",
1013
+ required: true,
1014
+ type: "string"
1015
+ },
1016
+ renewalType: {
1017
+ key: "renewal_type",
1018
+ required: false,
1019
+ type: "string"
1020
+ }
1021
+ }
1022
+ };
1023
+ }
1024
+ decode(data) {
1025
+ const baseResult = super.decode(data);
1026
+ const propToRemove = data.base_plan_id ? "ios" : "android";
1027
+ const { [propToRemove]: _,...partialData } = baseResult;
1028
+ return partialData;
1029
+ }
1030
+ };
1031
+
1032
+ //#endregion
1033
+ //#region src/coders/adapty-paywall-product.ts
1034
+ var AdaptyPaywallProductCoder = class extends SimpleCoder {
1035
+ constructor(..._args) {
1036
+ super(..._args);
1037
+ this.properties = {
1038
+ vendorProductId: {
1039
+ key: "vendor_product_id",
1040
+ required: true,
1041
+ type: "string"
1042
+ },
1043
+ adaptyId: {
1044
+ key: "adapty_product_id",
1045
+ required: true,
1046
+ type: "string"
1047
+ },
1048
+ paywallProductIndex: {
1049
+ key: "paywall_product_index",
1050
+ required: true,
1051
+ type: "number"
1052
+ },
1053
+ localizedDescription: {
1054
+ key: "localized_description",
1055
+ required: true,
1056
+ type: "string"
1057
+ },
1058
+ localizedTitle: {
1059
+ key: "localized_title",
1060
+ required: true,
1061
+ type: "string"
1062
+ },
1063
+ regionCode: {
1064
+ key: "region_code",
1065
+ required: false,
1066
+ type: "string"
1067
+ },
1068
+ variationId: {
1069
+ key: "paywall_variation_id",
1070
+ required: true,
1071
+ type: "string"
1072
+ },
1073
+ paywallABTestName: {
1074
+ key: "paywall_ab_test_name",
1075
+ required: true,
1076
+ type: "string"
1077
+ },
1078
+ paywallName: {
1079
+ key: "paywall_name",
1080
+ required: true,
1081
+ type: "string"
1082
+ },
1083
+ accessLevelId: {
1084
+ key: "access_level_id",
1085
+ required: true,
1086
+ type: "string"
1087
+ },
1088
+ productType: {
1089
+ key: "product_type",
1090
+ required: true,
1091
+ type: "string"
1092
+ },
1093
+ price: {
1094
+ key: "price",
1095
+ required: false,
1096
+ type: "object",
1097
+ converter: new AdaptyPriceCoder()
1098
+ },
1099
+ webPurchaseUrl: {
1100
+ key: "web_purchase_url",
1101
+ required: false,
1102
+ type: "string"
1103
+ },
1104
+ payloadData: {
1105
+ key: "payload_data",
1106
+ required: false,
1107
+ type: "string"
1108
+ },
1109
+ subscription: {
1110
+ key: "subscription",
1111
+ required: false,
1112
+ type: "object",
1113
+ converter: new AdaptySubscriptionDetailsCoder()
1114
+ },
1115
+ ios: { isFamilyShareable: {
1116
+ key: "is_family_shareable",
1117
+ required: true,
1118
+ type: "boolean"
1119
+ } }
1120
+ };
1121
+ }
1122
+ getInput(data) {
1123
+ return {
1124
+ adapty_product_id: data.adapty_product_id,
1125
+ access_level_id: data.access_level_id,
1126
+ product_type: data.product_type,
1127
+ paywall_product_index: data.paywall_product_index,
1128
+ paywall_ab_test_name: data.paywall_ab_test_name,
1129
+ payload_data: data.payload_data,
1130
+ paywall_name: data.paywall_name,
1131
+ paywall_variation_id: data.paywall_variation_id,
1132
+ subscription_offer_identifier: data.subscription?.offer?.offer_identifier,
1133
+ vendor_product_id: data.vendor_product_id
1134
+ };
1135
+ }
1136
+ };
1137
+
1138
+ //#endregion
1139
+ //#region src/coders/product-reference.ts
1140
+ var ProductReferenceCoder = class extends SimpleCoder {
1141
+ constructor(..._args) {
1142
+ super(..._args);
1143
+ this.properties = {
1144
+ vendorId: {
1145
+ key: "vendor_product_id",
1146
+ required: true,
1147
+ type: "string"
1148
+ },
1149
+ adaptyId: {
1150
+ key: "adapty_product_id",
1151
+ required: true,
1152
+ type: "string"
1153
+ },
1154
+ accessLevelId: {
1155
+ key: "access_level_id",
1156
+ required: true,
1157
+ type: "string"
1158
+ },
1159
+ productType: {
1160
+ key: "product_type",
1161
+ required: true,
1162
+ type: "string"
1163
+ },
1164
+ ios: {
1165
+ promotionalOfferId: {
1166
+ key: "promotional_offer_id",
1167
+ required: false,
1168
+ type: "string"
1169
+ },
1170
+ winBackOfferId: {
1171
+ key: "win_back_offer_id",
1172
+ required: false,
1173
+ type: "string"
1174
+ }
1175
+ },
1176
+ android: {
1177
+ basePlanId: {
1178
+ key: "base_plan_id",
1179
+ required: false,
1180
+ type: "string"
1181
+ },
1182
+ offerId: {
1183
+ key: "offer_id",
1184
+ required: false,
1185
+ type: "string"
1186
+ }
1187
+ }
1188
+ };
1189
+ }
1190
+ };
1191
+
1192
+ //#endregion
1193
+ //#region src/coders/adapty-paywall.ts
1194
+ var AdaptyPaywallCoder = class extends Coder {
1195
+ constructor(..._args) {
1196
+ super(..._args);
1197
+ this.properties = {
1198
+ placement: {
1199
+ key: "placement",
1200
+ required: true,
1201
+ type: "object",
1202
+ converter: new AdaptyPlacementCoder()
1203
+ },
1204
+ id: {
1205
+ key: "paywall_id",
1206
+ required: true,
1207
+ type: "string"
1208
+ },
1209
+ name: {
1210
+ key: "paywall_name",
1211
+ required: true,
1212
+ type: "string"
1213
+ },
1214
+ products: {
1215
+ key: "products",
1216
+ required: true,
1217
+ type: "array",
1218
+ converter: new ArrayCoder(() => new ProductReferenceCoder())
1219
+ },
1220
+ remoteConfig: {
1221
+ key: "remote_config",
1222
+ required: false,
1223
+ type: "object",
1224
+ converter: new AdaptyRemoteConfigCoder()
1225
+ },
1226
+ variationId: {
1227
+ key: "variation_id",
1228
+ required: true,
1229
+ type: "string"
1230
+ },
1231
+ version: {
1232
+ key: "response_created_at",
1233
+ required: false,
1234
+ type: "number"
1235
+ },
1236
+ paywallBuilder: {
1237
+ key: "paywall_builder",
1238
+ required: false,
1239
+ type: "object",
1240
+ converter: new AdaptyPaywallBuilderCoder()
1241
+ },
1242
+ webPurchaseUrl: {
1243
+ key: "web_purchase_url",
1244
+ required: false,
1245
+ type: "string"
1246
+ },
1247
+ payloadData: {
1248
+ key: "payload_data",
1249
+ required: false,
1250
+ type: "string"
1251
+ },
1252
+ requestLocale: {
1253
+ key: "request_locale",
1254
+ required: true,
1255
+ type: "string"
1256
+ }
1257
+ };
1258
+ }
1259
+ decode(data) {
1260
+ const codablePart = super.decode(data);
1261
+ return {
1262
+ ...codablePart,
1263
+ hasViewConfiguration: codablePart.paywallBuilder !== void 0,
1264
+ productIdentifiers: codablePart.products.map((product) => ({
1265
+ vendorProductId: product.vendorId,
1266
+ adaptyProductId: product.adaptyId,
1267
+ basePlanId: product.android?.basePlanId
1268
+ }))
1269
+ };
1270
+ }
1271
+ encode(data) {
1272
+ const { hasViewConfiguration, productIdentifiers,...codablePart } = data;
1273
+ return super.encode(codablePart);
1274
+ }
1275
+ };
1276
+
1277
+ //#endregion
1278
+ //#region src/coders/adapty-profile-parameters.ts
1279
+ var AdaptyProfileParametersCoder = class extends SimpleCoder {
1280
+ constructor(..._args) {
1281
+ super(..._args);
1282
+ this.properties = {
1283
+ firstName: {
1284
+ key: "first_name",
1285
+ required: false,
1286
+ type: "string"
1287
+ },
1288
+ lastName: {
1289
+ key: "last_name",
1290
+ required: false,
1291
+ type: "string"
1292
+ },
1293
+ gender: {
1294
+ key: "gender",
1295
+ required: false,
1296
+ type: "string"
1297
+ },
1298
+ birthday: {
1299
+ key: "birthday",
1300
+ required: false,
1301
+ type: "string"
1302
+ },
1303
+ email: {
1304
+ key: "email",
1305
+ required: false,
1306
+ type: "string"
1307
+ },
1308
+ phoneNumber: {
1309
+ key: "phone_number",
1310
+ required: false,
1311
+ type: "string"
1312
+ },
1313
+ appTrackingTransparencyStatus: {
1314
+ key: "att_status",
1315
+ required: false,
1316
+ type: "number"
1317
+ },
1318
+ codableCustomAttributes: {
1319
+ key: "custom_attributes",
1320
+ required: false,
1321
+ type: "object"
1322
+ },
1323
+ analyticsDisabled: {
1324
+ key: "analytics_disabled",
1325
+ required: false,
1326
+ type: "boolean"
1327
+ }
1328
+ };
1329
+ }
1330
+ };
1331
+
1332
+ //#endregion
1333
+ //#region src/coders/adapty-subscription.ts
1334
+ var AdaptySubscriptionCoder = class extends SimpleCoder {
1335
+ constructor(..._args) {
1336
+ super(..._args);
1337
+ this.properties = {
1338
+ isActive: {
1339
+ key: "is_active",
1340
+ required: true,
1341
+ type: "boolean"
1342
+ },
1343
+ isLifetime: {
1344
+ key: "is_lifetime",
1345
+ required: true,
1346
+ type: "boolean"
1347
+ },
1348
+ vendorProductId: {
1349
+ key: "vendor_product_id",
1350
+ required: true,
1351
+ type: "string"
1352
+ },
1353
+ store: {
1354
+ key: "store",
1355
+ required: true,
1356
+ type: "string"
1357
+ },
1358
+ vendorTransactionId: {
1359
+ key: "vendor_transaction_id",
1360
+ required: true,
1361
+ type: "string"
1362
+ },
1363
+ vendorOriginalTransactionId: {
1364
+ key: "vendor_original_transaction_id",
1365
+ required: true,
1366
+ type: "string"
1367
+ },
1368
+ activatedAt: {
1369
+ key: "activated_at",
1370
+ required: true,
1371
+ type: "string",
1372
+ converter: new DateCoder()
1373
+ },
1374
+ willRenew: {
1375
+ key: "will_renew",
1376
+ required: true,
1377
+ type: "boolean"
1378
+ },
1379
+ isInGracePeriod: {
1380
+ key: "is_in_grace_period",
1381
+ required: true,
1382
+ type: "boolean"
1383
+ },
1384
+ isRefund: {
1385
+ key: "is_refund",
1386
+ required: true,
1387
+ type: "boolean"
1388
+ },
1389
+ isSandbox: {
1390
+ key: "is_sandbox",
1391
+ required: true,
1392
+ type: "boolean"
1393
+ },
1394
+ renewedAt: {
1395
+ key: "renewed_at",
1396
+ required: false,
1397
+ type: "string",
1398
+ converter: new DateCoder()
1399
+ },
1400
+ expiresAt: {
1401
+ key: "expires_at",
1402
+ required: false,
1403
+ type: "string",
1404
+ converter: new DateCoder()
1405
+ },
1406
+ startsAt: {
1407
+ key: "starts_at",
1408
+ required: false,
1409
+ type: "string",
1410
+ converter: new DateCoder()
1411
+ },
1412
+ unsubscribedAt: {
1413
+ key: "unsubscribed_at",
1414
+ required: false,
1415
+ type: "string",
1416
+ converter: new DateCoder()
1417
+ },
1418
+ billingIssueDetectedAt: {
1419
+ key: "billing_issue_detected_at",
1420
+ required: false,
1421
+ type: "string",
1422
+ converter: new DateCoder()
1423
+ },
1424
+ activeIntroductoryOfferType: {
1425
+ key: "active_introductory_offer_type",
1426
+ required: false,
1427
+ type: "string"
1428
+ },
1429
+ activePromotionalOfferType: {
1430
+ key: "active_promotional_offer_type",
1431
+ required: false,
1432
+ type: "string"
1433
+ },
1434
+ activePromotionalOfferId: {
1435
+ key: "active_promotional_offer_id",
1436
+ required: false,
1437
+ type: "string"
1438
+ },
1439
+ cancellationReason: {
1440
+ key: "cancellation_reason",
1441
+ required: false,
1442
+ type: "string"
1443
+ }
1444
+ };
1445
+ }
1446
+ };
1447
+
1448
+ //#endregion
1449
+ //#region src/coders/hashmap.ts
1450
+ var HashmapCoder = class {
1451
+ constructor(coder) {
1452
+ this.coder = void 0;
1453
+ this.coder = coder;
1454
+ }
1455
+ decode(input) {
1456
+ const result = {};
1457
+ Object.keys(input).forEach((key) => {
1458
+ const property = input[key];
1459
+ result[key] = this.coder?.decode(property) ?? property;
1460
+ });
1461
+ return result;
1462
+ }
1463
+ encode(value) {
1464
+ const result = {};
1465
+ Object.keys(value).forEach((key) => {
1466
+ const property = value[key];
1467
+ result[key] = this.coder?.encode(property) ?? property;
1468
+ });
1469
+ return result;
1470
+ }
1471
+ };
1472
+
1473
+ //#endregion
1474
+ //#region src/coders/adapty-profile.ts
1475
+ var AdaptyProfileCoder = class extends SimpleCoder {
1476
+ constructor(..._args) {
1477
+ super(..._args);
1478
+ this.properties = {
1479
+ accessLevels: {
1480
+ key: "paid_access_levels",
1481
+ required: false,
1482
+ type: "object",
1483
+ converter: new HashmapCoder(new AdaptyAccessLevelCoder())
1484
+ },
1485
+ customAttributes: {
1486
+ key: "custom_attributes",
1487
+ required: false,
1488
+ type: "object"
1489
+ },
1490
+ customerUserId: {
1491
+ key: "customer_user_id",
1492
+ required: false,
1493
+ type: "string"
1494
+ },
1495
+ nonSubscriptions: {
1496
+ key: "non_subscriptions",
1497
+ required: false,
1498
+ type: "object",
1499
+ converter: new HashmapCoder(new ArrayCoder(() => new AdaptyNonSubscriptionCoder()))
1500
+ },
1501
+ profileId: {
1502
+ key: "profile_id",
1503
+ required: true,
1504
+ type: "string"
1505
+ },
1506
+ subscriptions: {
1507
+ key: "subscriptions",
1508
+ required: false,
1509
+ type: "object",
1510
+ converter: new HashmapCoder(new AdaptySubscriptionCoder())
1511
+ }
1512
+ };
1513
+ }
1514
+ };
1515
+
1516
+ //#endregion
1517
+ //#region src/coders/adapty-purchase-params.ts
1518
+ function isDeprecatedType(data) {
1519
+ return data && data.android && "oldSubVendorProductId" in data.android && "prorationMode" in data.android;
1520
+ }
1521
+ var AdaptyPurchaseParamsCoder = class {
1522
+ constructor(platform) {
1523
+ this.platform = platform;
1524
+ }
1525
+ encode(data) {
1526
+ if (this.platform.OS !== "android") return {};
1527
+ const purchaseParams = {};
1528
+ if (isDeprecatedType(data)) {
1529
+ if (data.android) {
1530
+ purchaseParams["subscription_update_params"] = {
1531
+ replacement_mode: data.android.prorationMode,
1532
+ old_sub_vendor_product_id: data.android.oldSubVendorProductId
1533
+ };
1534
+ if (data.android.isOfferPersonalized) purchaseParams["is_offer_personalized"] = data.android.isOfferPersonalized;
1535
+ }
1536
+ return purchaseParams;
1537
+ }
1538
+ if (data.android) {
1539
+ if (data.android.subscriptionUpdateParams) purchaseParams["subscription_update_params"] = {
1540
+ replacement_mode: data.android.subscriptionUpdateParams.prorationMode,
1541
+ old_sub_vendor_product_id: data.android.subscriptionUpdateParams.oldSubVendorProductId
1542
+ };
1543
+ if (data.android.isOfferPersonalized !== void 0) purchaseParams["is_offer_personalized"] = data.android.isOfferPersonalized;
1544
+ }
1545
+ return purchaseParams;
1546
+ }
1547
+ };
1548
+
1549
+ //#endregion
1550
+ //#region src/coders/adapty-purchase-result.ts
1551
+ var AdaptyPurchaseResultCoder = class extends SimpleCoder {
1552
+ constructor(..._args) {
1553
+ super(..._args);
1554
+ this.properties = { type: {
1555
+ key: "type",
1556
+ required: true,
1557
+ type: "string"
1558
+ } };
1559
+ }
1560
+ decode(data) {
1561
+ const baseResult = super.decode(data);
1562
+ if (baseResult.type === "success") {
1563
+ if (!data.profile) throw new Error("Profile is required for success type of purchase result");
1564
+ return {
1565
+ ...baseResult,
1566
+ profile: new AdaptyProfileCoder(this.platform).decode(data.profile),
1567
+ ...this.platform.OS === "ios" && data.apple_jws_transaction ? { ios: { jwsTransaction: data.apple_jws_transaction } } : {},
1568
+ ...this.platform.OS === "android" && data.google_purchase_token ? { android: { purchaseToken: data.google_purchase_token } } : {}
1569
+ };
1570
+ }
1571
+ return baseResult;
1572
+ }
1573
+ encode(data) {
1574
+ const { type } = data;
1575
+ if (type === "success") {
1576
+ if (!("profile" in data)) throw new Error("Profile is required for success type of purchase result");
1577
+ return {
1578
+ type: "success",
1579
+ profile: new AdaptyProfileCoder(this.platform).encode(data.profile),
1580
+ ...this.platform.OS === "ios" && data.ios?.jwsTransaction ? { apple_jws_transaction: data.ios.jwsTransaction } : {},
1581
+ ...this.platform.OS === "android" && data.android?.purchaseToken ? { google_purchase_token: data.android.purchaseToken } : {}
1582
+ };
1583
+ }
1584
+ return super.encode({ type });
1585
+ }
1586
+ };
1587
+
1588
+ //#endregion
1589
+ //#region src/coders/adapty-ui-dialog-config.ts
1590
+ var AdaptyUiDialogConfigCoder = class extends SimpleCoder {
1591
+ constructor(..._args) {
1592
+ super(..._args);
1593
+ this.properties = {
1594
+ primaryActionTitle: {
1595
+ key: "default_action_title",
1596
+ required: true,
1597
+ type: "string"
1598
+ },
1599
+ secondaryActionTitle: {
1600
+ key: "secondary_action_title",
1601
+ required: false,
1602
+ type: "string"
1603
+ },
1604
+ title: {
1605
+ key: "title",
1606
+ required: false,
1607
+ type: "string"
1608
+ },
1609
+ content: {
1610
+ key: "content",
1611
+ required: false,
1612
+ type: "string"
1613
+ }
1614
+ };
1615
+ }
1616
+ };
1617
+
1618
+ //#endregion
1619
+ //#region src/coders/adapty-ui-create-onboarding-view-params.ts
1620
+ var AdaptyUICreateOnboardingViewParamsCoder = class {
1621
+ encode(data) {
1622
+ const result = {};
1623
+ if (data.externalUrlsPresentation) result.external_urls_presentation = data.externalUrlsPresentation;
1624
+ return result;
1625
+ }
1626
+ };
1627
+
1628
+ //#endregion
1629
+ //#region src/coders/utils.ts
1630
+ const formatDateUTC = (date) => {
1631
+ const pad = (num, digits = 2) => {
1632
+ const str = num.toString();
1633
+ const paddingLength = digits - str.length;
1634
+ return paddingLength > 0 ? "0".repeat(paddingLength) + str : str;
1635
+ };
1636
+ const year = date.getUTCFullYear();
1637
+ const month = pad(date.getUTCMonth() + 1);
1638
+ const day = pad(date.getUTCDate());
1639
+ const hours = pad(date.getUTCHours());
1640
+ const minutes = pad(date.getUTCMinutes());
1641
+ const seconds = pad(date.getUTCSeconds());
1642
+ const millis = pad(date.getUTCMilliseconds(), 3);
1643
+ return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${millis}Z`;
1644
+ };
1645
+ const colorToHex = {
1646
+ fromARGB(value) {
1647
+ const hex = value.toString(16).padStart(8, "0");
1648
+ return `#${hex.slice(2)}${hex.slice(0, 2)}`;
1649
+ },
1650
+ fromRGBA(value) {
1651
+ return `#${value.toString(16).padStart(8, "0")}`;
1652
+ },
1653
+ fromRGB(value) {
1654
+ return `#${value.toString(16).padStart(6, "0")}ff`;
1655
+ }
1656
+ };
1657
+ const extractBase64Data = (input) => {
1658
+ const commaIndex = input.indexOf(",");
1659
+ if (input.startsWith("data:") && commaIndex !== -1) return input.slice(commaIndex + 1);
1660
+ return input;
1661
+ };
1662
+ const resolveAssetId = (asset, platformOS) => {
1663
+ if ("relativeAssetPath" in asset) return platformOS === "android" ? `${asset.relativeAssetPath}a` : asset.relativeAssetPath;
1664
+ const fileLocation = asset.fileLocation;
1665
+ if (platformOS === "android") return "relativeAssetPath" in fileLocation.android ? `${fileLocation.android.relativeAssetPath}a` : `${fileLocation.android.rawResName}r`;
1666
+ return fileLocation.ios.fileName;
1667
+ };
1668
+
1669
+ //#endregion
1670
+ //#region src/coders/adapty-ui-create-paywall-view-params.ts
1671
+ var AdaptyUICreatePaywallViewParamsCoder = class {
1672
+ constructor(platform) {
1673
+ this.platform = platform;
1674
+ }
1675
+ encode(data) {
1676
+ const result = {};
1677
+ if (data.prefetchProducts !== void 0) result.preload_products = data.prefetchProducts;
1678
+ if (data.loadTimeoutMs !== void 0) result.load_timeout = data.loadTimeoutMs / 1e3;
1679
+ if (data.customTags) result.custom_tags = data.customTags;
1680
+ if (data.customTimers) result.custom_timers = this.encodeCustomTimers(data.customTimers);
1681
+ if (data.customAssets) result.custom_assets = this.encodeCustomAssets(data.customAssets);
1682
+ if (data.productPurchaseParams) result.product_purchase_parameters = this.encodeProductPurchaseParams(data.productPurchaseParams);
1683
+ return result;
1684
+ }
1685
+ encodeCustomTimers(timers) {
1686
+ const result = {};
1687
+ for (const key in timers) if (timers.hasOwnProperty(key)) {
1688
+ const date = timers[key];
1689
+ if (date instanceof Date) result[key] = formatDateUTC(date);
1690
+ }
1691
+ return result;
1692
+ }
1693
+ encodeCustomAssets(assets) {
1694
+ const getAssetId = (asset) => {
1695
+ return resolveAssetId(asset, this.platform.OS) || "";
1696
+ };
1697
+ return Object.entries(assets).map(([id, asset]) => {
1698
+ switch (asset.type) {
1699
+ case "image": return "base64" in asset ? {
1700
+ id,
1701
+ type: "image",
1702
+ value: extractBase64Data(asset.base64)
1703
+ } : {
1704
+ id,
1705
+ type: "image",
1706
+ asset_id: getAssetId(asset)
1707
+ };
1708
+ case "video": return {
1709
+ id,
1710
+ type: "video",
1711
+ asset_id: getAssetId(asset)
1712
+ };
1713
+ case "color":
1714
+ let value;
1715
+ if ("argb" in asset) value = colorToHex.fromARGB(asset.argb);
1716
+ else if ("rgba" in asset) value = colorToHex.fromRGBA(asset.rgba);
1717
+ else if ("rgb" in asset) value = colorToHex.fromRGB(asset.rgb);
1718
+ else return void 0;
1719
+ return {
1720
+ id,
1721
+ type: "color",
1722
+ value
1723
+ };
1724
+ case "linear-gradient":
1725
+ const { values, points = {} } = asset;
1726
+ const { x0 = 0, y0 = 0, x1 = 1, y1 = 0 } = points;
1727
+ const colorStops = values.map(({ p,...colorInput }) => {
1728
+ let color;
1729
+ if ("argb" in colorInput) color = colorToHex.fromARGB(colorInput.argb);
1730
+ else if ("rgba" in colorInput) color = colorToHex.fromRGBA(colorInput.rgba);
1731
+ else if ("rgb" in colorInput) color = colorToHex.fromRGB(colorInput.rgb);
1732
+ else return void 0;
1733
+ return {
1734
+ color,
1735
+ p
1736
+ };
1737
+ }).filter((v) => v !== void 0);
1738
+ if (colorStops.length !== values.length) return void 0;
1739
+ return {
1740
+ id,
1741
+ type: "linear-gradient",
1742
+ values: colorStops,
1743
+ points: {
1744
+ x0,
1745
+ y0,
1746
+ x1,
1747
+ y1
1748
+ }
1749
+ };
1750
+ default: return void 0;
1751
+ }
1752
+ }).filter((item) => item !== void 0);
1753
+ }
1754
+ encodeProductPurchaseParams(params) {
1755
+ if (!params) return {};
1756
+ const purchaseParamsCoder = new AdaptyPurchaseParamsCoder(this.platform);
1757
+ return Object.fromEntries(params.map(({ productId, params: params$1 }) => [productId.adaptyProductId, purchaseParamsCoder.encode(params$1)]));
1758
+ }
1759
+ };
1760
+
1761
+ //#endregion
1762
+ //#region src/coders/adapty-ui-onboarding-meta.ts
1763
+ var AdaptyUiOnboardingMetaCoder = class extends SimpleCoder {
1764
+ constructor(..._args) {
1765
+ super(..._args);
1766
+ this.properties = {
1767
+ onboardingId: {
1768
+ key: "onboarding_id",
1769
+ required: true,
1770
+ type: "string"
1771
+ },
1772
+ screenClientId: {
1773
+ key: "screen_cid",
1774
+ required: true,
1775
+ type: "string"
1776
+ },
1777
+ screenIndex: {
1778
+ key: "screen_index",
1779
+ required: true,
1780
+ type: "number"
1781
+ },
1782
+ totalScreens: {
1783
+ key: "total_screens",
1784
+ required: true,
1785
+ type: "number"
1786
+ }
1787
+ };
1788
+ }
1789
+ };
1790
+
1791
+ //#endregion
1792
+ //#region src/coders/adapty-ui-onboarding-state-params.ts
1793
+ var AdaptyUiOnboardingStateParamsCoder = class extends SimpleCoder {
1794
+ constructor(..._args) {
1795
+ super(..._args);
1796
+ this.properties = {
1797
+ id: {
1798
+ key: "id",
1799
+ required: true,
1800
+ type: "string"
1801
+ },
1802
+ value: {
1803
+ key: "value",
1804
+ required: true,
1805
+ type: "string"
1806
+ },
1807
+ label: {
1808
+ key: "label",
1809
+ required: true,
1810
+ type: "string"
1811
+ }
1812
+ };
1813
+ }
1814
+ };
1815
+
1816
+ //#endregion
1817
+ //#region src/coders/adapty-ui-onboarding-state-updated-action.ts
1818
+ var AdaptyUiOnboardingStateUpdatedActionCoder = class extends SimpleCoder {
1819
+ constructor(..._args) {
1820
+ super(..._args);
1821
+ this.paramCoder = new AdaptyUiOnboardingStateParamsCoder();
1822
+ this.properties = {
1823
+ elementId: {
1824
+ key: "element_id",
1825
+ required: true,
1826
+ type: "string"
1827
+ },
1828
+ elementType: {
1829
+ key: "element_type",
1830
+ required: true,
1831
+ type: "string"
1832
+ }
1833
+ };
1834
+ }
1835
+ decode(data) {
1836
+ const base = super.decode(data);
1837
+ const { elementType } = base;
1838
+ switch (elementType) {
1839
+ case "select": return {
1840
+ ...base,
1841
+ elementType: "select",
1842
+ value: this.paramCoder.decode(data.value)
1843
+ };
1844
+ case "multi_select": return {
1845
+ ...base,
1846
+ elementType: "multi_select",
1847
+ value: Array.isArray(data.value) ? data.value.map((v) => this.paramCoder.decode(v)) : []
1848
+ };
1849
+ case "input": return {
1850
+ ...base,
1851
+ value: data.value
1852
+ };
1853
+ case "date_picker": return {
1854
+ ...base,
1855
+ value: data.value
1856
+ };
1857
+ default: throw new Error(`Unknown element_type: ${elementType}`);
1858
+ }
1859
+ }
1860
+ encode(data) {
1861
+ const base = super.encode(data);
1862
+ const { elementType } = data;
1863
+ switch (elementType) {
1864
+ case "select": return {
1865
+ ...base,
1866
+ element_type: "select",
1867
+ value: this.paramCoder.encode(data.value)
1868
+ };
1869
+ case "multi_select": return {
1870
+ ...base,
1871
+ element_type: "multi_select",
1872
+ value: data.value.map((v) => this.paramCoder.encode(v))
1873
+ };
1874
+ case "input": return {
1875
+ ...base,
1876
+ element_type: "input",
1877
+ value: data.value
1878
+ };
1879
+ case "date_picker": return {
1880
+ ...base,
1881
+ element_type: "date_picker",
1882
+ value: data.value
1883
+ };
1884
+ default: throw new Error(`Unknown elementType: ${elementType}`);
1885
+ }
1886
+ }
1887
+ };
1888
+
1889
+ //#endregion
1890
+ //#region src/coders/bridge-error.ts
1891
+ var BridgeErrorCoder = class extends SimpleCoder {
1892
+ constructor(..._args) {
1893
+ super(..._args);
1894
+ this.type = "error";
1895
+ this.properties = {
1896
+ errorType: {
1897
+ key: "error_type",
1898
+ required: true,
1899
+ type: "string"
1900
+ },
1901
+ name: {
1902
+ key: "name",
1903
+ required: false,
1904
+ type: "string"
1905
+ },
1906
+ type: {
1907
+ key: "type",
1908
+ required: false,
1909
+ type: "string"
1910
+ },
1911
+ underlyingError: {
1912
+ key: "parent_error",
1913
+ required: false,
1914
+ type: "string"
1915
+ },
1916
+ description: {
1917
+ key: "description",
1918
+ required: false,
1919
+ type: "string"
1920
+ }
1921
+ };
1922
+ }
1923
+ getError(data) {
1924
+ switch (data.errorType) {
1925
+ case "missingRequiredArgument": return new AdaptyError({
1926
+ adaptyCode: 3001,
1927
+ message: `Required parameter "${data.name} was not passed to a native module"`
1928
+ });
1929
+ case "typeMismatch": return new AdaptyError({
1930
+ adaptyCode: 3001,
1931
+ message: `Passed parameter "${data.name}" has invalid type. Expected type: ${data.type}"`
1932
+ });
1933
+ case "encodingFailed": return new AdaptyError({
1934
+ adaptyCode: 2009,
1935
+ message: `Bridge layer failed to encode response. Bridge error: ${JSON.stringify(data.underlyingError ?? {})}"`
1936
+ });
1937
+ case "wrongParam":
1938
+ case "WRONG_PARAMETER": return new AdaptyError({
1939
+ adaptyCode: 3001,
1940
+ message: data.name ?? `Wrong parameter. Bridge error: ${JSON.stringify(data.underlyingError ?? {})}"`
1941
+ });
1942
+ case "methodNotImplemented": return new AdaptyError({
1943
+ adaptyCode: 2003,
1944
+ message: "Requested bridge handle not found"
1945
+ });
1946
+ case "unsupportedIosVersion": return new AdaptyError({
1947
+ adaptyCode: 2003,
1948
+ message: "Unsupported iOS version"
1949
+ });
1950
+ case "unexpectedError":
1951
+ default: return new AdaptyError({
1952
+ adaptyCode: 0,
1953
+ message: `Unexpected error occurred: ${JSON.stringify(data.underlyingError ?? {})}`
1954
+ });
1955
+ }
1956
+ }
1957
+ };
1958
+
1959
+ //#endregion
1960
+ //#region src/coders/factory.ts
1961
+ /**
1962
+ * Factory for creating coders with injected dependencies
1963
+ */
1964
+ var CoderFactory = class {
1965
+ constructor(deps) {
1966
+ this.deps = deps;
1967
+ }
1968
+ createAccessLevelCoder() {
1969
+ return new AdaptyAccessLevelCoder(this.deps.platform);
1970
+ }
1971
+ createConfigurationCoder() {
1972
+ return new AdaptyConfigurationCoder(this.deps.platform, this.deps.sdkMetadata);
1973
+ }
1974
+ createDateCoder() {
1975
+ return new DateCoder();
1976
+ }
1977
+ createDiscountPhaseCoder() {
1978
+ return new AdaptyDiscountPhaseCoder(this.deps.platform);
1979
+ }
1980
+ createPurchaseParamsCoder() {
1981
+ return new AdaptyPurchaseParamsCoder(this.deps.platform);
1982
+ }
1983
+ createPurchaseResultCoder() {
1984
+ return new AdaptyPurchaseResultCoder(this.deps.platform);
1985
+ }
1986
+ createIdentifyParamsCoder() {
1987
+ return new AdaptyIdentifyParamsCoder(this.deps.platform);
1988
+ }
1989
+ createInstallationDetailsCoder() {
1990
+ return new AdaptyInstallationDetailsCoder();
1991
+ }
1992
+ createInstallationStatusCoder() {
1993
+ return new AdaptyInstallationStatusCoder();
1994
+ }
1995
+ createJsonCoder() {
1996
+ return new JSONCoder();
1997
+ }
1998
+ createNativeErrorCoder() {
1999
+ return new AdaptyNativeErrorCoder(this.deps.platform);
2000
+ }
2001
+ createNonSubscriptionCoder() {
2002
+ return new AdaptyNonSubscriptionCoder(this.deps.platform);
2003
+ }
2004
+ createOnboardingBuilderCoder() {
2005
+ return new AdaptyOnboardingBuilderCoder(this.deps.platform);
2006
+ }
2007
+ createOnboardingCoder() {
2008
+ return new AdaptyOnboardingCoder(this.deps.platform);
2009
+ }
2010
+ createPaywallBuilderCoder() {
2011
+ return new AdaptyPaywallBuilderCoder(this.deps.platform);
2012
+ }
2013
+ createPaywallCoder() {
2014
+ return new AdaptyPaywallCoder(this.deps.platform);
2015
+ }
2016
+ createPaywallProductCoder() {
2017
+ return new AdaptyPaywallProductCoder(this.deps.platform);
2018
+ }
2019
+ createPlacementCoder() {
2020
+ return new AdaptyPlacementCoder(this.deps.platform);
2021
+ }
2022
+ createPriceCoder() {
2023
+ return new AdaptyPriceCoder(this.deps.platform);
2024
+ }
2025
+ createProductReferenceCoder() {
2026
+ return new ProductReferenceCoder(this.deps.platform);
2027
+ }
2028
+ createProfileCoder() {
2029
+ return new AdaptyProfileCoder(this.deps.platform);
2030
+ }
2031
+ createProfileParametersCoder() {
2032
+ return new AdaptyProfileParametersCoder(this.deps.platform);
2033
+ }
2034
+ createRemoteConfigCoder() {
2035
+ return new AdaptyRemoteConfigCoder(this.deps.platform);
2036
+ }
2037
+ createSubscriptionCoder() {
2038
+ return new AdaptySubscriptionCoder(this.deps.platform);
2039
+ }
2040
+ createSubscriptionDetailsCoder() {
2041
+ return new AdaptySubscriptionDetailsCoder(this.deps.platform);
2042
+ }
2043
+ createSubscriptionOfferCoder() {
2044
+ return new AdaptySubscriptionOfferCoder(this.deps.platform);
2045
+ }
2046
+ createSubscriptionOfferIdCoder() {
2047
+ return new AdaptySubscriptionOfferIdCoder(this.deps.platform);
2048
+ }
2049
+ createSubscriptionPeriodCoder() {
2050
+ return new AdaptySubscriptionPeriodCoder(this.deps.platform);
2051
+ }
2052
+ createUiCreateOnboardingViewParamsCoder() {
2053
+ return new AdaptyUICreateOnboardingViewParamsCoder();
2054
+ }
2055
+ createUiCreatePaywallViewParamsCoder() {
2056
+ return new AdaptyUICreatePaywallViewParamsCoder(this.deps.platform);
2057
+ }
2058
+ createUiDialogConfigCoder() {
2059
+ return new AdaptyUiDialogConfigCoder(this.deps.platform);
2060
+ }
2061
+ createUiMediaCacheCoder() {
2062
+ return new AdaptyUiMediaCacheCoder(this.deps.platform);
2063
+ }
2064
+ createUiOnboardingMetaCoder() {
2065
+ return new AdaptyUiOnboardingMetaCoder(this.deps.platform);
2066
+ }
2067
+ createUiOnboardingStateParamsCoder() {
2068
+ return new AdaptyUiOnboardingStateParamsCoder(this.deps.platform);
2069
+ }
2070
+ createUiOnboardingStateUpdatedActionCoder() {
2071
+ return new AdaptyUiOnboardingStateUpdatedActionCoder(this.deps.platform);
2072
+ }
2073
+ createBridgeErrorCoder() {
2074
+ return new BridgeErrorCoder(this.deps.platform);
2075
+ }
2076
+ createArrayCoder(coderFactory) {
2077
+ return new ArrayCoder(coderFactory);
2078
+ }
2079
+ createPaywallProductArrayCoder() {
2080
+ return new ArrayCoder(() => this.createPaywallProductCoder());
2081
+ }
2082
+ createHashmapCoder(coder) {
2083
+ return new HashmapCoder(coder);
2084
+ }
2085
+ };
2086
+
2087
+ //#endregion
2088
+ //#region src/types/index.ts
2089
+ const VendorStore = Object.freeze({
2090
+ AppStore: "app_store",
2091
+ PlayStore: "play_store",
2092
+ Adapty: "adapty"
2093
+ });
2094
+ const OfferType = Object.freeze({
2095
+ FreeTrial: "free_trial",
2096
+ PayAsYouGo: "pay_as_you_go",
2097
+ PayUpFront: "pay_up_front"
2098
+ });
2099
+ const CancellationReason = Object.freeze({
2100
+ VolountarilyCancelled: "voluntarily_cancelled",
2101
+ BillingError: "billing_error",
2102
+ Refund: "refund",
2103
+ PriceIncrease: "price_increase",
2104
+ ProductWasNotAvailable: "product_was_not_available",
2105
+ Unknown: "unknown"
2106
+ });
2107
+ const Gender = Object.freeze({
2108
+ Female: "f",
2109
+ Male: "m",
2110
+ Other: "o"
2111
+ });
2112
+ const AppTrackingTransparencyStatus = Object.freeze({
2113
+ NotDetermined: 0,
2114
+ Restricted: 1,
2115
+ Denied: 2,
2116
+ Authorized: 3,
2117
+ Unknown: 4
2118
+ });
2119
+ const ProductPeriod = Object.freeze({
2120
+ Day: "day",
2121
+ Week: "week",
2122
+ Month: "month",
2123
+ Year: "year"
2124
+ });
2125
+ const WebPresentation = Object.freeze({
2126
+ BrowserOutApp: "browser_out_app",
2127
+ BrowserInApp: "browser_in_app"
2128
+ });
2129
+ const RefundPreference = Object.freeze({
2130
+ NoPreference: "no_preference",
2131
+ Grant: "grant",
2132
+ Decline: "decline"
2133
+ });
2134
+
2135
+ //#endregion
2136
+ //#region src/types/inputs.ts
2137
+ /**
2138
+ * Log levels for the SDK
2139
+ *
2140
+ * @remarks
2141
+ * Logging is performed on a native side.
2142
+ * So you are expected to watch logs in Xcode or Android Studio.
2143
+ */
2144
+ const LogLevel = Object.freeze({
2145
+ VERBOSE: "verbose",
2146
+ ERROR: "error",
2147
+ WARN: "warn",
2148
+ INFO: "info"
2149
+ });
2150
+ const FetchPolicy = Object.freeze({
2151
+ ReloadRevalidatingCacheData: "reload_revalidating_cache_data",
2152
+ ReturnCacheDataElseLoad: "return_cache_data_else_load",
2153
+ ReturnCacheDataIfNotExpiredElseLoad: "return_cache_data_if_not_expired_else_load"
2154
+ });
2155
+ const AdaptyAndroidSubscriptionUpdateReplacementMode = Object.freeze({
2156
+ ChargeFullPrice: "charge_full_price",
2157
+ Deferred: "deferred",
2158
+ WithoutProration: "without_proration",
2159
+ ChargeProratedPrice: "charge_prorated_price",
2160
+ WithTimeProration: "with_time_proration"
2161
+ });
2162
+
2163
+ //#endregion
2164
+ //#region src/types/bridge.ts
2165
+ /**
2166
+ * Valid list of callable bridge handlers
2167
+ * Must be the same as
2168
+ * - iOS RNAConstants.MethodName
2169
+ * @internal
2170
+ */
2171
+ const MethodNames = [
2172
+ "activate",
2173
+ "adapty_ui_activate",
2174
+ "adapty_ui_create_paywall_view",
2175
+ "adapty_ui_dismiss_paywall_view",
2176
+ "adapty_ui_present_paywall_view",
2177
+ "adapty_ui_show_dialog",
2178
+ "adapty_ui_create_onboarding_view",
2179
+ "adapty_ui_dismiss_onboarding_view",
2180
+ "adapty_ui_present_onboarding_view",
2181
+ "create_web_paywall_url",
2182
+ "get_current_installation_status",
2183
+ "is_activated",
2184
+ "get_paywall",
2185
+ "get_paywall_for_default_audience",
2186
+ "get_paywall_products",
2187
+ "get_onboarding",
2188
+ "get_onboarding_for_default_audience",
2189
+ "get_profile",
2190
+ "identify",
2191
+ "log_show_paywall",
2192
+ "logout",
2193
+ "make_purchase",
2194
+ "open_web_paywall",
2195
+ "present_code_redemption_sheet",
2196
+ "report_transaction",
2197
+ "restore_purchases",
2198
+ "set_fallback",
2199
+ "set_integration_identifiers",
2200
+ "set_log_level",
2201
+ "update_attribution_data",
2202
+ "update_collecting_refund_data_consent",
2203
+ "update_profile",
2204
+ "update_refund_preference"
2205
+ ];
2206
+
2207
+ //#endregion
2208
+ //#region src/types/paywall-events.ts
2209
+ const PaywallEventId = {
2210
+ DidAppear: "paywall_view_did_appear",
2211
+ DidDisappear: "paywall_view_did_disappear",
2212
+ DidPerformAction: "paywall_view_did_perform_action",
2213
+ DidSelectProduct: "paywall_view_did_select_product",
2214
+ DidStartPurchase: "paywall_view_did_start_purchase",
2215
+ DidFinishPurchase: "paywall_view_did_finish_purchase",
2216
+ DidFailPurchase: "paywall_view_did_fail_purchase",
2217
+ DidStartRestore: "paywall_view_did_start_restore",
2218
+ DidFinishRestore: "paywall_view_did_finish_restore",
2219
+ DidFailRestore: "paywall_view_did_fail_restore",
2220
+ DidFailRendering: "paywall_view_did_fail_rendering",
2221
+ DidFailLoadingProducts: "paywall_view_did_fail_loading_products",
2222
+ DidFinishWebPaymentNavigation: "paywall_view_did_finish_web_payment_navigation"
2223
+ };
2224
+
2225
+ //#endregion
2226
+ //#region src/types/onboarding-events.ts
2227
+ const OnboardingEventId = {
2228
+ Close: "onboarding_on_close_action",
2229
+ Custom: "onboarding_on_custom_action",
2230
+ Paywall: "onboarding_on_paywall_action",
2231
+ StateUpdated: "onboarding_on_state_updated_action",
2232
+ FinishedLoading: "onboarding_did_finish_loading",
2233
+ Analytics: "onboarding_on_analytics_action",
2234
+ Error: "onboarding_did_fail_with_error"
2235
+ };
2236
+
2237
+ //#endregion
2238
+ //#region src/index.ts
2239
+ /**
2240
+ * @adapty/core - Platform-agnostic core for Adapty SDKs
2241
+ *
2242
+ * This is the main entry point for the library.
2243
+ * Add your exports here as you develop the SDK.
2244
+ */
2245
+ const version = "0.0.0-dev.0000000000000000000000000000000000000000";
2246
+
2247
+ //#endregion
2248
+ export { AdaptyAndroidSubscriptionUpdateReplacementMode, AppTrackingTransparencyStatus, CancellationReason, CoderFactory, NoopLoggerAdapter as DefaultLoggerAdapter, DefaultPlatformAdapter, DefaultSdkMetadataAdapter, ErrorCode, FetchPolicy, Gender, LogLevel, MethodNames, OfferType, OnboardingEventId, PaywallEventId, ProductPeriod, RefundPreference, VendorStore, WebPresentation, getErrorCode, getErrorPrompt, version };
2249
+ //# sourceMappingURL=index.mjs.map