@final-commerce/command-frame 0.1.44 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/CommonTypes.d.ts +82 -35
  3. package/dist/CommonTypes.js +44 -0
  4. package/dist/actions/add-product/mock.js +7 -5
  5. package/dist/actions/add-product/types.d.ts +2 -2
  6. package/dist/actions/edit-product/mock.js +3 -1
  7. package/dist/actions/get-branding/action.d.ts +5 -0
  8. package/dist/actions/get-branding/action.js +7 -0
  9. package/dist/actions/get-branding/mock.d.ts +2 -0
  10. package/dist/actions/get-branding/mock.js +24 -0
  11. package/dist/actions/get-branding/types.d.ts +23 -0
  12. package/dist/actions/get-branding/types.js +2 -0
  13. package/dist/actions/get-current-company-custom-extensions/mock.js +2 -2
  14. package/dist/actions/get-custom-extensions/mock.js +2 -2
  15. package/dist/actions/get-media/action.d.ts +5 -0
  16. package/dist/actions/get-media/action.js +7 -0
  17. package/dist/actions/get-media/mock.d.ts +2 -0
  18. package/dist/actions/get-media/mock.js +35 -0
  19. package/dist/actions/get-media/types.d.ts +30 -0
  20. package/dist/actions/get-media/types.js +2 -0
  21. package/dist/actions/get-tax-tables/action.d.ts +5 -0
  22. package/dist/actions/get-tax-tables/action.js +7 -0
  23. package/dist/actions/get-tax-tables/mock.d.ts +2 -0
  24. package/dist/actions/get-tax-tables/mock.js +21 -0
  25. package/dist/actions/get-tax-tables/types.d.ts +15 -0
  26. package/dist/actions/get-tax-tables/types.js +2 -0
  27. package/dist/actions/navigate-to/action.d.ts +5 -0
  28. package/dist/actions/navigate-to/action.js +7 -0
  29. package/dist/actions/navigate-to/mock.d.ts +2 -0
  30. package/dist/actions/navigate-to/mock.js +7 -0
  31. package/dist/actions/navigate-to/types.d.ts +9 -0
  32. package/dist/actions/navigate-to/types.js +2 -0
  33. package/dist/actions/refresh-resource/action.d.ts +5 -0
  34. package/dist/actions/refresh-resource/action.js +7 -0
  35. package/dist/actions/refresh-resource/mock.d.ts +2 -0
  36. package/dist/actions/refresh-resource/mock.js +7 -0
  37. package/dist/actions/refresh-resource/types.d.ts +9 -0
  38. package/dist/actions/refresh-resource/types.js +2 -0
  39. package/dist/actions/resume-parked-order/mock.js +3 -3
  40. package/dist/actions/show-notification/mock.js +2 -2
  41. package/dist/actions/show-notification/types.d.ts +2 -0
  42. package/dist/actions/upload-media/action.d.ts +5 -0
  43. package/dist/actions/upload-media/action.js +7 -0
  44. package/dist/actions/upload-media/mock.d.ts +2 -0
  45. package/dist/actions/upload-media/mock.js +14 -0
  46. package/dist/actions/upload-media/types.d.ts +20 -0
  47. package/dist/actions/upload-media/types.js +2 -0
  48. package/dist/common-types/custom-extensions.d.ts +1 -1
  49. package/dist/demo/database.d.ts +1 -1
  50. package/dist/demo/database.js +66 -60
  51. package/dist/demo/mocks/custom-tables.js +3 -3
  52. package/dist/index.d.ts +12 -0
  53. package/dist/index.js +14 -0
  54. package/dist/projects/manage/mocks.js +16 -0
  55. package/dist/projects/manage/types.d.ts +15 -1
  56. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ export interface NavigateToParams {
2
+ /** In-app path (must start with `/`). Hosts may restrict allowed prefixes. */
3
+ path: string;
4
+ }
5
+ export interface NavigateToResponse {
6
+ success: boolean;
7
+ timestamp: string;
8
+ }
9
+ export type NavigateTo = (params: NavigateToParams) => Promise<NavigateToResponse>;
@@ -0,0 +1,2 @@
1
+ // Navigate To Types (Manage host extension)
2
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Refresh resource action — invalidate cached list/detail data in the Manage host.
3
+ */
4
+ import type { RefreshResource } from "./types";
5
+ export declare const refreshResource: RefreshResource;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Refresh resource action — invalidate cached list/detail data in the Manage host.
3
+ */
4
+ import { commandFrameClient } from "../../client";
5
+ export const refreshResource = async (params) => {
6
+ return await commandFrameClient.call("refreshResource", params);
7
+ };
@@ -0,0 +1,2 @@
1
+ import { RefreshResource } from "./types";
2
+ export declare const mockRefreshResource: RefreshResource;
@@ -0,0 +1,7 @@
1
+ export const mockRefreshResource = async (params) => {
2
+ console.log("[Mock] refreshResource called", params.resource);
3
+ return {
4
+ success: true,
5
+ timestamp: new Date().toISOString()
6
+ };
7
+ };
@@ -0,0 +1,9 @@
1
+ export interface RefreshResourceParams {
2
+ /** Resource key used by the host data layer (e.g. Refine resource name). */
3
+ resource: string;
4
+ }
5
+ export interface RefreshResourceResponse {
6
+ success: boolean;
7
+ timestamp: string;
8
+ }
9
+ export type RefreshResource = (params: RefreshResourceParams) => Promise<RefreshResourceResponse>;
@@ -0,0 +1,2 @@
1
+ // Refresh Resource Types (Manage host extension)
2
+ export {};
@@ -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
@@ -1,6 +1,6 @@
1
1
  export const mockShowNotification = async (params) => {
2
- console.log("[Mock] showNotification called", params);
3
- window.alert(`Notification: ${params?.message || "No message"}`);
2
+ console.log("[Mock] showNotification called", params?.message, params?.type);
3
+ window.alert(`Notification${params?.type ? ` (${params.type})` : ""}: ${params?.message || "No message"}`);
4
4
  return {
5
5
  success: true,
6
6
  message: params?.message || "",
@@ -1,5 +1,7 @@
1
1
  export interface ShowNotificationParams {
2
2
  message: string;
3
+ /** Visual style when the host supports it (e.g. toast variant). */
4
+ type?: "success" | "error" | "info" | "warning";
3
5
  }
4
6
  export interface ShowNotificationResponse {
5
7
  success: boolean;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Upload media action — upload a file via the Manage host.
3
+ */
4
+ import type { UploadMedia } from "./types";
5
+ export declare const uploadMedia: UploadMedia;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Upload media action — upload a file via the Manage host.
3
+ */
4
+ import { commandFrameClient } from "../../client";
5
+ export const uploadMedia = async (params) => {
6
+ return await commandFrameClient.call("uploadMedia", params);
7
+ };
@@ -0,0 +1,2 @@
1
+ import { UploadMedia } from "./types";
2
+ export declare const mockUploadMedia: UploadMedia;
@@ -0,0 +1,14 @@
1
+ export const mockUploadMedia = async (params) => {
2
+ console.log("[Mock] uploadMedia called", params.filename, params.mimeType);
3
+ return {
4
+ success: true,
5
+ url: `https://example.com/media/mock/${encodeURIComponent(params.filename)}`,
6
+ id: "mock_upload_id",
7
+ filename: params.filename,
8
+ mimeType: params.mimeType,
9
+ size: 1234,
10
+ width: null,
11
+ height: null,
12
+ timestamp: new Date().toISOString()
13
+ };
14
+ };
@@ -0,0 +1,20 @@
1
+ export interface UploadMediaParams {
2
+ /** Base64-encoded file content (no data URL prefix). */
3
+ base64: string;
4
+ filename: string;
5
+ mimeType: string;
6
+ /** Target folder label; host default if omitted. */
7
+ folder?: string;
8
+ }
9
+ export interface UploadMediaResponse {
10
+ success: boolean;
11
+ url: string;
12
+ id?: string | null;
13
+ filename?: string;
14
+ mimeType?: string;
15
+ size?: number;
16
+ width?: number | null;
17
+ height?: number | null;
18
+ timestamp: string;
19
+ }
20
+ export type UploadMedia = (params: UploadMediaParams) => Promise<UploadMediaResponse>;
@@ -0,0 +1,2 @@
1
+ // Upload Media Types (Manage host extension)
2
+ export {};
@@ -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/dist/index.d.ts CHANGED
@@ -72,6 +72,12 @@ export declare const command: {
72
72
  readonly getSecretsKeys: import("./actions/get-secrets-keys/types").GetSecretsKeys;
73
73
  readonly getSecretVal: import("./actions/get-secret-val/types").GetSecretVal;
74
74
  readonly setSecretVal: import("./actions/set-secret-val/types").SetSecretVal;
75
+ readonly navigateTo: import("./actions/navigate-to/types").NavigateTo;
76
+ readonly refreshResource: import("./actions/refresh-resource/types").RefreshResource;
77
+ readonly getMedia: import("./actions/get-media/types").GetMedia;
78
+ readonly uploadMedia: import("./actions/upload-media/types").UploadMedia;
79
+ readonly getTaxTables: import("./actions/get-tax-tables/types").GetTaxTables;
80
+ readonly getBranding: import("./actions/get-branding/types").GetBranding;
75
81
  };
76
82
  export type { ExampleFunction, ExampleFunctionParams, ExampleFunctionResponse } from "./actions/example-function/types";
77
83
  export type { GenerateAPIKey, GenerateAPIKeyParams, GenerateAPIKeyResponse } from "./actions/generate-api-key/types";
@@ -128,6 +134,12 @@ export type { RemoveCustomerFromCart, RemoveCustomerFromCartResponse } from "./a
128
134
  export type { GoToStationHome, GoToStationHomeResponse } from "./actions/go-to-station-home/types";
129
135
  export type { OpenCashDrawer, OpenCashDrawerResponse } from "./actions/open-cash-drawer/types";
130
136
  export type { ShowNotification, ShowNotificationParams, ShowNotificationResponse } from "./actions/show-notification/types";
137
+ export type { NavigateTo, NavigateToParams, NavigateToResponse } from "./actions/navigate-to/types";
138
+ export type { RefreshResource, RefreshResourceParams, RefreshResourceResponse } from "./actions/refresh-resource/types";
139
+ export type { GetMedia, GetMediaParams, GetMediaResponse, MediaItemPayload } from "./actions/get-media/types";
140
+ export type { UploadMedia, UploadMediaParams, UploadMediaResponse } from "./actions/upload-media/types";
141
+ export type { GetTaxTables, GetTaxTablesResponse, TaxRatePayload, TaxTablePayload } from "./actions/get-tax-tables/types";
142
+ export type { BorderRadiusPreset, GetBranding, GetBrandingResponse } from "./actions/get-branding/types";
131
143
  export type { ShowConfirmation, ShowConfirmationParams, ShowConfirmationResponse } from "./actions/show-confirmation/types";
132
144
  export type { AuthenticateUser, AuthenticateUserParams, AuthenticateUserResponse } from "./actions/authenticate-user/types";
133
145
  export type { PartialPayment, PartialPaymentParams, PartialPaymentResponse } from "./actions/partial-payment/types";
package/dist/index.js CHANGED
@@ -83,6 +83,13 @@ import { deleteProduct } from "./actions/delete-product/action";
83
83
  // Entity Actions
84
84
  import { getOutlets } from "./actions/get-outlets/action";
85
85
  import { getStations } from "./actions/get-stations/action";
86
+ // Manage extension actions (optional hosts: Deerlake, etc.)
87
+ import { navigateTo } from "./actions/navigate-to/action";
88
+ import { refreshResource } from "./actions/refresh-resource/action";
89
+ import { getMedia } from "./actions/get-media/action";
90
+ import { uploadMedia } from "./actions/upload-media/action";
91
+ import { getTaxTables } from "./actions/get-tax-tables/action";
92
+ import { getBranding } from "./actions/get-branding/action";
86
93
  // Export actions as command object
87
94
  export const command = {
88
95
  exampleFunction,
@@ -170,6 +177,13 @@ export const command = {
170
177
  getSecretsKeys,
171
178
  getSecretVal,
172
179
  setSecretVal,
180
+ // Manage extension actions (optional on ManageProviderActions)
181
+ navigateTo,
182
+ refreshResource,
183
+ getMedia,
184
+ uploadMedia,
185
+ getTaxTables,
186
+ getBranding,
173
187
  };
174
188
  export { EXTENSION_REFUND_REQUEST_ACTION } from "./actions/extension-refund/constants";
175
189
  export { installExtensionRefundListener } from "./actions/extension-refund/extension-refund-listener";
@@ -26,6 +26,14 @@ import { mockDeleteProduct } from "../../actions/delete-product/mock";
26
26
  import { mockGetOutlets } from "../../actions/get-outlets/mock";
27
27
  import { mockGetStations } from "../../actions/get-stations/mock";
28
28
  import { mockGetOrders } from "../../actions/get-orders/mock";
29
+ // Manage extension mocks
30
+ import { mockShowNotification } from "../../actions/show-notification/mock";
31
+ import { mockNavigateTo } from "../../actions/navigate-to/mock";
32
+ import { mockRefreshResource } from "../../actions/refresh-resource/mock";
33
+ import { mockGetMedia } from "../../actions/get-media/mock";
34
+ import { mockUploadMedia } from "../../actions/upload-media/mock";
35
+ import { mockGetTaxTables } from "../../actions/get-tax-tables/mock";
36
+ import { mockGetBranding } from "../../actions/get-branding/mock";
29
37
  // Manage-specific mock for getFinalContext
30
38
  const mockGetFinalContextManage = async () => {
31
39
  console.log("[Mock] getFinalContext called (Manage)");
@@ -63,4 +71,12 @@ export const MANAGE_MOCKS = {
63
71
  getOutlets: mockGetOutlets,
64
72
  getStations: mockGetStations,
65
73
  getOrders: mockGetOrders,
74
+ // Manage extension mocks
75
+ showNotification: mockShowNotification,
76
+ navigateTo: mockNavigateTo,
77
+ refreshResource: mockRefreshResource,
78
+ getMedia: mockGetMedia,
79
+ uploadMedia: mockUploadMedia,
80
+ getTaxTables: mockGetTaxTables,
81
+ getBranding: mockGetBranding,
66
82
  };
@@ -1,4 +1,4 @@
1
- import type { GetContext, GetFinalContext, GetSecretsKeys, GetSecretVal, SetSecretVal, GenerateAPIKey, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomers, GetProducts, GetCategories, EditProduct, EditProductVariants, DeleteProduct, GetOutlets, GetStations, GetOrders, GetUsers, GetRoles } from "../../index";
1
+ import type { GetContext, GetFinalContext, GetSecretsKeys, GetSecretVal, SetSecretVal, GenerateAPIKey, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomers, GetProducts, GetCategories, EditProduct, EditProductVariants, DeleteProduct, GetOutlets, GetStations, GetOrders, GetUsers, GetRoles, ShowNotification, NavigateTo, RefreshResource, GetMedia, UploadMedia, GetTaxTables, GetBranding } from "../../index";
2
2
  export interface ManageProviderActions {
3
3
  getContext: GetContext;
4
4
  getFinalContext: GetFinalContext;
@@ -24,4 +24,18 @@ export interface ManageProviderActions {
24
24
  getOutlets: GetOutlets;
25
25
  getStations: GetStations;
26
26
  getOrders: GetOrders;
27
+ /** Optional: toast / notification in host shell (e.g. Deerlake). */
28
+ showNotification?: ShowNotification;
29
+ /** Optional: SPA navigation (e.g. Deerlake). */
30
+ navigateTo?: NavigateTo;
31
+ /** Optional: invalidate cached data for a resource key (e.g. Deerlake). */
32
+ refreshResource?: RefreshResource;
33
+ /** Optional: list media library (e.g. Deerlake). */
34
+ getMedia?: GetMedia;
35
+ /** Optional: upload media via host (e.g. Deerlake). */
36
+ uploadMedia?: UploadMedia;
37
+ /** Optional: tax tables for company (e.g. Deerlake). */
38
+ getTaxTables?: GetTaxTables;
39
+ /** Optional: theme tokens for iframe styling (e.g. Deerlake). */
40
+ getBranding?: GetBranding;
27
41
  }
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.47",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",