@appfunnel-dev/sdk 2.0.0-canary.5 → 2.0.0-canary.8
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 +1 -1
- package/dist/{capabilities-7_hy5f5G.d.cts → capabilities-CsnkVwna.d.cts} +34 -1
- package/dist/{capabilities-7_hy5f5G.d.ts → capabilities-CsnkVwna.d.ts} +34 -1
- package/dist/{checkout-7Dy6IedP.d.ts → checkout-3PkKwPd7.d.ts} +14 -14
- package/dist/{checkout-Dz8cGkB_.d.cts → checkout-Cg20l53c.d.cts} +14 -14
- package/dist/{chunk-VAOR77NW.cjs → chunk-FY3TMSRU.cjs} +7 -7
- package/dist/{chunk-VAOR77NW.cjs.map → chunk-FY3TMSRU.cjs.map} +1 -1
- package/dist/{chunk-CFFMZYPE.js → chunk-PWXMQGO6.js} +3 -3
- package/dist/{chunk-CFFMZYPE.js.map → chunk-PWXMQGO6.js.map} +1 -1
- package/dist/{chunk-TNLRQPVY.js → chunk-RVJLR4RS.js} +36 -8
- package/dist/chunk-RVJLR4RS.js.map +1 -0
- package/dist/{chunk-QMAZGLGV.cjs → chunk-RY3LOSVZ.cjs} +37 -7
- package/dist/chunk-RY3LOSVZ.cjs.map +1 -0
- package/dist/{chunk-AXXG3ODP.js → chunk-VW2HVPR4.js} +63 -90
- package/dist/chunk-VW2HVPR4.js.map +1 -0
- package/dist/{chunk-G44BUG6G.cjs → chunk-Y4YNJ2EX.cjs} +65 -93
- package/dist/chunk-Y4YNJ2EX.cjs.map +1 -0
- package/dist/driver-paddle.cjs +22 -22
- package/dist/driver-paddle.d.cts +2 -2
- package/dist/driver-paddle.d.ts +2 -2
- package/dist/driver-paddle.js +2 -2
- package/dist/driver-stripe.cjs +264 -212
- package/dist/driver-stripe.cjs.map +1 -1
- package/dist/driver-stripe.d.cts +19 -3
- package/dist/driver-stripe.d.ts +19 -3
- package/dist/driver-stripe.js +244 -193
- package/dist/driver-stripe.js.map +1 -1
- package/dist/index.cjs +310 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -25
- package/dist/index.d.ts +25 -25
- package/dist/index.js +262 -82
- package/dist/index.js.map +1 -1
- package/dist/{manifest-Dl7faaKe.d.cts → manifest-B3Tdab0M.d.cts} +157 -85
- package/dist/{manifest-Dl7faaKe.d.ts → manifest-B3Tdab0M.d.ts} +157 -85
- package/dist/manifest-entry.cjs +118 -49
- package/dist/manifest-entry.cjs.map +1 -1
- package/dist/manifest-entry.d.cts +12 -29
- package/dist/manifest-entry.d.ts +12 -29
- package/dist/manifest-entry.js +79 -14
- package/dist/manifest-entry.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-AXXG3ODP.js.map +0 -1
- package/dist/chunk-G44BUG6G.cjs.map +0 -1
- package/dist/chunk-QMAZGLGV.cjs.map +0 -1
- package/dist/chunk-TNLRQPVY.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ComponentType, ButtonHTMLAttributes } from 'react';
|
|
3
|
-
import { V as VariableValue, a as VariableConfig, A as Acquisition,
|
|
4
|
-
export { B as BrowserContext,
|
|
3
|
+
import { V as VariableValue, a as VariableConfig, A as Acquisition, O as Offering, D as Direction, F as FunnelContext, R as RuntimeExperiment, b as FunnelSnapshot, c as FunnelDefinition, d as buildContext, e as OfferingInput, P as PageMeta, f as PageContext } from './manifest-B3Tdab0M.cjs';
|
|
4
|
+
export { B as BrowserContext, g as BuildContextOptions, C as ClickIdContext, h as CompileInput, i as Condition, j as ConditionOp, k as DeviceContext, E as EdgeCondition, l as ExperimentArm, m as ExperimentResolution, n as FlowPage, o as FunnelLocales, p as FunnelManifest, G as Gate, I as IdentityContext, q as Interval, L as LocaleContext, M as ManifestEdge, r as ManifestPage, s as ManifestValidation, t as Money, u as OsContext, v as PageType, w as Predicate, x as ResolvedOffering, y as Route, S as SessionContext, z as SystemContext, U as UtmContext, H as assignVariant, J as bucketingSeed, K as buildAcquisition, N as buildCatalog, Q as compileManifest, T as currencyExponent, W as defineFunnel, X as definePage, Y as entryGuard, Z as evaluateCondition, _ as evaluateGate, $ as expectedPathLength, a0 as fnv1a, a1 as formatMoney, a2 as formatOffering, a3 as hashToUnit, a4 as isRtl, a5 as isVariantKey, a6 as nextPage, a7 as outgoingKeys, a8 as pageMeta, a9 as parseSlotKey, aa as pickByWeight, ab as resolveExperiments, ac as resolveLocale, ad as resolveOffering, ae as resolveRoute } from './manifest-B3Tdab0M.cjs';
|
|
5
5
|
import { NavSnapshot } from './protocol.cjs';
|
|
6
|
-
import { a as CheckoutDriver, C as CheckoutDriverContext } from './checkout-
|
|
7
|
-
export { b as Checkout, c as CheckoutCallbacks, d as CheckoutHandle, e as CheckoutProps, f as CheckoutRequest, g as CheckoutResult, h as CheckoutResume, i as CheckoutStatus, F as FailureModalProps, j as FailureRoute, M as MockDriverOptions, O as OnFailedMap, U as Upsell, k as UpsellProps, l as UseCheckoutOptions, m as createMockDriver, n as driverWithEmail, u as useCheckout } from './checkout-
|
|
6
|
+
import { a as CheckoutDriver, C as CheckoutDriverContext } from './checkout-Cg20l53c.cjs';
|
|
7
|
+
export { b as Checkout, c as CheckoutCallbacks, d as CheckoutHandle, e as CheckoutProps, f as CheckoutRequest, g as CheckoutResult, h as CheckoutResume, i as CheckoutStatus, F as FailureModalProps, j as FailureRoute, M as MockDriverOptions, O as OnFailedMap, U as Upsell, k as UpsellProps, l as UseCheckoutOptions, m as createMockDriver, n as driverWithEmail, u as useCheckout } from './checkout-Cg20l53c.cjs';
|
|
8
8
|
import { ToasterProps } from 'sonner';
|
|
9
9
|
export { ToasterProps, toast } from 'sonner';
|
|
10
|
-
export { C as CheckoutError, a as CheckoutErrorCategory, b as CheckoutIntent, c as CheckoutProvider, d as CheckoutSurface, I as INLINE_SURFACES, O as OffSessionReliability, P as PROVIDER_PROFILES, e as ProviderProfile, S as SurfaceCapability, U as UpsellKind, V as ValidationResult, f as checkoutError, i as isInlineSurface, g as isMerchantOfRecord, h as isOrchestrator, s as surfacesFor, v as validateCheckout, j as validateUpsell } from './capabilities-
|
|
10
|
+
export { C as CheckoutError, a as CheckoutErrorCategory, b as CheckoutIntent, c as CheckoutProvider, d as CheckoutSurface, I as INLINE_SURFACES, O as OffSessionReliability, P as PROVIDER_PROFILES, e as ProviderProfile, S as SurfaceCapability, U as UpsellKind, V as ValidationResult, f as checkoutError, i as isInlineSurface, g as isMerchantOfRecord, h as isOrchestrator, s as surfacesFor, v as validateCheckout, j as validateUpsell } from './capabilities-CsnkVwna.cjs';
|
|
11
11
|
|
|
12
12
|
declare class VariableStore {
|
|
13
13
|
private state;
|
|
@@ -237,7 +237,7 @@ interface NavigationControl {
|
|
|
237
237
|
* The public `window.appfunnel` surface — subscribe + read + drive the flow. It never
|
|
238
238
|
* exposes `emit` (no forged events) or `setVariable` (state stays funnel-owned).
|
|
239
239
|
*/
|
|
240
|
-
interface
|
|
240
|
+
interface AppfunnelBusApi extends BusAccessors {
|
|
241
241
|
/** Subscribe to an event (or `'*'` for all). Returns an unsubscribe fn. */
|
|
242
242
|
on(event: string, cb: Listener): () => void;
|
|
243
243
|
off(event: string, cb: Listener): void;
|
|
@@ -253,10 +253,10 @@ interface AppFunnelBusApi extends BusAccessors {
|
|
|
253
253
|
navigation(): NavSnapshot | null;
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
|
-
* The internal bus: the public {@link
|
|
257
|
-
* `now` injection. The SDK holds this; only {@link
|
|
256
|
+
* The internal bus: the public {@link AppfunnelBusApi} plus `emit` (SDK-only) and
|
|
257
|
+
* `now` injection. The SDK holds this; only {@link AppfunnelBusApi} reaches `window`.
|
|
258
258
|
*/
|
|
259
|
-
interface FunnelBus extends
|
|
259
|
+
interface FunnelBus extends AppfunnelBusApi {
|
|
260
260
|
emit(event: string, data?: unknown): void;
|
|
261
261
|
/** SDK-only: a mounted `<FunnelView>` registers its flow control; returns an unregister fn. */
|
|
262
262
|
registerNavigation(nav: NavigationControl): () => void;
|
|
@@ -271,7 +271,7 @@ declare function createBus(accessors: BusAccessors, now?: () => number): FunnelB
|
|
|
271
271
|
declare function withBus(tracker: Tracker, bus: FunnelBus): Tracker;
|
|
272
272
|
declare global {
|
|
273
273
|
interface Window {
|
|
274
|
-
appfunnel?:
|
|
274
|
+
appfunnel?: AppfunnelBusApi;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
@@ -281,30 +281,30 @@ declare global {
|
|
|
281
281
|
declare function attachBus(bus: FunnelBus): () => void;
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
|
-
* v2 `
|
|
284
|
+
* v2 `offerings` — the **read-only** offering catalog.
|
|
285
285
|
*
|
|
286
|
-
* **
|
|
286
|
+
* **Appfunnel does not manage currency.** Multi-currency is entirely the payment
|
|
287
287
|
* provider's job: the provider (or its preview API) resolves the visitor's price,
|
|
288
|
-
* and we receive a single resolved `{ amount, currency }` per
|
|
288
|
+
* and we receive a single resolved `{ amount, currency }` per offering. No FX, no
|
|
289
289
|
* currency selection, no conversion on our side. (FX appears only for frozen-USD
|
|
290
290
|
* *reporting*, never display — phase-3 §3.6b.) A provider that doesn't localize
|
|
291
291
|
* simply gives one currency.
|
|
292
292
|
*
|
|
293
|
-
* Our only job is **display**: pick the
|
|
293
|
+
* Our only job is **display**: pick the offering by logical id and **format** its
|
|
294
294
|
* amount. Formatting happens at read time in the funnel's **active locale** (so
|
|
295
295
|
* switching language reformats `kr 79,00` ⇄ `$9.99`), while the **currency** is
|
|
296
296
|
* whatever the provider resolved. Currency selection is the platform's; the
|
|
297
|
-
* authoring funnel only ever names
|
|
297
|
+
* authoring funnel only ever names an offering id.
|
|
298
298
|
*
|
|
299
299
|
* The math itself (resolve/format/exponents) is pure and lives in {@link ./money}
|
|
300
300
|
* so the server/tooling entry can use it without React — this module re-exports
|
|
301
301
|
* it and adds the React wiring (provider + hooks).
|
|
302
302
|
*/
|
|
303
303
|
|
|
304
|
-
/** `
|
|
305
|
-
declare function
|
|
306
|
-
/** `
|
|
307
|
-
declare function
|
|
304
|
+
/** `useOffering('monthly')` — one offering, formatted in the active locale. */
|
|
305
|
+
declare function useOffering(id: string | undefined): Offering | undefined;
|
|
306
|
+
/** `useOfferings()` — every offering, formatted in the active locale, in order. */
|
|
307
|
+
declare function useOfferings(): Offering[];
|
|
308
308
|
|
|
309
309
|
/**
|
|
310
310
|
* v2 localization — translated **text** (prices already localize via `Intl` in
|
|
@@ -447,8 +447,8 @@ interface FunnelProviderProps {
|
|
|
447
447
|
tracker?: Tracker;
|
|
448
448
|
/** Computed-context seed (funnel id, test/live mode, server-hydrated utm/session). */
|
|
449
449
|
context?: Parameters<typeof buildContext>[0];
|
|
450
|
-
/**
|
|
451
|
-
|
|
450
|
+
/** Offerings with their provider-resolved price (`{ amount, currency }`). */
|
|
451
|
+
offerings?: OfferingInput[];
|
|
452
452
|
/** Live page-level experiment records, platform/DB-sourced (not authored in funnel code). */
|
|
453
453
|
experiments?: RuntimeExperiment[];
|
|
454
454
|
/** The platform checkout driver; defaults to a mock that resolves successfully. */
|
|
@@ -467,7 +467,7 @@ interface FunnelProviderProps {
|
|
|
467
467
|
* Mounts a funnel: builds the writable {@link VariableStore} + the read-only
|
|
468
468
|
* {@link FunnelContext} (once) and provides the runtime to the tree via hooks.
|
|
469
469
|
*/
|
|
470
|
-
declare function FunnelProvider({ config, sessionValues, deferSessionValues, tracker, context: contextOpts,
|
|
470
|
+
declare function FunnelProvider({ config, sessionValues, deferSessionValues, tracker, context: contextOpts, offerings, experiments, checkout, messages, locale: localeOverride, toaster, store, children, }: FunnelProviderProps): ReactNode;
|
|
471
471
|
/**
|
|
472
472
|
* The imperative handle. Does **not** subscribe — use it in event handlers and
|
|
473
473
|
* effects (`useFunnel().responses.set({...})`). For reactive reads use the hooks.
|
|
@@ -638,8 +638,8 @@ declare function useAssets(): Record<string, string>;
|
|
|
638
638
|
declare function useAsset(name: string): string | undefined;
|
|
639
639
|
/** What the renderer injects when mounting a funnel build (SSR and hydration). */
|
|
640
640
|
interface MountOpts {
|
|
641
|
-
/** Platform-resolved
|
|
642
|
-
|
|
641
|
+
/** Platform-resolved offering prices (one currency per visitor). */
|
|
642
|
+
offerings?: OfferingInput[];
|
|
643
643
|
/** Explicit locale override (URL/param/geo); wins over the detected device locale. */
|
|
644
644
|
locale?: string;
|
|
645
645
|
mode?: 'test' | 'live';
|
|
@@ -1082,4 +1082,4 @@ interface ScriptProps {
|
|
|
1082
1082
|
*/
|
|
1083
1083
|
declare function Script({ src, strategy, id, async, defer, nonce, attributes, onLoad, onError, }: ScriptProps): null;
|
|
1084
1084
|
|
|
1085
|
-
export { Acquisition, type
|
|
1085
|
+
export { Acquisition, type AppfunnelBusApi, AssetsContext, AssetsProvider, Back, type BackProps, type BusAccessors, type BusEvent, type CatalogEvent, CheckoutDriver, CheckoutDriverContext, Choice, type ChoiceOption, type ChoiceProps, type CreateFunnelTreeInput, Direction, EVENT_CATALOG, type EventMeta, type EventSource, type Formatters, type Funnel, type FunnelBus, FunnelContext, FunnelDefinition, type FunnelEventDataMap, FunnelProvider, type FunnelProviderProps, FunnelSnapshot, FunnelToaster, FunnelView, type KnownFunnelEvent, type MessageCatalog, Modal, type ModalHandler, type ModalHocProps, type ModalProps, type ModalState, type MountModule, type MountOpts, Namespace, type NavigationState, Next, type NextProps, Offering, OfferingInput, PageContext, PageMeta, type PageModule, type PlatformTrackingConfig, type PluralCategory, RuntimeExperiment, type RuntimePage, Script, type ScriptProps, Sheet, type SheetProps, type SheetSide, type TFunction, type Tracker, type Translation, VariableStore, attachBus, buildContext, createBus, createConsoleTracker, createFunnelStore, createFunnelTree, createPlatformTracker, defineModal, hideModal, integrationEvents, isIntegrationEvent, isTrackableEvent, newEventId, registerModal, removeModal, showModal, unregisterModal, useActiveLocale, useAsset, useAssets, useClickIds, useContextValue, useData, useDevice, useExperiment, useField, useFunnel, useLocale, useModal, useNavigation, useOffering, useOfferings, usePage, useResponse, useSystem, useTracker, useTranslation, useUserAttribute, useUtm, withBus };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ComponentType, ButtonHTMLAttributes } from 'react';
|
|
3
|
-
import { V as VariableValue, a as VariableConfig, A as Acquisition,
|
|
4
|
-
export { B as BrowserContext,
|
|
3
|
+
import { V as VariableValue, a as VariableConfig, A as Acquisition, O as Offering, D as Direction, F as FunnelContext, R as RuntimeExperiment, b as FunnelSnapshot, c as FunnelDefinition, d as buildContext, e as OfferingInput, P as PageMeta, f as PageContext } from './manifest-B3Tdab0M.js';
|
|
4
|
+
export { B as BrowserContext, g as BuildContextOptions, C as ClickIdContext, h as CompileInput, i as Condition, j as ConditionOp, k as DeviceContext, E as EdgeCondition, l as ExperimentArm, m as ExperimentResolution, n as FlowPage, o as FunnelLocales, p as FunnelManifest, G as Gate, I as IdentityContext, q as Interval, L as LocaleContext, M as ManifestEdge, r as ManifestPage, s as ManifestValidation, t as Money, u as OsContext, v as PageType, w as Predicate, x as ResolvedOffering, y as Route, S as SessionContext, z as SystemContext, U as UtmContext, H as assignVariant, J as bucketingSeed, K as buildAcquisition, N as buildCatalog, Q as compileManifest, T as currencyExponent, W as defineFunnel, X as definePage, Y as entryGuard, Z as evaluateCondition, _ as evaluateGate, $ as expectedPathLength, a0 as fnv1a, a1 as formatMoney, a2 as formatOffering, a3 as hashToUnit, a4 as isRtl, a5 as isVariantKey, a6 as nextPage, a7 as outgoingKeys, a8 as pageMeta, a9 as parseSlotKey, aa as pickByWeight, ab as resolveExperiments, ac as resolveLocale, ad as resolveOffering, ae as resolveRoute } from './manifest-B3Tdab0M.js';
|
|
5
5
|
import { NavSnapshot } from './protocol.js';
|
|
6
|
-
import { a as CheckoutDriver, C as CheckoutDriverContext } from './checkout-
|
|
7
|
-
export { b as Checkout, c as CheckoutCallbacks, d as CheckoutHandle, e as CheckoutProps, f as CheckoutRequest, g as CheckoutResult, h as CheckoutResume, i as CheckoutStatus, F as FailureModalProps, j as FailureRoute, M as MockDriverOptions, O as OnFailedMap, U as Upsell, k as UpsellProps, l as UseCheckoutOptions, m as createMockDriver, n as driverWithEmail, u as useCheckout } from './checkout-
|
|
6
|
+
import { a as CheckoutDriver, C as CheckoutDriverContext } from './checkout-3PkKwPd7.js';
|
|
7
|
+
export { b as Checkout, c as CheckoutCallbacks, d as CheckoutHandle, e as CheckoutProps, f as CheckoutRequest, g as CheckoutResult, h as CheckoutResume, i as CheckoutStatus, F as FailureModalProps, j as FailureRoute, M as MockDriverOptions, O as OnFailedMap, U as Upsell, k as UpsellProps, l as UseCheckoutOptions, m as createMockDriver, n as driverWithEmail, u as useCheckout } from './checkout-3PkKwPd7.js';
|
|
8
8
|
import { ToasterProps } from 'sonner';
|
|
9
9
|
export { ToasterProps, toast } from 'sonner';
|
|
10
|
-
export { C as CheckoutError, a as CheckoutErrorCategory, b as CheckoutIntent, c as CheckoutProvider, d as CheckoutSurface, I as INLINE_SURFACES, O as OffSessionReliability, P as PROVIDER_PROFILES, e as ProviderProfile, S as SurfaceCapability, U as UpsellKind, V as ValidationResult, f as checkoutError, i as isInlineSurface, g as isMerchantOfRecord, h as isOrchestrator, s as surfacesFor, v as validateCheckout, j as validateUpsell } from './capabilities-
|
|
10
|
+
export { C as CheckoutError, a as CheckoutErrorCategory, b as CheckoutIntent, c as CheckoutProvider, d as CheckoutSurface, I as INLINE_SURFACES, O as OffSessionReliability, P as PROVIDER_PROFILES, e as ProviderProfile, S as SurfaceCapability, U as UpsellKind, V as ValidationResult, f as checkoutError, i as isInlineSurface, g as isMerchantOfRecord, h as isOrchestrator, s as surfacesFor, v as validateCheckout, j as validateUpsell } from './capabilities-CsnkVwna.js';
|
|
11
11
|
|
|
12
12
|
declare class VariableStore {
|
|
13
13
|
private state;
|
|
@@ -237,7 +237,7 @@ interface NavigationControl {
|
|
|
237
237
|
* The public `window.appfunnel` surface — subscribe + read + drive the flow. It never
|
|
238
238
|
* exposes `emit` (no forged events) or `setVariable` (state stays funnel-owned).
|
|
239
239
|
*/
|
|
240
|
-
interface
|
|
240
|
+
interface AppfunnelBusApi extends BusAccessors {
|
|
241
241
|
/** Subscribe to an event (or `'*'` for all). Returns an unsubscribe fn. */
|
|
242
242
|
on(event: string, cb: Listener): () => void;
|
|
243
243
|
off(event: string, cb: Listener): void;
|
|
@@ -253,10 +253,10 @@ interface AppFunnelBusApi extends BusAccessors {
|
|
|
253
253
|
navigation(): NavSnapshot | null;
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
|
-
* The internal bus: the public {@link
|
|
257
|
-
* `now` injection. The SDK holds this; only {@link
|
|
256
|
+
* The internal bus: the public {@link AppfunnelBusApi} plus `emit` (SDK-only) and
|
|
257
|
+
* `now` injection. The SDK holds this; only {@link AppfunnelBusApi} reaches `window`.
|
|
258
258
|
*/
|
|
259
|
-
interface FunnelBus extends
|
|
259
|
+
interface FunnelBus extends AppfunnelBusApi {
|
|
260
260
|
emit(event: string, data?: unknown): void;
|
|
261
261
|
/** SDK-only: a mounted `<FunnelView>` registers its flow control; returns an unregister fn. */
|
|
262
262
|
registerNavigation(nav: NavigationControl): () => void;
|
|
@@ -271,7 +271,7 @@ declare function createBus(accessors: BusAccessors, now?: () => number): FunnelB
|
|
|
271
271
|
declare function withBus(tracker: Tracker, bus: FunnelBus): Tracker;
|
|
272
272
|
declare global {
|
|
273
273
|
interface Window {
|
|
274
|
-
appfunnel?:
|
|
274
|
+
appfunnel?: AppfunnelBusApi;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
@@ -281,30 +281,30 @@ declare global {
|
|
|
281
281
|
declare function attachBus(bus: FunnelBus): () => void;
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
|
-
* v2 `
|
|
284
|
+
* v2 `offerings` — the **read-only** offering catalog.
|
|
285
285
|
*
|
|
286
|
-
* **
|
|
286
|
+
* **Appfunnel does not manage currency.** Multi-currency is entirely the payment
|
|
287
287
|
* provider's job: the provider (or its preview API) resolves the visitor's price,
|
|
288
|
-
* and we receive a single resolved `{ amount, currency }` per
|
|
288
|
+
* and we receive a single resolved `{ amount, currency }` per offering. No FX, no
|
|
289
289
|
* currency selection, no conversion on our side. (FX appears only for frozen-USD
|
|
290
290
|
* *reporting*, never display — phase-3 §3.6b.) A provider that doesn't localize
|
|
291
291
|
* simply gives one currency.
|
|
292
292
|
*
|
|
293
|
-
* Our only job is **display**: pick the
|
|
293
|
+
* Our only job is **display**: pick the offering by logical id and **format** its
|
|
294
294
|
* amount. Formatting happens at read time in the funnel's **active locale** (so
|
|
295
295
|
* switching language reformats `kr 79,00` ⇄ `$9.99`), while the **currency** is
|
|
296
296
|
* whatever the provider resolved. Currency selection is the platform's; the
|
|
297
|
-
* authoring funnel only ever names
|
|
297
|
+
* authoring funnel only ever names an offering id.
|
|
298
298
|
*
|
|
299
299
|
* The math itself (resolve/format/exponents) is pure and lives in {@link ./money}
|
|
300
300
|
* so the server/tooling entry can use it without React — this module re-exports
|
|
301
301
|
* it and adds the React wiring (provider + hooks).
|
|
302
302
|
*/
|
|
303
303
|
|
|
304
|
-
/** `
|
|
305
|
-
declare function
|
|
306
|
-
/** `
|
|
307
|
-
declare function
|
|
304
|
+
/** `useOffering('monthly')` — one offering, formatted in the active locale. */
|
|
305
|
+
declare function useOffering(id: string | undefined): Offering | undefined;
|
|
306
|
+
/** `useOfferings()` — every offering, formatted in the active locale, in order. */
|
|
307
|
+
declare function useOfferings(): Offering[];
|
|
308
308
|
|
|
309
309
|
/**
|
|
310
310
|
* v2 localization — translated **text** (prices already localize via `Intl` in
|
|
@@ -447,8 +447,8 @@ interface FunnelProviderProps {
|
|
|
447
447
|
tracker?: Tracker;
|
|
448
448
|
/** Computed-context seed (funnel id, test/live mode, server-hydrated utm/session). */
|
|
449
449
|
context?: Parameters<typeof buildContext>[0];
|
|
450
|
-
/**
|
|
451
|
-
|
|
450
|
+
/** Offerings with their provider-resolved price (`{ amount, currency }`). */
|
|
451
|
+
offerings?: OfferingInput[];
|
|
452
452
|
/** Live page-level experiment records, platform/DB-sourced (not authored in funnel code). */
|
|
453
453
|
experiments?: RuntimeExperiment[];
|
|
454
454
|
/** The platform checkout driver; defaults to a mock that resolves successfully. */
|
|
@@ -467,7 +467,7 @@ interface FunnelProviderProps {
|
|
|
467
467
|
* Mounts a funnel: builds the writable {@link VariableStore} + the read-only
|
|
468
468
|
* {@link FunnelContext} (once) and provides the runtime to the tree via hooks.
|
|
469
469
|
*/
|
|
470
|
-
declare function FunnelProvider({ config, sessionValues, deferSessionValues, tracker, context: contextOpts,
|
|
470
|
+
declare function FunnelProvider({ config, sessionValues, deferSessionValues, tracker, context: contextOpts, offerings, experiments, checkout, messages, locale: localeOverride, toaster, store, children, }: FunnelProviderProps): ReactNode;
|
|
471
471
|
/**
|
|
472
472
|
* The imperative handle. Does **not** subscribe — use it in event handlers and
|
|
473
473
|
* effects (`useFunnel().responses.set({...})`). For reactive reads use the hooks.
|
|
@@ -638,8 +638,8 @@ declare function useAssets(): Record<string, string>;
|
|
|
638
638
|
declare function useAsset(name: string): string | undefined;
|
|
639
639
|
/** What the renderer injects when mounting a funnel build (SSR and hydration). */
|
|
640
640
|
interface MountOpts {
|
|
641
|
-
/** Platform-resolved
|
|
642
|
-
|
|
641
|
+
/** Platform-resolved offering prices (one currency per visitor). */
|
|
642
|
+
offerings?: OfferingInput[];
|
|
643
643
|
/** Explicit locale override (URL/param/geo); wins over the detected device locale. */
|
|
644
644
|
locale?: string;
|
|
645
645
|
mode?: 'test' | 'live';
|
|
@@ -1082,4 +1082,4 @@ interface ScriptProps {
|
|
|
1082
1082
|
*/
|
|
1083
1083
|
declare function Script({ src, strategy, id, async, defer, nonce, attributes, onLoad, onError, }: ScriptProps): null;
|
|
1084
1084
|
|
|
1085
|
-
export { Acquisition, type
|
|
1085
|
+
export { Acquisition, type AppfunnelBusApi, AssetsContext, AssetsProvider, Back, type BackProps, type BusAccessors, type BusEvent, type CatalogEvent, CheckoutDriver, CheckoutDriverContext, Choice, type ChoiceOption, type ChoiceProps, type CreateFunnelTreeInput, Direction, EVENT_CATALOG, type EventMeta, type EventSource, type Formatters, type Funnel, type FunnelBus, FunnelContext, FunnelDefinition, type FunnelEventDataMap, FunnelProvider, type FunnelProviderProps, FunnelSnapshot, FunnelToaster, FunnelView, type KnownFunnelEvent, type MessageCatalog, Modal, type ModalHandler, type ModalHocProps, type ModalProps, type ModalState, type MountModule, type MountOpts, Namespace, type NavigationState, Next, type NextProps, Offering, OfferingInput, PageContext, PageMeta, type PageModule, type PlatformTrackingConfig, type PluralCategory, RuntimeExperiment, type RuntimePage, Script, type ScriptProps, Sheet, type SheetProps, type SheetSide, type TFunction, type Tracker, type Translation, VariableStore, attachBus, buildContext, createBus, createConsoleTracker, createFunnelStore, createFunnelTree, createPlatformTracker, defineModal, hideModal, integrationEvents, isIntegrationEvent, isTrackableEvent, newEventId, registerModal, removeModal, showModal, unregisterModal, useActiveLocale, useAsset, useAssets, useClickIds, useContextValue, useData, useDevice, useExperiment, useField, useFunnel, useLocale, useModal, useNavigation, useOffering, useOfferings, usePage, useResponse, useSystem, useTracker, useTranslation, useUserAttribute, useUtm, withBus };
|