@adapty/core 3.17.2 → 4.0.0-dev.6ee3d5004744a21c79e3bc059d562ef925d49d5f

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 CHANGED
@@ -826,6 +826,319 @@ var AdaptyDiscountPhaseCoder = class extends SimpleCoder {
826
826
  }
827
827
  };
828
828
 
829
+ //#endregion
830
+ //#region src/coders/product-reference.ts
831
+ var ProductReferenceCoder = class extends SimpleCoder {
832
+ constructor(..._args) {
833
+ super(..._args);
834
+ this.properties = {
835
+ flowProductId: {
836
+ key: "flow_product_id",
837
+ required: false,
838
+ type: "string"
839
+ },
840
+ vendorId: {
841
+ key: "vendor_product_id",
842
+ required: true,
843
+ type: "string"
844
+ },
845
+ adaptyId: {
846
+ key: "adapty_product_id",
847
+ required: true,
848
+ type: "string"
849
+ },
850
+ accessLevelId: {
851
+ key: "access_level_id",
852
+ required: true,
853
+ type: "string"
854
+ },
855
+ productType: {
856
+ key: "product_type",
857
+ required: true,
858
+ type: "string"
859
+ },
860
+ ios: {
861
+ promotionalOfferId: {
862
+ key: "promotional_offer_id",
863
+ required: false,
864
+ type: "string"
865
+ },
866
+ winBackOfferId: {
867
+ key: "win_back_offer_id",
868
+ required: false,
869
+ type: "string"
870
+ }
871
+ },
872
+ android: {
873
+ basePlanId: {
874
+ key: "base_plan_id",
875
+ required: false,
876
+ type: "string"
877
+ },
878
+ offerId: {
879
+ key: "offer_id",
880
+ required: false,
881
+ type: "string"
882
+ }
883
+ }
884
+ };
885
+ }
886
+ };
887
+
888
+ //#endregion
889
+ //#region src/coders/array.ts
890
+ var ArrayCoder = class {
891
+ constructor(coderFactory) {
892
+ this.coderFactory = coderFactory;
893
+ }
894
+ decode(input) {
895
+ const coder = this.coderFactory();
896
+ return input.map((item) => coder.decode(item));
897
+ }
898
+ encode(value) {
899
+ const coder = this.coderFactory();
900
+ return value.map((item) => coder.encode(item));
901
+ }
902
+ };
903
+
904
+ //#endregion
905
+ //#region src/coders/adapty-placement.ts
906
+ var AdaptyPlacementCoder = class extends SimpleCoder {
907
+ constructor(..._args) {
908
+ super(..._args);
909
+ this.properties = {
910
+ abTestName: {
911
+ key: "ab_test_name",
912
+ required: true,
913
+ type: "string"
914
+ },
915
+ audienceName: {
916
+ key: "audience_name",
917
+ required: true,
918
+ type: "string"
919
+ },
920
+ id: {
921
+ key: "developer_id",
922
+ required: true,
923
+ type: "string"
924
+ },
925
+ revision: {
926
+ key: "revision",
927
+ required: true,
928
+ type: "number"
929
+ },
930
+ audienceVersionId: {
931
+ key: "placement_audience_version_id",
932
+ required: true,
933
+ type: "string"
934
+ },
935
+ isTrackingPurchases: {
936
+ key: "is_tracking_purchases",
937
+ required: false,
938
+ type: "boolean"
939
+ }
940
+ };
941
+ }
942
+ };
943
+
944
+ //#endregion
945
+ //#region src/coders/adapty-flow-paywall.ts
946
+ var AdaptyFlowPaywallCoder = class extends Coder {
947
+ constructor(..._args) {
948
+ super(..._args);
949
+ this.properties = {
950
+ placement: {
951
+ key: "placement",
952
+ required: true,
953
+ type: "object",
954
+ converter: new AdaptyPlacementCoder()
955
+ },
956
+ id: {
957
+ key: "paywall_id",
958
+ required: true,
959
+ type: "string"
960
+ },
961
+ name: {
962
+ key: "paywall_name",
963
+ required: true,
964
+ type: "string"
965
+ },
966
+ products: {
967
+ key: "products",
968
+ required: true,
969
+ type: "array",
970
+ converter: new ArrayCoder(() => new ProductReferenceCoder())
971
+ },
972
+ variationId: {
973
+ key: "variation_id",
974
+ required: true,
975
+ type: "string"
976
+ },
977
+ webPurchaseUrl: {
978
+ key: "web_purchase_url",
979
+ required: false,
980
+ type: "string"
981
+ }
982
+ };
983
+ }
984
+ decode(data) {
985
+ const codablePart = super.decode(data);
986
+ return {
987
+ ...codablePart,
988
+ productIdentifiers: codablePart.products.map((product) => ({
989
+ vendorProductId: product.vendorId,
990
+ adaptyProductId: product.adaptyId,
991
+ basePlanId: product.android?.basePlanId
992
+ }))
993
+ };
994
+ }
995
+ encode(data) {
996
+ const { productIdentifiers,...codablePart } = data;
997
+ return super.encode(codablePart);
998
+ }
999
+ };
1000
+
1001
+ //#endregion
1002
+ //#region src/coders/adapty-flow-ui-schema.ts
1003
+ var AdaptyFlowUiSchemaCoder = class {
1004
+ decode(data) {
1005
+ return {
1006
+ layouts: data.layouts.map((layout) => ({ flowLayoutId: layout.flow_layout_id })),
1007
+ grids: data.grids.map((grid) => ({
1008
+ cells: grid.cells,
1009
+ ...grid.platforms !== void 0 && { platforms: grid.platforms },
1010
+ ...grid.devices !== void 0 && { devices: grid.devices },
1011
+ ...grid.custom_id !== void 0 && { customId: grid.custom_id },
1012
+ ...grid.h_breakpoints !== void 0 && { hBreakpoints: grid.h_breakpoints },
1013
+ ...grid.v_breakpoints !== void 0 && { vBreakpoints: grid.v_breakpoints }
1014
+ }))
1015
+ };
1016
+ }
1017
+ encode(data) {
1018
+ return {
1019
+ layouts: data.layouts.map((layout) => ({ flow_layout_id: layout.flowLayoutId })),
1020
+ grids: data.grids.map((grid) => ({
1021
+ cells: grid.cells,
1022
+ ...grid.platforms !== void 0 && { platforms: grid.platforms },
1023
+ ...grid.devices !== void 0 && { devices: grid.devices },
1024
+ ...grid.customId !== void 0 && { custom_id: grid.customId },
1025
+ ...grid.hBreakpoints !== void 0 && { h_breakpoints: grid.hBreakpoints },
1026
+ ...grid.vBreakpoints !== void 0 && { v_breakpoints: grid.vBreakpoints }
1027
+ }))
1028
+ };
1029
+ }
1030
+ };
1031
+
1032
+ //#endregion
1033
+ //#region src/coders/json.ts
1034
+ var JSONCoder = class {
1035
+ decode(input) {
1036
+ if (!input) return {};
1037
+ return JSON.parse(input);
1038
+ }
1039
+ encode(value) {
1040
+ if (Object.keys(value).length === 0) return "";
1041
+ return JSON.stringify(value);
1042
+ }
1043
+ };
1044
+
1045
+ //#endregion
1046
+ //#region src/coders/adapty-remote-config.ts
1047
+ var AdaptyRemoteConfigCoder = class extends Coder {
1048
+ constructor(..._args) {
1049
+ super(..._args);
1050
+ this.properties = {
1051
+ data: {
1052
+ key: "data",
1053
+ required: true,
1054
+ type: "string",
1055
+ converter: new JSONCoder()
1056
+ },
1057
+ lang: {
1058
+ key: "lang",
1059
+ required: true,
1060
+ type: "string"
1061
+ }
1062
+ };
1063
+ }
1064
+ decode(data) {
1065
+ const codablePart = super.decode(data);
1066
+ const dataString = JSON.stringify(codablePart.data);
1067
+ return {
1068
+ ...codablePart,
1069
+ dataString: dataString.length < 4 ? "" : dataString
1070
+ };
1071
+ }
1072
+ encode(data) {
1073
+ const { dataString,...codablePart } = data;
1074
+ return super.encode(codablePart);
1075
+ }
1076
+ };
1077
+
1078
+ //#endregion
1079
+ //#region src/coders/adapty-flow.ts
1080
+ var AdaptyFlowCoder = class extends SimpleCoder {
1081
+ constructor(..._args) {
1082
+ super(..._args);
1083
+ this.properties = {
1084
+ placement: {
1085
+ key: "placement",
1086
+ required: true,
1087
+ type: "object",
1088
+ converter: new AdaptyPlacementCoder()
1089
+ },
1090
+ id: {
1091
+ key: "flow_id",
1092
+ required: true,
1093
+ type: "string"
1094
+ },
1095
+ name: {
1096
+ key: "flow_name",
1097
+ required: true,
1098
+ type: "string"
1099
+ },
1100
+ variationId: {
1101
+ key: "variation_id",
1102
+ required: true,
1103
+ type: "string"
1104
+ },
1105
+ remoteConfigs: {
1106
+ key: "remote_configs",
1107
+ required: false,
1108
+ type: "array",
1109
+ converter: new ArrayCoder(() => new AdaptyRemoteConfigCoder())
1110
+ },
1111
+ flowVersionId: {
1112
+ key: "flow_version_id",
1113
+ required: false,
1114
+ type: "string"
1115
+ },
1116
+ variations: {
1117
+ key: "variations",
1118
+ required: true,
1119
+ type: "array",
1120
+ converter: new ArrayCoder(() => new AdaptyFlowPaywallCoder())
1121
+ },
1122
+ uiSchema: {
1123
+ key: "ui_schema",
1124
+ required: false,
1125
+ type: "object",
1126
+ converter: new AdaptyFlowUiSchemaCoder()
1127
+ },
1128
+ responseCreatedAt: {
1129
+ key: "response_created_at",
1130
+ required: true,
1131
+ type: "number"
1132
+ },
1133
+ payloadData: {
1134
+ key: "payload_data",
1135
+ required: false,
1136
+ type: "string"
1137
+ }
1138
+ };
1139
+ }
1140
+ };
1141
+
829
1142
  //#endregion
