platform-types 1.10.774 → 1.10.775

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PRODUCT_MEDIA_INVALID_REASONS = exports.MAX_PRODUCT_PICTURE_ALT_CHARS = exports.PRODUCT_UPSERT_ERROR_CODES = exports.PRODUCT_UPSERT_ROW_ERROR_CODES = exports.PRODUCT_UPSERT_ROW_CAP = exports.PUBLIC_PRODUCT_SUGGEST_ERROR_CODES = exports.PUBLIC_PRODUCT_BY_SLUG_ERROR_CODES = exports.PRODUCT_PUBLISH_OVERDUE_AFTER_MS = exports.PRODUCT_PUBLISH_AT_MAX_AHEAD_MS = exports.PRODUCT_POST_ERROR_CODES = exports.PRODUCT_IDENTITY_ERROR_CODES = exports.PRODUCT_EXPORT_ERROR_CODES = exports.PRODUCT_CATALOG_EXPORT_COLUMNS = exports.DISCOVERY_SORTS = exports.MAX_BASE_QUANTITY = exports.BASE_QUANTITY_DECIMAL_PLACES = void 0;
3
+ exports.PRODUCT_MEDIA_INVALID_REASONS = exports.MAX_PRODUCT_PICTURE_ALT_CHARS = exports.PRODUCT_UPSERT_ERROR_CODES = exports.PRODUCT_UPSERT_ROW_ERROR_CODES = exports.PRODUCT_UPSERT_ROW_CAP = exports.PUBLIC_PRODUCT_SUGGEST_ERROR_CODES = exports.PUBLIC_PRODUCT_BY_SLUG_ERROR_CODES = exports.PRODUCT_PUBLISH_OVERDUE_AFTER_MS = exports.PRODUCT_PUBLISH_AT_MAX_AHEAD_MS = exports.PRODUCT_POST_ERROR_CODES = exports.PRODUCT_IDENTITY_ERROR_CODES = exports.PRODUCT_EXPORT_ERROR_CODES = exports.PRODUCT_CATALOG_EXPORT_COLUMNS = exports.RECENT_PURCHASES_MAX = exports.BEST_SELLERS_MAX = exports.DISCOVERY_SORTS = exports.MAX_BASE_QUANTITY = exports.BASE_QUANTITY_DECIMAL_PLACES = void 0;
4
4
  /** Maximum decimal places in a canonical base quantity; inputs are exact, never rounded. */
5
5
  exports.BASE_QUANTITY_DECIMAL_PLACES = 6;
6
6
  /** Absolute base-quantity input bound; signed adjustments admit the negative of this value. */
@@ -11,6 +11,10 @@ exports.MAX_BASE_QUANTITY = 1_000_000;
11
11
  * order them inside one bounded request).
12
12
  */
13
13
  exports.DISCOVERY_SORTS = ['newest'];
14
+ /** Most products the store's best-seller ranking holds, and web `mode=best-sellers` returns. */
15
+ exports.BEST_SELLERS_MAX = 50;
16
+ /** Most distinct products a buyer's recent-purchases row holds, and web `mode=recently-bought` returns. */
17
+ exports.RECENT_PURCHASES_MAX = 50;
14
18
  /**
15
19
  * The CSV header of `GET /products?mode=export`, in file order.
16
20
  *
@@ -205,6 +205,8 @@ exports.STOREFRONT_PREVIEW_READ_OPERATIONS = [
205
205
  'product',
206
206
  'productBySlug',
207
207
  'productsByIds',
208
+ 'bestSellers',
209
+ 'recentlyBought',
208
210
  'products',
209
211
  'incomes',
210
212
  'group',
@@ -1146,6 +1146,11 @@ declare global {
1146
1146
  invoiceId?: string;
1147
1147
  accountId?: string;
1148
1148
  }
1149
+ /** One entry of `CustomerDataExport.recentPurchases`: a product id and when it was last ordered (epoch ms). */
1150
+ interface CustomerRecentPurchaseExportEntry {
1151
+ productId: string;
1152
+ lastOrderedAt: number;
1153
+ }
1149
1154
  /**
1150
1155
  * Supported customer, CRM, order, invoice, ledger and directly customer-linked
1151
1156
  * payment collections, assembled for the SUBJECT
@@ -1225,6 +1230,14 @@ declare global {
1225
1230
  * `customer` object above never carries that array.
1226
1231
  */
1227
1232
  favorites: CustomerFavoriteExportEntry[];
