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