@appfunnel-dev/sdk 2.0.0-canary.2 → 2.0.0-canary.3
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/{checkout-DiQvRT5q.d.ts → checkout-7Dy6IedP.d.ts} +3 -0
- package/dist/{checkout-CZmEvWfC.d.cts → checkout-Dz8cGkB_.d.cts} +3 -0
- package/dist/{chunk-7UC5VXOR.js → chunk-AKO6XKXP.js} +28 -8
- package/dist/chunk-AKO6XKXP.js.map +1 -0
- package/dist/{chunk-VQOD2Z6Q.cjs → chunk-CY4VBSMX.cjs} +5 -3
- package/dist/chunk-CY4VBSMX.cjs.map +1 -0
- package/dist/{chunk-Z3TWO2PW.cjs → chunk-JSRKA375.cjs} +29 -7
- package/dist/chunk-JSRKA375.cjs.map +1 -0
- package/dist/{chunk-UIR6TGEW.js → chunk-M6U3FNRW.js} +5 -3
- package/dist/chunk-M6U3FNRW.js.map +1 -0
- package/dist/driver-paddle.cjs +14 -14
- package/dist/driver-paddle.d.cts +1 -1
- package/dist/driver-paddle.d.ts +1 -1
- package/dist/driver-paddle.js +1 -1
- package/dist/driver-stripe.cjs +13 -13
- package/dist/driver-stripe.d.cts +1 -1
- package/dist/driver-stripe.d.ts +1 -1
- package/dist/driver-stripe.js +1 -1
- package/dist/index.cjs +56 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/{manifest-DQThneiG.d.cts → manifest-Cr2y1op6.d.cts} +40 -3
- package/dist/{manifest-DQThneiG.d.ts → manifest-Cr2y1op6.d.ts} +40 -3
- package/dist/manifest-entry.cjs +129 -20
- package/dist/manifest-entry.cjs.map +1 -1
- package/dist/manifest-entry.d.cts +28 -3
- package/dist/manifest-entry.d.ts +28 -3
- package/dist/manifest-entry.js +105 -5
- package/dist/manifest-entry.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-7UC5VXOR.js.map +0 -1
- package/dist/chunk-UIR6TGEW.js.map +0 -1
- package/dist/chunk-VQOD2Z6Q.cjs.map +0 -1
- package/dist/chunk-Z3TWO2PW.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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, P as Product, D as Direction, F as FunnelContext, R as RuntimeExperiment, b as FunnelSnapshot, c as FunnelDefinition, d as buildContext, e as ProductInput, f as PageMeta, g as PageContext } from './manifest-
|
|
4
|
-
export { B as BrowserContext, h as BuildContextOptions, C as ClickIdContext, i as CompileInput, j as Condition, k as ConditionOp, l as DeviceContext, E as EdgeCondition, m as ExperimentIssue, n as ExperimentResolution, o as ExperimentValidation, p as ExperimentVariant, q as FlowPage, r as FunnelLocales, s as FunnelManifest, G as Gate, I as IdentityContext, t as Interval, L as LocaleContext, M as ManifestEdge, u as ManifestPage, v as ManifestValidation, w as Money, O as OsContext, x as PageType, y as Predicate, z as ResolvedProduct, H as Route, S as SessionContext, J as SystemContext, U as UtmContext, K as assignVariant, N as bucketingSeed, Q as buildAcquisition, T as buildCatalog, W as compileManifest, X as currencyExponent, Y as defineFunnel, Z as definePage, _ as entryGuard, $ as evaluateCondition, a0 as evaluateGate, a1 as expectedPathLength, a2 as fnv1a, a3 as formatMoney, a4 as formatProduct, a5 as hashToUnit, a6 as isRtl, a7 as isVariantKey, a8 as nextPage, a9 as outgoingKeys, aa as pageMeta, ab as parseSlotKey, ac as pickByWeight, ad as resolveExperiments, ae as resolveLocale, af as resolveProduct, ag as resolveRoute, ah as validateExperiments } from './manifest-
|
|
5
|
-
import { a as CheckoutDriver, C as CheckoutDriverContext } from './checkout-
|
|
6
|
-
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-
|
|
3
|
+
import { V as VariableValue, a as VariableConfig, A as Acquisition, P as Product, D as Direction, F as FunnelContext, R as RuntimeExperiment, b as FunnelSnapshot, c as FunnelDefinition, d as buildContext, e as ProductInput, f as PageMeta, g as PageContext } from './manifest-Cr2y1op6.cjs';
|
|
4
|
+
export { B as BrowserContext, h as BuildContextOptions, C as ClickIdContext, i as CompileInput, j as Condition, k as ConditionOp, l as DeviceContext, E as EdgeCondition, m as ExperimentIssue, n as ExperimentResolution, o as ExperimentValidation, p as ExperimentVariant, q as FlowPage, r as FunnelLocales, s as FunnelManifest, G as Gate, I as IdentityContext, t as Interval, L as LocaleContext, M as ManifestEdge, u as ManifestPage, v as ManifestValidation, w as Money, O as OsContext, x as PageType, y as Predicate, z as ResolvedProduct, H as Route, S as SessionContext, J as SystemContext, U as UtmContext, K as assignVariant, N as bucketingSeed, Q as buildAcquisition, T as buildCatalog, W as compileManifest, X as currencyExponent, Y as defineFunnel, Z as definePage, _ as entryGuard, $ as evaluateCondition, a0 as evaluateGate, a1 as expectedPathLength, a2 as fnv1a, a3 as formatMoney, a4 as formatProduct, a5 as hashToUnit, a6 as isRtl, a7 as isVariantKey, a8 as nextPage, a9 as outgoingKeys, aa as pageMeta, ab as parseSlotKey, ac as pickByWeight, ad as resolveExperiments, ae as resolveLocale, af as resolveProduct, ag as resolveRoute, ah as validateExperiments } from './manifest-Cr2y1op6.cjs';
|
|
5
|
+
import { a as CheckoutDriver, C as CheckoutDriverContext } from './checkout-Dz8cGkB_.cjs';
|
|
6
|
+
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-Dz8cGkB_.cjs';
|
|
7
7
|
import { ToasterProps } from 'sonner';
|
|
8
8
|
export { ToasterProps, toast } from 'sonner';
|
|
9
9
|
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-7_hy5f5G.cjs';
|
|
@@ -518,6 +518,8 @@ interface MountOpts {
|
|
|
518
518
|
initialKey?: string;
|
|
519
519
|
/** Asset map: logical name → content-addressed CDN URL. */
|
|
520
520
|
assets?: Record<string, string>;
|
|
521
|
+
/** Per-locale message catalogs (`messages/<locale>.json`) — overrides the mount's baked-in ones. */
|
|
522
|
+
messages?: MessageCatalog;
|
|
521
523
|
/** The SIGNED anonymous visitor id (bare id, verified server-side; phase-1 §1.2) — the
|
|
522
524
|
* renderer mints/reads the `af_vid` cookie and injects the value here. Feeds
|
|
523
525
|
* `context.identity.visitorId` (experiment bucketing fallback seed, session continuity). */
|
|
@@ -581,6 +583,12 @@ interface CreateFunnelTreeInput {
|
|
|
581
583
|
* resolves the provider's TEST store from it (that's the quarantine, not the client).
|
|
582
584
|
*/
|
|
583
585
|
checkoutDriver?: (ctx: CheckoutDriverContext) => CheckoutDriver;
|
|
586
|
+
/**
|
|
587
|
+
* The funnel's message catalogs (`messages/<locale>.json`), keyed by locale. The generated
|
|
588
|
+
* `mount.tsx` imports the catalogs and passes them here so `t()` resolves at render (SSR + client);
|
|
589
|
+
* `MountOpts.messages` can still override per-request. Omit for funnels with no translations.
|
|
590
|
+
*/
|
|
591
|
+
messages?: MessageCatalog;
|
|
584
592
|
}
|
|
585
593
|
/**
|
|
586
594
|
* Build a funnel's `tree(opts)` — the standard provider stack over your pages.
|
|
@@ -590,7 +598,7 @@ interface CreateFunnelTreeInput {
|
|
|
590
598
|
* export const tree = createFunnelTree({ config, pages, layout: Layout })
|
|
591
599
|
* ```
|
|
592
600
|
*/
|
|
593
|
-
declare function createFunnelTree({ config, pages, layout, checkoutDriver, }: CreateFunnelTreeInput): (opts: MountOpts) => ReactNode;
|
|
601
|
+
declare function createFunnelTree({ config, pages, layout, checkoutDriver, messages, }: CreateFunnelTreeInput): (opts: MountOpts) => ReactNode;
|
|
594
602
|
|
|
595
603
|
/**
|
|
596
604
|
* The two-tier component model (doc 07 §"magic ≠ black box"): the magic lives in
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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, P as Product, D as Direction, F as FunnelContext, R as RuntimeExperiment, b as FunnelSnapshot, c as FunnelDefinition, d as buildContext, e as ProductInput, f as PageMeta, g as PageContext } from './manifest-
|
|
4
|
-
export { B as BrowserContext, h as BuildContextOptions, C as ClickIdContext, i as CompileInput, j as Condition, k as ConditionOp, l as DeviceContext, E as EdgeCondition, m as ExperimentIssue, n as ExperimentResolution, o as ExperimentValidation, p as ExperimentVariant, q as FlowPage, r as FunnelLocales, s as FunnelManifest, G as Gate, I as IdentityContext, t as Interval, L as LocaleContext, M as ManifestEdge, u as ManifestPage, v as ManifestValidation, w as Money, O as OsContext, x as PageType, y as Predicate, z as ResolvedProduct, H as Route, S as SessionContext, J as SystemContext, U as UtmContext, K as assignVariant, N as bucketingSeed, Q as buildAcquisition, T as buildCatalog, W as compileManifest, X as currencyExponent, Y as defineFunnel, Z as definePage, _ as entryGuard, $ as evaluateCondition, a0 as evaluateGate, a1 as expectedPathLength, a2 as fnv1a, a3 as formatMoney, a4 as formatProduct, a5 as hashToUnit, a6 as isRtl, a7 as isVariantKey, a8 as nextPage, a9 as outgoingKeys, aa as pageMeta, ab as parseSlotKey, ac as pickByWeight, ad as resolveExperiments, ae as resolveLocale, af as resolveProduct, ag as resolveRoute, ah as validateExperiments } from './manifest-
|
|
5
|
-
import { a as CheckoutDriver, C as CheckoutDriverContext } from './checkout-
|
|
6
|
-
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-
|
|
3
|
+
import { V as VariableValue, a as VariableConfig, A as Acquisition, P as Product, D as Direction, F as FunnelContext, R as RuntimeExperiment, b as FunnelSnapshot, c as FunnelDefinition, d as buildContext, e as ProductInput, f as PageMeta, g as PageContext } from './manifest-Cr2y1op6.js';
|
|
4
|
+
export { B as BrowserContext, h as BuildContextOptions, C as ClickIdContext, i as CompileInput, j as Condition, k as ConditionOp, l as DeviceContext, E as EdgeCondition, m as ExperimentIssue, n as ExperimentResolution, o as ExperimentValidation, p as ExperimentVariant, q as FlowPage, r as FunnelLocales, s as FunnelManifest, G as Gate, I as IdentityContext, t as Interval, L as LocaleContext, M as ManifestEdge, u as ManifestPage, v as ManifestValidation, w as Money, O as OsContext, x as PageType, y as Predicate, z as ResolvedProduct, H as Route, S as SessionContext, J as SystemContext, U as UtmContext, K as assignVariant, N as bucketingSeed, Q as buildAcquisition, T as buildCatalog, W as compileManifest, X as currencyExponent, Y as defineFunnel, Z as definePage, _ as entryGuard, $ as evaluateCondition, a0 as evaluateGate, a1 as expectedPathLength, a2 as fnv1a, a3 as formatMoney, a4 as formatProduct, a5 as hashToUnit, a6 as isRtl, a7 as isVariantKey, a8 as nextPage, a9 as outgoingKeys, aa as pageMeta, ab as parseSlotKey, ac as pickByWeight, ad as resolveExperiments, ae as resolveLocale, af as resolveProduct, ag as resolveRoute, ah as validateExperiments } from './manifest-Cr2y1op6.js';
|
|
5
|
+
import { a as CheckoutDriver, C as CheckoutDriverContext } from './checkout-7Dy6IedP.js';
|
|
6
|
+
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-7Dy6IedP.js';
|
|
7
7
|
import { ToasterProps } from 'sonner';
|
|
8
8
|
export { ToasterProps, toast } from 'sonner';
|
|
9
9
|
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-7_hy5f5G.js';
|
|
@@ -518,6 +518,8 @@ interface MountOpts {
|
|
|
518
518
|
initialKey?: string;
|
|
519
519
|
/** Asset map: logical name → content-addressed CDN URL. */
|
|
520
520
|
assets?: Record<string, string>;
|
|
521
|
+
/** Per-locale message catalogs (`messages/<locale>.json`) — overrides the mount's baked-in ones. */
|
|
522
|
+
messages?: MessageCatalog;
|
|
521
523
|
/** The SIGNED anonymous visitor id (bare id, verified server-side; phase-1 §1.2) — the
|
|
522
524
|
* renderer mints/reads the `af_vid` cookie and injects the value here. Feeds
|
|
523
525
|
* `context.identity.visitorId` (experiment bucketing fallback seed, session continuity). */
|
|
@@ -581,6 +583,12 @@ interface CreateFunnelTreeInput {
|
|
|
581
583
|
* resolves the provider's TEST store from it (that's the quarantine, not the client).
|
|
582
584
|
*/
|
|
583
585
|
checkoutDriver?: (ctx: CheckoutDriverContext) => CheckoutDriver;
|
|
586
|
+
/**
|
|
587
|
+
* The funnel's message catalogs (`messages/<locale>.json`), keyed by locale. The generated
|
|
588
|
+
* `mount.tsx` imports the catalogs and passes them here so `t()` resolves at render (SSR + client);
|
|
589
|
+
* `MountOpts.messages` can still override per-request. Omit for funnels with no translations.
|
|
590
|
+
*/
|
|
591
|
+
messages?: MessageCatalog;
|
|
584
592
|
}
|
|
585
593
|
/**
|
|
586
594
|
* Build a funnel's `tree(opts)` — the standard provider stack over your pages.
|
|
@@ -590,7 +598,7 @@ interface CreateFunnelTreeInput {
|
|
|
590
598
|
* export const tree = createFunnelTree({ config, pages, layout: Layout })
|
|
591
599
|
* ```
|
|
592
600
|
*/
|
|
593
|
-
declare function createFunnelTree({ config, pages, layout, checkoutDriver, }: CreateFunnelTreeInput): (opts: MountOpts) => ReactNode;
|
|
601
|
+
declare function createFunnelTree({ config, pages, layout, checkoutDriver, messages, }: CreateFunnelTreeInput): (opts: MountOpts) => ReactNode;
|
|
594
602
|
|
|
595
603
|
/**
|
|
596
604
|
* The two-tier component model (doc 07 §"magic ≠ black box"): the magic lives in
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isRtl, formatProduct, bucketingSeed, resolveExperiments, entryGuard, evaluateGate, expectedPathLength, nextPage, outgoingKeys, buildCatalog, resolveLocale } from './chunk-
|
|
2
|
-
export { assignVariant, bucketingSeed, buildCatalog, compileManifest, currencyExponent, defineFunnel, definePage, entryGuard, evaluateCondition, evaluateGate, expectedPathLength, fnv1a, formatMoney, formatProduct, hashToUnit, isRtl, isVariantKey, nextPage, outgoingKeys, pageMeta, parseSlotKey, pickByWeight, resolveExperiments, resolveLocale, resolveProduct, resolveRoute, validateExperiments } from './chunk-
|
|
1
|
+
import { isRtl, formatProduct, bucketingSeed, resolveExperiments, entryGuard, evaluateGate, expectedPathLength, nextPage, outgoingKeys, buildCatalog, resolveLocale } from './chunk-AKO6XKXP.js';
|
|
2
|
+
export { assignVariant, bucketingSeed, buildCatalog, compileManifest, currencyExponent, defineFunnel, definePage, entryGuard, evaluateCondition, evaluateGate, expectedPathLength, fnv1a, formatMoney, formatProduct, hashToUnit, isRtl, isVariantKey, nextPage, outgoingKeys, pageMeta, parseSlotKey, pickByWeight, resolveExperiments, resolveLocale, resolveProduct, resolveRoute, validateExperiments } from './chunk-AKO6XKXP.js';
|
|
3
3
|
import { checkoutError, isInlineSurface, PROVIDER_PROFILES } from './chunk-YY375F2B.js';
|
|
4
4
|
export { INLINE_SURFACES, PROVIDER_PROFILES, checkoutError, isInlineSurface, isMerchantOfRecord, isOrchestrator, surfacesFor, validateCheckout, validateUpsell } from './chunk-YY375F2B.js';
|
|
5
5
|
import React, { createContext, createElement, useCallback, useContext, useMemo, lazy, useRef, useState, useEffect, useTransition, Suspense, Fragment, isValidElement, cloneElement, useReducer, useSyncExternalStore } from 'react';
|
|
@@ -1098,6 +1098,14 @@ function driverWithEmail(driver, getEmail) {
|
|
|
1098
1098
|
renderInline: driver.renderInline ? (req, cb) => driver.renderInline(enrich(req), cb) : void 0
|
|
1099
1099
|
};
|
|
1100
1100
|
}
|
|
1101
|
+
function driverWithCatalog(driver, catalog) {
|
|
1102
|
+
const enrich = (req) => req.catalogKey !== void 0 ? req : { ...req, catalogKey: catalog.get(req.product)?.catalogKey };
|
|
1103
|
+
return {
|
|
1104
|
+
...driver,
|
|
1105
|
+
start: (req) => driver.start(enrich(req)),
|
|
1106
|
+
renderInline: driver.renderInline ? (req, cb) => driver.renderInline(enrich(req), cb) : void 0
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1101
1109
|
var DriverContext = createContext(null);
|
|
1102
1110
|
function CheckoutDriverProvider({
|
|
1103
1111
|
driver,
|
|
@@ -2567,12 +2575,15 @@ function FunnelProvider({
|
|
|
2567
2575
|
const value2 = s.get("user.email");
|
|
2568
2576
|
return typeof value2 === "string" && /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(value2) ? value2 : void 0;
|
|
2569
2577
|
};
|
|
2578
|
+
const catalog = buildCatalog(products ?? []);
|
|
2570
2579
|
return {
|
|
2571
2580
|
funnel: createFunnel(s, ctx, busTracker, experiments ?? []),
|
|
2572
2581
|
store: s,
|
|
2573
2582
|
context: ctx,
|
|
2574
|
-
catalog
|
|
2575
|
-
|
|
2583
|
+
catalog,
|
|
2584
|
+
// Slot → catalog-key resolution wraps the email-enriching driver, so the wire charges the real
|
|
2585
|
+
// catalog key while pages + analytics keep the durable SLOT identity (req.product).
|
|
2586
|
+
driver: driverWithCatalog(driverWithEmail(checkout ?? createMockDriver(), emailForCheckout), catalog),
|
|
2576
2587
|
tracker: busTracker,
|
|
2577
2588
|
bus
|
|
2578
2589
|
};
|
|
@@ -2844,7 +2855,8 @@ function createFunnelTree({
|
|
|
2844
2855
|
config,
|
|
2845
2856
|
pages,
|
|
2846
2857
|
layout,
|
|
2847
|
-
checkoutDriver
|
|
2858
|
+
checkoutDriver,
|
|
2859
|
+
messages
|
|
2848
2860
|
}) {
|
|
2849
2861
|
return function tree(opts) {
|
|
2850
2862
|
const mode = opts.mode ?? "live";
|
|
@@ -2877,6 +2889,7 @@ function createFunnelTree({
|
|
|
2877
2889
|
children: createElement(FunnelProvider, {
|
|
2878
2890
|
config,
|
|
2879
2891
|
products: opts.products ?? [],
|
|
2892
|
+
messages: opts.messages ?? messages,
|
|
2880
2893
|
locale: opts.locale,
|
|
2881
2894
|
tracker,
|
|
2882
2895
|
checkout,
|