@final-commerce/command-frame 0.9.0-staging.1 → 0.10.0-staging.1

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.
@@ -16,8 +16,17 @@ export type CFAttributeOption = AttributeOption;
16
16
  export type CFAttribute = Attribute;
17
17
  export type CFTransaction = Transaction;
18
18
  export type CFCategory = Category;
19
- export type CFProductVariant = ProductVariant;
20
- export type CFProduct = FullProduct;
19
+ /**
20
+ * FT-151 `unavailable`: `true` when the variant is marked "can't be sold here right now" at the ACTIVE outlet
21
+ * (`setVariantUnavailable`). Independent of stock; `addProductToCart` refuses it even with backorders. The host always
22
+ * sets it on `getProducts`. INTERIM here until `common/pos-types` ProductVariant carries it (ob_agent).
23
+ */
24
+ export type CFProductVariant = ProductVariant & {
25
+ unavailable?: boolean;
26
+ };
27
+ export type CFProduct = Omit<FullProduct, 'variants'> & {
28
+ variants: CFProductVariant[];
29
+ };
21
30
  /** Composite products (FT-83): `CFProduct.composite`, the picks `addProductToCart` takes, the cart/order line's
22
31
  * components. The host decides availability, prices and tax; a flow renders them and sends picks. */
23
32
  /**
@@ -23,6 +23,21 @@ export const mockAddProductToCart = async (params) => {
23
23
  }
24
24
  }
25
25
  }
26
+ // Same refusal as the host: the mark wins over stock and backorders, and no line is created.
27
+ if (variant.unavailable) {
28
+ return {
29
+ success: false,
30
+ reason: 'Marked unavailable',
31
+ productId: product._id,
32
+ variantId: variant._id,
33
+ internalId: '',
34
+ name: product.name,
35
+ quantity: 0,
36
+ rows: [],
37
+ modifiersTotal: 0,
38
+ timestamp: new Date().toISOString(),
39
+ };
40
+ }
26
41
  // Composites: the host's refusals with its texts, then the same line it builds (kaching `buildCompositeLine`).
27
42
  let compositeLine;
28
43
  if (product.composite || params?.composite?.length) {
@@ -56,7 +56,7 @@ export interface AddProductToCartParams {
56
56
  }
57
57
  export interface AddProductToCartResponse {
58
58
  success: boolean;
59
- /** Set when the add was rejected (e.g. a required modifier is unanswered). */
59
+ /** Set when the add was rejected (e.g. a required modifier is unanswered, or `Marked unavailable` at this outlet). */
60
60
  reason?: string;
61
61
  productId: string;
62
62
  variantId: string;
@@ -15,5 +15,9 @@ import { GetRefundPlan } from './types';
15
15
  * and no company cash-rounding setting, so it always describes a FULL refund
16
16
  * with `rounding: 0` and no cash `payout`. Against real kaching the allocation
17
17
  * tracks the live selection and carries the drawer snap.
18
+ *
19
+ * `rows` / `allocation.breakdown` follow the engine's reading of the order
20
+ * (`line.total` includes the line's tax) but prorate by plain quantity share;
21
+ * the engine's remainder carry across earlier partial refunds is not modelled.
18
22
  */
19
23
  export declare const mockGetRefundPlan: GetRefundPlan;
@@ -1,4 +1,5 @@
1
1
  import { MOCK_ORDERS } from '../../demo/database';
2
+ import { mockRefundBreakdown, mockRefundRows } from './mockRows';
2
3
  /**
3
4
  * Demo derivation of the runtime `getRefundPlan`. Builds the per-source rows
4
5
  * from the mock order's `paymentMethods`, mirroring the runtime's capacity
@@ -15,6 +16,10 @@ import { MOCK_ORDERS } from '../../demo/database';
15
16
  * and no company cash-rounding setting, so it always describes a FULL refund
16
17
  * with `rounding: 0` and no cash `payout`. Against real kaching the allocation
17
18
  * tracks the live selection and carries the drawer snap.
19
+ *
20
+ * `rows` / `allocation.breakdown` follow the engine's reading of the order
21
+ * (`line.total` includes the line's tax) but prorate by plain quantity share;
22
+ * the engine's remainder carry across earlier partial refunds is not modelled.
18
23
  */
19
24
  export const mockGetRefundPlan = async (params) => {
20
25
  console.log('[Mock] getRefundPlan called', params);
@@ -62,16 +67,19 @@ export const mockGetRefundPlan = async (params) => {
62
67
  requiresGiftCardDestination: s.paymentType === 'redeem',
63
68
  }));
