@final-commerce/command-frame 0.1.44 → 0.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,47 @@
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
+ }
2
45
  export declare enum CFProductType {
3
46
  SIMPLE = "simple",
4
47
  VARIABLE = "variable"
@@ -51,7 +94,7 @@ export interface CFTax {
51
94
  id: string;
52
95
  name: string;
53
96
  percentage: number;
54
- amount: string;
97
+ amount: number;
55
98
  taxTableName: string;
56
99
  taxTableId: string;
57
100
  }
@@ -82,11 +125,11 @@ export interface CFCategory {
82
125
  }
83
126
  export interface CFProductVariant {
84
127
  sku: string;
85
- price: string;
86
- salePrice: string;
128
+ price: number;
129
+ salePrice: number;
87
130
  isOnSale: boolean;
88
131
  barcode?: string;
89
- costPrice?: string;
132
+ costPrice?: number;
90
133
  manageStock: boolean;
91
134
  externalId?: string;
92
135
  inventory?: CFInventory[];
@@ -121,8 +164,10 @@ export interface CFProduct {
121
164
  sku?: string;
122
165
  productType: CFProductType;
123
166
  variants: CFProductVariant[];
124
- minPrice?: string;
125
- maxPrice?: string;
167
+ currency: CurrencyCode;
168
+ minorUnits: number;
169
+ minPrice?: number;
170
+ maxPrice?: number;
126
171
  status?: string;
127
172
  isDeleted?: boolean;
128
173
  }
@@ -172,15 +217,15 @@ export interface CFActiveCustomer extends CFCustomer {
172
217
  id?: string;
173
218
  }
174
219
  export interface CFTip {
175
- amount: string;
220
+ amount: number;
176
221
  percentage: number;
177
222
  }
178
223
  export interface CFSummary {
179
- discountTotal: string;
180
- shippingTotal?: string | null;
181
- total: string;
182
- totalTaxes: string;
183
- subTotal: string;
224
+ discountTotal: number;
225
+ shippingTotal?: number | null;
226
+ total: number;
227
+ totalTaxes: number;
228
+ subTotal: number;
184
229
  taxes: CFTax[];
185
230
  tip?: CFTip | null;
186
231
  isTaxInclusive: boolean;
@@ -189,25 +234,25 @@ export interface CFSummary {
189
234
  }
190
235
  export interface CFCartDiscountItem {
191
236
  label: string;
192
- amount: string;
237
+ amount: number;
193
238
  percentage: number;
194
239
  }
195
240
  export interface CFCartFeeItem {
196
241
  id: string;
197
242
  label: string;
198
- amount: string;
243
+ amount: number;
199
244
  percentage: number;
200
245
  taxTableId?: string;
201
- tax?: string;
246
+ tax?: number;
202
247
  taxName: string;
203
248
  }
204
249
  export interface CFTipPayment {
205
- amount: string;
250
+ amount: number;
206
251
  tipTo: string;
207
252
  percentage: number;
208
253
  }
209
254
  export interface CFRefundedTipPayment {
210
- amount: string;
255
+ amount: number;
211
256
  percentage: number;
212
257
  transactionId: string;
213
258
  tipTo: string;
@@ -215,11 +260,11 @@ export interface CFRefundedTipPayment {
215
260
  export interface CFPaymentMethod {
216
261
  transactionId: string;
217
262
  paymentType: string;
218
- amount: string;
263
+ amount: number;
219
264
  timestamp: string;
220
265
  processor: string;
221
266
  saleId?: string;
222
- change?: string | null;
267
+ change?: number | null;
223
268
  tip?: CFTipPayment | null;
224
269
  cashRounding?: number;
225
270
  emv?: string | null;
@@ -235,13 +280,13 @@ export interface CFPosDataItem {
235
280
  }
236
281
  export interface CFDiscountDetail {
237
282
  percentage: number;
238
- amount: string;
283
+ amount: number;
239
284
  label?: string;
240
285
  }
241
286
  export interface CFFeeDetail {
242
287
  percentage: number;
243
- amount: string;
244
- tax: string;
288
+ amount: number;
289
+ tax: number;
245
290
  taxTableId: string;
246
291
  label?: string;
247
292
  }
@@ -260,12 +305,12 @@ export interface CFLineItem {
260
305
  internalId?: string;
261
306
  name: string;
262
307
  quantity: number;
263
- price: string;
308
+ price: number;
264
309
  taxes: CFTax[];
265
310
  discount: CFDiscountLineItem;
266
311
  fee: CFFeeLineItem;
267
- totalTax: string;
268
- total: string;
312
+ totalTax: number;
313
+ total: number;
269
314
  metadata: CFMetadataItem[];
270
315
  image: string;
271
316
  sku: string;
@@ -279,11 +324,11 @@ export interface CFLineItem {
279
324
  export interface CFCustomSale {
280
325
  customSaleId: string;
281
326
  name: string;
282
- price: string;
327
+ price: number;
283
328
  quantity: number;
284
329
  applyTaxes: boolean;
285
- total: string;
286
- totalTax: string;
330
+ total: number;
331
+ totalTax: number;
287
332
  taxes: CFTax[];
288
333
  discount: {
289
334
  cartDiscount: CFDiscountDetail;
@@ -300,11 +345,11 @@ export interface CFRefundedLineItem {
300
345
  internalId?: string;
301
346
  name: string;
302
347
  quantity: number;
303
- price: string;
348
+ price: number;
304
349
  taxes: CFTax[];
305
350
  discount: CFDiscountLineItem;
306
- totalTax: string;
307
- total: string;
351
+ totalTax: number;
352
+ total: number;
308
353
  image: string;
309
354
  sku: string;
310
355
  note?: string;
@@ -323,12 +368,15 @@ export interface CFRefundItem {
323
368
  timestamp: string | undefined;
324
369
  summary?: CFSummary;
325
370
  refundPayment: CFPaymentMethod[];
326
- balance?: string;
371
+ balance?: number;
327
372
  receiptId?: string;
328
- currency?: string;
373
+ currency: CurrencyCode;
374
+ minorUnits: number;
329
375
  }
330
376
  export interface CFOrder {
331
377
  _id: string;
378
+ currency: CurrencyCode;
379
+ minorUnits: number;
332
380
  receiptId?: string;
333
381
  companyId: string;
334
382
  externalId: string | null;
@@ -353,7 +401,7 @@ export interface CFOrder {
353
401
  /** Gift card / liability purchase lines (not product revenue) */
354
402
  nonRevenueItems?: CFNonRevenueItem[];
355
403
  refund?: CFRefundItem[];
356
- balance: string;
404
+ balance: number;
357
405
  signature?: string | null;
358
406
  }
359
407
  export interface CFActiveUserRole {
@@ -424,7 +472,6 @@ export interface CFActiveOrder extends CFOrder {
424
472
  outlet?: CFActiveOutlet;
425
473
  isDeleted?: boolean;
426
474
  newOrder?: boolean;
427
- currency?: string;
428
475
  station?: CFActiveStation;
429
476
  }
430
477
  export interface CFActiveCustomSales {
@@ -1,4 +1,48 @@
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 = {}));
2
46
  // Enums
3
47
  export var CFProductType;
4
48
  (function (CFProductType) {
@@ -1,10 +1,12 @@
1
- import { CFProductType } from "../../CommonTypes";
1
+ import { CFProductType, CurrencyCode } 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,
8
10
  name: params.name,
9
11
  description: params.description,
10
12
  categories: params.categories || [],
@@ -14,15 +16,15 @@ export const mockAddProduct = async (params) => {
14
16
  sku: params.sku,
15
17
  productType: hasVariants ? CFProductType.VARIABLE : CFProductType.SIMPLE,
16
18
  attributes: [],
17
- minPrice: params.price || "0",
18
- maxPrice: params.price || "0",
19
+ minPrice: params.price || 0,
20
+ maxPrice: params.price || 0,
19
21
  variants: hasVariants
20
22
  ? params.variants.map((v, i) => ({ ...v, _id: `mock_variant_${Date.now()}_${i}` }))
21
23
  : [{
22
24
  _id: `mock_variant_${Date.now()}_0`,
23
25
  sku: params.sku || "",
24
- price: params.price || "0",
25
- salePrice: "0",
26
+ price: params.price || 0,
27
+ salePrice: 0,
26
28
  isOnSale: false,
27
29
  manageStock: params.manageStock || false,
28
30
  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?: string;
10
+ price?: number;
11
11
  sku?: string;
12
- costPrice?: string;
12
+ costPrice?: number;
13
13
  manageStock?: boolean;
14
14
  /** For variable products: provide variants array */
15
15
  variants?: Omit<CFProductVariant, '_id'>[];
@@ -1,9 +1,11 @@
1
- import { CFProductType } from "../../CommonTypes";
1
+ import { CFProductType, CurrencyCode } 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,
7
9
  name: params.changes.name || "Updated Product",
8
10
  description: params.changes.description,
9
11
  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: "$29.99",
17
+ price: 2999,
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: "$49.99",
32
+ price: 4999,
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: "$29.99",
17
+ price: 2999,
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: "$49.99",
32
+ price: 4999,
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: parseFloat(li.price),
33
+ price: 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 = parseFloat(orderToResume.summary.subTotal);
43
- MOCK_CART.total = parseFloat(orderToResume.summary.total);
42
+ MOCK_CART.subtotal = orderToResume.summary.subTotal;
43
+ MOCK_CART.total = 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: string;
12
+ price: number;
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 | string, processor?: string) => CFActiveOrder;
56
+ export declare const createOrderFromCart: (paymentType: string, amount: number, 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, } from "../CommonTypes";
5
+ import { CFProductType, CFUserTypes, CurrencyCode, } 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,6 +195,8 @@ 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,
198
200
  minPrice: price,
199
201
  maxPrice: price,
200
202
  status: "active",
@@ -202,7 +204,6 @@ const createSimpleProduct = (id, name, price, image, categories, description) =>
202
204
  taxTable: "tax_standard",
203
205
  description,
204
206
  images: [image],
205
- // Render stores product categories as an array of category IDs
206
207
  categories: categories.map(c => c._id),
207
208
  attributes: [],
208
209
  variants: [
@@ -210,7 +211,7 @@ const createSimpleProduct = (id, name, price, image, categories, description) =>
210
211
  _id: `${id}_var_main`,
211
212
  sku,
212
213
  price,
213
- salePrice: "0",
214
+ salePrice: 0,
214
215
  isOnSale: false,
215
216
  manageStock: true,
216
217
  externalId: `ext_${id}_var`,
@@ -229,6 +230,8 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
229
230
  companyId: COMPANY_ID,
230
231
  externalId: `ext_${id}`,
231
232
  sku: skuBase,
233
+ currency: CurrencyCode.USD,
234
+ minorUnits: 2,
232
235
  minPrice: basePrice,
233
236
  maxPrice: largePrice,
234
237
  status: "active",
@@ -236,7 +239,6 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
236
239
  taxTable: "tax_standard",
237
240
  description,
238
241
  images: [image],
239
- // Render stores product categories as an array of category IDs
240
242
  categories: categories.map(c => c._id),
241
243
  attributes: [{ name: "Size", values: ["Small", "Large"] }],
242
244
  variants: [
@@ -244,7 +246,7 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
244
246
  _id: `${id}_var_small`,
245
247
  sku: `${skuBase}-S`,
246
248
  price: basePrice,
247
- salePrice: "0",
249
+ salePrice: 0,
248
250
  isOnSale: false,
249
251
  manageStock: true,
250
252
  externalId: `ext_${id}_var_s`,
@@ -255,7 +257,7 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
255
257
  _id: `${id}_var_large`,
256
258
  sku: `${skuBase}-L`,
257
259
  price: largePrice,
258
- salePrice: "0",
260
+ salePrice: 0,
259
261
  isOnSale: false,
260
262
  manageStock: true,
261
263
  externalId: `ext_${id}_var_l`,
@@ -265,23 +267,23 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
265
267
  ]
266
268
  };
267
269
  };
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
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
279
281
  [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], "Refreshing mint and lemon blend.");
280
- export const MOCK_PRODUCT_CHILI_GARLIC = createVariableProduct("prod_chili_garlic", "Chili Garlic Paste", "10.50", "16.50", redPepperImg, // Reusing red pepper image
282
+ export const MOCK_PRODUCT_CHILI_GARLIC = createVariableProduct("prod_chili_garlic", "Chili Garlic Paste", 1050, 1650, redPepperImg, // Reusing red pepper image
281
283
  [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Spicy garlic paste with chili flakes.");
282
- export const MOCK_PRODUCT_HABANERO = createSimpleProduct("prod_habanero", "Habanero Paste", "14.00", redPepperImg, // Reusing red pepper image
284
+ export const MOCK_PRODUCT_HABANERO = createSimpleProduct("prod_habanero", "Habanero Paste", 1400, redPepperImg, // Reusing red pepper image
283
285
  [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPICY, MOCK_CATEGORY_VEGAN], "Extremely spicy habanero concentrate.");
284
- export const MOCK_PRODUCT_BLACK_GARLIC = createSimpleProduct("prod_black_garlic", "Black Garlic Paste", "18.00", garlicImg, // Reusing garlic image
286
+ export const MOCK_PRODUCT_BLACK_GARLIC = createSimpleProduct("prod_black_garlic", "Black Garlic Paste", 1800, garlicImg, // Reusing garlic image
285
287
  [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_VEGAN], "Fermented black garlic paste, sweet and savory.");
286
288
  // --- ORDERS ---
287
289
  // Helper to create line item
@@ -295,12 +297,12 @@ const createLineItem = (product, variantIndex = 0, quantity = 1) => {
295
297
  price: variant.price,
296
298
  taxes: [],
297
299
  discount: {
298
- itemDiscount: { percentage: 0, amount: "0" },
299
- cartDiscount: { percentage: 0, amount: "0" }
300
+ itemDiscount: { percentage: 0, amount: 0 },
301
+ cartDiscount: { percentage: 0, amount: 0 }
300
302
  },
301
- fee: { itemFee: { percentage: 0, amount: "0", tax: "0", taxTableId: "" } },
302
- totalTax: "0",
303
- total: (parseFloat(variant.price) * quantity).toFixed(2),
303
+ fee: { itemFee: { percentage: 0, amount: 0, tax: 0, taxTableId: "" } },
304
+ totalTax: 0,
305
+ total: variant.price * quantity,
304
306
  metadata: [],
305
307
  image: product.images?.[0] || "",
306
308
  sku: variant.sku,
@@ -310,17 +312,19 @@ const createLineItem = (product, variantIndex = 0, quantity = 1) => {
310
312
  };
311
313
  export const MOCK_ORDER_1 = {
312
314
  _id: "order_1001",
315
+ currency: CurrencyCode.USD,
316
+ minorUnits: 2,
313
317
  receiptId: "1001-0001",
314
318
  companyId: COMPANY_ID,
315
319
  externalId: null,
316
320
  status: "completed",
317
321
  customer: MOCK_CUSTOMER_1,
318
322
  summary: {
319
- total: "21.00",
320
- subTotal: "21.00",
321
- discountTotal: "0",
322
- shippingTotal: "0",
323
- totalTaxes: "0",
323
+ total: 2100,
324
+ subTotal: 2100,
325
+ discountTotal: 0,
326
+ shippingTotal: 0,
327
+ totalTaxes: 0,
324
328
  taxes: [],
325
329
  isTaxInclusive: false
326
330
  },
@@ -330,7 +334,7 @@ export const MOCK_ORDER_1 = {
330
334
  {
331
335
  transactionId: "trans_cash_1",
332
336
  paymentType: "cash",
333
- amount: "21.00",
337
+ amount: 2100,
334
338
  timestamp: new Date().toISOString(),
335
339
  processor: "cash"
336
340
  }
@@ -346,11 +350,11 @@ export const MOCK_ORDER_1 = {
346
350
  billing: MOCK_CUSTOMER_1.billing || null,
347
351
  shipping: null,
348
352
  lineItems: [
349
- createLineItem(MOCK_PRODUCT_GARLIC, 0, 1), // 9.00
350
- createLineItem(MOCK_PRODUCT_BASIL_ALMOND, 0, 1) // 12.00
353
+ createLineItem(MOCK_PRODUCT_GARLIC, 0, 1),
354
+ createLineItem(MOCK_PRODUCT_BASIL_ALMOND, 0, 1)
351
355
  ],
352
356
  customSales: [],
353
- balance: "0",
357
+ balance: 0,
354
358
  user: MOCK_USER_LUIGI,
355
359
  outlet: MOCK_OUTLET_MAIN,
356
360
  station: MOCK_STATION_1,
@@ -358,17 +362,19 @@ export const MOCK_ORDER_1 = {
358
362
  };
359
363
  export const MOCK_ORDER_2 = {
360
364
  _id: "order_1002",
365
+ currency: CurrencyCode.USD,
366
+ minorUnits: 2,
361
367
  receiptId: "1001-0002",
362
368
  companyId: COMPANY_ID,
363
369
  externalId: null,
364
370
  status: "completed",
365
371
  customer: MOCK_CUSTOMER_2,
366
372
  summary: {
367
- total: "30.00",
368
- subTotal: "30.00",
369
- discountTotal: "0",
370
- shippingTotal: "0",
371
- totalTaxes: "0",
373
+ total: 3000,
374
+ subTotal: 3000,
375
+ discountTotal: 0,
376
+ shippingTotal: 0,
377
+ totalTaxes: 0,
372
378
  taxes: [],
373
379
  isTaxInclusive: false
374
380
  },
@@ -378,7 +384,7 @@ export const MOCK_ORDER_2 = {
378
384
  {
379
385
  transactionId: "trans_card_1",
380
386
  paymentType: "credit_card",
381
- amount: "30.00",
387
+ amount: 3000,
382
388
  timestamp: new Date(Date.now() - 3600000).toISOString(),
383
389
  processor: "stripe"
384
390
  }
@@ -394,10 +400,10 @@ export const MOCK_ORDER_2 = {
394
400
  billing: null,
395
401
  shipping: null,
396
402
  lineItems: [
397
- createLineItem(MOCK_PRODUCT_BEER, 0, 2) // 15.00 * 2 = 30.00
403
+ createLineItem(MOCK_PRODUCT_BEER, 0, 2)
398
404
  ],
399
405
  customSales: [],
400
- balance: "0",
406
+ balance: 0,
401
407
  user: MOCK_USER_MARIO,
402
408
  outlet: MOCK_OUTLET_MAIN,
403
409
  station: MOCK_STATION_2,
@@ -501,53 +507,53 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
501
507
  const receiptId = `receipt_${Date.now()}`;
502
508
  // Map cart products to line items
503
509
  const lineItems = MOCK_CART.products.map(p => {
504
- // Find original product to get attributes/variants if needed
505
- // For simplicity, we use what's in cart
506
510
  return {
507
511
  productId: p.id,
508
512
  variantId: p.variantId,
509
513
  name: p.name,
510
514
  quantity: p.quantity,
511
- price: String(p.price),
515
+ price: p.price,
512
516
  taxes: [],
513
517
  discount: {
514
- itemDiscount: { percentage: 0, amount: "0", const: "0" },
515
- cartDiscount: { percentage: 0, amount: "0", const: "0" }
518
+ itemDiscount: { percentage: 0, amount: 0, const: "0" },
519
+ cartDiscount: { percentage: 0, amount: 0, const: "0" }
516
520
  },
517
- fee: { itemFee: { percentage: 0, amount: "0", tax: "0", taxTableId: "" } },
518
- totalTax: "0",
519
- total: (p.price * p.quantity).toFixed(2),
521
+ fee: { itemFee: { percentage: 0, amount: 0, tax: 0, taxTableId: "" } },
522
+ totalTax: 0,
523
+ total: p.price * p.quantity,
520
524
  metadata: [],
521
525
  image: p.images?.[0] || "",
522
526
  sku: p.sku || "",
523
- stock: 100, // Mock stock
527
+ stock: 100,
524
528
  attributes: p.attributes || ""
525
529
  };
526
530
  });
527
- const totalStr = String(MOCK_CART.total.toFixed(2));
531
+ const totalNum = MOCK_CART.total;
528
532
  const newOrder = {
529
533
  _id: orderId,
534
+ currency: CurrencyCode.USD,
535
+ minorUnits: 2,
530
536
  receiptId,
531
537
  companyId: COMPANY_ID,
532
538
  externalId: null,
533
539
  status: "completed",
534
540
  customer: MOCK_CART.customer ? MOCK_CART.customer : null,
535
541
  summary: {
536
- total: totalStr,
537
- subTotal: totalStr,
538
- discountTotal: "0",
539
- shippingTotal: "0",
540
- totalTaxes: "0",
542
+ total: totalNum,
543
+ subTotal: totalNum,
544
+ discountTotal: 0,
545
+ shippingTotal: 0,
546
+ totalTaxes: 0,
541
547
  taxes: [],
542
548
  isTaxInclusive: false
543
549
  },
544
- cartDiscount: MOCK_CART.discount ? { label: MOCK_CART.discount.label || "Discount", amount: "0", percentage: MOCK_CART.discount.value } : null,
550
+ cartDiscount: MOCK_CART.discount ? { label: MOCK_CART.discount.label || "Discount", amount: 0, percentage: MOCK_CART.discount.value } : null,
545
551
  cartFees: [],
546
552
  paymentMethods: [
547
553
  {
548
554
  transactionId: `trans_${Date.now()}`,
549
555
  paymentType,
550
- amount: String(amount),
556
+ amount,
551
557
  timestamp: new Date().toISOString(),
552
558
  processor
553
559
  }
@@ -564,7 +570,7 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
564
570
  shipping: MOCK_CART.customer?.shipping || null,
565
571
  lineItems,
566
572
  customSales: [],
567
- balance: "0",
573
+ balance: 0,
568
574
  user: MOCK_USER_LUIGI,
569
575
  outlet: MOCK_OUTLET_MAIN,
570
576
  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: "$29.99",
238
+ price: 2999,
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: "$49.99",
253
+ price: 4999,
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: "$39.99",
267
+ price: 3999,
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.44",
3
+ "version": "0.1.46",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",