@appfunnel-dev/sdk 0.6.0 → 0.8.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/README.md +2 -80
- package/dist/{chunk-BUF5FDKC.cjs → chunk-EVUYCLVY.cjs} +42 -19
- package/dist/chunk-EVUYCLVY.cjs.map +1 -0
- package/dist/{chunk-E6KSJ5UI.js → chunk-H3KHXZSI.js} +42 -20
- package/dist/chunk-H3KHXZSI.js.map +1 -0
- package/dist/chunk-P4SLDMWY.js +104 -0
- package/dist/chunk-P4SLDMWY.js.map +1 -0
- package/dist/chunk-XP44I2MU.cjs +108 -0
- package/dist/chunk-XP44I2MU.cjs.map +1 -0
- package/dist/elements/index.cjs +12217 -0
- package/dist/elements/index.cjs.map +1 -0
- package/dist/elements/index.d.cts +620 -0
- package/dist/elements/index.d.ts +620 -0
- package/dist/elements/index.js +12181 -0
- package/dist/elements/index.js.map +1 -0
- package/dist/index.cjs +958 -150
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -5
- package/dist/index.d.ts +75 -5
- package/dist/index.js +928 -131
- package/dist/index.js.map +1 -1
- package/dist/{internal-BlgQ9C2d.d.cts → internal-C9MOEdND.d.cts} +12 -12
- package/dist/{internal-BlgQ9C2d.d.ts → internal-C9MOEdND.d.ts} +12 -12
- 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 +17 -2
- package/dist/chunk-BUF5FDKC.cjs.map +0 -1
- package/dist/chunk-E6KSJ5UI.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AppFunnelConfig, P as PageDefinition, V as VariableValue, U as UserState, L as LocaleState, T as TranslationState, N as NavigationState, a as ProductsState, b as TrackingState, c as PaymentState, D as DeviceInfo, d as PageData, F as FunnelState } from './internal-
|
|
2
|
-
export { C as ConditionConfig, e as ConditionGroupConfig, f as FunnelProvider, g as FunnelProviderProps, h as FunnelSettings, i as PageConfig, j as PageState, k as PageType, l as ProductConfig, m as ProductsConfig, n as Progress, R as RouteConfig, o as RuntimeProduct, p as VariableConfig, q as VariableType } from './internal-
|
|
1
|
+
import { A as AppFunnelConfig, P as PageDefinition, V as VariableValue, U as UserState, L as LocaleState, T as TranslationState, N as NavigationState, a as ProductsState, b as TrackingState, c as PaymentState, D as DeviceInfo, d as PageData, F as FunnelState } from './internal-C9MOEdND.cjs';
|
|
2
|
+
export { C as ConditionConfig, e as ConditionGroupConfig, f as FunnelProvider, g as FunnelProviderProps, h as FunnelSettings, i as PageConfig, j as PageState, k as PageType, l as ProductConfig, m as ProductsConfig, n as Progress, R as RouteConfig, o as RuntimeProduct, p as VariableConfig, q as VariableType } from './internal-C9MOEdND.cjs';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { Appearance } from '@stripe/stripe-js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -40,6 +40,9 @@ declare function definePage(definition: PageDefinition): PageDefinition;
|
|
|
40
40
|
/**
|
|
41
41
|
* Read/write a single variable.
|
|
42
42
|
*
|
|
43
|
+
* **Advanced** — this hook is not intended for normal page usage.
|
|
44
|
+
* Prefer accessing variables through the standard page props instead.
|
|
45
|
+
*
|
|
43
46
|
* ```tsx
|
|
44
47
|
* const [email, setEmail] = useVariable<string>('email')
|
|
45
48
|
* const [count, setCount] = useVariable<number>('count')
|
|
@@ -52,9 +55,17 @@ declare function useVariable<T extends VariableValue>(id: string): [T, (value: T
|
|
|
52
55
|
/**
|
|
53
56
|
* Read all variables (including system variables). Read-only.
|
|
54
57
|
* Use useVariable() to write individual variables.
|
|
58
|
+
*
|
|
59
|
+
* **Advanced** — this hook is not intended for normal page usage.
|
|
60
|
+
* Prefer accessing variables through the standard page props instead.
|
|
61
|
+
*
|
|
62
|
+
* Warning: this hook subscribes to ALL variable changes, so the
|
|
63
|
+
* component will re-render on every single variable update.
|
|
55
64
|
*/
|
|
56
65
|
declare function useVariables(): Record<string, VariableValue>;
|
|
57
66
|
|
|
67
|
+
type DateFormat = 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD';
|
|
68
|
+
|
|
58
69
|
/**
|
|
59
70
|
* Read built-in user state (email, name, customerId).
|
|
60
71
|
*
|
|
@@ -72,6 +83,21 @@ declare function useUser(): UserState;
|
|
|
72
83
|
* ```
|
|
73
84
|
*/
|
|
74
85
|
declare function useUserProperty(field: string): [string, (value: string) => void];
|
|
86
|
+
/**
|
|
87
|
+
* Read/write the user's date of birth.
|
|
88
|
+
* Always stores the value as YYYY-MM-DD regardless of input format.
|
|
89
|
+
*
|
|
90
|
+
* @param format - How the input string should be interpreted (default: MM/DD/YYYY).
|
|
91
|
+
*
|
|
92
|
+
* ```tsx
|
|
93
|
+
* const [dob, setDob] = useDateOfBirth() // defaults to MM/DD/YYYY
|
|
94
|
+
* const [dob, setDob] = useDateOfBirth('DD/MM/YYYY') // explicit EU format
|
|
95
|
+
*
|
|
96
|
+
* setDob('03/15/1990') // stored as "1990-03-15"
|
|
97
|
+
* setDob('03151990') // stored as "1990-03-15"
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
declare function useDateOfBirth(format?: DateFormat): [string, (value: string) => void];
|
|
75
101
|
|
|
76
102
|
/**
|
|
77
103
|
* Read/write a single response variable (answers.*).
|
|
@@ -164,12 +190,12 @@ declare function useNavigation(): NavigationState;
|
|
|
164
190
|
declare function useProducts(): ProductsState;
|
|
165
191
|
|
|
166
192
|
/**
|
|
167
|
-
* Tracking hook — fire events
|
|
193
|
+
* Tracking hook — fire custom events.
|
|
168
194
|
*/
|
|
169
195
|
declare function useTracking(): TrackingState;
|
|
170
196
|
|
|
171
197
|
/**
|
|
172
|
-
* Payment hook — reads payment-related variables.
|
|
198
|
+
* Payment hook — reads payment-related variables and provides a purchase action.
|
|
173
199
|
*
|
|
174
200
|
* Only re-renders when payment/card variables change.
|
|
175
201
|
*/
|
|
@@ -188,6 +214,47 @@ declare function usePayment(): PaymentState;
|
|
|
188
214
|
*/
|
|
189
215
|
declare function useDeviceInfo(): DeviceInfo;
|
|
190
216
|
|
|
217
|
+
interface SafeAreaInsets {
|
|
218
|
+
top: number;
|
|
219
|
+
right: number;
|
|
220
|
+
bottom: number;
|
|
221
|
+
left: number;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Returns the current safe-area insets (in px) from `env(safe-area-inset-*)`.
|
|
225
|
+
*
|
|
226
|
+
* Useful for positioning fixed elements above the Safari home-indicator bar.
|
|
227
|
+
*
|
|
228
|
+
* ```tsx
|
|
229
|
+
* const { bottom } = useSafeArea()
|
|
230
|
+
* <div style={{ position: 'fixed', bottom: 0, paddingBottom: bottom }} />
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
declare function useSafeArea(): SafeAreaInsets;
|
|
234
|
+
|
|
235
|
+
interface KeyboardState {
|
|
236
|
+
/** Whether the virtual keyboard is currently visible */
|
|
237
|
+
isOpen: boolean;
|
|
238
|
+
/** Height of the keyboard in pixels (0 when closed) */
|
|
239
|
+
height: number;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Detects the virtual keyboard on mobile devices.
|
|
243
|
+
*
|
|
244
|
+
* Uses the VirtualKeyboard API where available, with a
|
|
245
|
+
* visualViewport fallback for Safari/older browsers.
|
|
246
|
+
*
|
|
247
|
+
* The visualViewport path follows the approach described at
|
|
248
|
+
* https://martijnhols.nl/blog/how-to-get-document-height-ios-safari-osk
|
|
249
|
+
* to handle iOS Safari's delayed viewport updates on keyboard close.
|
|
250
|
+
*
|
|
251
|
+
* ```tsx
|
|
252
|
+
* const { isOpen, height } = useKeyboard()
|
|
253
|
+
* <div style={{ position: 'fixed', bottom: isOpen ? height : 0 }} />
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare function useKeyboard(): KeyboardState;
|
|
257
|
+
|
|
191
258
|
/**
|
|
192
259
|
* Read page-level system variables.
|
|
193
260
|
*
|
|
@@ -232,6 +299,9 @@ interface StripePaymentFormProps {
|
|
|
232
299
|
/**
|
|
233
300
|
* Stripe payment component supporting PaymentElement and Embedded Checkout.
|
|
234
301
|
*
|
|
302
|
+
* In dev mode (`globalThis.__APPFUNNEL_DEV__`), renders a demo form that
|
|
303
|
+
* simulates Stripe UI and emulates purchases without real Stripe calls.
|
|
304
|
+
*
|
|
235
305
|
* Use a ref to submit the form from an external button:
|
|
236
306
|
* ```tsx
|
|
237
307
|
* const paymentRef = useRef<StripePaymentHandle>(null)
|
|
@@ -288,4 +358,4 @@ type IntegrationLoader = (config: Record<string, unknown>) => void;
|
|
|
288
358
|
*/
|
|
289
359
|
declare function registerIntegration(id: string, loader: IntegrationLoader): void;
|
|
290
360
|
|
|
291
|
-
export { AppFunnelConfig, DeviceInfo, FunnelState, type IntegrationConfigs, LocaleState, NavigationState, PaddleCheckout, type PaddleCheckoutProps, PageData, PageDefinition, PaymentState, ProductsState, StripePaymentForm, type StripePaymentFormProps, type StripePaymentHandle, TrackingState, TranslationState, UserState, VariableValue, defineConfig, definePage, registerIntegration, useData, useDeviceInfo, useFunnel, useLocale, useNavigation, usePageData, usePayment, useProducts, useQueryParam, useQueryParams, useResponse, useResponses, useTracking, useTranslation, useUser, useUserProperty, useVariable, useVariables };
|
|
361
|
+
export { AppFunnelConfig, type DateFormat, DeviceInfo, FunnelState, type IntegrationConfigs, type KeyboardState, LocaleState, NavigationState, PaddleCheckout, type PaddleCheckoutProps, PageData, PageDefinition, PaymentState, ProductsState, type SafeAreaInsets, StripePaymentForm, type StripePaymentFormProps, type StripePaymentHandle, TrackingState, TranslationState, UserState, VariableValue, defineConfig, definePage, registerIntegration, useData, useDateOfBirth, useDeviceInfo, useFunnel, useKeyboard, useLocale, useNavigation, usePageData, usePayment, useProducts, useQueryParam, useQueryParams, useResponse, useResponses, useSafeArea, useTracking, useTranslation, useUser, useUserProperty, useVariable, useVariables };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AppFunnelConfig, P as PageDefinition, V as VariableValue, U as UserState, L as LocaleState, T as TranslationState, N as NavigationState, a as ProductsState, b as TrackingState, c as PaymentState, D as DeviceInfo, d as PageData, F as FunnelState } from './internal-
|
|
2
|
-
export { C as ConditionConfig, e as ConditionGroupConfig, f as FunnelProvider, g as FunnelProviderProps, h as FunnelSettings, i as PageConfig, j as PageState, k as PageType, l as ProductConfig, m as ProductsConfig, n as Progress, R as RouteConfig, o as RuntimeProduct, p as VariableConfig, q as VariableType } from './internal-
|
|
1
|
+
import { A as AppFunnelConfig, P as PageDefinition, V as VariableValue, U as UserState, L as LocaleState, T as TranslationState, N as NavigationState, a as ProductsState, b as TrackingState, c as PaymentState, D as DeviceInfo, d as PageData, F as FunnelState } from './internal-C9MOEdND.js';
|
|
2
|
+
export { C as ConditionConfig, e as ConditionGroupConfig, f as FunnelProvider, g as FunnelProviderProps, h as FunnelSettings, i as PageConfig, j as PageState, k as PageType, l as ProductConfig, m as ProductsConfig, n as Progress, R as RouteConfig, o as RuntimeProduct, p as VariableConfig, q as VariableType } from './internal-C9MOEdND.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { Appearance } from '@stripe/stripe-js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -40,6 +40,9 @@ declare function definePage(definition: PageDefinition): PageDefinition;
|
|
|
40
40
|
/**
|
|
41
41
|
* Read/write a single variable.
|
|
42
42
|
*
|
|
43
|
+
* **Advanced** — this hook is not intended for normal page usage.
|
|
44
|
+
* Prefer accessing variables through the standard page props instead.
|
|
45
|
+
*
|
|
43
46
|
* ```tsx
|
|
44
47
|
* const [email, setEmail] = useVariable<string>('email')
|
|
45
48
|
* const [count, setCount] = useVariable<number>('count')
|
|
@@ -52,9 +55,17 @@ declare function useVariable<T extends VariableValue>(id: string): [T, (value: T
|
|
|
52
55
|
/**
|
|
53
56
|
* Read all variables (including system variables). Read-only.
|
|
54
57
|
* Use useVariable() to write individual variables.
|
|
58
|
+
*
|
|
59
|
+
* **Advanced** — this hook is not intended for normal page usage.
|
|
60
|
+
* Prefer accessing variables through the standard page props instead.
|
|
61
|
+
*
|
|
62
|
+
* Warning: this hook subscribes to ALL variable changes, so the
|
|
63
|
+
* component will re-render on every single variable update.
|
|
55
64
|
*/
|
|
56
65
|
declare function useVariables(): Record<string, VariableValue>;
|
|
57
66
|
|
|
67
|
+
type DateFormat = 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD';
|
|
68
|
+
|
|
58
69
|
/**
|
|
59
70
|
* Read built-in user state (email, name, customerId).
|
|
60
71
|
*
|
|
@@ -72,6 +83,21 @@ declare function useUser(): UserState;
|
|
|
72
83
|
* ```
|
|
73
84
|
*/
|
|
74
85
|
declare function useUserProperty(field: string): [string, (value: string) => void];
|
|
86
|
+
/**
|
|
87
|
+
* Read/write the user's date of birth.
|
|
88
|
+
* Always stores the value as YYYY-MM-DD regardless of input format.
|
|
89
|
+
*
|
|
90
|
+
* @param format - How the input string should be interpreted (default: MM/DD/YYYY).
|
|
91
|
+
*
|
|
92
|
+
* ```tsx
|
|
93
|
+
* const [dob, setDob] = useDateOfBirth() // defaults to MM/DD/YYYY
|
|
94
|
+
* const [dob, setDob] = useDateOfBirth('DD/MM/YYYY') // explicit EU format
|
|
95
|
+
*
|
|
96
|
+
* setDob('03/15/1990') // stored as "1990-03-15"
|
|
97
|
+
* setDob('03151990') // stored as "1990-03-15"
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
declare function useDateOfBirth(format?: DateFormat): [string, (value: string) => void];
|
|
75
101
|
|
|
76
102
|
/**
|
|
77
103
|
* Read/write a single response variable (answers.*).
|
|
@@ -164,12 +190,12 @@ declare function useNavigation(): NavigationState;
|
|
|
164
190
|
declare function useProducts(): ProductsState;
|
|
165
191
|
|
|
166
192
|
/**
|
|
167
|
-
* Tracking hook — fire events
|
|
193
|
+
* Tracking hook — fire custom events.
|
|
168
194
|
*/
|
|
169
195
|
declare function useTracking(): TrackingState;
|
|
170
196
|
|
|
171
197
|
/**
|
|
172
|
-
* Payment hook — reads payment-related variables.
|
|
198
|
+
* Payment hook — reads payment-related variables and provides a purchase action.
|
|
173
199
|
*
|
|
174
200
|
* Only re-renders when payment/card variables change.
|
|
175
201
|
*/
|
|
@@ -188,6 +214,47 @@ declare function usePayment(): PaymentState;
|
|
|
188
214
|
*/
|
|
189
215
|
declare function useDeviceInfo(): DeviceInfo;
|
|
190
216
|
|
|
217
|
+
interface SafeAreaInsets {
|
|
218
|
+
top: number;
|
|
219
|
+
right: number;
|
|
220
|
+
bottom: number;
|
|
221
|
+
left: number;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Returns the current safe-area insets (in px) from `env(safe-area-inset-*)`.
|
|
225
|
+
*
|
|
226
|
+
* Useful for positioning fixed elements above the Safari home-indicator bar.
|
|
227
|
+
*
|
|
228
|
+
* ```tsx
|
|
229
|
+
* const { bottom } = useSafeArea()
|
|
230
|
+
* <div style={{ position: 'fixed', bottom: 0, paddingBottom: bottom }} />
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
declare function useSafeArea(): SafeAreaInsets;
|
|
234
|
+
|
|
235
|
+
interface KeyboardState {
|
|
236
|
+
/** Whether the virtual keyboard is currently visible */
|
|
237
|
+
isOpen: boolean;
|
|
238
|
+
/** Height of the keyboard in pixels (0 when closed) */
|
|
239
|
+
height: number;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Detects the virtual keyboard on mobile devices.
|
|
243
|
+
*
|
|
244
|
+
* Uses the VirtualKeyboard API where available, with a
|
|
245
|
+
* visualViewport fallback for Safari/older browsers.
|
|
246
|
+
*
|
|
247
|
+
* The visualViewport path follows the approach described at
|
|
248
|
+
* https://martijnhols.nl/blog/how-to-get-document-height-ios-safari-osk
|
|
249
|
+
* to handle iOS Safari's delayed viewport updates on keyboard close.
|
|
250
|
+
*
|
|
251
|
+
* ```tsx
|
|
252
|
+
* const { isOpen, height } = useKeyboard()
|
|
253
|
+
* <div style={{ position: 'fixed', bottom: isOpen ? height : 0 }} />
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare function useKeyboard(): KeyboardState;
|
|
257
|
+
|
|
191
258
|
/**
|
|
192
259
|
* Read page-level system variables.
|
|
193
260
|
*
|
|
@@ -232,6 +299,9 @@ interface StripePaymentFormProps {
|
|
|
232
299
|
/**
|
|
233
300
|
* Stripe payment component supporting PaymentElement and Embedded Checkout.
|
|
234
301
|
*
|
|
302
|
+
* In dev mode (`globalThis.__APPFUNNEL_DEV__`), renders a demo form that
|
|
303
|
+
* simulates Stripe UI and emulates purchases without real Stripe calls.
|
|
304
|
+
*
|
|
235
305
|
* Use a ref to submit the form from an external button:
|
|
236
306
|
* ```tsx
|
|
237
307
|
* const paymentRef = useRef<StripePaymentHandle>(null)
|
|
@@ -288,4 +358,4 @@ type IntegrationLoader = (config: Record<string, unknown>) => void;
|
|
|
288
358
|
*/
|
|
289
359
|
declare function registerIntegration(id: string, loader: IntegrationLoader): void;
|
|
290
360
|
|
|
291
|
-
export { AppFunnelConfig, DeviceInfo, FunnelState, type IntegrationConfigs, LocaleState, NavigationState, PaddleCheckout, type PaddleCheckoutProps, PageData, PageDefinition, PaymentState, ProductsState, StripePaymentForm, type StripePaymentFormProps, type StripePaymentHandle, TrackingState, TranslationState, UserState, VariableValue, defineConfig, definePage, registerIntegration, useData, useDeviceInfo, useFunnel, useLocale, useNavigation, usePageData, usePayment, useProducts, useQueryParam, useQueryParams, useResponse, useResponses, useTracking, useTranslation, useUser, useUserProperty, useVariable, useVariables };
|
|
361
|
+
export { AppFunnelConfig, type DateFormat, DeviceInfo, FunnelState, type IntegrationConfigs, type KeyboardState, LocaleState, NavigationState, PaddleCheckout, type PaddleCheckoutProps, PageData, PageDefinition, PaymentState, ProductsState, type SafeAreaInsets, StripePaymentForm, type StripePaymentFormProps, type StripePaymentHandle, TrackingState, TranslationState, UserState, VariableValue, defineConfig, definePage, registerIntegration, useData, useDateOfBirth, useDeviceInfo, useFunnel, useKeyboard, useLocale, useNavigation, usePageData, usePayment, useProducts, useQueryParam, useQueryParams, useResponse, useResponses, useSafeArea, useTracking, useTranslation, useUser, useUserProperty, useVariable, useVariables };
|