830
1143
  //#region src/coders/adapty-identify-params.ts
831
1144
  var AdaptyIdentifyParamsCoder = class {
@@ -995,92 +1308,6 @@ var AdaptyOnboardingBuilderCoder = class extends SimpleCoder {
995
1308
  }
996
1309
  };
997
1310
 
998
- //#endregion
999
- //#region src/coders/json.ts
1000
- var JSONCoder = class {
1001
- decode(input) {
1002
- if (!input) return {};
1003
- return JSON.parse(input);
1004
- }
1005
- encode(value) {
1006
- if (Object.keys(value).length === 0) return "";
1007
- return JSON.stringify(value);
1008
- }
1009
- };
1010
-
1011
- //#endregion
1012
- //#region src/coders/adapty-remote-config.ts
1013
- var AdaptyRemoteConfigCoder = class extends Coder {
1014
- constructor(..._args) {
1015
- super(..._args);
1016
- this.properties = {
1017
- data: {
1018
- key: "data",
1019
- required: true,
1020
- type: "string",
1021
- converter: new JSONCoder()
1022
- },
1023
- lang: {
1024
- key: "lang",
1025
- required: true,
1026
- type: "string"
1027
- }
1028
- };
1029
- }
1030
- decode(data) {
1031
- const codablePart = super.decode(data);
1032
- const dataString = JSON.stringify(codablePart.data);
1033
- return {
1034
- ...codablePart,
1035
- dataString: dataString.length < 4 ? "" : dataString
1036
- };
1037
- }
1038
- encode(data) {
1039
- const { dataString,...codablePart } = data;
1040
- return super.encode(codablePart);
1041
- }
1042
- };
1043
-
1044
- //#endregion
1045
- //#region src/coders/adapty-placement.ts
1046
- var AdaptyPlacementCoder = class extends SimpleCoder {
1047
- constructor(..._args) {
1048
- super(..._args);
1049
- this.properties = {
1050
- abTestName: {
1051
- key: "ab_test_name",
1052
- required: true,
1053
- type: "string"
1054
- },
1055
- audienceName: {
1056
- key: "audience_name",
1057
- required: true,
1058
- type: "string"
1059
- },
1060
- id: {
1061
- key: "developer_id",
1062
- required: true,
1063
- type: "string"
1064
- },
1065
- revision: {
1066
- key: "revision",
1067
- required: true,
1068
- type: "number"
1069
- },
1070
- audienceVersionId: {
1071
- key: "placement_audience_version_id",
1072
- required: true,
1073
- type: "string"
1074
- },
1075
- isTrackingPurchases: {
1076
- key: "is_tracking_purchases",
1077
- required: false,
1078
- type: "boolean"
1079
- }
1080
- };
1081
- }
1082
- };
1083
-
1084
1311
  //#endregion
