@appfunnel-dev/sdk 2.0.0-canary.8 → 2.0.0-canary.9
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/{capabilities-CsnkVwna.d.cts → capabilities-Dq22RCr_.d.cts} +34 -1
- package/dist/{capabilities-CsnkVwna.d.ts → capabilities-Dq22RCr_.d.ts} +34 -1
- package/dist/{checkout-3PkKwPd7.d.ts → checkout-ClaO5IYV.d.ts} +17 -4
- package/dist/{checkout-Cg20l53c.d.cts → checkout-DBp4bCpC.d.cts} +17 -4
- package/dist/{chunk-RY3LOSVZ.cjs → chunk-7JLOF6CJ.cjs} +27 -5
- package/dist/chunk-7JLOF6CJ.cjs.map +1 -0
- package/dist/{chunk-PWXMQGO6.js → chunk-JAO6AA4R.js} +3 -3
- package/dist/{chunk-PWXMQGO6.js.map → chunk-JAO6AA4R.js.map} +1 -1
- package/dist/{chunk-RVJLR4RS.js → chunk-OXQBEKZ5.js} +25 -6
- package/dist/chunk-OXQBEKZ5.js.map +1 -0
- package/dist/{chunk-FY3TMSRU.cjs → chunk-VV7TFC64.cjs} +7 -7
- package/dist/{chunk-FY3TMSRU.cjs.map → chunk-VV7TFC64.cjs.map} +1 -1
- package/dist/driver-paddle.cjs +26 -24
- package/dist/driver-paddle.cjs.map +1 -1
- package/dist/driver-paddle.d.cts +2 -2
- package/dist/driver-paddle.d.ts +2 -2
- package/dist/driver-paddle.js +6 -4
- package/dist/driver-paddle.js.map +1 -1
- package/dist/driver-stripe.cjs +32 -26
- package/dist/driver-stripe.cjs.map +1 -1
- package/dist/driver-stripe.d.cts +2 -2
- package/dist/driver-stripe.d.ts +2 -2
- package/dist/driver-stripe.js +10 -4
- package/dist/driver-stripe.js.map +1 -1
- package/dist/index.cjs +48 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/manifest-entry.cjs +24 -12
- package/dist/manifest-entry.d.cts +2 -2
- package/dist/manifest-entry.d.ts +2 -2
- package/dist/manifest-entry.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-RVJLR4RS.js.map +0 -1
- package/dist/chunk-RY3LOSVZ.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkY4YNJ2EX_cjs = require('./chunk-Y4YNJ2EX.cjs');
|
|
4
4
|
var chunkWYUDL4FI_cjs = require('./chunk-WYUDL4FI.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunk7JLOF6CJ_cjs = require('./chunk-7JLOF6CJ.cjs');
|
|
6
6
|
require('./chunk-EMMSS5I5.cjs');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var ReactDOM = require('react-dom');
|
|
@@ -1382,7 +1382,7 @@ function createMockDriver(provider = "stripe", options = {}) {
|
|
|
1382
1382
|
amountMinor: 0,
|
|
1383
1383
|
currency: "USD"
|
|
1384
1384
|
};
|
|
1385
|
-
const offError = typeof options.failOffSession === "object" ? options.failOffSession :
|
|
1385
|
+
const offError = typeof options.failOffSession === "object" ? options.failOffSession : chunk7JLOF6CJ_cjs.checkoutError(
|
|
1386
1386
|
"authentication_required",
|
|
1387
1387
|
"off-session charge declined (mock)"
|
|
1388
1388
|
);
|
|
@@ -1403,7 +1403,7 @@ function createMockDriver(provider = "stripe", options = {}) {
|
|
|
1403
1403
|
if (success.ok) cb.onSuccess(success);
|
|
1404
1404
|
else
|
|
1405
1405
|
cb.onError(
|
|
1406
|
-
success.error ??
|
|
1406
|
+
success.error ?? chunk7JLOF6CJ_cjs.checkoutError(
|
|
1407
1407
|
"processing_error",
|
|
1408
1408
|
"failed (mock)"
|
|
1409
1409
|
)
|
|
@@ -1524,7 +1524,7 @@ function useCheckout(opts = {}) {
|
|
|
1524
1524
|
},
|
|
1525
1525
|
[tracker, productFacts]
|
|
1526
1526
|
);
|
|
1527
|
-
const hostInSheet = (surface) => surface === "sheet" ||
|
|
1527
|
+
const hostInSheet = (surface) => surface === "sheet" || chunk7JLOF6CJ_cjs.isInlineSurface(surface) && !!chunk7JLOF6CJ_cjs.PROVIDER_PROFILES[driver.provider]?.surfaces.sheet;
|
|
1528
1528
|
const startRecovery = (product, surface) => {
|
|
1529
1529
|
recovering.current = true;
|
|
1530
1530
|
if (hostInSheet(surface)) {
|
|
@@ -1581,7 +1581,7 @@ function useCheckout(opts = {}) {
|
|
|
1581
1581
|
else
|
|
1582
1582
|
startRecovery(
|
|
1583
1583
|
product,
|
|
1584
|
-
|
|
1584
|
+
chunk7JLOF6CJ_cjs.PROVIDER_PROFILES[driver.provider]?.surfaces.sheet ? "sheet" : "popup"
|
|
1585
1585
|
);
|
|
1586
1586
|
return;
|
|
1587
1587
|
}
|
|
@@ -1609,12 +1609,12 @@ function useCheckout(opts = {}) {
|
|
|
1609
1609
|
if (result.ok) succeedRef.current(result, product);
|
|
1610
1610
|
else
|
|
1611
1611
|
failRef.current(
|
|
1612
|
-
result.error ??
|
|
1612
|
+
result.error ?? chunk7JLOF6CJ_cjs.checkoutError("unknown", "Checkout failed"),
|
|
1613
1613
|
product
|
|
1614
1614
|
);
|
|
1615
1615
|
return result;
|
|
1616
1616
|
} catch (e) {
|
|
1617
|
-
const err =
|
|
1617
|
+
const err = chunk7JLOF6CJ_cjs.checkoutError(
|
|
1618
1618
|
"processing_error",
|
|
1619
1619
|
e instanceof Error ? e.message : "Checkout failed"
|
|
1620
1620
|
);
|
|
@@ -1666,7 +1666,7 @@ var CheckoutSheet = defineModal(({ product, surface, intent, kind, onSuccess, on
|
|
|
1666
1666
|
if (!hostable) {
|
|
1667
1667
|
resolved.current = true;
|
|
1668
1668
|
onErrorRef.current(
|
|
1669
|
-
|
|
1669
|
+
chunk7JLOF6CJ_cjs.checkoutError(
|
|
1670
1670
|
"processing_error",
|
|
1671
1671
|
"This checkout driver has no inline surface to host in the sheet"
|
|
1672
1672
|
)
|
|
@@ -1678,7 +1678,7 @@ var CheckoutSheet = defineModal(({ product, surface, intent, kind, onSuccess, on
|
|
|
1678
1678
|
return () => {
|
|
1679
1679
|
if (!resolved.current) {
|
|
1680
1680
|
onErrorRef.current(
|
|
1681
|
-
|
|
1681
|
+
chunk7JLOF6CJ_cjs.checkoutError(
|
|
1682
1682
|
"canceled",
|
|
1683
1683
|
"Checkout was dismissed before completing"
|
|
1684
1684
|
)
|
|
@@ -1725,9 +1725,21 @@ function trigger(onClick, {
|
|
|
1725
1725
|
children ?? "Continue"
|
|
1726
1726
|
);
|
|
1727
1727
|
}
|
|
1728
|
+
function detectDeviceClass() {
|
|
1729
|
+
if (typeof window === "undefined") return "desktop";
|
|
1730
|
+
const ua = navigator.userAgent?.toLowerCase() ?? "";
|
|
1731
|
+
if (/mobile|android(?!.*tablet)|iphone|ipod/.test(ua)) return "mobile";
|
|
1732
|
+
try {
|
|
1733
|
+
if (window.matchMedia?.("(pointer: coarse)").matches && window.innerWidth > 0 && window.innerWidth < 768) {
|
|
1734
|
+
return "mobile";
|
|
1735
|
+
}
|
|
1736
|
+
} catch {
|
|
1737
|
+
}
|
|
1738
|
+
return "desktop";
|
|
1739
|
+
}
|
|
1728
1740
|
function Checkout({
|
|
1729
1741
|
offering,
|
|
1730
|
-
surface,
|
|
1742
|
+
surface: surfacePreference,
|
|
1731
1743
|
asChild,
|
|
1732
1744
|
children,
|
|
1733
1745
|
className,
|
|
@@ -1735,9 +1747,12 @@ function Checkout({
|
|
|
1735
1747
|
}) {
|
|
1736
1748
|
const product = offering;
|
|
1737
1749
|
const driver = useDriver();
|
|
1750
|
+
const [surface] = React.useState(
|
|
1751
|
+
() => chunk7JLOF6CJ_cjs.resolveSurface(driver.provider, surfacePreference, detectDeviceClass())
|
|
1752
|
+
);
|
|
1738
1753
|
const checkout = useCheckout(options);
|
|
1739
1754
|
const intent = options.intent ?? "purchase";
|
|
1740
|
-
if (
|
|
1755
|
+
if (chunk7JLOF6CJ_cjs.isInlineSurface(surface)) {
|
|
1741
1756
|
return driver.renderInline ? React.createElement(
|
|
1742
1757
|
"div",
|
|
1743
1758
|
{ key: product, className },
|
|
@@ -1823,7 +1838,7 @@ function CheckoutResume(options = {}) {
|
|
|
1823
1838
|
cb.onSuccess(result);
|
|
1824
1839
|
} else {
|
|
1825
1840
|
cb.onError(
|
|
1826
|
-
result.error ??
|
|
1841
|
+
result.error ?? chunk7JLOF6CJ_cjs.checkoutError(
|
|
1827
1842
|
"unknown",
|
|
1828
1843
|
"The checkout could not be verified"
|
|
1829
1844
|
)
|
|
@@ -3792,39 +3807,51 @@ Object.defineProperty(exports, "resolveRoute", {
|
|
|
3792
3807
|
});
|
|
3793
3808
|
Object.defineProperty(exports, "INLINE_SURFACES", {
|
|
3794
3809
|
enumerable: true,
|
|
3795
|
-
get: function () { return
|
|
3810
|
+
get: function () { return chunk7JLOF6CJ_cjs.INLINE_SURFACES; }
|
|
3796
3811
|
});
|
|
3797
3812
|
Object.defineProperty(exports, "PROVIDER_PROFILES", {
|
|
3798
3813
|
enumerable: true,
|
|
3799
|
-
get: function () { return
|
|
3814
|
+
get: function () { return chunk7JLOF6CJ_cjs.PROVIDER_PROFILES; }
|
|
3800
3815
|
});
|
|
3801
3816
|
Object.defineProperty(exports, "checkoutError", {
|
|
3802
3817
|
enumerable: true,
|
|
3803
|
-
get: function () { return
|
|
3818
|
+
get: function () { return chunk7JLOF6CJ_cjs.checkoutError; }
|
|
3804
3819
|
});
|
|
3805
3820
|
Object.defineProperty(exports, "isInlineSurface", {
|
|
3806
3821
|
enumerable: true,
|
|
3807
|
-
get: function () { return
|
|
3822
|
+
get: function () { return chunk7JLOF6CJ_cjs.isInlineSurface; }
|
|
3808
3823
|
});
|
|
3809
3824
|
Object.defineProperty(exports, "isMerchantOfRecord", {
|
|
3810
3825
|
enumerable: true,
|
|
3811
|
-
get: function () { return
|
|
3826
|
+
get: function () { return chunk7JLOF6CJ_cjs.isMerchantOfRecord; }
|
|
3812
3827
|
});
|
|
3813
3828
|
Object.defineProperty(exports, "isOrchestrator", {
|
|
3814
3829
|
enumerable: true,
|
|
3815
|
-
get: function () { return
|
|
3830
|
+
get: function () { return chunk7JLOF6CJ_cjs.isOrchestrator; }
|
|
3831
|
+
});
|
|
3832
|
+
Object.defineProperty(exports, "isRenderableSurface", {
|
|
3833
|
+
enumerable: true,
|
|
3834
|
+
get: function () { return chunk7JLOF6CJ_cjs.isRenderableSurface; }
|
|
3835
|
+
});
|
|
3836
|
+
Object.defineProperty(exports, "renderableSurfaces", {
|
|
3837
|
+
enumerable: true,
|
|
3838
|
+
get: function () { return chunk7JLOF6CJ_cjs.renderableSurfaces; }
|
|
3839
|
+
});
|
|
3840
|
+
Object.defineProperty(exports, "resolveSurface", {
|
|
3841
|
+
enumerable: true,
|
|
3842
|
+
get: function () { return chunk7JLOF6CJ_cjs.resolveSurface; }
|
|
3816
3843
|
});
|
|
3817
3844
|
Object.defineProperty(exports, "surfacesFor", {
|
|
3818
3845
|
enumerable: true,
|
|
3819
|
-
get: function () { return
|
|
3846
|
+
get: function () { return chunk7JLOF6CJ_cjs.surfacesFor; }
|
|
3820
3847
|
});
|
|
3821
3848
|
Object.defineProperty(exports, "validateCheckout", {
|
|
3822
3849
|
enumerable: true,
|
|
3823
|
-
get: function () { return
|
|
3850
|
+
get: function () { return chunk7JLOF6CJ_cjs.validateCheckout; }
|
|
3824
3851
|
});
|
|
3825
3852
|
Object.defineProperty(exports, "validateUpsell", {
|
|
3826
3853
|
enumerable: true,
|
|
3827
|
-
get: function () { return
|
|
3854
|
+
get: function () { return chunk7JLOF6CJ_cjs.validateUpsell; }
|
|
3828
3855
|
});
|
|
3829
3856
|
exports.AssetsContext = AssetsContext;
|
|
3830
3857
|
exports.AssetsProvider = AssetsProvider;
|