@40rty/ams-sdk 0.5.19 → 0.5.20

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 CHANGED
@@ -353,6 +353,7 @@ __export(src_exports3, {
353
353
  classifyItemChange: () => classifyItemChange,
354
354
  clearAgentPresence: () => clearAgentPresence,
355
355
  clearCartActionFailures: () => clearCartActionFailures,
356
+ clearCatalogSearches: () => clearCatalogSearches,
356
357
  clearCodeDiscountSources: () => clearCodeDiscountSources,
357
358
  clearProductNameLookups: () => clearProductNameLookups,
358
359
  clearShopCheckouts: () => clearShopCheckouts,
@@ -502,6 +503,7 @@ __export(src_exports3, {
502
503
  recordVisitorCheckoutExit: () => recordVisitorCheckoutExit,
503
504
  reducePatch: () => reducePatch,
504
505
  refuseCheckoutHandoff: () => refuseCheckoutHandoff,
506
+ registerCatalogSearch: () => registerCatalogSearch,
505
507
  registerChipRelevanceRule: () => registerChipRelevanceRule,
506
508
  registerCodeDiscountSource: () => registerCodeDiscountSource,
507
509
  registerComponent: () => registerComponent,
@@ -531,6 +533,7 @@ __export(src_exports3, {
531
533
  requestVariantChoice: () => requestVariantChoice,
532
534
  requiredTopLevelProps: () => requiredTopLevelProps,
533
535
  resetServerState: () => resetServerState,
536
+ resolveCatalogSearch: () => resolveCatalogSearch,
534
537
  resolveCodeDiscountSource: () => resolveCodeDiscountSource,
535
538
  resolveHydrators: () => resolveHydrators,
536
539
  resolvePresenceFactForm: () => resolvePresenceFactForm,
@@ -5145,6 +5148,7 @@ __export(src_exports2, {
5145
5148
  buildPdpCompanionsConfig: () => buildPdpCompanionsConfig,
5146
5149
  cartLineMatchesSelections: () => cartLineMatchesSelections,
5147
5150
  cartLinesForProduct: () => cartLinesForProduct,
5151
+ clearCatalogSearches: () => clearCatalogSearches,
5148
5152
  clearCodeDiscountSources: () => clearCodeDiscountSources,
5149
5153
  clearProductNameLookups: () => clearProductNameLookups,
5150
5154
  clearShopCheckouts: () => clearShopCheckouts,
@@ -5168,11 +5172,13 @@ __export(src_exports2, {
5168
5172
  readBaseAttributesConfig: () => readBaseAttributesConfig,
5169
5173
  readBucketLabelsConfig: () => readBucketLabelsConfig,
5170
5174
  readPdpCompanions: () => readPdpCompanions,
5175
+ registerCatalogSearch: () => registerCatalogSearch,
5171
5176
  registerCodeDiscountSource: () => registerCodeDiscountSource,
5172
5177
  registerProductNameLookup: () => registerProductNameLookup,
5173
5178
  registerShopCheckout: () => registerShopCheckout,
5174
5179
  registerStoreArticleLookup: () => registerStoreArticleLookup,
5175
5180
  registerStoreThemeSource: () => registerStoreThemeSource,
5181
+ resolveCatalogSearch: () => resolveCatalogSearch,
5176
5182
  resolveCodeDiscountSource: () => resolveCodeDiscountSource,
5177
5183
  resolveProductNameLookup: () => resolveProductNameLookup,
5178
5184
  resolveShopCheckout: () => resolveShopCheckout,
@@ -5932,36 +5938,52 @@ function clearStoreArticleLookups() {
5932
5938
  factories2.length = 0;
5933
5939
  }
5934
5940
 
5935
- // ../ecommerce/src/shop-checkout.ts
5941
+ // ../ecommerce/src/catalog-search.ts
5936
5942
  var factories3 = [];
5937
- function registerShopCheckout(factory) {
5943
+ function registerCatalogSearch(factory) {
5938
5944
  factories3.push(factory);
5939
5945
  }
5940
- function resolveShopCheckout(platformConfig) {
5946
+ function resolveCatalogSearch(platformConfig) {
5941
5947
  for (const factory of factories3) {
5948
+ const search = factory(platformConfig);
5949
+ if (search !== void 0) return search;
5950
+ }
5951
+ return void 0;
5952
+ }
5953
+ function clearCatalogSearches() {
5954
+ factories3.length = 0;
5955
+ }
5956
+
5957
+ // ../ecommerce/src/shop-checkout.ts
5958
+ var factories4 = [];
5959
+ function registerShopCheckout(factory) {
5960
+ factories4.push(factory);
5961
+ }
5962
+ function resolveShopCheckout(platformConfig) {
5963
+ for (const factory of factories4) {
5942
5964
  const maker = factory(platformConfig);
5943
5965
  if (maker !== void 0) return maker;
5944
5966
  }
5945
5967
  return void 0;
5946
5968
  }
5947
5969
  function clearShopCheckouts() {
5948
- factories3.length = 0;
5970
+ factories4.length = 0;
5949
5971
  }
5950
5972
 
5951
5973
  // ../ecommerce/src/code-discounts.ts
5952
- var factories4 = [];
5974
+ var factories5 = [];
5953
5975
  function registerCodeDiscountSource(factory) {
5954
- factories4.push(factory);
5976
+ factories5.push(factory);
5955
5977
  }
5956
5978
  function resolveCodeDiscountSource(options) {
5957
- for (const factory of factories4) {
5979
+ for (const factory of factories5) {
5958
5980
  const source = factory(options);
5959
5981
  if (source !== void 0) return source;
5960
5982
  }
5961
5983
  return void 0;
5962
5984
  }
5963
5985
  function clearCodeDiscountSources() {
5964
- factories4.length = 0;
5986
+ factories5.length = 0;
5965
5987
  }
5966
5988
 
5967
5989
  // ../ecommerce/src/store-theme.ts
@@ -5971,19 +5993,19 @@ var StoreThemeAccessError = class extends Error {
5971
5993
  this.name = "StoreThemeAccessError";
5972
5994
  }
5973
5995
  };
5974
- var factories5 = [];
5996
+ var factories6 = [];
5975
5997
  function registerStoreThemeSource(factory) {
5976
- factories5.push(factory);
5998
+ factories6.push(factory);
5977
5999
  }
5978
6000
  function resolveStoreThemeSource(options) {
5979
- for (const factory of factories5) {
6001
+ for (const factory of factories6) {
5980
6002
  const source = factory(options);
5981
6003
  if (source !== void 0) return source;
5982
6004
  }
5983
6005
  return void 0;
5984
6006
  }
5985
6007
  function clearStoreThemeSources() {
5986
- factories5.length = 0;
6008
+ factories6.length = 0;
5987
6009
  }
5988
6010
 
5989
6011
  // ../ecommerce/src/installment-offer.ts
@@ -13059,7 +13081,7 @@ function useContentActions() {
13059
13081
  import { useEffect as useEffect19, useState as useState19 } from "react";
13060
13082
 
13061
13083
  // package.json
13062
- var version = "0.5.19";
13084
+ var version = "0.5.20";
13063
13085
 
13064
13086
  // src/host/host-modules.ts
13065
13087
  import * as react from "react";
@@ -13494,6 +13516,7 @@ export {
13494
13516
  classifyItemChange,
13495
13517
  clearAgentPresence,
13496
13518
  clearCartActionFailures,
13519
+ clearCatalogSearches,
13497
13520
  clearCodeDiscountSources,
13498
13521
  clearProductNameLookups,
13499
13522
  clearShopCheckouts,
@@ -13644,6 +13667,7 @@ export {
13644
13667
  recordVisitorCheckoutExit,
13645
13668
  reducePatch,
13646
13669
  refuseCheckoutHandoff,
13670
+ registerCatalogSearch,
13647
13671
  registerChipRelevanceRule,
13648
13672
  registerCodeDiscountSource,
13649
13673
  registerComponent,
@@ -13673,6 +13697,7 @@ export {
13673
13697
  requestVariantChoice,
13674
13698
  requiredTopLevelProps,
13675
13699
  resetServerState,
13700
+ resolveCatalogSearch,
13676
13701
  resolveCodeDiscountSource,
13677
13702
  resolveHydrators,
13678
13703
  resolvePresenceFactForm,
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A space's own product search, served by its API, for a platform whose
3
+ * search cannot run in the browser (it needs a credential the page must not
4
+ * hold, like a saved catalog read with our bearer).
5
+ *
6
+ * The search is INJECTED (§IX), like the store-article lookup: the platform
7
+ * binding registers a factory, and the route that serves it never names a
8
+ * platform. A space whose options no factory claims has no served search.
9
+ */
10
+ import type { Product } from './commerce-schemas';
11
+ export interface CatalogSearchInput {
12
+ query: string;
13
+ limit: number;
14
+ /** The previous page's `nextCursor`; absent = the first page. */
15
+ cursor?: string;
16
+ /** Major units of the space's currency. */
17
+ minPrice?: number;
18
+ maxPrice?: number;
19
+ }
20
+ export interface CatalogSearchPage {
21
+ items: Product[];
22
+ /** Absent on the last page. */
23
+ nextCursor?: string;
24
+ }
25
+ export type CatalogSearch = (input: CatalogSearchInput) => Promise<CatalogSearchPage>;
26
+ /** A search for a space's platform config, or `undefined` when the platform is not this factory's. */
27
+ export type CatalogSearchFactory = (platformConfig: unknown) => CatalogSearch | undefined;
28
+ export declare function registerCatalogSearch(factory: CatalogSearchFactory): void;
29
+ /** First registered factory that claims this platform config. */
30
+ export declare function resolveCatalogSearch(platformConfig: unknown): CatalogSearch | undefined;
31
+ /** Test seam: drops every registration. */
32
+ export declare function clearCatalogSearches(): void;
@@ -12,6 +12,7 @@ export { buildBaseAttributesConfig, readBaseAttributesConfig } from './base-attr
12
12
  export { buildBucketLabelsConfig, readBucketLabelsConfig } from './bucket-labels';
13
13
  export { registerProductNameLookup, resolveProductNameLookup, clearProductNameLookups, type ProductNameLookup, type ProductNameLookupFactory, type ProductNameMatch, } from './product-lookup';
14
14
  export { registerStoreArticleLookup, resolveStoreArticleLookup, clearStoreArticleLookups, type StoreArticle, type StoreArticleLookup, type StoreArticleLookupFactory, } from './store-articles';
15
+ export { registerCatalogSearch, resolveCatalogSearch, clearCatalogSearches, type CatalogSearch, type CatalogSearchFactory, type CatalogSearchInput, type CatalogSearchPage, } from './catalog-search';
15
16
  export { registerShopCheckout, resolveShopCheckout, clearShopCheckouts, type ShopCheckoutLine, type ShopCheckoutMaker, type ShopCheckoutFactory, } from './shop-checkout';
16
17
  export { registerCodeDiscountSource, resolveCodeDiscountSource, clearCodeDiscountSources, type CodeDiscountSource, type CodeDiscountSourceFactory, type CodeDiscountTerms, type StoreCodeDiscount, } from './code-discounts';
17
18
  export { registerStoreThemeSource, resolveStoreThemeSource, clearStoreThemeSources, StoreThemeAccessError, type StoreThemeSource, type StoreThemeSourceFactory, type StoreThemeFile, type StoreThemeFilesPage, type StoreThemeProduct, } from './store-theme';
@@ -4883,6 +4883,9 @@ export declare const HOST_MODULES: {
4883
4883
  registerStoreArticleLookup: typeof ecommerce.registerStoreArticleLookup;
4884
4884
  resolveStoreArticleLookup: typeof ecommerce.resolveStoreArticleLookup;
4885
4885
  clearStoreArticleLookups: typeof ecommerce.clearStoreArticleLookups;
4886
+ registerCatalogSearch: typeof ecommerce.registerCatalogSearch;
4887
+ resolveCatalogSearch: typeof ecommerce.resolveCatalogSearch;
4888
+ clearCatalogSearches: typeof ecommerce.clearCatalogSearches;
4886
4889
  registerShopCheckout: typeof ecommerce.registerShopCheckout;
4887
4890
  resolveShopCheckout: typeof ecommerce.resolveShopCheckout;
4888
4891
  clearShopCheckouts: typeof ecommerce.clearShopCheckouts;
@@ -27,6 +27,13 @@ export interface ConnectorFieldDescriptor {
27
27
  * config field must be named in `browserConfig` (publishable — designed to
28
28
  * ship in client code) or `vaultedConfig` (server-only). */
29
29
  secret: boolean;
30
+ /** The connector connects without it — left empty, it is not stored (and
31
+ * a stored one is cleared). Absent: required. */
32
+ optional?: true;
33
+ /** Where an app conventionally keeps this value, as `.env` names in the
34
+ * connector's own vocabulary (`PUBLIC_STORE_DOMAIN`). `forty connect` reads
35
+ * the first one set when its flag is not given; the console ignores it. */
36
+ env?: readonly string[];
30
37
  }
31
38
  /**
32
39
  * A connector, as the console renders it. A space has MANY — one per platform
@@ -55,7 +62,7 @@ export interface ConnectorDescriptor {
55
62
  /** The heading the console files it under, in the connector's own words
56
63
  * ("Ecommerce"). Connectors that serve the same kind of space sit together. */
57
64
  category: string;
58
- /** What connecting it asks for, in order. Every one is required. */
65
+ /** What connecting it asks for, in order. Required unless marked `optional`. */
59
66
  fields: ConnectorFieldDescriptor[];
60
67
  /** Whether the connector can check typed values against the live service
61
68
  * before they are saved. */
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "react": "^18.3.0 || ^19.0.0",
27
27
  "react-dom": "^18.3.0 || ^19.0.0"
28
28
  },
29
- "version": "0.5.19",
29
+ "version": "0.5.20",
30
30
  "homepage": "https://docs.40rty.ai",
31
31
  "license": "UNLICENSED",
32
32
  "engines": {