@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.
- package/README.md +1 -1
- package/dist/CommonTypes.d.ts +82 -35
- package/dist/CommonTypes.js +44 -0
- package/dist/actions/add-product/mock.js +7 -5
- package/dist/actions/add-product/types.d.ts +2 -2
- package/dist/actions/edit-product/mock.js +3 -1
- package/dist/actions/get-branding/action.d.ts +5 -0
- package/dist/actions/get-branding/action.js +7 -0
- package/dist/actions/get-branding/mock.d.ts +2 -0
- package/dist/actions/get-branding/mock.js +24 -0
- package/dist/actions/get-branding/types.d.ts +23 -0
- package/dist/actions/get-branding/types.js +2 -0
- package/dist/actions/get-current-company-custom-extensions/mock.js +2 -2
- package/dist/actions/get-custom-extensions/mock.js +2 -2
- package/dist/actions/get-media/action.d.ts +5 -0
- package/dist/actions/get-media/action.js +7 -0
- package/dist/actions/get-media/mock.d.ts +2 -0
- package/dist/actions/get-media/mock.js +35 -0
- package/dist/actions/get-media/types.d.ts +30 -0
- package/dist/actions/get-media/types.js +2 -0
- package/dist/actions/get-tax-tables/action.d.ts +5 -0
- package/dist/actions/get-tax-tables/action.js +7 -0
- package/dist/actions/get-tax-tables/mock.d.ts +2 -0
- package/dist/actions/get-tax-tables/mock.js +21 -0
- package/dist/actions/get-tax-tables/types.d.ts +15 -0
- package/dist/actions/get-tax-tables/types.js +2 -0
- package/dist/actions/navigate-to/action.d.ts +5 -0
- package/dist/actions/navigate-to/action.js +7 -0
- package/dist/actions/navigate-to/mock.d.ts +2 -0
- package/dist/actions/navigate-to/mock.js +7 -0
- package/dist/actions/navigate-to/types.d.ts +9 -0
- package/dist/actions/navigate-to/types.js +2 -0
- package/dist/actions/refresh-resource/action.d.ts +5 -0
- package/dist/actions/refresh-resource/action.js +7 -0
- package/dist/actions/refresh-resource/mock.d.ts +2 -0
- package/dist/actions/refresh-resource/mock.js +7 -0
- package/dist/actions/refresh-resource/types.d.ts +9 -0
- package/dist/actions/refresh-resource/types.js +2 -0
- package/dist/actions/resume-parked-order/mock.js +3 -3
- package/dist/actions/show-notification/mock.js +2 -2
- package/dist/actions/show-notification/types.d.ts +2 -0
- package/dist/actions/upload-media/action.d.ts +5 -0
- package/dist/actions/upload-media/action.js +7 -0
- package/dist/actions/upload-media/mock.d.ts +2 -0
- package/dist/actions/upload-media/mock.js +14 -0
- package/dist/actions/upload-media/types.d.ts +20 -0
- package/dist/actions/upload-media/types.js +2 -0
- package/dist/common-types/custom-extensions.d.ts +1 -1
- package/dist/demo/database.d.ts +1 -1
- package/dist/demo/database.js +66 -60
- package/dist/demo/mocks/custom-tables.js +3 -3
- package/dist/index.d.ts +12 -0
- package/dist/index.js +14 -0
- package/dist/projects/manage/mocks.js +16 -0
- package/dist/projects/manage/types.d.ts +15 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ const products = await client.getProducts();
|
|
|
61
61
|
For building applications that run inside the Final Commerce Management Dashboard.
|
|
62
62
|
|
|
63
63
|
- **[Manage Documentation](./src/projects/manage/README.md)**
|
|
64
|
-
- **Features:** Context
|
|
64
|
+
- **Features:** Context, catalog, entities, custom tables, secrets, and optional host-specific commands (navigation, media, tax, branding, notifications) when the dashboard implements them.
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
67
|
import { ManageClient } from '@final-commerce/command-frame';
|
package/dist/CommonTypes.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
86
|
-
salePrice:
|
|
128
|
+
price: number;
|
|
129
|
+
salePrice: number;
|
|
87
130
|
isOnSale: boolean;
|
|
88
131
|
barcode?: string;
|
|
89
|
-
costPrice?:
|
|
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
|
-
|
|
125
|
-
|
|
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:
|
|
220
|
+
amount: number;
|
|
176
221
|
percentage: number;
|
|
177
222
|
}
|
|
178
223
|
export interface CFSummary {
|
|
179
|
-
discountTotal:
|
|
180
|
-
shippingTotal?:
|
|
181
|
-
total:
|
|
182
|
-
totalTaxes:
|
|
183
|
-
subTotal:
|
|
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:
|
|
237
|
+
amount: number;
|
|
193
238
|
percentage: number;
|
|
194
239
|
}
|
|
195
240
|
export interface CFCartFeeItem {
|
|
196
241
|
id: string;
|
|
197
242
|
label: string;
|
|
198
|
-
amount:
|
|
243
|
+
amount: number;
|
|
199
244
|
percentage: number;
|
|
200
245
|
taxTableId?: string;
|
|
201
|
-
tax?:
|
|
246
|
+
tax?: number;
|
|
202
247
|
taxName: string;
|
|
203
248
|
}
|
|
204
249
|
export interface CFTipPayment {
|
|
205
|
-
amount:
|
|
250
|
+
amount: number;
|
|
206
251
|
tipTo: string;
|
|
207
252
|
percentage: number;
|
|
208
253
|
}
|
|
209
254
|
export interface CFRefundedTipPayment {
|
|
210
|
-
amount:
|
|
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:
|
|
263
|
+
amount: number;
|
|
219
264
|
timestamp: string;
|
|
220
265
|
processor: string;
|
|
221
266
|
saleId?: string;
|
|
222
|
-
change?:
|
|
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:
|
|
283
|
+
amount: number;
|
|
239
284
|
label?: string;
|
|
240
285
|
}
|
|
241
286
|
export interface CFFeeDetail {
|
|
242
287
|
percentage: number;
|
|
243
|
-
amount:
|
|
244
|
-
tax:
|
|
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:
|
|
308
|
+
price: number;
|
|
264
309
|
taxes: CFTax[];
|
|
265
310
|
discount: CFDiscountLineItem;
|
|
266
311
|
fee: CFFeeLineItem;
|
|
267
|
-
totalTax:
|
|
268
|
-
total:
|
|
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:
|
|
327
|
+
price: number;
|
|
283
328
|
quantity: number;
|
|
284
329
|
applyTaxes: boolean;
|
|
285
|
-
total:
|
|
286
|
-
totalTax:
|
|
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:
|
|
348
|
+
price: number;
|
|
304
349
|
taxes: CFTax[];
|
|
305
350
|
discount: CFDiscountLineItem;
|
|
306
|
-
totalTax:
|
|
307
|
-
total:
|
|
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?:
|
|
371
|
+
balance?: number;
|
|
327
372
|
receiptId?: string;
|
|
328
|
-
currency
|
|
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:
|
|
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 {
|
package/dist/CommonTypes.js
CHANGED
|
@@ -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 ||
|
|
18
|
-
maxPrice: params.price ||
|
|
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 ||
|
|
25
|
-
salePrice:
|
|
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?:
|
|
10
|
+
price?: number;
|
|
11
11
|
sku?: string;
|
|
12
|
-
costPrice?:
|
|
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 || [],
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const mockGetBranding = async () => {
|
|
2
|
+
console.log("[Mock] getBranding called");
|
|
3
|
+
return {
|
|
4
|
+
theme: "light",
|
|
5
|
+
colors: {
|
|
6
|
+
primary: "#2563eb",
|
|
7
|
+
secondary: "#64748b",
|
|
8
|
+
accent: "#0ea5e9",
|
|
9
|
+
destructive: "#dc2626",
|
|
10
|
+
sidebar: "#1e293b",
|
|
11
|
+
background: "#ffffff",
|
|
12
|
+
foreground: "#0f172a",
|
|
13
|
+
muted: "#f1f5f9",
|
|
14
|
+
border: "#e2e8f0"
|
|
15
|
+
},
|
|
16
|
+
borderRadius: "round",
|
|
17
|
+
borderRadiusValue: "0.5rem",
|
|
18
|
+
font: {
|
|
19
|
+
family: "system-ui, sans-serif"
|
|
20
|
+
},
|
|
21
|
+
logo: null,
|
|
22
|
+
timestamp: new Date().toISOString()
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type BorderRadiusPreset = "sharp" | "soft" | "round" | "pill";
|
|
2
|
+
export interface GetBrandingResponse {
|
|
3
|
+
theme: "light" | "dark";
|
|
4
|
+
colors: {
|
|
5
|
+
primary: string;
|
|
6
|
+
secondary: string;
|
|
7
|
+
accent: string;
|
|
8
|
+
destructive: string;
|
|
9
|
+
sidebar: string;
|
|
10
|
+
background: string;
|
|
11
|
+
foreground: string;
|
|
12
|
+
muted: string;
|
|
13
|
+
border: string;
|
|
14
|
+
};
|
|
15
|
+
borderRadius: BorderRadiusPreset;
|
|
16
|
+
borderRadiusValue: string;
|
|
17
|
+
font: {
|
|
18
|
+
family: string;
|
|
19
|
+
};
|
|
20
|
+
logo: string | null;
|
|
21
|
+
timestamp: string;
|
|
22
|
+
}
|
|
23
|
+
export type GetBranding = () => Promise<GetBrandingResponse>;
|
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
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",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const now = new Date().toISOString();
|
|
2
|
+
export const mockGetMedia = async (params) => {
|
|
3
|
+
console.log("[Mock] getMedia called", params);
|
|
4
|
+
const items = [
|
|
5
|
+
{
|
|
6
|
+
_id: "mock_media_1",
|
|
7
|
+
url: "https://example.com/media/photo1.jpg",
|
|
8
|
+
filename: "photo1.jpg",
|
|
9
|
+
mimeType: "image/jpeg",
|
|
10
|
+
size: 102400,
|
|
11
|
+
folder: "images",
|
|
12
|
+
title: "Sample photo",
|
|
13
|
+
alt: "Sample",
|
|
14
|
+
width: 800,
|
|
15
|
+
height: 600,
|
|
16
|
+
createdAt: now
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
_id: "mock_media_2",
|
|
20
|
+
url: "https://example.com/media/doc.pdf",
|
|
21
|
+
filename: "doc.pdf",
|
|
22
|
+
mimeType: "application/pdf",
|
|
23
|
+
size: 51200,
|
|
24
|
+
folder: "documents",
|
|
25
|
+
createdAt: now
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
return {
|
|
29
|
+
items,
|
|
30
|
+
total: items.length,
|
|
31
|
+
page: params?.page ?? 1,
|
|
32
|
+
pageSize: params?.pageSize ?? 20,
|
|
33
|
+
timestamp: new Date().toISOString()
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface GetMediaParams {
|
|
2
|
+
search?: string;
|
|
3
|
+
mimeType?: string[];
|
|
4
|
+
folder?: string;
|
|
5
|
+
page?: number;
|
|
6
|
+
pageSize?: number;
|
|
7
|
+
sortBy?: "createdAt" | "filename" | "size" | "title";
|
|
8
|
+
sortDir?: "asc" | "desc";
|
|
9
|
+
}
|
|
10
|
+
export interface MediaItemPayload {
|
|
11
|
+
_id: string;
|
|
12
|
+
url: string;
|
|
13
|
+
filename: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
size: number;
|
|
16
|
+
folder: string;
|
|
17
|
+
title?: string;
|
|
18
|
+
alt?: string;
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
}
|
|
23
|
+
export interface GetMediaResponse {
|
|
24
|
+
items: MediaItemPayload[];
|
|
25
|
+
total: number;
|
|
26
|
+
page: number;
|
|
27
|
+
pageSize: number;
|
|
28
|
+
timestamp: string;
|
|
29
|
+
}
|
|
30
|
+
export type GetMedia = (params?: GetMediaParams) => Promise<GetMediaResponse>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const mockGetTaxTables = async () => {
|
|
2
|
+
console.log("[Mock] getTaxTables called");
|
|
3
|
+
return {
|
|
4
|
+
taxTables: [
|
|
5
|
+
{
|
|
6
|
+
_id: "mock_table_1",
|
|
7
|
+
name: "Standard",
|
|
8
|
+
rates: [
|
|
9
|
+
{ _id: "mock_rate_1", name: "GST", isCompounding: false },
|
|
10
|
+
{ _id: "mock_rate_2", name: "PST", isCompounding: true }
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
_id: "mock_table_2",
|
|
15
|
+
name: "Zero",
|
|
16
|
+
rates: [{ _id: "mock_rate_3", name: "Zero rated", isCompounding: false }]
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
timestamp: new Date().toISOString()
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface TaxRatePayload {
|
|
2
|
+
_id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
isCompounding: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface TaxTablePayload {
|
|
7
|
+
_id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
rates: TaxRatePayload[];
|
|
10
|
+
}
|
|
11
|
+
export interface GetTaxTablesResponse {
|
|
12
|
+
taxTables: TaxTablePayload[];
|
|
13
|
+
timestamp: string;
|
|
14
|
+
}
|
|
15
|
+
export type GetTaxTables = () => Promise<GetTaxTablesResponse>;
|