@appfunnel-dev/sdk 0.4.0 → 0.6.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-BUF5FDKC.cjs +1303 -0
- package/dist/chunk-BUF5FDKC.cjs.map +1 -0
- package/dist/chunk-E6KSJ5UI.js +1299 -0
- package/dist/chunk-E6KSJ5UI.js.map +1 -0
- package/dist/index.cjs +413 -313
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -14
- package/dist/index.d.ts +65 -14
- package/dist/index.js +392 -300
- package/dist/index.js.map +1 -1
- package/dist/internal-BlgQ9C2d.d.cts +515 -0
- package/dist/internal-BlgQ9C2d.d.ts +515 -0
- package/dist/internal.cjs +5 -1196
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +2 -204
- package/dist/internal.d.ts +2 -204
- package/dist/internal.js +1 -1199
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/types-ChorYUCl.d.cts +0 -255
- package/dist/types-ChorYUCl.d.ts +0 -255
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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, F as FunnelState } from './
|
|
2
|
-
export { C as ConditionConfig,
|
|
3
|
-
import * as
|
|
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-BlgQ9C2d.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-BlgQ9C2d.js';
|
|
3
|
+
import * as react from 'react';
|
|
4
4
|
import { Appearance } from '@stripe/stripe-js';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Type helper for appfunnel.config.ts.
|
|
@@ -57,6 +58,7 @@ declare function useVariables(): Record<string, VariableValue>;
|
|
|
57
58
|
/**
|
|
58
59
|
* Read built-in user state (email, name, customerId).
|
|
59
60
|
*
|
|
61
|
+
* Only re-renders when a `user.*` variable changes.
|
|
60
62
|
* For reading/writing arbitrary user fields, use `useUserProperty('fieldName')`.
|
|
61
63
|
*/
|
|
62
64
|
declare function useUser(): UserState;
|
|
@@ -83,6 +85,8 @@ declare function useResponse<T extends VariableValue>(key: string): [T, (value:
|
|
|
83
85
|
/**
|
|
84
86
|
* Read all response variables as a flat object (without the `answers.` prefix).
|
|
85
87
|
*
|
|
88
|
+
* Only re-renders when an `answers.*` variable changes.
|
|
89
|
+
*
|
|
86
90
|
* ```tsx
|
|
87
91
|
* const responses = useResponses()
|
|
88
92
|
* // { goal: 'weight_loss', interests: ['yoga', 'running'] }
|
|
@@ -93,10 +97,7 @@ declare function useResponses(): Record<string, VariableValue>;
|
|
|
93
97
|
/**
|
|
94
98
|
* Read all URL query parameters as a flat object (without the `query.` prefix).
|
|
95
99
|
*
|
|
96
|
-
* `query.*`
|
|
97
|
-
* e.g. `?utm_source=google&ref=abc` → `{ utm_source: 'google', ref: 'abc' }`.
|
|
98
|
-
*
|
|
99
|
-
* These are read-only from the developer's perspective — they come from the URL.
|
|
100
|
+
* Only re-renders when a `query.*` variable changes.
|
|
100
101
|
*/
|
|
101
102
|
declare function useQueryParams(): Record<string, string>;
|
|
102
103
|
/**
|
|
@@ -149,11 +150,16 @@ declare function useTranslation(): TranslationState;
|
|
|
149
150
|
|
|
150
151
|
/**
|
|
151
152
|
* Navigation hook — evaluates routes, navigates between pages, tracks progress.
|
|
153
|
+
*
|
|
154
|
+
* Only re-renders when the router's current page changes (not on variable changes).
|
|
155
|
+
* Variables are read lazily at navigation time — callbacks are referentially stable.
|
|
152
156
|
*/
|
|
153
157
|
declare function useNavigation(): NavigationState;
|
|
154
158
|
|
|
155
159
|
/**
|
|
156
160
|
* Products hook — access product list, selected product, and selection handler.
|
|
161
|
+
*
|
|
162
|
+
* Only re-renders when `products.selectedProductId` changes.
|
|
157
163
|
*/
|
|
158
164
|
declare function useProducts(): ProductsState;
|
|
159
165
|
|
|
@@ -163,33 +169,78 @@ declare function useProducts(): ProductsState;
|
|
|
163
169
|
declare function useTracking(): TrackingState;
|
|
164
170
|
|
|
165
171
|
/**
|
|
166
|
-
* Payment hook — reads payment-related
|
|
172
|
+
* Payment hook — reads payment-related variables.
|
|
173
|
+
*
|
|
174
|
+
* Only re-renders when payment/card variables change.
|
|
167
175
|
*/
|
|
168
176
|
declare function usePayment(): PaymentState;
|
|
169
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Read device, browser, and OS metadata.
|
|
180
|
+
*
|
|
181
|
+
* These values are set once on mount and don't change, so this hook
|
|
182
|
+
* will rarely (if ever) re-render.
|
|
183
|
+
*
|
|
184
|
+
* ```tsx
|
|
185
|
+
* const { device, browser, os } = useDeviceInfo()
|
|
186
|
+
* if (device.isMobile) { ... }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
declare function useDeviceInfo(): DeviceInfo;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Read page-level system variables.
|
|
193
|
+
*
|
|
194
|
+
* Re-renders when page variables change (e.g. on navigation).
|
|
195
|
+
*
|
|
196
|
+
* ```tsx
|
|
197
|
+
* const { currentId, progressPercentage, startedAt } = usePageData()
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
declare function usePageData(): PageData;
|
|
201
|
+
|
|
170
202
|
/**
|
|
171
203
|
* Convenience hook that combines all SDK hooks.
|
|
172
204
|
* Useful for simple funnels where you don't want multiple hook imports.
|
|
173
205
|
*/
|
|
174
206
|
declare function useFunnel(): FunnelState;
|
|
175
207
|
|
|
176
|
-
interface
|
|
208
|
+
interface StripePaymentHandle {
|
|
209
|
+
/** Programmatically submit the payment form */
|
|
210
|
+
submit: () => Promise<void>;
|
|
211
|
+
}
|
|
212
|
+
interface StripePaymentFormProps {
|
|
177
213
|
/** Product ID override (default: currently selected product) */
|
|
178
214
|
productId?: string;
|
|
179
215
|
/** "checkout" for full payment, "validate-only" to just collect card */
|
|
180
216
|
mode?: 'checkout' | 'validate-only';
|
|
217
|
+
/** "elements" for PaymentElement, "embedded" for Stripe Embedded Checkout */
|
|
218
|
+
variant?: 'elements' | 'embedded';
|
|
181
219
|
/** Called on successful payment */
|
|
182
220
|
onSuccess?: () => void;
|
|
183
221
|
/** Called on payment error */
|
|
184
222
|
onError?: (error: string) => void;
|
|
185
|
-
/**
|
|
186
|
-
|
|
223
|
+
/** Called when the Stripe form is ready to accept submissions */
|
|
224
|
+
onReady?: () => void;
|
|
187
225
|
/** Additional CSS class */
|
|
188
226
|
className?: string;
|
|
189
|
-
/** Stripe Appearance override */
|
|
227
|
+
/** Stripe Appearance override (elements variant only) */
|
|
190
228
|
appearance?: Appearance;
|
|
229
|
+
/** PaymentElement layout option (default: 'tabs') */
|
|
230
|
+
layout?: 'tabs' | 'accordion' | 'auto';
|
|
191
231
|
}
|
|
192
|
-
|
|
232
|
+
/**
|
|
233
|
+
* Stripe payment component supporting PaymentElement and Embedded Checkout.
|
|
234
|
+
*
|
|
235
|
+
* Use a ref to submit the form from an external button:
|
|
236
|
+
* ```tsx
|
|
237
|
+
* const paymentRef = useRef<StripePaymentHandle>(null)
|
|
238
|
+
*
|
|
239
|
+
* <StripePaymentForm ref={paymentRef} onSuccess={goToNextPage} />
|
|
240
|
+
* <button onClick={() => paymentRef.current?.submit()}>Pay Now</button>
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
declare const StripePaymentForm: react.ForwardRefExoticComponent<StripePaymentFormProps & react.RefAttributes<StripePaymentHandle>>;
|
|
193
244
|
|
|
194
245
|
interface PaddleCheckoutProps {
|
|
195
246
|
/** Product ID to checkout (default: currently selected product) */
|
|
@@ -237,4 +288,4 @@ type IntegrationLoader = (config: Record<string, unknown>) => void;
|
|
|
237
288
|
*/
|
|
238
289
|
declare function registerIntegration(id: string, loader: IntegrationLoader): void;
|
|
239
290
|
|
|
240
|
-
export { AppFunnelConfig, FunnelState, type IntegrationConfigs, LocaleState, NavigationState, PaddleCheckout, type PaddleCheckoutProps, PageDefinition,
|
|
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 };
|