1085
1312
  //#region src/coders/adapty-onboarding.ts
1086
1313
  var AdaptyOnboardingCoder = class extends Coder {
@@ -1150,26 +1377,6 @@ var AdaptyOnboardingCoder = class extends Coder {
1150
1377
  }
1151
1378
  };
1152
1379
 
1153
- //#endregion
1154
- //#region src/coders/adapty-paywall-builder.ts
1155
- var AdaptyPaywallBuilderCoder = class extends SimpleCoder {
1156
- constructor(..._args) {
1157
- super(..._args);
1158
- this.properties = {
1159
- id: {
1160
- key: "paywall_builder_id",
1161
- required: true,
1162
- type: "string"
1163
- },
1164
- lang: {
1165
- key: "lang",
1166
- required: true,
1167
- type: "string"
1168
- }
1169
- };
1170
- }
1171
- };
1172
-
1173
1380
  //#endregion
1174
1381
  //#region src/coders/adapty-subscription-offer-identifier.ts
1175
1382
  var AdaptySubscriptionOfferIdCoder = class extends SimpleCoder {
@@ -1190,22 +1397,6 @@ var AdaptySubscriptionOfferIdCoder = class extends SimpleCoder {
1190
1397
  }
1191
1398
  };
1192
1399
 
1193
- //#endregion
1194
- //#region src/coders/array.ts
1195
- var ArrayCoder = class {
1196
- constructor(coderFactory) {
1197
- this.coderFactory = coderFactory;
1198
- }
1199
- decode(input) {
1200
- const coder = this.coderFactory();
1201
- return input.map((item) => coder.decode(item));
1202
- }
1203
- encode(value) {
1204
- const coder = this.coderFactory();
1205
- return value.map((item) => coder.encode(item));
1206
- }
1207
- };
1208
-
1209
1400
  //#endregion
1210
1401
  //#region src/coders/adapty-subscription-offer.ts
1211
1402
  var AdaptySubscriptionOfferCoder = class extends SimpleCoder {
@@ -1397,145 +1588,6 @@ var AdaptyPaywallProductCoder = class extends SimpleCoder {
1397
1588
  }
1398
1589
  };
1399
1590
 