64
69
  const budget = legs.reduce((sum, l) => sum + l.amount, 0);
70
+ const rows = mockRefundRows(order);
65
71
  return {
66
72
  success: true,
67
73
  orderId: order._id,
68
74
  sources,
75
+ rows,
69
76
  allocation: {
70
77
  budget,
71
78
  // No cash rounding in the demo, so the goods value and the budget agree.
72
79
  itemTotal: budget,
73
80
  rounding: 0,
74
81
  legs,
82
+ breakdown: mockRefundBreakdown(rows, params?.items),
75
83
  },
76
84
  // Demo: no prior refunds, so remaining = captured minus the non-revenue load.
77
85
  remainingRefundable: Math.max(0, totalCaptured - nonRefundableLiability),
@@ -0,0 +1,6 @@
1
+ import type { CFActiveOrder } from '../../CommonTypes';
2
+ import type { GetRefundPlanParams, RefundPlanBreakdown, RefundPlanRow } from './types';
3
+ /** Every row of a demo order. The demo has no refund ledger, so everything is refundable. */
4
+ export declare function mockRefundRows(order: CFActiveOrder): RefundPlanRow[];
5
+ /** The selection's breakdown; no `items` means everything, like the demo's full-refund legs. */
6
+ export declare function mockRefundBreakdown(rows: RefundPlanRow[], items?: GetRefundPlanParams['items']): RefundPlanBreakdown;
@@ -0,0 +1,114 @@
1
+ // Demo derivation of `getRefundPlan`'s `rows` and `allocation.breakdown`, for
2
+ // local/standalone mode only. See the note on `mockGetRefundPlan`.
3
+ const minor = (v) => Math.round(Number(v ?? 0)) || 0;
4
+ /** A line's whole-quantity money, reading `total` as tax-inclusive (the engine's reading). */
5
+ function lineAmounts(line) {
6
+ const tax = minor(line.totalTax);
7
+ const itemDiscount = (line.discount?.itemDiscounts ?? []).reduce((s, d) => s + minor(d.amount), 0);
8
+ const cartDiscount = minor(line.discount?.cartDiscount?.amount);
9
+ const net = Math.max(0, minor(line.total) - tax);
10
+ const taxes = (line.taxes ?? []).map((t) => ({
11
+ name: String(t.name ?? 'Tax'),
12
+ percentage: t.percentage,
13
+ amount: minor(t.amount),
14
+ }));
15
+ return { subtotal: net + itemDiscount + cartDiscount, itemDiscount, cartDiscount, tax, taxes, total: net + tax };
16
+ }
17
+ function scale(a, share) {
18
+ if (share >= 1)
19
+ return a;
20
+ const r = (n) => Math.round(n * share);
21
+ const out = {
22
+ subtotal: r(a.subtotal),
23
+ itemDiscount: r(a.itemDiscount),
24
+ cartDiscount: r(a.cartDiscount),
25
+ tax: r(a.tax),
26
+ taxes: a.taxes.map((t) => ({ ...t, amount: r(t.amount) })),
27
+ };
28
+ return { ...out, total: out.subtotal - out.itemDiscount - out.cartDiscount + out.tax };
29
+ }
30
+ /** Every row of a demo order. The demo has no refund ledger, so everything is refundable. */
31
+ export function mockRefundRows(order) {
32
+ const rows = [];
33
+ for (const li of order.lineItems ?? []) {
34
+ const itemKey = String(li.internalId || li.variantId || '');
35
+ if (!itemKey || !(li.quantity > 0))
36
+ continue;
37
+ rows.push({
38
+ type: 'product',
39
+ itemKey,
40
+ label: String(li.name ?? 'Item'),
41
+ ...(li.sku ? { sku: li.sku } : {}),
42
+ ...(li.attributes ? { attributes: li.attributes } : {}),
43
+ quantity: li.quantity,
44
+ refundableQuantity: li.quantity,
45
+ amounts: lineAmounts(li),
46
+ });
47
+ }
48
+ for (const cs of order.customSales ?? []) {
49
+ if (!cs.customSaleId || !(cs.quantity > 0))
50
+ continue;
51
+ rows.push({
52
+ type: 'customSale',
53
+ itemKey: cs.customSaleId,
54
+ label: String(cs.name ?? 'Custom sale'),
55
+ quantity: cs.quantity,
56
+ refundableQuantity: cs.quantity,
57
+ amounts: lineAmounts(cs),
58
+ });
59
+ }
60
+ for (const fee of order.cartFees ?? []) {
61
+ const amount = minor(fee.amount);
62
+ const tax = minor(fee.tax);
63
+ rows.push({
64
+ type: 'fee',
65
+ itemKey: String(fee.id),
66
+ label: String(fee.label || 'Cart fee'),
67
+ quantity: 1,
68
+ refundableQuantity: 1,
69
+ amounts: { subtotal: amount, itemDiscount: 0, cartDiscount: 0, tax, taxes: [], total: amount + tax },
70
+ });
71
+ }
72
+ for (const pm of order.paymentMethods ?? []) {
73
+ const tip = minor(pm.tip?.amount);
74
+ if (tip <= 0)
75
+ continue;
76
+ rows.push({
77
+ type: 'tip',
78
+ itemKey: pm.transactionId,
79
+ label: 'Tip',
80
+ paymentType: pm.paymentType,
81
+ quantity: 1,
82
+ refundableQuantity: 1,
83
+ amounts: { subtotal: tip, itemDiscount: 0, cartDiscount: 0, tax: 0, taxes: [], total: tip },
84
+ });
85
+ }
86
+ return rows;
87
+ }
88
+ /** The selection's breakdown; no `items` means everything, like the demo's full-refund legs. */
89
+ export function mockRefundBreakdown(rows, items) {
90
+ const picked = new Map((items ?? []).map((i) => [i.itemKey, i.quantity]));
91
+ const selected = rows
92
+ .map((row) => {
93
+ const quantity = items?.length
94
+ ? Math.min(picked.get(row.itemKey) ?? 0, row.refundableQuantity)
95
+ : row.refundableQuantity;
96
+ return { type: row.type, itemKey: row.itemKey, quantity, amounts: scale(row.amounts, quantity / row.quantity) };
97
+ })
98
+ .filter((r) => r.quantity > 0);
99
+ const totals = { items: 0, discounts: 0, fees: 0, tax: 0, tip: 0, total: 0 };
100
+ for (const r of selected) {
101
+ const a = r.amounts;
102
+ if (r.type === 'fee')
103
+ totals.fees += a.subtotal;
104
+ else if (r.type === 'tip')
105
+ totals.tip += a.subtotal;
106
+ else {
107
+ totals.items += a.subtotal;
108
+ totals.discounts += a.itemDiscount + a.cartDiscount;
109
+ }
110
+ totals.tax += a.tax;
111
+ totals.total += a.total;
112
+ }
113
+ return { rows: selected, totals };
114
+ }
@@ -79,6 +79,81 @@ export interface RefundPlanLeg {
79
79
  rounding: number;
80
80
  };
81
81
  }
