platform-types 1.10.778 → 1.10.779

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.isAdoptableStorefrontLiteral = exports.isAllowedStorefrontLiteralValue = exports.isStorefrontLiteralKey = exports.STOREFRONT_WEB_LITERAL_KEYS = void 0;
3
+ exports.isAdoptableStorefrontLiteral = exports.isStorefrontLiteralKey = exports.STOREFRONT_WEB_LITERAL_KEYS = void 0;
4
4
  const storefrontDesignRegistry_ts_1 = require("./storefrontDesignRegistry.js");
5
5
  /**
6
6
  * Every storefront `WEB` literal key a shop may override, in code-unit order.
@@ -17,6 +17,9 @@ const storefrontDesignRegistry_ts_1 = require("./storefrontDesignRegistry.js");
17
17
  * - keys whose storefront value is not a plain `{name}`-token sentence (it
18
18
  * branches, computes, or is not a string), which a shop string cannot
19
19
  * express.
20
+ * Route paths (the former `NAVIGATE_*` keys) are not copy at all: they live in
21
+ * the storefront's own config, and the api refuses and drops a `NAVIGATE_*`
22
+ * literal on every storefront surface.
20
23
  * An editor that lists any of those offers an edit the server refuses.
21
24
  *
22
25
  * Interpolated values use `{name}` tokens named after the storefront's own
@@ -492,6 +495,8 @@ exports.STOREFRONT_WEB_LITERAL_KEYS = Object.freeze([
492
495
  'DATA_RIGHTS_COLLECTION_NOTES',
493
496
  'DATA_RIGHTS_COLLECTION_ORDERS',
494
497
  'DATA_RIGHTS_COLLECTION_PAYMENTS',
498
+ 'DATA_RIGHTS_COLLECTION_RECENT_PURCHASES',
499
+ 'DATA_RIGHTS_COLLECTION_WHOLESALE_REQUESTS',
495
500
  'DATA_RIGHTS_DIALOG_ACK',
496
501
  'DATA_RIGHTS_DIALOG_CONFIRM',
497
502
  'DATA_RIGHTS_DIALOG_FISCAL',
@@ -815,27 +820,6 @@ exports.STOREFRONT_WEB_LITERAL_KEYS = Object.freeze([
815
820
  'MOBILE_BUTTONS_FAVORITES',
816
821
  'MOBILE_BUTTONS_INVOICES',
817
822
  'MOBILE_BUTTONS_ORDERS',
818
- 'NAVIGATE_APPOINTMENTS',
819
- 'NAVIGATE_BASKET',
820
- 'NAVIGATE_BRANDS',
821
- 'NAVIGATE_CATEGORIES',
822
- 'NAVIGATE_CHECKOUT',
823
- 'NAVIGATE_FAVORITES',
824
- 'NAVIGATE_HOME',
825
- 'NAVIGATE_INCOMES',
826
- 'NAVIGATE_INVOICES',
827
- 'NAVIGATE_LOGIN',
828
- 'NAVIGATE_LOGOUT',
829
- 'NAVIGATE_MAINTENANCE',
830
- 'NAVIGATE_NEW_ARRIVALS',
831
- 'NAVIGATE_NOTIFICATIONS',
832
- 'NAVIGATE_ORDERS',
833
- 'NAVIGATE_PAYMENTS',
834
- 'NAVIGATE_PROFILE',
835
- 'NAVIGATE_RECOVER',
836
- 'NAVIGATE_REGISTRATION',
837
- 'NAVIGATE_SALE',
838
- 'NAVIGATE_SESSIONS',
839
823
  'NETWORK_OFFLINE',
840
824
  'NETWORK_REQUEST_FAILED',
841
825
  'NETWORK_TIMEOUT',
@@ -1078,6 +1062,7 @@ exports.STOREFRONT_WEB_LITERAL_KEYS = Object.freeze([
1078
1062
  'PREVIEW_LOADING',
1079
1063
  'PREVIEW_READ_FAILED',
1080
1064
  'PREVIEW_READ_ONLY',
1065
+ 'PREVIEW_RECENTLY_BOUGHT',
1081
1066
  'PREVIEW_RESTART',
1082
1067
  'PREVIEW_RETRY',
1083
1068
  'PREVIEW_TITLE',
@@ -1346,6 +1331,7 @@ exports.STOREFRONT_WEB_LITERAL_KEYS = Object.freeze([
1346
1331
  'STOREFRONT_FOOTER_NAV_ARIA',
1347
1332
  'STOREFRONT_MERCHANT_NAV_ARIA',
1348
1333
  'STOREFRONT_NAV_GROUP_FALLBACK',
1334
+ 'STOREFRONT_PRODUCTS_REFRESH_FAILED',
1349
1335
  'STOREFRONT_SEARCH',
1350
1336
  'STOREFRONT_SOCIAL_FACEBOOK',
1351
1337
  'STOREFRONT_SOCIAL_INSTAGRAM',
@@ -1374,34 +1360,13 @@ const STOREFRONT_WEB_LITERAL_KEY_SET = new Set(exports.STOREFRONT_WEB_LITERAL_KE
1374
1360
  /** Whether a shop may override `key` — membership in {@link STOREFRONT_WEB_LITERAL_KEYS}. */