1233
+ /**
1234
+ * The subject's recent purchases (`PURCHASES#{storeId}` / `{customerId}`), newest first:
1235
+ * the distinct products they ordered on the storefront or at the counter, at most
1236
+ * `RECENT_PURCHASES_MAX` per id. A merge does not move the row, so the row of every folded
1237
+ * id (up to the folded-id cap) is unioned in, one entry per product at its latest instant.
1238
+ * On BOTH surfaces; `[]` when the subject has none.
1239
+ */
1240
+ recentPurchases: CustomerRecentPurchaseExportEntry[];
1228
1241
  /**
1229
1242
  * Per COLLECTION, and honest: `true` means the read stopped before the
1230
1243
  * end of a partition, folded financial IDs were omitted at the cap, or whole
@@ -1246,6 +1259,8 @@ declare global {
1246
1259
  /** Present exactly when `contacts` is. */
1247
1260
  contacts?: boolean;
1248
1261
  favorites: boolean;
1262
+ /** `true` when folded ids past the cap were not read. */
1263
+ recentPurchases: boolean;
1249
1264
  };
1250
1265
  }
1251
1266
  /**
@@ -1531,6 +1546,14 @@ declare global {
1531
1546
  * On BOTH wires — the subject's own data, like the addresses.
1532
1547
  */
1533
1548
  favoritesEraseComplete: boolean;
1549
+ /**
1550
+ * `false` when the subject's recent-purchases row (`PURCHASES#{storeId}` / `{customerId}`,
1551
+ * one item per erased id) could not be deleted. The whole row goes: it is the subject's own
1552
+ * data (it is in their art. 14 export). Re-issuing the erasure re-runs the delete; BOTH
1553
+ * erasure handlers write a deduped `ERROR` row
1554
+ * (`CUSTOMER_ANONYMIZE_RECENT_PURCHASES_INCOMPLETE`). On BOTH wires.
1555
+ */
1556
+ recentPurchasesEraseComplete: boolean;
1534
1557
  /**
1535
1558
  * `RMA#` rows of this customer whose free text (`requestReason`,
1536
1559
  * `rejectionReason`) this erasure REMOVEd. The RMA row itself is kept —
package/dist/product.d.ts CHANGED
@@ -9,6 +9,10 @@ export declare const MAX_BASE_QUANTITY = 1000000;
9
9
  */
10
10
  export declare const DISCOVERY_SORTS: readonly ["newest"];
11
11
  export type DiscoverySort = (typeof DISCOVERY_SORTS)[number];
