@adapty/core 4.0.2 → 4.1.0-dev.51f7b5e66af39a9a82a499d0a75bedc5b5c796f5
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 +136 -6
- package/dist/index.d.cts +262 -71
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +262 -71
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +136 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -710,6 +710,7 @@ var AdaptyConfigurationCoder = class {
|
|
|
710
710
|
if (params.customerUserId) config["customer_user_id"] = params.customerUserId;
|
|
711
711
|
config["observer_mode"] = params.observerMode ?? false;
|
|
712
712
|
config["ip_address_collection_disabled"] = params.ipAddressCollectionDisabled ?? false;
|
|
713
|
+
config["adapty_attribution_enabled"] = params.adaptyAttributionEnabled ?? false;
|
|
713
714
|
if (params.logLevel) config["log_level"] = params.logLevel;
|
|
714
715
|
config["server_cluster"] = params.serverCluster ?? "default";
|
|
715
716
|
if (params.backendProxyHost) config["backend_proxy_host"] = params.backendProxyHost;
|
|
@@ -1001,6 +1002,57 @@ var AdaptyFlowPaywallCoder = class extends Coder {
|
|
|
1001
1002
|
}
|
|
1002
1003
|
};
|
|
1003
1004
|
|
|
1005
|
+
//#endregion
|
|
1006
|
+
//#region src/coders/adapty-flow-ui-schema.ts
|
|
1007
|
+
function decodeLayout(json) {
|
|
1008
|
+
return { flowLayoutId: json.flow_layout_id };
|
|
1009
|
+
}
|
|
1010
|
+
function encodeLayout(model) {
|
|
1011
|
+
return { flow_layout_id: model.flowLayoutId };
|
|
1012
|
+
}
|
|
1013
|
+
function decodeGrid(json) {
|
|
1014
|
+
return {
|
|
1015
|
+
...json.platforms !== void 0 && { platforms: json.platforms },
|
|
1016
|
+
...json.devices !== void 0 && { devices: json.devices },
|
|
1017
|
+
...json.custom_id !== void 0 && { customId: json.custom_id },
|
|
1018
|
+
...json.h_breakpoints !== void 0 && { hBreakpoints: json.h_breakpoints },
|
|
1019
|
+
...json.v_breakpoints !== void 0 && { vBreakpoints: json.v_breakpoints },
|
|
1020
|
+
cells: json.cells
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
function encodeGrid(model) {
|
|
1024
|
+
return {
|
|
1025
|
+
...model.platforms !== void 0 && { platforms: model.platforms },
|
|
1026
|
+
...model.devices !== void 0 && { devices: model.devices },
|
|
1027
|
+
...model.customId !== void 0 && { custom_id: model.customId },
|
|
1028
|
+
...model.hBreakpoints !== void 0 && { h_breakpoints: model.hBreakpoints },
|
|
1029
|
+
...model.vBreakpoints !== void 0 && { v_breakpoints: model.vBreakpoints },
|
|
1030
|
+
cells: model.cells
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* `ui_schema` is written by hand rather than declared through `Properties`,
|
|
1035
|
+
* because `platforms` and `devices` are unions of an `'all'` literal and an
|
|
1036
|
+
* array, and `PropertyMeta` can only carry a single runtime type per property.
|
|
1037
|
+
*
|
|
1038
|
+
* The flow is passed back to the native side (e.g. `adapty_ui_create_flow_view`),
|
|
1039
|
+
* so this schema has to survive a decode/encode round trip unchanged.
|
|
1040
|
+
*/
|
|
1041
|
+
var AdaptyFlowUiSchemaCoder = class {
|
|
1042
|
+
decode(json) {
|
|
1043
|
+
return {
|
|
1044
|
+
layouts: json.layouts.map(decodeLayout),
|
|
1045
|
+
grids: json.grids.map(decodeGrid)
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
encode(model) {
|
|
1049
|
+
return {
|
|
1050
|
+
layouts: model.layouts.map(encodeLayout),
|
|
1051
|
+
grids: model.grids.map(encodeGrid)
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1004
1056
|
//#endregion
|
|
1005
1057
|
//#region src/coders/json.ts
|
|
1006
1058
|
var JSONCoder = class {
|
|
@@ -1091,6 +1143,12 @@ var AdaptyFlowCoder = class extends SimpleCoder {
|
|
|
1091
1143
|
type: "array",
|
|
1092
1144
|
converter: new ArrayCoder(() => new AdaptyFlowPaywallCoder())
|
|
1093
1145
|
},
|
|
1146
|
+
uiSchema: {
|
|
1147
|
+
key: "ui_schema",
|
|
1148
|
+
required: false,
|
|
1149
|
+
type: "object",
|
|
1150
|
+
converter: new AdaptyFlowUiSchemaCoder()
|
|
1151
|
+
},
|
|
1094
1152
|
responseCreatedAt: {
|
|
1095
1153
|
key: "response_created_at",
|
|
1096
1154
|
required: true,
|
|
@@ -1548,12 +1606,71 @@ var AdaptyPaywallProductCoder = class extends SimpleCoder {
|
|
|
1548
1606
|
payload_data: data.payload_data,
|
|
1549
1607
|
paywall_name: data.paywall_name,
|
|
1550
1608
|
paywall_variation_id: data.paywall_variation_id,
|
|
1551
|
-
|
|
1609
|
+
subscription: data.subscription?.offer ? { offer: { offer_identifier: data.subscription.offer.offer_identifier } } : void 0,
|
|
1552
1610
|
vendor_product_id: data.vendor_product_id
|
|
1553
1611
|
};
|
|
1554
1612
|
}
|
|
1555
1613
|
};
|
|
1556
1614
|
|
|
1615
|
+
//#endregion
|
|
1616
|
+
//#region src/coders/adapty-promoted-product.ts
|
|
1617
|
+
var AdaptyPromotedProductCoder = class extends SimpleCoder {
|
|
1618
|
+
constructor(..._args) {
|
|
1619
|
+
super(..._args);
|
|
1620
|
+
this.properties = {
|
|
1621
|
+
vendorProductId: {
|
|
1622
|
+
key: "vendor_product_id",
|
|
1623
|
+
required: true,
|
|
1624
|
+
type: "string"
|
|
1625
|
+
},
|
|
1626
|
+
localizedDescription: {
|
|
1627
|
+
key: "localized_description",
|
|
1628
|
+
required: true,
|
|
1629
|
+
type: "string"
|
|
1630
|
+
},
|
|
1631
|
+
localizedTitle: {
|
|
1632
|
+
key: "localized_title",
|
|
1633
|
+
required: true,
|
|
1634
|
+
type: "string"
|
|
1635
|
+
},
|
|
1636
|
+
regionCode: {
|
|
1637
|
+
key: "region_code",
|
|
1638
|
+
required: false,
|
|
1639
|
+
type: "string"
|
|
1640
|
+
},
|
|
1641
|
+
price: {
|
|
1642
|
+
key: "price",
|
|
1643
|
+
required: false,
|
|
1644
|
+
type: "object",
|
|
1645
|
+
converter: new AdaptyPriceCoder()
|
|
1646
|
+
},
|
|
1647
|
+
payloadData: {
|
|
1648
|
+
key: "payload_data",
|
|
1649
|
+
required: false,
|
|
1650
|
+
type: "string"
|
|
1651
|
+
},
|
|
1652
|
+
subscription: {
|
|
1653
|
+
key: "subscription",
|
|
1654
|
+
required: false,
|
|
1655
|
+
type: "object",
|
|
1656
|
+
converter: new AdaptySubscriptionDetailsCoder()
|
|
1657
|
+
},
|
|
1658
|
+
ios: { isFamilyShareable: {
|
|
1659
|
+
key: "is_family_shareable",
|
|
1660
|
+
required: true,
|
|
1661
|
+
type: "boolean"
|
|
1662
|
+
} }
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
getInput(data) {
|
|
1666
|
+
return {
|
|
1667
|
+
vendor_product_id: data.vendor_product_id,
|
|
1668
|
+
payload_data: data.payload_data,
|
|
1669
|
+
subscription: data.subscription?.offer ? { offer: { offer_identifier: data.subscription.offer.offer_identifier } } : void 0
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
|
|
1557
1674
|
//#endregion
|
|
1558
1675
|
//#region src/coders/adapty-profile-parameters.ts
|
|
1559
1676
|
var AdaptyProfileParametersCoder = class extends SimpleCoder {
|
|
@@ -1947,6 +2064,7 @@ var AdaptyUICreateFlowViewParamsCoder = class {
|
|
|
1947
2064
|
encode(data) {
|
|
1948
2065
|
const result = {};
|
|
1949
2066
|
if (data.locale !== void 0) result.locale = data.locale;
|
|
2067
|
+
if (data.customLayoutId !== void 0) result.custom_layout_id = data.customLayoutId;
|
|
1950
2068
|
if (data.prefetchProducts !== void 0) result.preload_products = data.prefetchProducts;
|
|
1951
2069
|
if (data.android?.enableSafeArea !== void 0) result.enable_safe_area_paddings = data.android.enableSafeArea;
|
|
1952
2070
|
if (data.loadTimeoutMs !== void 0) result.load_timeout = data.loadTimeoutMs / 1e3;
|
|
@@ -2289,6 +2407,9 @@ var CoderFactory = class {
|
|
|
2289
2407
|
createFlowPaywallCoder() {
|
|
2290
2408
|
return new AdaptyFlowPaywallCoder(this.deps.platform);
|
|
2291
2409
|
}
|
|
2410
|
+
createFlowUiSchemaCoder() {
|
|
2411
|
+
return new AdaptyFlowUiSchemaCoder();
|
|
2412
|
+
}
|
|
2292
2413
|
createPaywallProductCoder() {
|
|
2293
2414
|
return new AdaptyPaywallProductCoder(this.deps.platform);
|
|
2294
2415
|
}
|
|
@@ -2307,6 +2428,9 @@ var CoderFactory = class {
|
|
|
2307
2428
|
createProfileParametersCoder() {
|
|
2308
2429
|
return new AdaptyProfileParametersCoder(this.deps.platform);
|
|
2309
2430
|
}
|
|
2431
|
+
createPromotedProductCoder() {
|
|
2432
|
+
return new AdaptyPromotedProductCoder(this.deps.platform);
|
|
2433
|
+
}
|
|
2310
2434
|
createRemoteConfigCoder() {
|
|
2311
2435
|
return new AdaptyRemoteConfigCoder(this.deps.platform);
|
|
2312
2436
|
}
|
|
@@ -2411,14 +2535,15 @@ const RefundPreference = Object.freeze({
|
|
|
2411
2535
|
//#endregion
|
|
2412
2536
|
//#region src/types/bridge.ts
|
|
2413
2537
|
/**
|
|
2414
|
-
* Valid list of callable bridge handlers
|
|
2415
|
-
*
|
|
2416
|
-
*
|
|
2538
|
+
* Valid list of callable bridge handlers.
|
|
2539
|
+
*
|
|
2540
|
+
* The source of truth is `cross_platform.yaml`: one entry per `$requests`
|
|
2541
|
+
* method const. `bridge.test.ts` asserts the two stay in sync — a method the
|
|
2542
|
+
* native side does not register would fail at runtime, not at compile time.
|
|
2417
2543
|
* @internal
|
|
2418
2544
|
*/
|
|
2419
2545
|
const MethodNames = [
|
|
2420
2546
|
"activate",
|
|
2421
|
-
"adapty_ui_activate",
|
|
2422
2547
|
"adapty_ui_create_flow_view",
|
|
2423
2548
|
"adapty_ui_dismiss_flow_view",
|
|
2424
2549
|
"adapty_ui_present_flow_view",
|
|
@@ -2435,9 +2560,12 @@ const MethodNames = [
|
|
|
2435
2560
|
"get_onboarding",
|
|
2436
2561
|
"get_onboarding_for_default_audience",
|
|
2437
2562
|
"get_profile",
|
|
2563
|
+
"get_log_level",
|
|
2564
|
+
"get_sdk_version",
|
|
2438
2565
|
"identify",
|
|
2439
2566
|
"log_show_flow",
|
|
2440
2567
|
"logout",
|
|
2568
|
+
"make_promoted_purchase",
|
|
2441
2569
|
"make_purchase",
|
|
2442
2570
|
"open_web_paywall",
|
|
2443
2571
|
"present_code_redemption_sheet",
|
|
@@ -2446,8 +2574,8 @@ const MethodNames = [
|
|
|
2446
2574
|
"set_fallback",
|
|
2447
2575
|
"set_integration_identifiers",
|
|
2448
2576
|
"set_log_level",
|
|
2449
|
-
"update_attribution_data",
|
|
2450
2577
|
"update_collecting_refund_data_consent",
|
|
2578
|
+
"update_external_attribution_data",
|
|
2451
2579
|
"update_profile",
|
|
2452
2580
|
"update_refund_preference",
|
|
2453
2581
|
"flow_view_did_answer_permission",
|
|
@@ -2671,6 +2799,7 @@ function parseCommonEvent(factory, event, input, ctx) {
|
|
|
2671
2799
|
}
|
|
2672
2800
|
switch (event) {
|
|
2673
2801
|
case "did_load_latest_profile": return getCoder(factory, "AdaptyProfile", ctx)?.decode(obj["profile"]);
|
|
2802
|
+
case "did_receive_promoted_purchase": return getCoder(factory, "AdaptyPromotedProduct", ctx)?.decode(obj["product"]);
|
|
2674
2803
|
case "on_installation_details_success": return getCoder(factory, "AdaptyInstallationDetails", ctx)?.decode(obj["details"]);
|
|
2675
2804
|
case "on_installation_details_fail": return getCoder(factory, "AdaptyError", ctx)?.decode(obj["error"]);
|
|
2676
2805
|
default: return null;
|
|
@@ -2683,6 +2812,7 @@ function getCoder(factory, type, ctx) {
|
|
|
2683
2812
|
case "AdaptyProfile": return factory.createProfileCoder();
|
|
2684
2813
|
case "AdaptyFlow": return factory.createFlowCoder();
|
|
2685
2814
|
case "AdaptyPaywallProduct": return factory.createPaywallProductCoder();
|
|
2815
|
+
case "AdaptyPromotedProduct": return factory.createPromotedProductCoder();
|
|
2686
2816
|
case "AdaptyRemoteConfig": return factory.createRemoteConfigCoder();
|
|
2687
2817
|
case "AdaptyOnboarding": return factory.createOnboardingCoder();
|
|
2688
2818
|
case "AdaptyPurchaseResult": return factory.createPurchaseResultCoder();
|