1400
- //#endregion
1401
- //#region src/coders/product-reference.ts
1402
- var ProductReferenceCoder = class extends SimpleCoder {
1403
- constructor(..._args) {
1404
- super(..._args);
1405
- this.properties = {
1406
- vendorId: {
1407
- key: "vendor_product_id",
1408
- required: true,
1409
- type: "string"
1410
- },
1411
- adaptyId: {
1412
- key: "adapty_product_id",
1413
- required: true,
1414
- type: "string"
1415
- },
1416
- accessLevelId: {
1417
- key: "access_level_id",
1418
- required: true,
1419
- type: "string"
1420
- },
1421
- productType: {
1422
- key: "product_type",
1423
- required: true,
1424
- type: "string"
1425
- },
1426
- ios: {
1427
- promotionalOfferId: {
1428
- key: "promotional_offer_id",
1429
- required: false,
1430
- type: "string"
1431
- },
1432
- winBackOfferId: {
1433
- key: "win_back_offer_id",
1434
- required: false,
1435
- type: "string"
1436
- }
1437
- },
1438
- android: {
1439
- basePlanId: {
1440
- key: "base_plan_id",
1441
- required: false,
1442
- type: "string"
1443
- },
1444
- offerId: {
1445
- key: "offer_id",
1446
- required: false,
1447
- type: "string"
1448
- }
1449
- }
1450
- };
1451
- }
1452
- };
1453
-
1454
- //#endregion
1455
- //#region src/coders/adapty-paywall.ts
1456
- var AdaptyPaywallCoder = class extends Coder {
1457
- constructor(..._args) {
1458
- super(..._args);
1459
- this.properties = {
1460
- placement: {
1461
- key: "placement",
1462
- required: true,
1463
- type: "object",
1464
- converter: new AdaptyPlacementCoder()
1465
- },
1466
- id: {
1467
- key: "paywall_id",
1468
- required: true,
1469
- type: "string"
1470
- },
1471
- name: {
1472
- key: "paywall_name",
1473
- required: true,
1474
- type: "string"
1475
- },
1476
- products: {
1477
- key: "products",
1478
- required: true,
1479
- type: "array",
1480
- converter: new ArrayCoder(() => new ProductReferenceCoder())
1481
- },
1482
- remoteConfig: {
1483
- key: "remote_config",
1484
- required: false,
1485
- type: "object",
1486
- converter: new AdaptyRemoteConfigCoder()
1487
- },
1488
- variationId: {
1489
- key: "variation_id",
1490
- required: true,
1491
- type: "string"
1492
- },
1493
- version: {
1494
- key: "response_created_at",
1495
- required: false,
1496
- type: "number"
1497
- },
1498
- paywallBuilder: {
1499
- key: "paywall_builder",
1500
- required: false,
1501
- type: "object",
1502
- converter: new AdaptyPaywallBuilderCoder()
1503
- },
1504
- webPurchaseUrl: {
1505
- key: "web_purchase_url",
1506
- required: false,
1507
- type: "string"
1508
- },
1509
- payloadData: {
1510
- key: "payload_data",
1511
- required: false,
1512
- type: "string"
1513
- },
1514
- requestLocale: {
1515
- key: "request_locale",
1516
- required: true,
1517
- type: "string"
1518
- }
1519
- };
1520
- }
1521
- decode(data) {
1522
- const codablePart = super.decode(data);
1523
- return {
1524
- ...codablePart,
1525
- hasViewConfiguration: codablePart.paywallBuilder !== void 0,
1526
- productIdentifiers: codablePart.products.map((product) => ({
1527
- vendorProductId: product.vendorId,
1528
- adaptyProductId: product.adaptyId,
1529
- basePlanId: product.android?.basePlanId
1530
- }))
1531
- };
1532
- }
1533
- encode(data) {
1534
- const { hasViewConfiguration, productIdentifiers,...codablePart } = data;
1535
- return super.encode(codablePart);
1536
- }
1537
- };
1538
-
1539
1591
  //#endregion
1540
1592
  //#region src/coders/adapty-profile-parameters.ts
