@appfunnel-dev/sdk 0.14.0 → 0.16.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-OTBIW5DN.cjs → chunk-6QKCIT32.cjs} +5 -5
- package/dist/chunk-6QKCIT32.cjs.map +1 -0
- package/dist/{chunk-JHR65SVV.cjs → chunk-CZQHTQU2.cjs} +6 -6
- package/dist/{chunk-JHR65SVV.cjs.map → chunk-CZQHTQU2.cjs.map} +1 -1
- package/dist/{chunk-H5C2QJIY.js → chunk-FDAIQSVU.js} +5 -5
- package/dist/chunk-FDAIQSVU.js.map +1 -0
- package/dist/{chunk-7JLCKTX6.js → chunk-IA5WCBUS.js} +3 -3
- package/dist/{chunk-7JLCKTX6.js.map → chunk-IA5WCBUS.js.map} +1 -1
- package/dist/elements/index.cjs +6 -6
- package/dist/elements/index.js +2 -2
- package/dist/index.cjs +31 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +2 -2
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-H5C2QJIY.js.map +0 -1
- package/dist/chunk-OTBIW5DN.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkCZQHTQU2_cjs = require('./chunk-CZQHTQU2.cjs');
|
|
4
|
+
var chunk6QKCIT32_cjs = require('./chunk-6QKCIT32.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var stripeJs = require('@stripe/stripe-js');
|
|
7
7
|
var sonner = require('sonner');
|
|
@@ -16,7 +16,7 @@ function definePage(definition) {
|
|
|
16
16
|
return definition;
|
|
17
17
|
}
|
|
18
18
|
function useVariable(id) {
|
|
19
|
-
const { variableStore } =
|
|
19
|
+
const { variableStore } = chunk6QKCIT32_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 } = chunk6QKCIT32_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 } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
145
145
|
const subscribe = react.useCallback(
|
|
146
146
|
(cb) => variableStore.subscribe(cb, { prefix: "user." }),
|
|
147
147
|
[variableStore]
|
|
@@ -170,6 +170,9 @@ function useUser() {
|
|
|
170
170
|
},
|
|
171
171
|
setMarketingConsent(consent) {
|
|
172
172
|
variableStore.set("user.marketingConsent", consent);
|
|
173
|
+
if (consent) {
|
|
174
|
+
tracker.track("marketing.consent_given");
|
|
175
|
+
}
|
|
173
176
|
},
|
|
174
177
|
identify(email) {
|
|
175
178
|
tracker.identify(email);
|
|
@@ -179,7 +182,7 @@ function useUser() {
|
|
|
179
182
|
);
|
|
180
183
|
}
|
|
181
184
|
function useUserProperty(field) {
|
|
182
|
-
const { variableStore } =
|
|
185
|
+
const { variableStore } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
183
186
|
const key = `user.${field}`;
|
|
184
187
|
const subscribe = react.useCallback(
|
|
185
188
|
(cb) => variableStore.subscribe(cb, { keys: [key] }),
|
|
@@ -197,7 +200,7 @@ function useUserProperty(field) {
|
|
|
197
200
|
return [value, setValue];
|
|
198
201
|
}
|
|
199
202
|
function useDateOfBirth(format = "MM/DD/YYYY") {
|
|
200
|
-
const { variableStore } =
|
|
203
|
+
const { variableStore } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
201
204
|
const key = "user.dateOfBirth";
|
|
202
205
|
const subscribe = react.useCallback(
|
|
203
206
|
(cb) => variableStore.subscribe(cb, { keys: [key] }),
|
|
@@ -215,7 +218,7 @@ function useDateOfBirth(format = "MM/DD/YYYY") {
|
|
|
215
218
|
return [value, setValue];
|
|
216
219
|
}
|
|
217
220
|
function useQueryParams() {
|
|
218
|
-
const { variableStore } =
|
|
221
|
+
const { variableStore } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
219
222
|
const subscribe = react.useCallback(
|
|
220
223
|
(cb) => variableStore.subscribe(cb, { prefix: "query." }),
|
|
221
224
|
[variableStore]
|
|
@@ -236,7 +239,7 @@ function useQueryParams() {
|
|
|
236
239
|
}, [variables]);
|
|
237
240
|
}
|
|
238
241
|
function useQueryParam(key) {
|
|
239
|
-
const { variableStore } =
|
|
242
|
+
const { variableStore } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
240
243
|
const prefixedKey = `query.${key}`;
|
|
241
244
|
const subscribe = react.useCallback(
|
|
242
245
|
(cb) => variableStore.subscribe(cb, { keys: [prefixedKey] }),
|
|
@@ -249,7 +252,7 @@ function useQueryParam(key) {
|
|
|
249
252
|
return react.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
250
253
|
}
|
|
251
254
|
function useData(key) {
|
|
252
|
-
const { variableStore } =
|
|
255
|
+
const { variableStore } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
253
256
|
const prefixedKey = `data.${key}`;
|
|
254
257
|
const subscribe = react.useCallback(
|
|
255
258
|
(cb) => variableStore.subscribe(cb, { keys: [prefixedKey] }),
|
|
@@ -302,7 +305,7 @@ function detect24Hour(locale) {
|
|
|
302
305
|
}
|
|
303
306
|
}
|
|
304
307
|
function useTranslation() {
|
|
305
|
-
const { i18n } =
|
|
308
|
+
const { i18n } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
306
309
|
const subscribe = react.useCallback(
|
|
307
310
|
(cb) => i18n.subscribe(cb),
|
|
308
311
|
[i18n]
|
|
@@ -325,7 +328,7 @@ function useTranslation() {
|
|
|
325
328
|
return { t, locale, setLocale, availableLocales };
|
|
326
329
|
}
|
|
327
330
|
function useProducts() {
|
|
328
|
-
const { products, variableStore, selectProduct: ctxSelect } =
|
|
331
|
+
const { products, variableStore, selectProduct: ctxSelect } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
329
332
|
const subscribe = react.useCallback(
|
|
330
333
|
(cb) => variableStore.subscribe(cb, { keys: ["products.selectedProductId"] }),
|
|
331
334
|
[variableStore]
|
|
@@ -342,7 +345,7 @@ function useProducts() {
|
|
|
342
345
|
return { products, selected, select };
|
|
343
346
|
}
|
|
344
347
|
function useTracking() {
|
|
345
|
-
const { tracker } =
|
|
348
|
+
const { tracker } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
346
349
|
const track = react.useCallback(
|
|
347
350
|
(eventName, data) => {
|
|
348
351
|
tracker.track(eventName, data);
|
|
@@ -354,7 +357,7 @@ function useTracking() {
|
|
|
354
357
|
var API_BASE_URL = "https://api.appfunnel.net";
|
|
355
358
|
var PAYMENT_KEYS = ["payment.loading", "payment.error"];
|
|
356
359
|
function usePayment() {
|
|
357
|
-
const { variableStore, products, campaignId, tracker, config } =
|
|
360
|
+
const { variableStore, products, campaignId, tracker, config } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
358
361
|
const showToasts = !config.settings?.disableToasts;
|
|
359
362
|
const subscribe = react.useCallback(
|
|
360
363
|
(cb) => variableStore.subscribe(cb, { keys: PAYMENT_KEYS }),
|
|
@@ -643,7 +646,7 @@ var DEVICE_KEYS = [
|
|
|
643
646
|
"browser.language"
|
|
644
647
|
];
|
|
645
648
|
function useDeviceInfo() {
|
|
646
|
-
const { variableStore } =
|
|
649
|
+
const { variableStore } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
647
650
|
const subscribe = react.useCallback(
|
|
648
651
|
(cb) => variableStore.subscribe(cb, { keys: DEVICE_KEYS }),
|
|
649
652
|
[variableStore]
|
|
@@ -777,7 +780,7 @@ var PAGE_KEYS = [
|
|
|
777
780
|
"page.startedAt"
|
|
778
781
|
];
|
|
779
782
|
function usePageData() {
|
|
780
|
-
const { variableStore } =
|
|
783
|
+
const { variableStore } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
781
784
|
const subscribe = react.useCallback(
|
|
782
785
|
(cb) => variableStore.subscribe(cb, { keys: PAGE_KEYS }),
|
|
783
786
|
[variableStore]
|
|
@@ -799,16 +802,16 @@ function usePageData() {
|
|
|
799
802
|
|
|
800
803
|
// src/hooks/useFunnel.ts
|
|
801
804
|
function useFunnel() {
|
|
802
|
-
const { funnelId, campaignId, tracker } =
|
|
805
|
+
const { funnelId, campaignId, tracker } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
803
806
|
return {
|
|
804
807
|
funnelId,
|
|
805
808
|
campaignId,
|
|
806
809
|
sessionId: tracker.getSessionId(),
|
|
807
810
|
variables: useVariables(),
|
|
808
811
|
user: useUser(),
|
|
809
|
-
responses:
|
|
812
|
+
responses: chunkCZQHTQU2_cjs.useResponses(),
|
|
810
813
|
queryParams: useQueryParams(),
|
|
811
|
-
navigation:
|
|
814
|
+
navigation: chunkCZQHTQU2_cjs.useNavigation(),
|
|
812
815
|
products: useProducts(),
|
|
813
816
|
tracking: useTracking(),
|
|
814
817
|
payment: usePayment()
|
|
@@ -1209,7 +1212,7 @@ var DemoStripePaymentForm = react.forwardRef(
|
|
|
1209
1212
|
onReady,
|
|
1210
1213
|
className
|
|
1211
1214
|
}, ref) {
|
|
1212
|
-
const { variableStore, tracker, products } =
|
|
1215
|
+
const { variableStore, tracker, products } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
1213
1216
|
const validateOnly = mode === "validate-only";
|
|
1214
1217
|
const product = react.useMemo(() => {
|
|
1215
1218
|
if (productId) return products.find((p) => p.id === productId) || null;
|
|
@@ -1269,7 +1272,7 @@ var InnerPaymentForm = react.forwardRef(
|
|
|
1269
1272
|
const stripe = reactStripeJs.useStripe();
|
|
1270
1273
|
const elements = reactStripeJs.useElements();
|
|
1271
1274
|
const [error, setError] = react.useState(null);
|
|
1272
|
-
const { variableStore, campaignId, tracker, products, config } =
|
|
1275
|
+
const { variableStore, campaignId, tracker, products, config } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
1273
1276
|
const showToasts = !config.settings?.disableToasts;
|
|
1274
1277
|
const readyFired = react.useRef(false);
|
|
1275
1278
|
react.useEffect(() => {
|
|
@@ -1420,7 +1423,7 @@ var RealStripePaymentForm = react.forwardRef(
|
|
|
1420
1423
|
appearance,
|
|
1421
1424
|
layout
|
|
1422
1425
|
}, ref) {
|
|
1423
|
-
const { campaignId, tracker, variableStore, products, router, config } =
|
|
1426
|
+
const { campaignId, tracker, variableStore, products, router, config } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
1424
1427
|
const showToasts = !config.settings?.disableToasts;
|
|
1425
1428
|
const [email] = useVariable("user.email");
|
|
1426
1429
|
const validateOnly = mode === "validate-only";
|
|
@@ -1576,7 +1579,7 @@ function PaddleCheckout({
|
|
|
1576
1579
|
onError,
|
|
1577
1580
|
className
|
|
1578
1581
|
}) {
|
|
1579
|
-
const { variableStore, tracker, products } =
|
|
1582
|
+
const { variableStore, tracker, products } = chunk6QKCIT32_cjs.useFunnelContext();
|
|
1580
1583
|
const containerRef = react.useRef(null);
|
|
1581
1584
|
const initializedRef = react.useRef(false);
|
|
1582
1585
|
const product = productId ? products.find((p) => p.id === productId) : products.find((p) => p.id === variableStore.get("products.selectedProductId"));
|
|
@@ -1635,23 +1638,23 @@ function PaddleCheckout({
|
|
|
1635
1638
|
|
|
1636
1639
|
Object.defineProperty(exports, "useNavigation", {
|
|
1637
1640
|
enumerable: true,
|
|
1638
|
-
get: function () { return
|
|
1641
|
+
get: function () { return chunkCZQHTQU2_cjs.useNavigation; }
|
|
1639
1642
|
});
|
|
1640
1643
|
Object.defineProperty(exports, "useResponse", {
|
|
1641
1644
|
enumerable: true,
|
|
1642
|
-
get: function () { return
|
|
1645
|
+
get: function () { return chunkCZQHTQU2_cjs.useResponse; }
|
|
1643
1646
|
});
|
|
1644
1647
|
Object.defineProperty(exports, "useResponses", {
|
|
1645
1648
|
enumerable: true,
|
|
1646
|
-
get: function () { return
|
|
1649
|
+
get: function () { return chunkCZQHTQU2_cjs.useResponses; }
|
|
1647
1650
|
});
|
|
1648
1651
|
Object.defineProperty(exports, "FunnelProvider", {
|
|
1649
1652
|
enumerable: true,
|
|
1650
|
-
get: function () { return
|
|
1653
|
+
get: function () { return chunk6QKCIT32_cjs.FunnelProvider; }
|
|
1651
1654
|
});
|
|
1652
1655
|
Object.defineProperty(exports, "registerIntegration", {
|
|
1653
1656
|
enumerable: true,
|
|
1654
|
-
get: function () { return
|
|
1657
|
+
get: function () { return chunk6QKCIT32_cjs.registerIntegration; }
|
|
1655
1658
|
});
|
|
1656
1659
|
Object.defineProperty(exports, "toast", {
|
|
1657
1660
|
enumerable: true,
|