@heavybit/ecommerce-contracts 0.3.4 → 0.3.8

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.
Files changed (51) hide show
  1. package/dist/cjs/app.js +3 -1
  2. package/dist/cjs/app.js.map +1 -1
  3. package/dist/cjs/events/auth.js +6 -0
  4. package/dist/cjs/events/auth.js.map +1 -1
  5. package/dist/cjs/events/order.js +3 -1
  6. package/dist/cjs/events/order.js.map +1 -1
  7. package/dist/cjs/events/payment.js +14 -4
  8. package/dist/cjs/events/payment.js.map +1 -1
  9. package/dist/cjs/index.js +2 -1
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/cjs/internal/catalog.js +74 -0
  12. package/dist/cjs/internal/catalog.js.map +1 -0
  13. package/dist/cjs/internal/index.js +18 -0
  14. package/dist/cjs/internal/index.js.map +1 -0
  15. package/dist/cjs/permissions.js +1 -0
  16. package/dist/cjs/permissions.js.map +1 -1
  17. package/dist/esm/app.js +2 -0
  18. package/dist/esm/app.js.map +1 -1
  19. package/dist/esm/events/auth.js +6 -0
  20. package/dist/esm/events/auth.js.map +1 -1
  21. package/dist/esm/events/order.js +3 -1
  22. package/dist/esm/events/order.js.map +1 -1
  23. package/dist/esm/events/payment.js +13 -3
  24. package/dist/esm/events/payment.js.map +1 -1
  25. package/dist/esm/index.js +2 -1
  26. package/dist/esm/index.js.map +1 -1
  27. package/dist/esm/internal/catalog.js +71 -0
  28. package/dist/esm/internal/catalog.js.map +1 -0
  29. package/dist/esm/internal/index.js +2 -0
  30. package/dist/esm/internal/index.js.map +1 -0
  31. package/dist/esm/permissions.js +1 -0
  32. package/dist/esm/permissions.js.map +1 -1
  33. package/dist/types/app.d.ts +4 -0
  34. package/dist/types/app.d.ts.map +1 -1
  35. package/dist/types/events/auth.d.ts +12 -0
  36. package/dist/types/events/auth.d.ts.map +1 -1
  37. package/dist/types/events/index.d.ts +156 -1
  38. package/dist/types/events/index.d.ts.map +1 -1
  39. package/dist/types/events/order.d.ts +3 -0
  40. package/dist/types/events/order.d.ts.map +1 -1
  41. package/dist/types/events/payment.d.ts +75 -0
  42. package/dist/types/events/payment.d.ts.map +1 -1
  43. package/dist/types/index.d.ts +2 -1
  44. package/dist/types/index.d.ts.map +1 -1
  45. package/dist/types/internal/catalog.d.ts +348 -0
  46. package/dist/types/internal/catalog.d.ts.map +1 -0
  47. package/dist/types/internal/index.d.ts +2 -0
  48. package/dist/types/internal/index.d.ts.map +1 -0
  49. package/dist/types/permissions.d.ts +1 -0
  50. package/dist/types/permissions.d.ts.map +1 -1
  51. package/package.json +1 -1
@@ -12,12 +12,18 @@ export declare const PAYMENT_KEYS: {
12
12
  readonly completed: "payment.refund.completed";
13
13
  readonly failed: "payment.refund.failed";
14
14
  };
15
+ /** A shop's prepaid wallet changed state (Prompt 17.3). */
16
+ readonly billing: {
17
+ readonly stateChanged: "payment.billing.state_changed";
18
+ };
15
19
  readonly payout: {
16
20
  readonly scheduled: "payment.payout.scheduled";
17
21
  readonly paid: "payment.payout.paid";
18
22
  readonly failed: "payment.payout.failed";
19
23
  };
20
24
  };
25
+ /** How a shop's prepaid wallet is doing (docs/BILLING.md §3); `restricted` means metered extras are paused. */
26
+ export declare const WALLET_STATES: readonly ["healthy", "low", "grace", "restricted", "checkout_paused"];
21
27
  /** v1 payload schemas of the payment events. */