1541
1593
  var AdaptyProfileParametersCoder = class extends SimpleCoder {
@@ -1934,8 +1986,8 @@ const resolveAssetId = (asset, platformOS) => {
1934
1986
  };
1935
1987
 
1936
1988
  //#endregion
1937
- //#region src/coders/adapty-ui-create-paywall-view-params.ts
1938
- var AdaptyUICreatePaywallViewParamsCoder = class {
1989
+ //#region src/coders/adapty-ui-create-flow-view-params.ts
1990
+ var AdaptyUICreateFlowViewParamsCoder = class {
1939
1991
  constructor(platform) {
1940
1992
  this.platform = platform;
1941
1993
  }
@@ -2276,11 +2328,14 @@ var CoderFactory = class {
2276
2328
  createOnboardingCoder() {
2277
2329
  return new AdaptyOnboardingCoder(this.deps.platform);
2278
2330
  }
2279
- createPaywallBuilderCoder() {
2280
- return new AdaptyPaywallBuilderCoder(this.deps.platform);
2331
+ createFlowCoder() {
2332
+ return new AdaptyFlowCoder(this.deps.platform);
2333
+ }
2334
+ createFlowPaywallCoder() {
2335
+ return new AdaptyFlowPaywallCoder(this.deps.platform);
2281
2336
  }
2282
- createPaywallCoder() {
2283
- return new AdaptyPaywallCoder(this.deps.platform);
2337
+ createFlowUiSchemaCoder() {
2338
+ return new AdaptyFlowUiSchemaCoder();
2284
2339
  }
2285
2340
  createPaywallProductCoder() {
2286
2341
  return new AdaptyPaywallProductCoder(this.deps.platform);
@@ -2321,8 +2376,8 @@ var CoderFactory = class {
2321
2376
  createUiCreateOnboardingViewParamsCoder() {
2322
2377
  return new AdaptyUICreateOnboardingViewParamsCoder();
2323
2378
  }
2324
- createUiCreatePaywallViewParamsCoder() {
2325
- return new AdaptyUICreatePaywallViewParamsCoder(this.deps.platform);
2379
+ createUiCreateFlowViewParamsCoder() {
2380
+ return new AdaptyUICreateFlowViewParamsCoder(this.deps.platform);
2326
2381
  }
2327
2382
  createUiDialogConfigCoder() {
2328
2383
  return new AdaptyUiDialogConfigCoder(this.deps.platform);
@@ -2412,9 +2467,9 @@ const RefundPreference = Object.freeze({
2412
2467
  const MethodNames = [
2413
2468
  "activate",
2414
2469
  "adapty_ui_activate",
2415
- "adapty_ui_create_paywall_view",
2416
- "adapty_ui_dismiss_paywall_view",
2417
- "adapty_ui_present_paywall_view",
2470
+ "adapty_ui_create_flow_view",
2471
+ "adapty_ui_dismiss_flow_view",
2472
+ "adapty_ui_present_flow_view",
2418
2473
  "adapty_ui_show_dialog",
2419
2474
  "adapty_ui_create_onboarding_view",
2420
2475
  "adapty_ui_dismiss_onboarding_view",
@@ -2422,14 +2477,14 @@ const MethodNames = [
2422
2477
  "create_web_paywall_url",
2423
2478
  "get_current_installation_status",
2424
2479
  "is_activated",
2425
- "get_paywall",
2426
- "get_paywall_for_default_audience",
2480
+ "get_flow",
2481
+ "get_flow_for_default_audience",
2427
2482
  "get_paywall_products",
2428
2483
  "get_onboarding",
2429
2484
  "get_onboarding_for_default_audience",
2430
2485
  "get_profile",
2431
2486
  "identify",
2432
- "log_show_paywall",
2487
+ "log_show_flow",
2433
2488
  "logout",
2434
2489
  "make_purchase",
2435
2490
  "open_web_paywall",
@@ -2446,21 +2501,21 @@ const MethodNames = [
2446
2501
  ];
2447
2502
 
2448
2503
  //#endregion
2449
- //#region src/types/paywall-events.ts
2450
- const PaywallEventId = {
2451
- DidAppear: "paywall_view_did_appear",
2452
- DidDisappear: "paywall_view_did_disappear",
2453
- DidPerformAction: "paywall_view_did_perform_action",
2454
- DidSelectProduct: "paywall_view_did_select_product",
2455
- DidStartPurchase: "paywall_view_did_start_purchase",
2456
- DidFinishPurchase: "paywall_view_did_finish_purchase",
2457
- DidFailPurchase: "paywall_view_did_fail_purchase",
2458
- DidStartRestore: "paywall_view_did_start_restore",
2459
- DidFinishRestore: "paywall_view_did_finish_restore",
2460
- DidFailRestore: "paywall_view_did_fail_restore",
2461
- DidFailRendering: "paywall_view_did_fail_rendering",
2462
- DidFailLoadingProducts: "paywall_view_did_fail_loading_products",
2463
- DidFinishWebPaymentNavigation: "paywall_view_did_finish_web_payment_navigation"
2504
+ //#region src/types/flow-events.ts
2505
+ const FlowEventId = {
2506
+ DidAppear: "flow_view_did_appear",
2507
+ DidDisappear: "flow_view_did_disappear",
2508
+ DidPerformAction: "flow_view_did_perform_action",
2509
+ DidSelectProduct: "flow_view_did_select_product",
2510
+ DidStartPurchase: "flow_view_did_start_purchase",
2511
+ DidFinishPurchase: "flow_view_did_finish_purchase",
2512
+ DidFailPurchase: "flow_view_did_fail_purchase",
2513
+ DidStartRestore: "flow_view_did_start_restore",
2514
+ DidFinishRestore: "flow_view_did_finish_restore",
2515
+ DidFailRestore: "flow_view_did_fail_restore",
2516
+ DidReceiveError: "flow_view_did_receive_error",
2517
+ DidFailLoadingProducts: "flow_view_did_fail_loading_products",
2518
+ DidFinishWebPaymentNavigation: "flow_view_did_finish_web_payment_navigation"
2464
2519
  };
2465
2520
 
2466
2521
  //#endregion
@@ -2476,13 +2531,13 @@ const OnboardingEventId = {
2476
2531
  };
2477
2532
 
2478
2533
  //#endregion
2479
- //#region src/ui-builder/paywall-event-mapping.ts
2534
+ //#region src/ui-builder/flow-event-mapping.ts
2480
2535
  /**
2481
2536
  * Resolves native event to handler name based on event data
2482
2537
  */
2483
2538
  const NATIVE_EVENT_RESOLVER = {
2484
- [PaywallEventId.DidPerformAction]: (event) => {
2485
- if (event.id !== PaywallEventId.DidPerformAction) return null;
2539
+ [FlowEventId.DidPerformAction]: (event) => {
2540
+ if (event.id !== FlowEventId.DidPerformAction) return null;
2486
2541
  const actionMap = {
2487
2542
  close: "onCloseButtonPress",
2488
2543
  system_back: "onAndroidSystemBack",
@@ -2491,59 +2546,59 @@ const NATIVE_EVENT_RESOLVER = {
2491
2546
  };
2492
2547
  return actionMap[event.action.type] || null;
2493
2548
  },
2494
- [PaywallEventId.DidAppear]: () => "onPaywallShown",
2495
- [PaywallEventId.DidDisappear]: () => "onPaywallClosed",
2496
- [PaywallEventId.DidSelectProduct]: () => "onProductSelected",
2497
- [PaywallEventId.DidStartPurchase]: () => "onPurchaseStarted",
2498
- [PaywallEventId.DidFinishPurchase]: () => "onPurchaseCompleted",
2499
- [PaywallEventId.DidFailPurchase]: () => "onPurchaseFailed",
2500
- [PaywallEventId.DidStartRestore]: () => "onRestoreStarted",
2501
- [PaywallEventId.DidFinishRestore]: () => "onRestoreCompleted",
2502
- [PaywallEventId.DidFailRestore]: () => "onRestoreFailed",
2503
- [PaywallEventId.DidFailRendering]: () => "onRenderingFailed",
2504
- [PaywallEventId.DidFailLoadingProducts]: () => "onLoadingProductsFailed",
2505
- [PaywallEventId.DidFinishWebPaymentNavigation]: () => "onWebPaymentNavigationFinished"
2549
+ [FlowEventId.DidAppear]: () => "onAppeared",
2550
+ [FlowEventId.DidDisappear]: () => "onDisappeared",
2551
+ [FlowEventId.DidSelectProduct]: () => "onProductSelected",
2552
+ [FlowEventId.DidStartPurchase]: () => "onPurchaseStarted",
2553
+ [FlowEventId.DidFinishPurchase]: () => "onPurchaseCompleted",
2554
+ [FlowEventId.DidFailPurchase]: () => "onPurchaseFailed",
2555
+ [FlowEventId.DidStartRestore]: () => "onRestoreStarted",
2556
+ [FlowEventId.DidFinishRestore]: () => "onRestoreCompleted",
2557
+ [FlowEventId.DidFailRestore]: () => "onRestoreFailed",
2558
+ [FlowEventId.DidReceiveError]: () => "onError",
2559
+ [FlowEventId.DidFailLoadingProducts]: () => "onLoadingProductsFailed",
2560
+ [FlowEventId.DidFinishWebPaymentNavigation]: () => "onWebPaymentNavigationFinished"
2506
2561
  };
2507
2562
  /**
2508
2563
  * Maps handler name to native event name
2509
2564
  * Used in addListener/addInternalListener to subscribe to correct native event
2510
2565
  */
2511
2566
  const HANDLER_TO_NATIVE_EVENT = {
2512
- onCloseButtonPress: PaywallEventId.DidPerformAction,
2513
- onAndroidSystemBack: PaywallEventId.DidPerformAction,
2514
- onUrlPress: PaywallEventId.DidPerformAction,
2515
- onCustomAction: PaywallEventId.DidPerformAction,
2516
- onPaywallShown: PaywallEventId.DidAppear,
2517
- onPaywallClosed: PaywallEventId.DidDisappear,
2518
- onProductSelected: PaywallEventId.DidSelectProduct,
2519
- onPurchaseStarted: PaywallEventId.DidStartPurchase,
2520
- onPurchaseCompleted: PaywallEventId.DidFinishPurchase,
2521
- onPurchaseFailed: PaywallEventId.DidFailPurchase,
2522
- onRestoreStarted: PaywallEventId.DidStartRestore,
2523
- onRestoreCompleted: PaywallEventId.DidFinishRestore,
2524
- onRestoreFailed: PaywallEventId.DidFailRestore,
2525
- onRenderingFailed: PaywallEventId.DidFailRendering,
2526
- onLoadingProductsFailed: PaywallEventId.DidFailLoadingProducts,
2527
- onWebPaymentNavigationFinished: PaywallEventId.DidFinishWebPaymentNavigation
2567
+ onCloseButtonPress: FlowEventId.DidPerformAction,
2568
+ onAndroidSystemBack: FlowEventId.DidPerformAction,
2569
+ onUrlPress: FlowEventId.DidPerformAction,
2570
+ onCustomAction: FlowEventId.DidPerformAction,
2571
+ onAppeared: FlowEventId.DidAppear,
2572
+ onDisappeared: FlowEventId.DidDisappear,
2573
+ onProductSelected: FlowEventId.DidSelectProduct,
2574
+ onPurchaseStarted: FlowEventId.DidStartPurchase,
2575
+ onPurchaseCompleted: FlowEventId.DidFinishPurchase,
2576
+ onPurchaseFailed: FlowEventId.DidFailPurchase,
2577
+ onRestoreStarted: FlowEventId.DidStartRestore,
2578
+ onRestoreCompleted: FlowEventId.DidFinishRestore,
2579
+ onRestoreFailed: FlowEventId.DidFailRestore,
2580
+ onError: FlowEventId.DidReceiveError,
2581
+ onLoadingProductsFailed: FlowEventId.DidFailLoadingProducts,
2582
+ onWebPaymentNavigationFinished: FlowEventId.DidFinishWebPaymentNavigation
2528
2583
  };
2529
- function extractPaywallCallbackArgs(handlerName, event) {
2584
+ function extractFlowCallbackArgs(handlerName, event) {
2530
2585
  switch (event.id) {
2531
- case PaywallEventId.DidSelectProduct: return [event.productId];
2532
- case PaywallEventId.DidStartPurchase: return [event.product];
2533
- case PaywallEventId.DidFinishPurchase: return [event.purchaseResult, event.product];
2534
- case PaywallEventId.DidFailPurchase: return [event.error, event.product];
2535
- case PaywallEventId.DidFinishRestore: return [event.profile];
2536
- case PaywallEventId.DidFailRestore:
2537
- case PaywallEventId.DidFailRendering:
2538
- case PaywallEventId.DidFailLoadingProducts: return [event.error];
2539
- case PaywallEventId.DidPerformAction:
2586
+ case FlowEventId.DidSelectProduct: return [event.productId];
2587
+ case FlowEventId.DidStartPurchase: return [event.product];
2588
+ case FlowEventId.DidFinishPurchase: return [event.purchaseResult, event.product];
2589
+ case FlowEventId.DidFailPurchase: return [event.error, event.product];
2590
+ case FlowEventId.DidFinishRestore: return [event.profile];
2591
+ case FlowEventId.DidFailRestore:
2592
+ case FlowEventId.DidReceiveError:
2593
+ case FlowEventId.DidFailLoadingProducts: return [event.error];
2594
+ case FlowEventId.DidPerformAction:
2540
2595
  if (handlerName === "onUrlPress" && event.action.type === "open_url") return [event.action.value, event.action.openIn];
2541
2596
  if (handlerName === "onCustomAction" && event.action.type === "custom") return [event.action.value];
2542
2597
  return [];
2543
- case PaywallEventId.DidFinishWebPaymentNavigation: return [event.product, event.error];
2544
- case PaywallEventId.DidAppear:
2545
- case PaywallEventId.DidDisappear:
2546
- case PaywallEventId.DidStartRestore: return [];
2598
+ case FlowEventId.DidFinishWebPaymentNavigation: return [event.product, event.error];
2599
+ case FlowEventId.DidAppear:
2600
+ case FlowEventId.DidDisappear:
2601
+ case FlowEventId.DidStartRestore: return [];
2547
2602
  }
2548
2603
  }
2549
2604
 
@@ -2647,10 +2702,9 @@ function getCoder(factory, type, ctx) {
2647
2702
  switch (type) {
2648
2703
  case "AdaptyError": return factory.createNativeErrorCoder();
2649
2704
  case "AdaptyProfile": return factory.createProfileCoder();
2650
- case "AdaptyPaywall": return factory.createPaywallCoder();
2705
+ case "AdaptyFlow": return factory.createFlowCoder();
2651
2706
  case "AdaptyPaywallProduct": return factory.createPaywallProductCoder();
2652
2707
  case "AdaptyRemoteConfig": return factory.createRemoteConfigCoder();
2653
- case "AdaptyPaywallBuilder": return factory.createPaywallBuilderCoder();
2654
2708
  case "AdaptyOnboarding": return factory.createOnboardingCoder();
2655
2709
  case "AdaptyPurchaseResult": return factory.createPurchaseResultCoder();
2656
2710
  case "AdaptyInstallationStatus": return factory.createInstallationStatusCoder();
@@ -2666,8 +2720,8 @@ function getCoder(factory, type, ctx) {
2666
2720
  }
2667
2721
 
2668
2722
  //#endregion
2669
- //#region src/coders/parse-paywall.ts
2670
- function parsePaywallEvent(factory, input, ctx) {
2723
+ //#region src/coders/parse-flow.ts
2724
+ function parseFlowEvent(factory, input, ctx) {
2671
2725
  let obj;
2672
2726
  try {
2673
2727
  obj = JSON.parse(input);
@@ -2675,7 +2729,7 @@ function parsePaywallEvent(factory, input, ctx) {
2675
2729
  throw AdaptyError.failedToDecode(`Failed to decode event: ${error?.message}`);
2676
2730
  }
2677
2731
  const eventId = obj["id"];
2678
- if (!eventId?.startsWith("paywall_view_")) return null;
2732
+ if (!eventId?.startsWith("flow_view_")) return null;
2679
2733
  const viewObj = obj["view"];
2680
2734
  const view = {
2681
2735
  id: viewObj["id"],
@@ -2683,59 +2737,59 @@ function parsePaywallEvent(factory, input, ctx) {
2683
2737
  variationId: viewObj["variation_id"]
2684
2738
  };
2685
2739
  switch (eventId) {
2686
- case PaywallEventId.DidAppear: return {
2740
+ case FlowEventId.DidAppear: return {
2687
2741
  id: eventId,
2688
2742
  view
2689
2743
  };
2690
- case PaywallEventId.DidDisappear: return {
2744
+ case FlowEventId.DidDisappear: return {
2691
2745
  id: eventId,
2692
2746
  view
2693
2747
  };
2694
- case PaywallEventId.DidPerformAction: {
2748
+ case FlowEventId.DidPerformAction: {
2695
2749
  const actionObj = obj["action"];
2696
2750
  return {
2697
2751
  id: eventId,
2698
2752
  view,
2699
- action: parsePaywallUserAction(actionObj)
2753
+ action: parseFlowUserAction(actionObj)
2700
2754
  };
2701
2755
  }
2702
- case PaywallEventId.DidSelectProduct: return {
2756
+ case FlowEventId.DidSelectProduct: return {
2703
2757
  id: eventId,
2704
2758
  view,
2705
2759
  productId: obj["product_id"] ?? ""
2706
2760
  };
2707
- case PaywallEventId.DidStartPurchase: return {
2761
+ case FlowEventId.DidStartPurchase: return {
2708
2762
  id: eventId,
2709
2763
  view,
2710
- product: getPaywallCoder(factory, "product", ctx).decode(obj["product"])
2764
+ product: getFlowCoder(factory, "product", ctx).decode(obj["product"])
2711
2765
  };
2712
- case PaywallEventId.DidFinishPurchase: return {
2766
+ case FlowEventId.DidFinishPurchase: return {
2713
2767
  id: eventId,
2714
2768
  view,
2715
- purchaseResult: getPaywallCoder(factory, "purchaseResult", ctx).decode(obj["purchased_result"]),
2716
- product: getPaywallCoder(factory, "product", ctx).decode(obj["product"])
2769
+ purchaseResult: getFlowCoder(factory, "purchaseResult", ctx).decode(obj["purchased_result"]),
2770
+ product: getFlowCoder(factory, "product", ctx).decode(obj["product"])
2717
2771
  };
2718
- case PaywallEventId.DidFailPurchase: {
2719
- const errorCoder = getPaywallCoder(factory, "error", ctx);
2772
+ case FlowEventId.DidFailPurchase: {
2773
+ const errorCoder = getFlowCoder(factory, "error", ctx);
2720
2774
  const decodedError = errorCoder.decode(obj["error"]);
2721
2775
  return {
2722
2776
  id: eventId,
2723
2777
  view,
2724
2778
  error: errorCoder.getError(decodedError),
2725
- product: getPaywallCoder(factory, "product", ctx).decode(obj["product"])
2779
+ product: getFlowCoder(factory, "product", ctx).decode(obj["product"])
2726
2780
  };
2727
2781
  }
2728
- case PaywallEventId.DidStartRestore: return {
2782
+ case FlowEventId.DidStartRestore: return {
2729
2783
  id: eventId,
2730
2784
  view
2731
2785
  };
2732
- case PaywallEventId.DidFinishRestore: return {
2786
+ case FlowEventId.DidFinishRestore: return {
2733
2787
  id: eventId,
2734
2788
  view,
2735
- profile: getPaywallCoder(factory, "profile", ctx).decode(obj["profile"])
2789
+ profile: getFlowCoder(factory, "profile", ctx).decode(obj["profile"])
2736
2790
  };
2737
- case PaywallEventId.DidFailRestore: {
2738
- const errorCoder = getPaywallCoder(factory, "error", ctx);
2791
+ case FlowEventId.DidFailRestore: {
2792
+ const errorCoder = getFlowCoder(factory, "error", ctx);
2739
2793
  const decodedError = errorCoder.decode(obj["error"]);
2740
2794
  return {
2741
2795
  id: eventId,
@@ -2743,8 +2797,8 @@ function parsePaywallEvent(factory, input, ctx) {
2743
2797
  error: errorCoder.getError(decodedError)
2744
2798
  };
2745
2799
  }
2746
- case PaywallEventId.DidFailRendering: {
2747
- const errorCoder = getPaywallCoder(factory, "error", ctx);
2800
+ case FlowEventId.DidReceiveError: {
2801
+ const errorCoder = getFlowCoder(factory, "error", ctx);
2748
2802
  const decodedError = errorCoder.decode(obj["error"]);
2749
2803
  return {
2750
2804
  id: eventId,
@@ -2752,8 +2806,8 @@ function parsePaywallEvent(factory, input, ctx) {
2752
2806
  error: errorCoder.getError(decodedError)
2753
2807
  };
2754
2808
  }
2755
- case PaywallEventId.DidFailLoadingProducts: {
2756
- const errorCoder = getPaywallCoder(factory, "error", ctx);
2809
+ case FlowEventId.DidFailLoadingProducts: {
2810
+ const errorCoder = getFlowCoder(factory, "error", ctx);
2757
2811
  const decodedError = errorCoder.decode(obj["error"]);
2758
2812
  return {
2759
2813
  id: eventId,
@@ -2761,12 +2815,12 @@ function parsePaywallEvent(factory, input, ctx) {
2761
2815
  error: errorCoder.getError(decodedError)
2762
2816
  };
2763
2817
  }
2764
- case PaywallEventId.DidFinishWebPaymentNavigation: return {
2818
+ case FlowEventId.DidFinishWebPaymentNavigation: return {
2765
2819
  id: eventId,
2766
2820
  view,
2767
- product: obj["product"] ? getPaywallCoder(factory, "product", ctx).decode(obj["product"]) : void 0,
2821
+ product: obj["product"] ? getFlowCoder(factory, "product", ctx).decode(obj["product"]) : void 0,
2768
2822
  error: obj["error"] ? (() => {
2769
- const errorCoder = getPaywallCoder(factory, "error", ctx);
2823
+ const errorCoder = getFlowCoder(factory, "error", ctx);
2770
2824
  const decodedError = errorCoder.decode(obj["error"]);
2771
2825
  return errorCoder.getError(decodedError);
2772
2826
  })() : void 0
@@ -2774,7 +2828,7 @@ function parsePaywallEvent(factory, input, ctx) {
2774
2828
  default: return null;
2775
2829
  }
2776
2830
  }
2777
- function parsePaywallUserAction(actionObj) {
2831
+ function parseFlowUserAction(actionObj) {
2778
2832
  const type = actionObj["type"];
2779
2833
  switch (type) {
2780
2834
  case "open_url": return {
@@ -2790,7 +2844,7 @@ function parsePaywallUserAction(actionObj) {
2790
2844
  case "system_back": return { type };
2791
2845
  }
2792
2846
  }
2793
- function getPaywallCoder(factory, type, _ctx) {
2847
+ function getFlowCoder(factory, type, _ctx) {
2794
2848
  switch (type) {
2795
2849
  case "product": return factory.createPaywallProductCoder();
2796
2850
  case "profile": return factory.createProfileCoder();
@@ -2991,5 +3045,5 @@ function withErrorContext(callback, handlerName, source) {
2991
3045
  }
2992
3046
 
2993
3047
  //#endregion
2994
- export { AdaptyAndroidSubscriptionUpdateReplacementMode, AdaptyError, AdaptyUiDialogActionType, AppTrackingTransparencyStatus, CancellationReason, CoderFactory, DefaultLoggerAdapter, DefaultPlatformAdapter, DefaultSdkMetadataAdapter, ErrorCode, ErrorCodeName, FetchPolicy, Gender, HANDLER_TO_EVENT_CONFIG, HANDLER_TO_NATIVE_EVENT, Log, LogContext, LogLevel, LogScope, MethodNames, NATIVE_EVENT_RESOLVER, NATIVE_EVENT_TO_HANDLERS, ONBOARDING_EVENT_MAPPINGS, OfferType, OnboardingEventId, PaywallEventId, ProductPeriod, RefundPreference, VendorStore, WebPresentation, consoleLogSink, extractOnboardingCallbackArgs, extractPaywallCallbackArgs, filterUndefined, generateId, getErrorCode, getErrorPrompt, mapValues, mergeOptions, parseCommonEvent, parseMethodResult, parseOnboardingEvent, parsePaywallEvent, withErrorContext };
3048
+ export { AdaptyAndroidSubscriptionUpdateReplacementMode, AdaptyError, AdaptyUiDialogActionType, AppTrackingTransparencyStatus, CancellationReason, CoderFactory, DefaultLoggerAdapter, DefaultPlatformAdapter, DefaultSdkMetadataAdapter, ErrorCode, ErrorCodeName, FetchPolicy, FlowEventId, Gender, HANDLER_TO_EVENT_CONFIG, HANDLER_TO_NATIVE_EVENT, Log, LogContext, LogLevel, LogScope, MethodNames, NATIVE_EVENT_RESOLVER, NATIVE_EVENT_TO_HANDLERS, ONBOARDING_EVENT_MAPPINGS, OfferType, OnboardingEventId, ProductPeriod, RefundPreference, VendorStore, WebPresentation, consoleLogSink, extractFlowCallbackArgs, extractOnboardingCallbackArgs, filterUndefined, generateId, getErrorCode, getErrorPrompt, mapValues, mergeOptions, parseCommonEvent, parseFlowEvent, parseMethodResult, parseOnboardingEvent, withErrorContext };
2995
3049
  //# sourceMappingURL=index.mjs.map