@adapty/core 4.0.0-dev.be3bfb2d97c35a578f09706e179187ebdb312943 → 4.0.0
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 +450 -384
- package/dist/index.d.cts +592 -372
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +592 -372
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +448 -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 {
|
|
@@ -1746,6 +1762,11 @@ var AdaptyProfileCoder = class extends SimpleCoder {
|
|
|
1746
1762
|
type: "object",
|
|
1747
1763
|
converter: new HashmapCoder(new AdaptyAccessLevelCoder())
|
|
1748
1764
|
},
|
|
1765
|
+
appliedAttributionSources: {
|
|
1766
|
+
key: "applied_attribution_sources",
|
|
1767
|
+
required: false,
|
|
1768
|
+
type: "array"
|
|
1769
|
+
},
|
|
1749
1770
|
customAttributes: {
|
|
1750
1771
|
key: "custom_attributes",
|
|
1751
1772
|
required: false,
|
|
@@ -1779,9 +1800,6 @@ var AdaptyProfileCoder = class extends SimpleCoder {
|
|
|
1779
1800
|
|
|
1780
1801
|
//#endregion
|
|
1781
1802
|
//#region src/coders/adapty-purchase-params.ts
|
|
1782
|
-
function isDeprecatedType(data) {
|
|
1783
|
-
return typeof data === "object" && data !== null && "android" in data && typeof data.android === "object" && data.android !== null && "oldSubVendorProductId" in data.android && "prorationMode" in data.android;
|
|
1784
|
-
}
|
|
1785
1803
|
var AdaptyPurchaseParamsCoder = class {
|
|
1786
1804
|
constructor(platform) {
|
|
1787
1805
|
this.platform = platform;
|
|
@@ -1789,16 +1807,6 @@ var AdaptyPurchaseParamsCoder = class {
|
|
|
1789
1807
|
encode(data) {
|
|
1790
1808
|
if (this.platform.OS !== "android") return {};
|
|
1791
1809
|
const purchaseParams = {};
|
|
1792
|
-
if (isDeprecatedType(data)) {
|
|
1793
|
-
if (data.android) {
|
|
1794
|
-
purchaseParams["subscription_update_params"] = {
|
|
1795
|
-
replacement_mode: data.android.prorationMode,
|
|
1796
|
-
old_sub_vendor_product_id: data.android.oldSubVendorProductId
|
|
1797
|
-
};
|
|
1798
|
-
if (data.android.isOfferPersonalized) purchaseParams["is_offer_personalized"] = data.android.isOfferPersonalized;
|
|
1799
|
-
}
|
|
1800
|
-
return purchaseParams;
|
|
1801
|
-
}
|
|
1802
1810
|
if (data.android) {
|
|
1803
1811
|
if (data.android.subscriptionUpdateParams) purchaseParams["subscription_update_params"] = {
|
|
1804
1812
|
replacement_mode: data.android.subscriptionUpdateParams.prorationMode,
|
|
@@ -1931,14 +1939,15 @@ const resolveAssetId = (asset, platformOS) => {
|
|
|
1931
1939
|
};
|
|
1932
1940
|
|
|
1933
1941
|
//#endregion
|
|
1934
|
-
//#region src/coders/adapty-ui-create-
|
|
1935
|
-
var
|
|
1942
|
+
//#region src/coders/adapty-ui-create-flow-view-params.ts
|
|
1943
|
+
var AdaptyUICreateFlowViewParamsCoder = class {
|
|
1936
1944
|
constructor(platform) {
|
|
1937
1945
|
this.platform = platform;
|
|
1938
1946
|
}
|
|
1939
1947
|
encode(data) {
|
|
1940
1948
|
const result = {};
|
|
1941
1949
|
if (data.prefetchProducts !== void 0) result.preload_products = data.prefetchProducts;
|
|
1950
|
+
if (data.android?.enableSafeArea !== void 0) result.enable_safe_area_paddings = data.android.enableSafeArea;
|
|
1942
1951
|
if (data.loadTimeoutMs !== void 0) result.load_timeout = data.loadTimeoutMs / 1e3;
|
|
1943
1952
|
if (data.customTags) result.custom_tags = data.customTags;
|
|
1944
1953
|
if (data.customTimers) result.custom_timers = this.encodeCustomTimers(data.customTimers);
|
|
@@ -2273,11 +2282,11 @@ var CoderFactory = class {
|
|
|
2273
2282
|
createOnboardingCoder() {
|
|
2274
2283
|
return new AdaptyOnboardingCoder(this.deps.platform);
|
|
2275
2284
|
}
|
|
2276
|
-
|
|
2277
|
-
return new
|
|
2285
|
+
createFlowCoder() {
|
|
2286
|
+
return new AdaptyFlowCoder(this.deps.platform);
|
|
2278
2287
|
}
|
|
2279
|
-
|
|
2280
|
-
return new
|
|
2288
|
+
createFlowPaywallCoder() {
|
|
2289
|
+
return new AdaptyFlowPaywallCoder(this.deps.platform);
|
|
2281
2290
|
}
|
|
2282
2291
|
createPaywallProductCoder() {
|
|
2283
2292
|
return new AdaptyPaywallProductCoder(this.deps.platform);
|
|
@@ -2318,8 +2327,8 @@ var CoderFactory = class {
|
|
|
2318
2327
|
createUiCreateOnboardingViewParamsCoder() {
|
|
2319
2328
|
return new AdaptyUICreateOnboardingViewParamsCoder();
|
|
2320
2329
|
}
|
|
2321
|
-
|
|
2322
|
-
return new
|
|
2330
|
+
createUiCreateFlowViewParamsCoder() {
|
|
2331
|
+
return new AdaptyUICreateFlowViewParamsCoder(this.deps.platform);
|
|
2323
2332
|
}
|
|
2324
2333
|
createUiDialogConfigCoder() {
|
|
2325
2334
|
return new AdaptyUiDialogConfigCoder(this.deps.platform);
|
|
@@ -2409,9 +2418,9 @@ const RefundPreference = Object.freeze({
|
|
|
2409
2418
|
const MethodNames = [
|
|
2410
2419
|
"activate",
|
|
2411
2420
|
"adapty_ui_activate",
|
|
2412
|
-
"
|
|
2413
|
-
"
|
|
2414
|
-
"
|
|
2421
|
+
"adapty_ui_create_flow_view",
|
|
2422
|
+
"adapty_ui_dismiss_flow_view",
|
|
2423
|
+
"adapty_ui_present_flow_view",
|
|
2415
2424
|
"adapty_ui_show_dialog",
|
|
2416
2425
|
"adapty_ui_create_onboarding_view",
|
|
2417
2426
|
"adapty_ui_dismiss_onboarding_view",
|
|
@@ -2419,14 +2428,14 @@ const MethodNames = [
|
|
|
2419
2428
|
"create_web_paywall_url",
|
|
2420
2429
|
"get_current_installation_status",
|
|
2421
2430
|
"is_activated",
|
|
2422
|
-
"
|
|
2423
|
-
"
|
|
2431
|
+
"get_flow",
|
|
2432
|
+
"get_flow_for_default_audience",
|
|
2424
2433
|
"get_paywall_products",
|
|
2425
2434
|
"get_onboarding",
|
|
2426
2435
|
"get_onboarding_for_default_audience",
|
|
2427
2436
|
"get_profile",
|
|
2428
2437
|
"identify",
|
|
2429
|
-
"
|
|
2438
|
+
"log_show_flow",
|
|
2430
2439
|
"logout",
|
|
2431
2440
|
"make_purchase",
|
|
2432
2441
|
"open_web_paywall",
|
|
@@ -2439,25 +2448,37 @@ const MethodNames = [
|
|
|
2439
2448
|
"update_attribution_data",
|
|
2440
2449
|
"update_collecting_refund_data_consent",
|
|
2441
2450
|
"update_profile",
|
|
2442
|
-
"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"
|
|
2443
2459
|
];
|
|
2444
2460
|
|
|
2445
2461
|
//#endregion
|
|
2446
|
-
//#region src/types/
|
|
2447
|
-
const
|
|
2448
|
-
DidAppear: "
|
|
2449
|
-
DidDisappear: "
|
|
2450
|
-
DidPerformAction: "
|
|
2451
|
-
DidSelectProduct: "
|
|
2452
|
-
DidStartPurchase: "
|
|
2453
|
-
DidFinishPurchase: "
|
|
2454
|
-
DidFailPurchase: "
|
|
2455
|
-
DidStartRestore: "
|
|
2456
|
-
DidFinishRestore: "
|
|
2457
|
-
DidFailRestore: "
|
|
2458
|
-
|
|
2459
|
-
DidFailLoadingProducts: "
|
|
2460
|
-
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"
|
|
2461
2482
|
};
|
|
2462
2483
|
|
|
2463
2484
|
//#endregion
|
|
@@ -2473,13 +2494,13 @@ const OnboardingEventId = {
|
|
|
2473
2494
|
};
|
|
2474
2495
|
|
|
2475
2496
|
//#endregion
|
|
2476
|
-
//#region src/ui-builder/
|
|
2497
|
+
//#region src/ui-builder/flow-event-mapping.ts
|
|
2477
2498
|
/**
|
|
2478
2499
|
* Resolves native event to handler name based on event data
|
|
2479
2500
|
*/
|
|
2480
2501
|
const NATIVE_EVENT_RESOLVER = {
|
|
2481
|
-
[
|
|
2482
|
-
if (event.id !==
|
|
2502
|
+
[FlowEventId.DidPerformAction]: (event) => {
|
|
2503
|
+
if (event.id !== FlowEventId.DidPerformAction) return null;
|
|
2483
2504
|
const actionMap = {
|
|
2484
2505
|
close: "onCloseButtonPress",
|
|
2485
2506
|
system_back: "onAndroidSystemBack",
|
|
@@ -2488,59 +2509,74 @@ const NATIVE_EVENT_RESOLVER = {
|
|
|
2488
2509
|
};
|
|
2489
2510
|
return actionMap[event.action.type] || null;
|
|
2490
2511
|
},
|
|
2491
|
-
[
|
|
2492
|
-
[
|
|
2493
|
-
[
|
|
2494
|
-
[
|
|
2495
|
-
[
|
|
2496
|
-
[
|
|
2497
|
-
[
|
|
2498
|
-
[
|
|
2499
|
-
[
|
|
2500
|
-
[
|
|
2501
|
-
[
|
|
2502
|
-
[
|
|
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"
|
|
2503
2529
|
};
|
|
2504
2530
|
/**
|
|
2505
2531
|
* Maps handler name to native event name
|
|
2506
2532
|
* Used in addListener/addInternalListener to subscribe to correct native event
|
|
2507
2533
|
*/
|
|
2508
2534
|
const HANDLER_TO_NATIVE_EVENT = {
|
|
2509
|
-
onCloseButtonPress:
|
|
2510
|
-
onAndroidSystemBack:
|
|
2511
|
-
onUrlPress:
|
|
2512
|
-
onCustomAction:
|
|
2513
|
-
onAppeared:
|
|
2514
|
-
onDisappeared:
|
|
2515
|
-
onProductSelected:
|
|
2516
|
-
onPurchaseStarted:
|
|
2517
|
-
onPurchaseCompleted:
|
|
2518
|
-
onPurchaseFailed:
|
|
2519
|
-
onRestoreStarted:
|
|
2520
|
-
onRestoreCompleted:
|
|
2521
|
-
onRestoreFailed:
|
|
2522
|
-
|
|
2523
|
-
onLoadingProductsFailed:
|
|
2524
|
-
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
|
|
2525
2556
|
};
|
|
2526
|
-
function
|
|
2557
|
+
function extractFlowCallbackArgs(handlerName, event) {
|
|
2527
2558
|
switch (event.id) {
|
|
2528
|
-
case
|
|
2529
|
-
case
|
|
2530
|
-
case
|
|
2531
|
-
case
|
|
2532
|
-
case
|
|
2533
|
-
case
|
|
2534
|
-
case
|
|
2535
|
-
case
|
|
2536
|
-
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:
|
|
2537
2568
|
if (handlerName === "onUrlPress" && event.action.type === "open_url") return [event.action.value, event.action.openIn];
|
|
2538
2569
|
if (handlerName === "onCustomAction" && event.action.type === "custom") return [event.action.value];
|
|
2539
2570
|
return [];
|
|
2540
|
-
case
|
|
2541
|
-
case
|
|
2542
|
-
case
|
|
2543
|
-
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 [];
|
|
2544
2580
|
}
|
|
2545
2581
|
}
|
|
2546
2582
|
|
|
@@ -2644,10 +2680,9 @@ function getCoder(factory, type, ctx) {
|
|
|
2644
2680
|
switch (type) {
|
|
2645
2681
|
case "AdaptyError": return factory.createNativeErrorCoder();
|
|
2646
2682
|
case "AdaptyProfile": return factory.createProfileCoder();
|
|
2647
|
-
case "
|
|
2683
|
+
case "AdaptyFlow": return factory.createFlowCoder();
|
|
2648
2684
|
case "AdaptyPaywallProduct": return factory.createPaywallProductCoder();
|
|
2649
2685
|
case "AdaptyRemoteConfig": return factory.createRemoteConfigCoder();
|
|
2650
|
-
case "AdaptyPaywallBuilder": return factory.createPaywallBuilderCoder();
|
|
2651
2686
|
case "AdaptyOnboarding": return factory.createOnboardingCoder();
|
|
2652
2687
|
case "AdaptyPurchaseResult": return factory.createPurchaseResultCoder();
|
|
2653
2688
|
case "AdaptyInstallationStatus": return factory.createInstallationStatusCoder();
|
|
@@ -2663,8 +2698,8 @@ function getCoder(factory, type, ctx) {
|
|
|
2663
2698
|
}
|
|
2664
2699
|
|
|
2665
2700
|
//#endregion
|
|
2666
|
-
//#region src/coders/parse-
|
|
2667
|
-
function
|
|
2701
|
+
//#region src/coders/parse-flow.ts
|
|
2702
|
+
function parseFlowEvent(factory, input, ctx) {
|
|
2668
2703
|
let obj;
|
|
2669
2704
|
try {
|
|
2670
2705
|
obj = JSON.parse(input);
|
|
@@ -2672,7 +2707,7 @@ function parsePaywallEvent(factory, input, ctx) {
|
|
|
2672
2707
|
throw AdaptyError.failedToDecode(`Failed to decode event: ${error?.message}`);
|
|
2673
2708
|
}
|
|
2674
2709
|
const eventId = obj["id"];
|
|
2675
|
-
if (!eventId?.startsWith("
|
|
2710
|
+
if (!eventId?.startsWith("flow_view_")) return null;
|
|
2676
2711
|
const viewObj = obj["view"];
|
|
2677
2712
|
const view = {
|
|
2678
2713
|
id: viewObj["id"],
|
|
@@ -2680,59 +2715,59 @@ function parsePaywallEvent(factory, input, ctx) {
|
|
|
2680
2715
|
variationId: viewObj["variation_id"]
|
|
2681
2716
|
};
|
|
2682
2717
|
switch (eventId) {
|
|
2683
|
-
case
|
|
2718
|
+
case FlowEventId.DidAppear: return {
|
|
2684
2719
|
id: eventId,
|
|
2685
2720
|
view
|
|
2686
2721
|
};
|
|
2687
|
-
case
|
|
2722
|
+
case FlowEventId.DidDisappear: return {
|
|
2688
2723
|
id: eventId,
|
|
2689
2724
|
view
|
|
2690
2725
|
};
|
|
2691
|
-
case
|
|
2726
|
+
case FlowEventId.DidPerformAction: {
|
|
2692
2727
|
const actionObj = obj["action"];
|
|
2693
2728
|
return {
|
|
2694
2729
|
id: eventId,
|
|
2695
2730
|
view,
|
|
2696
|
-
action:
|
|
2731
|
+
action: parseFlowUserAction(actionObj)
|
|
2697
2732
|
};
|
|
2698
2733
|
}
|
|
2699
|
-
case
|
|
2734
|
+
case FlowEventId.DidSelectProduct: return {
|
|
2700
2735
|
id: eventId,
|
|
2701
2736
|
view,
|
|
2702
2737
|
productId: obj["product_id"] ?? ""
|
|
2703
2738
|
};
|
|
2704
|
-
case
|
|
2739
|
+
case FlowEventId.DidStartPurchase: return {
|
|
2705
2740
|
id: eventId,
|
|
2706
2741
|
view,
|
|
2707
|
-
product:
|
|
2742
|
+
product: getFlowCoder(factory, "product", ctx).decode(obj["product"])
|
|
2708
2743
|
};
|
|
2709
|
-
case
|
|
2744
|
+
case FlowEventId.DidFinishPurchase: return {
|
|
2710
2745
|
id: eventId,
|
|
2711
2746
|
view,
|
|
2712
|
-
purchaseResult:
|
|
2713
|
-
product:
|
|
2747
|
+
purchaseResult: getFlowCoder(factory, "purchaseResult", ctx).decode(obj["purchased_result"]),
|
|
2748
|
+
product: getFlowCoder(factory, "product", ctx).decode(obj["product"])
|
|
2714
2749
|
};
|
|
2715
|
-
case
|
|
2716
|
-
const errorCoder =
|
|
2750
|
+
case FlowEventId.DidFailPurchase: {
|
|
2751
|
+
const errorCoder = getFlowCoder(factory, "error", ctx);
|
|
2717
2752
|
const decodedError = errorCoder.decode(obj["error"]);
|
|
2718
2753
|
return {
|
|
2719
2754
|
id: eventId,
|
|
2720
2755
|
view,
|
|
2721
2756
|
error: errorCoder.getError(decodedError),
|
|
2722
|
-
product:
|
|
2757
|
+
product: getFlowCoder(factory, "product", ctx).decode(obj["product"])
|
|
2723
2758
|
};
|
|
2724
2759
|
}
|
|
2725
|
-
case
|
|
2760
|
+
case FlowEventId.DidStartRestore: return {
|
|
2726
2761
|
id: eventId,
|
|
2727
2762
|
view
|
|
2728
2763
|
};
|
|
2729
|
-
case
|
|
2764
|
+
case FlowEventId.DidFinishRestore: return {
|
|
2730
2765
|
id: eventId,
|
|
2731
2766
|
view,
|
|
2732
|
-
profile:
|
|
2767
|
+
profile: getFlowCoder(factory, "profile", ctx).decode(obj["profile"])
|
|
2733
2768
|
};
|
|
2734
|
-
case
|
|
2735
|
-
const errorCoder =
|
|
2769
|
+
case FlowEventId.DidFailRestore: {
|
|
2770
|
+
const errorCoder = getFlowCoder(factory, "error", ctx);
|
|
2736
2771
|
const decodedError = errorCoder.decode(obj["error"]);
|
|
2737
2772
|
return {
|
|
2738
2773
|
id: eventId,
|
|
@@ -2740,8 +2775,8 @@ function parsePaywallEvent(factory, input, ctx) {
|
|
|
2740
2775
|
error: errorCoder.getError(decodedError)
|
|
2741
2776
|
};
|
|
2742
2777
|
}
|
|
2743
|
-
case
|
|
2744
|
-
const errorCoder =
|
|
2778
|
+
case FlowEventId.DidReceiveError: {
|
|
2779
|
+
const errorCoder = getFlowCoder(factory, "error", ctx);
|
|
2745
2780
|
const decodedError = errorCoder.decode(obj["error"]);
|
|
2746
2781
|
return {
|
|
2747
2782
|
id: eventId,
|
|
@@ -2749,8 +2784,8 @@ function parsePaywallEvent(factory, input, ctx) {
|
|
|
2749
2784
|
error: errorCoder.getError(decodedError)
|
|
2750
2785
|
};
|
|
2751
2786
|
}
|
|
2752
|
-
case
|
|
2753
|
-
const errorCoder =
|
|
2787
|
+
case FlowEventId.DidFailLoadingProducts: {
|
|
2788
|
+
const errorCoder = getFlowCoder(factory, "error", ctx);
|
|
2754
2789
|
const decodedError = errorCoder.decode(obj["error"]);
|
|
2755
2790
|
return {
|
|
2756
2791
|
id: eventId,
|
|
@@ -2758,20 +2793,51 @@ function parsePaywallEvent(factory, input, ctx) {
|
|
|
2758
2793
|
error: errorCoder.getError(decodedError)
|
|
2759
2794
|
};
|
|
2760
2795
|
}
|
|
2761
|
-
case
|
|
2796
|
+
case FlowEventId.DidFinishWebPaymentNavigation: return {
|
|
2762
2797
|
id: eventId,
|
|
2763
2798
|
view,
|
|
2764
|
-
product: obj["product"] ?
|
|
2799
|
+
product: obj["product"] ? getFlowCoder(factory, "product", ctx).decode(obj["product"]) : void 0,
|
|
2765
2800
|
error: obj["error"] ? (() => {
|
|
2766
|
-
const errorCoder =
|
|
2801
|
+
const errorCoder = getFlowCoder(factory, "error", ctx);
|
|
2767
2802
|
const decodedError = errorCoder.decode(obj["error"]);
|
|
2768
2803
|
return errorCoder.getError(decodedError);
|
|
2769
2804
|
})() : void 0
|
|
2770
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
|
+
};
|
|
2771
2837
|
default: return null;
|
|
2772
2838
|
}
|
|
2773
2839
|
}
|
|
2774
|
-
function
|
|
2840
|
+
function parseFlowUserAction(actionObj) {
|
|
2775
2841
|
const type = actionObj["type"];
|
|
2776
2842
|
switch (type) {
|
|
2777
2843
|
case "open_url": return {
|
|
@@ -2787,7 +2853,7 @@ function parsePaywallUserAction(actionObj) {
|
|
|
2787
2853
|
case "system_back": return { type };
|
|
2788
2854
|
}
|
|
2789
2855
|
}
|
|
2790
|
-
function
|
|
2856
|
+
function getFlowCoder(factory, type, _ctx) {
|
|
2791
2857
|
switch (type) {
|
|
2792
2858
|
case "product": return factory.createPaywallProductCoder();
|
|
2793
2859
|
case "profile": return factory.createProfileCoder();
|
|
@@ -3000,6 +3066,7 @@ exports.DefaultSdkMetadataAdapter = DefaultSdkMetadataAdapter
|
|
|
3000
3066
|
exports.ErrorCode = ErrorCode
|
|
3001
3067
|
exports.ErrorCodeName = ErrorCodeName
|
|
3002
3068
|
exports.FetchPolicy = FetchPolicy
|
|
3069
|
+
exports.FlowEventId = FlowEventId
|
|
3003
3070
|
exports.Gender = Gender
|
|
3004
3071
|
exports.HANDLER_TO_EVENT_CONFIG = HANDLER_TO_EVENT_CONFIG
|
|
3005
3072
|
exports.HANDLER_TO_NATIVE_EVENT = HANDLER_TO_NATIVE_EVENT
|
|
@@ -3013,14 +3080,13 @@ exports.NATIVE_EVENT_TO_HANDLERS = NATIVE_EVENT_TO_HANDLERS
|
|
|
3013
3080
|
exports.ONBOARDING_EVENT_MAPPINGS = ONBOARDING_EVENT_MAPPINGS
|
|
3014
3081
|
exports.OfferType = OfferType
|
|
3015
3082
|
exports.OnboardingEventId = OnboardingEventId
|
|
3016
|
-
exports.PaywallEventId = PaywallEventId
|
|
3017
3083
|
exports.ProductPeriod = ProductPeriod
|
|
3018
3084
|
exports.RefundPreference = RefundPreference
|
|
3019
3085
|
exports.VendorStore = VendorStore
|
|
3020
3086
|
exports.WebPresentation = WebPresentation
|
|
3021
3087
|
exports.consoleLogSink = consoleLogSink
|
|
3088
|
+
exports.extractFlowCallbackArgs = extractFlowCallbackArgs
|
|
3022
3089
|
exports.extractOnboardingCallbackArgs = extractOnboardingCallbackArgs
|
|
3023
|
-
exports.extractPaywallCallbackArgs = extractPaywallCallbackArgs
|
|
3024
3090
|
exports.filterUndefined = filterUndefined
|
|
3025
3091
|
exports.generateId = generateId
|
|
3026
3092
|
exports.getErrorCode = getErrorCode
|
|
@@ -3028,7 +3094,7 @@ exports.getErrorPrompt = getErrorPrompt
|
|
|
3028
3094
|
exports.mapValues = mapValues
|
|
3029
3095
|
exports.mergeOptions = mergeOptions
|
|
3030
3096
|
exports.parseCommonEvent = parseCommonEvent
|
|
3097
|
+
exports.parseFlowEvent = parseFlowEvent
|
|
3031
3098
|
exports.parseMethodResult = parseMethodResult
|
|
3032
3099
|
exports.parseOnboardingEvent = parseOnboardingEvent
|
|
3033
|
-
exports.parsePaywallEvent = parsePaywallEvent
|
|
3034
3100
|
exports.withErrorContext = withErrorContext
|