@websolutespa/bom-mixer-checkout 1.8.1 → 1.8.2
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/CHANGELOG.md +6 -0
- package/dist/cjs/index.js +39 -39
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/checkout/checkout-review.js +22 -22
- package/dist/esm/checkout/checkout-review.js.map +1 -1
- package/dist/esm/checkout/checkout-wizard.js +3 -3
- package/dist/esm/checkout/checkout-wizard.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/models/checkout/checkout.service.js +1 -1
- package/dist/esm/models/checkout/checkout.service.js.map +1 -1
- package/dist/esm/models/{store/store.service.js → retailer/retailer.service.js} +15 -15
- package/dist/esm/models/retailer/retailer.service.js.map +1 -0
- package/dist/types/checkout/checkout-review.d.ts +2 -2
- package/dist/types/checkout/checkout-review.d.ts.map +1 -1
- package/dist/types/checkout/checkout-wizard.d.ts.map +1 -1
- package/dist/types/models/checkout/checkout.d.ts +2 -2
- package/dist/types/models/checkout/checkout.d.ts.map +1 -1
- package/dist/types/models/index.d.ts +2 -2
- package/dist/types/models/index.d.ts.map +1 -1
- package/dist/types/models/{store/store.d.ts → retailer/retailer.d.ts} +2 -2
- package/dist/types/models/retailer/retailer.d.ts.map +1 -0
- package/dist/types/models/retailer/retailer.service.d.ts +7 -0
- package/dist/types/models/retailer/retailer.service.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/checkout/checkout-review.tsx +24 -24
- package/src/checkout/checkout-wizard.tsx +4 -4
- package/src/models/checkout/checkout.service.ts +2 -2
- package/src/models/checkout/checkout.ts +2 -2
- package/src/models/index.ts +2 -2
- package/src/models/retailer/retailer.service.ts +38 -0
- package/src/models/{store/store.ts → retailer/retailer.ts} +1 -1
- package/dist/esm/models/store/store.service.js.map +0 -1
- package/dist/types/models/store/store.d.ts.map +0 -1
- package/dist/types/models/store/store.service.d.ts +0 -7
- package/dist/types/models/store/store.service.d.ts.map +0 -1
- package/src/models/store/store.service.ts +0 -38
package/CHANGELOG.md
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -1951,31 +1951,31 @@ const CheckoutReview = _ref => {
|
|
|
1951
1951
|
const {
|
|
1952
1952
|
setCheckout
|
|
1953
1953
|
} = useCheckout(state => state.actions);
|
|
1954
|
-
const [options, loading] = bomMixerHooks.useApiPost('/checkout/
|
|
1954
|
+
const [options, loading] = bomMixerHooks.useApiPost('/checkout/retailers', checkout);
|
|
1955
1955
|
// console.log('CheckoutReview', checkout);
|
|
1956
1956
|
const [error, setError] = react.useState();
|
|
1957
1957
|
const required = bomMixerForms.RequiredValidator();
|
|
1958
1958
|
const [form, setValue, setTouched, reset, group] = bomMixerForms.useFormBuilder({
|
|
1959
|
-
|
|
1959
|
+
retailer: {
|
|
1960
1960
|
schema: 'select',
|
|
1961
|
-
label: 'field.
|
|
1962
|
-
options: options === null || options === void 0 ? void 0 : options.
|
|
1961
|
+
label: 'field.retailer',
|
|
1962
|
+
options: options === null || options === void 0 ? void 0 : options.retailers,
|
|
1963
1963
|
validators: [required]
|
|
1964
1964
|
}
|
|
1965
1965
|
}, [options]);
|
|
1966
1966
|
react.useEffect(() => {
|
|
1967
|
-
if (checkout.
|
|
1967
|
+
if (checkout.retailer || checkout.discounts) {
|
|
1968
1968
|
setValue({
|
|
1969
|
-
|
|
1969
|
+
retailer: checkout.retailer
|
|
1970
1970
|
});
|
|
1971
1971
|
} else if (options) {
|
|
1972
1972
|
setValue({
|
|
1973
|
-
|
|
1973
|
+
retailer: options.retailers[0]
|
|
1974
1974
|
});
|
|
1975
1975
|
}
|
|
1976
1976
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1977
1977
|
}, [options]);
|
|
1978
|
-
const
|
|
1978
|
+
const selectedRetailer = (_a = form.value) === null || _a === void 0 ? void 0 : _a.retailer;
|
|
1979
1979
|
const shippingAddress = checkout.shippingAddress;
|
|
1980
1980
|
const billingAddress = checkout.billingAddress;
|
|
1981
1981
|
const delivery = checkout.delivery;
|
|
@@ -1989,16 +1989,16 @@ const CheckoutReview = _ref => {
|
|
|
1989
1989
|
console.log('CheckoutReview.valid', form.value);
|
|
1990
1990
|
try {
|
|
1991
1991
|
setError(undefined);
|
|
1992
|
-
const
|
|
1992
|
+
const retailer = form.value.retailer;
|
|
1993
1993
|
const response = yield api.post('/checkout/update', {
|
|
1994
|
-
action: '
|
|
1994
|
+
action: 'retailer',
|
|
1995
1995
|
checkout: Object.assign(Object.assign({}, checkout), {
|
|
1996
|
-
|
|
1996
|
+
retailer
|
|
1997
1997
|
})
|
|
1998
1998
|
});
|
|
1999
1999
|
setCheckout(response);
|
|
2000
2000
|
if (typeof onReview === 'function') {
|
|
2001
|
-
onReview(
|
|
2001
|
+
onReview(retailer);
|
|
2002
2002
|
}
|
|
2003
2003
|
} catch (error) {
|
|
2004
2004
|
console.log('CheckoutReview.error', error);
|
|
@@ -2014,10 +2014,10 @@ const CheckoutReview = _ref => {
|
|
|
2014
2014
|
onPrevious();
|
|
2015
2015
|
}
|
|
2016
2016
|
};
|
|
2017
|
-
const
|
|
2017
|
+
const retailer = group.controls.retailer;
|
|
2018
2018
|
const onStoreChange = event => {
|
|
2019
2019
|
var _a;
|
|
2020
|
-
group.controls.
|
|
2020
|
+
group.controls.retailer.value = (_a = retailer === null || retailer === void 0 ? void 0 : retailer.options) === null || _a === void 0 ? void 0 : _a.find(x => x.id.toString() === event.target.value);
|
|
2021
2021
|
};
|
|
2022
2022
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2023
2023
|
children: [jsxRuntime.jsx(bomMixerUi.Section, {
|
|
@@ -2042,24 +2042,24 @@ const CheckoutReview = _ref => {
|
|
|
2042
2042
|
variant: "paragraph10",
|
|
2043
2043
|
marginBottom: "1rem",
|
|
2044
2044
|
children: "Your suggested closest sales outlet for self-service pickup."
|
|
2045
|
-
}), loading && jsxRuntime.jsx(bomMixerUi.Loading, {}),
|
|
2045
|
+
}), loading && jsxRuntime.jsx(bomMixerUi.Loading, {}), selectedRetailer && jsxRuntime.jsxs(bomMixerUi.Flex.Col, {
|
|
2046
2046
|
marginBottom: "1rem",
|
|
2047
2047
|
children: [jsxRuntime.jsx(bomMixerUi.Text, {
|
|
2048
2048
|
variant: "heading40",
|
|
2049
2049
|
fontWeight: "700",
|
|
2050
|
-
children:
|
|
2050
|
+
children: selectedRetailer.name
|
|
2051
2051
|
}), jsxRuntime.jsxs(bomMixerUi.Text, {
|
|
2052
|
-
children: [
|
|
2052
|
+
children: [selectedRetailer.address, ", ", selectedRetailer.streetNumber]
|
|
2053
2053
|
}), jsxRuntime.jsxs(bomMixerUi.Text, {
|
|
2054
|
-
children: [
|
|
2054
|
+
children: [selectedRetailer.zipCode, " ", selectedRetailer.city, " ", (_b = selectedRetailer.country) === null || _b === void 0 ? void 0 : _b.name]
|
|
2055
2055
|
}), jsxRuntime.jsx(bomMixerUi.Text, {
|
|
2056
|
-
children:
|
|
2056
|
+
children: selectedRetailer.phoneNumber
|
|
2057
2057
|
})]
|
|
2058
|
-
}),
|
|
2059
|
-
initialValue: (_c =
|
|
2058
|
+
}), retailer && jsxRuntime.jsx(bomMixerUi.RadioCard.Group, {
|
|
2059
|
+
initialValue: (_c = retailer.value) === null || _c === void 0 ? void 0 : _c.id.toString(),
|
|
2060
2060
|
onChange: onStoreChange,
|
|
2061
2061
|
maxWidth: "60ch",
|
|
2062
|
-
children: (_d =
|
|
2062
|
+
children: (_d = retailer.options) === null || _d === void 0 ? void 0 : _d.map(option => jsxRuntime.jsxs(bomMixerUi.RadioCard, {
|
|
2063
2063
|
value: option.id.toString(),
|
|
2064
2064
|
children: [jsxRuntime.jsx(bomMixerUi.RadioCard.Title, {
|
|
2065
2065
|
children: option.name
|
|
@@ -2860,10 +2860,10 @@ const CheckoutWizard = _a => {
|
|
|
2860
2860
|
setStatus(exports.CheckoutStatus.Review);
|
|
2861
2861
|
};
|
|
2862
2862
|
// 4.
|
|
2863
|
-
const onReview =
|
|
2864
|
-
console.log('CheckoutWizard.onReview',
|
|
2863
|
+
const onReview = retailer => {
|
|
2864
|
+
console.log('CheckoutWizard.onReview', retailer);
|
|
2865
2865
|
onCheckout_(Object.assign(Object.assign({}, checkout), {
|
|
2866
|
-
|
|
2866
|
+
retailer
|
|
2867
2867
|
}));
|
|
2868
2868
|
setStatus(exports.CheckoutStatus.Payment);
|
|
2869
2869
|
};
|
|
@@ -3268,7 +3268,7 @@ function checkoutSubmitHandler(_ref) {
|
|
|
3268
3268
|
})),
|
|
3269
3269
|
payment: checkout.payment ? checkout.payment.id : undefined,
|
|
3270
3270
|
shippingAddress: shippingAddress ? shippingAddress.id : undefined,
|
|
3271
|
-
|
|
3271
|
+
retailer: checkout.retailer ? checkout.retailer.id : undefined,
|
|
3272
3272
|
user: checkout.user ? checkout.user.id : undefined
|
|
3273
3273
|
});
|
|
3274
3274
|
console.log('action', action);
|
|
@@ -3621,43 +3621,43 @@ function checkoutPaymentsHandler() {
|
|
|
3621
3621
|
});
|
|
3622
3622
|
}
|
|
3623
3623
|
|
|
3624
|
-
function
|
|
3624
|
+
function getRetailers() {
|
|
3625
3625
|
return __awaiter(this, arguments, void 0, function (params) {
|
|
3626
3626
|
if (params === void 0) {
|
|
3627
3627
|
params = {};
|
|
3628
3628
|
}
|
|
3629
3629
|
return function* () {
|
|
3630
3630
|
const store = yield bomMixerStore.getStore();
|
|
3631
|
-
const items = yield store.
|
|
3631
|
+
const items = yield store.retailer.findMany(params);
|
|
3632
3632
|
return items;
|
|
3633
3633
|
}();
|
|
3634
3634
|
});
|
|
3635
3635
|
}
|
|
3636
|
-
function
|
|
3636
|
+
function getRetailer(id_1) {
|
|
3637
3637
|
return __awaiter(this, arguments, void 0, function (id, params) {
|
|
3638
3638
|
if (params === void 0) {
|
|
3639
3639
|
params = {};
|
|
3640
3640
|
}
|
|
3641
3641
|
return function* () {
|
|
3642
3642
|
const store = yield bomMixerStore.getStore();
|
|
3643
|
-
const item = yield store.
|
|
3643
|
+
const item = yield store.retailer.findOne(id, params);
|
|
3644
3644
|
return item;
|
|
3645
3645
|
}();
|
|
3646
3646
|
});
|
|
3647
3647
|
}
|
|
3648
|
-
function
|
|
3648
|
+
function getRetailersPagination() {
|
|
3649
3649
|
return __awaiter(this, arguments, void 0, function (params) {
|
|
3650
3650
|
if (params === void 0) {
|
|
3651
3651
|
params = {};
|
|
3652
3652
|
}
|
|
3653
3653
|
return function* () {
|
|
3654
3654
|
const store = yield bomMixerStore.getStore();
|
|
3655
|
-
const pagination = yield store.
|
|
3655
|
+
const pagination = yield store.retailer.findPaged(params);
|
|
3656
3656
|
return pagination;
|
|
3657
3657
|
}();
|
|
3658
3658
|
});
|
|
3659
3659
|
}
|
|
3660
|
-
function
|
|
3660
|
+
function checkoutRetailersHandler() {
|
|
3661
3661
|
return bomMixerStore.apiHandler({
|
|
3662
3662
|
options: (request, response) => __awaiter(this, void 0, void 0, function* () {
|
|
3663
3663
|
response.status(200).end();
|
|
@@ -3666,12 +3666,12 @@ function checkoutStoresHandler() {
|
|
|
3666
3666
|
request.body;
|
|
3667
3667
|
const locale = request.query.locale;
|
|
3668
3668
|
const market = request.query.market;
|
|
3669
|
-
const
|
|
3669
|
+
const retailers = yield getRetailers({
|
|
3670
3670
|
market,
|
|
3671
3671
|
locale
|
|
3672
3672
|
});
|
|
3673
3673
|
response.status(200).json({
|
|
3674
|
-
|
|
3674
|
+
retailers
|
|
3675
3675
|
});
|
|
3676
3676
|
})
|
|
3677
3677
|
});
|
|
@@ -3798,7 +3798,7 @@ exports.checkoutDiscountHandler = checkoutDiscountHandler;
|
|
|
3798
3798
|
exports.checkoutInfoHandler = checkoutInfoHandler;
|
|
3799
3799
|
exports.checkoutItemsHandler = checkoutItemsHandler;
|
|
3800
3800
|
exports.checkoutPaymentsHandler = checkoutPaymentsHandler;
|
|
3801
|
-
exports.
|
|
3801
|
+
exports.checkoutRetailersHandler = checkoutRetailersHandler;
|
|
3802
3802
|
exports.checkoutSubmitHandler = checkoutSubmitHandler;
|
|
3803
3803
|
exports.checkoutUpdateHandler = checkoutUpdateHandler;
|
|
3804
3804
|
exports.getArticle = getArticle;
|
|
@@ -3816,9 +3816,9 @@ exports.getOrders = getOrders;
|
|
|
3816
3816
|
exports.getPayment = getPayment;
|
|
3817
3817
|
exports.getPayments = getPayments;
|
|
3818
3818
|
exports.getPaymentsPagination = getPaymentsPagination;
|
|
3819
|
-
exports.
|
|
3820
|
-
exports.
|
|
3821
|
-
exports.
|
|
3819
|
+
exports.getRetailer = getRetailer;
|
|
3820
|
+
exports.getRetailers = getRetailers;
|
|
3821
|
+
exports.getRetailersPagination = getRetailersPagination;
|
|
3822
3822
|
exports.paymentResult = paymentResult;
|
|
3823
3823
|
exports.setDiscountCode = setDiscountCode;
|
|
3824
3824
|
exports.updateCheckout = updateCheckout;
|