@open-tender/cloud 0.4.38 → 0.4.50
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.
|
@@ -13,7 +13,8 @@ export interface CheckoutState {
|
|
|
13
13
|
export declare enum CheckoutActionType {
|
|
14
14
|
ValidateOrder = "checkout/validateOrder",
|
|
15
15
|
SubmitOrder = "checkout/SubmitOrder",
|
|
16
|
-
SubmitOrderPay = "checkout/SubmitOrderPay"
|
|
16
|
+
SubmitOrderPay = "checkout/SubmitOrderPay",
|
|
17
|
+
UpdateForm = "checkout/updateForm"
|
|
17
18
|
}
|
|
18
19
|
export declare const validateOrder: import("@reduxjs/toolkit").AsyncThunk<{
|
|
19
20
|
check: CheckoutCheck;
|
|
@@ -40,6 +41,16 @@ export declare const submitOrder: import("@reduxjs/toolkit").AsyncThunk<Order, {
|
|
|
40
41
|
fulfilledMeta?: unknown;
|
|
41
42
|
rejectedMeta?: unknown;
|
|
42
43
|
}>;
|
|
44
|
+
export declare const updateForm: import("@reduxjs/toolkit").AsyncThunk<CheckoutState, Partial<CheckoutForm>, {
|
|
45
|
+
state: AppState;
|
|
46
|
+
rejectValue: CheckoutErrorMessages;
|
|
47
|
+
dispatch?: Dispatch<import("redux").AnyAction> | undefined;
|
|
48
|
+
extra?: unknown;
|
|
49
|
+
serializedErrorType?: unknown;
|
|
50
|
+
pendingMeta?: unknown;
|
|
51
|
+
fulfilledMeta?: unknown;
|
|
52
|
+
rejectedMeta?: unknown;
|
|
53
|
+
}>;
|
|
43
54
|
export declare const submitOrderPay: import("@reduxjs/toolkit").AsyncThunk<Order | null, boolean | undefined, {
|
|
44
55
|
state: AppState;
|
|
45
56
|
rejectValue: CheckoutErrorMessages;
|
|
@@ -50,7 +61,7 @@ export declare const submitOrderPay: import("@reduxjs/toolkit").AsyncThunk<Order
|
|
|
50
61
|
fulfilledMeta?: unknown;
|
|
51
62
|
rejectedMeta?: unknown;
|
|
52
63
|
}>;
|
|
53
|
-
export declare const resetCheckout: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCheckout">, resetCheck: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCheck">, resetCompletedOrder: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCompletedOrder">, resetErrors: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetErrors">, resetTip: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetTip">, setCompletedOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setCompletedOrder">, setGuest: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setGuest">, setSubmitting: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setSubmitting">, updateCheckoutCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/updateCheckoutCustomer">,
|
|
64
|
+
export declare const resetCheckout: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCheckout">, resetCheck: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCheck">, resetCompletedOrder: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCompletedOrder">, resetErrors: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetErrors">, resetTip: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetTip">, setCompletedOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setCompletedOrder">, setGuest: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setGuest">, setSubmitting: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setSubmitting">, updateCheckoutCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/updateCheckoutCustomer">, setRecaptchaToken: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setRecaptchaToken">;
|
|
54
65
|
export declare const selectCheckout: (state: AppState) => CheckoutState;
|
|
55
66
|
export declare const selectCheck: (state: AppState) => CheckoutCheck | null;
|
|
56
67
|
export declare const selectCompletedOrder: (state: AppState) => Order | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.checkoutReducer = exports.selectDiscounts = exports.selectCompletedOrder = exports.selectCheck = exports.selectCheckout = exports.setRecaptchaToken = exports.
|
|
4
|
+
exports.checkoutReducer = exports.selectDiscounts = exports.selectCompletedOrder = exports.selectCheck = exports.selectCheckout = exports.setRecaptchaToken = exports.updateCheckoutCustomer = exports.setSubmitting = exports.setGuest = exports.setCompletedOrder = exports.resetTip = exports.resetErrors = exports.resetCompletedOrder = exports.resetCheck = exports.resetCheckout = exports.submitOrderPay = exports.updateForm = exports.submitOrder = exports.validateOrder = exports.CheckoutActionType = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
7
|
const utils_1 = require("@open-tender/utils");
|
|
@@ -34,6 +34,7 @@ var CheckoutActionType;
|
|
|
34
34
|
CheckoutActionType["ValidateOrder"] = "checkout/validateOrder";
|
|
35
35
|
CheckoutActionType["SubmitOrder"] = "checkout/SubmitOrder";
|
|
36
36
|
CheckoutActionType["SubmitOrderPay"] = "checkout/SubmitOrderPay";
|
|
37
|
+
CheckoutActionType["UpdateForm"] = "checkout/updateForm";
|
|
37
38
|
})(CheckoutActionType = exports.CheckoutActionType || (exports.CheckoutActionType = {}));
|
|
38
39
|
const assembleOrder = (orderData, save = false) => {
|
|
39
40
|
const { order, checkout, groupOrder } = orderData;
|
|
@@ -176,6 +177,16 @@ exports.submitOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.SubmitO
|
|
|
176
177
|
return rejectWithValue(errors);
|
|
177
178
|
}
|
|
178
179
|
}));
|
|
180
|
+
exports.updateForm = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.UpdateForm, (payload, { getState }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
181
|
+
const { checkout } = getState();
|
|
182
|
+
const errors = Object.assign({}, checkout.errors);
|
|
183
|
+
const { tenders } = payload;
|
|
184
|
+
if (tenders)
|
|
185
|
+
delete errors.tenders;
|
|
186
|
+
const form = Object.assign(Object.assign({}, checkout.form), payload);
|
|
187
|
+
return Object.assign(Object.assign({}, checkout), { form,
|
|
188
|
+
errors });
|
|
189
|
+
}));
|
|
179
190
|
exports.submitOrderPay = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.SubmitOrderPay, (showAlert = false, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
180
191
|
const { api } = getState().config;
|
|
181
192
|
if (!api)
|
|
@@ -238,14 +249,6 @@ const checkoutSlice = (0, toolkit_1.createSlice)({
|
|
|
238
249
|
setRecaptchaToken: (state, action) => {
|
|
239
250
|
state.form.token = action.payload;
|
|
240
251
|
},
|
|
241
|
-
updateForm: (state, action) => {
|
|
242
|
-
const errors = Object.assign({}, state.errors);
|
|
243
|
-
const { tenders } = action.payload;
|
|
244
|
-
if (tenders)
|
|
245
|
-
delete errors.tenders;
|
|
246
|
-
state.form = Object.assign(Object.assign({}, state.form), action.payload);
|
|
247
|
-
state.errors = errors;
|
|
248
|
-
},
|
|
249
252
|
updateCheckoutCustomer: (state, action) => {
|
|
250
253
|
const account = action.payload;
|
|
251
254
|
const customer = Object.assign({}, state.form.customer);
|
|
@@ -279,6 +282,9 @@ const checkoutSlice = (0, toolkit_1.createSlice)({
|
|
|
279
282
|
.addCase(exports.validateOrder.rejected, (state, action) => {
|
|
280
283
|
state.errors = action.payload || {};
|
|
281
284
|
state.loading = 'idle';
|
|
285
|
+
})
|
|
286
|
+
.addCase(exports.updateForm.fulfilled, (state, action) => {
|
|
287
|
+
return Object.assign(Object.assign({}, state), action.payload);
|
|
282
288
|
})
|
|
283
289
|
.addCase(exports.submitOrder.fulfilled, (_, action) => {
|
|
284
290
|
return Object.assign(Object.assign({}, initialState), { completedOrder: action.payload });
|
|
@@ -304,7 +310,7 @@ const checkoutSlice = (0, toolkit_1.createSlice)({
|
|
|
304
310
|
});
|
|
305
311
|
}
|
|
306
312
|
});
|
|
307
|
-
_a = checkoutSlice.actions, exports.resetCheckout = _a.resetCheckout, exports.resetCheck = _a.resetCheck, exports.resetCompletedOrder = _a.resetCompletedOrder, exports.resetErrors = _a.resetErrors, exports.resetTip = _a.resetTip, exports.setCompletedOrder = _a.setCompletedOrder, exports.setGuest = _a.setGuest, exports.setSubmitting = _a.setSubmitting, exports.updateCheckoutCustomer = _a.updateCheckoutCustomer, exports.
|
|
313
|
+
_a = checkoutSlice.actions, exports.resetCheckout = _a.resetCheckout, exports.resetCheck = _a.resetCheck, exports.resetCompletedOrder = _a.resetCompletedOrder, exports.resetErrors = _a.resetErrors, exports.resetTip = _a.resetTip, exports.setCompletedOrder = _a.setCompletedOrder, exports.setGuest = _a.setGuest, exports.setSubmitting = _a.setSubmitting, exports.updateCheckoutCustomer = _a.updateCheckoutCustomer, exports.setRecaptchaToken = _a.setRecaptchaToken;
|
|
308
314
|
const selectCheckout = (state) => state.checkout;
|
|
309
315
|
exports.selectCheckout = selectCheckout;
|
|
310
316
|
const selectCheck = (state) => state.checkout.check;
|
|
@@ -13,7 +13,8 @@ export interface CheckoutState {
|
|
|
13
13
|
export declare enum CheckoutActionType {
|
|
14
14
|
ValidateOrder = "checkout/validateOrder",
|
|
15
15
|
SubmitOrder = "checkout/SubmitOrder",
|
|
16
|
-
SubmitOrderPay = "checkout/SubmitOrderPay"
|
|
16
|
+
SubmitOrderPay = "checkout/SubmitOrderPay",
|
|
17
|
+
UpdateForm = "checkout/updateForm"
|
|
17
18
|
}
|
|
18
19
|
export declare const validateOrder: import("@reduxjs/toolkit").AsyncThunk<{
|
|
19
20
|
check: CheckoutCheck;
|
|
@@ -40,6 +41,16 @@ export declare const submitOrder: import("@reduxjs/toolkit").AsyncThunk<Order, {
|
|
|
40
41
|
fulfilledMeta?: unknown;
|
|
41
42
|
rejectedMeta?: unknown;
|
|
42
43
|
}>;
|
|
44
|
+
export declare const updateForm: import("@reduxjs/toolkit").AsyncThunk<CheckoutState, Partial<CheckoutForm>, {
|
|
45
|
+
state: AppState;
|
|
46
|
+
rejectValue: CheckoutErrorMessages;
|
|
47
|
+
dispatch?: Dispatch<import("redux").AnyAction> | undefined;
|
|
48
|
+
extra?: unknown;
|
|
49
|
+
serializedErrorType?: unknown;
|
|
50
|
+
pendingMeta?: unknown;
|
|
51
|
+
fulfilledMeta?: unknown;
|
|
52
|
+
rejectedMeta?: unknown;
|
|
53
|
+
}>;
|
|
43
54
|
export declare const submitOrderPay: import("@reduxjs/toolkit").AsyncThunk<Order | null, boolean | undefined, {
|
|
44
55
|
state: AppState;
|
|
45
56
|
rejectValue: CheckoutErrorMessages;
|
|
@@ -50,7 +61,7 @@ export declare const submitOrderPay: import("@reduxjs/toolkit").AsyncThunk<Order
|
|
|
50
61
|
fulfilledMeta?: unknown;
|
|
51
62
|
rejectedMeta?: unknown;
|
|
52
63
|
}>;
|
|
53
|
-
export declare const resetCheckout: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCheckout">, resetCheck: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCheck">, resetCompletedOrder: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCompletedOrder">, resetErrors: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetErrors">, resetTip: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetTip">, setCompletedOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setCompletedOrder">, setGuest: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setGuest">, setSubmitting: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setSubmitting">, updateCheckoutCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/updateCheckoutCustomer">,
|
|
64
|
+
export declare const resetCheckout: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCheckout">, resetCheck: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCheck">, resetCompletedOrder: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetCompletedOrder">, resetErrors: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetErrors">, resetTip: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetTip">, setCompletedOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setCompletedOrder">, setGuest: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setGuest">, setSubmitting: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setSubmitting">, updateCheckoutCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/updateCheckoutCustomer">, setRecaptchaToken: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setRecaptchaToken">;
|
|
54
65
|
export declare const selectCheckout: (state: AppState) => CheckoutState;
|
|
55
66
|
export declare const selectCheck: (state: AppState) => CheckoutCheck | null;
|
|
56
67
|
export declare const selectCompletedOrder: (state: AppState) => Order | null;
|
|
@@ -30,6 +30,7 @@ export var CheckoutActionType;
|
|
|
30
30
|
CheckoutActionType["ValidateOrder"] = "checkout/validateOrder";
|
|
31
31
|
CheckoutActionType["SubmitOrder"] = "checkout/SubmitOrder";
|
|
32
32
|
CheckoutActionType["SubmitOrderPay"] = "checkout/SubmitOrderPay";
|
|
33
|
+
CheckoutActionType["UpdateForm"] = "checkout/updateForm";
|
|
33
34
|
})(CheckoutActionType || (CheckoutActionType = {}));
|
|
34
35
|
const assembleOrder = (orderData, save = false) => {
|
|
35
36
|
const { order, checkout, groupOrder } = orderData;
|
|
@@ -172,6 +173,16 @@ export const submitOrder = createAsyncThunk(CheckoutActionType.SubmitOrder, (arg
|
|
|
172
173
|
return rejectWithValue(errors);
|
|
173
174
|
}
|
|
174
175
|
}));
|
|
176
|
+
export const updateForm = createAsyncThunk(CheckoutActionType.UpdateForm, (payload, { getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
177
|
+
const { checkout } = getState();
|
|
178
|
+
const errors = Object.assign({}, checkout.errors);
|
|
179
|
+
const { tenders } = payload;
|
|
180
|
+
if (tenders)
|
|
181
|
+
delete errors.tenders;
|
|
182
|
+
const form = Object.assign(Object.assign({}, checkout.form), payload);
|
|
183
|
+
return Object.assign(Object.assign({}, checkout), { form,
|
|
184
|
+
errors });
|
|
185
|
+
}));
|
|
175
186
|
export const submitOrderPay = createAsyncThunk(CheckoutActionType.SubmitOrderPay, (showAlert = false, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
176
187
|
const { api } = getState().config;
|
|
177
188
|
if (!api)
|
|
@@ -234,14 +245,6 @@ const checkoutSlice = createSlice({
|
|
|
234
245
|
setRecaptchaToken: (state, action) => {
|
|
235
246
|
state.form.token = action.payload;
|
|
236
247
|
},
|
|
237
|
-
updateForm: (state, action) => {
|
|
238
|
-
const errors = Object.assign({}, state.errors);
|
|
239
|
-
const { tenders } = action.payload;
|
|
240
|
-
if (tenders)
|
|
241
|
-
delete errors.tenders;
|
|
242
|
-
state.form = Object.assign(Object.assign({}, state.form), action.payload);
|
|
243
|
-
state.errors = errors;
|
|
244
|
-
},
|
|
245
248
|
updateCheckoutCustomer: (state, action) => {
|
|
246
249
|
const account = action.payload;
|
|
247
250
|
const customer = Object.assign({}, state.form.customer);
|
|
@@ -275,6 +278,9 @@ const checkoutSlice = createSlice({
|
|
|
275
278
|
.addCase(validateOrder.rejected, (state, action) => {
|
|
276
279
|
state.errors = action.payload || {};
|
|
277
280
|
state.loading = 'idle';
|
|
281
|
+
})
|
|
282
|
+
.addCase(updateForm.fulfilled, (state, action) => {
|
|
283
|
+
return Object.assign(Object.assign({}, state), action.payload);
|
|
278
284
|
})
|
|
279
285
|
.addCase(submitOrder.fulfilled, (_, action) => {
|
|
280
286
|
return Object.assign(Object.assign({}, initialState), { completedOrder: action.payload });
|
|
@@ -300,7 +306,7 @@ const checkoutSlice = createSlice({
|
|
|
300
306
|
});
|
|
301
307
|
}
|
|
302
308
|
});
|
|
303
|
-
export const { resetCheckout, resetCheck, resetCompletedOrder, resetErrors, resetTip, setCompletedOrder, setGuest, setSubmitting, updateCheckoutCustomer,
|
|
309
|
+
export const { resetCheckout, resetCheck, resetCompletedOrder, resetErrors, resetTip, setCompletedOrder, setGuest, setSubmitting, updateCheckoutCustomer, setRecaptchaToken } = checkoutSlice.actions;
|
|
304
310
|
export const selectCheckout = (state) => state.checkout;
|
|
305
311
|
export const selectCheck = (state) => state.checkout.check;
|
|
306
312
|
export const selectCompletedOrder = (state) => state.checkout.completedOrder;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.50",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|