@40rty/ams-sdk 0.5.5 → 0.5.6
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 +11 -2
- package/dist/types/sdk/src/catalog/registration/types.d.ts +4 -3
- package/dist/types/sdk/src/host/host-modules.d.ts +1 -0
- package/dist/types/sdk/src/verticals/commerce/commerce-context.d.ts +6 -2
- package/dist/types/sdk/src/verticals/commerce/commerce-shapes.d.ts +16 -0
- package/dist/types/sdk/src/verticals/commerce/index.d.ts +2 -2
- package/dist/types/spacestation/src/contracts/tools/definitions.d.ts +9 -0
- package/dist/types/spacestation/src/signal/agent-signals.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -580,6 +580,7 @@ __export(src_exports3, {
|
|
|
580
580
|
useConversationState: () => useConversationState,
|
|
581
581
|
useConversations: () => useConversations,
|
|
582
582
|
useCurrentMessageIndex: () => useCurrentMessageIndex,
|
|
583
|
+
useCustomerAccount: () => useCustomerAccount,
|
|
583
584
|
useDebug: () => useDebug,
|
|
584
585
|
useDictation: () => useDictation,
|
|
585
586
|
useDismissedLabels: () => useDismissedLabels,
|
|
@@ -10517,6 +10518,7 @@ __export(commerce_exports, {
|
|
|
10517
10518
|
useCommerceActions: () => useCommerceActions,
|
|
10518
10519
|
useCommerceRuntime: () => useCommerceRuntime,
|
|
10519
10520
|
useComparisonHighlight: () => useComparisonHighlight,
|
|
10521
|
+
useCustomerAccount: () => useCustomerAccount,
|
|
10520
10522
|
useLookCard: () => useLookCard,
|
|
10521
10523
|
useOptionSelections: () => useOptionSelections,
|
|
10522
10524
|
usePendingVariantChoice: () => usePendingVariantChoice,
|
|
@@ -10605,7 +10607,10 @@ var INERT_COMMERCE_RUNTIME = {
|
|
|
10605
10607
|
highlights: [],
|
|
10606
10608
|
isLoading: false,
|
|
10607
10609
|
error: null
|
|
10608
|
-
})
|
|
10610
|
+
}),
|
|
10611
|
+
useCustomerAccount: () => ({ signedIn: false, email: null, signIn: () => {
|
|
10612
|
+
}, signOut: async () => {
|
|
10613
|
+
}, available: false })
|
|
10609
10614
|
};
|
|
10610
10615
|
var FourtyCommerceRuntimeContext = createContext25(
|
|
10611
10616
|
INERT_COMMERCE_RUNTIME
|
|
@@ -10635,6 +10640,9 @@ function useCollectionByHandle(handle) {
|
|
|
10635
10640
|
function useProductReviews(product, intent) {
|
|
10636
10641
|
return useCommerceRuntime().useProductReviews(product, intent);
|
|
10637
10642
|
}
|
|
10643
|
+
function useCustomerAccount() {
|
|
10644
|
+
return useCommerceRuntime().useCustomerAccount();
|
|
10645
|
+
}
|
|
10638
10646
|
|
|
10639
10647
|
// src/verticals/commerce/checkout/external-navigation.ts
|
|
10640
10648
|
function navigateToExternalCommerceUrl(url) {
|
|
@@ -12300,7 +12308,7 @@ function useContentActions() {
|
|
|
12300
12308
|
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
12301
12309
|
|
|
12302
12310
|
// package.json
|
|
12303
|
-
var version = "0.5.
|
|
12311
|
+
var version = "0.5.6";
|
|
12304
12312
|
|
|
12305
12313
|
// src/host/host-modules.ts
|
|
12306
12314
|
import * as react from "react";
|
|
@@ -12963,6 +12971,7 @@ export {
|
|
|
12963
12971
|
useConversationState,
|
|
12964
12972
|
useConversations,
|
|
12965
12973
|
useCurrentMessageIndex,
|
|
12974
|
+
useCustomerAccount,
|
|
12966
12975
|
useDebug,
|
|
12967
12976
|
useDictation,
|
|
12968
12977
|
useDismissedLabels,
|
|
@@ -69,9 +69,10 @@ export interface FourtyPackage {
|
|
|
69
69
|
}>;
|
|
70
70
|
/**
|
|
71
71
|
* URL of the package's own page stylesheet — set for a package whose CSS is
|
|
72
|
-
* PUBLISHED with it rather than compiled into the page that renders it.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
72
|
+
* PUBLISHED with it rather than compiled into the page that renders it.
|
|
73
|
+
* Installed into whatever document or shadow root draws the package
|
|
74
|
+
* (`@fourty/spacefront`'s `PackageScope`); the console never draws one in
|
|
75
|
+
* its own document.
|
|
75
76
|
*/
|
|
76
77
|
stylesheet?: string;
|
|
77
78
|
/**
|
|
@@ -343,6 +343,7 @@ export declare const HOST_MODULES: {
|
|
|
343
343
|
useProducts: typeof sdk.useProducts;
|
|
344
344
|
useCollectionByHandle: typeof sdk.useCollectionByHandle;
|
|
345
345
|
useProductReviews: typeof sdk.useProductReviews;
|
|
346
|
+
useCustomerAccount: typeof sdk.useCustomerAccount;
|
|
346
347
|
useCommerceRuntime: typeof sdk.useCommerceRuntime;
|
|
347
348
|
FourtyCommerceRuntimeProvider: react.Provider<sdk.FourtyCommerceRuntime>;
|
|
348
349
|
navigateToExternalCommerceUrl: typeof sdk.navigateToExternalCommerceUrl;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Product } from '../../../../ecommerce/src/index';
|
|
2
|
-
export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
|
|
3
|
-
import type { AddToCartApi, CartAddHints, CartApi, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
|
|
2
|
+
export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, CustomerAccountApi, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
|
|
3
|
+
import type { AddToCartApi, CartAddHints, CartApi, CustomerAccountApi, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
|
|
4
4
|
/**
|
|
5
5
|
* FourtyCommerceRuntime — the commerce-hook surface the catalog
|
|
6
6
|
* consumes. Same dependency-inversion pattern as `FourtyRuntime`: these
|
|
@@ -28,6 +28,7 @@ export interface FourtyCommerceRuntime {
|
|
|
28
28
|
* reviews yet is generated on demand server-side from its title +
|
|
29
29
|
* description, so the hook needs that context, not just the id. */
|
|
30
30
|
useProductReviews: (product: Product | undefined, intent?: string) => ProductReviewsResult;
|
|
31
|
+
useCustomerAccount: () => CustomerAccountApi;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Provider for the commerce-hook surface. Mounted by the SDK's
|
|
@@ -60,3 +61,6 @@ export declare function useCollectionByHandle(handle: string | undefined): Produ
|
|
|
60
61
|
* a separate, third-party-shaped system, independent of the active
|
|
61
62
|
* commerce platform. Degrades to empty without a `<CommerceProvider>`. */
|
|
62
63
|
export declare function useProductReviews(product: Product | undefined, intent?: string): ProductReviewsResult;
|
|
64
|
+
/** The visitor's sign-in to the store's customer accounts. Inert (not
|
|
65
|
+
* available) without a `<CommerceProvider>`. */
|
|
66
|
+
export declare function useCustomerAccount(): CustomerAccountApi;
|
|
@@ -171,3 +171,19 @@ export interface ProductReviewsResult {
|
|
|
171
171
|
isLoading: boolean;
|
|
172
172
|
error: Error | null;
|
|
173
173
|
}
|
|
174
|
+
/** Return shape of the commerce `useCustomerAccount` hook — the visitor's
|
|
175
|
+
* sign-in to the store's own customer accounts, for this session. The token
|
|
176
|
+
* never reaches the page: this is only whether they are signed in, and as whom. */
|
|
177
|
+
export interface CustomerAccountApi {
|
|
178
|
+
/** `null` until the first check answers. */
|
|
179
|
+
signedIn: boolean | null;
|
|
180
|
+
/** Who is signed in, when they are. */
|
|
181
|
+
email: string | null;
|
|
182
|
+
/** Leave for the store's sign-in; the page comes back signed in. */
|
|
183
|
+
signIn: () => void;
|
|
184
|
+
/** Drop this session's sign-in. */
|
|
185
|
+
signOut: () => Promise<void>;
|
|
186
|
+
/** False where the page has no customer sign-in to offer (no session yet,
|
|
187
|
+
* or a space addressed by id, as in a console preview). */
|
|
188
|
+
available: boolean;
|
|
189
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './chip-relevance';
|
|
2
|
-
export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
|
|
3
|
-
export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
|
|
2
|
+
export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCustomerAccount, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
|
|
3
|
+
export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CustomerAccountApi, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
|
|
4
4
|
export { navigateToExternalCommerceUrl } from './checkout/external-navigation';
|
|
5
5
|
export type { ExternalNavigationResult } from './checkout/external-navigation';
|
|
6
6
|
export { recordVariantSelection, getVariantSelection, useVariantSelections, } from './variant/variant-selection-store';
|
|
@@ -71,6 +71,15 @@ export interface FourtyToolDefDescriptor {
|
|
|
71
71
|
* on) takes precedence.
|
|
72
72
|
*/
|
|
73
73
|
defaultEnabled?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Whether a session may replay this tool's result for an identical call.
|
|
76
|
+
* Absent = `true`: the registry's per-session cache answers a repeat
|
|
77
|
+
* `(name, args)` without running the tool. Set `false` for a tool whose
|
|
78
|
+
* answer follows visitor state that changes mid-session with the same args
|
|
79
|
+
* — a signed-in shopper's account reads "not signed in" until they sign in,
|
|
80
|
+
* and a replay would keep saying so after they have.
|
|
81
|
+
*/
|
|
82
|
+
cacheResults?: boolean;
|
|
74
83
|
/**
|
|
75
84
|
* Declarative absorb shape — when present, the agent's per-session
|
|
76
85
|
* entity registry harvests entries from this tool's result without
|
|
@@ -247,6 +247,11 @@ export interface ActionDefinition {
|
|
|
247
247
|
* e.g. `text.delta`). Tells the SDK to debounce/batch and tells the LLM
|
|
248
248
|
* the cadence is allowed. */
|
|
249
249
|
streaming?: boolean;
|
|
250
|
+
/** The tool this action belongs beside. When set, the action is offered
|
|
251
|
+
* only while that tool is enabled for the space — one switch turns on a
|
|
252
|
+
* capability and the verb that acts on it (`customer.signin` follows
|
|
253
|
+
* `get_customer_account`). Absent → offered to every space. */
|
|
254
|
+
requiresTool?: string;
|
|
250
255
|
/**
|
|
251
256
|
* How this action's real-world effect is CONFIRMED. An action tool only
|
|
252
257
|
* dispatches a client signal — the effect (a cart write, a wishlist
|