82
+ export type RefundPlanRowType = 'product' | 'customSale' | 'fee' | 'tip';
83
+ /** One tax rate's share of a row's refund (minor units). */
84
+ export interface RefundPlanTaxLine {
85
+ name: string;
86
+ /** Decimal rate as stored on the order (e.g. `0.15`), when the order recorded one. */
87
+ percentage?: number;
88
+ amount: number;
89
+ }
90
+ /**
91
+ * The money a row refunds, split the way a receipt shows it. Every field is
92
+ * minor units and already rounded; `subtotal − itemDiscount − cartDiscount +
93
+ * tax === total` always holds. DISPLAY IT — never re-add or prorate it.
94
+ */
95
+ export interface RefundPlanAmounts {
96
+ /** Before discounts, tax excluded. For a tip row, the tip itself. */
97
+ subtotal: number;
98
+ /** Per-item discounts on the refunded quantity (positive). */
99
+ itemDiscount: number;
100
+ /** Cart discount share on the refunded quantity (positive). */
101
+ cartDiscount: number;
102
+ /** Tax on the refunded quantity. Zero for a tip. */
103
+ tax: number;
104
+ /** `tax` per rate — the price breakdown's tax lines. */
105
+ taxes: RefundPlanTaxLine[];
106
+ /** What the row refunds. */
107
+ total: number;
108
+ }
109
+ /**
110
+ * One refundable row of the order — a line item, custom sale, cart fee or tip —
111
+ * served ready to render. Rows with nothing left to refund are not listed.
112
+ */
113
+ export interface RefundPlanRow {
114
+ type: RefundPlanRowType;
115
+ /** The key `items[].itemKey` takes, for this call and for `processPartialRefund`. */
116
+ itemKey: string;
117
+ /** Line or fee name; `Tip` for a tip. */
118
+ label: string;
119
+ /** Product lines only, when the order recorded them. */
120
+ sku?: string;
121
+ attributes?: string;
122
+ /** Tip rows only: the tender that took the tip (`card`, `cash`, …). */
123
+ paymentType?: string;
124
+ /** Quantity originally sold. Fees and tips are `1` — all or nothing. */
125
+ quantity: number;
126
+ /** Quantity still refundable — the stepper's max. */
127
+ refundableQuantity: number;
128
+ /** The money for refunding ALL of `refundableQuantity`. */
129
+ amounts: RefundPlanAmounts;
130
+ }
131
+ /** One selected row and what refunding the selected quantity of it moves. */
132
+ export interface RefundPlanSelectedRow {
133
+ type: RefundPlanRowType;
134
+ itemKey: string;
135
+ quantity: number;
136
+ amounts: RefundPlanAmounts;
137
+ }
138
+ /**
139
+ * The selection's goods value broken down for display. Minor units;
140
+ * `items − discounts + fees + tax + tip === total === allocation.itemTotal`.
141
+ */
142
+ export interface RefundPlanTotals {
143
+ /** Σ selected line subtotals (before discounts, tax excluded). */
144
+ items: number;
145
+ /** Σ item + cart discounts on the selected lines (positive). */
146
+ discounts: number;
147
+ /** Σ selected cart fees, tax excluded. */
148
+ fees: number;
149
+ tax: number;
150
+ tip: number;
151
+ total: number;
152
+ }
153
+ export interface RefundPlanBreakdown {
154
+ rows: RefundPlanSelectedRow[];
155
+ totals: RefundPlanTotals;
156
+ }
82
157
  /**
83
158
  * The engine's own allocation of the CURRENT refund selection across the
84
159
  * order's captures — what a flow renders and submits instead of computing a
@@ -106,11 +181,25 @@ export interface RefundPlanAllocation {
106
181
  rounding: number;
107
182
  /** One leg per source that receives money. Submit as `legs`, unchanged. */
