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