@40rty/ams-sdk 0.5.10 → 0.5.12
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/index.js +762 -618
- package/dist/types/sdk/src/host/host-modules.d.ts +36 -0
- package/dist/types/sdk/src/shell/bot-check-notice.d.ts +9 -0
- package/dist/types/sdk/src/shell/index.d.ts +1 -0
- package/dist/types/sdk/src/verticals/commerce/cart/queued-discount-codes.d.ts +24 -0
- package/dist/types/sdk/src/verticals/commerce/index.d.ts +1 -0
- package/dist/types/spacestation/src/contracts/customer-account-session-header.d.ts +2 -0
- package/dist/types/spacestation/src/contracts/socket-ticket-param.d.ts +16 -0
- package/dist/types/spacestation/src/index.d.ts +3 -1
- package/dist/types/spacestation/src/shell/bot-check-notice.d.ts +34 -0
- package/dist/types/spacestation/src/space/connector.d.ts +3 -2
- package/dist/types/spacestation/src/space/space-config.d.ts +4 -0
- package/package.json +1 -1
|
@@ -72,6 +72,30 @@ export declare const HOST_MODULES: {
|
|
|
72
72
|
useShellRoot: typeof sdk.useShellRoot;
|
|
73
73
|
DockPersistenceProvider: typeof sdk.DockPersistenceProvider;
|
|
74
74
|
useDockPersistence: typeof sdk.useDockPersistence;
|
|
75
|
+
BotCheckNoticeProvider: typeof sdk.BotCheckNoticeProvider;
|
|
76
|
+
BotCheckNoticeSchema: zod.ZodObject<{
|
|
77
|
+
segments: zod.ZodArray<zod.ZodUnion<[zod.ZodString, zod.ZodObject<{
|
|
78
|
+
text: zod.ZodString;
|
|
79
|
+
href: zod.ZodString;
|
|
80
|
+
}, "strip", zod.ZodTypeAny, {
|
|
81
|
+
text: string;
|
|
82
|
+
href: string;
|
|
83
|
+
}, {
|
|
84
|
+
text: string;
|
|
85
|
+
href: string;
|
|
86
|
+
}>]>, "many">;
|
|
87
|
+
}, "strip", zod.ZodTypeAny, {
|
|
88
|
+
segments: (string | {
|
|
89
|
+
text: string;
|
|
90
|
+
href: string;
|
|
91
|
+
})[];
|
|
92
|
+
}, {
|
|
93
|
+
segments: (string | {
|
|
94
|
+
text: string;
|
|
95
|
+
href: string;
|
|
96
|
+
})[];
|
|
97
|
+
}>;
|
|
98
|
+
useBotCheckNotice: typeof sdk.useBotCheckNotice;
|
|
75
99
|
useDockState: typeof sdk.useDockState;
|
|
76
100
|
registerExclusiveOverlay: typeof sdk.registerExclusiveOverlay;
|
|
77
101
|
claimExclusiveOverlay: typeof sdk.claimExclusiveOverlay;
|
|
@@ -378,6 +402,13 @@ export declare const HOST_MODULES: {
|
|
|
378
402
|
clearCartActionFailures: typeof sdk.clearCartActionFailures;
|
|
379
403
|
useCartActionFailures: typeof sdk.useCartActionFailures;
|
|
380
404
|
useCartActionFailuresFor: typeof sdk.useCartActionFailuresFor;
|
|
405
|
+
queueDiscountCode: typeof sdk.queueDiscountCode;
|
|
406
|
+
takeQueuedDiscountCodes: typeof sdk.takeQueuedDiscountCodes;
|
|
407
|
+
readQueuedDiscountCodes: typeof sdk.readQueuedDiscountCodes;
|
|
408
|
+
withQueuedDiscountCodes: typeof sdk.withQueuedDiscountCodes;
|
|
409
|
+
isDiscountCodeQueued: typeof sdk.isDiscountCodeQueued;
|
|
410
|
+
dequeueDiscountCode: typeof sdk.dequeueDiscountCode;
|
|
411
|
+
useQueuedDiscountCodes: typeof sdk.useQueuedDiscountCodes;
|
|
381
412
|
useCartLineRow: typeof sdk.useCartLineRow;
|
|
382
413
|
openCartDrawer: typeof sdk.openCartDrawer;
|
|
383
414
|
openCartDrawerFocusedOn: typeof sdk.openCartDrawerFocusedOn;
|
|
@@ -2454,6 +2485,11 @@ export declare const HOST_MODULES: {
|
|
|
2454
2485
|
arrivalFromParams: typeof spacestation.arrivalFromParams;
|
|
2455
2486
|
arrivalToParams: typeof spacestation.arrivalToParams;
|
|
2456
2487
|
SOCKET_TICKET_PARAM: "ticket";
|
|
2488
|
+
SOCKET_SUBPROTOCOL: "fourty.v1";
|
|
2489
|
+
SOCKET_BEARER_SUBPROTOCOL_PREFIX: "fourty.bearer.";
|
|
2490
|
+
socketProtocolsFor: typeof spacestation.socketProtocolsFor;
|
|
2491
|
+
bearerFromSocketProtocols: typeof spacestation.bearerFromSocketProtocols;
|
|
2492
|
+
CUSTOMER_ACCOUNT_SESSION_HEADER: "x-fourty-session";
|
|
2457
2493
|
WIRE_PROTOCOL_VERSION: 1;
|
|
2458
2494
|
MIN_WIRE_PROTOCOL_VERSION: 1;
|
|
2459
2495
|
WIRE_PROTOCOL_PARAM: "protocol";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BotCheckNoticeSchema, type BotCheckNotice } from '../../../spacestation/src/index';
|
|
3
|
+
export { BotCheckNoticeSchema, type BotCheckNotice };
|
|
4
|
+
export declare function BotCheckNoticeProvider({ value, children, }: {
|
|
5
|
+
value: BotCheckNotice | null;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}): React.ReactElement;
|
|
8
|
+
/** The notice a brand footer renders, or `null` when this page runs no bot check. */
|
|
9
|
+
export declare function useBotCheckNotice(): BotCheckNotice | null;
|
|
@@ -2,6 +2,7 @@ export { ScrollContainerProvider, useScrollContainerRef, type ScrollContainerRef
|
|
|
2
2
|
export { ShellRegistryProvider, useShellRegistry, type ShellComponentProps, type ShellComponent, type ShellRegistry, } from './ShellRegistry';
|
|
3
3
|
export { ShellRootContext, useShellRoot } from './ShellRootContext';
|
|
4
4
|
export { DockPersistenceProvider, useDockPersistence, type DockPersistence, } from './dock-persistence';
|
|
5
|
+
export { BotCheckNoticeProvider, BotCheckNoticeSchema, useBotCheckNotice, type BotCheckNotice, } from './bot-check-notice';
|
|
5
6
|
export { useDockState, type ShellDockState } from './use-dock-state';
|
|
6
7
|
export { registerExclusiveOverlay, claimExclusiveOverlay, useExclusiveOverlay, } from './exclusive-overlay';
|
|
7
8
|
export { useComposerAttachments, ATTACHMENT_ACCEPT, type AttachmentStatus, type ComposerAttachmentsApi, type ComposerAttachment, } from './composer-attachments/use-composer-attachments';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The codes a cart surface shows: the cart's own, then any still held for an
|
|
3
|
+
* empty bag. A held code reads as applied — the visitor asked for it and it
|
|
4
|
+
* WILL be applied the moment an item lands, so the surface agrees with what the
|
|
5
|
+
* agent told them. Applicability is the backend's verdict and arrives with the
|
|
6
|
+
* real write; until then there is nothing to contradict.
|
|
7
|
+
*/
|
|
8
|
+
export declare function withQueuedDiscountCodes(cartCodes: readonly {
|
|
9
|
+
code: string;
|
|
10
|
+
applicable: boolean;
|
|
11
|
+
}[], held: readonly string[]): {
|
|
12
|
+
code: string;
|
|
13
|
+
applicable: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
export declare function isDiscountCodeQueued(code: string): boolean;
|
|
16
|
+
/** Drop one held code (the visitor removed it before it was ever applied). */
|
|
17
|
+
export declare function dequeueDiscountCode(code: string): void;
|
|
18
|
+
/** Hold a code until the cart can take it. Re-queueing the same code is a no-op. */
|
|
19
|
+
export declare function queueDiscountCode(code: string): void;
|
|
20
|
+
/** Remove and return every held code — the engine's flush, once a cart exists. */
|
|
21
|
+
export declare function takeQueuedDiscountCodes(): readonly string[];
|
|
22
|
+
export declare function readQueuedDiscountCodes(): readonly string[];
|
|
23
|
+
/** Reactive read — the codes waiting for an item. */
|
|
24
|
+
export declare function useQueuedDiscountCodes(): readonly string[];
|
|
@@ -16,6 +16,7 @@ export { useCartDrawer } from './cart/use-cart-drawer';
|
|
|
16
16
|
export { useCartView, type CartViewModel, type ExitPending } from './cart/use-cart-view';
|
|
17
17
|
export { useSafeCart, type SafeCart } from './cart/use-safe-cart';
|
|
18
18
|
export { recordCartActionFailure, readCartActionFailures, clearCartActionFailures, useCartActionFailures, useCartActionFailuresFor, type CartActionFailure, type CartActionSubject, } from './cart/cart-action-failures';
|
|
19
|
+
export { queueDiscountCode, takeQueuedDiscountCodes, readQueuedDiscountCodes, withQueuedDiscountCodes, isDiscountCodeQueued, dequeueDiscountCode, useQueuedDiscountCodes, } from './cart/queued-discount-codes';
|
|
19
20
|
export { useCartLineRow, type CartLineRowState, type CartLineInteraction, } from './cart/use-cart-line-row';
|
|
20
21
|
export { openCartDrawer, openCartDrawerFocusedOn, closeCartDrawer, toggleCartDrawer, useCartDrawerOpen, useCartDrawerFocus, type CartDrawerFocus, } from './cart/cart-drawer-store';
|
|
21
22
|
export { armCheckoutHandoff, refuseCheckoutHandoff, consumeArmedCheckoutHandoff, disarmCheckoutHandoff, settleArmedCheckoutHandoff, recordVisitorCheckoutExit, readCheckoutHandoff, useCheckoutHandoff, checkoutHandoffReasonFor, CHECKOUT_BLOCKED_REASON, CHECKOUT_NO_URL_REASON, CHECKOUT_EMPTY_CART_REASON, CHECKOUT_NO_LINK_REASON, type CheckoutHandoffOutcome, type CheckoutHandoffOrigin, type CheckoutHandoffState, } from './checkout/checkout-handoff-store';
|
|
@@ -7,3 +7,19 @@
|
|
|
7
7
|
* single-purpose and expires in seconds (`@fourty/platform/socket-ticket`).
|
|
8
8
|
*/
|
|
9
9
|
export declare const SOCKET_TICKET_PARAM = "ticket";
|
|
10
|
+
/**
|
|
11
|
+
* How a socket carries a BEARER — long-lived, so never on the URL: Cloud Run's
|
|
12
|
+
* request log records every full URL, whatever the app does.
|
|
13
|
+
*
|
|
14
|
+
* A browser WebSocket can set exactly one handshake header,
|
|
15
|
+
* `Sec-WebSocket-Protocol`, by offering subprotocols. The dialer offers
|
|
16
|
+
* `SOCKET_SUBPROTOCOL` first — the one the server echoes (`ws` selects the first
|
|
17
|
+
* offer), so the bearer never comes back in the response — then the bearer under
|
|
18
|
+
* `SOCKET_BEARER_SUBPROTOCOL_PREFIX`. A JWT's alphabet is all legal here.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SOCKET_SUBPROTOCOL = "fourty.v1";
|
|
21
|
+
export declare const SOCKET_BEARER_SUBPROTOCOL_PREFIX = "fourty.bearer.";
|
|
22
|
+
/** The second argument of `new WebSocket(url, …)` for a dial holding `bearer`. */
|
|
23
|
+
export declare function socketProtocolsFor(bearer: string): string[];
|
|
24
|
+
/** The bearer out of a `Sec-WebSocket-Protocol` header, if it offers one. */
|
|
25
|
+
export declare function bearerFromSocketProtocols(header: string | undefined): string | undefined;
|
|
@@ -43,7 +43,8 @@ export { MAX_ATTACHMENT_MB, AttachmentUploadError, attachmentFailureOfStatus, ty
|
|
|
43
43
|
export { ENTRY_CONTEXT_MAX_VALUE_CHARS, ENTRY_CONTEXT_MAX_KEYS, ENTRY_CONTEXT_MAX_NAMESPACES, ENTRY_CONTEXT_MAX_NAME_CHARS, EntryContextValueSchema, EntryContextNamespaceSchema, EntryContextSchema, type EntryContext, } from './contracts/entry-context';
|
|
44
44
|
export { ARRIVAL_MAX_VALUE_CHARS, SURFACES, SurfaceSchema, type Surface, CLICK_ID_KINDS, ClickIdKindSchema, type ClickIdKind, VISITOR_ID_DURABILITIES, VisitorIdDurabilitySchema, type VisitorIdDurability, TRAFFIC_BUCKETS, TrafficBucketSchema, type TrafficBucket, SessionArrivalSchema, type SessionArrival, type RecordedSessionArrival, } from './contracts/session-arrival';
|
|
45
45
|
export { ARRIVAL_PARAMS, REFERRER_HOST_PARAM, arrivalFromParams, arrivalToParams, type ArrivalEvidence, } from './contracts/session-arrival-params';
|
|
46
|
-
export { SOCKET_TICKET_PARAM } from './contracts/socket-ticket-param';
|
|
46
|
+
export { SOCKET_TICKET_PARAM, SOCKET_SUBPROTOCOL, SOCKET_BEARER_SUBPROTOCOL_PREFIX, socketProtocolsFor, bearerFromSocketProtocols, } from './contracts/socket-ticket-param';
|
|
47
|
+
export { CUSTOMER_ACCOUNT_SESSION_HEADER } from './contracts/customer-account-session-header';
|
|
47
48
|
export { WIRE_PROTOCOL_VERSION, MIN_WIRE_PROTOCOL_VERSION, WIRE_PROTOCOL_PARAM, WIRE_PROTOCOL_UNSUPPORTED_CLOSE, } from './contracts/wire-protocol';
|
|
48
49
|
export { type AttributeDef, type AttributeRegistry, type AttributeScopeBucket, type AttributeScopeConfig, AttributeDefSchema, AttributeScopeBucketSchema, AttributeScopeConfigSchema, EXTRAS_PREFIX, } from './catalog/attribute-registry';
|
|
49
50
|
export { resolveScope, normalizeAttributeField, scopedAttributeKey, scopeOfAttributeKey, } from './catalog/attribute-scope';
|
|
@@ -52,6 +53,7 @@ export type { HostedApp, SpaceConfig, SpaceWithConfig, VisitorAccess } from './s
|
|
|
52
53
|
export type { ConnectorDescriptor, ConnectorFieldDescriptor } from './space/connector';
|
|
53
54
|
export { AgentDirectiveSchema, SpaceAgentDirectiveSchema, SpaceAgentDirectiveListItemSchema, UpdateAgentDirectiveInputSchema, ReorderAgentDirectivesInputSchema, AGENT_DIRECTIVE_KINDS, AGENT_DIRECTIVE_SEVERITIES, AGENT_DIRECTIVE_SOURCES, AGENT_DIRECTIVE_STATUSES, MAX_ACTIVE_AGENT_DIRECTIVES, } from './space/agent-directive';
|
|
54
55
|
export type { AgentDirective, SpaceAgentDirective, SpaceAgentDirectiveListItem, UpdateAgentDirectiveInput, } from './space/agent-directive';
|
|
56
|
+
export { BotCheckNoticeSchema, type BotCheckNotice } from './shell/bot-check-notice';
|
|
55
57
|
export { DEFAULT_SPACE_LOCALE, SpaceLocaleSchema, textDirectionOf, languageOf, languageNameOf, spaceLocaleOf, declaredSpaceLocaleOf, SUPPORTED_SPACE_LOCALES, } from './space/space-locale';
|
|
56
58
|
export type { TextDirection } from './space/space-locale';
|
|
57
59
|
export { DEFAULT_SPACE_CONFIG, DEFAULT_VISITOR_ACCESS, VISITOR_ACCESS, visitorAccessOf, } from './space/space-config';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The bot check's disclosure a spacefront shows — words and links the host
|
|
4
|
+
* supplies and a brand's footer renders (`useBotCheckNotice` in the sdk).
|
|
5
|
+
*
|
|
6
|
+
* The platform checks every spacefront visitor with an invisible bot check
|
|
7
|
+
* (reCAPTCHA Enterprise today). Its provider floats a badge over the page
|
|
8
|
+
* unless the page carries the provider's notice itself, and a brand's own
|
|
9
|
+
* chrome is the only place on the page that can carry it.
|
|
10
|
+
*/
|
|
11
|
+
export declare const BotCheckNoticeSchema: z.ZodObject<{
|
|
12
|
+
/** Read in order: plain text, and links the notice must keep linked. */
|
|
13
|
+
segments: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
14
|
+
text: z.ZodString;
|
|
15
|
+
href: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
text: string;
|
|
18
|
+
href: string;
|
|
19
|
+
}, {
|
|
20
|
+
text: string;
|
|
21
|
+
href: string;
|
|
22
|
+
}>]>, "many">;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
segments: (string | {
|
|
25
|
+
text: string;
|
|
26
|
+
href: string;
|
|
27
|
+
})[];
|
|
28
|
+
}, {
|
|
29
|
+
segments: (string | {
|
|
30
|
+
text: string;
|
|
31
|
+
href: string;
|
|
32
|
+
})[];
|
|
33
|
+
}>;
|
|
34
|
+
export type BotCheckNotice = z.infer<typeof BotCheckNoticeSchema>;
|
|
@@ -68,8 +68,9 @@ export interface ConnectorDescriptor {
|
|
|
68
68
|
*/
|
|
69
69
|
browserConfig: readonly string[];
|
|
70
70
|
/**
|
|
71
|
-
* The `config` keys that are server-only credentials. Each is held
|
|
72
|
-
*
|
|
71
|
+
* The `config` keys that are server-only credentials. Each is held
|
|
72
|
+
* encrypted by the api (`connector_secret_ciphertexts`), keyed by space,
|
|
73
|
+
* platform and key.
|
|
73
74
|
* Never also in `browserConfig`.
|
|
74
75
|
*/
|
|
75
76
|
vaultedConfig: readonly string[];
|
|
@@ -57,6 +57,10 @@ export interface SpaceConfig {
|
|
|
57
57
|
* every page it measures, so it is the other config key besides
|
|
58
58
|
* `componentSources` the public projection may carry. */
|
|
59
59
|
facebookPixelId?: string;
|
|
60
|
+
/** The brand's OWN Google Tag Manager container id (`GTM-XXXXXXX`), loaded on
|
|
61
|
+
* their spacefront. Absent = no container on this spacefront. Same
|
|
62
|
+
* publication rule as `googleAnalyticsId`. */
|
|
63
|
+
googleTagManagerId?: string;
|
|
60
64
|
/** The language this space speaks (BCP 47, e.g. `he-IL`) — agent output, UI
|
|
61
65
|
* chrome, direction and formatting all follow it. Absent ⇒ `en-US`. Public
|
|
62
66
|
* by design: the page renders in it. See `space-locale.ts`. */
|