108
183
  legs: RefundPlanLeg[];
184
+ /**
185
+ * What the selection refunds, per row and in total — the numbers a refund
186
+ * dialog's rows and footer render. Optional so an older runtime still
187
+ * type-checks; kaching 1.12.1+ always sends it.
188
+ */
189
+ breakdown?: RefundPlanBreakdown;
109
190
  }
110
191
  export interface GetRefundPlanResponse {
111
192
  success: boolean;
112
193
  orderId: string;
113
194
  sources: RefundPlanSource[];
195
+ /**
196
+ * Every row still refundable on the order, with the money for refunding all
197
+ * of it — what a refund dialog lists before anything is selected. Replaces
198
+ * reading line totals off the order and deciding whether they include tax.
199
+ * Optional so an older runtime still type-checks; kaching 1.12.1+ always
200
+ * sends it.
201
+ */
202
+ rows?: RefundPlanRow[];
114
203
  /**
115
204
  * Ready-to-submit allocation of the current selection. Present only when a
116
205
  * refund selection exists on the active order. See {@link RefundPlanAllocation}.
@@ -0,0 +1,2 @@
1
+ import type { SetVariantUnavailable } from './types';
2
+ export declare const setVariantUnavailable: SetVariantUnavailable;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from '../../client';
2
+ export const setVariantUnavailable = async (params) => {
3
+ return await commandFrameClient.call('setVariantUnavailable', params);
4
+ };
@@ -0,0 +1,2 @@
1
+ import { SetVariantUnavailable } from './types';
2
+ export declare const mockSetVariantUnavailable: SetVariantUnavailable;
@@ -0,0 +1,12 @@
1
+ import { MOCK_OUTLET, MOCK_PRODUCTS } from '../../demo/database';
2
+ export const mockSetVariantUnavailable = async (params) => {
3
+ console.log('[Mock] setVariantUnavailable called', params);
4
+ if (!params?.variantId)
5
+ throw new Error('variantId is required');
6
+ const { variantId, unavailable } = params;
7
+ const variant = MOCK_PRODUCTS.flatMap((product) => product.variants).find((v) => v._id === variantId);
8
+ if (!variant)
9
+ throw new Error(`Variant with ID ${variantId} not found`);
10
+ variant.unavailable = unavailable;
11
+ return { success: true, variantId, outletId: MOCK_OUTLET.id, unavailable, timestamp: new Date().toISOString() };
12
+ };
@@ -0,0 +1,17 @@
1
+ export interface SetVariantUnavailableParams {
2
+ /** Variant to mark or unmark. */
3
+ variantId: string;
4
+ /**
5
+ * `true` marks the variant "can't be sold here right now" at the ACTIVE outlet; `false` removes the mark.
6
+ * Independent of stock and of catalog visibility. Needs a connection: the host refuses offline.
7
+ */
8
+ unavailable: boolean;
9
+ }
10
+ export interface SetVariantUnavailableResponse {
11
+ success: boolean;
12
+ variantId: string;
13
+ outletId: string;
14
+ unavailable: boolean;
15
+ timestamp: string;
16
+ }
17
+ export type SetVariantUnavailable = (params?: SetVariantUnavailableParams) => Promise<SetVariantUnavailableResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -44,20 +44,20 @@ export declare const MOCK_CATEGORY_SPECIALTY: CFCategory;
44
44
  export declare const MOCK_CATEGORY_BASIC: CFCategory;