1375
1361
  const isStorefrontLiteralKey = (key) => STOREFRONT_WEB_LITERAL_KEY_SET.has(key);
1376
1362
  exports.isStorefrontLiteralKey = isStorefrontLiteralKey;
1377
- /** Keys whose value is a storefront route the storefront renders as a link target. */
1378
- const STOREFRONT_NAVIGATE_LITERAL_PREFIX = 'NAVIGATE_';
1379
- /**
1380
- * A same-origin path: a leading `/`, a second character that is neither `/` nor `\`
1381
- * (`//host` and `/\host` are protocol-relative to a browser), and no whitespace,
1382
- * backslash, control character (`\p{Cc}`) or invisible format character (`\p{Cf}`: every
1383
- * bidi mark including U+061C, zero-width characters, the soft hyphen, tag characters)
1384
- * anywhere. Browsers strip tab and newline before parsing, so `/\t/host` becomes `//host`;
1385
- * invisible and directional characters can also disguise the link target. A scheme
1386
- * cannot start with `/`.
1387
- */
1388
- const STOREFRONT_SAME_ORIGIN_PATH_RE = /^\/(?![/\\])[^\s\\\p{Cc}\p{Cf}]*$/u;
1389
- /**
1390
- * Whether `value` may be stored, published or served for `key`. A `NAVIGATE_*` key is
1391
- * rendered as a link, so it must be a same-origin path — otherwise an override could
1392
- * send a shop's customers to an off-site look-alike login page. Every other key is
1393
- * unconstrained here (key membership, well-formedness and length are checked apart).
1394
- */
1395
- const isAllowedStorefrontLiteralValue = (key, value) => !key.startsWith(STOREFRONT_NAVIGATE_LITERAL_PREFIX) || STOREFRONT_SAME_ORIGIN_PATH_RE.test(value);
1396
- exports.isAllowedStorefrontLiteralValue = isAllowedStorefrontLiteralValue;
1397
1363
  /**
1398
1364
  * Whether a shop's stored `value` for `key` is one a save keeps, a read serves and the editor
1399
- * baseline adopts: a shop-overridable key, a well-formed string within
1400
- * {@link STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS} code points, and an allowed value for it.
1365
+ * baseline adopts: a shop-overridable key and a well-formed string within
1366
+ * {@link STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS} code points.
1401
1367
  */
1402
1368
  const isAdoptableStorefrontLiteral = (key, value) => (0, exports.isStorefrontLiteralKey)(key) &&
1403
1369
  typeof value === 'string' &&
1404
1370
  value.isWellFormed() &&
1405
- Array.from(value).length <= storefrontDesignRegistry_ts_1.STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS &&
1406
- (0, exports.isAllowedStorefrontLiteralValue)(key, value);
1371
+ Array.from(value).length <= storefrontDesignRegistry_ts_1.STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS;
1407
1372
  exports.isAdoptableStorefrontLiteral = isAdoptableStorefrontLiteral;
