@final-commerce/command-frame 0.1.41-develop → 0.1.42

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/README.md CHANGED
@@ -16,6 +16,23 @@ The library provides three main capabilities:
16
16
 
17
17
  ## Installation
18
18
 
19
+ ### From npm (public registry)
20
+
21
+ ```bash
22
+ npm install @final-commerce/command-frame
23
+ ```
24
+
25
+ ### From GitHub Packages
26
+
27
+ To install from GitHub Packages, add this to your project's `.npmrc`:
28
+
29
+ ```
30
+ @final-commerce:registry=https://npm.pkg.github.com
31
+ //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
32
+ ```
33
+
34
+ Set `NODE_AUTH_TOKEN` to a GitHub personal access token with `read:packages` scope, then install as usual:
35
+
19
36
  ```bash
20
37
  npm install @final-commerce/command-frame
21
38
  ```
@@ -1,47 +1,4 @@
1
1
  export * from "./common-types";
2
- export declare enum CurrencyCode {
3
- USD = "USD",
4
- EUR = "EUR",
5
- GBP = "GBP",
6
- CAD = "CAD",
7
- AUD = "AUD",
8
- NZD = "NZD",
9
- CHF = "CHF",
10
- CNY = "CNY",
11
- INR = "INR",
12
- MXN = "MXN",
13
- BRL = "BRL",
14
- ZAR = "ZAR",
15
- SGD = "SGD",
16
- HKD = "HKD",
17
- SEK = "SEK",
18
- NOK = "NOK",
19
- DKK = "DKK",
20
- PLN = "PLN",
21
- THB = "THB",
22
- MYR = "MYR",
23
- PHP = "PHP",
24
- IDR = "IDR",
25
- AED = "AED",
26
- SAR = "SAR",
27
- ILS = "ILS",
28
- TRY = "TRY",
29
- RUB = "RUB",
30
- JPY = "JPY",
31
- KRW = "KRW",
32
- VND = "VND",
33
- CLP = "CLP",
34
- ISK = "ISK",
35
- HUF = "HUF",
36
- TWD = "TWD",
37
- KWD = "KWD",
38
- BHD = "BHD",
39
- OMR = "OMR",
40
- JOD = "JOD",
41
- TND = "TND",
42
- LYD = "LYD",
43
- IQD = "IQD"
44
- }
45
2
  export declare enum CFProductType {
46
3
  SIMPLE = "simple",
47
4
  VARIABLE = "variable"
@@ -94,7 +51,7 @@ export interface CFTax {
94
51
  id: string;
95
52
  name: string;
96
53
  percentage: number;
97
- amount: number;
54
+ amount: string;
98
55
  taxTableName: string;
99
56
  taxTableId: string;
100
57
  }
@@ -125,11 +82,11 @@ export interface CFCategory {
125
82
  }
126
83
  export interface CFProductVariant {
127
84
  sku: string;
128
- price: number;
129
- salePrice: number;
85
+ price: string;
86
+ salePrice: string;
130
87
  isOnSale: boolean;
131
88
  barcode?: string;
132
- costPrice?: number;
89
+ costPrice?: string;
133
90
  manageStock: boolean;
134
91
  externalId?: string;
135
92
  inventory?: CFInventory[];
@@ -164,10 +121,8 @@ export interface CFProduct {
164
121
  sku?: string;
165
122
  productType: CFProductType;
166
123
  variants: CFProductVariant[];
167
- currency: CurrencyCode;
168
- minorUnits: number;
169
- minPrice?: number;
170
- maxPrice?: number;
124
+ minPrice?: string;
125
+ maxPrice?: string;
171
126
  status?: string;
172
127
  isDeleted?: boolean;
173
128
  }
@@ -217,40 +172,40 @@ export interface CFActiveCustomer extends CFCustomer {
217
172
  id?: string;
218
173
  }
219
174
  export interface CFTip {
220
- amount: number;
175
+ amount: string;
221
176
  percentage: number;
222
177
  }
223
178
  export interface CFSummary {
224
- discountTotal: number;
225
- shippingTotal?: number | null;
226
- total: number;
227
- totalTaxes: number;
228
- subTotal: number;
179
+ discountTotal: string;
180
+ shippingTotal?: string | null;
181
+ total: string;
182
+ totalTaxes: string;
183
+ subTotal: string;
229
184
  taxes: CFTax[];
230
185
  tip?: CFTip | null;
231
186
  isTaxInclusive: boolean;
232
187
  }
233
188
  export interface CFCartDiscountItem {
234
189
  label: string;
235
- amount: number;
190
+ amount: string;
236
191
  percentage: number;
237
192
  }
238
193
  export interface CFCartFeeItem {
239
194
  id: string;
240
195
  label: string;
241
- amount: number;
196
+ amount: string;
242
197
  percentage: number;
243
198
  taxTableId?: string;
244
- tax?: number;
199
+ tax?: string;
245
200
  taxName: string;
246
201
  }
247
202
  export interface CFTipPayment {
248
- amount: number;
203
+ amount: string;
249
204
  tipTo: string;
250
205
  percentage: number;
251
206
  }
252
207
  export interface CFRefundedTipPayment {
253
- amount: number;
208
+ amount: string;
254
209
  percentage: number;
255
210
  transactionId: string;
256
211
  tipTo: string;
@@ -258,11 +213,11 @@ export interface CFRefundedTipPayment {
258
213
  export interface CFPaymentMethod {
259
214
  transactionId: string;
260
215
  paymentType: string;
261
- amount: number;
216
+ amount: string;
262
217
  timestamp: string;
263
218
  processor: string;
264
219
  saleId?: string;
265
- change?: number | null;
220
+ change?: string | null;
266
221
  tip?: CFTipPayment | null;
267
222
  cashRounding?: number;
268
223
  emv?: string | null;
@@ -278,13 +233,13 @@ export interface CFPosDataItem {
278
233
  }
279
234
  export interface CFDiscountDetail {
280
235
  percentage: number;
281
- amount: number;
236
+ amount: string;
282
237
  const?: string;
283
238
  }
284
239
  export interface CFFeeDetail {
285
240
  percentage: number;
286
- amount: number;
287
- tax: number;
241
+ amount: string;
242
+ tax: string;
288
243
  taxTableId: string;
289
244
  }
290
245
  export interface CFDiscountLineItem {
@@ -302,12 +257,12 @@ export interface CFLineItem {
302
257
  internalId?: string;
303
258
  name: string;
304
259
  quantity: number;
305
- price: number;
260
+ price: string;
306
261
  taxes: CFTax[];
307
262
  discount: CFDiscountLineItem;
308
263
  fee: CFFeeLineItem;
309
- totalTax: number;
310
- total: number;
264
+ totalTax: string;
265
+ total: string;
311
266
  metadata: CFMetadataItem[];
312
267
  image: string;
313
268
  sku: string;
@@ -321,21 +276,21 @@ export interface CFLineItem {
321
276
  export interface CFCustomSale {
322
277
  customSaleId: string;
323
278
  name: string;
324
- price: number;
279
+ price: string;
325
280
  quantity: number;
326
281
  applyTaxes: boolean;
327
- total: number;
328
- totalTax: number;
282
+ total: string;
283
+ totalTax: string;
329
284
  taxes: CFTax[];
330
285
  discount: {
331
286
  cartDiscount: CFDiscountDetail;
332
287
  };
333
288
  fee: {
334
289
  cartFee: {
335
- amount: number;
290
+ amount: string;
336
291
  label: string;
337
292
  percentage: number;
338
- tax: number;
293
+ tax: string;
339
294
  taxTableId: string;
340
295
  };
341
296
  };
@@ -348,11 +303,11 @@ export interface CFRefundedLineItem {
348
303
  internalId?: string;
349
304
  name: string;
350
305
  quantity: number;
351
- price: number;
306
+ price: string;
352
307
  taxes: CFTax[];
353
308
  discount: CFDiscountLineItem;
354
- totalTax: number;
355
- total: number;
309
+ totalTax: string;
310
+ total: string;
356
311
  image: string;
357
312
  sku: string;
358
313
  note?: string;
@@ -371,15 +326,12 @@ export interface CFRefundItem {
371
326
  timestamp: string | undefined;
372
327
  summary?: CFSummary;
373
328
  refundPayment: CFPaymentMethod[];
374
- balance?: number;
329
+ balance?: string;
375
330
  receiptId?: string;
376
- currency: CurrencyCode;
377
- minorUnits: number;
331
+ currency?: string;
378
332
  }
379
333
  export interface CFOrder {
380
334
  _id: string;
381
- currency: CurrencyCode;
382
- minorUnits: number;
383
335
  receiptId?: string;
384
336
  companyId: string;
385
337
  externalId: string | null;
@@ -402,7 +354,7 @@ export interface CFOrder {
402
354
  lineItems: CFLineItem[];
403
355
  customSales: CFCustomSale[];
404
356
  refund?: CFRefundItem[];
405
- balance: number;
357
+ balance: string;
406
358
  signature?: string | null;
407
359
  }
408
360
  export interface CFActiveUserRole {
@@ -473,6 +425,7 @@ export interface CFActiveOrder extends CFOrder {
473
425
  outlet?: CFActiveOutlet;
474
426
  isDeleted?: boolean;
475
427
  newOrder?: boolean;
428
+ currency?: string;
476
429
  station?: CFActiveStation;
477
430
  }
478
431
  export interface CFActiveCustomSales {
@@ -1,48 +1,4 @@
1
1
  export * from "./common-types";
2
- export var CurrencyCode;
3
- (function (CurrencyCode) {
4
- CurrencyCode["USD"] = "USD";
5
- CurrencyCode["EUR"] = "EUR";
6
- CurrencyCode["GBP"] = "GBP";
7
- CurrencyCode["CAD"] = "CAD";
8
- CurrencyCode["AUD"] = "AUD";
9
- CurrencyCode["NZD"] = "NZD";
10
- CurrencyCode["CHF"] = "CHF";
11
- CurrencyCode["CNY"] = "CNY";
12
- CurrencyCode["INR"] = "INR";
13
- CurrencyCode["MXN"] = "MXN";
14
- CurrencyCode["BRL"] = "BRL";
15
- CurrencyCode["ZAR"] = "ZAR";
16
- CurrencyCode["SGD"] = "SGD";
17
- CurrencyCode["HKD"] = "HKD";
18
- CurrencyCode["SEK"] = "SEK";
19
- CurrencyCode["NOK"] = "NOK";
20
- CurrencyCode["DKK"] = "DKK";
21
- CurrencyCode["PLN"] = "PLN";
22
- CurrencyCode["THB"] = "THB";
23
- CurrencyCode["MYR"] = "MYR";
24
- CurrencyCode["PHP"] = "PHP";
25
- CurrencyCode["IDR"] = "IDR";
26
- CurrencyCode["AED"] = "AED";
27
- CurrencyCode["SAR"] = "SAR";
28
- CurrencyCode["ILS"] = "ILS";
29
- CurrencyCode["TRY"] = "TRY";
30
- CurrencyCode["RUB"] = "RUB";
31
- CurrencyCode["JPY"] = "JPY";
32
- CurrencyCode["KRW"] = "KRW";
33
- CurrencyCode["VND"] = "VND";
34
- CurrencyCode["CLP"] = "CLP";
35
- CurrencyCode["ISK"] = "ISK";
36
- CurrencyCode["HUF"] = "HUF";
37
- CurrencyCode["TWD"] = "TWD";
38
- CurrencyCode["KWD"] = "KWD";
39
- CurrencyCode["BHD"] = "BHD";
40
- CurrencyCode["OMR"] = "OMR";
41
- CurrencyCode["JOD"] = "JOD";
42
- CurrencyCode["TND"] = "TND";
43
- CurrencyCode["LYD"] = "LYD";
44
- CurrencyCode["IQD"] = "IQD";
45
- })(CurrencyCode || (CurrencyCode = {}));
46
2
  // Enums
47
3
  export var CFProductType;
48
4
  (function (CFProductType) {
@@ -1,12 +1,10 @@
1
- import { CFProductType, CurrencyCode } from "../../CommonTypes";
1
+ import { CFProductType } from "../../CommonTypes";
2
2
  export const mockAddProduct = async (params) => {
3
3
  console.log("[Mock] addProduct called", params);
4
4
  const hasVariants = params.variants && params.variants.length > 0;
5
5
  return {
6
6
  product: {
7
7
  _id: "mock_product_" + Date.now(),
8
- currency: CurrencyCode.USD,
9
- minorUnits: 2,
10
8
  name: params.name,
11
9
  description: params.description,
12
10
  categories: params.categories || [],
@@ -16,15 +14,15 @@ export const mockAddProduct = async (params) => {
16
14
  sku: params.sku,
17
15
  productType: hasVariants ? CFProductType.VARIABLE : CFProductType.SIMPLE,
18
16
  attributes: [],
19
- minPrice: params.price || 0,
20
- maxPrice: params.price || 0,
17
+ minPrice: params.price || "0",
18
+ maxPrice: params.price || "0",
21
19
  variants: hasVariants
22
20
  ? params.variants.map((v, i) => ({ ...v, _id: `mock_variant_${Date.now()}_${i}` }))
23
21
  : [{
24
22
  _id: `mock_variant_${Date.now()}_0`,
25
23
  sku: params.sku || "",
26
- price: params.price || 0,
27
- salePrice: 0,
24
+ price: params.price || "0",
25
+ salePrice: "0",
28
26
  isOnSale: false,
29
27
  manageStock: params.manageStock || false,
30
28
  attributes: [],
@@ -7,9 +7,9 @@ export interface AddProductParams {
7
7
  images?: string[];
8
8
  status?: 'active' | 'inactive';
9
9
  /** For simple products: set price directly */
10
- price?: number;
10
+ price?: string;
11
11
  sku?: string;
12
- costPrice?: number;
12
+ costPrice?: string;
13
13
  manageStock?: boolean;
14
14
  /** For variable products: provide variants array */
15
15
  variants?: Omit<CFProductVariant, '_id'>[];
@@ -1,11 +1,9 @@
1
- import { CFProductType, CurrencyCode } from "../../CommonTypes";
1
+ import { CFProductType } from "../../CommonTypes";
2
2
  export const mockEditProduct = async (params) => {
3
3
  console.log("[Mock] editProduct called", params);
4
4
  return {
5
5
  product: {
6
6
  _id: params.productId,
7
- currency: CurrencyCode.USD,
8
- minorUnits: 2,
9
7
  name: params.changes.name || "Updated Product",
10
8
  description: params.changes.description,
11
9
  categories: params.changes.categories || [],
@@ -14,7 +14,7 @@ export const mockGetCurrentCompanyCustomExtensions = async (params) => {
14
14
  "https://example.com/images/loyalty-1.png",
15
15
  "https://example.com/images/loyalty-2.png"
16
16
  ],
17
- price: 2999,
17
+ price: "$29.99",
18
18
  website: "https://loyalty-extension.example.com",
19
19
  isDeleted: false,
20
20
  createdAt: "2024-01-01T10:00:00.000Z",
@@ -29,7 +29,7 @@ export const mockGetCurrentCompanyCustomExtensions = async (params) => {
29
29
  short_description: "Real-time inventory insights",
30
30
  long_description: "Get detailed insights into your inventory with real-time tracking, low stock alerts, and comprehensive reporting.",
31
31
  main_image: "https://example.com/images/inventory-extension.png",
32
- price: 4999,
32
+ price: "$49.99",
33
33
  isDeleted: false,
34
34
  createdAt: "2024-01-05T08:00:00.000Z",
35
35
  updatedAt: "2024-01-05T08:00:00.000Z",
@@ -14,7 +14,7 @@ export const mockGetCustomExtensions = async () => {
14
14
  "https://example.com/images/loyalty-1.png",
15
15
  "https://example.com/images/loyalty-2.png"
16
16
  ],
17
- price: 2999,
17
+ price: "$29.99",
18
18
  website: "https://loyalty-extension.example.com",
19
19
  isDeleted: false,
20
20
  createdAt: "2024-01-01T10:00:00.000Z",
@@ -29,7 +29,7 @@ export const mockGetCustomExtensions = async () => {
29
29
  short_description: "Real-time inventory insights",
30
30
  long_description: "Get detailed insights into your inventory with real-time tracking, low stock alerts, and comprehensive reporting.",
31
31
  main_image: "https://example.com/images/inventory-extension.png",
32
- price: 4999,
32
+ price: "$49.99",
33
33
  isDeleted: false,
34
34
  createdAt: "2024-01-05T08:00:00.000Z",
35
35
  updatedAt: "2024-01-05T08:00:00.000Z",
@@ -30,7 +30,7 @@ export const mockResumeParkedOrder = async (params) => {
30
30
  id: li.productId,
31
31
  name: li.name,
32
32
  quantity: li.quantity,
33
- price: li.price,
33
+ price: parseFloat(li.price),
34
34
  internalId: li.internalId || li.productId,
35
35
  variantId: li.variantId,
36
36
  sku: li.sku,
@@ -39,8 +39,8 @@ export const mockResumeParkedOrder = async (params) => {
39
39
  taxTableId: "",
40
40
  attributes: li.attributes
41
41
  }));
42
- MOCK_CART.subtotal = orderToResume.summary.subTotal;
43
- MOCK_CART.total = orderToResume.summary.total;
42
+ MOCK_CART.subtotal = parseFloat(orderToResume.summary.subTotal);
43
+ MOCK_CART.total = parseFloat(orderToResume.summary.total);
44
44
  MOCK_CART.amountToBeCharged = MOCK_CART.total;
45
45
  MOCK_CART.remainingBalance = MOCK_CART.total;
46
46
  // Remove from parked
@@ -9,7 +9,7 @@ export type CustomExtension = BaseEntity & {
9
9
  short_description?: string;
10
10
  long_description?: string;
11
11
  main_image?: string;
12
- price: number;
12
+ price: string;
13
13
  isDeleted: boolean;
14
14
  createdAt: string;
15
15
  updatedAt: string;
@@ -53,4 +53,4 @@ export declare const safeSerialize: <T>(data: T) => T;
53
53
  type MockEventCallback = (event: any) => void;
54
54
  export declare const mockPublishEvent: (topic: string, eventType: string, data: any) => void;
55
55
  export declare const mockSubscribeToTopic: (topic: string, callback: MockEventCallback) => void;
56
- export declare const createOrderFromCart: (paymentType: string, amount: number, processor?: string) => CFActiveOrder;
56
+ export declare const createOrderFromCart: (paymentType: string, amount: number | string, processor?: string) => CFActiveOrder;
@@ -2,7 +2,7 @@
2
2
  * Mock Database for Standalone/Demo Mode
3
3
  * Stores mock data that mimics the Render environment
4
4
  */
5
- import { CFProductType, CFUserTypes, CurrencyCode, } from "../CommonTypes";
5
+ import { CFProductType, CFUserTypes, } from "../CommonTypes";
6
6
  export * from './mocks';
7
7
  // Asset Imports - Using Remote URLs to avoid build complexity with asset copying
8
8
  const ASSETS_BASE_URL = "https://raw.githubusercontent.com/Final-Commerce/command-frame/refs/heads/main/src/demo/assets";
@@ -195,8 +195,6 @@ const createSimpleProduct = (id, name, price, image, categories, description) =>
195
195
  companyId: COMPANY_ID,
196
196
  externalId: `ext_${id}`,
197
197
  sku,
198
- currency: CurrencyCode.USD,
199
- minorUnits: 2,
200
198
  minPrice: price,
201
199
  maxPrice: price,
202
200
  status: "active",
@@ -204,6 +202,7 @@ const createSimpleProduct = (id, name, price, image, categories, description) =>
204
202
  taxTable: "tax_standard",
205
203
  description,
206
204
  images: [image],
205
+ // Render stores product categories as an array of category IDs
207
206
  categories: categories.map(c => c._id),
208
207
  attributes: [],
209
208
  variants: [
@@ -211,7 +210,7 @@ const createSimpleProduct = (id, name, price, image, categories, description) =>
211
210
  _id: `${id}_var_main`,
212
211
  sku,
213
212
  price,
214
- salePrice: 0,
213
+ salePrice: "0",
215
214
  isOnSale: false,
216
215
  manageStock: true,
217
216
  externalId: `ext_${id}_var`,
@@ -230,8 +229,6 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
230
229
  companyId: COMPANY_ID,
231
230
  externalId: `ext_${id}`,
232
231
  sku: skuBase,
233
- currency: CurrencyCode.USD,
234
- minorUnits: 2,
235
232
  minPrice: basePrice,
236
233
  maxPrice: largePrice,
237
234
  status: "active",
@@ -239,6 +236,7 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
239
236
  taxTable: "tax_standard",
240
237
  description,
241
238
  images: [image],
239
+ // Render stores product categories as an array of category IDs
242
240
  categories: categories.map(c => c._id),
243
241
  attributes: [{ name: "Size", values: ["Small", "Large"] }],
244
242
  variants: [
@@ -246,7 +244,7 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
246
244
  _id: `${id}_var_small`,
247
245
  sku: `${skuBase}-S`,
248
246
  price: basePrice,
249
- salePrice: 0,
247
+ salePrice: "0",
250
248
  isOnSale: false,
251
249
  manageStock: true,
252
250
  externalId: `ext_${id}_var_s`,
@@ -257,7 +255,7 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
257
255
  _id: `${id}_var_large`,
258
256
  sku: `${skuBase}-L`,
259
257
  price: largePrice,
260
- salePrice: 0,
258
+ salePrice: "0",
261
259
  isOnSale: false,
262
260
  manageStock: true,
263
261
  externalId: `ext_${id}_var_l`,
@@ -267,23 +265,23 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
267
265
  ]
268
266
  };
269
267
  };
270
- 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.");
271
- 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.");
272
- 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.");
273
- 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.");
274
- 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.");
275
- export const MOCK_PRODUCT_GARLIC = createSimpleProduct("prod_garlic", "Garlic Paste", 900, garlicImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Pure, intense garlic paste.");
276
- export const MOCK_PRODUCT_GINGER_LIME = createVariableProduct("prod_ginger_lime", "Ginger Lime Paste", 1300, 2000, gingerLimeImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Zesty and spicy, great for asian cuisine.");
277
- export const MOCK_PRODUCT_LEMON = createSimpleProduct("prod_lemon", "Lemon Paste", 1050, lemonImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Bright citrus flavor concentrate.");
278
- export const MOCK_PRODUCT_RED_PEPPER = createVariableProduct("prod_red_pepper", "Red Pepper Paste", 1250, 1900, redPepperImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Roasted red peppers with a hint of spice.");
279
- export const MOCK_PRODUCT_ROASTED_TOMATO = createVariableProduct("prod_roasted_tomato", "Roasted Tomato Paste", 1150, 1850, roastedTomatoImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Deep, umami-rich tomato flavor.");
280
- export const MOCK_PRODUCT_MINT_LEMON = createSimpleProduct("prod_mint_lemon", "Mint Lemon Paste", 1200, lemonImg, // Reusing lemon image for now
268
+ export const MOCK_PRODUCT_BASIL_ALMOND = createSimpleProduct("prod_basil_almond", "Basil Almond Paste", "12.00", basilAlmondImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], "A rich blend of fresh basil and roasted almonds.");
269
+ export const MOCK_PRODUCT_BEER = createVariableProduct("prod_beer", "Beer Paste", "15.00", "25.00", beerImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY], "Unique paste infused with dark lager.");
270
+ export const MOCK_PRODUCT_BEET = createSimpleProduct("prod_beet", "Beet Paste", "10.00", beetImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Earthy and sweet beet paste, perfect for salads.");
271
+ export const MOCK_PRODUCT_CARAMELIZED = createVariableProduct("prod_caramelized", "Caramelized Paste", "14.00", "22.00", caramelizedImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], "Slow-cooked caramelized onion paste.");
272
+ export const MOCK_PRODUCT_GARLIC_ONION = createVariableProduct("prod_garlic_onion", "Garlic Onion Paste", "11.00", "18.00", garlicOnionImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Classic savory base for any dish.");
273
+ export const MOCK_PRODUCT_GARLIC = createSimpleProduct("prod_garlic", "Garlic Paste", "9.00", garlicImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Pure, intense garlic paste.");
274
+ export const MOCK_PRODUCT_GINGER_LIME = createVariableProduct("prod_ginger_lime", "Ginger Lime Paste", "13.00", "20.00", gingerLimeImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Zesty and spicy, great for asian cuisine.");
275
+ export const MOCK_PRODUCT_LEMON = createSimpleProduct("prod_lemon", "Lemon Paste", "10.50", lemonImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Bright citrus flavor concentrate.");
276
+ export const MOCK_PRODUCT_RED_PEPPER = createVariableProduct("prod_red_pepper", "Red Pepper Paste", "12.50", "19.00", redPepperImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Roasted red peppers with a hint of spice.");
277
+ export const MOCK_PRODUCT_ROASTED_TOMATO = createVariableProduct("prod_roasted_tomato", "Roasted Tomato Paste", "11.50", "18.50", roastedTomatoImg, [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN], "Deep, umami-rich tomato flavor.");
278
+ export const MOCK_PRODUCT_MINT_LEMON = createSimpleProduct("prod_mint_lemon", "Mint Lemon Paste", "12.00", lemonImg, // Reusing lemon image for now
281
279
  [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], "Refreshing mint and lemon blend.");
282
- export const MOCK_PRODUCT_CHILI_GARLIC = createVariableProduct("prod_chili_garlic", "Chili Garlic Paste", 1050, 1650, redPepperImg, // Reusing red pepper image
280
+ export const MOCK_PRODUCT_CHILI_GARLIC = createVariableProduct("prod_chili_garlic", "Chili Garlic Paste", "10.50", "16.50", redPepperImg, // Reusing red pepper image
283
281
  [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Spicy garlic paste with chili flakes.");
284
- export const MOCK_PRODUCT_HABANERO = createSimpleProduct("prod_habanero", "Habanero Paste", 1400, redPepperImg, // Reusing red pepper image
282
+ export const MOCK_PRODUCT_HABANERO = createSimpleProduct("prod_habanero", "Habanero Paste", "14.00", redPepperImg, // Reusing red pepper image
285
283
  [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Extremely spicy habanero concentrate.");
286
- export const MOCK_PRODUCT_BLACK_GARLIC = createSimpleProduct("prod_black_garlic", "Black Garlic Paste", 1800, garlicImg, // Reusing garlic image
284
+ export const MOCK_PRODUCT_BLACK_GARLIC = createSimpleProduct("prod_black_garlic", "Black Garlic Paste", "18.00", garlicImg, // Reusing garlic image
287
285
  [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], "Fermented black garlic paste, sweet and savory.");
288
286
  // --- ORDERS ---
289
287
  // Helper to create line item
@@ -297,12 +295,12 @@ const createLineItem = (product, variantIndex = 0, quantity = 1) => {
297
295
  price: variant.price,
298
296
  taxes: [],
299
297
  discount: {
300
- itemDiscount: { percentage: 0, amount: 0 },
301
- cartDiscount: { percentage: 0, amount: 0 }
298
+ itemDiscount: { percentage: 0, amount: "0" },
299
+ cartDiscount: { percentage: 0, amount: "0" }
302
300
  },
303
- fee: { itemFee: { percentage: 0, amount: 0, tax: 0, taxTableId: "" } },
304
- totalTax: 0,
305
- total: variant.price * quantity,
301
+ fee: { itemFee: { percentage: 0, amount: "0", tax: "0", taxTableId: "" } },
302
+ totalTax: "0",
303
+ total: (parseFloat(variant.price) * quantity).toFixed(2),
306
304
  metadata: [],
307
305
  image: product.images?.[0] || "",
308
306
  sku: variant.sku,
@@ -312,19 +310,17 @@ const createLineItem = (product, variantIndex = 0, quantity = 1) => {
312
310
  };
313
311
  export const MOCK_ORDER_1 = {
314
312
  _id: "order_1001",
315
- currency: CurrencyCode.USD,
316
- minorUnits: 2,
317
313
  receiptId: "1001-0001",
318
314
  companyId: COMPANY_ID,
319
315
  externalId: null,
320
316
  status: "completed",
321
317
  customer: MOCK_CUSTOMER_1,
322
318
  summary: {
323
- total: 2100,
324
- subTotal: 2100,
325
- discountTotal: 0,
326
- shippingTotal: 0,
327
- totalTaxes: 0,
319
+ total: "21.00",
320
+ subTotal: "21.00",
321
+ discountTotal: "0",
322
+ shippingTotal: "0",
323
+ totalTaxes: "0",
328
324
  taxes: [],
329
325
  isTaxInclusive: false
330
326
  },
@@ -334,7 +330,7 @@ export const MOCK_ORDER_1 = {
334
330
  {
335
331
  transactionId: "trans_cash_1",
336
332
  paymentType: "cash",
337
- amount: 2100,
333
+ amount: "21.00",
338
334
  timestamp: new Date().toISOString(),
339
335
  processor: "cash"
340
336
  }
@@ -350,11 +346,11 @@ export const MOCK_ORDER_1 = {
350
346
  billing: MOCK_CUSTOMER_1.billing || null,
351
347
  shipping: null,
352
348
  lineItems: [
353
- createLineItem(MOCK_PRODUCT_GARLIC, 0, 1),
354
- createLineItem(MOCK_PRODUCT_BASIL_ALMOND, 0, 1)
349
+ createLineItem(MOCK_PRODUCT_GARLIC, 0, 1), // 9.00
350
+ createLineItem(MOCK_PRODUCT_BASIL_ALMOND, 0, 1) // 12.00
355
351
  ],
356
352
  customSales: [],
357
- balance: 0,
353
+ balance: "0",
358
354
  user: MOCK_USER_LUIGI,
359
355
  outlet: MOCK_OUTLET_MAIN,
360
356
  station: MOCK_STATION_1,
@@ -362,19 +358,17 @@ export const MOCK_ORDER_1 = {
362
358
  };
363
359
  export const MOCK_ORDER_2 = {
364
360
  _id: "order_1002",
365
- currency: CurrencyCode.USD,
366
- minorUnits: 2,
367
361
  receiptId: "1001-0002",
368
362
  companyId: COMPANY_ID,
369
363
  externalId: null,
370
364
  status: "completed",
371
365
  customer: MOCK_CUSTOMER_2,
372
366
  summary: {
373
- total: 3000,
374
- subTotal: 3000,
375
- discountTotal: 0,
376
- shippingTotal: 0,
377
- totalTaxes: 0,
367
+ total: "30.00",
368
+ subTotal: "30.00",
369
+ discountTotal: "0",
370
+ shippingTotal: "0",
371
+ totalTaxes: "0",
378
372
  taxes: [],
379
373
  isTaxInclusive: false
380
374
  },
@@ -384,7 +378,7 @@ export const MOCK_ORDER_2 = {
384
378
  {
385
379
  transactionId: "trans_card_1",
386
380
  paymentType: "credit_card",
387
- amount: 3000,
381
+ amount: "30.00",
388
382
  timestamp: new Date(Date.now() - 3600000).toISOString(),
389
383
  processor: "stripe"
390
384
  }
@@ -400,10 +394,10 @@ export const MOCK_ORDER_2 = {
400
394
  billing: null,
401
395
  shipping: null,
402
396
  lineItems: [
403
- createLineItem(MOCK_PRODUCT_BEER, 0, 2)
397
+ createLineItem(MOCK_PRODUCT_BEER, 0, 2) // 15.00 * 2 = 30.00
404
398
  ],
405
399
  customSales: [],
406
- balance: 0,
400
+ balance: "0",
407
401
  user: MOCK_USER_MARIO,
408
402
  outlet: MOCK_OUTLET_MAIN,
409
403
  station: MOCK_STATION_2,
@@ -505,53 +499,53 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
505
499
  const receiptId = `receipt_${Date.now()}`;
506
500
  // Map cart products to line items
507
501
  const lineItems = MOCK_CART.products.map(p => {
502
+ // Find original product to get attributes/variants if needed
503
+ // For simplicity, we use what's in cart
508
504
  return {
509
505
  productId: p.id,
510
506
  variantId: p.variantId,
511
507
  name: p.name,
512
508
  quantity: p.quantity,
513
- price: p.price,
509
+ price: String(p.price),
514
510
  taxes: [],
515
511
  discount: {
516
- itemDiscount: { percentage: 0, amount: 0, const: "0" },
517
- cartDiscount: { percentage: 0, amount: 0, const: "0" }
512
+ itemDiscount: { percentage: 0, amount: "0", const: "0" },
513
+ cartDiscount: { percentage: 0, amount: "0", const: "0" }
518
514
  },
519
- fee: { itemFee: { percentage: 0, amount: 0, tax: 0, taxTableId: "" } },
520
- totalTax: 0,
521
- total: p.price * p.quantity,
515
+ fee: { itemFee: { percentage: 0, amount: "0", tax: "0", taxTableId: "" } },
516
+ totalTax: "0",
517
+ total: (p.price * p.quantity).toFixed(2),
522
518
  metadata: [],
523
519
  image: p.images?.[0] || "",
524
520
  sku: p.sku || "",
525
- stock: 100,
521
+ stock: 100, // Mock stock
526
522
  attributes: p.attributes || ""
527
523
  };
528
524
  });
529
- const totalNum = MOCK_CART.total;
525
+ const totalStr = String(MOCK_CART.total.toFixed(2));
530
526
  const newOrder = {
531
527
  _id: orderId,
532
- currency: CurrencyCode.USD,
533
- minorUnits: 2,
534
528
  receiptId,
535
529
  companyId: COMPANY_ID,
536
530
  externalId: null,
537
531
  status: "completed",
538
532
  customer: MOCK_CART.customer ? MOCK_CART.customer : null,
539
533
  summary: {
540
- total: totalNum,
541
- subTotal: totalNum,
542
- discountTotal: 0,
543
- shippingTotal: 0,
544
- totalTaxes: 0,
534
+ total: totalStr,
535
+ subTotal: totalStr,
536
+ discountTotal: "0",
537
+ shippingTotal: "0",
538
+ totalTaxes: "0",
545
539
  taxes: [],
546
540
  isTaxInclusive: false
547
541
  },
548
- cartDiscount: MOCK_CART.discount ? { label: MOCK_CART.discount.label || "Discount", amount: 0, percentage: MOCK_CART.discount.value } : null,
542
+ cartDiscount: MOCK_CART.discount ? { label: MOCK_CART.discount.label || "Discount", amount: "0", percentage: MOCK_CART.discount.value } : null,
549
543
  cartFees: [],
550
544
  paymentMethods: [
551
545
  {
552
546
  transactionId: `trans_${Date.now()}`,
553
547
  paymentType,
554
- amount,
548
+ amount: String(amount),
555
549
  timestamp: new Date().toISOString(),
556
550
  processor
557
551
  }
@@ -568,7 +562,7 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
568
562
  shipping: MOCK_CART.customer?.shipping || null,
569
563
  lineItems,
570
564
  customSales: [],
571
- balance: 0,
565
+ balance: "0",
572
566
  user: MOCK_USER_LUIGI,
573
567
  outlet: MOCK_OUTLET_MAIN,
574
568
  station: MOCK_STATION_1,
@@ -235,7 +235,7 @@ export const MOCK_CUSTOM_EXTENSIONS = [
235
235
  "https://example.com/images/loyalty-1.png",
236
236
  "https://example.com/images/loyalty-2.png"
237
237
  ],
238
- price: 2999,
238
+ price: "$29.99",
239
239
  website: "https://loyalty-extension.example.com",
240
240
  isDeleted: false,
241
241
  createdAt: "2024-01-01T10:00:00.000Z",
@@ -250,7 +250,7 @@ export const MOCK_CUSTOM_EXTENSIONS = [
250
250
  short_description: "Real-time inventory insights",
251
251
  long_description: "Get detailed insights into your inventory with real-time tracking, low stock alerts, and comprehensive reporting.",
252
252
  main_image: "https://example.com/images/inventory-extension.png",
253
- price: 4999,
253
+ price: "$49.99",
254
254
  isDeleted: false,
255
255
  createdAt: "2024-01-05T08:00:00.000Z",
256
256
  updatedAt: "2024-01-05T08:00:00.000Z",
@@ -264,7 +264,7 @@ export const MOCK_CUSTOM_EXTENSIONS = [
264
264
  short_description: "Automated email marketing",
265
265
  long_description: "Create and manage email campaigns, automate customer communications, and track engagement metrics.",
266
266
  main_image: "https://example.com/images/email-extension.png",
267
- price: 3999,
267
+ price: "$39.99",
268
268
  isDeleted: false,
269
269
  createdAt: "2024-01-08T12:00:00.000Z",
270
270
  updatedAt: "2024-01-08T12:00:00.000Z",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.41-develop",
3
+ "version": "0.1.42",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -44,6 +44,5 @@
44
44
  "@typescript-eslint/parser": "^8.48.0",
45
45
  "prettier": "^3.7.1",
46
46
  "typescript": "^5.0.0"
47
- },
48
- "dependencies": {}
47
+ }
49
48
  }