45
45
  export declare const MOCK_CATEGORY_VEGAN: CFCategory;
46
46
  export declare const MOCK_CATEGORY_SPICY: CFCategory;
47
- export declare const MOCK_PRODUCT_BASIL_ALMOND: import("@final-commerce/common/pos-types").FullProduct;
48
- export declare const MOCK_PRODUCT_BEER: import("@final-commerce/common/pos-types").FullProduct;
49
- export declare const MOCK_PRODUCT_BEET: import("@final-commerce/common/pos-types").FullProduct;
50
- export declare const MOCK_PRODUCT_CARAMELIZED: import("@final-commerce/common/pos-types").FullProduct;
51
- export declare const MOCK_PRODUCT_GARLIC_ONION: import("@final-commerce/common/pos-types").FullProduct;
52
- export declare const MOCK_PRODUCT_GARLIC: import("@final-commerce/common/pos-types").FullProduct;
53
- export declare const MOCK_PRODUCT_GINGER_LIME: import("@final-commerce/common/pos-types").FullProduct;
54
- export declare const MOCK_PRODUCT_LEMON: import("@final-commerce/common/pos-types").FullProduct;
55
- export declare const MOCK_PRODUCT_RED_PEPPER: import("@final-commerce/common/pos-types").FullProduct;
56
- export declare const MOCK_PRODUCT_ROASTED_TOMATO: import("@final-commerce/common/pos-types").FullProduct;
57
- export declare const MOCK_PRODUCT_MINT_LEMON: import("@final-commerce/common/pos-types").FullProduct;
58
- export declare const MOCK_PRODUCT_CHILI_GARLIC: import("@final-commerce/common/pos-types").FullProduct;
59
- export declare const MOCK_PRODUCT_HABANERO: import("@final-commerce/common/pos-types").FullProduct;
60
- export declare const MOCK_PRODUCT_BLACK_GARLIC: import("@final-commerce/common/pos-types").FullProduct;
47
+ export declare const MOCK_PRODUCT_BASIL_ALMOND: CFProduct;
48
+ export declare const MOCK_PRODUCT_BEER: CFProduct;
49
+ export declare const MOCK_PRODUCT_BEET: CFProduct;
50
+ export declare const MOCK_PRODUCT_CARAMELIZED: CFProduct;
51
+ export declare const MOCK_PRODUCT_GARLIC_ONION: CFProduct;
52
+ export declare const MOCK_PRODUCT_GARLIC: CFProduct;
53
+ export declare const MOCK_PRODUCT_GINGER_LIME: CFProduct;
54
+ export declare const MOCK_PRODUCT_LEMON: CFProduct;
55
+ export declare const MOCK_PRODUCT_RED_PEPPER: CFProduct;
56
+ export declare const MOCK_PRODUCT_ROASTED_TOMATO: CFProduct;
57
+ export declare const MOCK_PRODUCT_MINT_LEMON: CFProduct;
58
+ export declare const MOCK_PRODUCT_CHILI_GARLIC: CFProduct;
59
+ export declare const MOCK_PRODUCT_HABANERO: CFProduct;
60
+ export declare const MOCK_PRODUCT_BLACK_GARLIC: CFProduct;
61
61
  export declare const MOCK_ORDER_1: CFActiveOrder;