@@ -11,7 +11,7 @@
11
11
  * `ecommerce.config.wholesaleRequests` is `true` (absent = off).
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.WHOLESALE_REQUEST_REASON_MAX = exports.WHOLESALE_REQUEST_PHONE_MAX = exports.WHOLESALE_REQUEST_MESSAGE_MAX = exports.WHOLESALE_REQUEST_ACTIVITY_MAX = exports.WHOLESALE_REQUEST_RAZON_SOCIAL_MAX = exports.WHOLESALE_REQUESTS_PAGE_MAX = exports.WHOLESALE_REQUEST_STATES = void 0;
14
+ exports.WHOLESALE_REQUEST_ERROR_CODES = exports.WHOLESALE_REQUEST_REASON_MAX = exports.WHOLESALE_REQUEST_PHONE_MAX = exports.WHOLESALE_REQUEST_MESSAGE_MAX = exports.WHOLESALE_REQUEST_ACTIVITY_MAX = exports.WHOLESALE_REQUEST_RAZON_SOCIAL_MAX = exports.WHOLESALE_REQUESTS_PAGE_MAX = exports.WHOLESALE_REQUEST_STATES = void 0;
15
15
  /** The three states a request moves through. */
16
16
  exports.WHOLESALE_REQUEST_STATES = ['pending', 'approved', 'declined'];
17
17
  /** `GET /customers?mode=wholesale-requests` page ceiling; the default page is 50. */
@@ -23,3 +23,42 @@ exports.WHOLESALE_REQUEST_MESSAGE_MAX = 1000;
23
23
  exports.WHOLESALE_REQUEST_PHONE_MAX = 30;
24
24
  /** Character ceiling on the operator's decline reason, counted after trimming. */
25
25
  exports.WHOLESALE_REQUEST_REASON_MAX = 500;
26
+ /**
27
+ * Every `error` code the wholesale-request flow answers on its own behalf:
28
+ * - web `POST /user { mode: 'wholesale-request' }` (`stacks/web/lambdas/user/_wholesaleRequest.ts`):
29
+ * `WHOLESALE_REQUESTS_DISABLED`, `CUSTOMER_NOT_FOUND`, `CUSTOMER_ANONYMIZED`, `USER_NOT_ENABLED`,
30
+ * `CUSTOMER_ALREADY_WHOLESALE`, `WHOLESALE_REQUEST_CONTENDED`, `WHOLESALE_REQUEST_PENDING`;
31
+ * - app `GET /customers?mode=wholesale-requests` and `POST /customers { mode: 'wholesale-decision' }`
32
+ * (`stacks/lambdas/customers/_wholesaleRequests.ts`): `ROLE_FORBIDDEN`, `ADMIN_REQUIRED`,
33
+ * `INVALID_CURSOR`, `WHOLESALE_REQUEST_NOT_PENDING`, `WHOLESALE_DECISION_CONTENDED`,
34
+ * `CUSTOMER_NOT_FOUND`, `CUSTOMER_ANONYMIZED`, `CUSTOMER_MERGED`, `PRICE_LIST_NOT_FOUND`,
35
+ * `PRICE_LIST_NOT_WHOLESALE`, `WHOLESALE_REQUEST_NOT_FOUND`;
36
+ * - the opt-in refusal both configuration writers answer when `ecommerce.config.wholesaleRequests`
37
+ * turns on with no wholesale-class list: `WHOLESALE_LIST_REQUIRED` (`409`). It is also in
38
+ * `STORE_PATCH_ERROR_CODES`, on purpose: a wholesale client handles it without reading that tuple.
39
+ *
40
+ * The rule: a code is listed when a wholesale handler writes it as its own literal, and each of
41
+ * those literals is typed `satisfies WholesaleRequestErrorCode`, so one this list misses fails
42
+ * typecheck. A code those routes forward from a shared helper is not listed, though a wholesale
43
+ * route can answer it: the customer-access refusals (`refuseCustomerAccess`), `VALIDATION_FAILED`
44
+ * (`validateRequest`), the handler wrapper's own codes and the authorizer's.
45
+ */
46
+ exports.WHOLESALE_REQUEST_ERROR_CODES = [
47
+ 'WHOLESALE_REQUESTS_DISABLED',
48
+ 'CUSTOMER_NOT_FOUND',
49
+ 'CUSTOMER_ANONYMIZED',
50
+ 'USER_NOT_ENABLED',
51
+ 'CUSTOMER_ALREADY_WHOLESALE',
52
+ 'WHOLESALE_REQUEST_CONTENDED',
53
+ 'WHOLESALE_REQUEST_PENDING',
54
+ 'ROLE_FORBIDDEN',
55
+ 'ADMIN_REQUIRED',
56
+ 'INVALID_CURSOR',
57
+ 'WHOLESALE_REQUEST_NOT_PENDING',
58
+ 'WHOLESALE_DECISION_CONTENDED',
59
+ 'CUSTOMER_MERGED',
60
+ 'PRICE_LIST_NOT_FOUND',
61
+ 'PRICE_LIST_NOT_WHOLESALE',
62
+ 'WHOLESALE_REQUEST_NOT_FOUND',
63
+ 'WHOLESALE_LIST_REQUIRED',
64
+ ];
@@ -13,6 +13,9 @@
13
13
  * - keys whose storefront value is not a plain `{name}`-token sentence (it
14
14
  * branches, computes, or is not a string), which a shop string cannot
