rerobe-js-orm 4.0.9 → 4.1.0
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/lib/factories/Order/OrderFromFormState.js +2 -2
- package/lib/models/Merchant.d.ts +1 -0
- package/lib/models/Merchant.js +6 -0
- package/lib/models/Order.d.ts +2 -1
- package/lib/models/Order.js +4 -4
- package/lib/models/ProductStateManager.d.ts +17 -10
- package/lib/models/ProductStateManager.js +46 -320
- package/lib/types/merchant-types.d.ts +1 -0
- package/lib/types/rerobe-order-types.d.ts +5 -1
- package/package.json +1 -1
|
@@ -104,8 +104,8 @@ class OrderFromFormState extends OrderFactory_1.default {
|
|
|
104
104
|
paymentIntentObj: (_0 = fs.props) === null || _0 === void 0 ? void 0 : _0.paymentIntentObj,
|
|
105
105
|
})), (((_1 = fs.props) === null || _1 === void 0 ? void 0 : _1.paymentIntentId) && {
|
|
106
106
|
paymentIntentId: (_2 = fs.props) === null || _2 === void 0 ? void 0 : _2.paymentIntentId,
|
|
107
|
-
})), (((_3 = fs.props) === null || _3 === void 0 ? void 0 : _3.
|
|
108
|
-
|
|
107
|
+
})), (((_3 = fs.props) === null || _3 === void 0 ? void 0 : _3.receiptLog) && {
|
|
108
|
+
receiptLog: (_4 = fs.props) === null || _4 === void 0 ? void 0 : _4.receiptLog,
|
|
109
109
|
})), (((_5 = fs.props) === null || _5 === void 0 ? void 0 : _5.channelPartnerOrderId) && {
|
|
110
110
|
channelPartnerOrderId: (_6 = fs.props) === null || _6 === void 0 ? void 0 : _6.channelPartnerOrderId,
|
|
111
111
|
}));
|
package/lib/models/Merchant.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export default class Merchant extends Base {
|
|
|
88
88
|
stripeRegion?: string;
|
|
89
89
|
hasAutomatedPayouts?: boolean;
|
|
90
90
|
hasAIQuickList?: boolean;
|
|
91
|
+
hasReceiptPrinter?: boolean;
|
|
91
92
|
constructor(props?: any);
|
|
92
93
|
toObj(): MerchantObj;
|
|
93
94
|
toMerchantMutableData(): MerchantMutableData;
|
package/lib/models/Merchant.js
CHANGED
|
@@ -68,6 +68,9 @@ class Merchant extends Base_1.default {
|
|
|
68
68
|
if (props === null || props === void 0 ? void 0 : props.hasAIQuickList) {
|
|
69
69
|
this.hasAIQuickList = props.hasAIQuickList;
|
|
70
70
|
}
|
|
71
|
+
if (props === null || props === void 0 ? void 0 : props.hasReceiptPrinter) {
|
|
72
|
+
this.hasReceiptPrinter = props.hasReceiptPrinter;
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
toObj() {
|
|
73
76
|
const mObj = {
|
|
@@ -119,6 +122,9 @@ class Merchant extends Base_1.default {
|
|
|
119
122
|
if (this.hasAIQuickList) {
|
|
120
123
|
mObj.hasAIQuickList = this.hasAIQuickList;
|
|
121
124
|
}
|
|
125
|
+
if (this.hasReceiptPrinter) {
|
|
126
|
+
mObj.hasReceiptPrinter = this.hasReceiptPrinter;
|
|
127
|
+
}
|
|
122
128
|
return mObj;
|
|
123
129
|
}
|
|
124
130
|
toMerchantMutableData() {
|
package/lib/models/Order.d.ts
CHANGED
|
@@ -109,7 +109,8 @@ export default class Order extends Base {
|
|
|
109
109
|
zettleTransactionObj?: ZettleTransactionObj;
|
|
110
110
|
paymentIntentObj?: any;
|
|
111
111
|
paymentIntentId?: string;
|
|
112
|
-
|
|
112
|
+
receiptPrinted?: boolean;
|
|
113
|
+
receiptLog?: ReceiptLog;
|
|
113
114
|
channelPartnerOrderId?: string;
|
|
114
115
|
constructor(props?: any);
|
|
115
116
|
toObj(): ReRobeOrderObj;
|
package/lib/models/Order.js
CHANGED
|
@@ -138,8 +138,8 @@ class Order extends Base_1.default {
|
|
|
138
138
|
if (props === null || props === void 0 ? void 0 : props.paymentIntentId) {
|
|
139
139
|
this.paymentIntentId = props.paymentIntentId;
|
|
140
140
|
}
|
|
141
|
-
if (props === null || props === void 0 ? void 0 : props.
|
|
142
|
-
this.
|
|
141
|
+
if (props === null || props === void 0 ? void 0 : props.receiptLog) {
|
|
142
|
+
this.receiptLog = props.receiptLog;
|
|
143
143
|
}
|
|
144
144
|
if (props === null || props === void 0 ? void 0 : props.channelPartnerOrderId) {
|
|
145
145
|
this.channelPartnerOrderId = props.channelPartnerOrderId;
|
|
@@ -229,8 +229,8 @@ class Order extends Base_1.default {
|
|
|
229
229
|
if (this.paymentIntentId) {
|
|
230
230
|
orderObj.paymentIntentId = this.paymentIntentId;
|
|
231
231
|
}
|
|
232
|
-
if (this.
|
|
233
|
-
orderObj.
|
|
232
|
+
if (this.receiptLog) {
|
|
233
|
+
orderObj.receiptLog = this.receiptLog;
|
|
234
234
|
}
|
|
235
235
|
if (this.channelPartnerOrderId) {
|
|
236
236
|
orderObj.channelPartnerOrderId = this.channelPartnerOrderId;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import Base from '../Base';
|
|
2
|
+
import { PRODUCT_STATES } from '../constants/product-constants';
|
|
3
|
+
type ProductStateKey = keyof typeof PRODUCT_STATES;
|
|
4
|
+
interface ProductState {
|
|
5
|
+
target: ProductStateManager;
|
|
6
|
+
initialize(target: ProductStateManager): void;
|
|
7
|
+
toState(stateKey: ProductStateKey): void;
|
|
8
|
+
changeTo(newState: ProductState): void;
|
|
9
|
+
getVal(): string;
|
|
10
|
+
}
|
|
2
11
|
export default class ProductStateManager extends Base {
|
|
3
12
|
static PRODUCT_STATES: {
|
|
4
13
|
archived: string;
|
|
@@ -32,18 +41,16 @@ export default class ProductStateManager extends Base {
|
|
|
32
41
|
reserved: string;
|
|
33
42
|
};
|
|
34
43
|
state: ProductState;
|
|
35
|
-
states:
|
|
44
|
+
states: Record<ProductStateKey, ProductState>;
|
|
36
45
|
constructor();
|
|
46
|
+
createState(name: string): ProductState;
|
|
37
47
|
changeState(state: ProductState): void;
|
|
38
|
-
updateSelf(productPartial:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
toShoppingBag(): void;
|
|
44
|
-
toReservationQueue(): void;
|
|
45
|
-
toSold(): void;
|
|
46
|
-
toAvailableInStore(): void;
|
|
48
|
+
updateSelf(productPartial: {
|
|
49
|
+
reservedBy?: string[];
|
|
50
|
+
status?: string;
|
|
51
|
+
}, shoppingSessionId: string): void;
|
|
52
|
+
toState(stateKey: ProductStateKey): void;
|
|
47
53
|
getVal(): string;
|
|
48
54
|
inReservedBy(): boolean;
|
|
49
55
|
}
|
|
56
|
+
export {};
|
|
@@ -5,281 +5,35 @@ const product_constants_1 = require("../constants/product-constants");
|
|
|
5
5
|
class ProductStateManager extends Base_1.default {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
|
-
this.states = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
toReserved() {
|
|
24
|
-
this.target.changeState(this.target.states.reserved);
|
|
25
|
-
},
|
|
26
|
-
toShoppingBag() {
|
|
27
|
-
this.target.changeState(this.target.states.shoppingBag);
|
|
28
|
-
},
|
|
29
|
-
toReservationQueue() {
|
|
30
|
-
this.target.changeState(this.target.states.reservationQueue);
|
|
31
|
-
},
|
|
32
|
-
toSold() {
|
|
33
|
-
this.target.changeState(this.target.states.sold);
|
|
34
|
-
},
|
|
35
|
-
toAvailableInStore() {
|
|
36
|
-
this.target.changeState(this.target.states.availableInStore);
|
|
37
|
-
},
|
|
38
|
-
getVal() {
|
|
39
|
-
return ProductStateManager.PRODUCT_STATES.loading;
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
listed: {
|
|
43
|
-
target: this,
|
|
44
|
-
initialize(target) {
|
|
45
|
-
this.target = target;
|
|
46
|
-
},
|
|
47
|
-
toLoading() {
|
|
48
|
-
this.target.changeState(this.target.states.loading);
|
|
49
|
-
},
|
|
50
|
-
toListed() {
|
|
51
|
-
// ('already in listed state');
|
|
52
|
-
},
|
|
53
|
-
toClearance() {
|
|
54
|
-
this.target.changeState(this.target.states.clearance);
|
|
55
|
-
},
|
|
56
|
-
toReserved() {
|
|
57
|
-
this.target.changeState(this.target.states.reserved);
|
|
58
|
-
},
|
|
59
|
-
toShoppingBag() {
|
|
60
|
-
this.target.changeState(this.target.states.shoppingBag);
|
|
61
|
-
},
|
|
62
|
-
toReservationQueue() {
|
|
63
|
-
this.target.changeState(this.target.states.reservationQueue);
|
|
64
|
-
},
|
|
65
|
-
toSold() {
|
|
66
|
-
this.target.changeState(this.target.states.sold);
|
|
67
|
-
},
|
|
68
|
-
toAvailableInStore() {
|
|
69
|
-
this.target.changeState(this.target.states.availableInStore);
|
|
70
|
-
},
|
|
71
|
-
getVal() {
|
|
72
|
-
return ProductStateManager.PRODUCT_STATES.listed;
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
clearance: {
|
|
76
|
-
target: this,
|
|
77
|
-
initialize(target) {
|
|
78
|
-
this.target = target;
|
|
79
|
-
},
|
|
80
|
-
toLoading() {
|
|
81
|
-
this.target.changeState(this.target.states.loading);
|
|
82
|
-
},
|
|
83
|
-
toListed() {
|
|
84
|
-
this.target.changeState(this.target.states.listed);
|
|
85
|
-
},
|
|
86
|
-
toClearance() {
|
|
87
|
-
// ('already in listed state');
|
|
88
|
-
},
|
|
89
|
-
toReserved() {
|
|
90
|
-
this.target.changeState(this.target.states.reserved);
|
|
91
|
-
},
|
|
92
|
-
toShoppingBag() {
|
|
93
|
-
this.target.changeState(this.target.states.shoppingBag);
|
|
94
|
-
},
|
|
95
|
-
toReservationQueue() {
|
|
96
|
-
this.target.changeState(this.target.states.reservationQueue);
|
|
97
|
-
},
|
|
98
|
-
toSold() {
|
|
99
|
-
this.target.changeState(this.target.states.sold);
|
|
100
|
-
},
|
|
101
|
-
toAvailableInStore() {
|
|
102
|
-
this.target.changeState(this.target.states.availableInStore);
|
|
103
|
-
},
|
|
104
|
-
getVal() {
|
|
105
|
-
return ProductStateManager.PRODUCT_STATES.listed;
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
reserved: {
|
|
109
|
-
target: this,
|
|
110
|
-
initialize(target) {
|
|
111
|
-
this.target = target;
|
|
112
|
-
},
|
|
113
|
-
toLoading() {
|
|
114
|
-
this.target.changeState(this.target.states.loading);
|
|
115
|
-
},
|
|
116
|
-
toListed() {
|
|
117
|
-
this.target.changeState(this.target.states.listed);
|
|
118
|
-
},
|
|
119
|
-
toClearance() {
|
|
120
|
-
this.target.changeState(this.target.states.clearance);
|
|
121
|
-
},
|
|
122
|
-
toReserved() {
|
|
123
|
-
// console.log('already in reserved state');
|
|
124
|
-
},
|
|
125
|
-
toShoppingBag() {
|
|
126
|
-
this.target.changeState(this.target.states.shoppingBag);
|
|
127
|
-
},
|
|
128
|
-
toReservationQueue() {
|
|
129
|
-
this.target.changeState(this.target.states.reservationQueue);
|
|
130
|
-
},
|
|
131
|
-
toSold() {
|
|
132
|
-
this.target.changeState(this.target.states.sold);
|
|
133
|
-
},
|
|
134
|
-
toAvailableInStore() {
|
|
135
|
-
this.target.changeState(this.target.states.availableInStore);
|
|
136
|
-
},
|
|
137
|
-
getVal() {
|
|
138
|
-
return ProductStateManager.PRODUCT_STATES.reserved;
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
shoppingBag: {
|
|
142
|
-
target: this,
|
|
143
|
-
initialize(target) {
|
|
144
|
-
this.target = target;
|
|
145
|
-
},
|
|
146
|
-
toLoading() {
|
|
147
|
-
this.target.changeState(this.target.states.loading);
|
|
148
|
-
},
|
|
149
|
-
toListed() {
|
|
150
|
-
this.target.changeState(this.target.states.listed);
|
|
151
|
-
},
|
|
152
|
-
toClearance() {
|
|
153
|
-
this.target.changeState(this.target.states.clearance);
|
|
154
|
-
},
|
|
155
|
-
toReserved() {
|
|
156
|
-
this.target.changeState(this.target.states.reserved);
|
|
157
|
-
},
|
|
158
|
-
toShoppingBag() {
|
|
159
|
-
// console.log('already in shoppingBag');
|
|
160
|
-
},
|
|
161
|
-
toReservationQueue() {
|
|
162
|
-
this.target.changeState(this.target.states.reservationQueue);
|
|
163
|
-
},
|
|
164
|
-
toSold() {
|
|
165
|
-
this.target.changeState(this.target.states.sold);
|
|
166
|
-
},
|
|
167
|
-
toAvailableInStore() {
|
|
168
|
-
this.target.changeState(this.target.states.availableInStore);
|
|
169
|
-
},
|
|
170
|
-
getVal() {
|
|
171
|
-
return ProductStateManager.PRODUCT_STATES.shoppingBag;
|
|
172
|
-
},
|
|
8
|
+
this.states = Object.keys(product_constants_1.PRODUCT_STATES).reduce((states, key) => {
|
|
9
|
+
const typedKey = key; // Ensure TypeScript understands this is a valid key
|
|
10
|
+
states[typedKey] = this.createState(product_constants_1.PRODUCT_STATES[typedKey]);
|
|
11
|
+
return states;
|
|
12
|
+
}, {});
|
|
13
|
+
Object.values(this.states).forEach((state) => state.initialize(this));
|
|
14
|
+
this.state = this.states.loading;
|
|
15
|
+
}
|
|
16
|
+
createState(name) {
|
|
17
|
+
const manager = this;
|
|
18
|
+
return {
|
|
19
|
+
target: manager,
|
|
20
|
+
initialize(target) {
|
|
21
|
+
this.target = target;
|
|
173
22
|
},
|
|
174
|
-
|
|
175
|
-
target
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
},
|
|
179
|
-
toLoading() {
|
|
180
|
-
this.target.changeState(this.target.states.loading);
|
|
181
|
-
},
|
|
182
|
-
toListed() {
|
|
183
|
-
this.target.changeState(this.target.states.listed);
|
|
184
|
-
},
|
|
185
|
-
toClearance() {
|
|
186
|
-
this.target.changeState(this.target.states.clearance);
|
|
187
|
-
},
|
|
188
|
-
toReserved() {
|
|
189
|
-
this.target.changeState(this.target.states.reserved);
|
|
190
|
-
},
|
|
191
|
-
toShoppingBag() {
|
|
192
|
-
this.target.changeState(this.target.states.shoppingBag);
|
|
193
|
-
},
|
|
194
|
-
toReservationQueue() {
|
|
195
|
-
// console.log('already in reservation queue');
|
|
196
|
-
},
|
|
197
|
-
toSold() {
|
|
198
|
-
this.target.changeState(this.target.states.sold);
|
|
199
|
-
},
|
|
200
|
-
toAvailableInStore() {
|
|
201
|
-
this.target.changeState(this.target.states.availableInStore);
|
|
202
|
-
},
|
|
203
|
-
getVal() {
|
|
204
|
-
return ProductStateManager.PRODUCT_STATES.reservationQueue;
|
|
205
|
-
},
|
|
23
|
+
changeTo(newState) {
|
|
24
|
+
if (this.target.state !== newState) {
|
|
25
|
+
this.target.state = newState;
|
|
26
|
+
}
|
|
206
27
|
},
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
this.
|
|
211
|
-
},
|
|
212
|
-
toLoading() {
|
|
213
|
-
this.target.changeState(this.target.states.loading);
|
|
214
|
-
},
|
|
215
|
-
toListed() {
|
|
216
|
-
// console.log('restricted state change');
|
|
217
|
-
},
|
|
218
|
-
toClearance() {
|
|
219
|
-
// console.log('restricted state change');
|
|
220
|
-
},
|
|
221
|
-
toReserved() {
|
|
222
|
-
// console.log('restricted state change');
|
|
223
|
-
},
|
|
224
|
-
toShoppingBag() {
|
|
225
|
-
// console.log('restricted state change');
|
|
226
|
-
},
|
|
227
|
-
toReservationQueue() {
|
|
228
|
-
// console.log('restricted state change');
|
|
229
|
-
},
|
|
230
|
-
toSold() {
|
|
231
|
-
// console.log('already in reserved state');
|
|
232
|
-
},
|
|
233
|
-
toAvailableInStore() {
|
|
234
|
-
// console.log('restricted state change');
|
|
235
|
-
},
|
|
236
|
-
getVal() {
|
|
237
|
-
return ProductStateManager.PRODUCT_STATES.sold;
|
|
238
|
-
},
|
|
28
|
+
toState(stateKey) {
|
|
29
|
+
const newState = this.target.states[stateKey];
|
|
30
|
+
if (newState)
|
|
31
|
+
this.changeTo(newState);
|
|
239
32
|
},
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
initialize(target) {
|
|
243
|
-
this.target = target;
|
|
244
|
-
},
|
|
245
|
-
toLoading() {
|
|
246
|
-
this.target.changeState(this.target.states.loading);
|
|
247
|
-
},
|
|
248
|
-
toListed() {
|
|
249
|
-
this.target.changeState(this.target.states.listed);
|
|
250
|
-
},
|
|
251
|
-
toClearance() {
|
|
252
|
-
this.target.changeState(this.target.states.clearance);
|
|
253
|
-
},
|
|
254
|
-
toReserved() {
|
|
255
|
-
this.target.changeState(this.target.states.reserved);
|
|
256
|
-
},
|
|
257
|
-
toShoppingBag() {
|
|
258
|
-
this.target.changeState(this.target.states.shoppingBag);
|
|
259
|
-
},
|
|
260
|
-
toReservationQueue() {
|
|
261
|
-
this.target.changeState(this.target.states.reservationQueue);
|
|
262
|
-
},
|
|
263
|
-
toSold() {
|
|
264
|
-
this.target.changeState(this.target.states.sold);
|
|
265
|
-
},
|
|
266
|
-
toAvailableInStore() {
|
|
267
|
-
// console.log('already in availableInStore state');
|
|
268
|
-
},
|
|
269
|
-
getVal() {
|
|
270
|
-
return ProductStateManager.PRODUCT_STATES.availableInStore;
|
|
271
|
-
},
|
|
33
|
+
getVal() {
|
|
34
|
+
return name;
|
|
272
35
|
},
|
|
273
36
|
};
|
|
274
|
-
this.states.loading.initialize(this);
|
|
275
|
-
this.states.listed.initialize(this);
|
|
276
|
-
this.states.clearance.initialize(this);
|
|
277
|
-
this.states.reserved.initialize(this);
|
|
278
|
-
this.states.shoppingBag.initialize(this);
|
|
279
|
-
this.states.reservationQueue.initialize(this);
|
|
280
|
-
this.states.sold.initialize(this);
|
|
281
|
-
this.states.availableInStore.initialize(this);
|
|
282
|
-
this.state = this.states.loading;
|
|
283
37
|
}
|
|
284
38
|
changeState(state) {
|
|
285
39
|
if (this.state !== state) {
|
|
@@ -288,68 +42,40 @@ class ProductStateManager extends Base_1.default {
|
|
|
288
42
|
}
|
|
289
43
|
updateSelf(productPartial, shoppingSessionId) {
|
|
290
44
|
const { reservedBy, status } = productPartial;
|
|
291
|
-
if (status
|
|
292
|
-
return this.state.
|
|
45
|
+
if (status === null || status === void 0 ? void 0 : status.includes(product_constants_1.PRODUCT_STATES.sold)) {
|
|
46
|
+
return this.state.toState('sold');
|
|
293
47
|
}
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
if (
|
|
297
|
-
return this.state.
|
|
48
|
+
if (Array.isArray(reservedBy) && reservedBy.length > 0) {
|
|
49
|
+
const firstReserved = reservedBy[0];
|
|
50
|
+
if (firstReserved === 'RESERVED_IN_STORE') {
|
|
51
|
+
return this.state.toState('availableInStore');
|
|
298
52
|
}
|
|
299
|
-
if (
|
|
300
|
-
return this.state.
|
|
53
|
+
if (firstReserved === shoppingSessionId) {
|
|
54
|
+
return this.state.toState('shoppingBag');
|
|
301
55
|
}
|
|
302
|
-
if (reservedBy.includes(shoppingSessionId)
|
|
303
|
-
return this.state.
|
|
56
|
+
if (reservedBy.includes(shoppingSessionId)) {
|
|
57
|
+
return this.state.toState('reservationQueue');
|
|
304
58
|
}
|
|
305
|
-
return this.state.
|
|
306
|
-
}
|
|
307
|
-
if (status.includes(ProductStateManager.PRODUCT_STATES.reserved)) {
|
|
308
|
-
return this.state.toReserved();
|
|
309
|
-
}
|
|
310
|
-
if (status.includes(ProductStateManager.PRODUCT_STATES.clearance)) {
|
|
311
|
-
return this.state.toClearance();
|
|
59
|
+
return this.state.toState('reserved');
|
|
312
60
|
}
|
|
313
|
-
if (status
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
61
|
+
if (status) {
|
|
62
|
+
for (const [key, value] of Object.entries(product_constants_1.PRODUCT_STATES)) {
|
|
63
|
+
if (status.includes(value)) {
|
|
64
|
+
return this.state.toState(key);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
318
67
|
}
|
|
319
|
-
return this.state.
|
|
320
|
-
}
|
|
321
|
-
toLoading() {
|
|
322
|
-
this.state.toLoading();
|
|
323
|
-
}
|
|
324
|
-
toListed() {
|
|
325
|
-
this.state.toListed();
|
|
326
|
-
}
|
|
327
|
-
toClearance() {
|
|
328
|
-
this.state.toClearance();
|
|
329
|
-
}
|
|
330
|
-
toReserved() {
|
|
331
|
-
this.state.toReserved();
|
|
332
|
-
}
|
|
333
|
-
toShoppingBag() {
|
|
334
|
-
this.state.toShoppingBag();
|
|
335
|
-
}
|
|
336
|
-
toReservationQueue() {
|
|
337
|
-
this.state.toReservationQueue();
|
|
338
|
-
}
|
|
339
|
-
toSold() {
|
|
340
|
-
this.state.toSold();
|
|
68
|
+
return this.state.toState('sold');
|
|
341
69
|
}
|
|
342
|
-
|
|
343
|
-
this.state.
|
|
70
|
+
toState(stateKey) {
|
|
71
|
+
this.state.toState(stateKey);
|
|
344
72
|
}
|
|
345
73
|
getVal() {
|
|
346
74
|
var _a;
|
|
347
|
-
return ((_a = this.state) === null || _a === void 0 ? void 0 : _a.getVal()) ||
|
|
75
|
+
return ((_a = this.state) === null || _a === void 0 ? void 0 : _a.getVal()) || product_constants_1.PRODUCT_STATES.loading;
|
|
348
76
|
}
|
|
349
77
|
inReservedBy() {
|
|
350
|
-
|
|
351
|
-
return (((_a = this.state) === null || _a === void 0 ? void 0 : _a.getVal()) === ProductStateManager.PRODUCT_STATES.shoppingBag ||
|
|
352
|
-
((_b = this.state) === null || _b === void 0 ? void 0 : _b.getVal()) === ProductStateManager.PRODUCT_STATES.reservationQueue);
|
|
78
|
+
return (this.state.getVal() === product_constants_1.PRODUCT_STATES.shoppingBag || this.state.getVal() === product_constants_1.PRODUCT_STATES.reservationQueue);
|
|
353
79
|
}
|
|
354
80
|
}
|
|
355
81
|
exports.default = ProductStateManager;
|
|
@@ -44,6 +44,7 @@ type MerchantSystemOnlyMutableData = {
|
|
|
44
44
|
stripeRegion?: string;
|
|
45
45
|
hasAutomatedPayouts?: boolean;
|
|
46
46
|
hasAIQuickList?: boolean;
|
|
47
|
+
hasReceiptPrinter?: boolean;
|
|
47
48
|
};
|
|
48
49
|
type MerchantObj = MerchantMutableData & MerchantSystemOnlyMutableData;
|
|
49
50
|
type MerchantTypes = 'INDIVIDUAL' | 'BUSINESS';
|
|
@@ -76,6 +76,10 @@ type ReceiptObj = {
|
|
|
76
76
|
};
|
|
77
77
|
additionalInfo: string;
|
|
78
78
|
} & ReceiptLabelsAndPaymentTerminalInfo;
|
|
79
|
+
type ReceiptLog = {
|
|
80
|
+
createdAtTimestamp: number;
|
|
81
|
+
posId: string;
|
|
82
|
+
};
|
|
79
83
|
type ReRobeOrderObj = {
|
|
80
84
|
id: string;
|
|
81
85
|
appliedDiscount: AppliedDiscount;
|
|
@@ -146,7 +150,7 @@ type ReRobeOrderObj = {
|
|
|
146
150
|
zettleTransactionObj?: ZettleTransactionObj;
|
|
147
151
|
paymentIntentObj?: any;
|
|
148
152
|
paymentIntentId?: string;
|
|
149
|
-
|
|
153
|
+
receiptLog?: ReceiptLog;
|
|
150
154
|
channelPartnerOrderId?: string;
|
|
151
155
|
};
|
|
152
156
|
type OrderWithRefundsAndFulfillmentsInfoObj = {
|