@final-commerce/command-frame 0.2.0-beta.1 → 0.2.0-beta.6
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/dist/CommonTypes.d.ts +98 -3
- package/dist/actions/add-customer-note/mock.js +24 -15
- package/dist/actions/add-customer-note/types.d.ts +3 -2
- package/dist/actions/add-product/mock.js +11 -5
- package/dist/actions/edit-product/mock.js +4 -2
- package/dist/actions/get-context/mock.js +12 -6
- package/dist/actions/print/mock.js +3 -6
- package/dist/actions/print/types.d.ts +1 -7
- package/dist/actions/remove-customer-note/mock.js +14 -5
- package/dist/demo/database.js +9 -24
- package/dist/index.d.ts +9 -1
- package/dist/index.js +4 -0
- package/dist/pubsub/topics/attributes/attribute-created/types.d.ts +6 -0
- package/dist/pubsub/topics/attributes/attribute-created/types.js +1 -0
- package/dist/pubsub/topics/attributes/attribute-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/attributes/attribute-updated/types.js +1 -0
- package/dist/pubsub/topics/attributes/index.d.ts +3 -0
- package/dist/pubsub/topics/attributes/index.js +18 -0
- package/dist/pubsub/topics/attributes/types.d.ts +6 -0
- package/dist/pubsub/topics/attributes/types.js +2 -0
- package/dist/pubsub/topics/categories/category-created/types.d.ts +6 -0
- package/dist/pubsub/topics/categories/category-created/types.js +1 -0
- package/dist/pubsub/topics/categories/category-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/categories/category-updated/types.js +1 -0
- package/dist/pubsub/topics/categories/index.d.ts +3 -0
- package/dist/pubsub/topics/categories/index.js +18 -0
- package/dist/pubsub/topics/categories/types.d.ts +6 -0
- package/dist/pubsub/topics/categories/types.js +2 -0
- package/dist/pubsub/topics/index.d.ts +4 -0
- package/dist/pubsub/topics/index.js +4 -0
- package/dist/pubsub/topics/print/print-completed/types.d.ts +1 -1
- package/dist/pubsub/topics/print/print-error/types.d.ts +1 -1
- package/dist/pubsub/topics/print/print-started/types.d.ts +1 -1
- package/dist/pubsub/topics/transactions/index.d.ts +3 -0
- package/dist/pubsub/topics/transactions/index.js +18 -0
- package/dist/pubsub/topics/transactions/transaction-created/types.d.ts +6 -0
- package/dist/pubsub/topics/transactions/transaction-created/types.js +1 -0
- package/dist/pubsub/topics/transactions/transaction-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/transactions/transaction-updated/types.js +1 -0
- package/dist/pubsub/topics/transactions/types.d.ts +6 -0
- package/dist/pubsub/topics/transactions/types.js +2 -0
- package/dist/pubsub/topics/types.d.ts +8 -0
- package/dist/pubsub/topics/users/index.js +10 -0
- package/dist/pubsub/topics/users/types.d.ts +6 -2
- package/dist/pubsub/topics/users/types.js +2 -0
- package/dist/pubsub/topics/users/user-created/types.d.ts +6 -0
- package/dist/pubsub/topics/users/user-created/types.js +1 -0
- package/dist/pubsub/topics/users/user-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/users/user-updated/types.js +1 -0
- package/dist/pubsub/topics/variants/index.d.ts +3 -0
- package/dist/pubsub/topics/variants/index.js +18 -0
- package/dist/pubsub/topics/variants/types.d.ts +6 -0
- package/dist/pubsub/topics/variants/types.js +2 -0
- package/dist/pubsub/topics/variants/variant-created/types.d.ts +6 -0
- package/dist/pubsub/topics/variants/variant-created/types.js +1 -0
- package/dist/pubsub/topics/variants/variant-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/variants/variant-updated/types.js +1 -0
- package/package.json +1 -1
package/dist/CommonTypes.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export declare enum CFUserTypes {
|
|
|
60
60
|
CASHIER = "cashier",
|
|
61
61
|
RESELLER = "reseller"
|
|
62
62
|
}
|
|
63
|
-
export type CFActiveEntity =
|
|
63
|
+
export type CFActiveEntity = Record<string, unknown>;
|
|
64
64
|
export interface CFDiscount {
|
|
65
65
|
value: number;
|
|
66
66
|
label?: string;
|
|
@@ -96,8 +96,26 @@ export interface CFTax {
|
|
|
96
96
|
amount: number;
|
|
97
97
|
taxTableName: string;
|
|
98
98
|
taxTableId: string;
|
|
99
|
+
/** Whether this tax compounds on top of others. */
|
|
100
|
+
compounding?: boolean;
|
|
101
|
+
/** Application order; lower numbers apply first. */
|
|
102
|
+
priority?: number;
|
|
103
|
+
}
|
|
104
|
+
/** Per-rate tax entry on a cart fee (gst, hst, etc.). Same shape as `CFTax`; declared
|
|
105
|
+
* separately to match the host's distinct `CartFeeTaxEntry` type. */
|
|
106
|
+
export interface CFCartFeeTaxEntry {
|
|
107
|
+
id: string;
|
|
108
|
+
name: string;
|
|
109
|
+
percentage: number;
|
|
110
|
+
amount: number;
|
|
111
|
+
taxTableId: string;
|
|
112
|
+
taxTableName: string;
|
|
113
|
+
compounding?: boolean;
|
|
114
|
+
priority?: number;
|
|
99
115
|
}
|
|
100
116
|
export interface CFInventory {
|
|
117
|
+
/** Warehouse identifier the stock is held at. */
|
|
118
|
+
warehouse: string;
|
|
101
119
|
outletId: string;
|
|
102
120
|
stock?: number | null;
|
|
103
121
|
_id?: string;
|
|
@@ -115,6 +133,29 @@ export interface CFOrderNote {
|
|
|
115
133
|
addedByUser?: string;
|
|
116
134
|
dateCreated?: string;
|
|
117
135
|
}
|
|
136
|
+
export interface CFAttributeOption {
|
|
137
|
+
name: string;
|
|
138
|
+
order?: number;
|
|
139
|
+
}
|
|
140
|
+
export interface CFAttribute {
|
|
141
|
+
_id: string;
|
|
142
|
+
companyId?: string;
|
|
143
|
+
optionName: string;
|
|
144
|
+
sortingOrder: number;
|
|
145
|
+
options: CFAttributeOption[];
|
|
146
|
+
}
|
|
147
|
+
export interface CFTransaction {
|
|
148
|
+
_id: string;
|
|
149
|
+
companyId?: string;
|
|
150
|
+
orderId?: string;
|
|
151
|
+
amount: number;
|
|
152
|
+
currency?: string;
|
|
153
|
+
status?: string;
|
|
154
|
+
paymentMethod?: string;
|
|
155
|
+
createdAt?: string;
|
|
156
|
+
updatedAt?: string;
|
|
157
|
+
[key: string]: unknown;
|
|
158
|
+
}
|
|
118
159
|
export interface CFCategory {
|
|
119
160
|
_id: string;
|
|
120
161
|
companyId: string;
|
|
@@ -131,7 +172,8 @@ export interface CFProductVariant {
|
|
|
131
172
|
barcode?: string;
|
|
132
173
|
costPrice?: number;
|
|
133
174
|
manageStock: boolean;
|
|
134
|
-
|
|
175
|
+
/** External variant identifier — required by host. */
|
|
176
|
+
externalId: string;
|
|
135
177
|
inventory?: CFInventory[];
|
|
136
178
|
allowBackorder?: boolean;
|
|
137
179
|
images?: string[];
|
|
@@ -144,11 +186,15 @@ export interface CFProductVariant {
|
|
|
144
186
|
value: string;
|
|
145
187
|
}[];
|
|
146
188
|
_id: string;
|
|
189
|
+
isDeleted?: boolean;
|
|
190
|
+
currency?: CurrencyCode;
|
|
191
|
+
minorUnits?: number;
|
|
147
192
|
}
|
|
148
193
|
export interface CFProduct {
|
|
149
194
|
_id: string;
|
|
150
195
|
companyId?: string;
|
|
151
|
-
|
|
196
|
+
/** External product identifier — required by host. */
|
|
197
|
+
externalId: string;
|
|
152
198
|
taxTable: string;
|
|
153
199
|
name: string;
|
|
154
200
|
description?: string;
|
|
@@ -168,8 +214,12 @@ export interface CFProduct {
|
|
|
168
214
|
minorUnits: number;
|
|
169
215
|
minPrice?: number;
|
|
170
216
|
maxPrice?: number;
|
|
217
|
+
/** Catalog-level price (rare; usually only on simple products). */
|
|
218
|
+
price?: number;
|
|
171
219
|
status?: string;
|
|
172
220
|
isDeleted?: boolean;
|
|
221
|
+
createdAt?: string;
|
|
222
|
+
updatedAt?: string;
|
|
173
223
|
}
|
|
174
224
|
export interface CFActiveProduct extends CFActiveEntity {
|
|
175
225
|
id: string;
|
|
@@ -195,6 +245,13 @@ export interface CFActiveProduct extends CFActiveEntity {
|
|
|
195
245
|
isUnlimited?: boolean;
|
|
196
246
|
attributes?: string;
|
|
197
247
|
localQuantity?: number;
|
|
248
|
+
/** Mongo-style id when the active product retains the catalog `_id`. */
|
|
249
|
+
_id?: string;
|
|
250
|
+
productType?: CFProductType;
|
|
251
|
+
/** Currency code for the line price. */
|
|
252
|
+
currency?: CurrencyCode;
|
|
253
|
+
/** Number of minor units (decimal places) for the line currency. */
|
|
254
|
+
minorUnits?: number;
|
|
198
255
|
}
|
|
199
256
|
export interface CFCustomer {
|
|
200
257
|
_id: string;
|
|
@@ -245,6 +302,8 @@ export interface CFCartFeeItem {
|
|
|
245
302
|
taxTableId?: string;
|
|
246
303
|
tax?: number;
|
|
247
304
|
taxName: string;
|
|
305
|
+
/** Per-rate breakdown so summary/refund views can show correct amounts per rate. */
|
|
306
|
+
taxes?: CFCartFeeTaxEntry[];
|
|
248
307
|
}
|
|
249
308
|
export interface CFTipPayment {
|
|
250
309
|
amount: number;
|
|
@@ -268,6 +327,8 @@ export interface CFPaymentMethod {
|
|
|
268
327
|
tip?: CFTipPayment | null;
|
|
269
328
|
cashRounding?: number;
|
|
270
329
|
emv?: string | null;
|
|
330
|
+
/** Processor fee charged on this payment. */
|
|
331
|
+
processorFee?: number | null;
|
|
271
332
|
}
|
|
272
333
|
export interface CFPosDataItem {
|
|
273
334
|
outlet: string;
|
|
@@ -408,6 +469,10 @@ export interface CFOrder {
|
|
|
408
469
|
refund?: CFRefundItem[];
|
|
409
470
|
balance: number;
|
|
410
471
|
signature?: string | null;
|
|
472
|
+
/** ISO timestamp at which a parked order's stock reservation expires. */
|
|
473
|
+
parkExpiryDate?: string;
|
|
474
|
+
/** Park stock-reduction policy (host-defined string flag). */
|
|
475
|
+
parkReduceStock?: string;
|
|
411
476
|
}
|
|
412
477
|
export interface CFActiveUserRole {
|
|
413
478
|
id?: string;
|
|
@@ -469,6 +534,12 @@ export interface CFActiveStation {
|
|
|
469
534
|
createdAt?: string;
|
|
470
535
|
updatedAt?: string;
|
|
471
536
|
stripeTerminalId?: string;
|
|
537
|
+
/** Stripe serial-reader identifier when paired. */
|
|
538
|
+
serialReaderId?: string;
|
|
539
|
+
/** User id of whoever enrolled the station. */
|
|
540
|
+
enrolledBy?: string;
|
|
541
|
+
/** Whether the station is virtual (no physical terminal). */
|
|
542
|
+
isVirtual?: boolean;
|
|
472
543
|
}
|
|
473
544
|
/** Cash register session (station session), aligned with Render `Session`. */
|
|
474
545
|
export interface CFSession {
|
|
@@ -534,6 +605,8 @@ export interface CFNonRevenueItem {
|
|
|
534
605
|
}
|
|
535
606
|
export interface CFActiveCart extends CFActiveEntity {
|
|
536
607
|
tax?: number;
|
|
608
|
+
/** Per-rate tax breakdown for the cart. Same shape as line item taxes. */
|
|
609
|
+
taxes?: CFTax[];
|
|
537
610
|
total: number;
|
|
538
611
|
subtotal: number;
|
|
539
612
|
discount?: CFDiscount;
|
|
@@ -549,6 +622,22 @@ export interface CFActiveCart extends CFActiveEntity {
|
|
|
549
622
|
cartTotal?: number;
|
|
550
623
|
orderTotal?: number;
|
|
551
624
|
orderId?: string;
|
|
625
|
+
/** Currency code for amounts on this cart. */
|
|
626
|
+
currency?: CurrencyCode;
|
|
627
|
+
/** Number of minor units (decimal places) for the cart's currency. */
|
|
628
|
+
minorUnits?: number;
|
|
629
|
+
}
|
|
630
|
+
/** A parked order. Extends `CFActiveCart` with parking-specific fields. */
|
|
631
|
+
export interface CFActivePark extends CFActiveCart {
|
|
632
|
+
/** Required on parked orders (overrides the optional `orderId` on the parent). */
|
|
633
|
+
orderId: string;
|
|
634
|
+
receiptId: string;
|
|
635
|
+
servedBy: string | {
|
|
636
|
+
_id?: string;
|
|
637
|
+
firstName: string;
|
|
638
|
+
lastName: string;
|
|
639
|
+
} | undefined;
|
|
640
|
+
createdAt: string | number;
|
|
552
641
|
}
|
|
553
642
|
export interface CFActiveCompany extends CFActiveEntity {
|
|
554
643
|
id?: string;
|
|
@@ -572,6 +661,12 @@ export interface CFContextRender {
|
|
|
572
661
|
buildSourceId: string | null;
|
|
573
662
|
buildIsPremium: boolean;
|
|
574
663
|
isOffline: boolean;
|
|
664
|
+
currency: string | null;
|
|
665
|
+
currencySymbol: string | null;
|
|
666
|
+
currencyPrefix: string | null;
|
|
667
|
+
currencySuffix: string | null;
|
|
668
|
+
thousandSeparator: string | null;
|
|
669
|
+
decimalSeparator: string | null;
|
|
575
670
|
user: Record<string, unknown> | null;
|
|
576
671
|
company: Omit<Record<string, unknown>, "settings"> | null;
|
|
577
672
|
station: Record<string, unknown> | null;
|
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import { MOCK_CUSTOMERS } from "../../demo/database";
|
|
1
|
+
import { MOCK_CUSTOMERS, mockPublishEvent } from "../../demo/database";
|
|
2
|
+
function generateNoteId() {
|
|
3
|
+
return `mock_note_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
|
|
4
|
+
}
|
|
2
5
|
export const mockAddCustomerNote = (params) => {
|
|
3
6
|
console.log("[Mock] addCustomerNote called", params);
|
|
4
|
-
if (params?.
|
|
5
|
-
|
|
6
|
-
if (customer) {
|
|
7
|
-
if (!customer.notes) {
|
|
8
|
-
customer.notes = [];
|
|
9
|
-
}
|
|
10
|
-
customer.notes.push({
|
|
11
|
-
_id: `mock_note_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`,
|
|
12
|
-
message: params.note,
|
|
13
|
-
createdAt: new Date().toISOString()
|
|
14
|
-
});
|
|
15
|
-
}
|
|
7
|
+
if (!params?.note) {
|
|
8
|
+
throw new Error("addCustomerNote: note is required");
|
|
16
9
|
}
|
|
10
|
+
const target = params.customerId ? MOCK_CUSTOMERS.find(c => c._id === params.customerId) : MOCK_CUSTOMERS[0];
|
|
11
|
+
if (!target) {
|
|
12
|
+
throw new Error("addCustomerNote: no target customer (provide customerId or seed at least one mock customer)");
|
|
13
|
+
}
|
|
14
|
+
const noteId = generateNoteId();
|
|
15
|
+
const note = {
|
|
16
|
+
_id: noteId,
|
|
17
|
+
message: params.note,
|
|
18
|
+
createdAt: new Date().toISOString()
|
|
19
|
+
};
|
|
20
|
+
target.notes = [...(target.notes || []), note];
|
|
21
|
+
mockPublishEvent("customers", "customer-note-added", {
|
|
22
|
+
customer: target,
|
|
23
|
+
note
|
|
24
|
+
});
|
|
17
25
|
return Promise.resolve({
|
|
18
26
|
success: true,
|
|
19
|
-
customerId:
|
|
20
|
-
|
|
27
|
+
customerId: target._id,
|
|
28
|
+
noteId,
|
|
29
|
+
note: params.note,
|
|
21
30
|
timestamp: new Date().toISOString()
|
|
22
31
|
});
|
|
23
32
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export interface AddCustomerNoteParams {
|
|
2
|
-
customerId: string;
|
|
3
2
|
note: string;
|
|
3
|
+
customerId?: string;
|
|
4
4
|
}
|
|
5
5
|
export interface AddCustomerNoteResponse {
|
|
6
6
|
success: boolean;
|
|
7
7
|
customerId: string;
|
|
8
|
+
noteId: string;
|
|
8
9
|
note: string;
|
|
9
10
|
timestamp: string;
|
|
10
11
|
}
|
|
11
|
-
export type AddCustomerNote = (params
|
|
12
|
+
export type AddCustomerNote = (params: AddCustomerNoteParams) => Promise<AddCustomerNoteResponse>;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { CFProductType, CurrencyCode } from "../../CommonTypes";
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
2
3
|
export const mockAddProduct = async (params) => {
|
|
3
4
|
console.log("[Mock] addProduct called", params);
|
|
4
5
|
const hasVariants = params.variants && params.variants.length > 0;
|
|
6
|
+
const productId = "mock_product_" + Date.now();
|
|
5
7
|
return {
|
|
6
8
|
product: {
|
|
7
|
-
_id:
|
|
9
|
+
_id: productId,
|
|
10
|
+
externalId: `ext_${productId}`,
|
|
8
11
|
currency: CurrencyCode.USD,
|
|
9
12
|
minorUnits: 2,
|
|
10
13
|
name: params.name,
|
|
@@ -20,16 +23,19 @@ export const mockAddProduct = async (params) => {
|
|
|
20
23
|
maxPrice: params.price || 0,
|
|
21
24
|
variants: hasVariants
|
|
22
25
|
? params.variants.map((v, i) => ({ ...v, _id: `mock_variant_${Date.now()}_${i}` }))
|
|
23
|
-
: [
|
|
26
|
+
: [
|
|
27
|
+
{
|
|
24
28
|
_id: `mock_variant_${Date.now()}_0`,
|
|
29
|
+
externalId: `ext_variant_${Date.now()}_0`,
|
|
25
30
|
sku: params.sku || "",
|
|
26
31
|
price: params.price || 0,
|
|
27
32
|
salePrice: 0,
|
|
28
33
|
isOnSale: false,
|
|
29
34
|
manageStock: params.manageStock || false,
|
|
30
|
-
attributes: []
|
|
31
|
-
}
|
|
35
|
+
attributes: []
|
|
36
|
+
}
|
|
37
|
+
]
|
|
32
38
|
},
|
|
33
|
-
timestamp: new Date().toISOString()
|
|
39
|
+
timestamp: new Date().toISOString()
|
|
34
40
|
};
|
|
35
41
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CFProductType, CurrencyCode } from "../../CommonTypes";
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
2
3
|
export const mockEditProduct = async (params) => {
|
|
3
4
|
console.log("[Mock] editProduct called", params);
|
|
4
5
|
return {
|
|
5
6
|
product: {
|
|
6
7
|
_id: params.productId,
|
|
8
|
+
externalId: `ext_${params.productId}`,
|
|
7
9
|
currency: CurrencyCode.USD,
|
|
8
10
|
minorUnits: 2,
|
|
9
11
|
name: params.changes.name || "Updated Product",
|
|
@@ -14,8 +16,8 @@ export const mockEditProduct = async (params) => {
|
|
|
14
16
|
status: params.changes.status || "active",
|
|
15
17
|
productType: CFProductType.SIMPLE,
|
|
16
18
|
attributes: [],
|
|
17
|
-
variants: []
|
|
19
|
+
variants: []
|
|
18
20
|
},
|
|
19
|
-
timestamp: new Date().toISOString()
|
|
21
|
+
timestamp: new Date().toISOString()
|
|
20
22
|
};
|
|
21
23
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MOCK_COMPANY, MOCK_OUTLET, MOCK_STATION, MOCK_USER } from "../../demo/database";
|
|
2
2
|
// Mock for Render context (POS terminal)
|
|
3
|
-
export const mockGetContext =
|
|
3
|
+
export const mockGetContext = () => {
|
|
4
4
|
console.log("[Mock] getContext called (Render)");
|
|
5
|
-
return {
|
|
5
|
+
return Promise.resolve({
|
|
6
6
|
userId: MOCK_USER.id || null,
|
|
7
7
|
companyId: MOCK_COMPANY.id || null,
|
|
8
8
|
companyName: MOCK_COMPANY.name || null,
|
|
@@ -17,17 +17,23 @@ export const mockGetContext = async () => {
|
|
|
17
17
|
buildSourceId: "mock_source_id",
|
|
18
18
|
buildIsPremium: true,
|
|
19
19
|
isOffline: false,
|
|
20
|
+
currency: "USD",
|
|
21
|
+
currencySymbol: "$",
|
|
22
|
+
currencyPrefix: "$",
|
|
23
|
+
currencySuffix: "",
|
|
24
|
+
thousandSeparator: ",",
|
|
25
|
+
decimalSeparator: ".",
|
|
20
26
|
user: null,
|
|
21
27
|
company: null,
|
|
22
28
|
station: null,
|
|
23
29
|
outlet: null,
|
|
24
30
|
timestamp: new Date().toISOString()
|
|
25
|
-
};
|
|
31
|
+
});
|
|
26
32
|
};
|
|
27
33
|
// Mock for Manage context (Hub/BuilderHub)
|
|
28
|
-
export const mockGetContextManage =
|
|
34
|
+
export const mockGetContextManage = () => {
|
|
29
35
|
console.log("[Mock] getContext called (Manage)");
|
|
30
|
-
return {
|
|
36
|
+
return Promise.resolve({
|
|
31
37
|
user: {
|
|
32
38
|
_id: MOCK_USER.id,
|
|
33
39
|
id: MOCK_USER.id,
|
|
@@ -47,5 +53,5 @@ export const mockGetContextManage = async () => {
|
|
|
47
53
|
extensionId: "mock_extension_id",
|
|
48
54
|
outlets: [MOCK_OUTLET],
|
|
49
55
|
timestamp: new Date().toISOString()
|
|
50
|
-
};
|
|
56
|
+
});
|
|
51
57
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const mockPrint =
|
|
1
|
+
export const mockPrint = (params) => {
|
|
2
2
|
console.log("[Mock] print called", params);
|
|
3
3
|
if (!params) {
|
|
4
4
|
throw new Error("Print parameters are required");
|
|
@@ -11,16 +11,13 @@ export const mockPrint = async (params) => {
|
|
|
11
11
|
case "html":
|
|
12
12
|
console.log("[Mock] Would print HTML:", params.data.html?.substring(0, 100) + "...");
|
|
13
13
|
break;
|
|
14
|
-
case "selector":
|
|
15
|
-
console.log("[Mock] Would print element with selector:", params.data.selector);
|
|
16
|
-
break;
|
|
17
14
|
case "receipt":
|
|
18
15
|
console.log("[Mock] Would print receipt for order:", params.data.order);
|
|
19
16
|
break;
|
|
20
17
|
}
|
|
21
|
-
return {
|
|
18
|
+
return Promise.resolve({
|
|
22
19
|
success: true,
|
|
23
20
|
timestamp: new Date().toISOString(),
|
|
24
21
|
type: params.type
|
|
25
|
-
};
|
|
22
|
+
});
|
|
26
23
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CFActiveOrder } from "../../CommonTypes";
|
|
2
|
-
export type PrintType = "image" | "html" | "
|
|
2
|
+
export type PrintType = "image" | "html" | "receipt";
|
|
3
3
|
export type PrintParams = {
|
|
4
4
|
type: "image";
|
|
5
5
|
data: {
|
|
@@ -12,12 +12,6 @@ export type PrintParams = {
|
|
|
12
12
|
html: string;
|
|
13
13
|
};
|
|
14
14
|
options?: PrintOptions;
|
|
15
|
-
} | {
|
|
16
|
-
type: "selector";
|
|
17
|
-
data: {
|
|
18
|
-
selector: string;
|
|
19
|
-
};
|
|
20
|
-
options?: PrintOptions;
|
|
21
15
|
} | {
|
|
22
16
|
type: "receipt";
|
|
23
17
|
data: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MOCK_CUSTOMERS, mockPublishEvent } from "../../demo/database";
|
|
1
2
|
export const mockRemoveCustomerNote = (params) => {
|
|
2
3
|
console.log("[Mock] removeCustomerNote called", params);
|
|
3
4
|
const noteId = params?.noteId ?? "";
|
|
@@ -5,9 +6,17 @@ export const mockRemoveCustomerNote = (params) => {
|
|
|
5
6
|
if (!noteId) {
|
|
6
7
|
return Promise.resolve({ success: false, noteId, timestamp });
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
noteId
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
for (const customer of MOCK_CUSTOMERS) {
|
|
10
|
+
const before = customer.notes?.length ?? 0;
|
|
11
|
+
const removed = (customer.notes || []).find(n => n._id === noteId);
|
|
12
|
+
customer.notes = (customer.notes || []).filter(n => n._id !== noteId);
|
|
13
|
+
if ((customer.notes?.length ?? 0) !== before) {
|
|
14
|
+
mockPublishEvent("customers", "customer-note-deleted", {
|
|
15
|
+
customer,
|
|
16
|
+
note: removed
|
|
17
|
+
});
|
|
18
|
+
return Promise.resolve({ success: true, noteId, timestamp });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return Promise.resolve({ success: false, noteId, timestamp });
|
|
13
22
|
};
|
package/dist/demo/database.js
CHANGED
|
@@ -202,7 +202,7 @@ export const MOCK_CATEGORY_SPICY = {
|
|
|
202
202
|
parentId: null
|
|
203
203
|
};
|
|
204
204
|
// --- PRODUCTS ---
|
|
205
|
-
const createInventory = (stock) => [{ outletId: MOCK_OUTLET_MAIN.id, stock }];
|
|
205
|
+
const createInventory = (stock) => [{ warehouse: "main", outletId: MOCK_OUTLET_MAIN.id, stock }];
|
|
206
206
|
// Helper for Simple Product
|
|
207
207
|
const createSimpleProduct = (id, name, price, image, categories, description) => {
|
|
208
208
|
const sku = `SKU-${id.toUpperCase()}`;
|
|
@@ -369,10 +369,7 @@ export const MOCK_ORDER_1 = {
|
|
|
369
369
|
metadata: [],
|
|
370
370
|
billing: MOCK_CUSTOMER_1.billing || null,
|
|
371
371
|
shipping: null,
|
|
372
|
-
lineItems: [
|
|
373
|
-
createLineItem(MOCK_PRODUCT_GARLIC, 0, 1),
|
|
374
|
-
createLineItem(MOCK_PRODUCT_BASIL_ALMOND, 0, 1)
|
|
375
|
-
],
|
|
372
|
+
lineItems: [createLineItem(MOCK_PRODUCT_GARLIC, 0, 1), createLineItem(MOCK_PRODUCT_BASIL_ALMOND, 0, 1)],
|
|
376
373
|
customSales: [],
|
|
377
374
|
balance: 0,
|
|
378
375
|
user: MOCK_USER_LUIGI,
|
|
@@ -422,9 +419,7 @@ export const MOCK_ORDER_2 = {
|
|
|
422
419
|
metadata: [],
|
|
423
420
|
billing: null,
|
|
424
421
|
shipping: null,
|
|
425
|
-
lineItems: [
|
|
426
|
-
createLineItem(MOCK_PRODUCT_BEER, 0, 2)
|
|
427
|
-
],
|
|
422
|
+
lineItems: [createLineItem(MOCK_PRODUCT_BEER, 0, 2)],
|
|
428
423
|
customSales: [],
|
|
429
424
|
balance: 0,
|
|
430
425
|
user: MOCK_USER_MARIO,
|
|
@@ -436,20 +431,8 @@ export const MOCK_ORDER_2 = {
|
|
|
436
431
|
export const MOCK_USERS = [MOCK_USER_MARIO, MOCK_USER_LUIGI];
|
|
437
432
|
export const MOCK_STATIONS = [MOCK_STATION_1, MOCK_STATION_2];
|
|
438
433
|
export const MOCK_OUTLETS = [MOCK_OUTLET_MAIN];
|
|
439
|
-
export const MOCK_CUSTOMERS = [
|
|
440
|
-
|
|
441
|
-
MOCK_CUSTOMER_2,
|
|
442
|
-
MOCK_CUSTOMER_3,
|
|
443
|
-
MOCK_CUSTOMER_4,
|
|
444
|
-
MOCK_CUSTOMER_5
|
|
445
|
-
];
|
|
446
|
-
export const MOCK_CATEGORIES = [
|
|
447
|
-
MOCK_CATEGORY_PASTES,
|
|
448
|
-
MOCK_CATEGORY_SPECIALTY,
|
|
449
|
-
MOCK_CATEGORY_BASIC,
|
|
450
|
-
MOCK_CATEGORY_VEGAN,
|
|
451
|
-
MOCK_CATEGORY_SPICY
|
|
452
|
-
];
|
|
434
|
+
export const MOCK_CUSTOMERS = [MOCK_CUSTOMER_1, MOCK_CUSTOMER_2, MOCK_CUSTOMER_3, MOCK_CUSTOMER_4, MOCK_CUSTOMER_5];
|
|
435
|
+
export const MOCK_CATEGORIES = [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN, MOCK_CATEGORY_SPICY];
|
|
453
436
|
export const MOCK_PRODUCTS = [
|
|
454
437
|
MOCK_PRODUCT_BASIL_ALMOND,
|
|
455
438
|
MOCK_PRODUCT_BEER,
|
|
@@ -500,7 +483,8 @@ export const resetMockCart = () => {
|
|
|
500
483
|
};
|
|
501
484
|
};
|
|
502
485
|
function resolveMockOrderCurrency() {
|
|
503
|
-
const
|
|
486
|
+
const settings = MOCK_COMPANY.settings;
|
|
487
|
+
const raw = settings?.currency;
|
|
504
488
|
if (typeof raw === "string" && Object.values(CurrencyCode).includes(raw)) {
|
|
505
489
|
return raw;
|
|
506
490
|
}
|
|
@@ -560,6 +544,7 @@ export const safeSerialize = (data) => {
|
|
|
560
544
|
return JSON.parse(JSON.stringify(data));
|
|
561
545
|
};
|
|
562
546
|
const mockTopicSubscribers = {};
|
|
547
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
563
548
|
export const mockPublishEvent = (topic, eventType, data) => {
|
|
564
549
|
const subscribers = mockTopicSubscribers[topic] || [];
|
|
565
550
|
const event = {
|
|
@@ -669,6 +654,6 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
|
|
|
669
654
|
MOCK_ORDERS.push(newOrder);
|
|
670
655
|
resetMockCart();
|
|
671
656
|
// Publish cart-created event after cart is reset (simulates new empty cart)
|
|
672
|
-
mockPublishEvent(
|
|
657
|
+
mockPublishEvent("cart", "cart-created", {});
|
|
673
658
|
return newOrder;
|
|
674
659
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -228,6 +228,10 @@ export { outletTopic } from "./pubsub/topics/outlet";
|
|
|
228
228
|
export { stationTopic } from "./pubsub/topics/station";
|
|
229
229
|
export { sessionTopic } from "./pubsub/topics/session";
|
|
230
230
|
export { usersTopic } from "./pubsub/topics/users";
|
|
231
|
+
export { variantsTopic } from "./pubsub/topics/variants";
|
|
232
|
+
export { transactionsTopic } from "./pubsub/topics/transactions";
|
|
233
|
+
export { categoriesTopic } from "./pubsub/topics/categories";
|
|
234
|
+
export { attributesTopic } from "./pubsub/topics/attributes";
|
|
231
235
|
export type { CustomerCreatedPayload, CustomerUpdatedPayload, CustomerNoteAddedPayload, CustomerNoteDeletedPayload, CustomerAssignedPayload, CustomerUnassignedPayload, CustomerActiveSetPayload, CustomerActiveGetPayload, CustomerCreatedEvent, CustomerUpdatedEvent, CustomerNoteAddedEvent, CustomerNoteDeletedEvent, CustomerAssignedEvent, CustomerUnassignedEvent, CustomerActiveSetEvent, CustomerActiveGetEvent, CustomersEventType, CustomersEventPayload } from "./pubsub/topics/customers/types";
|
|
232
236
|
export type { OrderCreatedPayload, OrderUpdatedPayload, OrderActiveSetPayload, OrderActiveGetPayload, OrderCreatedEvent, OrderUpdatedEvent, OrderActiveSetEvent, OrderActiveGetEvent, OrderStateTransitionCompletedPayload, OrderStateTransitionBlockedPayload, OrderStateTransitionCompletedEvent, OrderStateTransitionBlockedEvent, OrdersEventType, OrdersEventPayload } from "./pubsub/topics/orders/types";
|
|
233
237
|
export type { RefundCreatedPayload, RefundUpdatedPayload, RefundActiveSetPayload, RefundActiveGetPayload, RefundCreatedEvent, RefundUpdatedEvent, RefundActiveSetEvent, RefundActiveGetEvent, RefundsEventType, RefundsEventPayload } from "./pubsub/topics/refunds/types";
|
|
@@ -235,7 +239,11 @@ export type { ProductCreatedPayload, ProductUpdatedPayload, ProductSetActivePayl
|
|
|
235
239
|
export type { OutletActiveSetPayload, OutletActiveGetPayload, OutletActiveSetEvent, OutletActiveGetEvent, OutletEventType, OutletEventPayload } from "./pubsub/topics/outlet/types";
|
|
236
240
|
export type { StationActiveSetPayload, StationActiveGetPayload, StationActiveSetEvent, StationActiveGetEvent, StationEventType, StationEventPayload } from "./pubsub/topics/station/types";
|
|
237
241
|
export type { SessionActiveSetPayload, SessionActiveGetPayload, SessionActiveSetEvent, SessionActiveGetEvent, SessionEventType, SessionEventPayload } from "./pubsub/topics/session/types";
|
|
238
|
-
export type { UserActiveSetPayload, UserActiveGetPayload, UserActiveSetEvent, UserActiveGetEvent, UsersEventType, UsersEventPayload } from "./pubsub/topics/users/types";
|
|
242
|
+
export type { UserActiveSetPayload, UserActiveGetPayload, UserActiveSetEvent, UserActiveGetEvent, UserCreatedPayload, UserCreatedEvent, UserUpdatedPayload, UserUpdatedEvent, UsersEventType, UsersEventPayload } from "./pubsub/topics/users/types";
|
|
243
|
+
export type { VariantCreatedPayload, VariantCreatedEvent, VariantUpdatedPayload, VariantUpdatedEvent, VariantsEventType, VariantsEventPayload } from "./pubsub/topics/variants/types";
|
|
244
|
+
export type { TransactionCreatedPayload, TransactionCreatedEvent, TransactionUpdatedPayload, TransactionUpdatedEvent, TransactionsEventType, TransactionsEventPayload } from "./pubsub/topics/transactions/types";
|
|
245
|
+
export type { CategoryCreatedPayload, CategoryCreatedEvent, CategoryUpdatedPayload, CategoryUpdatedEvent, CategoriesEventType, CategoriesEventPayload } from "./pubsub/topics/categories/types";
|
|
246
|
+
export type { AttributeCreatedPayload, AttributeCreatedEvent, AttributeUpdatedPayload, AttributeUpdatedEvent, AttributesEventType, AttributesEventPayload } from "./pubsub/topics/attributes/types";
|
|
239
247
|
export type { CartCreatedPayload, CartCustomerAssignedPayload, ProductAddedPayload, ProductDeletedPayload, CartDiscountAddedPayload, CartDiscountRemovedPayload, CartFeeAddedPayload, CartFeeRemovedPayload, ProductDiscountAddedPayload, ProductDiscountRemovedPayload, ProductFeeAddedPayload, ProductFeeRemovedPayload, ProductNoteAddedPayload, ProductNoteRemovedPayload, CartCreatedEvent, CartCustomerAssignedEvent, ProductAddedEvent, ProductDeletedEvent, CartDiscountAddedEvent, CartDiscountRemovedEvent, CartFeeAddedEvent, CartFeeRemovedEvent, ProductDiscountAddedEvent, ProductDiscountRemovedEvent, ProductFeeAddedEvent, ProductFeeRemovedEvent, ProductNoteAddedEvent, ProductNoteRemovedEvent, CartEventType, CartEventPayload } from "./pubsub/topics/cart/types";
|
|
240
248
|
export type { PaymentDonePayload, PaymentErrPayload, PaymentDoneEvent, PaymentErrEvent, PaymentsEventType, PaymentsEventPayload } from "./pubsub/topics/payments/types";
|
|
241
249
|
export type { RowCreatedPayload, RowUpdatedPayload, RowDeletedPayload, RowCreatedEvent, RowUpdatedEvent, RowDeletedEvent, CustomTablesEventType, CustomTablesEventPayload } from "./pubsub/topics/custom-tables/types";
|
package/dist/index.js
CHANGED
|
@@ -276,6 +276,10 @@ export { outletTopic } from "./pubsub/topics/outlet";
|
|
|
276
276
|
export { stationTopic } from "./pubsub/topics/station";
|
|
277
277
|
export { sessionTopic } from "./pubsub/topics/session";
|
|
278
278
|
export { usersTopic } from "./pubsub/topics/users";
|
|
279
|
+
export { variantsTopic } from "./pubsub/topics/variants";
|
|
280
|
+
export { transactionsTopic } from "./pubsub/topics/transactions";
|
|
281
|
+
export { categoriesTopic } from "./pubsub/topics/categories";
|
|
282
|
+
export { attributesTopic } from "./pubsub/topics/attributes";
|
|
279
283
|
// Export Custom Tables Types
|
|
280
284
|
export { AttributeType } from "./common-types/attribute-type";
|
|
281
285
|
// State Machine Fragments
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const attributesTopic = {
|
|
2
|
+
id: "attributes",
|
|
3
|
+
name: "Attributes",
|
|
4
|
+
description: "Topic for product attribute definition changes synced from the database",
|
|
5
|
+
eventTypes: [
|
|
6
|
+
{
|
|
7
|
+
id: "attribute-created",
|
|
8
|
+
name: "Attribute Created",
|
|
9
|
+
description: "Published when a new attribute definition is synced/created"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "attribute-updated",
|
|
13
|
+
name: "Attribute Updated",
|
|
14
|
+
description: "Published when an attribute definition is synced/updated"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
export * from "./types";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./attribute-created/types";
|
|
2
|
+
export * from "./attribute-updated/types";
|
|
3
|
+
import type { AttributeCreatedPayload } from "./attribute-created/types";
|
|
4
|
+
import type { AttributeUpdatedPayload } from "./attribute-updated/types";
|
|
5
|
+
export type AttributesEventPayload = AttributeCreatedPayload | AttributeUpdatedPayload;
|
|
6
|
+
export type AttributesEventType = "attribute-created" | "attribute-updated";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const categoriesTopic = {
|
|
2
|
+
id: "categories",
|
|
3
|
+
name: "Categories",
|
|
4
|
+
description: "Topic for product category changes synced from the database",
|
|
5
|
+
eventTypes: [
|
|
6
|
+
{
|
|
7
|
+
id: "category-created",
|
|
8
|
+
name: "Category Created",
|
|
9
|
+
description: "Published when a new category is synced/created"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "category-updated",
|
|
13
|
+
name: "Category Updated",
|
|
14
|
+
description: "Published when a category is synced/updated"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
export * from "./types";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./category-created/types";
|
|
2
|
+
export * from "./category-updated/types";
|
|
3
|
+
import type { CategoryCreatedPayload } from "./category-created/types";
|
|
4
|
+
import type { CategoryUpdatedPayload } from "./category-updated/types";
|
|
5
|
+
export type CategoriesEventPayload = CategoryCreatedPayload | CategoryUpdatedPayload;
|
|
6
|
+
export type CategoriesEventType = "category-created" | "category-updated";
|
|
@@ -3,7 +3,7 @@ import type { TopicEvent } from "../../../types";
|
|
|
3
3
|
* Payload for print-completed event
|
|
4
4
|
*/
|
|
5
5
|
export interface PrintCompletedPayload {
|
|
6
|
-
type: "image" | "html" | "
|
|
6
|
+
type: "image" | "html" | "receipt";
|
|
7
7
|
orderId?: string;
|
|
8
8
|
globalBlockId?: string;
|
|
9
9
|
}
|
|
@@ -3,7 +3,7 @@ import type { TopicEvent } from "../../../types";
|
|
|
3
3
|
* Payload for print-error event
|
|
4
4
|
*/
|
|
5
5
|
export interface PrintErrorPayload {
|
|
6
|
-
type: "image" | "html" | "
|
|
6
|
+
type: "image" | "html" | "receipt";
|
|
7
7
|
error: string;
|
|
8
8
|
orderId?: string;
|
|
9
9
|
globalBlockId?: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const transactionsTopic = {
|
|
2
|
+
id: "transactions",
|
|
3
|
+
name: "Transactions",
|
|
4
|
+
description: "Topic for payment transaction events",
|
|
5
|
+
eventTypes: [
|
|
6
|
+
{
|
|
7
|
+
id: "transaction-created",
|
|
8
|
+
name: "Transaction Created",
|
|
9
|
+
description: "Published when a new transaction is created"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "transaction-updated",
|
|
13
|
+
name: "Transaction Updated",
|
|
14
|
+
description: "Published when a transaction is updated"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
export * from "./types";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CFTransaction } from "../../../../CommonTypes";
|
|
2
|
+
import type { TopicEvent } from "../../../types";
|
|
3
|
+
export interface TransactionCreatedPayload {
|
|
4
|
+
transaction: CFTransaction;
|
|
5
|
+
}
|
|
6
|
+
export type TransactionCreatedEvent = TopicEvent<TransactionCreatedPayload>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CFTransaction } from "../../../../CommonTypes";
|
|
2
|
+
import type { TopicEvent } from "../../../types";
|
|
3
|
+
export interface TransactionUpdatedPayload {
|
|
4
|
+
transaction: CFTransaction;
|
|
5
|
+
}
|
|
6
|
+
export type TransactionUpdatedEvent = TopicEvent<TransactionUpdatedPayload>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./transaction-created/types";
|
|
2
|
+
export * from "./transaction-updated/types";
|
|
3
|
+
import type { TransactionCreatedPayload } from "./transaction-created/types";
|
|
4
|
+
import type { TransactionUpdatedPayload } from "./transaction-updated/types";
|
|
5
|
+
export type TransactionsEventPayload = TransactionCreatedPayload | TransactionUpdatedPayload;
|
|
6
|
+
export type TransactionsEventType = "transaction-created" | "transaction-updated";
|
|
@@ -10,6 +10,10 @@ import { OutletEventType, OutletEventPayload } from "./outlet/types";
|
|
|
10
10
|
import { StationEventType, StationEventPayload } from "./station/types";
|
|
11
11
|
import { SessionEventType, SessionEventPayload } from "./session/types";
|
|
12
12
|
import { UsersEventType, UsersEventPayload } from "./users/types";
|
|
13
|
+
import { VariantsEventType, VariantsEventPayload } from "./variants/types";
|
|
14
|
+
import { TransactionsEventType, TransactionsEventPayload } from "./transactions/types";
|
|
15
|
+
import { CategoriesEventType, CategoriesEventPayload } from "./categories/types";
|
|
16
|
+
import { AttributesEventType, AttributesEventPayload } from "./attributes/types";
|
|
13
17
|
export interface TopicEventPayloadMap {
|
|
14
18
|
customers: Record<CustomersEventType, CustomersEventPayload>;
|
|
15
19
|
orders: Record<OrdersEventType, OrdersEventPayload>;
|
|
@@ -23,4 +27,8 @@ export interface TopicEventPayloadMap {
|
|
|
23
27
|
station: Record<StationEventType, StationEventPayload>;
|
|
24
28
|
session: Record<SessionEventType, SessionEventPayload>;
|
|
25
29
|
users: Record<UsersEventType, UsersEventPayload>;
|
|
30
|
+
variants: Record<VariantsEventType, VariantsEventPayload>;
|
|
31
|
+
transactions: Record<TransactionsEventType, TransactionsEventPayload>;
|
|
32
|
+
categories: Record<CategoriesEventType, CategoriesEventPayload>;
|
|
33
|
+
attributes: Record<AttributesEventType, AttributesEventPayload>;
|
|
26
34
|
}
|
|
@@ -12,6 +12,16 @@ export const usersTopic = {
|
|
|
12
12
|
id: "get-active-user",
|
|
13
13
|
name: "Get Active User",
|
|
14
14
|
description: "Published when the active user is published to listeners"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "user-created",
|
|
18
|
+
name: "User Created",
|
|
19
|
+
description: "Published when a new user record is synced/created in the database"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "user-updated",
|
|
23
|
+
name: "User Updated",
|
|
24
|
+
description: "Published when any user record is synced/updated in the database"
|
|
15
25
|
}
|
|
16
26
|
]
|
|
17
27
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export * from "./set-active-user/types";
|
|
2
2
|
export * from "./get-active-user/types";
|
|
3
|
+
export * from "./user-created/types";
|
|
4
|
+
export * from "./user-updated/types";
|
|
3
5
|
import type { UserActiveSetPayload } from "./set-active-user/types";
|
|
4
6
|
import type { UserActiveGetPayload } from "./get-active-user/types";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
import type { UserCreatedPayload } from "./user-created/types";
|
|
8
|
+
import type { UserUpdatedPayload } from "./user-updated/types";
|
|
9
|
+
export type UsersEventPayload = UserActiveSetPayload | UserActiveGetPayload | UserCreatedPayload | UserUpdatedPayload;
|
|
10
|
+
export type UsersEventType = "set-active-user" | "get-active-user" | "user-created" | "user-updated";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const variantsTopic = {
|
|
2
|
+
id: "variants",
|
|
3
|
+
name: "Variants",
|
|
4
|
+
description: "Topic for product variant changes synced from the database",
|
|
5
|
+
eventTypes: [
|
|
6
|
+
{
|
|
7
|
+
id: "variant-created",
|
|
8
|
+
name: "Variant Created",
|
|
9
|
+
description: "Published when a new product variant is synced/created"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "variant-updated",
|
|
13
|
+
name: "Variant Updated",
|
|
14
|
+
description: "Published when a product variant is synced/updated"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
export * from "./types";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./variant-created/types";
|
|
2
|
+
export * from "./variant-updated/types";
|
|
3
|
+
import type { VariantCreatedPayload } from "./variant-created/types";
|
|
4
|
+
import type { VariantUpdatedPayload } from "./variant-updated/types";
|
|
5
|
+
export type VariantsEventPayload = VariantCreatedPayload | VariantUpdatedPayload;
|
|
6
|
+
export type VariantsEventType = "variant-created" | "variant-updated";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|