15
15
  * express.
16
+ * Route paths (the former `NAVIGATE_*` keys) are not copy at all: they live in
17
+ * the storefront's own config, and the api refuses and drops a `NAVIGATE_*`
18
+ * literal on every storefront surface.
16
19
  * An editor that lists any of those offers an edit the server refuses.
17
20
  *
18
21
  * Interpolated values use `{name}` tokens named after the storefront's own
@@ -21,16 +24,9 @@
21
24
  export declare const STOREFRONT_WEB_LITERAL_KEYS: readonly string[];
22
25
  /** Whether a shop may override `key` — membership in {@link STOREFRONT_WEB_LITERAL_KEYS}. */
23
26
  export declare const isStorefrontLiteralKey: (key: string) => boolean;
24
- /**
25
- * Whether `value` may be stored, published or served for `key`. A `NAVIGATE_*` key is
26
- * rendered as a link, so it must be a same-origin path — otherwise an override could
27
- * send a shop's customers to an off-site look-alike login page. Every other key is
28
- * unconstrained here (key membership, well-formedness and length are checked apart).
29
- */
30
- export declare const isAllowedStorefrontLiteralValue: (key: string, value: string) => boolean;
31
27
  /**
32
28
  * Whether a shop's stored `value` for `key` is one a save keeps, a read serves and the editor
33
- * baseline adopts: a shop-overridable key, a well-formed string within
34
- * {@link STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS} code points, and an allowed value for it.
29
+ * baseline adopts: a shop-overridable key and a well-formed string within
30
+ * {@link STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS} code points.
35
31
  */
36
32
  export declare const isAdoptableStorefrontLiteral: (key: string, value: unknown) => value is string;
@@ -14,6 +14,9 @@ import { STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS } from "./storefrontDesignReg
14
14
  * - keys whose storefront value is not a plain `{name}`-token sentence (it
15
15
  * branches, computes, or is not a string), which a shop string cannot
16
16
  * express.
17
+ * Route paths (the former `NAVIGATE_*` keys) are not copy at all: they live in
18
+ * the storefront's own config, and the api refuses and drops a `NAVIGATE_*`
19
+ * literal on every storefront surface.
17
20
  * An editor that lists any of those offers an edit the server refuses.
18
21
  *
19
22
  * Interpolated values use `{name}` tokens named after the storefront's own
