@aifeatures/react 0.7.1 → 0.9.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 +73 -0
- package/dist/consent-reader.cjs +1 -0
- package/dist/consent-reader.d.cts +130 -0
- package/dist/consent-reader.d.ts +130 -0
- package/dist/consent-reader.js +1 -0
- package/dist/index.cjs +8 -1
- package/dist/index.d.cts +670 -23
- package/dist/index.d.ts +670 -23
- package/dist/index.js +8 -1
- package/package.json +20 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,55 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
3
3
|
|
|
4
|
+
interface AifeaturesProviderProps {
|
|
5
|
+
/** Public feature API base, such as `/_ls` for the current site's origin. */
|
|
6
|
+
apiUrl: string;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Configures forms, commerce, and customer-account requests for descendants.
|
|
11
|
+
* ConsentProvider keeps its independent API configuration.
|
|
12
|
+
*/
|
|
13
|
+
declare function AifeaturesProvider({ apiUrl, children }: AifeaturesProviderProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
declare namespace AifeaturesProvider {
|
|
15
|
+
var neverConsentGate: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolves an explicit override, then the nearest provider, then the existing
|
|
19
|
+
* platform default. Relative bases remain relative, including during SSR.
|
|
20
|
+
* Use this for authored form actions/fetches as well as package components.
|
|
21
|
+
*/
|
|
22
|
+
declare function useAifeaturesApiUrl(explicitApiUrl?: string): string;
|
|
23
|
+
|
|
24
|
+
type AifeaturesCaptchaStatus =
|
|
25
|
+
/** Fetching the form's config; nothing rendered yet. */
|
|
26
|
+
'loading'
|
|
27
|
+
/** The widget is on the page and the check is running or awaiting a click. */
|
|
28
|
+
| 'ready'
|
|
29
|
+
/** A token is in the form. */
|
|
30
|
+
| 'verified'
|
|
31
|
+
/**
|
|
32
|
+
* The check cannot run in this browser: the config endpoint was
|
|
33
|
+
* unreachable, or the Turnstile script never rendered a widget — almost
|
|
34
|
+
* always an ad blocker, privacy extension, or network filter. The
|
|
35
|
+
* component shows its own notice with a retry for this state.
|
|
36
|
+
*/
|
|
37
|
+
| 'blocked';
|
|
4
38
|
interface AifeaturesCaptchaProps {
|
|
5
39
|
/** Form ID from aifeatures - used to fetch the Turnstile sitekey */
|
|
6
40
|
formId: string;
|
|
7
|
-
/**
|
|
41
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
8
42
|
apiUrl?: string;
|
|
9
43
|
/** Called when CAPTCHA verification succeeds */
|
|
10
44
|
onVerify?: (token: string) => void;
|
|
11
45
|
/** Called when CAPTCHA verification fails or expires */
|
|
12
46
|
onError?: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Called on every status change. Use it to word the form's own submit
|
|
49
|
+
* message (a `blocked` visitor cannot submit until the check loads) or to
|
|
50
|
+
* surface a fallback contact path. See `AifeaturesCaptchaStatus`.
|
|
51
|
+
*/
|
|
52
|
+
onStatusChange?: (status: AifeaturesCaptchaStatus) => void;
|
|
13
53
|
/** Additional class name for the container */
|
|
14
54
|
className?: string;
|
|
15
55
|
}
|
|
@@ -27,6 +67,16 @@ interface AifeaturesCaptchaProps {
|
|
|
27
67
|
* — invisible has no interactive escape hatch, so a visitor it cannot clear
|
|
28
68
|
* silently loses the ability to submit at all.
|
|
29
69
|
*
|
|
70
|
+
* There is one more way a visitor can lose the ability to submit: the check
|
|
71
|
+
* never loads at all, because an ad blocker, privacy extension, or network
|
|
72
|
+
* filter stops `challenges.cloudflare.com` (or the config request). Nothing
|
|
73
|
+
* draws, no token ever arrives, and a form that waits for one waits forever.
|
|
74
|
+
* The component watches for that and renders its own notice — what happened,
|
|
75
|
+
* and a "Try again" that re-fetches the config and remounts the widget — so
|
|
76
|
+
* the visitor is never left staring at a form that silently cannot send.
|
|
77
|
+
* Forms that track the token themselves should never tell the visitor to
|
|
78
|
+
* wait; read `onStatusChange` and offer a fallback (phone, email) instead.
|
|
79
|
+
*
|
|
30
80
|
* @example
|
|
31
81
|
* ```tsx
|
|
32
82
|
* <form action={`https://aifeatures.dev/f/${formId}`} method="POST">
|
|
@@ -37,7 +87,10 @@ interface AifeaturesCaptchaProps {
|
|
|
37
87
|
* </form>
|
|
38
88
|
* ```
|
|
39
89
|
*/
|
|
40
|
-
declare function AifeaturesCaptcha({ formId, apiUrl, onVerify, onError, className, }: AifeaturesCaptchaProps): react_jsx_runtime.JSX.Element | null;
|
|
90
|
+
declare function AifeaturesCaptcha({ formId, apiUrl: explicitApiUrl, onVerify, onError, onStatusChange, className, }: AifeaturesCaptchaProps): react_jsx_runtime.JSX.Element | null;
|
|
91
|
+
declare namespace AifeaturesCaptcha {
|
|
92
|
+
var neverConsentGate: string;
|
|
93
|
+
}
|
|
41
94
|
|
|
42
95
|
/** One selectable value of an option (e.g. "L" of "Size"). */
|
|
43
96
|
interface PublicOptionValue {
|
|
@@ -240,7 +293,7 @@ interface PublicProduct {
|
|
|
240
293
|
subscription?: PublicProductSubscription | null;
|
|
241
294
|
}
|
|
242
295
|
interface UseProductOptions {
|
|
243
|
-
/**
|
|
296
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
244
297
|
apiUrl?: string;
|
|
245
298
|
/**
|
|
246
299
|
* Buyer-declared market country (ISO 3166-1 alpha-2) — pass `useMarket()`'s
|
|
@@ -420,7 +473,7 @@ declare function selectedImages(product: Pick<PublicProduct, 'options' | 'images
|
|
|
420
473
|
declare function applySelectionToUrl(product: Pick<PublicProduct, 'options'>, selection: VariantSelection): void;
|
|
421
474
|
|
|
422
475
|
interface UseCheckoutOptions {
|
|
423
|
-
/**
|
|
476
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
424
477
|
apiUrl?: string;
|
|
425
478
|
}
|
|
426
479
|
interface StartCheckoutOptions {
|
|
@@ -629,7 +682,7 @@ interface CartItemLine extends CartLine {
|
|
|
629
682
|
status: CartLineStatus;
|
|
630
683
|
}
|
|
631
684
|
interface UseCartItemsOptions {
|
|
632
|
-
/**
|
|
685
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
633
686
|
apiUrl?: string;
|
|
634
687
|
}
|
|
635
688
|
interface UseCartItemsResult {
|
|
@@ -772,7 +825,7 @@ interface CartSummary {
|
|
|
772
825
|
tax: CartSummaryTax | null;
|
|
773
826
|
}
|
|
774
827
|
interface UseCartSummaryOptions {
|
|
775
|
-
/**
|
|
828
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
776
829
|
apiUrl?: string;
|
|
777
830
|
/**
|
|
778
831
|
* Milliseconds to wait after a cart change before pricing it. Quantity
|
|
@@ -814,7 +867,7 @@ interface UseCartSummaryResult {
|
|
|
814
867
|
declare function useCartSummary(options?: UseCartSummaryOptions): UseCartSummaryResult;
|
|
815
868
|
|
|
816
869
|
interface UseCartCheckoutOptions {
|
|
817
|
-
/**
|
|
870
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
818
871
|
apiUrl?: string;
|
|
819
872
|
}
|
|
820
873
|
/**
|
|
@@ -931,7 +984,7 @@ interface MarketCountry {
|
|
|
931
984
|
*/
|
|
932
985
|
declare const MARKET_COUNTRIES: readonly MarketCountry[];
|
|
933
986
|
interface UseMarketOptions {
|
|
934
|
-
/**
|
|
987
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
935
988
|
apiUrl?: string;
|
|
936
989
|
}
|
|
937
990
|
interface UseMarketResult {
|
|
@@ -977,7 +1030,7 @@ interface ProductPriceProps {
|
|
|
977
1030
|
* the price tracks the buyer's selection.
|
|
978
1031
|
*/
|
|
979
1032
|
variantId?: string;
|
|
980
|
-
/**
|
|
1033
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
981
1034
|
apiUrl?: string;
|
|
982
1035
|
/** Optional BCP 47 locale for formatting (defaults to the browser locale) */
|
|
983
1036
|
locale?: string;
|
|
@@ -1001,6 +1054,9 @@ interface ProductPriceProps {
|
|
|
1001
1054
|
* (which have no fixed price).
|
|
1002
1055
|
*/
|
|
1003
1056
|
declare function ProductPrice({ productId, variantId, apiUrl, locale, className, style, compareAtClassName, }: ProductPriceProps): react_jsx_runtime.JSX.Element | null;
|
|
1057
|
+
declare namespace ProductPrice {
|
|
1058
|
+
var neverConsentGate: string;
|
|
1059
|
+
}
|
|
1004
1060
|
|
|
1005
1061
|
interface VariantPickerProps {
|
|
1006
1062
|
/** The product's option axes (from `useProduct` / GET /v1/p/:id). */
|
|
@@ -1068,6 +1124,9 @@ interface VariantPickerProps {
|
|
|
1068
1124
|
* data-available attributes) to match the site's design.
|
|
1069
1125
|
*/
|
|
1070
1126
|
declare function VariantPicker({ options, variants, value, syncUrl, onChange, onVariantChange, className, style, optionClassName, optionLabelClassName, valueClassName, selectedValueClassName, unavailableValueClassName, swatchClassName, }: VariantPickerProps): react_jsx_runtime.JSX.Element | null;
|
|
1127
|
+
declare namespace VariantPicker {
|
|
1128
|
+
var neverConsentGate: string;
|
|
1129
|
+
}
|
|
1071
1130
|
|
|
1072
1131
|
interface BuyButtonProps {
|
|
1073
1132
|
/** Product ID from aifeatures */
|
|
@@ -1099,7 +1158,7 @@ interface BuyButtonProps {
|
|
|
1099
1158
|
cancelUrl?: string;
|
|
1100
1159
|
/** Prefills the email field on the Stripe Checkout page. */
|
|
1101
1160
|
customerEmail?: string;
|
|
1102
|
-
/**
|
|
1161
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
1103
1162
|
apiUrl?: string;
|
|
1104
1163
|
/** Force-disable the button (combined with the automatic disabled states). */
|
|
1105
1164
|
disabled?: boolean;
|
|
@@ -1131,6 +1190,9 @@ interface BuyButtonProps {
|
|
|
1131
1190
|
* Unstyled by default — pass className/style to match the site's design.
|
|
1132
1191
|
*/
|
|
1133
1192
|
declare function BuyButton({ productId, variantId, quantity, planId, amount, metadata, successUrl, cancelUrl, customerEmail, apiUrl, disabled, className, style, errorClassName, spinner, children, }: BuyButtonProps): react_jsx_runtime.JSX.Element;
|
|
1193
|
+
declare namespace BuyButton {
|
|
1194
|
+
var neverConsentGate: string;
|
|
1195
|
+
}
|
|
1134
1196
|
|
|
1135
1197
|
interface AddToCartButtonProps {
|
|
1136
1198
|
/** Product ID from aifeatures */
|
|
@@ -1151,7 +1213,7 @@ interface AddToCartButtonProps {
|
|
|
1151
1213
|
selection?: VariantSelection;
|
|
1152
1214
|
/** Units to add per click (default 1). */
|
|
1153
1215
|
quantity?: number;
|
|
1154
|
-
/**
|
|
1216
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
1155
1217
|
apiUrl?: string;
|
|
1156
1218
|
/** Force-disable the button (combined with the automatic disabled states). */
|
|
1157
1219
|
disabled?: boolean;
|
|
@@ -1188,9 +1250,12 @@ interface AddToCartButtonProps {
|
|
|
1188
1250
|
* role="alert". Unstyled by default — pass className/style.
|
|
1189
1251
|
*/
|
|
1190
1252
|
declare function AddToCartButton({ productId, variantId, selection, quantity, apiUrl, disabled, className, style, errorClassName, spinner, children, }: AddToCartButtonProps): react_jsx_runtime.JSX.Element;
|
|
1253
|
+
declare namespace AddToCartButton {
|
|
1254
|
+
var neverConsentGate: string;
|
|
1255
|
+
}
|
|
1191
1256
|
|
|
1192
1257
|
interface CartCheckoutButtonProps {
|
|
1193
|
-
/**
|
|
1258
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
1194
1259
|
apiUrl?: string;
|
|
1195
1260
|
/** Defaults to `${window.location.origin}/order/confirmation`. */
|
|
1196
1261
|
successUrl?: string;
|
|
@@ -1237,6 +1302,9 @@ interface CartCheckoutButtonProps {
|
|
|
1237
1302
|
* `conflicts`) is the site's job. Unstyled by default — pass className/style.
|
|
1238
1303
|
*/
|
|
1239
1304
|
declare function CartCheckoutButton({ apiUrl, successUrl, cancelUrl, customerEmail, metadata, shippingOption, disabled, className, style, errorClassName, spinner, children, }: CartCheckoutButtonProps): react_jsx_runtime.JSX.Element;
|
|
1305
|
+
declare namespace CartCheckoutButton {
|
|
1306
|
+
var neverConsentGate: string;
|
|
1307
|
+
}
|
|
1240
1308
|
|
|
1241
1309
|
type OrderStatus = "pending" | "paid" | "failed" | "expired" | "refunded" | "partially_refunded" | "disputed";
|
|
1242
1310
|
interface OrderFulfillment {
|
|
@@ -1382,7 +1450,7 @@ interface OrderSession {
|
|
|
1382
1450
|
subscription?: OrderSessionSubscription;
|
|
1383
1451
|
}
|
|
1384
1452
|
interface OrderConfirmationProps {
|
|
1385
|
-
/**
|
|
1453
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
1386
1454
|
apiUrl?: string;
|
|
1387
1455
|
/** Class name for the container of the default-rendered states */
|
|
1388
1456
|
className?: string;
|
|
@@ -1419,7 +1487,557 @@ interface OrderConfirmationProps {
|
|
|
1419
1487
|
/** Rendered for failed/expired (and refunded/disputed) orders */
|
|
1420
1488
|
renderFailed?: (session: OrderSession) => ReactNode;
|
|
1421
1489
|
}
|
|
1422
|
-
declare function OrderConfirmation({ apiUrl, className, style, sessionId: sessionIdProp, pollIntervalMs, pollTimeoutMs, followRedirect, redirectDelayMs, renderNoSession, renderPending, renderPaid, renderFailed, }: OrderConfirmationProps): react_jsx_runtime.JSX.Element | null;
|
|
1490
|
+
declare function OrderConfirmation({ apiUrl: explicitApiUrl, className, style, sessionId: sessionIdProp, pollIntervalMs, pollTimeoutMs, followRedirect, redirectDelayMs, renderNoSession, renderPending, renderPaid, renderFailed, }: OrderConfirmationProps): react_jsx_runtime.JSX.Element | null;
|
|
1491
|
+
declare namespace OrderConfirmation {
|
|
1492
|
+
var neverConsentGate: string;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* INTERNAL module — not exported from the package index (cartStorage
|
|
1497
|
+
* convention). The single storage seam for the visitor's consent choice. The
|
|
1498
|
+
* storage MEDIUM is chosen by HOST CLASS, and the two are never mixed:
|
|
1499
|
+
*
|
|
1500
|
+
* - PLATFORM SHARED HOSTS (getlandingsite.com, landingsite.dev, agncy.dev,
|
|
1501
|
+
* agcy.dev — many unrelated tenants under one suffix, none of it on the
|
|
1502
|
+
* Public Suffix List): PER-ORIGIN storage is authoritative and NO consent
|
|
1503
|
+
* cookie is written or read at all. localStorage first, sessionStorage
|
|
1504
|
+
* when localStorage is unavailable or refuses the write (same per-origin,
|
|
1505
|
+
* untossable property; it keeps the choice usable for the session). A
|
|
1506
|
+
* per-origin store cannot be written by a sibling tenant, and with no
|
|
1507
|
+
* cookie there is nothing for one to plant. Nothing is lost by dropping
|
|
1508
|
+
* the cookie here: one of these hosts serves ONE site, so there is no
|
|
1509
|
+
* www/apex split and no cross-subdomain sharing to preserve.
|
|
1510
|
+
* When neither store is writable nothing persists — the banner appears on
|
|
1511
|
+
* every load (fail-closed and honest) and a one-time console.warn makes
|
|
1512
|
+
* that diagnosable.
|
|
1513
|
+
* - EVERY OTHER HOST (custom domains, landingsite.ai, ...): the first-party
|
|
1514
|
+
* cookie `af-consent-${configId}` scoped to the registrable domain is
|
|
1515
|
+
* authoritative. Per-config-id names (nanoid's A-Za-z0-9_- alphabet is
|
|
1516
|
+
* cookie-name-safe, asserted in consentCookieName) mean two sites sharing
|
|
1517
|
+
* a registrable domain hold two distinct cookies that can never clobber
|
|
1518
|
+
* each other, and every write/clear here touches ONLY the caller's own
|
|
1519
|
+
* name. The domain scope survives the www/apex split and propagates across
|
|
1520
|
+
* subdomains — all of which belong to the site's owner, so the cookie is
|
|
1521
|
+
* honored as written. The registrable domain is derived conservatively by
|
|
1522
|
+
* try-set-and-verify (below), never from a bundled public-suffix list.
|
|
1523
|
+
* localStorage carries a MIRROR of the value — the change-notification
|
|
1524
|
+
* channel (`storage` events never fire for cookies). When the cookie is
|
|
1525
|
+
* absent, only rejection-only mirrors may be rescued: another subdomain
|
|
1526
|
+
* may have revoked an old origin mirror's grants before cookie eviction.
|
|
1527
|
+
* - Reads validate FAIL-CLOSED (R3/R13/D8). Malformed, unsupported, and
|
|
1528
|
+
* unverified values stay in place until replaced by a choice or explicitly
|
|
1529
|
+
* cleared. Deleting their evidence would let the next load treat a prior
|
|
1530
|
+
* rejection as a new visitor's opt-out permission. Genuine expiry alone
|
|
1531
|
+
* returns to first-visit policy and may be cleaned up.
|
|
1532
|
+
* - ONE access path serves every reader: readConsentRecord (may clear),
|
|
1533
|
+
* peekConsentRecord and peekConsentStatus (never write, never clear) all
|
|
1534
|
+
* classify through inspectStoredRecord, so the exported reader and the
|
|
1535
|
+
* engine can never disagree about what a stored value means.
|
|
1536
|
+
* - Geography is NEVER stored (origin geo purpose-limitation): the record is
|
|
1537
|
+
* `cid` is the site's consent config id (tenant isolation), not a location.
|
|
1538
|
+
* Optional revision and GPC-override provenance describe the choice.
|
|
1539
|
+
*/
|
|
1540
|
+
type ConsentCategory = 'functional' | 'analytics' | 'advertising';
|
|
1541
|
+
interface ConsentGrants {
|
|
1542
|
+
functional: boolean;
|
|
1543
|
+
analytics: boolean;
|
|
1544
|
+
advertising: boolean;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
/** Site-owned facts used by the consent UI and the website maintenance agent. */
|
|
1548
|
+
interface ConsentIntegration {
|
|
1549
|
+
id: string;
|
|
1550
|
+
vendor: string;
|
|
1551
|
+
categories: readonly ConsentCategory[];
|
|
1552
|
+
purpose: string;
|
|
1553
|
+
/** Repo-relative location of the integration, for inspection and repair. */
|
|
1554
|
+
source: string;
|
|
1555
|
+
policyUrl?: string;
|
|
1556
|
+
storage?: string;
|
|
1557
|
+
}
|
|
1558
|
+
interface ConsentManifest {
|
|
1559
|
+
/** Change for a new recipient or materially changed purpose, not styling. */
|
|
1560
|
+
revision: string;
|
|
1561
|
+
/** Published same-site path; keeps disclosures available on returning visits. */
|
|
1562
|
+
policyPath: string;
|
|
1563
|
+
integrations: readonly ConsentIntegration[];
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
/** Shared reference copy; legal approval is tracked separately from source. */
|
|
1567
|
+
interface ConsentDisclosureStrings {
|
|
1568
|
+
/** Optional shared fallback for copy that is accurate in every regime.
|
|
1569
|
+
* For translated permission explanations, supply all three variants below. */
|
|
1570
|
+
beforeLink?: string;
|
|
1571
|
+
/** Optional services wait for permission. */
|
|
1572
|
+
beforeLinkStrict?: string;
|
|
1573
|
+
/** Functional services may run; analytics and advertising wait. */
|
|
1574
|
+
beforeLinkStrictTrackers?: string;
|
|
1575
|
+
/** Optional services may run before a choice, with standing opt-out controls. */
|
|
1576
|
+
beforeLinkOptOut?: string;
|
|
1577
|
+
linkText: string;
|
|
1578
|
+
afterLink: string;
|
|
1579
|
+
}
|
|
1580
|
+
interface ConsentBannerDisclosureProps {
|
|
1581
|
+
strings?: Partial<ConsentDisclosureStrings>;
|
|
1582
|
+
className?: string;
|
|
1583
|
+
style?: CSSProperties;
|
|
1584
|
+
}
|
|
1585
|
+
/** Permission-aware disclosure shared by custom layouts and the fallback. */
|
|
1586
|
+
declare function ConsentBannerDisclosure({ strings, className, style }: ConsentBannerDisclosureProps): react_jsx_runtime.JSX.Element;
|
|
1587
|
+
declare namespace ConsentBannerDisclosure {
|
|
1588
|
+
var displayName: string;
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* PUBLIC SHAPE — mirrored by hand. Changing the props here means updating
|
|
1592
|
+
* landingsite-modal agent/test/fixtures/aifeatures-react.d.ts, which is what
|
|
1593
|
+
* type-checks the snippets the site-builder agent emits. CI there catches a
|
|
1594
|
+
* snippet that disagrees with the mirror; nothing catches the mirror
|
|
1595
|
+
* disagreeing with THIS file except someone remembering it exists.
|
|
1596
|
+
*/
|
|
1597
|
+
interface ConsentBannerProps {
|
|
1598
|
+
/** Agent-authored first layer for the strict shape — must contain
|
|
1599
|
+
* `ConsentBanner.AcceptAll`, `ConsentBanner.RejectAll`, and
|
|
1600
|
+
* `ConsentBanner.Preferences` among its descendants. */
|
|
1601
|
+
strict?: ReactNode;
|
|
1602
|
+
/** Agent-authored first layer for the soft shape — must contain
|
|
1603
|
+
* `ConsentBanner.AcceptAll` and `ConsentBanner.Preferences`.
|
|
1604
|
+
*
|
|
1605
|
+
* Only ever painted under mode `adaptive-with-notice`: the default
|
|
1606
|
+
* `adaptive` shows no first layer outside the opt-in regions, so sites
|
|
1607
|
+
* that never opt in leave this undefined. Flipping the mode on without
|
|
1608
|
+
* authoring it falls back to the built-in bar — usable, but not site-styled,
|
|
1609
|
+
* which is why the guidance pairs the mode change with authoring this. */
|
|
1610
|
+
soft?: ReactNode;
|
|
1611
|
+
className?: string;
|
|
1612
|
+
style?: CSSProperties;
|
|
1613
|
+
'aria-label'?: string;
|
|
1614
|
+
}
|
|
1615
|
+
interface SlotButtonProps {
|
|
1616
|
+
children?: ReactNode;
|
|
1617
|
+
className?: string;
|
|
1618
|
+
style?: CSSProperties;
|
|
1619
|
+
}
|
|
1620
|
+
/** Free-form content area for the agent-authored layer — a plain container
|
|
1621
|
+
* carrying no wiring; present for symmetry with the action slots. */
|
|
1622
|
+
declare function ConsentBannerContent({ children, className, style, }: SlotButtonProps): react_jsx_runtime.JSX.Element;
|
|
1623
|
+
declare namespace ConsentBannerContent {
|
|
1624
|
+
var displayName: string;
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* The first consent layer (R1/R9). The agent authors BOTH shapes — strict
|
|
1628
|
+
* (equal-prominence Accept All / Reject All + Preferences) and soft (Accept +
|
|
1629
|
+
* Preferences link) — via the `strict` / `soft` props; the engine picks the
|
|
1630
|
+
* one matching the shape verdict resolved for this visitor, and the painted
|
|
1631
|
+
* shape never swaps. The slot subcomponents carry the wiring (actions, focus,
|
|
1632
|
+
* keyboard, ARIA); the agent supplies labels and styling.
|
|
1633
|
+
*
|
|
1634
|
+
* Structural floor: after mount the banner verifies the active shape's
|
|
1635
|
+
* mandatory slots are present among its rendered descendants; when a slot is
|
|
1636
|
+
* missing (or no markup was authored for the active shape) it renders the
|
|
1637
|
+
* built-in, neutrally-styled default banner with the canonical copy instead.
|
|
1638
|
+
*
|
|
1639
|
+
* Non-blocking by contract: a fixed bar, no overlay, no dismiss control, and
|
|
1640
|
+
* Escape does nothing — the page stays fully usable and ignoring the banner
|
|
1641
|
+
* leaves the current geographic permission policy in place.
|
|
1642
|
+
*
|
|
1643
|
+
* @example
|
|
1644
|
+
* ```tsx
|
|
1645
|
+
* <ConsentBanner
|
|
1646
|
+
* strict={
|
|
1647
|
+
* <ConsentBanner.Content>
|
|
1648
|
+
* <p>...translated disclosure...</p>
|
|
1649
|
+
* <ConsentBanner.AcceptAll>Accept all</ConsentBanner.AcceptAll>
|
|
1650
|
+
* <ConsentBanner.RejectAll>Use only necessary</ConsentBanner.RejectAll>
|
|
1651
|
+
* <ConsentBanner.Preferences>Preferences</ConsentBanner.Preferences>
|
|
1652
|
+
* </ConsentBanner.Content>
|
|
1653
|
+
* }
|
|
1654
|
+
* soft={
|
|
1655
|
+
* <ConsentBanner.Content>
|
|
1656
|
+
* <p>...translated disclosure...</p>
|
|
1657
|
+
* <ConsentBanner.AcceptAll>Accept</ConsentBanner.AcceptAll>
|
|
1658
|
+
* <ConsentBanner.Preferences>Preferences</ConsentBanner.Preferences>
|
|
1659
|
+
* </ConsentBanner.Content>
|
|
1660
|
+
* }
|
|
1661
|
+
* />
|
|
1662
|
+
* ```
|
|
1663
|
+
*/
|
|
1664
|
+
declare function ConsentBanner({ strict, soft, className, style, 'aria-label': ariaLabel, }: ConsentBannerProps): react_jsx_runtime.JSX.Element | null;
|
|
1665
|
+
declare namespace ConsentBanner {
|
|
1666
|
+
var AcceptAll: {
|
|
1667
|
+
({ children, className, style }: SlotButtonProps): react_jsx_runtime.JSX.Element;
|
|
1668
|
+
displayName: string;
|
|
1669
|
+
};
|
|
1670
|
+
var RejectAll: {
|
|
1671
|
+
({ children, className, style }: SlotButtonProps): react_jsx_runtime.JSX.Element;
|
|
1672
|
+
displayName: string;
|
|
1673
|
+
};
|
|
1674
|
+
var Preferences: {
|
|
1675
|
+
({ children, className, style }: SlotButtonProps): react_jsx_runtime.JSX.Element;
|
|
1676
|
+
displayName: string;
|
|
1677
|
+
};
|
|
1678
|
+
var Content: typeof ConsentBannerContent;
|
|
1679
|
+
var Disclosure: typeof ConsentBannerDisclosure;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
type PreferencesStrings = typeof DEFAULT_PREFERENCES_STRINGS;
|
|
1683
|
+
declare const DEFAULT_PREFERENCES_STRINGS: {
|
|
1684
|
+
title: string;
|
|
1685
|
+
description: string;
|
|
1686
|
+
essentialLabel: string;
|
|
1687
|
+
essentialDescription: string;
|
|
1688
|
+
essentialAlwaysActive: string;
|
|
1689
|
+
functionalLabel: string;
|
|
1690
|
+
functionalDescription: string;
|
|
1691
|
+
analyticsLabel: string;
|
|
1692
|
+
analyticsDescription: string;
|
|
1693
|
+
advertisingLabel: string;
|
|
1694
|
+
advertisingDescription: string;
|
|
1695
|
+
allowAll: string;
|
|
1696
|
+
declineAll: string;
|
|
1697
|
+
save: string;
|
|
1698
|
+
close: string;
|
|
1699
|
+
policyLink: string;
|
|
1700
|
+
categoryScope: string;
|
|
1701
|
+
gpcOverrideDescription: string;
|
|
1702
|
+
gpcOverrideLabel: string;
|
|
1703
|
+
gpcOverridden: string;
|
|
1704
|
+
/**
|
|
1705
|
+
* Shown only while a Global Privacy Control signal is present. This is a
|
|
1706
|
+
* REGULATORY string, not decoration: 11 CCR §7025(c)(6) took effect
|
|
1707
|
+
* 2026-01-01 and requires a business that processes an opt-out preference
|
|
1708
|
+
* signal to display that it did so. The wording follows the regulation's own
|
|
1709
|
+
* example, "Opt-Out Request Honored", rather than the "Opt-Out Preference
|
|
1710
|
+
* Signal Honored" phrasing that circulates in secondary summaries.
|
|
1711
|
+
*
|
|
1712
|
+
* Translatable like every other string here — the DUTY is to tell the
|
|
1713
|
+
* visitor, not to say it in English.
|
|
1714
|
+
*/
|
|
1715
|
+
gpcHonored: string;
|
|
1716
|
+
};
|
|
1717
|
+
interface ConsentThemeTokens {
|
|
1718
|
+
/** Panel background color (hex). */
|
|
1719
|
+
background?: string;
|
|
1720
|
+
/** Panel text color (hex). */
|
|
1721
|
+
text?: string;
|
|
1722
|
+
/** Panel border color (hex). */
|
|
1723
|
+
border?: string;
|
|
1724
|
+
/** Primary action (Allow all) background color (hex). */
|
|
1725
|
+
primaryBackground?: string;
|
|
1726
|
+
/** Primary action (Allow all) text color (hex). */
|
|
1727
|
+
primaryText?: string;
|
|
1728
|
+
/** Backdrop color (any CSS color). */
|
|
1729
|
+
overlay?: string;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* PUBLIC SHAPE — mirrored by hand. Changing the props here means updating
|
|
1733
|
+
* landingsite-modal agent/test/fixtures/aifeatures-react.d.ts, which is what
|
|
1734
|
+
* type-checks the snippets the site-builder agent emits. CI there catches a
|
|
1735
|
+
* snippet that disagrees with the mirror; nothing catches the mirror
|
|
1736
|
+
* disagreeing with THIS file except someone remembering it exists.
|
|
1737
|
+
*/
|
|
1738
|
+
interface PreferencesPanelProps {
|
|
1739
|
+
/** Per-string overrides — the agent fills these with site-language
|
|
1740
|
+
* translations; structure and behavior are fixed regardless (R7). */
|
|
1741
|
+
strings?: Partial<PreferencesStrings>;
|
|
1742
|
+
/** CSS-variable theme tokens from the site's palette. The primary action
|
|
1743
|
+
* pair is contrast-clamped: below 4.5:1 it falls back to the defaults. */
|
|
1744
|
+
theme?: ConsentThemeTokens;
|
|
1745
|
+
className?: string;
|
|
1746
|
+
/** @internal Provider-rendered fallback instance — skips registration. */
|
|
1747
|
+
__fallback?: boolean;
|
|
1748
|
+
}
|
|
1749
|
+
/**
|
|
1750
|
+
* The standardized Preferences layer (R7) — component-rendered, never
|
|
1751
|
+
* AI-authored: per-category toggles (essential shows "Always active"), Allow
|
|
1752
|
+
* All / Decline All (apply + persist + close immediately), Save (persist the
|
|
1753
|
+
* current toggles + close), and a close control that discards unsaved
|
|
1754
|
+
* changes. First open shows every non-essential toggle OFF; re-open
|
|
1755
|
+
* pre-populates from the stored choice. Renders as a focus-trapped modal
|
|
1756
|
+
* (bottom sheet on small viewports); the provider opens it via
|
|
1757
|
+
* `openPreferences()` and returns focus to the invoking control on close.
|
|
1758
|
+
*
|
|
1759
|
+
* Mount it once inside the provider to customize strings/theme — when no
|
|
1760
|
+
* instance is mounted the provider renders this component itself with
|
|
1761
|
+
* defaults, so Preferences is always reachable.
|
|
1762
|
+
*
|
|
1763
|
+
* @example
|
|
1764
|
+
* ```tsx
|
|
1765
|
+
* <PreferencesPanel
|
|
1766
|
+
* strings={{ title: 'Cookie-Einstellungen', allowAll: 'Alle erlauben' }}
|
|
1767
|
+
* theme={{ primaryBackground: '#0f766e', primaryText: '#ffffff' }}
|
|
1768
|
+
* />
|
|
1769
|
+
* ```
|
|
1770
|
+
*/
|
|
1771
|
+
declare function PreferencesPanel({ strings, theme, className, __fallback, }: PreferencesPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
1772
|
+
|
|
1773
|
+
/** Exactly one of `category` / `categories` — the pair is a discriminated
|
|
1774
|
+
* union, so passing both (or neither) is a compile error rather than silently
|
|
1775
|
+
* hidden content. `categories` is the multi-category rule GatedScript uses
|
|
1776
|
+
* (R10): the content renders only when EVERY listed category is granted. */
|
|
1777
|
+
type CategoryProps$1 = {
|
|
1778
|
+
category: ConsentCategory;
|
|
1779
|
+
categories?: never;
|
|
1780
|
+
} | {
|
|
1781
|
+
categories: ConsentCategory[];
|
|
1782
|
+
category?: never;
|
|
1783
|
+
};
|
|
1784
|
+
type GatedContentStrings = typeof DEFAULT_GATED_CONTENT_STRINGS;
|
|
1785
|
+
/** The placeholder identifies the recipient and opens category-wide
|
|
1786
|
+
* preferences. Its button never records consent by itself. */
|
|
1787
|
+
declare const DEFAULT_GATED_CONTENT_STRINGS: {
|
|
1788
|
+
title: string;
|
|
1789
|
+
bodyBeforeVendor: string;
|
|
1790
|
+
bodyAfterVendor: string;
|
|
1791
|
+
scope: string;
|
|
1792
|
+
action: string;
|
|
1793
|
+
};
|
|
1794
|
+
/**
|
|
1795
|
+
* PUBLIC SHAPE — mirrored by hand. Changing the props here means updating
|
|
1796
|
+
* landingsite-modal agent/test/fixtures/aifeatures-react.d.ts, which is what
|
|
1797
|
+
* type-checks the snippets the site-builder agent emits. CI there catches a
|
|
1798
|
+
* snippet that disagrees with the mirror; nothing catches the mirror
|
|
1799
|
+
* disagreeing with THIS file except someone remembering it exists.
|
|
1800
|
+
*/
|
|
1801
|
+
type GatedContentProps = CategoryProps$1 & {
|
|
1802
|
+
/** Rendered only once every listed category is granted. */
|
|
1803
|
+
children: ReactNode;
|
|
1804
|
+
/**
|
|
1805
|
+
* The third party the content comes from, named the way a visitor would
|
|
1806
|
+
* recognize them — "YouTube (Google Ireland Ltd.)", "Calendly".
|
|
1807
|
+
*
|
|
1808
|
+
* Passing this asks for the built-in preferences placeholder, which names
|
|
1809
|
+
* the recipient before visitors review the category. Omit it for an invisible
|
|
1810
|
+
* tracker — a pixel or a beacon has nothing to show and no hole to explain.
|
|
1811
|
+
*/
|
|
1812
|
+
vendor?: string;
|
|
1813
|
+
/** Per-string overrides for the built-in placeholder — site-language
|
|
1814
|
+
* translations. Ignored when `fallback` replaces the placeholder wholesale. */
|
|
1815
|
+
strings?: Partial<GatedContentStrings>;
|
|
1816
|
+
/**
|
|
1817
|
+
* Replaces the built-in placeholder entirely. Custom fallbacks should open
|
|
1818
|
+
* preferences so visitors can review all recipients in the category.
|
|
1819
|
+
*/
|
|
1820
|
+
fallback?: ReactNode;
|
|
1821
|
+
};
|
|
1822
|
+
declare function GatedContent({ category, categories, children, vendor, strings, fallback, }: GatedContentProps): react_jsx_runtime.JSX.Element | null;
|
|
1823
|
+
|
|
1824
|
+
/** Complete visitor copy, selected once on the provider. Site integration facts
|
|
1825
|
+
* still need translation in the manifest. Copy overrides do not change grants. */
|
|
1826
|
+
interface ConsentLocale {
|
|
1827
|
+
regionLabel: string;
|
|
1828
|
+
settingsLabel: string;
|
|
1829
|
+
actions: {
|
|
1830
|
+
acceptAll: string;
|
|
1831
|
+
rejectAll: string;
|
|
1832
|
+
preferences: string;
|
|
1833
|
+
softAccept: string;
|
|
1834
|
+
};
|
|
1835
|
+
disclosure: Required<Omit<ConsentDisclosureStrings, 'beforeLink'>>;
|
|
1836
|
+
preferences: PreferencesStrings;
|
|
1837
|
+
gatedContent: GatedContentStrings;
|
|
1838
|
+
policy: {
|
|
1839
|
+
title: string;
|
|
1840
|
+
strict: string;
|
|
1841
|
+
adaptive: string;
|
|
1842
|
+
off: string;
|
|
1843
|
+
unresolved: string;
|
|
1844
|
+
choices: string;
|
|
1845
|
+
empty: string;
|
|
1846
|
+
};
|
|
1847
|
+
}
|
|
1848
|
+
/** Built-in translations. pt uses Brazilian Portuguese; zh uses Simplified
|
|
1849
|
+
* Chinese; nb uses Norwegian Bokmål. Select a preset using the site's language.
|
|
1850
|
+
* Custom complete ConsentLocale objects and component overrides still work.
|
|
1851
|
+
* These reference translations are not a claim of legal approval.
|
|
1852
|
+
* Keep this declaration compact: agents need the keys and schema, not 20
|
|
1853
|
+
* repeated object shapes when inspecting the installed package's types. */
|
|
1854
|
+
declare const consentLocales: Record<'en' | 'es' | 'ar' | 'fr' | 'de' | 'it' | 'pt' | 'nl' | 'pl' | 'sv' | 'da' | 'nb' | 'fi' | 'tr' | 'ru' | 'uk' | 'ja' | 'ko' | 'zh' | 'hi', ConsentLocale>;
|
|
1855
|
+
|
|
1856
|
+
interface ConsentProviderProps {
|
|
1857
|
+
/** Complete UI copy, including fallback controls. Defaults to English. */
|
|
1858
|
+
locale?: ConsentLocale;
|
|
1859
|
+
/** Consent config ID from aifeatures (returned by setup_cookie_consent). */
|
|
1860
|
+
configId: string;
|
|
1861
|
+
/** Consent runtime base URL. Defaults to the site's same-origin /_ls service. */
|
|
1862
|
+
apiUrl?: string;
|
|
1863
|
+
/** Accessible label for the floating cookie-settings badge the provider
|
|
1864
|
+
* renders when no CookieSettingsLink is mounted. Defaults to the provider
|
|
1865
|
+
* locale's settingsLabel; pass this only to override that wording. */
|
|
1866
|
+
badgeLabel?: string;
|
|
1867
|
+
/** Published integration disclosures. A material revision requires a new choice. */
|
|
1868
|
+
manifest?: ConsentManifest;
|
|
1869
|
+
children?: ReactNode;
|
|
1870
|
+
}
|
|
1871
|
+
/**
|
|
1872
|
+
* The consent engine (cookie-consent plan D1): owns the stored choice, the
|
|
1873
|
+
* config + geo fetches, GPC, the grant map, and the gated-script registry.
|
|
1874
|
+
* Wrap the app in it once; register trackers with `<GatedScript>`, author the
|
|
1875
|
+
* first layer with `<ConsentBanner>`, and read state with `useConsent()`.
|
|
1876
|
+
*
|
|
1877
|
+
* First-paint contract (R13): SSG/prerender renders children and nothing
|
|
1878
|
+
* else; on hydration a valid stored choice applies with ZERO network; only a
|
|
1879
|
+
* choice-less visitor triggers the parallel config + geo fetches, and the
|
|
1880
|
+
* banner renders once — the painted shape never swaps. Every failure path is
|
|
1881
|
+
* strict: optional integrations wait for a choice unless a resolved policy
|
|
1882
|
+
* explicitly permits the category before a choice.
|
|
1883
|
+
*
|
|
1884
|
+
* @example
|
|
1885
|
+
* ```tsx
|
|
1886
|
+
* <ConsentProvider configId={consentConfigId}>
|
|
1887
|
+
* <App />
|
|
1888
|
+
* <GatedScript category="analytics" src="https://www.googletagmanager.com/gtag/js?id=G-XXXX" />
|
|
1889
|
+
* <ConsentBanner strict={...} soft={...} />
|
|
1890
|
+
* <PreferencesPanel />
|
|
1891
|
+
* </ConsentProvider>
|
|
1892
|
+
* ```
|
|
1893
|
+
*/
|
|
1894
|
+
declare function ConsentProvider({ configId, apiUrl, locale, badgeLabel, manifest, children, }: ConsentProviderProps): react_jsx_runtime.JSX.Element;
|
|
1895
|
+
|
|
1896
|
+
/** Exactly one of `category` / `categories` — the pair is a discriminated
|
|
1897
|
+
* union, so passing both (or neither) is a compile error rather than a
|
|
1898
|
+
* silently blocked script. `categories` is the multi-category GTM rule (R10):
|
|
1899
|
+
* the script loads only when EVERY listed category is granted. */
|
|
1900
|
+
type CategoryProps = {
|
|
1901
|
+
category: ConsentCategory;
|
|
1902
|
+
categories?: never;
|
|
1903
|
+
} | {
|
|
1904
|
+
categories: ConsentCategory[];
|
|
1905
|
+
category?: never;
|
|
1906
|
+
};
|
|
1907
|
+
/** Exactly one payload: an external `src` or inline code as `children`. */
|
|
1908
|
+
type PayloadProps = {
|
|
1909
|
+
src: string;
|
|
1910
|
+
children?: never;
|
|
1911
|
+
} | {
|
|
1912
|
+
children: string;
|
|
1913
|
+
src?: never;
|
|
1914
|
+
};
|
|
1915
|
+
/**
|
|
1916
|
+
* PUBLIC SHAPE — mirrored by hand. Changing the props here means updating
|
|
1917
|
+
* landingsite-modal agent/test/fixtures/aifeatures-react.d.ts, which is what
|
|
1918
|
+
* type-checks the snippets the site-builder agent emits. CI there catches a
|
|
1919
|
+
* snippet that disagrees with the mirror; nothing catches the mirror
|
|
1920
|
+
* disagreeing with THIS file except someone remembering it exists.
|
|
1921
|
+
*/
|
|
1922
|
+
type GatedScriptProps = CategoryProps & PayloadProps & {
|
|
1923
|
+
/** Stable registration id — defaults to `src` (or a hash of the inline
|
|
1924
|
+
* code). Set it when the same src is registered twice on purpose. */
|
|
1925
|
+
id?: string;
|
|
1926
|
+
};
|
|
1927
|
+
/**
|
|
1928
|
+
* Registers a third-party script with the consent engine and renders nothing.
|
|
1929
|
+
* The provider injects the actual `<script>` element only once every listed
|
|
1930
|
+
* category is granted — so accepting applies without a reload, and until a
|
|
1931
|
+
* choice exists (or the owner set mode 'off') the script never executes and
|
|
1932
|
+
* never emits a request (R2 hard block).
|
|
1933
|
+
*
|
|
1934
|
+
* Unmounting removes the REGISTRATION but never an already-injected script:
|
|
1935
|
+
* un-running a script is impossible, consistent with R4's best-effort
|
|
1936
|
+
* withdrawal contract (a new choice fully applies from the next page load).
|
|
1937
|
+
*
|
|
1938
|
+
* UNSUPPORTED placement: inside a ConsentBanner layer. acceptAll unmounts the
|
|
1939
|
+
* banner, unregistering the script before its grant ever applies — it would
|
|
1940
|
+
* never inject. Mount GatedScript at the page level; a console.warn flags the
|
|
1941
|
+
* mistake in development.
|
|
1942
|
+
*
|
|
1943
|
+
* @example
|
|
1944
|
+
* ```tsx
|
|
1945
|
+
* <GatedScript category="analytics" src="https://www.googletagmanager.com/gtag/js?id=G-XXXX" />
|
|
1946
|
+
* <GatedScript category="analytics">{`window.dataLayer = window.dataLayer || [];`}</GatedScript>
|
|
1947
|
+
* <GatedScript categories={['analytics', 'advertising']} src="https://www.googletagmanager.com/gtm.js?id=GTM-XXXX" />
|
|
1948
|
+
* ```
|
|
1949
|
+
*/
|
|
1950
|
+
declare function GatedScript({ category, categories, src, children, id, }: GatedScriptProps): null;
|
|
1951
|
+
|
|
1952
|
+
/**
|
|
1953
|
+
* PUBLIC SHAPE — mirrored by hand. Changing the props here means updating
|
|
1954
|
+
* landingsite-modal agent/test/fixtures/aifeatures-react.d.ts, which is what
|
|
1955
|
+
* type-checks the snippets the site-builder agent emits. CI there catches a
|
|
1956
|
+
* snippet that disagrees with the mirror; nothing catches the mirror
|
|
1957
|
+
* disagreeing with THIS file except someone remembering it exists.
|
|
1958
|
+
*/
|
|
1959
|
+
interface CookieSettingsLinkProps {
|
|
1960
|
+
/** Link text — defaults to "Cookie settings". */
|
|
1961
|
+
children?: ReactNode;
|
|
1962
|
+
className?: string;
|
|
1963
|
+
style?: CSSProperties;
|
|
1964
|
+
}
|
|
1965
|
+
/**
|
|
1966
|
+
* The persistent re-open affordance (R4): a link-styled button that opens the
|
|
1967
|
+
* Preferences layer with the visitor's current per-category state. Place it
|
|
1968
|
+
* in the site footer on every page. When no CookieSettingsLink is mounted
|
|
1969
|
+
* anywhere, the provider renders a floating-badge fallback instead — so
|
|
1970
|
+
* withdrawal is always reachable.
|
|
1971
|
+
*
|
|
1972
|
+
* @example
|
|
1973
|
+
* ```tsx
|
|
1974
|
+
* <footer>
|
|
1975
|
+
* <CookieSettingsLink>Cookie settings</CookieSettingsLink>
|
|
1976
|
+
* </footer>
|
|
1977
|
+
* ```
|
|
1978
|
+
*/
|
|
1979
|
+
declare function CookieSettingsLink({ children, className, style, }: CookieSettingsLinkProps): react_jsx_runtime.JSX.Element;
|
|
1980
|
+
|
|
1981
|
+
/**
|
|
1982
|
+
* The public consent surface — grants and actions ONLY. The provider's
|
|
1983
|
+
* resolved geography (country/region/shape) is deliberately absent from this
|
|
1984
|
+
* type and must never be added: the geo verdict is purpose-limited to the
|
|
1985
|
+
* banner's shape selection (plan D1 privacy boundary).
|
|
1986
|
+
*/
|
|
1987
|
+
/**
|
|
1988
|
+
* PUBLIC SHAPE — mirrored by hand. Changing the props here means updating
|
|
1989
|
+
* landingsite-modal agent/test/fixtures/aifeatures-react.d.ts, which is what
|
|
1990
|
+
* type-checks the snippets the site-builder agent emits. CI there catches a
|
|
1991
|
+
* snippet that disagrees with the mirror; nothing catches the mirror
|
|
1992
|
+
* disagreeing with THIS file except someone remembering it exists.
|
|
1993
|
+
*/
|
|
1994
|
+
interface UseConsentResult {
|
|
1995
|
+
/**
|
|
1996
|
+
* What is ALLOWED TO RUN — the EFFECTIVE grants, the same map `<GatedScript>`
|
|
1997
|
+
* and `<GatedContent>` gate on. Permissions may be granted before a choice
|
|
1998
|
+
* by the resolved regional/owner policy. Saved refusals and GPC still apply.
|
|
1999
|
+
* Never infer the owner's mode from grants or `hasChoice`.
|
|
2000
|
+
*/
|
|
2001
|
+
grants: ConsentGrants;
|
|
2002
|
+
/** True once a valid stored choice exists, including a refusal saved in off mode. */
|
|
2003
|
+
hasChoice: boolean;
|
|
2004
|
+
/** Grant all categories (under Global Privacy Control, advertising stays
|
|
2005
|
+
* withheld — R16). Persists for 12 months. */
|
|
2006
|
+
acceptAll: () => void;
|
|
2007
|
+
/** Decline all non-essential categories. Persists for 12 months. */
|
|
2008
|
+
rejectAll: () => void;
|
|
2009
|
+
/** Persist a per-category choice. GPC still withholds advertising; the
|
|
2010
|
+
* shared PreferencesPanel owns the separately acknowledged override flow. */
|
|
2011
|
+
save: (grants: ConsentGrants) => void;
|
|
2012
|
+
/** Open the Preferences layer showing the current per-category state. */
|
|
2013
|
+
openPreferences: () => void;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Read and change the visitor's consent state. Throws outside a
|
|
2017
|
+
* `<ConsentProvider>`.
|
|
2018
|
+
*
|
|
2019
|
+
* `grants` answers "may I do this thing?", not "what did the visitor click?" —
|
|
2020
|
+
* it is the EFFECTIVE map used by all shared gates. Run SDK effects only in
|
|
2021
|
+
* an allowed child, and dynamically import side-effectful modules there:
|
|
2022
|
+
*
|
|
2023
|
+
* @example
|
|
2024
|
+
* ```tsx
|
|
2025
|
+
* function AnalyticsSession() {
|
|
2026
|
+
* useEffect(() => {
|
|
2027
|
+
* let cancelled = false;
|
|
2028
|
+
* let stop: undefined | (() => void);
|
|
2029
|
+
* void import('./analytics').then(({ start }) => {
|
|
2030
|
+
* if (!cancelled) stop = start(); // start returns the SDK's teardown
|
|
2031
|
+
* });
|
|
2032
|
+
* return () => { cancelled = true; stop?.(); };
|
|
2033
|
+
* }, []);
|
|
2034
|
+
* return null;
|
|
2035
|
+
* }
|
|
2036
|
+
* // Inside the root ConsentProvider, outside ConsentBanner:
|
|
2037
|
+
* <GatedContent category="analytics"><AnalyticsSession /></GatedContent>
|
|
2038
|
+
* ```
|
|
2039
|
+
*/
|
|
2040
|
+
declare function useConsent(): UseConsentResult;
|
|
1423
2041
|
|
|
1424
2042
|
/**
|
|
1425
2043
|
* The recurring price a plan derives from a base one-time price, in minor
|
|
@@ -1507,7 +2125,9 @@ interface PlanPickerProps {
|
|
|
1507
2125
|
* planId>` (a selected plan locks quantity at 1 and switches the CTA to
|
|
1508
2126
|
* "Subscribe").
|
|
1509
2127
|
*
|
|
1510
|
-
*
|
|
2128
|
+
* In the editor frame, configured plans remain selectable before payments or
|
|
2129
|
+
* the account route are ready so the merchant can rehearse a test signup.
|
|
2130
|
+
* Degraded states outside the editor (plan §Unit 8):
|
|
1511
2131
|
* - no subscription block → renders nothing (one-time only);
|
|
1512
2132
|
* - `ready: false`, not required → renders nothing — plans are silently
|
|
1513
2133
|
* hidden, the one-time path is untouched, no error surface;
|
|
@@ -1515,6 +2135,9 @@ interface PlanPickerProps {
|
|
|
1515
2135
|
* (renderUnavailable), with no purchase controls and no reason given.
|
|
1516
2136
|
*/
|
|
1517
2137
|
declare function PlanPicker({ product, subscription: subscriptionProp, baseUnitAmount, currency, value, onChange, className, style, optionClassName, selectedOptionClassName, oneTimeLabel, renderOption, renderUnavailable, }: PlanPickerProps): react_jsx_runtime.JSX.Element | null;
|
|
2138
|
+
declare namespace PlanPicker {
|
|
2139
|
+
var neverConsentGate: string;
|
|
2140
|
+
}
|
|
1518
2141
|
|
|
1519
2142
|
interface StoredSessionCustomer {
|
|
1520
2143
|
email: string;
|
|
@@ -1526,7 +2149,7 @@ type SessionCustomer = StoredSessionCustomer;
|
|
|
1526
2149
|
/** Why the hook is signed_out, when it wasn't a plain fresh visit. */
|
|
1527
2150
|
type SessionReason = 'session_expired' | 'invalid_code' | null;
|
|
1528
2151
|
interface UseSessionOptions {
|
|
1529
|
-
/**
|
|
2152
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
1530
2153
|
apiUrl?: string;
|
|
1531
2154
|
/**
|
|
1532
2155
|
* Whether THIS instance consumes a `?code=` magic-link param from the URL
|
|
@@ -1624,7 +2247,7 @@ interface AccountLoginSentContext {
|
|
|
1624
2247
|
reset: () => void;
|
|
1625
2248
|
}
|
|
1626
2249
|
interface AccountLoginProps {
|
|
1627
|
-
/**
|
|
2250
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
1628
2251
|
apiUrl?: string;
|
|
1629
2252
|
/**
|
|
1630
2253
|
* Share a parent's useSession() (AccountPage passes its own so the login
|
|
@@ -1665,6 +2288,9 @@ interface AccountLoginProps {
|
|
|
1665
2288
|
* check-your-email state is skipped.
|
|
1666
2289
|
*/
|
|
1667
2290
|
declare function AccountLogin({ apiUrl, session: sessionProp, resendDelayMs, className, style, renderForm, renderSent, renderUnavailable, }: AccountLoginProps): react_jsx_runtime.JSX.Element;
|
|
2291
|
+
declare namespace AccountLogin {
|
|
2292
|
+
var neverConsentGate: string;
|
|
2293
|
+
}
|
|
1668
2294
|
|
|
1669
2295
|
interface AccountPagePmBannerContext {
|
|
1670
2296
|
/** 'retrying' while a subscription is still past_due after the card
|
|
@@ -1675,7 +2301,7 @@ interface AccountPagePmBannerContext {
|
|
|
1675
2301
|
checking: boolean;
|
|
1676
2302
|
}
|
|
1677
2303
|
interface AccountPageProps {
|
|
1678
|
-
/**
|
|
2304
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
1679
2305
|
apiUrl?: string;
|
|
1680
2306
|
className?: string;
|
|
1681
2307
|
style?: CSSProperties;
|
|
@@ -1730,7 +2356,10 @@ interface AccountPageProps {
|
|
|
1730
2356
|
* the stored token and returns to email entry with a brief message, keeping
|
|
1731
2357
|
* the buyer on this page.
|
|
1732
2358
|
*/
|
|
1733
|
-
declare function AccountPage({ apiUrl, className, style, resendDelayMs, loginProps, renderLoading, renderError, renderEmpty, renderHeader, renderPmBanner, renderManageExpired, }: AccountPageProps): react_jsx_runtime.JSX.Element;
|
|
2359
|
+
declare function AccountPage({ apiUrl: explicitApiUrl, className, style, resendDelayMs, loginProps, renderLoading, renderError, renderEmpty, renderHeader, renderPmBanner, renderManageExpired, }: AccountPageProps): react_jsx_runtime.JSX.Element;
|
|
2360
|
+
declare namespace AccountPage {
|
|
2361
|
+
var neverConsentGate: string;
|
|
2362
|
+
}
|
|
1734
2363
|
|
|
1735
2364
|
/**
|
|
1736
2365
|
* INTERNAL module — shared wire types + fetch classification for the
|
|
@@ -1852,6 +2481,9 @@ interface AccountOrdersProps {
|
|
|
1852
2481
|
* defaults; restyle via className or replace rows via renderOrder.
|
|
1853
2482
|
*/
|
|
1854
2483
|
declare function AccountOrders({ orders, className, style, heading, renderEmpty, renderOrder, }: AccountOrdersProps): react_jsx_runtime.JSX.Element;
|
|
2484
|
+
declare namespace AccountOrders {
|
|
2485
|
+
var neverConsentGate: string;
|
|
2486
|
+
}
|
|
1855
2487
|
|
|
1856
2488
|
/**
|
|
1857
2489
|
* Which doorway this list acts through:
|
|
@@ -1908,7 +2540,7 @@ interface SubscriptionRowContext {
|
|
|
1908
2540
|
openPortal: () => void;
|
|
1909
2541
|
}
|
|
1910
2542
|
interface SubscriptionListProps {
|
|
1911
|
-
/**
|
|
2543
|
+
/** API base override; falls back to AifeaturesProvider, then https://aifeatures.dev. */
|
|
1912
2544
|
apiUrl?: string;
|
|
1913
2545
|
subscriptions: AccountSubscription[];
|
|
1914
2546
|
auth: SubscriptionListAuth;
|
|
@@ -1946,6 +2578,21 @@ interface SubscriptionListProps {
|
|
|
1946
2578
|
* than erroring — the copy is "this subscription has ended", and the only
|
|
1947
2579
|
* path onward is resubscribing on the product page.
|
|
1948
2580
|
*/
|
|
1949
|
-
declare function SubscriptionList({ apiUrl, subscriptions, auth, onAuthError, onUnavailable, onSubscriptionChange, className, style, heading, renderEmpty, renderRow, }: SubscriptionListProps): react_jsx_runtime.JSX.Element;
|
|
2581
|
+
declare function SubscriptionList({ apiUrl: explicitApiUrl, subscriptions, auth, onAuthError, onUnavailable, onSubscriptionChange, className, style, heading, renderEmpty, renderRow, }: SubscriptionListProps): react_jsx_runtime.JSX.Element;
|
|
2582
|
+
declare namespace SubscriptionList {
|
|
2583
|
+
var neverConsentGate: string;
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
interface ConsentPolicyDetailsProps {
|
|
2587
|
+
className?: string;
|
|
2588
|
+
style?: CSSProperties;
|
|
2589
|
+
}
|
|
2590
|
+
/** The changing part of a site's cookie policy. Reads the SAME manifest and
|
|
2591
|
+
* resolved owner setting as the provider; it never adds a geo/config request.
|
|
2592
|
+
* Returning visitors can use saved choices without resolving mode, so that
|
|
2593
|
+
* path uses conditional wording instead of guessing the current owner setting.
|
|
2594
|
+
* Add controller/contact, essential services and other site-specific policy
|
|
2595
|
+
* facts around this section. It is not a complete legal policy. */
|
|
2596
|
+
declare function ConsentPolicyDetails({ className, style }: ConsentPolicyDetailsProps): react_jsx_runtime.JSX.Element;
|
|
1950
2597
|
|
|
1951
|
-
export { AccountLogin, type AccountLoginFormContext, type AccountLoginProps, type AccountLoginSentContext, type AccountMePayload, type AccountOrder, AccountOrders, type AccountOrdersProps, AccountPage, type AccountPagePmBannerContext, type AccountPageProps, type AccountShippingAddressInput, type AccountSubscription, type AddCartLineInput, AddToCartButton, type AddToCartButtonProps, type AddToCartResult, AifeaturesCaptcha, type AifeaturesCaptchaProps, BuyButton, type BuyButtonProps, CartCheckoutButton, type CartCheckoutButtonProps, type CartCheckoutLine, type CartConflictItem, type CartItemLine, type CartLine, type CartLineDisplay, type CartLineStatus, type CartSummary, type CartSummaryShipping, type CartSummaryShippingOption, type LoginResult, MARKET_COUNTRIES, MAX_CART_LINES, type MarketCountry, OrderConfirmation, type OrderConfirmationProps, type OrderFulfillment, type OrderSession, type OrderSessionLineItem, type OrderSessionSubscription, type OrderStatus, PlanPicker, type PlanPickerOptionContext, type PlanPickerProps, ProductPrice, type ProductPriceProps, type PublicOption, type PublicOptionValue, type PublicProduct, type PublicProductSubscription, type PublicSubscriptionPlan, type PublicVariant, type PublicVariantOptionValue, type SessionCustomer, type SessionReason, type SessionStatus, type ShippingOptionConflict, type StartCartCheckoutOptions, type StartCheckoutOptions, SubscriptionList, type SubscriptionListAuth, type SubscriptionListProps, type SubscriptionMutationState, type SubscriptionRowContext, type UseCartCheckoutOptions, type UseCartCheckoutResult, type UseCartItemsOptions, type UseCartItemsResult, type UseCartResult, type UseCartSummaryOptions, type UseCartSummaryResult, type UseCheckoutOptions, type UseCheckoutResult, type UseMarketOptions, type UseMarketResult, type UseProductOptions, type UseProductResult, type UseSessionOptions, type UseSessionResult, VariantPicker, type VariantPickerProps, type VariantSelection, type VerifyResult, ZERO_DECIMAL_CURRENCIES, applySelectionToUrl, formatPrice, getOptions, getVariants, isMultiVariant, isValueAvailable, isValueInCatalog, planRecurringAmount, reanchorSelection, resolveVariant, searchFromSelection, selectedImages, selectedValues, selectionFromSearch, useCart, useCartCheckout, useCartItems, useCartSummary, useCheckout, useMarket, useProduct, useSession, valueSlug, variantPriceRange };
|
|
2598
|
+
export { AccountLogin, type AccountLoginFormContext, type AccountLoginProps, type AccountLoginSentContext, type AccountMePayload, type AccountOrder, AccountOrders, type AccountOrdersProps, AccountPage, type AccountPagePmBannerContext, type AccountPageProps, type AccountShippingAddressInput, type AccountSubscription, type AddCartLineInput, AddToCartButton, type AddToCartButtonProps, type AddToCartResult, AifeaturesCaptcha, type AifeaturesCaptchaProps, AifeaturesProvider, type AifeaturesProviderProps, BuyButton, type BuyButtonProps, CartCheckoutButton, type CartCheckoutButtonProps, type CartCheckoutLine, type CartConflictItem, type CartItemLine, type CartLine, type CartLineDisplay, type CartLineStatus, type CartSummary, type CartSummaryShipping, type CartSummaryShippingOption, ConsentBanner, type ConsentBannerDisclosureProps, type ConsentBannerProps, type ConsentCategory, type ConsentDisclosureStrings, type ConsentGrants, type ConsentIntegration, type ConsentLocale, type ConsentManifest, ConsentPolicyDetails, type ConsentPolicyDetailsProps, ConsentProvider, type ConsentProviderProps, type ConsentThemeTokens, CookieSettingsLink, type CookieSettingsLinkProps, GatedContent, type GatedContentProps, type GatedContentStrings, GatedScript, type GatedScriptProps, type LoginResult, MARKET_COUNTRIES, MAX_CART_LINES, type MarketCountry, OrderConfirmation, type OrderConfirmationProps, type OrderFulfillment, type OrderSession, type OrderSessionLineItem, type OrderSessionSubscription, type OrderStatus, PlanPicker, type PlanPickerOptionContext, type PlanPickerProps, PreferencesPanel, type PreferencesPanelProps, type PreferencesStrings, ProductPrice, type ProductPriceProps, type PublicOption, type PublicOptionValue, type PublicProduct, type PublicProductSubscription, type PublicSubscriptionPlan, type PublicVariant, type PublicVariantOptionValue, type SessionCustomer, type SessionReason, type SessionStatus, type ShippingOptionConflict, type StartCartCheckoutOptions, type StartCheckoutOptions, SubscriptionList, type SubscriptionListAuth, type SubscriptionListProps, type SubscriptionMutationState, type SubscriptionRowContext, type UseCartCheckoutOptions, type UseCartCheckoutResult, type UseCartItemsOptions, type UseCartItemsResult, type UseCartResult, type UseCartSummaryOptions, type UseCartSummaryResult, type UseCheckoutOptions, type UseCheckoutResult, type UseConsentResult, type UseMarketOptions, type UseMarketResult, type UseProductOptions, type UseProductResult, type UseSessionOptions, type UseSessionResult, VariantPicker, type VariantPickerProps, type VariantSelection, type VerifyResult, ZERO_DECIMAL_CURRENCIES, applySelectionToUrl, consentLocales, formatPrice, getOptions, getVariants, isMultiVariant, isValueAvailable, isValueInCatalog, planRecurringAmount, reanchorSelection, resolveVariant, searchFromSelection, selectedImages, selectedValues, selectionFromSearch, useAifeaturesApiUrl, useCart, useCartCheckout, useCartItems, useCartSummary, useCheckout, useConsent, useMarket, useProduct, useSession, valueSlug, variantPriceRange };
|