62
62
  export declare const MOCK_ORDER_2: CFActiveOrder;
63
63
  export declare const MOCK_ORDER_3: CFActiveOrder;
@@ -71,7 +71,7 @@ export declare const MOCK_CUSTOMERS: import("@final-commerce/common/pos-types").
71
71
  export declare const MOCK_CATEGORIES: import("@final-commerce/common/pos-types").Category[];
72
72
  export declare const MOCK_PRODUCT_HAIRCUT: CFProduct;
73
73
  export declare const MOCK_PRODUCT_PASTE_TRIO: CFProduct;
74
- export declare const MOCK_PRODUCTS: import("@final-commerce/common/pos-types").FullProduct[];
74
+ export declare const MOCK_PRODUCTS: CFProduct[];
75
75
  export declare const MOCK_ORDERS: import("@final-commerce/common/pos-types").ActiveOrder[];
76
76
  /** Nothing hidden by default; `setMockDatabase({ catalogVisibility })` hides products at an outlet. */
77
77
  export declare const MOCK_CATALOG_VISIBILITY: MockCatalogVisibility[];
@@ -242,6 +242,7 @@ const createSimpleProduct = (id, name, price, image, categories, description) =>
242
242
  salePrice: 0,
243
243
  isOnSale: false,
244
244
  manageStock: true,
245
+ unavailable: false,
245
246
  externalId: `ext_${id}_var`,
246
247
  attributes: [],
247
248
  inventory: createInventory(100),
@@ -278,6 +279,7 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
278
279
  salePrice: 0,
279
280
  isOnSale: false,
280
281
  manageStock: true,
282
+ unavailable: false,
281
283
  externalId: `ext_${id}_var_s`,
282
284
  attributes: [{ name: 'Size', value: 'Small' }],
283
285
  inventory: createInventory(50),
@@ -289,6 +291,7 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
289
291
  salePrice: 0,
290
292
  isOnSale: false,
291
293
  manageStock: true,
294
+ unavailable: false,
292
295
  externalId: `ext_${id}_var_l`,
293
296
  attributes: [{ name: 'Size', value: 'Large' }],
294
297
  inventory: createInventory(30),
@@ -298,6 +301,8 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
298
301
  };
299
302
  export const MOCK_PRODUCT_BASIL_ALMOND = createSimpleProduct('prod_basil_almond', 'Basil Almond Paste', 1200, basilAlmondImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], 'A rich blend of fresh basil and roasted almonds.');
300
303
  export const MOCK_PRODUCT_BEER = createVariableProduct('prod_beer', 'Beer Paste', 1500, 2500, beerImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY], 'Unique paste infused with dark lager.');