22
28
  export declare const PAYMENT_EVENTS: {
23
29
  readonly "payment.payment.initiated": z.ZodObject<{
@@ -45,11 +51,13 @@ export declare const PAYMENT_EVENTS: {
45
51
  paymentId: z.ZodString;
46
52
  orderId: z.ZodString;
47
53
  }, z.ZodTypeAny, "passthrough">>;
54
+ /** `platformFee` (since 0.3.7, optional first, MS-4): the transaction fee fixed for this order at payment success (SET-1, D5 decimal string); order-service keeps it on the order. */
48
55
  readonly "payment.payment.succeeded": z.ZodObject<{
49
56
  companyId: z.ZodString;
50
57
  } & {
51
58
  providerRef: z.ZodString;
52
59
  paidAt: z.ZodString;
60
+ platformFee: z.ZodOptional<z.ZodString>;
53
61
  amount: z.ZodString;
54
62
  currency: z.ZodLiteral<"KES">;
55
63
  paymentId: z.ZodString;
@@ -59,6 +67,7 @@ export declare const PAYMENT_EVENTS: {
59
67
  } & {
60
68
  providerRef: z.ZodString;
61
69
  paidAt: z.ZodString;
70
+ platformFee: z.ZodOptional<z.ZodString>;
62
71
  amount: z.ZodString;
63
72
  currency: z.ZodLiteral<"KES">;
64
73
  paymentId: z.ZodString;
@@ -68,6 +77,7 @@ export declare const PAYMENT_EVENTS: {
68
77
  } & {
69
78
  providerRef: z.ZodString;
70
79
  paidAt: z.ZodString;
80
+ platformFee: z.ZodOptional<z.ZodString>;
71
81
  amount: z.ZodString;
72
82
  currency: z.ZodLiteral<"KES">;
73
83
  paymentId: z.ZodString;
@@ -112,6 +122,17 @@ export declare const PAYMENT_EVENTS: {
112
122
  companyId: z.ZodString;
113
123
  } & {
114
124
  completedAt: z.ZodString;
125
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
126
+ orderItemId: z.ZodString;
127
+ quantity: z.ZodNumber;
128
+ }, "strip", z.ZodTypeAny, {
129
+ orderItemId: string;
130
+ quantity: number;
131
+ }, {
132
+ orderItemId: string;
133
+ quantity: number;
134
+ }>, "many">>;
135
+ includesShipping: z.ZodOptional<z.ZodBoolean>;
115
136
  amount: z.ZodString;
116
137
  currency: z.ZodLiteral<"KES">;
117
138
  refundId: z.ZodString;
@@ -121,6 +142,17 @@ export declare const PAYMENT_EVENTS: {
121
142
  companyId: z.ZodString;
122
143
  } & {
123
144
  completedAt: z.ZodString;
145
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
146
+ orderItemId: z.ZodString;
147
+ quantity: z.ZodNumber;
148
+ }, "strip", z.ZodTypeAny, {
149
+ orderItemId: string;
150
+ quantity: number;
151
+ }, {
152
+ orderItemId: string;
153
+ quantity: number;
154
+ }>, "many">>;
155
+ includesShipping: z.ZodOptional<z.ZodBoolean>;
124
156
  amount: z.ZodString;
125
157
  currency: z.ZodLiteral<"KES">;
126
158
  refundId: z.ZodString;
@@ -130,6 +162,17 @@ export declare const PAYMENT_EVENTS: {
130
162
  companyId: z.ZodString;
131
163
  } & {
132
164
  completedAt: z.ZodString;
165
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
166
+ orderItemId: z.ZodString;
167
+ quantity: z.ZodNumber;
168
+ }, "strip", z.ZodTypeAny, {
169
+ orderItemId: string;
170
+ quantity: number;
171
+ }, {
172
+ orderItemId: string;
173
+ quantity: number;
174
+ }>, "many">>;
175
+ includesShipping: z.ZodOptional<z.ZodBoolean>;
133
176
  amount: z.ZodString;
134
177
  currency: z.ZodLiteral<"KES">;
135
178
  refundId: z.ZodString;
@@ -142,18 +185,50 @@ export declare const PAYMENT_EVENTS: {
142
185
  refundId: z.ZodString;
143
186
  orderId: z.ZodString;
144
187
  reason: z.ZodString;
188
+ paymentId: z.ZodOptional<z.ZodString>;
189
+ amount: z.ZodOptional<z.ZodString>;
190
+ currency: z.ZodOptional<z.ZodLiteral<"KES">>;
145
191
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
146
192
  companyId: z.ZodString;
147
193
  } & {
148
194
  refundId: z.ZodString;
149
195
  orderId: z.ZodString;
150
196
  reason: z.ZodString;
197
+ paymentId: z.ZodOptional<z.ZodString>;
198
+ amount: z.ZodOptional<z.ZodString>;
199
+ currency: z.ZodOptional<z.ZodLiteral<"KES">>;
151
200
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
152
201
  companyId: z.ZodString;
153
202
  } & {
154
203
  refundId: z.ZodString;
155
204
  orderId: z.ZodString;
156
205
  reason: z.ZodString;
206
+ paymentId: z.ZodOptional<z.ZodString>;
207
+ amount: z.ZodOptional<z.ZodString>;
208
+ currency: z.ZodOptional<z.ZodLiteral<"KES">>;
209
+ }, z.ZodTypeAny, "passthrough">>;
210
+ /** `since` is when the wallet entered `state`; `balance` is the wallet balance then (decimal string, may be negative). Carries no personal data. */
211
+ readonly "payment.billing.state_changed": z.ZodObject<{
212
+ companyId: z.ZodString;
213
+ } & {
214
+ previousState: z.ZodEnum<["healthy", "low", "grace", "restricted", "checkout_paused"]>;
215
+ state: z.ZodEnum<["healthy", "low", "grace", "restricted", "checkout_paused"]>;
216
+ balance: z.ZodString;
217
+ since: z.ZodString;
218
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
219
+ companyId: z.ZodString;
220
+ } & {
221
+ previousState: z.ZodEnum<["healthy", "low", "grace", "restricted", "checkout_paused"]>;
222
+ state: z.ZodEnum<["healthy", "low", "grace", "restricted", "checkout_paused"]>;
223
+ balance: z.ZodString;
224
+ since: z.ZodString;
225
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
226
+ companyId: z.ZodString;
227
+ } & {
228
+ previousState: z.ZodEnum<["healthy", "low", "grace", "restricted", "checkout_paused"]>;
229
+ state: z.ZodEnum<["healthy", "low", "grace", "restricted", "checkout_paused"]>;
230
+ balance: z.ZodString;
231
+ since: z.ZodString;
157
232
  }, z.ZodTypeAny, "passthrough">>;
158
233
  readonly "payment.payout.scheduled": z.ZodObject<{
159
234
  companyId: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/events/payment.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAGzC,iDAAiD;AACjD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;CASf,CAAC;AAOX,gDAAgD;AAChD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUjB,CAAC"}
1
+ {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/events/payment.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAGzC,iDAAiD;AACjD,eAAO,MAAM,YAAY;;;;;;;;;;;IAQvB,2DAA2D;;;;;;;;;CAGnD,CAAC;AAEX,+GAA+G;AAC/G,eAAO,MAAM,aAAa,uEAAwE,CAAC;AAUnG,gDAAgD;AAChD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;IAEzB,sLAAsL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMtL,oJAAoJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAK5I,CAAC"}
@@ -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 event catalogue, built on `@heavybit/shared-lib`. No business logic.
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;AAC/E,eAAO,MAAM,wBAAwB;;;;;;;;;;QAhBnC,iDAAiD;;QAEjD,2GAA2G;;QAE3G,8EAA8E;;QAE9E,iDAAiD;;;;QAIjD,0EAA0E;;;;;;;;;;QAV1E,iDAAiD;;QAEjD,2GAA2G;;QAE3G,8EAA8E;;QAE9E,iDAAiD;;;;QAIjD,0EAA0E;;;;;;;;;;QAV1E,iDAAiD;;QAEjD,2GAA2G;;QAE3G,8EAA8E;;QAE9E,iDAAiD;;;;QAIjD,0EAA0E;;;;;;;;;;;;;;QAV1E,iDAAiD;;QAEjD,2GAA2G;;QAE3G,8EAA8E;;QAE9E,iDAAiD;;;;QAIjD,0EAA0E;;;;;;;;;;QAV1E,iDAAiD;;QAEjD,2GAA2G;;QAE3G,8EAA8E;;QAE9E,iDAAiD;;;;QAIjD,0EAA0E;;;;;;;;;;QAV1E,iDAAiD;;QAEjD,2GAA2G;;QAE3G,8EAA8E;;QAE9E,iDAAiD;;;;QAIjD,0EAA0E;;;;;;;;;;;;;;QAV1E,iDAAiD;;QAEjD,2GAA2G;;QAE3G,8EAA8E;;QAE9E,iDAAiD;;;;QAIjD,0EAA0E;;;;;;;;;;QAV1E,iDAAiD;;QAEjD,2GAA2G;;QAE3G,8EAA8E;;QAE9E,iDAAiD;;;;QAIjD,0EAA0E;;;;;;;;;;QAV1E,iDAAiD;;QAEjD,2GAA2G;;QAE3G,8EAA8E;;QAE9E,iDAAiD;;;;QAIjD,0EAA0E;;;;gCAU5D,CAAC;AAEjB,iGAAiG;AACjG,eAAO,MAAM,sBAAsB;;;;;;gCAA8D,CAAC;AAElG,sCAAsC;AACtC,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,6CAA6C;AAC7C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,uDAAuD;AACvD,MAAM,MAAM,cAAc,GAAG,CAAC,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,2 @@
1
+ export * from './catalog.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -50,6 +50,7 @@ export declare const PERMISSIONS: {
50
50
  readonly platformStaffManage: "platform:staff:manage";
51
51
  readonly platformBillingRead: "platform:billing:read";
52
52
  readonly platformBillingManage: "platform:billing:manage";
53
+ readonly platformPaymentsManage: "platform:payments:manage";
53
54
  readonly platformDeliveryManage: "platform:delivery:manage";
54
55
  readonly platformAuditRead: "platform:audit:read";
55
56
  readonly platformSettingsManage: "platform:settings:manage";
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/permissions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,EAAG,4BAAqC,CAAC;AAEzE,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,EAAG,aAAsB,CAAC;AAE3D,8HAA8H;AAC9H,eAAO,MAAM,0BAA0B,EAAG,iBAA0B,CAAC;AAErE,iEAAiE;AACjE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Cd,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/permissions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,EAAG,4BAAqC,CAAC;AAEzE,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,EAAG,aAAsB,CAAC;AAE3D,8HAA8H;AAC9H,eAAO,MAAM,0BAA0B,EAAG,iBAA0B,CAAC;AAErE,iEAAiE;AACjE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Cd,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heavybit/ecommerce-contracts",
3
- "version": "0.3.4",
3
+ "version": "0.3.8",
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",