12
+ /** Most products the store's best-seller ranking holds, and web `mode=best-sellers` returns. */
13
+ export declare const BEST_SELLERS_MAX = 50;
14
+ /** Most distinct products a buyer's recent-purchases row holds, and web `mode=recently-bought` returns. */
15
+ export declare const RECENT_PURCHASES_MAX = 50;
12
16
  declare global {
13
17
  type ProductUnitsErrorCode = 'UNIT_REVISION_STALE' | 'UNIT_FACTOR_INVALID' | 'UNIT_FACTOR_MISMATCH' | 'UNIT_INCOMPATIBLE_DIMENSION' | 'UNIT_QUANTITY_UNREPRESENTABLE' | 'UNIT_QUANTITY_NOT_WHOLE';
14
18
  type ProductUnit = 'each' | 'gram' | 'kilogram' | 'millilitre' | 'litre' | 'metre';
@@ -285,6 +289,21 @@ declare global {
285
289
  /** Present while rows remain; absent means the walk is complete. */
286
290
  LastEvaluatedKey?: string;
287
291
  }
292
+ /**
293
+ * Web `GET /products?mode=best-sellers` and `mode=recently-bought`: at most 50 rows, no cursor,
294
+ * each priced and stocked for the caller as `mode=by-ids` does, withheld products dropped.
295
+ *
296
+ * `best-sellers` is rank order: units sold over the store's ABC window (`windowDays`, default
297
+ * 90), net of customer returns, services and disabled products excluded, recomputed nightly;
298
+ * `[]` before the first ranking. `recently-bought` is the signed-in, approved buyer's own last
299
+ * distinct products, newest first, read for the bearer's own customer and never for a query
300
+ * parameter; a guest gets `[]`. Both answer `Cache-Control: private, no-store` when a customer is
301
+ * resolved, and `recently-bought` always does.
302
+ */
303
+ interface PublicProductSourceResponse {
304
+ message: string;
305
+ data: PublicProduct[];
306
+ }
288
307
  /** Anonymous Web GET /products typeahead; the tenant comes from the public store context. */
289
308
  interface PublicProductSuggestInput {
290
309
  mode: 'suggest';
package/dist/product.js CHANGED
@@ -8,6 +8,10 @@ export const MAX_BASE_QUANTITY = 1_000_000;
8
8
  * order them inside one bounded request).
9
9
  */
10
10
  export const DISCOVERY_SORTS = ['newest'];
11
+ /** Most products the store's best-seller ranking holds, and web `mode=best-sellers` returns. */
12
+ export const BEST_SELLERS_MAX = 50;
13
+ /** Most distinct products a buyer's recent-purchases row holds, and web `mode=recently-bought` returns. */
14
+ export const RECENT_PURCHASES_MAX = 50;
11
15
  /**
12
16
  * The CSV header of `GET /products?mode=export`, in file order.
13
17
  *
@@ -1,4 +1,5 @@
1
1
  import type { StorefrontThemeWarning } from './storefrontTheme.ts';
2
+ import type { DiscoverySort } from './product.ts';
2
3
  /** The social kinds a contact may link, each to its own hosts; a contact links at most one per kind. */
3
4
  export declare const STOREFRONT_SOCIAL_HOSTS: {
4
5
  readonly instagram: readonly ["instagram.com", "www.instagram.com"];
@@ -109,8 +110,14 @@ export declare function createStorefrontDesignV1(): StorefrontDesignV1;
109
110
  declare global {
110
111
  type StorefrontDesignSectionType = (typeof STOREFRONT_SECTION_TYPES)[number];
111
112
  type StorefrontContactField = (typeof STOREFRONT_CONTACT_FIELDS)[number];
113
+ /**
114
+ * Where a products section's rows come from. `bestSellers` is the shop's ranking (web
115
+ * `GET /products?mode=best-sellers`, rank order); `recentlyBought` is the signed-in buyer's own
116
+ * last distinct products (`mode=recently-bought`, newest first), empty for a guest. A storefront
117
+ * that does not know a kind must render nothing for it.
118
+ */
112
119
  type StorefrontDesignProductSource = {
113
- kind: 'offers' | 'new';
120
+ kind: 'offers' | 'new' | 'bestSellers' | 'recentlyBought';
114
121
  } | {
115
122
  kind: 'category' | 'brand';
116
123
  id: string;
@@ -167,6 +174,13 @@ declare global {
167
174
  layout?: 'row' | 'grid';
168
175
  count?: number;
169
176
  heading?: string;
177
+ /**
178
+ * A `DISCOVERY_SORTS` member, for a discovery-backed source only (`offers`, `new`,
179
+ * `category`, `brand`); on `collection`, `bestSellers` or `recentlyBought` it is `INVALID`.
180
+ * Whether discovery serves it for the source's filters is discovery's own
181
+ * `DISCOVERY_SORT_UNSUPPORTED`. Absent means the source's own order.
182
+ */
183
+ sort?: DiscoverySort;
170
184
  };
171
185
  categories: {
172
186
  source?: {
@@ -662,6 +676,13 @@ declare global {
662
676
  | {
663
677
  operation: 'productsByIds';
664
678
  productIds: string;
679
+ }
680
+ /**
681
+ * `bestSellers` is web `GET /products?mode=best-sellers`'s read and answer, priced as a
682
+ * guest. `recentlyBought` answers `{ data: [] }`: a preview has no buyer to read for.
683
+ */
684
+ | {
685
+ operation: 'bestSellers' | 'recentlyBought';
665
686
  } | {
666
687
  operation: 'products';
667
688
  search?: string;
@@ -905,7 +926,7 @@ declare global {
905
926
  data: StorefrontDesignPreviewResult;
906
927
  } | StorefrontDesignFailure;
907
928
  }
908
- export declare const STOREFRONT_PREVIEW_READ_OPERATIONS: readonly ["design", "store", "product", "productBySlug", "productsByIds", "products", "incomes", "group", "related", "categories", "brands", "tags", "collection", "paymentMethods", "deliveryMethods", "asset"];
929
+ export declare const STOREFRONT_PREVIEW_READ_OPERATIONS: readonly ["design", "store", "product", "productBySlug", "productsByIds", "bestSellers", "recentlyBought", "products", "incomes", "group", "related", "categories", "brands", "tags", "collection", "paymentMethods", "deliveryMethods", "asset"];
909
930
  /** Checks transport structure and UTF-8 size; unfamiliar section types are skipped, never rendered. */
910
931
  export declare function parseStorefrontPreviewDocument(input: unknown): StorefrontPreviewDocument | undefined;
911
932
  /** The codes a preview frame may report in an `error` message; the parser accepts exactly these. */
@@ -197,6 +197,8 @@ export const STOREFRONT_PREVIEW_READ_OPERATIONS = [
197
197
  'product',
198
198
  'productBySlug',
199
199
  'productsByIds',
200
+ 'bestSellers',
201
+ 'recentlyBought',
200
202
  'products',
201
203
  'incomes',
202
204
  'group',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.774",
3
+ "version": "1.10.775",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",