304
+ // Demo of `setVariantUnavailable`: the large jar is marked unavailable at the outlet, so `addProductToCart` refuses it.
305
+ MOCK_PRODUCT_BEER.variants[1].unavailable = true;
301
306
  export const MOCK_PRODUCT_BEET = createSimpleProduct('prod_beet', 'Beet Paste', 1000, beetImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], 'Earthy and sweet beet paste, perfect for salads.');
302
307
  export const MOCK_PRODUCT_CARAMELIZED = createVariableProduct('prod_caramelized', 'Caramelized Paste', 1400, 2200, caramelizedImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], 'Slow-cooked caramelized onion paste.');
303
308
  export const MOCK_PRODUCT_GARLIC_ONION = createVariableProduct('prod_garlic_onion', 'Garlic Onion Paste', 1100, 1800, garlicOnionImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], 'Classic savory base for any dish.');
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export declare const command: {
37
37
  readonly getActiveProduct: import(".").GetActiveProduct;
38
38
  readonly setActiveProduct: import(".").SetActiveProduct;
39
39
  readonly adjustInventory: import(".").AdjustInventory;
40
+ readonly setVariantUnavailable: import(".").SetVariantUnavailable;
40
41
  readonly addOrderNote: import(".").AddOrderNote;
41
42
  readonly addCartFee: import(".").AddCartFee;
42
43
  readonly getCurrentCart: import(".").GetCurrentCart;
@@ -162,7 +163,7 @@ export type { CalculateRefundTotal, CalculateRefundTotalParams, CalculateRefundT
162
163
  export type { GetRemainingRefundableQuantities, GetRemainingRefundableQuantitiesParams, GetRemainingRefundableQuantitiesResponse, } from './actions/get-remaining-refundable-quantities/types';
163
164
  export type { ProcessPartialRefund, ProcessPartialRefundParams, ProcessPartialRefundResponse, } from './actions/process-partial-refund/types';
164
165
  export type { RedeemRefund, RedeemRefundParams, RedeemRefundResponse } from './actions/redeem-refund/types';
165
- export type { GetRefundPlan, GetRefundPlanParams, GetRefundPlanResponse, RefundPlanSource, RefundPlanAllocation, RefundPlanLeg, } from './actions/get-refund-plan/types';
166
+ export type { GetRefundPlan, GetRefundPlanParams, GetRefundPlanResponse, RefundPlanSource, RefundPlanAllocation, RefundPlanLeg, RefundPlanRowType, RefundPlanTaxLine, RefundPlanAmounts, RefundPlanRow, RefundPlanSelectedRow, RefundPlanTotals, RefundPlanBreakdown, } from './actions/get-refund-plan/types';
166
167
  export type { CheckPermission, CheckPermissionParams, CheckPermissionResponse } from './actions/check-permission/types';
167
168
  export type { InitiateRefund, InitiateRefundParams, InitiateRefundResponse } from './actions/initiate-refund/types';
168
169
  export type { GetCurrentCart, GetCurrentCartResponse } from './actions/get-current-cart/types';
@@ -184,6 +185,7 @@ export type { SetActiveProductDiscount, SetActiveProductDiscountParams, SetActiv
184
185
  export type { GetActiveProduct, GetActiveProductResponse } from './actions/get-active-product/types';
185
186
  export type { SetActiveProduct, SetActiveProductParams, SetActiveProductResponse, } from './actions/set-active-product/types';
186
187
  export type { AdjustInventory, AdjustInventoryParams, AdjustInventoryResponse } from './actions/adjust-inventory/types';
188
+ export type { SetVariantUnavailable, SetVariantUnavailableParams, SetVariantUnavailableResponse, } from './actions/set-variant-unavailable/types';
187
189
  export type { AddOrderNote, AddOrderNoteParams, AddOrderNoteResponse } from './actions/add-order-note/types';
188
190
  export type { AddCartFee, AddCartFeeParams, AddCartFeeResponse } from './actions/add-cart-fee/types';
189
191
  export type { ClearCart, ClearCartResponse } from './actions/clear-cart/types';
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ import { setActiveProductDiscount } from './actions/set-active-product-discount/
36
36
  import { getActiveProduct } from './actions/get-active-product/action';
37
37
  import { setActiveProduct } from './actions/set-active-product/action';
38
38
  import { adjustInventory } from './actions/adjust-inventory/action';
39
+ import { setVariantUnavailable } from './actions/set-variant-unavailable/action';
39
40
  // Order Actions
40
41
  import { addOrderNote } from './actions/add-order-note/action';
41
42
  import { addCartFee } from './actions/add-cart-fee/action';
@@ -184,6 +185,7 @@ export const command = {
184
185
  getActiveProduct,
185
186
  setActiveProduct,
186
187
  adjustInventory,
188
+ setVariantUnavailable,
187
189
  // Order Actions
188
190
  addOrderNote,
189
191
  addCartFee,
@@ -28,6 +28,7 @@ import { mockRemoveProductFromCart } from '../../actions/remove-product-from-car
28
28
  import { mockRemoveCartDiscount } from '../../actions/remove-cart-discount/mock';
29
29
  import { mockUpdateCartItemQuantity } from '../../actions/update-cart-item-quantity/mock';
30
30
  import { mockAdjustInventory } from '../../actions/adjust-inventory/mock';
31
+ import { mockSetVariantUnavailable } from '../../actions/set-variant-unavailable/mock';
31
32
  import { mockAssignCustomer } from '../../actions/assign-customer/mock';
32
33
  import { mockAuthenticateUser } from '../../actions/authenticate-user/mock';
33
34
  import { mockCalculateRefundTotal } from '../../actions/calculate-refund-total/mock';
@@ -136,6 +137,7 @@ export const RENDER_MOCKS = {
136
137
  removeProductFromCart: mockRemoveProductFromCart,
137
138
  updateCartItemQuantity: mockUpdateCartItemQuantity,
138
139
  adjustInventory: mockAdjustInventory,
140
+ setVariantUnavailable: mockSetVariantUnavailable,
139
141
  assignCustomer: mockAssignCustomer,
140
142
  authenticateUser: mockAuthenticateUser,
141
143
  calculateRefundTotal: mockCalculateRefundTotal,
@@ -1,4 +1,4 @@
1
- import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, GetProductModifierSelections, GetCompositePrice, GetCompositeAvailability, SetProductModifierSelections, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, VoidOrder, InitiateRefund, CashPayment, GetCashRoundingAmount, TapToPayPayment, TerminalPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, RedeemRefund, GetRefundPlan, CheckPermission, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, GetActiveStation, GetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, CanTransition, GetAvailableTransitions, ApplyTransition, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout, SendEmail, SendSms, GetBookingResources, GetBookingAvailability, GetBookings, HoldBooking, AddBookingToCart, RemoveBookingFromCart, CancelBooking, CreatePaymentLink, ChargeMoto, GetTimeClockStatus } from '../../index';
1
+ import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, GetProductModifierSelections, GetCompositePrice, GetCompositeAvailability, SetProductModifierSelections, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, SetVariantUnavailable, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, VoidOrder, InitiateRefund, CashPayment, GetCashRoundingAmount, TapToPayPayment, TerminalPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, RedeemRefund, GetRefundPlan, CheckPermission, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, GetActiveStation, GetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, CanTransition, GetAvailableTransitions, ApplyTransition, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout, SendEmail, SendSms, GetBookingResources, GetBookingAvailability, GetBookings, HoldBooking, AddBookingToCart, RemoveBookingFromCart, CancelBooking, CreatePaymentLink, ChargeMoto, GetTimeClockStatus } from '../../index';
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
@@ -37,6 +37,7 @@ export interface RenderProviderActions {
37
37
  getActiveProduct: GetActiveProduct;
38
38
  setActiveProduct: SetActiveProduct;
39
39
  adjustInventory: AdjustInventory;
40
+ setVariantUnavailable: SetVariantUnavailable;
40
41
  addOrderNote: AddOrderNote;
41
42
  addCartFee: AddCartFee;
42
43
  clearCart: ClearCart;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.9.0-staging.1",
3
+ "version": "0.10.0-staging.1",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",