@heavybit/ecommerce-contracts 0.3.4 → 0.3.5
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/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/internal/catalog.js +74 -0
- package/dist/cjs/internal/catalog.js.map +1 -0
- package/dist/cjs/internal/index.js +18 -0
- package/dist/cjs/internal/index.js.map +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/catalog.js +71 -0
- package/dist/esm/internal/catalog.js.map +1 -0
- package/dist/esm/internal/index.js +2 -0
- package/dist/esm/internal/index.js.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/internal/catalog.d.ts +348 -0
- package/dist/types/internal/catalog.d.ts.map +1 -0
- package/dist/types/internal/index.d.ts +2 -0
- package/dist/types/internal/index.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/**
|
|
18
18
|
* `@heavybit/ecommerce-contracts` (D40): the e-commerce app's settings, identity and scope bindings,
|
|
19
|
-
* step-up scopes and
|
|
19
|
+
* step-up scopes, event catalogue and internal API DTOs, built on `@heavybit/shared-lib`. No business logic.
|
|
20
20
|
*/
|
|
21
21
|
__exportStar(require("./app.js"), exports);
|
|
22
22
|
__exportStar(require("./scopes.js"), exports);
|
|
@@ -24,4 +24,5 @@ __exportStar(require("./identity.js"), exports);
|
|
|
24
24
|
__exportStar(require("./permissions.js"), exports);
|
|
25
25
|
__exportStar(require("./bindings.js"), exports);
|
|
26
26
|
__exportStar(require("./events/index.js"), exports);
|
|
27
|
+
__exportStar(require("./internal/index.js"), exports);
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,2CAAyB;AACzB,8CAA4B;AAC5B,gDAA8B;AAC9B,mDAAiC;AACjC,gDAA8B;AAC9B,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,2CAAyB;AACzB,8CAA4B;AAC5B,gDAA8B;AAC9B,mDAAiC;AACjC,gDAA8B;AAC9B,oDAAkC;AAClC,sDAAoC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.catalogReadinessSchema = exports.priceQuoteResponseSchema = exports.priceQuoteLineSchema = exports.priceQuoteRequestSchema = exports.priceQuoteRequestLineSchema = exports.TAX_CLASSES = exports.PRICE_QUOTE_REASONS = exports.PRICE_QUOTE_MAX_QUANTITY = exports.PRICE_QUOTE_MAX_LINES = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* catalog-service internal API contracts (Prompt 10.6): the price quote that cart-service and order-service use
|
|
6
|
+
* (CHK-7, one pricing function) and the catalog-readiness answer that store-service's setup checklist reads.
|
|
7
|
+
* Money is a KES decimal string with 2 dp (D5); field names drop the `Cents` suffix.
|
|
8
|
+
*/
|
|
9
|
+
const shared_lib_1 = require("@heavybit/shared-lib");
|
|
10
|
+
const base_js_1 = require("../events/base.js");
|
|
11
|
+
/** Most lines one quote may ask for. */
|
|
12
|
+
exports.PRICE_QUOTE_MAX_LINES = 100;
|
|
13
|
+
/** Most units of one variant one line may ask for. */
|
|
14
|
+
exports.PRICE_QUOTE_MAX_QUANTITY = 10_000;
|
|
15
|
+
/**
|
|
16
|
+
* Why a quoted line cannot be sold now.
|
|
17
|
+
* - `NOT_FOUND`: no live variant with that id in this company (deleted, or another company's — TEN-9).
|
|
18
|
+
* - `PRODUCT_UNAVAILABLE`: the product is draft or disabled.
|
|
19
|
+
* - `VARIANT_INACTIVE`: the variant is switched off.
|
|
20
|
+
* - `SHOP_UNAVAILABLE`: the shop is not active (pending review, suspended or closed).
|
|
21
|
+
* - `INSUFFICIENT_STOCK`: fewer units are available than asked for (`availableQuantity` says how many).
|
|
22
|
+
*/
|
|
23
|
+
exports.PRICE_QUOTE_REASONS = ['NOT_FOUND', 'PRODUCT_UNAVAILABLE', 'VARIANT_INACTIVE', 'SHOP_UNAVAILABLE', 'INSUFFICIENT_STOCK'];
|
|
24
|
+
/** Tax class of a product (VAT treatment; prices include tax). */
|
|
25
|
+
exports.TAX_CLASSES = ['standard', 'zero_rated', 'exempt'];
|
|
26
|
+
/** One requested line. */
|
|
27
|
+
exports.priceQuoteRequestLineSchema = shared_lib_1.z.object({
|
|
28
|
+
variantId: shared_lib_1.idSchema,
|
|
29
|
+
quantity: shared_lib_1.z.number().int().min(1).max(exports.PRICE_QUOTE_MAX_QUANTITY),
|
|
30
|
+
}).strict();
|
|
31
|
+
/**
|
|
32
|
+
* Body of `POST /api/v1/internal/prices/quote`. A variant id may appear only once (callers merge quantities).
|
|
33
|
+
*
|
|
34
|
+
* @example { companyId: '01J…', lines: [{ variantId: '01J…', quantity: 2 }] }
|
|
35
|
+
*/
|
|
36
|
+
exports.priceQuoteRequestSchema = shared_lib_1.z.object({
|
|
37
|
+
companyId: shared_lib_1.idSchema,
|
|
38
|
+
lines: shared_lib_1.z.array(exports.priceQuoteRequestLineSchema).min(1).max(exports.PRICE_QUOTE_MAX_LINES)
|
|
39
|
+
.refine((lines) => new Set(lines.map((line) => line.variantId)).size === lines.length, { message: 'Each variantId may appear only once' }),
|
|
40
|
+
}).strict();
|
|
41
|
+
/**
|
|
42
|
+
* One quoted line, in request order. Snapshot fields (MS-3) are null only when `reason` is `NOT_FOUND`.
|
|
43
|
+
* `available` is true exactly when `reason` is absent.
|
|
44
|
+
*/
|
|
45
|
+
exports.priceQuoteLineSchema = shared_lib_1.z.object({
|
|
46
|
+
variantId: shared_lib_1.idSchema,
|
|
47
|
+
quantity: shared_lib_1.z.number().int(),
|
|
48
|
+
productId: shared_lib_1.idSchema.nullable(),
|
|
49
|
+
productName: shared_lib_1.z.string().nullable(),
|
|
50
|
+
productSlug: shared_lib_1.z.string().nullable(),
|
|
51
|
+
sku: shared_lib_1.z.string().nullable(),
|
|
52
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
53
|
+
options: shared_lib_1.z.record(shared_lib_1.z.string(), shared_lib_1.z.string()).nullable(),
|
|
54
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
55
|
+
imageKey: shared_lib_1.z.string().nullable(),
|
|
56
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
57
|
+
unitPrice: base_js_1.amount.nullable(),
|
|
58
|
+
/** "Was" price shown struck through, or null. */
|
|
59
|
+
compareAtPrice: base_js_1.amount.nullable(),
|
|
60
|
+
taxClass: shared_lib_1.z.enum(exports.TAX_CLASSES).nullable(),
|
|
61
|
+
available: shared_lib_1.z.boolean(),
|
|
62
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
63
|
+
availableQuantity: shared_lib_1.z.number().int().min(0),
|
|
64
|
+
reason: shared_lib_1.z.enum(exports.PRICE_QUOTE_REASONS).optional(),
|
|
65
|
+
}).passthrough();
|
|
66
|
+
/** Envelope `data` of the quote: currency plus one line per requested line. */
|
|
67
|
+
exports.priceQuoteResponseSchema = shared_lib_1.z.object({
|
|
68
|
+
companyId: shared_lib_1.idSchema,
|
|
69
|
+
currency: shared_lib_1.z.string(),
|
|
70
|
+
lines: shared_lib_1.z.array(exports.priceQuoteLineSchema),
|
|
71
|
+
}).passthrough();
|
|
72
|
+
/** Envelope `data` of `GET /api/v1/internal/companies/{id}/readiness` (caller store-service). */
|
|
73
|
+
exports.catalogReadinessSchema = shared_lib_1.z.object({ hasSellableProduct: shared_lib_1.z.boolean() }).passthrough();
|
|
74
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/internal/catalog.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,qDAAmD;AACnD,+CAA2C;AAE3C,wCAAwC;AAC3B,QAAA,qBAAqB,GAAG,GAAG,CAAC;AAEzC,sDAAsD;AACzC,QAAA,wBAAwB,GAAG,MAAM,CAAC;AAE/C;;;;;;;GAOG;AACU,QAAA,mBAAmB,GAAG,CAAC,WAAW,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,oBAAoB,CAAU,CAAC;AAK/I,kEAAkE;AACrD,QAAA,WAAW,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,CAAU,CAAC;AAEzE,0BAA0B;AACb,QAAA,2BAA2B,GAAG,cAAC,CAAC,MAAM,CAAC;IAClD,SAAS,EAAE,qBAAQ;IACnB,QAAQ,EAAE,cAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,gCAAwB,CAAC;CAChE,CAAC,CAAC,MAAM,EAAE,CAAC;AAEZ;;;;GAIG;AACU,QAAA,uBAAuB,GAAG,cAAC,CAAC,MAAM,CAAC;IAC9C,SAAS,EAAE,qBAAQ;IACnB,KAAK,EAAE,cAAC,CAAC,KAAK,CAAC,mCAA2B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,6BAAqB,CAAC;SAC1E,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,MA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E,qBAAQ;IACnB,QAAQ,EAAE,cAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,cAAC,CAAC,KAAK,CAAC,4BAAoB,CAAC;CACrC,CAAC,CAAC,WAAW,EAAE,CAAC;AAEjB,iGAAiG;AACpF,QAAA,sBAAsB,GAAG,cAAC,CAAC,MAAM,CAAC,EAAE,kBAAkB,EAAE,cAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./catalog.js"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@heavybit/ecommerce-contracts` (D40): the e-commerce app's settings, identity and scope bindings,
|
|
3
|
-
* step-up scopes and
|
|
3
|
+
* step-up scopes, event catalogue and internal API DTOs, built on `@heavybit/shared-lib`. No business logic.
|
|
4
4
|
*/
|
|
5
5
|
export * from './app.js';
|
|
6
6
|
export * from './scopes.js';
|
|
@@ -8,4 +8,5 @@ export * from './identity.js';
|
|
|
8
8
|
export * from './permissions.js';
|
|
9
9
|
export * from './bindings.js';
|
|
10
10
|
export * from './events/index.js';
|
|
11
|
+
export * from './internal/index.js';
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* catalog-service internal API contracts (Prompt 10.6): the price quote that cart-service and order-service use
|
|
3
|
+
* (CHK-7, one pricing function) and the catalog-readiness answer that store-service's setup checklist reads.
|
|
4
|
+
* Money is a KES decimal string with 2 dp (D5); field names drop the `Cents` suffix.
|
|
5
|
+
*/
|
|
6
|
+
import { idSchema, z } from '@heavybit/shared-lib';
|
|
7
|
+
import { amount } from '../events/base.js';
|
|
8
|
+
/** Most lines one quote may ask for. */
|
|
9
|
+
export const PRICE_QUOTE_MAX_LINES = 100;
|
|
10
|
+
/** Most units of one variant one line may ask for. */
|
|
11
|
+
export const PRICE_QUOTE_MAX_QUANTITY = 10_000;
|
|
12
|
+
/**
|
|
13
|
+
* Why a quoted line cannot be sold now.
|
|
14
|
+
* - `NOT_FOUND`: no live variant with that id in this company (deleted, or another company's — TEN-9).
|
|
15
|
+
* - `PRODUCT_UNAVAILABLE`: the product is draft or disabled.
|
|
16
|
+
* - `VARIANT_INACTIVE`: the variant is switched off.
|
|
17
|
+
* - `SHOP_UNAVAILABLE`: the shop is not active (pending review, suspended or closed).
|
|
18
|
+
* - `INSUFFICIENT_STOCK`: fewer units are available than asked for (`availableQuantity` says how many).
|
|
19
|
+
*/
|
|
20
|
+
export const PRICE_QUOTE_REASONS = ['NOT_FOUND', 'PRODUCT_UNAVAILABLE', 'VARIANT_INACTIVE', 'SHOP_UNAVAILABLE', 'INSUFFICIENT_STOCK'];
|
|
21
|
+
/** Tax class of a product (VAT treatment; prices include tax). */
|
|
22
|
+
export const TAX_CLASSES = ['standard', 'zero_rated', 'exempt'];
|
|
23
|
+
/** One requested line. */
|
|
24
|
+
export const priceQuoteRequestLineSchema = z.object({
|
|
25
|
+
variantId: idSchema,
|
|
26
|
+
quantity: z.number().int().min(1).max(PRICE_QUOTE_MAX_QUANTITY),
|
|
27
|
+
}).strict();
|
|
28
|
+
/**
|
|
29
|
+
* Body of `POST /api/v1/internal/prices/quote`. A variant id may appear only once (callers merge quantities).
|
|
30
|
+
*
|
|
31
|
+
* @example { companyId: '01J…', lines: [{ variantId: '01J…', quantity: 2 }] }
|
|
32
|
+
*/
|
|
33
|
+
export const priceQuoteRequestSchema = z.object({
|
|
34
|
+
companyId: idSchema,
|
|
35
|
+
lines: z.array(priceQuoteRequestLineSchema).min(1).max(PRICE_QUOTE_MAX_LINES)
|
|
36
|
+
.refine((lines) => new Set(lines.map((line) => line.variantId)).size === lines.length, { message: 'Each variantId may appear only once' }),
|
|
37
|
+
}).strict();
|
|
38
|
+
/**
|
|
39
|
+
* One quoted line, in request order. Snapshot fields (MS-3) are null only when `reason` is `NOT_FOUND`.
|
|
40
|
+
* `available` is true exactly when `reason` is absent.
|
|
41
|
+
*/
|
|
42
|
+
export const priceQuoteLineSchema = z.object({
|
|
43
|
+
variantId: idSchema,
|
|
44
|
+
quantity: z.number().int(),
|
|
45
|
+
productId: idSchema.nullable(),
|
|
46
|
+
productName: z.string().nullable(),
|
|
47
|
+
productSlug: z.string().nullable(),
|
|
48
|
+
sku: z.string().nullable(),
|
|
49
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
50
|
+
options: z.record(z.string(), z.string()).nullable(),
|
|
51
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
52
|
+
imageKey: z.string().nullable(),
|
|
53
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
54
|
+
unitPrice: amount.nullable(),
|
|
55
|
+
/** "Was" price shown struck through, or null. */
|
|
56
|
+
compareAtPrice: amount.nullable(),
|
|
57
|
+
taxClass: z.enum(TAX_CLASSES).nullable(),
|
|
58
|
+
available: z.boolean(),
|
|
59
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
60
|
+
availableQuantity: z.number().int().min(0),
|
|
61
|
+
reason: z.enum(PRICE_QUOTE_REASONS).optional(),
|
|
62
|
+
}).passthrough();
|
|
63
|
+
/** Envelope `data` of the quote: currency plus one line per requested line. */
|
|
64
|
+
export const priceQuoteResponseSchema = z.object({
|
|
65
|
+
companyId: idSchema,
|
|
66
|
+
currency: z.string(),
|
|
67
|
+
lines: z.array(priceQuoteLineSchema),
|
|
68
|
+
}).passthrough();
|
|
69
|
+
/** Envelope `data` of `GET /api/v1/internal/companies/{id}/readiness` (caller store-service). */
|
|
70
|
+
export const catalogReadinessSchema = z.object({ hasSellableProduct: z.boolean() }).passthrough();
|
|
71
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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AAC,MAAM,CAAC;IAC/C,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;CACrC,CAAC,CAAC,WAAW,EAAE,CAAC;AAEjB,iGAAiG;AACjG,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@heavybit/ecommerce-contracts` (D40): the e-commerce app's settings, identity and scope bindings,
|
|
3
|
-
* step-up scopes and
|
|
3
|
+
* step-up scopes, event catalogue and internal API DTOs, built on `@heavybit/shared-lib`. No business logic.
|
|
4
4
|
*/
|
|
5
5
|
export * from './app.js';
|
|
6
6
|
export * from './scopes.js';
|
|
@@ -8,4 +8,5 @@ export * from './identity.js';
|
|
|
8
8
|
export * from './permissions.js';
|
|
9
9
|
export * from './bindings.js';
|
|
10
10
|
export * from './events/index.js';
|
|
11
|
+
export * from './internal/index.js';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* catalog-service internal API contracts (Prompt 10.6): the price quote that cart-service and order-service use
|
|
3
|
+
* (CHK-7, one pricing function) and the catalog-readiness answer that store-service's setup checklist reads.
|
|
4
|
+
* Money is a KES decimal string with 2 dp (D5); field names drop the `Cents` suffix.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from '@heavybit/shared-lib';
|
|
7
|
+
/** Most lines one quote may ask for. */
|
|
8
|
+
export declare const PRICE_QUOTE_MAX_LINES = 100;
|
|
9
|
+
/** Most units of one variant one line may ask for. */
|
|
10
|
+
export declare const PRICE_QUOTE_MAX_QUANTITY = 10000;
|
|
11
|
+
/**
|
|
12
|
+
* Why a quoted line cannot be sold now.
|
|
13
|
+
* - `NOT_FOUND`: no live variant with that id in this company (deleted, or another company's — TEN-9).
|
|
14
|
+
* - `PRODUCT_UNAVAILABLE`: the product is draft or disabled.
|
|
15
|
+
* - `VARIANT_INACTIVE`: the variant is switched off.
|
|
16
|
+
* - `SHOP_UNAVAILABLE`: the shop is not active (pending review, suspended or closed).
|
|
17
|
+
* - `INSUFFICIENT_STOCK`: fewer units are available than asked for (`availableQuantity` says how many).
|
|
18
|
+
*/
|
|
19
|
+
export declare const PRICE_QUOTE_REASONS: readonly ["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"];
|
|
20
|
+
/** One of {@link PRICE_QUOTE_REASONS}. */
|
|
21
|
+
export type PriceQuoteReason = (typeof PRICE_QUOTE_REASONS)[number];
|
|
22
|
+
/** Tax class of a product (VAT treatment; prices include tax). */
|
|
23
|
+
export declare const TAX_CLASSES: readonly ["standard", "zero_rated", "exempt"];
|
|
24
|
+
/** One requested line. */
|
|
25
|
+
export declare const priceQuoteRequestLineSchema: z.ZodObject<{
|
|
26
|
+
variantId: z.ZodString;
|
|
27
|
+
quantity: z.ZodNumber;
|
|
28
|
+
}, "strict", z.ZodTypeAny, {
|
|
29
|
+
variantId: string;
|
|
30
|
+
quantity: number;
|
|
31
|
+
}, {
|
|
32
|
+
variantId: string;
|
|
33
|
+
quantity: number;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Body of `POST /api/v1/internal/prices/quote`. A variant id may appear only once (callers merge quantities).
|
|
37
|
+
*
|
|
38
|
+
* @example { companyId: '01J…', lines: [{ variantId: '01J…', quantity: 2 }] }
|
|
39
|
+
*/
|
|
40
|
+
export declare const priceQuoteRequestSchema: z.ZodObject<{
|
|
41
|
+
companyId: z.ZodString;
|
|
42
|
+
lines: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
43
|
+
variantId: z.ZodString;
|
|
44
|
+
quantity: z.ZodNumber;
|
|
45
|
+
}, "strict", z.ZodTypeAny, {
|
|
46
|
+
variantId: string;
|
|
47
|
+
quantity: number;
|
|
48
|
+
}, {
|
|
49
|
+
variantId: string;
|
|
50
|
+
quantity: number;
|
|
51
|
+
}>, "many">, {
|
|
52
|
+
variantId: string;
|
|
53
|
+
quantity: number;
|
|
54
|
+
}[], {
|
|
55
|
+
variantId: string;
|
|
56
|
+
quantity: number;
|
|
57
|
+
}[]>;
|
|
58
|
+
}, "strict", z.ZodTypeAny, {
|
|
59
|
+
companyId: string;
|
|
60
|
+
lines: {
|
|
61
|
+
variantId: string;
|
|
62
|
+
quantity: number;
|
|
63
|
+
}[];
|
|
64
|
+
}, {
|
|
65
|
+
companyId: string;
|
|
66
|
+
lines: {
|
|
67
|
+
variantId: string;
|
|
68
|
+
quantity: number;
|
|
69
|
+
}[];
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* One quoted line, in request order. Snapshot fields (MS-3) are null only when `reason` is `NOT_FOUND`.
|
|
73
|
+
* `available` is true exactly when `reason` is absent.
|
|
74
|
+
*/
|
|
75
|
+
export declare const priceQuoteLineSchema: z.ZodObject<{
|
|
76
|
+
variantId: z.ZodString;
|
|
77
|
+
quantity: z.ZodNumber;
|
|
78
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
79
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
80
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
81
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
82
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
83
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
84
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
85
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
86
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
87
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
88
|
+
/** "Was" price shown struck through, or null. */
|
|
89
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
90
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
91
|
+
available: z.ZodBoolean;
|
|
92
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
93
|
+
availableQuantity: z.ZodNumber;
|
|
94
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
95
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
96
|
+
variantId: z.ZodString;
|
|
97
|
+
quantity: z.ZodNumber;
|
|
98
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
99
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
100
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
101
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
102
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
103
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
104
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
105
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
106
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
107
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
108
|
+
/** "Was" price shown struck through, or null. */
|
|
109
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
110
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
111
|
+
available: z.ZodBoolean;
|
|
112
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
113
|
+
availableQuantity: z.ZodNumber;
|
|
114
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
115
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
116
|
+
variantId: z.ZodString;
|
|
117
|
+
quantity: z.ZodNumber;
|
|
118
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
119
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
120
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
121
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
122
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
123
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
124
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
125
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
126
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
127
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
128
|
+
/** "Was" price shown struck through, or null. */
|
|
129
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
130
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
131
|
+
available: z.ZodBoolean;
|
|
132
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
133
|
+
availableQuantity: z.ZodNumber;
|
|
134
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
135
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
136
|
+
/** Envelope `data` of the quote: currency plus one line per requested line. */
|
|
137
|
+
export declare const priceQuoteResponseSchema: z.ZodObject<{
|
|
138
|
+
companyId: z.ZodString;
|
|
139
|
+
currency: z.ZodString;
|
|
140
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
141
|
+
variantId: z.ZodString;
|
|
142
|
+
quantity: z.ZodNumber;
|
|
143
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
144
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
145
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
146
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
147
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
148
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
149
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
150
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
151
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
152
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
153
|
+
/** "Was" price shown struck through, or null. */
|
|
154
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
155
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
156
|
+
available: z.ZodBoolean;
|
|
157
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
158
|
+
availableQuantity: z.ZodNumber;
|
|
159
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
160
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
161
|
+
variantId: z.ZodString;
|
|
162
|
+
quantity: z.ZodNumber;
|
|
163
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
164
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
165
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
166
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
167
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
168
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
169
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
170
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
171
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
172
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
173
|
+
/** "Was" price shown struck through, or null. */
|
|
174
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
175
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
176
|
+
available: z.ZodBoolean;
|
|
177
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
178
|
+
availableQuantity: z.ZodNumber;
|
|
179
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
180
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
181
|
+
variantId: z.ZodString;
|
|
182
|
+
quantity: z.ZodNumber;
|
|
183
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
184
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
185
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
186
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
187
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
188
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
189
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
190
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
191
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
192
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
193
|
+
/** "Was" price shown struck through, or null. */
|
|
194
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
195
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
196
|
+
available: z.ZodBoolean;
|
|
197
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
198
|
+
availableQuantity: z.ZodNumber;
|
|
199
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
200
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
201
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
202
|
+
companyId: z.ZodString;
|
|
203
|
+
currency: z.ZodString;
|
|
204
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
205
|
+
variantId: z.ZodString;
|
|
206
|
+
quantity: z.ZodNumber;
|
|
207
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
208
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
209
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
210
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
211
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
212
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
213
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
214
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
215
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
216
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
217
|
+
/** "Was" price shown struck through, or null. */
|
|
218
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
219
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
220
|
+
available: z.ZodBoolean;
|
|
221
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
222
|
+
availableQuantity: z.ZodNumber;
|
|
223
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
224
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
225
|
+
variantId: z.ZodString;
|
|
226
|
+
quantity: z.ZodNumber;
|
|
227
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
228
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
229
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
230
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
231
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
232
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
233
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
234
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
235
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
236
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
237
|
+
/** "Was" price shown struck through, or null. */
|
|
238
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
239
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
240
|
+
available: z.ZodBoolean;
|
|
241
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
242
|
+
availableQuantity: z.ZodNumber;
|
|
243
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
244
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
245
|
+
variantId: z.ZodString;
|
|
246
|
+
quantity: z.ZodNumber;
|
|
247
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
248
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
249
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
250
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
251
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
252
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
253
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
254
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
255
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
256
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
257
|
+
/** "Was" price shown struck through, or null. */
|
|
258
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
259
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
260
|
+
available: z.ZodBoolean;
|
|
261
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
262
|
+
availableQuantity: z.ZodNumber;
|
|
263
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
264
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
265
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
266
|
+
companyId: z.ZodString;
|
|
267
|
+
currency: z.ZodString;
|
|
268
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
269
|
+
variantId: z.ZodString;
|
|
270
|
+
quantity: z.ZodNumber;
|
|
271
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
272
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
273
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
274
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
275
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
276
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
277
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
278
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
279
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
280
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
281
|
+
/** "Was" price shown struck through, or null. */
|
|
282
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
283
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
284
|
+
available: z.ZodBoolean;
|
|
285
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
286
|
+
availableQuantity: z.ZodNumber;
|
|
287
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
288
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
289
|
+
variantId: z.ZodString;
|
|
290
|
+
quantity: z.ZodNumber;
|
|
291
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
292
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
293
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
294
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
295
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
296
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
297
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
298
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
299
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
300
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
301
|
+
/** "Was" price shown struck through, or null. */
|
|
302
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
303
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
304
|
+
available: z.ZodBoolean;
|
|
305
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
306
|
+
availableQuantity: z.ZodNumber;
|
|
307
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
308
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
309
|
+
variantId: z.ZodString;
|
|
310
|
+
quantity: z.ZodNumber;
|
|
311
|
+
productId: z.ZodNullable<z.ZodString>;
|
|
312
|
+
productName: z.ZodNullable<z.ZodString>;
|
|
313
|
+
productSlug: z.ZodNullable<z.ZodString>;
|
|
314
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
315
|
+
/** Option name → value, e.g. `{ Size: 'M' }`. */
|
|
316
|
+
options: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
317
|
+
/** Storage key of the picture to snapshot (variant picture first, else the product's primary), or null. */
|
|
318
|
+
imageKey: z.ZodNullable<z.ZodString>;
|
|
319
|
+
/** Price per unit now (after any price resolver, e.g. Phase 21 campaigns). */
|
|
320
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
321
|
+
/** "Was" price shown struck through, or null. */
|
|
322
|
+
compareAtPrice: z.ZodNullable<z.ZodString>;
|
|
323
|
+
taxClass: z.ZodNullable<z.ZodEnum<["standard", "zero_rated", "exempt"]>>;
|
|
324
|
+
available: z.ZodBoolean;
|
|
325
|
+
/** Units that can be sold now (stock − reserved, 0 when not sellable). */
|
|
326
|
+
availableQuantity: z.ZodNumber;
|
|
327
|
+
reason: z.ZodOptional<z.ZodEnum<["NOT_FOUND", "PRODUCT_UNAVAILABLE", "VARIANT_INACTIVE", "SHOP_UNAVAILABLE", "INSUFFICIENT_STOCK"]>>;
|
|
328
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
329
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
330
|
+
/** Envelope `data` of `GET /api/v1/internal/companies/{id}/readiness` (caller store-service). */
|
|
331
|
+
export declare const catalogReadinessSchema: z.ZodObject<{
|
|
332
|
+
hasSellableProduct: z.ZodBoolean;
|
|
333
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
334
|
+
hasSellableProduct: z.ZodBoolean;
|
|
335
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
336
|
+
hasSellableProduct: z.ZodBoolean;
|
|
337
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
338
|
+
/** Parsed body of the price quote. */
|
|
339
|
+
export type PriceQuoteRequest = z.infer<typeof priceQuoteRequestSchema>;
|
|
340
|
+
/** One requested line of the price quote. */
|
|
341
|
+
export type PriceQuoteRequestLine = z.infer<typeof priceQuoteRequestLineSchema>;
|
|
342
|
+
/** One quoted line (snapshot, price, availability). */
|
|
343
|
+
export type PriceQuoteLine = z.infer<typeof priceQuoteLineSchema>;
|
|
344
|
+
/** Envelope `data` of the price quote. */
|
|
345
|
+
export type PriceQuoteResponse = z.infer<typeof priceQuoteResponseSchema>;
|
|
346
|
+
/** Envelope `data` of catalog readiness. */
|
|
347
|
+
export type CatalogReadiness = z.infer<typeof catalogReadinessSchema>;
|
|
348
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/internal/catalog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAY,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAGnD,wCAAwC;AACxC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,sDAAsD;AACtD,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,6GAA8G,CAAC;AAE/I,0CAA0C;AAC1C,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,kEAAkE;AAClE,eAAO,MAAM,WAAW,+CAAgD,CAAC;AAEzE,0BAA0B;AAC1B,eAAO,MAAM,2BAA2B;;;;;;;;;EAG7B,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIzB,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;IAO/B,iDAAiD;;IAEjD,2GAA2G;;IAE3G,8EAA8E;;IAE9E,iDAAiD;;;;IAIjD,0EAA0E;;;;;;;;;;IAV1E,iDAAiD;;IAEjD,2GAA2G;;IAE3G,8EAA8E;;IAE9E,iDAAiD;;;;IAIjD,0EAA0E;;;;;;;;;;IAV1E,iDAAiD;;IAEjD,2GAA2G;;IAE3G,8EAA8E;;IAE9E,iDAAiD;;;;IAIjD,0EAA0E;;;gCAG5D,CAAC;AAEjB,+EAA+E;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CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,0CAA0C;AAC1C,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,4CAA4C;AAC5C,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heavybit/ecommerce-contracts",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "The e-commerce app's shared contracts: app settings, identity and scope bindings, step-up scopes, event catalogue and v1 payload schemas. Built on @heavybit/shared-lib; no business logic.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|