@adapty/core 3.17.2 → 4.0.0-beta.1-dev.c014d57cfcbd780e854d741136d31a1ad10e09dd
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 +445 -384
- package/dist/index.d.cts +563 -350
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +563 -350
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +443 -382
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -828,6 +828,283 @@ 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
|
+
const PROPERTIES = {
|
|
949
|
+
placement: {
|
|
950
|
+
key: "placement",
|
|
951
|
+
required: true,
|
|
952
|
+
type: "object",
|
|
953
|
+
converter: new AdaptyPlacementCoder()
|
|
954
|
+
},
|
|
955
|
+
id: {
|
|
956
|
+
key: "paywall_id",
|
|
957
|
+
required: true,
|
|
958
|
+
type: "string"
|
|
959
|
+
},
|
|
960
|
+
name: {
|
|
961
|
+
key: "paywall_name",
|
|
962
|
+
required: true,
|
|
963
|
+
type: "string"
|
|
964
|
+
},
|
|
965
|
+
products: {
|
|
966
|
+
key: "products",
|
|
967
|
+
required: true,
|
|
968
|
+
type: "array",
|
|
969
|
+
converter: new ArrayCoder(() => new ProductReferenceCoder())
|
|
970
|
+
},
|
|
971
|
+
variationId: {
|
|
972
|
+
key: "variation_id",
|
|
973
|
+
required: true,
|
|
974
|
+
type: "string"
|
|
975
|
+
},
|
|
976
|
+
webPurchaseUrl: {
|
|
977
|
+
key: "web_purchase_url",
|
|
978
|
+
required: false,
|
|
979
|
+
type: "string"
|
|
980
|
+
}
|
|
981
|
+
};
|
|
982
|
+
var AdaptyFlowPaywallCoder = class extends Coder {
|
|
983
|
+
constructor(..._args) {
|
|
984
|
+
super(..._args);
|
|
985
|
+
this.properties = PROPERTIES;
|
|
986
|
+
}
|
|
987
|
+
decode(data) {
|
|
988
|
+
const codablePart = super.decode(data);
|
|
989
|
+
return {
|
|
990
|
+
...codablePart,
|
|
991
|
+
productIdentifiers: codablePart.products.map((product) => ({
|
|
992
|
+
vendorProductId: product.vendorId,
|
|
993
|
+
adaptyProductId: product.adaptyId,
|
|
994
|
+
basePlanId: product.android?.basePlanId
|
|
995
|
+
}))
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
encode(data) {
|
|
999
|
+
const { productIdentifiers,...codablePart } = data;
|
|
1000
|
+
return super.encode(codablePart);
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
|
|
1004
|
+
//#endregion
|
|
1005
|
+
//#region src/coders/json.ts
|
|
1006
|
+
var JSONCoder = class {
|
|
1007
|
+
decode(input) {
|
|
1008
|
+
if (!input) return {};
|
|
1009
|
+
return JSON.parse(input);
|
|
1010
|
+
}
|
|
1011
|
+
encode(value) {
|
|
1012
|
+
if (Object.keys(value).length === 0) return "";
|
|
1013
|
+
return JSON.stringify(value);
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
|
|
1017
|
+
//#endregion
|
|
1018
|
+
//#region src/coders/adapty-remote-config.ts
|
|
1019
|
+
var AdaptyRemoteConfigCoder = class extends Coder {
|
|
1020
|
+
constructor(..._args) {
|
|
1021
|
+
super(..._args);
|
|
1022
|
+
this.properties = {
|
|
1023
|
+
data: {
|
|
1024
|
+
key: "data",
|
|
1025
|
+
required: true,
|
|
1026
|
+
type: "string",
|
|
1027
|
+
converter: new JSONCoder()
|
|
1028
|
+
},
|
|
1029
|
+
lang: {
|
|
1030
|
+
key: "lang",
|
|
1031
|
+
required: true,
|
|
1032
|
+
type: "string"
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
decode(data) {
|
|
1037
|
+
const codablePart = super.decode(data);
|
|
1038
|
+
const dataString = JSON.stringify(codablePart.data);
|
|
1039
|
+
return {
|
|
1040
|
+
...codablePart,
|
|
1041
|
+
dataString: dataString.length < 4 ? "" : dataString
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
encode(data) {
|
|
1045
|
+
const { dataString,...codablePart } = data;
|
|
1046
|
+
return super.encode(codablePart);
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
//#endregion
|
|
1051
|
+
//#region src/coders/adapty-flow.ts
|
|
1052
|
+
var AdaptyFlowCoder = class extends SimpleCoder {
|
|
1053
|
+
constructor(..._args) {
|
|
1054
|
+
super(..._args);
|
|
1055
|
+
this.properties = {
|
|
1056
|
+
placement: {
|
|
1057
|
+
key: "placement",
|
|
1058
|
+
required: true,
|
|
1059
|
+
type: "object",
|
|
1060
|
+
converter: new AdaptyPlacementCoder()
|
|
1061
|
+
},
|
|
1062
|
+
id: {
|
|
1063
|
+
key: "flow_id",
|
|
1064
|
+
required: true,
|
|
1065
|
+
type: "string"
|
|
1066
|
+
},
|
|
1067
|
+
name: {
|
|
1068
|
+
key: "flow_name",
|
|
1069
|
+
required: true,
|
|
1070
|
+
type: "string"
|
|
1071
|
+
},
|
|
1072
|
+
variationId: {
|
|
1073
|
+
key: "variation_id",
|
|
1074
|
+
required: true,
|
|
1075
|
+
type: "string"
|
|
1076
|
+
},
|
|
1077
|
+
remoteConfigs: {
|
|
1078
|
+
key: "remote_configs",
|
|
1079
|
+
required: false,
|
|
1080
|
+
type: "array",
|
|
1081
|
+
converter: new ArrayCoder(() => new AdaptyRemoteConfigCoder())
|
|
1082
|
+
},
|
|
1083
|
+
flowVersionId: {
|
|
1084
|
+
key: "flow_version_id",
|
|
1085
|
+
required: false,
|
|
1086
|
+
type: "string"
|
|
1087
|
+
},
|
|
1088
|
+
paywalls: {
|
|
1089
|
+
key: "variations",
|
|
1090
|
+
required: true,
|
|
1091
|
+
type: "array",
|
|
1092
|
+
converter: new ArrayCoder(() => new AdaptyFlowPaywallCoder())
|
|
1093
|
+
},
|
|
1094
|
+
responseCreatedAt: {
|
|
1095
|
+
key: "response_created_at",
|
|
1096
|
+
required: true,
|
|
1097
|
+
type: "number"
|
|
1098
|
+
},
|
|
1099
|
+
payloadData: {
|
|
1100
|
+
key: "payload_data",
|
|
1101
|
+
required: false,
|
|
1102
|
+
type: "string"
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1107
|
+
|
|
831
1108
|
//#endregion
|
|
832
1109
|
//#region src/coders/adapty-identify-params.ts
|
|
833
1110
|
var AdaptyIdentifyParamsCoder = class {
|
|
@@ -997,92 +1274,6 @@ var AdaptyOnboardingBuilderCoder = class extends SimpleCoder {
|
|
|
997
1274
|
}
|
|
998
1275
|
};
|
|
999
1276
|
|
|
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
1277
|
//#endregion
|
|
1087
1278
|
//#region src/coders/adapty-onboarding.ts
|
|
1088
1279
|
var AdaptyOnboardingCoder = class extends Coder {
|
|
@@ -1152,26 +1343,6 @@ var AdaptyOnboardingCoder = class extends Coder {
|
|
|
1152
1343
|
}
|
|
1153
1344
|
};
|
|
1154
1345
|
|
|
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
1346
|
//#endregion
|
|
1176
1347
|
//#region src/coders/adapty-subscription-offer-identifier.ts
|
|
1177
1348
|
var AdaptySubscriptionOfferIdCoder = class extends SimpleCoder {
|
|
@@ -1192,22 +1363,6 @@ var AdaptySubscriptionOfferIdCoder = class extends SimpleCoder {
|
|
|
1192
1363
|
}
|
|
1193
1364
|
};
|
|
1194
1365
|
|
|
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
1366
|
//#endregion
|
|
1212
1367
|
//#region src/coders/adapty-subscription-offer.ts
|
|
1213
1368
|
var AdaptySubscriptionOfferCoder = class extends SimpleCoder {
|
|
@@ -1399,145 +1554,6 @@ var AdaptyPaywallProductCoder = class extends SimpleCoder {
|
|
|
1399
1554
|
}
|
|
1400
1555
|
};
|
|
1401
1556
|
|
|
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
1557
|
//#endregion
|
|
1542
1558
|
//#region src/coders/adapty-profile-parameters.ts
|
|
1543
1559
|
var AdaptyProfileParametersCoder = class extends SimpleCoder {
|
|
@@ -1784,9 +1800,6 @@ var AdaptyProfileCoder = class extends SimpleCoder {
|
|
|
1784
1800
|
|
|
1785
1801
|
//#endregion
|
|
1786
1802
|
//#region src/coders/adapty-purchase-params.ts
|
|
1787
|
-
function isDeprecatedType(data) {
|
|
1788
|
-
return typeof data === "object" && data !== null && "android" in data && typeof data.android === "object" && data.android !== null && "oldSubVendorProductId" in data.android && "prorationMode" in data.android;
|
|
1789
|
-
}
|
|
1790
1803
|
var AdaptyPurchaseParamsCoder = class {
|
|
1791
1804
|
constructor(platform) {
|
|
1792
1805
|
this.platform = platform;
|
|
@@ -1794,16 +1807,6 @@ var AdaptyPurchaseParamsCoder = class {
|
|
|
1794
1807
|
encode(data) {
|
|
1795
1808
|
if (this.platform.OS !== "android") return {};
|
|
1796
1809
|
const purchaseParams = {};
|
|
1797
|
-
if (isDeprecatedType(data)) {
|
|
1798
|
-
if (data.android) {
|
|
1799
|
-
purchaseParams["subscription_update_params"] = {
|
|
1800
|
-
replacement_mode: data.android.prorationMode,
|
|
1801
|
-
old_sub_vendor_product_id: data.android.oldSubVendorProductId
|
|
1802
|
-
};
|
|
1803
|
-
if (data.android.isOfferPersonalized) purchaseParams["is_offer_personalized"] = data.android.isOfferPersonalized;
|
|
1804
|
-
}
|
|
1805
|
-
return purchaseParams;
|
|
1806
|
-
}
|
|
1807
1810
|
if (data.android) {
|
|
1808
1811
|
if (data.android.subscriptionUpdateParams) purchaseParams["subscription_update_params"] = {
|
|
1809
1812
|
replacement_mode: data.android.subscriptionUpdateParams.prorationMode,
|
|
@@ -1936,14 +1939,15 @@ const resolveAssetId = (asset, platformOS) => {
|
|
|
1936
1939
|
};
|
|
1937
1940
|
|
|
1938
1941
|
//#endregion
|
|
1939
|
-
//#region src/coders/adapty-ui-create-
|
|
1940
|
-
var
|
|
1942
|
+
//#region src/coders/adapty-ui-create-flow-view-params.ts
|
|
1943
|
+
var AdaptyUICreateFlowViewParamsCoder = class {
|
|
1941
1944
|
constructor(platform) {
|
|
1942
1945
|
this.platform = platform;
|
|
1943
1946
|
}
|
|
1944
1947
|
encode(data) {
|
|
1945
1948
|
const result = {};
|
|
1946
1949
|
if (data.prefetchProducts !== void 0) result.preload_products = data.prefetchProducts;
|
|
1950
|
+
if (data.enableSafeArea !== void 0) result.enable_safe_area_paddings = data.enableSafeArea;
|
|
1947
1951
|
if (data.loadTimeoutMs !== void 0) result.load_timeout = data.loadTimeoutMs / 1e3;
|
|
1948
1952
|
if (data.customTags) result.custom_tags = data.customTags;
|
|
1949
1953
|
if (data.customTimers) result.custom_timers = this.encodeCustomTimers(data.customTimers);
|
|
@@ -2278,11 +2282,11 @@ var CoderFactory = class {
|
|
|
2278
2282
|
createOnboardingCoder() {
|
|
2279
2283
|
return new AdaptyOnboardingCoder(this.deps.platform);
|
|
2280
2284
|
}
|
|
2281
|
-
|
|
2282
|
-
return new
|
|
2285
|
+
createFlowCoder() {
|
|
2286
|
+
return new AdaptyFlowCoder(this.deps.platform);
|
|
2283
2287
|
}
|
|
2284
|
-
|
|
2285
|
-
return new
|
|
2288
|
+
createFlowPaywallCoder() {
|
|
2289
|
+
return new AdaptyFlowPaywallCoder(this.deps.platform);
|
|
2286
2290
|
}
|
|
2287
2291
|
createPaywallProductCoder() {
|
|
2288
2292
|
return new AdaptyPaywallProductCoder(this.deps.platform);
|
|
@@ -2323,8 +2327,8 @@ var CoderFactory = class {
|
|
|
2323
2327
|
createUiCreateOnboardingViewParamsCoder() {
|
|
2324
2328
|
return new AdaptyUICreateOnboardingViewParamsCoder();
|
|
2325
2329
|
}
|
|
2326
|
-
|
|
2327
|
-
return new
|
|
2330
|
+
createUiCreateFlowViewParamsCoder() {
|
|
2331
|
+
return new AdaptyUICreateFlowViewParamsCoder(this.deps.platform);
|
|
2328
2332
|
}
|
|
2329
2333
|
createUiDialogConfigCoder() {
|
|
2330
2334
|
return new AdaptyUiDialogConfigCoder(this.deps.platform);
|
|
@@ -2414,9 +2418,9 @@ const RefundPreference = Object.freeze({
|
|
|
2414
2418
|
const MethodNames = [
|
|
2415
2419
|
"activate",
|
|
2416
2420
|
"adapty_ui_activate",
|
|
2417
|
-
"
|
|
2418
|
-
"
|
|
2419
|
-
"
|
|
2421
|
+
"adapty_ui_create_flow_view",
|
|
2422
|
+
"adapty_ui_dismiss_flow_view",
|
|
2423
|
+
"adapty_ui_present_flow_view",
|
|
2420
2424
|
"adapty_ui_show_dialog",
|
|
2421
2425
|
"adapty_ui_create_onboarding_view",
|
|
2422
2426
|
"adapty_ui_dismiss_onboarding_view",
|
|
@@ -2424,14 +2428,14 @@ const MethodNames = [
|
|
|
2424
2428
|
"create_web_paywall_url",
|
|
2425
2429
|
"get_current_installation_status",
|
|
2426
2430
|
"is_activated",
|
|
2427
|
-
"
|
|
2428
|
-
"
|
|
2431
|
+
"get_flow",
|
|
2432
|
+
"get_flow_for_default_audience",
|
|
2429
2433
|
"get_paywall_products",
|
|
2430
2434
|
"get_onboarding",
|
|
2431
2435
|
"get_onboarding_for_default_audience",
|
|
2432
2436
|
"get_profile",
|
|
2433
2437
|
"identify",
|
|
2434
|
-
"
|
|
2438
|
+
"log_show_flow",
|
|
2435
2439
|
"logout",
|
|
2436
2440
|
"make_purchase",
|
|
2437
2441
|
"open_web_paywall",
|
|
@@ -2444,25 +2448,37 @@ const MethodNames = [
|
|
|
2444
2448
|
"update_attribution_data",
|
|
2445
2449
|
"update_collecting_refund_data_consent",
|
|
2446
2450
|
"update_profile",
|
|
2447
|
-
"update_refund_preference"
|
|
2451
|
+
"update_refund_preference",
|
|
2452
|
+
"flow_view_did_answer_permission",
|
|
2453
|
+
"adapty_ui_open_url",
|
|
2454
|
+
"adapty_ui_request_app_review",
|
|
2455
|
+
"observer_purchase_did_start",
|
|
2456
|
+
"observer_purchase_did_finish",
|
|
2457
|
+
"observer_restore_did_start",
|
|
2458
|
+
"observer_restore_did_finish"
|
|
2448
2459
|
];
|
|
2449
2460
|
|
|
2450
2461
|
//#endregion
|
|
2451
|
-
//#region src/types/
|
|
2452
|
-
const
|
|
2453
|
-
DidAppear: "
|
|
2454
|
-
DidDisappear: "
|
|
2455
|
-
DidPerformAction: "
|
|
2456
|
-
DidSelectProduct: "
|
|
2457
|
-
DidStartPurchase: "
|
|
2458
|
-
DidFinishPurchase: "
|
|
2459
|
-
DidFailPurchase: "
|
|
2460
|
-
DidStartRestore: "
|
|
2461
|
-
DidFinishRestore: "
|
|
2462
|
-
DidFailRestore: "
|
|
2463
|
-
|
|
2464
|
-
DidFailLoadingProducts: "
|
|
2465
|
-
DidFinishWebPaymentNavigation: "
|
|
2462
|
+
//#region src/types/flow-events.ts
|
|
2463
|
+
const FlowEventId = {
|
|
2464
|
+
DidAppear: "flow_view_did_appear",
|
|
2465
|
+
DidDisappear: "flow_view_did_disappear",
|
|
2466
|
+
DidPerformAction: "flow_view_did_perform_action",
|
|
2467
|
+
DidSelectProduct: "flow_view_did_select_product",
|
|
2468
|
+
DidStartPurchase: "flow_view_did_start_purchase",
|
|
2469
|
+
DidFinishPurchase: "flow_view_did_finish_purchase",
|
|
2470
|
+
DidFailPurchase: "flow_view_did_fail_purchase",
|
|
2471
|
+
DidStartRestore: "flow_view_did_start_restore",
|
|
2472
|
+
DidFinishRestore: "flow_view_did_finish_restore",
|
|
2473
|
+
DidFailRestore: "flow_view_did_fail_restore",
|
|
2474
|
+
DidReceiveError: "flow_view_did_receive_error",
|
|
2475
|
+
DidFailLoadingProducts: "flow_view_did_fail_loading_products",
|
|
2476
|
+
DidFinishWebPaymentNavigation: "flow_view_did_finish_web_payment_navigation",
|
|
2477
|
+
DidRequestAppReview: "flow_view_did_request_app_review",
|
|
2478
|
+
DidReceiveAnalyticEvent: "flow_view_did_receive_analytic_event",
|
|
2479
|
+
DidAskPermission: "flow_view_did_ask_permission",
|
|
2480
|
+
ObserverDidInitiatePurchase: "flow_view_observer_did_initiate_purchase",
|
|
2481
|
+
ObserverDidInitiateRestore: "flow_view_observer_did_initiate_restore"
|
|
2466
2482
|
};
|
|
2467
2483
|
|
|
2468
2484
|
//#endregion
|
|
@@ -2478,13 +2494,13 @@ const OnboardingEventId = {
|
|
|
2478
2494
|
};
|
|
2479
2495
|
|
|
2480
2496
|
//#endregion
|
|
2481
|
-
//#region src/ui-builder/
|
|
2497
|
+
//#region src/ui-builder/flow-event-mapping.ts
|
|
2482
2498
|
/**
|
|
2483
2499
|
* Resolves native event to handler name based on event data
|
|
2484
2500
|
*/
|
|
2485
2501
|
const NATIVE_EVENT_RESOLVER = {
|
|
2486
|
-
[
|
|
2487
|
-
if (event.id !==
|
|
2502
|
+
[FlowEventId.DidPerformAction]: (event) => {
|
|
2503
|
+
if (event.id !== FlowEventId.DidPerformAction) return null;
|
|
2488
2504
|
const actionMap = {
|
|
2489
2505
|
close: "onCloseButtonPress",
|
|
2490
2506
|
system_back: "onAndroidSystemBack",
|
|
@@ -2493,59 +2509,74 @@ const NATIVE_EVENT_RESOLVER = {
|
|
|
2493
2509
|
};
|
|
2494
2510
|
return actionMap[event.action.type] || null;
|
|
2495
2511
|
},
|
|
2496
|
-
[
|
|
2497
|
-
[
|
|
2498
|
-
[
|
|
2499
|
-
[
|
|
2500
|
-
[
|
|
2501
|
-
[
|
|
2502
|
-
[
|
|
2503
|
-
[
|
|
2504
|
-
[
|
|
2505
|
-
[
|
|
2506
|
-
[
|
|
2507
|
-
[
|
|
2512
|
+
[FlowEventId.DidAppear]: () => "onAppeared",
|
|
2513
|
+
[FlowEventId.DidDisappear]: () => "onDisappeared",
|
|
2514
|
+
[FlowEventId.DidSelectProduct]: () => "onProductSelected",
|
|
2515
|
+
[FlowEventId.DidStartPurchase]: () => "onPurchaseStarted",
|
|
2516
|
+
[FlowEventId.DidFinishPurchase]: () => "onPurchaseCompleted",
|
|
2517
|
+
[FlowEventId.DidFailPurchase]: () => "onPurchaseFailed",
|
|
2518
|
+
[FlowEventId.DidStartRestore]: () => "onRestoreStarted",
|
|
2519
|
+
[FlowEventId.DidFinishRestore]: () => "onRestoreCompleted",
|
|
2520
|
+
[FlowEventId.DidFailRestore]: () => "onRestoreFailed",
|
|
2521
|
+
[FlowEventId.DidReceiveError]: () => "onError",
|
|
2522
|
+
[FlowEventId.DidFailLoadingProducts]: () => "onLoadingProductsFailed",
|
|
2523
|
+
[FlowEventId.DidFinishWebPaymentNavigation]: () => "onWebPaymentNavigationFinished",
|
|
2524
|
+
[FlowEventId.DidRequestAppReview]: () => "onRequestAppReview",
|
|
2525
|
+
[FlowEventId.DidReceiveAnalyticEvent]: () => "onAnalytics",
|
|
2526
|
+
[FlowEventId.DidAskPermission]: () => "onRequestPermission",
|
|
2527
|
+
[FlowEventId.ObserverDidInitiatePurchase]: () => "onObserverPurchaseInitiated",
|
|
2528
|
+
[FlowEventId.ObserverDidInitiateRestore]: () => "onObserverRestoreInitiated"
|
|
2508
2529
|
};
|
|
2509
2530
|
/**
|
|
2510
2531
|
* Maps handler name to native event name
|
|
2511
2532
|
* Used in addListener/addInternalListener to subscribe to correct native event
|
|
2512
2533
|
*/
|
|
2513
2534
|
const HANDLER_TO_NATIVE_EVENT = {
|
|
2514
|
-
onCloseButtonPress:
|
|
2515
|
-
onAndroidSystemBack:
|
|
2516
|
-
onUrlPress:
|
|
2517
|
-
onCustomAction:
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
onProductSelected:
|
|
2521
|
-
onPurchaseStarted:
|
|
2522
|
-
onPurchaseCompleted:
|
|
2523
|
-
onPurchaseFailed:
|
|
2524
|
-
onRestoreStarted:
|
|
2525
|
-
onRestoreCompleted:
|
|
2526
|
-
onRestoreFailed:
|
|
2527
|
-
|
|
2528
|
-
onLoadingProductsFailed:
|
|
2529
|
-
onWebPaymentNavigationFinished:
|
|
2535
|
+
onCloseButtonPress: FlowEventId.DidPerformAction,
|
|
2536
|
+
onAndroidSystemBack: FlowEventId.DidPerformAction,
|
|
2537
|
+
onUrlPress: FlowEventId.DidPerformAction,
|
|
2538
|
+
onCustomAction: FlowEventId.DidPerformAction,
|
|
2539
|
+
onAppeared: FlowEventId.DidAppear,
|
|
2540
|
+
onDisappeared: FlowEventId.DidDisappear,
|
|
2541
|
+
onProductSelected: FlowEventId.DidSelectProduct,
|
|
2542
|
+
onPurchaseStarted: FlowEventId.DidStartPurchase,
|
|
2543
|
+
onPurchaseCompleted: FlowEventId.DidFinishPurchase,
|
|
2544
|
+
onPurchaseFailed: FlowEventId.DidFailPurchase,
|
|
2545
|
+
onRestoreStarted: FlowEventId.DidStartRestore,
|
|
2546
|
+
onRestoreCompleted: FlowEventId.DidFinishRestore,
|
|
2547
|
+
onRestoreFailed: FlowEventId.DidFailRestore,
|
|
2548
|
+
onError: FlowEventId.DidReceiveError,
|
|
2549
|
+
onLoadingProductsFailed: FlowEventId.DidFailLoadingProducts,
|
|
2550
|
+
onWebPaymentNavigationFinished: FlowEventId.DidFinishWebPaymentNavigation,
|
|
2551
|
+
onRequestAppReview: FlowEventId.DidRequestAppReview,
|
|
2552
|
+
onAnalytics: FlowEventId.DidReceiveAnalyticEvent,
|
|
2553
|
+
onRequestPermission: FlowEventId.DidAskPermission,
|
|
2554
|
+
onObserverPurchaseInitiated: FlowEventId.ObserverDidInitiatePurchase,
|
|
2555
|
+
onObserverRestoreInitiated: FlowEventId.ObserverDidInitiateRestore
|
|
2530
2556
|
};
|
|
2531
|
-
function
|
|
2557
|
+
function extractFlowCallbackArgs(handlerName, event) {
|
|
2532
2558
|
switch (event.id) {
|
|
2533
|
-
case
|
|
2534
|
-
case
|
|
2535
|
-
case
|
|
2536
|
-
case
|
|
2537
|
-
case
|
|
2538
|
-
case
|
|
2539
|
-
case
|
|
2540
|
-
case
|
|
2541
|
-
case
|
|
2559
|
+
case FlowEventId.DidSelectProduct: return [event.productId];
|
|
2560
|
+
case FlowEventId.DidStartPurchase: return [event.product];
|
|
2561
|
+
case FlowEventId.DidFinishPurchase: return [event.purchaseResult, event.product];
|
|
2562
|
+
case FlowEventId.DidFailPurchase: return [event.error, event.product];
|
|
2563
|
+
case FlowEventId.DidFinishRestore: return [event.profile];
|
|
2564
|
+
case FlowEventId.DidFailRestore:
|
|
2565
|
+
case FlowEventId.DidReceiveError:
|
|
2566
|
+
case FlowEventId.DidFailLoadingProducts: return [event.error];
|
|
2567
|
+
case FlowEventId.DidPerformAction:
|
|
2542
2568
|
if (handlerName === "onUrlPress" && event.action.type === "open_url") return [event.action.value, event.action.openIn];
|
|
2543
2569
|
if (handlerName === "onCustomAction" && event.action.type === "custom") return [event.action.value];
|
|
2544
2570
|
return [];
|
|
2545
|
-
case
|
|
2546
|
-
case
|
|
2547
|
-
case
|
|
2548
|
-
case
|
|
2571
|
+
case FlowEventId.DidFinishWebPaymentNavigation: return [event.product, event.error];
|
|
2572
|
+
case FlowEventId.DidReceiveAnalyticEvent: return [event.name, event.params];
|
|
2573
|
+
case FlowEventId.DidAskPermission: return [event.permission, event.customArgs];
|
|
2574
|
+
case FlowEventId.ObserverDidInitiatePurchase:
|
|
2575
|
+
case FlowEventId.ObserverDidInitiateRestore: return [];
|
|
2576
|
+
case FlowEventId.DidRequestAppReview:
|
|
2577
|
+
case FlowEventId.DidAppear:
|
|
2578
|
+
case FlowEventId.DidDisappear:
|
|
2579
|
+
case FlowEventId.DidStartRestore: return [];
|
|
2549
2580
|
}
|
|
2550
2581
|
}
|
|
2551
2582
|
|
|
@@ -2649,10 +2680,9 @@ function getCoder(factory, type, ctx) {
|
|
|
2649
2680
|
switch (type) {
|
|
2650
2681
|
case "AdaptyError": return factory.createNativeErrorCoder();
|
|
2651
2682
|
case "AdaptyProfile": return factory.createProfileCoder();
|
|
2652
|
-
case "
|
|
2683
|
+
case "AdaptyFlow": return factory.createFlowCoder();
|
|
2653
2684
|
case "AdaptyPaywallProduct": return factory.createPaywallProductCoder();
|
|
2654
2685
|
case "AdaptyRemoteConfig": return factory.createRemoteConfigCoder();
|
|
2655
|
-
case "AdaptyPaywallBuilder": return factory.createPaywallBuilderCoder();
|
|
2656
2686
|
case "AdaptyOnboarding": return factory.createOnboardingCoder();
|
|
2657
2687
|
case "AdaptyPurchaseResult": return factory.createPurchaseResultCoder();
|
|
2658
2688
|
case "AdaptyInstallationStatus": return factory.createInstallationStatusCoder();
|
|
@@ -2668,8 +2698,8 @@ function getCoder(factory, type, ctx) {
|
|
|
2668
2698
|
}
|
|
2669
2699
|
|
|
2670
2700
|
//#endregion
|
|
2671
|
-
//#region src/coders/parse-
|
|
2672
|
-
function
|
|
2701
|
+
//#region src/coders/parse-flow.ts
|
|
2702
|
+
function parseFlowEvent(factory, input, ctx) {
|
|
2673
2703
|
let obj;
|
|
2674
2704
|
try {
|
|
2675
2705
|
obj = JSON.parse(input);
|
|
@@ -2677,7 +2707,7 @@ function parsePaywallEvent(factory, input, ctx) {
|
|
|
2677
2707
|
throw AdaptyError.failedToDecode(`Failed to decode event: ${error?.message}`);
|
|
2678
2708
|
}
|
|
2679
2709
|
const eventId = obj["id"];
|
|
2680
|
-
if (!eventId?.startsWith("
|
|
2710
|
+
if (!eventId?.startsWith("flow_view_")) return null;
|
|
2681
2711
|
const viewObj = obj["view"];
|
|
2682
2712
|
const view = {
|
|
2683
2713
|
id: viewObj["id"],
|
|
@@ -2685,59 +2715,59 @@ function parsePaywallEvent(factory, input, ctx) {
|
|
|
2685
2715
|
variationId: viewObj["variation_id"]
|
|
2686
2716
|
};
|
|
2687
2717
|
switch (eventId) {
|
|
2688
|
-
case
|
|
2718
|
+
case FlowEventId.DidAppear: return {
|
|
2689
2719
|
id: eventId,
|
|
2690
2720
|
view
|
|
2691
2721
|
};
|
|
2692
|
-
case
|
|
2722
|
+
case FlowEventId.DidDisappear: return {
|
|
2693
2723
|
id: eventId,
|
|
2694
2724
|
view
|
|
2695
2725
|
};
|
|
2696
|
-
case
|
|
2726
|
+
case FlowEventId.DidPerformAction: {
|
|
2697
2727
|
const actionObj = obj["action"];
|
|
2698
2728
|
return {
|
|
2699
2729
|
id: eventId,
|
|
2700
2730
|
view,
|
|
2701
|
-
action:
|
|
2731
|
+
action: parseFlowUserAction(actionObj)
|
|
2702
2732
|
};
|
|
2703
2733
|
}
|
|
2704
|
-
case
|
|
2734
|
+
case FlowEventId.DidSelectProduct: return {
|
|
2705
2735
|
id: eventId,
|
|
2706
2736
|
view,
|
|
2707
2737
|
productId: obj["product_id"] ?? ""
|
|
2708
2738
|
};
|
|
2709
|
-
case
|
|
2739
|
+
case FlowEventId.DidStartPurchase: return {
|
|
2710
2740
|
id: eventId,
|
|
2711
2741
|
view,
|
|
2712
|
-
product:
|
|
2742
|
+
product: getFlowCoder(factory, "product", ctx).decode(obj["product"])
|
|
2713
2743
|
};
|
|
2714
|
-
case
|
|
2744
|
+
case FlowEventId.DidFinishPurchase: return {
|
|
2715
2745
|
id: eventId,
|
|
2716
2746
|
view,
|
|
2717
|
-
purchaseResult:
|
|
2718
|
-
product:
|
|
2747
|
+
purchaseResult: getFlowCoder(factory, "purchaseResult", ctx).decode(obj["purchased_result"]),
|
|
2748
|
+
product: getFlowCoder(factory, "product", ctx).decode(obj["product"])
|
|
2719
2749
|
};
|
|
2720
|
-
case
|
|
2721
|
-
const errorCoder =
|
|
2750
|
+
case FlowEventId.DidFailPurchase: {
|
|
2751
|
+
const errorCoder = getFlowCoder(factory, "error", ctx);
|
|
2722
2752
|
const decodedError = errorCoder.decode(obj["error"]);
|
|
2723
2753
|
return {
|
|
2724
2754
|
id: eventId,
|
|
2725
2755
|
view,
|
|
2726
2756
|
error: errorCoder.getError(decodedError),
|
|
2727
|
-
product:
|
|
2757
|
+
product: getFlowCoder(factory, "product", ctx).decode(obj["product"])
|
|
2728
2758
|
};
|
|
2729
2759
|
}
|
|
2730
|
-
case
|
|
2760
|
+
case FlowEventId.DidStartRestore: return {
|
|
2731
2761
|
id: eventId,
|
|
2732
2762
|
view
|
|
2733
2763
|
};
|
|
2734
|
-
case
|
|
2764
|
+
case FlowEventId.DidFinishRestore: return {
|
|
2735
2765
|
id: eventId,
|
|
2736
2766
|
view,
|
|
2737
|
-
profile:
|
|
2767
|
+
profile: getFlowCoder(factory, "profile", ctx).decode(obj["profile"])
|
|
2738
2768
|
};
|
|
2739
|
-
case
|
|
2740
|
-
const errorCoder =
|
|
2769
|
+
case FlowEventId.DidFailRestore: {
|
|
2770
|
+
const errorCoder = getFlowCoder(factory, "error", ctx);
|
|
2741
2771
|
const decodedError = errorCoder.decode(obj["error"]);
|
|
2742
2772
|
return {
|
|
2743
2773
|
id: eventId,
|
|
@@ -2745,8 +2775,8 @@ function parsePaywallEvent(factory, input, ctx) {
|
|
|
2745
2775
|
error: errorCoder.getError(decodedError)
|
|
2746
2776
|
};
|
|
2747
2777
|
}
|
|
2748
|
-
case
|
|
2749
|
-
const errorCoder =
|
|
2778
|
+
case FlowEventId.DidReceiveError: {
|
|
2779
|
+
const errorCoder = getFlowCoder(factory, "error", ctx);
|
|
2750
2780
|
const decodedError = errorCoder.decode(obj["error"]);
|
|
2751
2781
|
return {
|
|
2752
2782
|
id: eventId,
|
|
@@ -2754,8 +2784,8 @@ function parsePaywallEvent(factory, input, ctx) {
|
|
|
2754
2784
|
error: errorCoder.getError(decodedError)
|
|
2755
2785
|
};
|
|
2756
2786
|
}
|
|
2757
|
-
case
|
|
2758
|
-
const errorCoder =
|
|
2787
|
+
case FlowEventId.DidFailLoadingProducts: {
|
|
2788
|
+
const errorCoder = getFlowCoder(factory, "error", ctx);
|
|
2759
2789
|
const decodedError = errorCoder.decode(obj["error"]);
|
|
2760
2790
|
return {
|
|
2761
2791
|
id: eventId,
|
|
@@ -2763,20 +2793,51 @@ function parsePaywallEvent(factory, input, ctx) {
|
|
|
2763
2793
|
error: errorCoder.getError(decodedError)
|
|
2764
2794
|
};
|
|
2765
2795
|
}
|
|
2766
|
-
case
|
|
2796
|
+
case FlowEventId.DidFinishWebPaymentNavigation: return {
|
|
2767
2797
|
id: eventId,
|
|
2768
2798
|
view,
|
|
2769
|
-
product: obj["product"] ?
|
|
2799
|
+
product: obj["product"] ? getFlowCoder(factory, "product", ctx).decode(obj["product"]) : void 0,
|
|
2770
2800
|
error: obj["error"] ? (() => {
|
|
2771
|
-
const errorCoder =
|
|
2801
|
+
const errorCoder = getFlowCoder(factory, "error", ctx);
|
|
2772
2802
|
const decodedError = errorCoder.decode(obj["error"]);
|
|
2773
2803
|
return errorCoder.getError(decodedError);
|
|
2774
2804
|
})() : void 0
|
|
2775
2805
|
};
|
|
2806
|
+
case FlowEventId.DidRequestAppReview: return {
|
|
2807
|
+
id: eventId,
|
|
2808
|
+
view
|
|
2809
|
+
};
|
|
2810
|
+
case FlowEventId.DidReceiveAnalyticEvent: {
|
|
2811
|
+
const params = obj["params"];
|
|
2812
|
+
return {
|
|
2813
|
+
id: eventId,
|
|
2814
|
+
view,
|
|
2815
|
+
name: typeof obj["name"] === "string" ? obj["name"] : "",
|
|
2816
|
+
params: typeof params === "object" && params !== null ? params : {}
|
|
2817
|
+
};
|
|
2818
|
+
}
|
|
2819
|
+
case FlowEventId.DidAskPermission: return {
|
|
2820
|
+
id: eventId,
|
|
2821
|
+
view,
|
|
2822
|
+
eventId: typeof obj["event_id"] === "string" ? obj["event_id"] : "",
|
|
2823
|
+
permission: typeof obj["permission"] === "string" ? obj["permission"] : "",
|
|
2824
|
+
customArgs: typeof obj["custom_args"] === "object" && obj["custom_args"] !== null ? obj["custom_args"] : {}
|
|
2825
|
+
};
|
|
2826
|
+
case FlowEventId.ObserverDidInitiatePurchase: return {
|
|
2827
|
+
id: eventId,
|
|
2828
|
+
view,
|
|
2829
|
+
eventId: typeof obj["event_id"] === "string" ? obj["event_id"] : "",
|
|
2830
|
+
product: getFlowCoder(factory, "product", ctx).decode(obj["product"])
|
|
2831
|
+
};
|
|
2832
|
+
case FlowEventId.ObserverDidInitiateRestore: return {
|
|
2833
|
+
id: eventId,
|
|
2834
|
+
view,
|
|
2835
|
+
eventId: typeof obj["event_id"] === "string" ? obj["event_id"] : ""
|
|
2836
|
+
};
|
|
2776
2837
|
default: return null;
|
|
2777
2838
|
}
|
|
2778
2839
|
}
|
|
2779
|
-
function
|
|
2840
|
+
function parseFlowUserAction(actionObj) {
|
|
2780
2841
|
const type = actionObj["type"];
|
|
2781
2842
|
switch (type) {
|
|
2782
2843
|
case "open_url": return {
|
|
@@ -2792,7 +2853,7 @@ function parsePaywallUserAction(actionObj) {
|
|
|
2792
2853
|
case "system_back": return { type };
|
|
2793
2854
|
}
|
|
2794
2855
|
}
|
|
2795
|
-
function
|
|
2856
|
+
function getFlowCoder(factory, type, _ctx) {
|
|
2796
2857
|
switch (type) {
|
|
2797
2858
|
case "product": return factory.createPaywallProductCoder();
|
|
2798
2859
|
case "profile": return factory.createProfileCoder();
|
|
@@ -3005,6 +3066,7 @@ exports.DefaultSdkMetadataAdapter = DefaultSdkMetadataAdapter
|
|
|
3005
3066
|
exports.ErrorCode = ErrorCode
|
|
3006
3067
|
exports.ErrorCodeName = ErrorCodeName
|
|
3007
3068
|
exports.FetchPolicy = FetchPolicy
|
|
3069
|
+
exports.FlowEventId = FlowEventId
|
|
3008
3070
|
exports.Gender = Gender
|
|
3009
3071
|
exports.HANDLER_TO_EVENT_CONFIG = HANDLER_TO_EVENT_CONFIG
|
|
3010
3072
|
exports.HANDLER_TO_NATIVE_EVENT = HANDLER_TO_NATIVE_EVENT
|
|
@@ -3018,14 +3080,13 @@ exports.NATIVE_EVENT_TO_HANDLERS = NATIVE_EVENT_TO_HANDLERS
|
|
|
3018
3080
|
exports.ONBOARDING_EVENT_MAPPINGS = ONBOARDING_EVENT_MAPPINGS
|
|
3019
3081
|
exports.OfferType = OfferType
|
|
3020
3082
|
exports.OnboardingEventId = OnboardingEventId
|
|
3021
|
-
exports.PaywallEventId = PaywallEventId
|
|
3022
3083
|
exports.ProductPeriod = ProductPeriod
|
|
3023
3084
|
exports.RefundPreference = RefundPreference
|
|
3024
3085
|
exports.VendorStore = VendorStore
|
|
3025
3086
|
exports.WebPresentation = WebPresentation
|
|
3026
3087
|
exports.consoleLogSink = consoleLogSink
|
|
3088
|
+
exports.extractFlowCallbackArgs = extractFlowCallbackArgs
|
|
3027
3089
|
exports.extractOnboardingCallbackArgs = extractOnboardingCallbackArgs
|
|
3028
|
-
exports.extractPaywallCallbackArgs = extractPaywallCallbackArgs
|
|
3029
3090
|
exports.filterUndefined = filterUndefined
|
|
3030
3091
|
exports.generateId = generateId
|
|
3031
3092
|
exports.getErrorCode = getErrorCode
|
|
@@ -3033,7 +3094,7 @@ exports.getErrorPrompt = getErrorPrompt
|
|
|
3033
3094
|
exports.mapValues = mapValues
|
|
3034
3095
|
exports.mergeOptions = mergeOptions
|
|
3035
3096
|
exports.parseCommonEvent = parseCommonEvent
|
|
3097
|
+
exports.parseFlowEvent = parseFlowEvent
|
|
3036
3098
|
exports.parseMethodResult = parseMethodResult
|
|
3037
3099
|
exports.parseOnboardingEvent = parseOnboardingEvent
|
|
3038
|
-
exports.parsePaywallEvent = parsePaywallEvent
|
|
3039
3100
|
exports.withErrorContext = withErrorContext
|