@@ -489,6 +492,8 @@ export const STOREFRONT_WEB_LITERAL_KEYS = Object.freeze([
489
492
  'DATA_RIGHTS_COLLECTION_NOTES',
490
493
  'DATA_RIGHTS_COLLECTION_ORDERS',
491
494
  'DATA_RIGHTS_COLLECTION_PAYMENTS',
495
+ 'DATA_RIGHTS_COLLECTION_RECENT_PURCHASES',
496
+ 'DATA_RIGHTS_COLLECTION_WHOLESALE_REQUESTS',
492
497
  'DATA_RIGHTS_DIALOG_ACK',
493
498
  'DATA_RIGHTS_DIALOG_CONFIRM',
494
499
  'DATA_RIGHTS_DIALOG_FISCAL',
@@ -812,27 +817,6 @@ export const STOREFRONT_WEB_LITERAL_KEYS = Object.freeze([
812
817
  'MOBILE_BUTTONS_FAVORITES',
813
818
  'MOBILE_BUTTONS_INVOICES',
814
819
  'MOBILE_BUTTONS_ORDERS',
815
- 'NAVIGATE_APPOINTMENTS',
816
- 'NAVIGATE_BASKET',
817
- 'NAVIGATE_BRANDS',
818
- 'NAVIGATE_CATEGORIES',
819
- 'NAVIGATE_CHECKOUT',
820
- 'NAVIGATE_FAVORITES',
821
- 'NAVIGATE_HOME',
822
- 'NAVIGATE_INCOMES',
823
- 'NAVIGATE_INVOICES',
824
- 'NAVIGATE_LOGIN',
825
- 'NAVIGATE_LOGOUT',
826
- 'NAVIGATE_MAINTENANCE',
827
- 'NAVIGATE_NEW_ARRIVALS',
828
- 'NAVIGATE_NOTIFICATIONS',
829
- 'NAVIGATE_ORDERS',
830
- 'NAVIGATE_PAYMENTS',
831
- 'NAVIGATE_PROFILE',
832
- 'NAVIGATE_RECOVER',
833
- 'NAVIGATE_REGISTRATION',
834
- 'NAVIGATE_SALE',
835
- 'NAVIGATE_SESSIONS',
836
820
  'NETWORK_OFFLINE',
837
821
  'NETWORK_REQUEST_FAILED',
838
822
  'NETWORK_TIMEOUT',
@@ -1075,6 +1059,7 @@ export const STOREFRONT_WEB_LITERAL_KEYS = Object.freeze([
1075
1059
  'PREVIEW_LOADING',
1076
1060
  'PREVIEW_READ_FAILED',
1077
1061
  'PREVIEW_READ_ONLY',
1062
+ 'PREVIEW_RECENTLY_BOUGHT',
1078
1063
  'PREVIEW_RESTART',
1079
1064
  'PREVIEW_RETRY',
1080
1065
  'PREVIEW_TITLE',
@@ -1343,6 +1328,7 @@ export const STOREFRONT_WEB_LITERAL_KEYS = Object.freeze([
1343
1328
  'STOREFRONT_FOOTER_NAV_ARIA',
1344
1329
  'STOREFRONT_MERCHANT_NAV_ARIA',
1345
1330
  'STOREFRONT_NAV_GROUP_FALLBACK',
1331
+ 'STOREFRONT_PRODUCTS_REFRESH_FAILED',
1346
1332
  'STOREFRONT_SEARCH',
1347
1333
  'STOREFRONT_SOCIAL_FACEBOOK',
1348
1334
  'STOREFRONT_SOCIAL_INSTAGRAM',
@@ -1370,32 +1356,12 @@ export const STOREFRONT_WEB_LITERAL_KEYS = Object.freeze([
1370
1356
  const STOREFRONT_WEB_LITERAL_KEY_SET = new Set(STOREFRONT_WEB_LITERAL_KEYS);
1371
1357
  /** Whether a shop may override `key` — membership in {@link STOREFRONT_WEB_LITERAL_KEYS}. */
1372
1358
  export const isStorefrontLiteralKey = (key) => STOREFRONT_WEB_LITERAL_KEY_SET.has(key);
1373
- /** Keys whose value is a storefront route the storefront renders as a link target. */
1374
- const STOREFRONT_NAVIGATE_LITERAL_PREFIX = 'NAVIGATE_';
1375
- /**
1376
- * A same-origin path: a leading `/`, a second character that is neither `/` nor `\`
1377
- * (`//host` and `/\host` are protocol-relative to a browser), and no whitespace,
1378
- * backslash, control character (`\p{Cc}`) or invisible format character (`\p{Cf}`: every
1379
- * bidi mark including U+061C, zero-width characters, the soft hyphen, tag characters)
1380
- * anywhere. Browsers strip tab and newline before parsing, so `/\t/host` becomes `//host`;
1381
- * invisible and directional characters can also disguise the link target. A scheme
1382
- * cannot start with `/`.
1383
- */
1384
- const STOREFRONT_SAME_ORIGIN_PATH_RE = /^\/(?![/\\])[^\s\\\p{Cc}\p{Cf}]*$/u;
1385
- /**
1386
- * Whether `value` may be stored, published or served for `key`. A `NAVIGATE_*` key is
1387
- * rendered as a link, so it must be a same-origin path — otherwise an override could
1388
- * send a shop's customers to an off-site look-alike login page. Every other key is
1389
- * unconstrained here (key membership, well-formedness and length are checked apart).
1390
- */
1391
- export const isAllowedStorefrontLiteralValue = (key, value) => !key.startsWith(STOREFRONT_NAVIGATE_LITERAL_PREFIX) || STOREFRONT_SAME_ORIGIN_PATH_RE.test(value);
1392
1359
  /**
1393
1360
  * Whether a shop's stored `value` for `key` is one a save keeps, a read serves and the editor
1394
- * baseline adopts: a shop-overridable key, a well-formed string within
1395
- * {@link STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS} code points, and an allowed value for it.
1361
+ * baseline adopts: a shop-overridable key and a well-formed string within
1362
+ * {@link STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS} code points.
1396
1363
  */
1397
1364
  export const isAdoptableStorefrontLiteral = (key, value) => isStorefrontLiteralKey(key) &&
1398
1365
  typeof value === 'string' &&
1399
1366
  value.isWellFormed() &&
1400
- Array.from(value).length <= STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS &&
1401
- isAllowedStorefrontLiteralValue(key, value);
1367
+ Array.from(value).length <= STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS;
@@ -20,6 +20,28 @@ export declare const WHOLESALE_REQUEST_MESSAGE_MAX = 1000;
20
20
  export declare const WHOLESALE_REQUEST_PHONE_MAX = 30;
21
21
  /** Character ceiling on the operator's decline reason, counted after trimming. */
22
22
  export declare const WHOLESALE_REQUEST_REASON_MAX = 500;
23
+ /**
24
+ * Every `error` code the wholesale-request flow answers on its own behalf:
25
+ * - web `POST /user { mode: 'wholesale-request' }` (`stacks/web/lambdas/user/_wholesaleRequest.ts`):
26
+ * `WHOLESALE_REQUESTS_DISABLED`, `CUSTOMER_NOT_FOUND`, `CUSTOMER_ANONYMIZED`, `USER_NOT_ENABLED`,
27
+ * `CUSTOMER_ALREADY_WHOLESALE`, `WHOLESALE_REQUEST_CONTENDED`, `WHOLESALE_REQUEST_PENDING`;
28
+ * - app `GET /customers?mode=wholesale-requests` and `POST /customers { mode: 'wholesale-decision' }`
29
+ * (`stacks/lambdas/customers/_wholesaleRequests.ts`): `ROLE_FORBIDDEN`, `ADMIN_REQUIRED`,
30
+ * `INVALID_CURSOR`, `WHOLESALE_REQUEST_NOT_PENDING`, `WHOLESALE_DECISION_CONTENDED`,
31
+ * `CUSTOMER_NOT_FOUND`, `CUSTOMER_ANONYMIZED`, `CUSTOMER_MERGED`, `PRICE_LIST_NOT_FOUND`,
32
+ * `PRICE_LIST_NOT_WHOLESALE`, `WHOLESALE_REQUEST_NOT_FOUND`;
33
+ * - the opt-in refusal both configuration writers answer when `ecommerce.config.wholesaleRequests`
34
+ * turns on with no wholesale-class list: `WHOLESALE_LIST_REQUIRED` (`409`). It is also in
35
+ * `STORE_PATCH_ERROR_CODES`, on purpose: a wholesale client handles it without reading that tuple.
36
+ *
37
+ * The rule: a code is listed when a wholesale handler writes it as its own literal, and each of
38
+ * those literals is typed `satisfies WholesaleRequestErrorCode`, so one this list misses fails
39
+ * typecheck. A code those routes forward from a shared helper is not listed, though a wholesale
40
+ * route can answer it: the customer-access refusals (`refuseCustomerAccess`), `VALIDATION_FAILED`
41
+ * (`validateRequest`), the handler wrapper's own codes and the authorizer's.
42
+ */
43
+ export declare const WHOLESALE_REQUEST_ERROR_CODES: readonly ["WHOLESALE_REQUESTS_DISABLED", "CUSTOMER_NOT_FOUND", "CUSTOMER_ANONYMIZED", "USER_NOT_ENABLED", "CUSTOMER_ALREADY_WHOLESALE", "WHOLESALE_REQUEST_CONTENDED", "WHOLESALE_REQUEST_PENDING", "ROLE_FORBIDDEN", "ADMIN_REQUIRED", "INVALID_CURSOR", "WHOLESALE_REQUEST_NOT_PENDING", "WHOLESALE_DECISION_CONTENDED", "CUSTOMER_MERGED", "PRICE_LIST_NOT_FOUND", "PRICE_LIST_NOT_WHOLESALE", "WHOLESALE_REQUEST_NOT_FOUND", "WHOLESALE_LIST_REQUIRED"];
44
+ export type WholesaleRequestErrorCode = (typeof WHOLESALE_REQUEST_ERROR_CODES)[number];
23
45
  declare global {
24
46
  type WholesaleRequestState = (typeof WHOLESALE_REQUEST_STATES)[number];
25
47
  /**
@@ -20,3 +20,42 @@ export const WHOLESALE_REQUEST_MESSAGE_MAX = 1000;
20
20
  export const WHOLESALE_REQUEST_PHONE_MAX = 30;
21
21
  /** Character ceiling on the operator's decline reason, counted after trimming. */
22
22
  export const WHOLESALE_REQUEST_REASON_MAX = 500;
23
+ /**
24
+ * Every `error` code the wholesale-request flow answers on its own behalf:
25
+ * - web `POST /user { mode: 'wholesale-request' }` (`stacks/web/lambdas/user/_wholesaleRequest.ts`):
26
+ * `WHOLESALE_REQUESTS_DISABLED`, `CUSTOMER_NOT_FOUND`, `CUSTOMER_ANONYMIZED`, `USER_NOT_ENABLED`,
27
+ * `CUSTOMER_ALREADY_WHOLESALE`, `WHOLESALE_REQUEST_CONTENDED`, `WHOLESALE_REQUEST_PENDING`;
28
+ * - app `GET /customers?mode=wholesale-requests` and `POST /customers { mode: 'wholesale-decision' }`
29
+ * (`stacks/lambdas/customers/_wholesaleRequests.ts`): `ROLE_FORBIDDEN`, `ADMIN_REQUIRED`,
30
+ * `INVALID_CURSOR`, `WHOLESALE_REQUEST_NOT_PENDING`, `WHOLESALE_DECISION_CONTENDED`,
31
+ * `CUSTOMER_NOT_FOUND`, `CUSTOMER_ANONYMIZED`, `CUSTOMER_MERGED`, `PRICE_LIST_NOT_FOUND`,
32
+ * `PRICE_LIST_NOT_WHOLESALE`, `WHOLESALE_REQUEST_NOT_FOUND`;
33
+ * - the opt-in refusal both configuration writers answer when `ecommerce.config.wholesaleRequests`
34
+ * turns on with no wholesale-class list: `WHOLESALE_LIST_REQUIRED` (`409`). It is also in
35
+ * `STORE_PATCH_ERROR_CODES`, on purpose: a wholesale client handles it without reading that tuple.
36
+ *
37
+ * The rule: a code is listed when a wholesale handler writes it as its own literal, and each of
38
+ * those literals is typed `satisfies WholesaleRequestErrorCode`, so one this list misses fails
39
+ * typecheck. A code those routes forward from a shared helper is not listed, though a wholesale
40
+ * route can answer it: the customer-access refusals (`refuseCustomerAccess`), `VALIDATION_FAILED`
41
+ * (`validateRequest`), the handler wrapper's own codes and the authorizer's.
42
+ */
43
+ export const WHOLESALE_REQUEST_ERROR_CODES = [
44
+ 'WHOLESALE_REQUESTS_DISABLED',
45
+ 'CUSTOMER_NOT_FOUND',
46
+ 'CUSTOMER_ANONYMIZED',
47
+ 'USER_NOT_ENABLED',
48
+ 'CUSTOMER_ALREADY_WHOLESALE',
49
+ 'WHOLESALE_REQUEST_CONTENDED',
50
+ 'WHOLESALE_REQUEST_PENDING',
51
+ 'ROLE_FORBIDDEN',
52
+ 'ADMIN_REQUIRED',
53
+ 'INVALID_CURSOR',
54
+ 'WHOLESALE_REQUEST_NOT_PENDING',
55
+ 'WHOLESALE_DECISION_CONTENDED',
56
+ 'CUSTOMER_MERGED',
57
+ 'PRICE_LIST_NOT_FOUND',
58
+ 'PRICE_LIST_NOT_WHOLESALE',
59
+ 'WHOLESALE_REQUEST_NOT_FOUND',
60
+ 'WHOLESALE_LIST_REQUIRED',
61
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.778",
3
+ "version": "1.10.779",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",