@appfunnel-dev/sdk 0.12.0 → 0.14.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/{chunk-GZKA33W2.js → chunk-7JLCKTX6.js} +3 -3
- package/dist/{chunk-GZKA33W2.js.map → chunk-7JLCKTX6.js.map} +1 -1
- package/dist/{chunk-DAHMOQ63.js → chunk-H5C2QJIY.js} +184 -34
- package/dist/chunk-H5C2QJIY.js.map +1 -0
- package/dist/{chunk-ECWTUTEJ.cjs → chunk-JHR65SVV.cjs} +6 -6
- package/dist/{chunk-ECWTUTEJ.cjs.map → chunk-JHR65SVV.cjs.map} +1 -1
- package/dist/{chunk-5E6WNNU4.cjs → chunk-OTBIW5DN.cjs} +183 -33
- package/dist/chunk-OTBIW5DN.cjs.map +1 -0
- package/dist/elements/index.cjs +6 -6
- package/dist/elements/index.js +2 -2
- package/dist/index.cjs +30 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -18
- package/dist/index.d.ts +34 -18
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/{internal-BuotLNwa.d.cts → internal-BBWDTB-l.d.cts} +9 -1
- package/dist/{internal-BuotLNwa.d.ts → internal-BBWDTB-l.d.ts} +9 -1
- package/dist/internal.cjs +2 -2
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5E6WNNU4.cjs.map +0 -1
- package/dist/chunk-DAHMOQ63.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkJHR65SVV_cjs = require('./chunk-JHR65SVV.cjs');
|
|
4
|
+
var chunkOTBIW5DN_cjs = require('./chunk-OTBIW5DN.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
|
-
var sonner = require('sonner');
|
|
7
6
|
var stripeJs = require('@stripe/stripe-js');
|
|
7
|
+
var sonner = require('sonner');
|
|
8
8
|
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ function definePage(definition) {
|
|
|
16
16
|
return definition;
|
|
17
17
|
}
|
|
18
18
|
function useVariable(id) {
|
|
19
|
-
const { variableStore } =
|
|
19
|
+
const { variableStore } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
20
20
|
const subscribe = react.useCallback(
|
|
21
21
|
(callback) => variableStore.subscribe(callback, { keys: [id] }),
|
|
22
22
|
[variableStore, id]
|
|
@@ -33,7 +33,7 @@ function useVariable(id) {
|
|
|
33
33
|
return [value, setValue];
|
|
34
34
|
}
|
|
35
35
|
function useVariables() {
|
|
36
|
-
const { variableStore } =
|
|
36
|
+
const { variableStore } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
37
37
|
const subscribe = react.useCallback(
|
|
38
38
|
(callback) => variableStore.subscribe(callback),
|
|
39
39
|
[variableStore]
|
|
@@ -141,7 +141,7 @@ function toISODateWithFormat(input, format) {
|
|
|
141
141
|
|
|
142
142
|
// src/hooks/useUser.ts
|
|
143
143
|
function useUser() {
|
|
144
|
-
const { variableStore, tracker } =
|
|
144
|
+
const { variableStore, tracker } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
145
145
|
const subscribe = react.useCallback(
|
|
146
146
|
(cb) => variableStore.subscribe(cb, { prefix: "user." }),
|
|
147
147
|
[variableStore]
|
|
@@ -179,7 +179,7 @@ function useUser() {
|
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
function useUserProperty(field) {
|
|
182
|
-
const { variableStore } =
|
|
182
|
+
const { variableStore } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
183
183
|
const key = `user.${field}`;
|
|
184
184
|
const subscribe = react.useCallback(
|
|
185
185
|
(cb) => variableStore.subscribe(cb, { keys: [key] }),
|
|
@@ -197,7 +197,7 @@ function useUserProperty(field) {
|
|
|
197
197
|
return [value, setValue];
|
|
198
198
|
}
|
|
199
199
|
function useDateOfBirth(format = "MM/DD/YYYY") {
|
|
200
|
-
const { variableStore } =
|
|
200
|
+
const { variableStore } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
201
201
|
const key = "user.dateOfBirth";
|
|
202
202
|
const subscribe = react.useCallback(
|
|
203
203
|
(cb) => variableStore.subscribe(cb, { keys: [key] }),
|
|
@@ -215,7 +215,7 @@ function useDateOfBirth(format = "MM/DD/YYYY") {
|
|
|
215
215
|
return [value, setValue];
|
|
216
216
|
}
|
|
217
217
|
function useQueryParams() {
|
|
218
|
-
const { variableStore } =
|
|
218
|
+
const { variableStore } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
219
219
|
const subscribe = react.useCallback(
|
|
220
220
|
(cb) => variableStore.subscribe(cb, { prefix: "query." }),
|
|
221
221
|
[variableStore]
|
|
@@ -236,7 +236,7 @@ function useQueryParams() {
|
|
|
236
236
|
}, [variables]);
|
|
237
237
|
}
|
|
238
238
|
function useQueryParam(key) {
|
|
239
|
-
const { variableStore } =
|
|
239
|
+
const { variableStore } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
240
240
|
const prefixedKey = `query.${key}`;
|
|
241
241
|
const subscribe = react.useCallback(
|
|
242
242
|
(cb) => variableStore.subscribe(cb, { keys: [prefixedKey] }),
|
|
@@ -249,7 +249,7 @@ function useQueryParam(key) {
|
|
|
249
249
|
return react.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
250
250
|
}
|
|
251
251
|
function useData(key) {
|
|
252
|
-
const { variableStore } =
|
|
252
|
+
const { variableStore } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
253
253
|
const prefixedKey = `data.${key}`;
|
|
254
254
|
const subscribe = react.useCallback(
|
|
255
255
|
(cb) => variableStore.subscribe(cb, { keys: [prefixedKey] }),
|
|
@@ -302,7 +302,7 @@ function detect24Hour(locale) {
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
function useTranslation() {
|
|
305
|
-
const { i18n } =
|
|
305
|
+
const { i18n } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
306
306
|
const subscribe = react.useCallback(
|
|
307
307
|
(cb) => i18n.subscribe(cb),
|
|
308
308
|
[i18n]
|
|
@@ -325,7 +325,7 @@ function useTranslation() {
|
|
|
325
325
|
return { t, locale, setLocale, availableLocales };
|
|
326
326
|
}
|
|
327
327
|
function useProducts() {
|
|
328
|
-
const { products, variableStore, selectProduct: ctxSelect } =
|
|
328
|
+
const { products, variableStore, selectProduct: ctxSelect } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
329
329
|
const subscribe = react.useCallback(
|
|
330
330
|
(cb) => variableStore.subscribe(cb, { keys: ["products.selectedProductId"] }),
|
|
331
331
|
[variableStore]
|
|
@@ -342,7 +342,7 @@ function useProducts() {
|
|
|
342
342
|
return { products, selected, select };
|
|
343
343
|
}
|
|
344
344
|
function useTracking() {
|
|
345
|
-
const { tracker } =
|
|
345
|
+
const { tracker } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
346
346
|
const track = react.useCallback(
|
|
347
347
|
(eventName, data) => {
|
|
348
348
|
tracker.track(eventName, data);
|
|
@@ -354,7 +354,7 @@ function useTracking() {
|
|
|
354
354
|
var API_BASE_URL = "https://api.appfunnel.net";
|
|
355
355
|
var PAYMENT_KEYS = ["payment.loading", "payment.error"];
|
|
356
356
|
function usePayment() {
|
|
357
|
-
const { variableStore, products, campaignId, tracker, config } =
|
|
357
|
+
const { variableStore, products, campaignId, tracker, config } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
358
358
|
const showToasts = !config.settings?.disableToasts;
|
|
359
359
|
const subscribe = react.useCallback(
|
|
360
360
|
(cb) => variableStore.subscribe(cb, { keys: PAYMENT_KEYS }),
|
|
@@ -446,8 +446,7 @@ function usePayment() {
|
|
|
446
446
|
console.log(
|
|
447
447
|
"[Purchase] 3DS authentication required, loading Stripe..."
|
|
448
448
|
);
|
|
449
|
-
const
|
|
450
|
-
const stripeInstance = await loadStripe2(
|
|
449
|
+
const stripeInstance = await stripeJs.loadStripe(
|
|
451
450
|
result.publishableKey
|
|
452
451
|
);
|
|
453
452
|
if (!stripeInstance) {
|
|
@@ -644,7 +643,7 @@ var DEVICE_KEYS = [
|
|
|
644
643
|
"browser.language"
|
|
645
644
|
];
|
|
646
645
|
function useDeviceInfo() {
|
|
647
|
-
const { variableStore } =
|
|
646
|
+
const { variableStore } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
648
647
|
const subscribe = react.useCallback(
|
|
649
648
|
(cb) => variableStore.subscribe(cb, { keys: DEVICE_KEYS }),
|
|
650
649
|
[variableStore]
|
|
@@ -778,7 +777,7 @@ var PAGE_KEYS = [
|
|
|
778
777
|
"page.startedAt"
|
|
779
778
|
];
|
|
780
779
|
function usePageData() {
|
|
781
|
-
const { variableStore } =
|
|
780
|
+
const { variableStore } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
782
781
|
const subscribe = react.useCallback(
|
|
783
782
|
(cb) => variableStore.subscribe(cb, { keys: PAGE_KEYS }),
|
|
784
783
|
[variableStore]
|
|
@@ -800,16 +799,16 @@ function usePageData() {
|
|
|
800
799
|
|
|
801
800
|
// src/hooks/useFunnel.ts
|
|
802
801
|
function useFunnel() {
|
|
803
|
-
const { funnelId, campaignId, tracker } =
|
|
802
|
+
const { funnelId, campaignId, tracker } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
804
803
|
return {
|
|
805
804
|
funnelId,
|
|
806
805
|
campaignId,
|
|
807
806
|
sessionId: tracker.getSessionId(),
|
|
808
807
|
variables: useVariables(),
|
|
809
808
|
user: useUser(),
|
|
810
|
-
responses:
|
|
809
|
+
responses: chunkJHR65SVV_cjs.useResponses(),
|
|
811
810
|
queryParams: useQueryParams(),
|
|
812
|
-
navigation:
|
|
811
|
+
navigation: chunkJHR65SVV_cjs.useNavigation(),
|
|
813
812
|
products: useProducts(),
|
|
814
813
|
tracking: useTracking(),
|
|
815
814
|
payment: usePayment()
|
|
@@ -1210,7 +1209,7 @@ var DemoStripePaymentForm = react.forwardRef(
|
|
|
1210
1209
|
onReady,
|
|
1211
1210
|
className
|
|
1212
1211
|
}, ref) {
|
|
1213
|
-
const { variableStore, tracker, products } =
|
|
1212
|
+
const { variableStore, tracker, products } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
1214
1213
|
const validateOnly = mode === "validate-only";
|
|
1215
1214
|
const product = react.useMemo(() => {
|
|
1216
1215
|
if (productId) return products.find((p) => p.id === productId) || null;
|
|
@@ -1270,7 +1269,7 @@ var InnerPaymentForm = react.forwardRef(
|
|
|
1270
1269
|
const stripe = reactStripeJs.useStripe();
|
|
1271
1270
|
const elements = reactStripeJs.useElements();
|
|
1272
1271
|
const [error, setError] = react.useState(null);
|
|
1273
|
-
const { variableStore, campaignId, tracker, products, config } =
|
|
1272
|
+
const { variableStore, campaignId, tracker, products, config } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
1274
1273
|
const showToasts = !config.settings?.disableToasts;
|
|
1275
1274
|
const readyFired = react.useRef(false);
|
|
1276
1275
|
react.useEffect(() => {
|
|
@@ -1421,7 +1420,7 @@ var RealStripePaymentForm = react.forwardRef(
|
|
|
1421
1420
|
appearance,
|
|
1422
1421
|
layout
|
|
1423
1422
|
}, ref) {
|
|
1424
|
-
const { campaignId, tracker, variableStore, products, router, config } =
|
|
1423
|
+
const { campaignId, tracker, variableStore, products, router, config } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
1425
1424
|
const showToasts = !config.settings?.disableToasts;
|
|
1426
1425
|
const [email] = useVariable("user.email");
|
|
1427
1426
|
const validateOnly = mode === "validate-only";
|
|
@@ -1577,7 +1576,7 @@ function PaddleCheckout({
|
|
|
1577
1576
|
onError,
|
|
1578
1577
|
className
|
|
1579
1578
|
}) {
|
|
1580
|
-
const { variableStore, tracker, products } =
|
|
1579
|
+
const { variableStore, tracker, products } = chunkOTBIW5DN_cjs.useFunnelContext();
|
|
1581
1580
|
const containerRef = react.useRef(null);
|
|
1582
1581
|
const initializedRef = react.useRef(false);
|
|
1583
1582
|
const product = productId ? products.find((p) => p.id === productId) : products.find((p) => p.id === variableStore.get("products.selectedProductId"));
|
|
@@ -1636,23 +1635,23 @@ function PaddleCheckout({
|
|
|
1636
1635
|
|
|
1637
1636
|
Object.defineProperty(exports, "useNavigation", {
|
|
1638
1637
|
enumerable: true,
|
|
1639
|
-
get: function () { return
|
|
1638
|
+
get: function () { return chunkJHR65SVV_cjs.useNavigation; }
|
|
1640
1639
|
});
|
|
1641
1640
|
Object.defineProperty(exports, "useResponse", {
|
|
1642
1641
|
enumerable: true,
|
|
1643
|
-
get: function () { return
|
|
1642
|
+
get: function () { return chunkJHR65SVV_cjs.useResponse; }
|
|
1644
1643
|
});
|
|
1645
1644
|
Object.defineProperty(exports, "useResponses", {
|
|
1646
1645
|
enumerable: true,
|
|
1647
|
-
get: function () { return
|
|
1646
|
+
get: function () { return chunkJHR65SVV_cjs.useResponses; }
|
|
1648
1647
|
});
|
|
1649
1648
|
Object.defineProperty(exports, "FunnelProvider", {
|
|
1650
1649
|
enumerable: true,
|
|
1651
|
-
get: function () { return
|
|
1650
|
+
get: function () { return chunkOTBIW5DN_cjs.FunnelProvider; }
|
|
1652
1651
|
});
|
|
1653
1652
|
Object.defineProperty(exports, "registerIntegration", {
|
|
1654
1653
|
enumerable: true,
|
|
1655
|
-
get: function () { return
|
|
1654
|
+
get: function () { return chunkOTBIW5DN_cjs.registerIntegration; }
|
|
1656
1655
|
});
|
|
1657
1656
|
Object.defineProperty(exports, "toast", {
|
|
1658
1657
|
enumerable: true,
|