@open-tender/store 1.0.1 → 1.0.3
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/.DS_Store +0 -0
- package/dist/cjs/slices/checkout.js +10 -20
- package/dist/esm/slices/checkout.js +10 -20
- package/package.json +1 -1
package/dist/.DS_Store
CHANGED
|
Binary file
|
|
@@ -469,23 +469,18 @@ var checkoutSlice = (0, toolkit_1.createSlice)({
|
|
|
469
469
|
},
|
|
470
470
|
addGiftCard: function (state, action) {
|
|
471
471
|
state.giftCards.push(action.payload);
|
|
472
|
-
state.check = null;
|
|
473
472
|
},
|
|
474
473
|
removeGiftCard: function (state, action) {
|
|
475
474
|
state.giftCards = state.giftCards.filter(function (i) { return i.code !== action.payload; });
|
|
476
|
-
state.check = null;
|
|
477
475
|
},
|
|
478
476
|
addSurcharge: function (state, action) {
|
|
479
477
|
state.surcharges.push(action.payload);
|
|
480
|
-
state.check = null;
|
|
481
478
|
},
|
|
482
479
|
removeSurcharge: function (state, action) {
|
|
483
480
|
state.surcharges = state.surcharges.filter(function (i) { return i.id !== action.payload; });
|
|
484
|
-
state.check = null;
|
|
485
481
|
},
|
|
486
482
|
addDiscount: function (state, action) {
|
|
487
483
|
state.discounts.push(action.payload);
|
|
488
|
-
state.check = null;
|
|
489
484
|
},
|
|
490
485
|
removeDiscount: function (state, action) {
|
|
491
486
|
var discount = state.check
|
|
@@ -497,27 +492,21 @@ var checkoutSlice = (0, toolkit_1.createSlice)({
|
|
|
497
492
|
else {
|
|
498
493
|
state.discounts = state.discounts.filter(function (i) { return i.id !== action.payload; });
|
|
499
494
|
}
|
|
500
|
-
state.check = null;
|
|
501
495
|
},
|
|
502
496
|
addTax: function (state, action) {
|
|
503
497
|
state.taxes.push(action.payload);
|
|
504
|
-
state.check = null;
|
|
505
498
|
},
|
|
506
499
|
removeTax: function (state, action) {
|
|
507
500
|
state.taxes = state.taxes.filter(function (i) { return i.id !== action.payload; });
|
|
508
|
-
state.check = null;
|
|
509
501
|
},
|
|
510
502
|
addTip: function (state, action) {
|
|
511
503
|
state.tip = action.payload;
|
|
512
|
-
state.check = null;
|
|
513
504
|
},
|
|
514
505
|
removeTip: function (state) {
|
|
515
506
|
state.tip = null;
|
|
516
|
-
state.check = null;
|
|
517
507
|
},
|
|
518
508
|
setTaxExempt: function (state, action) {
|
|
519
509
|
state.isTaxExempt = action.payload;
|
|
520
|
-
state.check = null;
|
|
521
510
|
},
|
|
522
511
|
addCustomer: function (state, action) {
|
|
523
512
|
state.customer = action.payload;
|
|
@@ -625,15 +614,16 @@ var checkoutSlice = (0, toolkit_1.createSlice)({
|
|
|
625
614
|
state.error = action.payload;
|
|
626
615
|
})
|
|
627
616
|
.addCase(exports.submitPosOrder.fulfilled, function (state, action) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
617
|
+
if (action.payload) {
|
|
618
|
+
return tslib_1.__assign(tslib_1.__assign({}, initialState), { completedOrder: action.payload });
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
state.check = null;
|
|
622
|
+
state.error = null;
|
|
623
|
+
state.loading = 'idle';
|
|
624
|
+
state.submitting = 'idle';
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
637
627
|
})
|
|
638
628
|
.addCase(exports.submitPosOrder.pending, function (state) {
|
|
639
629
|
state.loading = 'pending';
|
|
@@ -466,23 +466,18 @@ var checkoutSlice = createSlice({
|
|
|
466
466
|
},
|
|
467
467
|
addGiftCard: function (state, action) {
|
|
468
468
|
state.giftCards.push(action.payload);
|
|
469
|
-
state.check = null;
|
|
470
469
|
},
|
|
471
470
|
removeGiftCard: function (state, action) {
|
|
472
471
|
state.giftCards = state.giftCards.filter(function (i) { return i.code !== action.payload; });
|
|
473
|
-
state.check = null;
|
|
474
472
|
},
|
|
475
473
|
addSurcharge: function (state, action) {
|
|
476
474
|
state.surcharges.push(action.payload);
|
|
477
|
-
state.check = null;
|
|
478
475
|
},
|
|
479
476
|
removeSurcharge: function (state, action) {
|
|
480
477
|
state.surcharges = state.surcharges.filter(function (i) { return i.id !== action.payload; });
|
|
481
|
-
state.check = null;
|
|
482
478
|
},
|
|
483
479
|
addDiscount: function (state, action) {
|
|
484
480
|
state.discounts.push(action.payload);
|
|
485
|
-
state.check = null;
|
|
486
481
|
},
|
|
487
482
|
removeDiscount: function (state, action) {
|
|
488
483
|
var discount = state.check
|
|
@@ -494,27 +489,21 @@ var checkoutSlice = createSlice({
|
|
|
494
489
|
else {
|
|
495
490
|
state.discounts = state.discounts.filter(function (i) { return i.id !== action.payload; });
|
|
496
491
|
}
|
|
497
|
-
state.check = null;
|
|
498
492
|
},
|
|
499
493
|
addTax: function (state, action) {
|
|
500
494
|
state.taxes.push(action.payload);
|
|
501
|
-
state.check = null;
|
|
502
495
|
},
|
|
503
496
|
removeTax: function (state, action) {
|
|
504
497
|
state.taxes = state.taxes.filter(function (i) { return i.id !== action.payload; });
|
|
505
|
-
state.check = null;
|
|
506
498
|
},
|
|
507
499
|
addTip: function (state, action) {
|
|
508
500
|
state.tip = action.payload;
|
|
509
|
-
state.check = null;
|
|
510
501
|
},
|
|
511
502
|
removeTip: function (state) {
|
|
512
503
|
state.tip = null;
|
|
513
|
-
state.check = null;
|
|
514
504
|
},
|
|
515
505
|
setTaxExempt: function (state, action) {
|
|
516
506
|
state.isTaxExempt = action.payload;
|
|
517
|
-
state.check = null;
|
|
518
507
|
},
|
|
519
508
|
addCustomer: function (state, action) {
|
|
520
509
|
state.customer = action.payload;
|
|
@@ -622,15 +611,16 @@ var checkoutSlice = createSlice({
|
|
|
622
611
|
state.error = action.payload;
|
|
623
612
|
})
|
|
624
613
|
.addCase(submitPosOrder.fulfilled, function (state, action) {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
614
|
+
if (action.payload) {
|
|
615
|
+
return __assign(__assign({}, initialState), { completedOrder: action.payload });
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
state.check = null;
|
|
619
|
+
state.error = null;
|
|
620
|
+
state.loading = 'idle';
|
|
621
|
+
state.submitting = 'idle';
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
634
624
|
})
|
|
635
625
|
.addCase(submitPosOrder.pending, function (state) {
|
|
636
626
|
state.loading = 'pending';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|