@websolutespa/bom-mixer-checkout 1.9.0 → 1.9.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/index.js +15 -10
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/esm/cart/cart-drawer.js +4 -2
  5. package/dist/esm/cart/cart-drawer.js.map +1 -1
  6. package/dist/esm/cart/cart-item.js +1 -1
  7. package/dist/esm/cart/cart-item.js.map +1 -1
  8. package/dist/esm/checkout/checkout-basket-item.js +1 -1
  9. package/dist/esm/checkout/checkout-basket-item.js.map +1 -1
  10. package/dist/esm/checkout/checkout-basket.js +2 -1
  11. package/dist/esm/checkout/checkout-basket.js.map +1 -1
  12. package/dist/esm/checkout/checkout-empty.js +3 -1
  13. package/dist/esm/checkout/checkout-empty.js.map +1 -1
  14. package/dist/esm/checkout/checkout-user-info.js +4 -3
  15. package/dist/esm/checkout/checkout-user-info.js.map +1 -1
  16. package/dist/esm/hooks/useCart/useCart.js.map +1 -1
  17. package/dist/esm/order/order-summary-item.js +1 -1
  18. package/dist/esm/order/order-summary-item.js.map +1 -1
  19. package/dist/types/cart/cart-drawer.d.ts.map +1 -1
  20. package/dist/types/checkout/checkout-basket.d.ts.map +1 -1
  21. package/dist/types/checkout/checkout-empty.d.ts.map +1 -1
  22. package/dist/types/checkout/checkout-user-info.d.ts.map +1 -1
  23. package/dist/types/hooks/useCart/useCart.d.ts +4 -0
  24. package/dist/types/hooks/useCart/useCart.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/cart/cart-drawer.tsx +4 -2
  27. package/src/cart/cart-item.tsx +1 -1
  28. package/src/checkout/checkout-basket-item.tsx +1 -1
  29. package/src/checkout/checkout-basket.tsx +2 -1
  30. package/src/checkout/checkout-empty.tsx +3 -1
  31. package/src/checkout/checkout-user-info.tsx +59 -25
  32. package/src/hooks/useCart/useCart.tsx +8 -1
  33. package/src/order/order-summary-item.tsx +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @websolutespa/bom-mixer-checkout
2
2
 
3
+ ## 1.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: checkoutUrl & shopUrl options
8
+ - Updated dependencies
9
+ - @websolutespa/bom-mixer-forms@1.9.3
10
+ - @websolutespa/bom-mixer-ui@1.10.1
11
+
12
+ ## 1.9.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Modified: Link component
17
+ - Updated dependencies
18
+ - @websolutespa/bom-mixer-ui@1.9.14
19
+
3
20
  ## 1.9.0
4
21
 
5
22
  ### Minor Changes
package/dist/cjs/index.js CHANGED
@@ -240,7 +240,7 @@ const CartItem = _ref => {
240
240
  flex: "1",
241
241
  padding: "0 1rem",
242
242
  children: [jsxRuntime.jsx(Link__default.default, {
243
- href: article.href || '',
243
+ href: article.href,
244
244
  children: jsxRuntime.jsx(bomMixerUi.Text, {
245
245
  variant: "paragraph20",
246
246
  fontWeight: "700",
@@ -296,6 +296,8 @@ const CartDrawer = props => {
296
296
  const layout = bomMixerHooks.useLayout();
297
297
  const currency = bomMixerHooks.useCurrency();
298
298
  const items = useCart(state => state.items);
299
+ const checkoutUrl = useCart(state => state.checkoutUrl || layout.topLevelHrefs.checkout);
300
+ const shopUrl = useCart(state => state.shopUrl || layout.topLevelHrefs.shop_index);
299
301
  const totalAmount = items.reduce((p, c) => p + c.price * c.qty, 0);
300
302
  return jsxRuntime.jsxs(bomMixerUi.Drawer, Object.assign({
301
303
  name: "cart",
@@ -345,7 +347,7 @@ const CartDrawer = props => {
345
347
  children: "Shipping and taxes calculated at checkout"
346
348
  })
347
349
  }), jsxRuntime.jsx(bomMixerUi.NavLink, {
348
- href: layout.topLevelHrefs.checkout || '',
350
+ href: checkoutUrl,
349
351
  children: jsxRuntime.jsxs(bomMixerUi.Button, {
350
352
  as: "a",
351
353
  variant: "primary",
@@ -365,7 +367,7 @@ const CartDrawer = props => {
365
367
  children: [jsxRuntime.jsx("span", {
366
368
  children: "or"
367
369
  }), jsxRuntime.jsx(bomMixerUi.NavLink, {
368
- href: layout.topLevelHrefs.shop_index || '',
370
+ href: shopUrl,
369
371
  children: jsxRuntime.jsxs(bomMixerUi.Button, {
370
372
  as: "a",
371
373
  variant: "link",
@@ -485,7 +487,7 @@ const CheckoutBasketItem = _ref => {
485
487
  }), jsxRuntime.jsxs(bomMixerUi.Flex.Col, {
486
488
  alignItems: "flex-start",
487
489
  children: [jsxRuntime.jsx(bomMixerUi.Link, {
488
- href: article.href || '',
490
+ href: article.href,
489
491
  children: jsxRuntime.jsx(bomMixerUi.Button, {
490
492
  as: "a",
491
493
  variant: "nav",
@@ -573,6 +575,7 @@ const CheckoutBasket = _ref => {
573
575
  const api = bomMixerHooks.useApi();
574
576
  const currency = bomMixerHooks.useCurrency();
575
577
  const cartItems = useCart(state => state.items);
578
+ const shopUrl = useCart(state => state.shopUrl || layout.topLevelHrefs.shop_index);
576
579
  const checkout = useCheckout(state => state.checkout);
577
580
  const {
578
581
  setCheckout
@@ -728,7 +731,7 @@ const CheckoutBasket = _ref => {
728
731
  justifyContent: "space-between",
729
732
  children: [jsxRuntime.jsx(bomMixerUi.Flex, {
730
733
  children: jsxRuntime.jsx(bomMixerUi.NavLink, {
731
- href: layout.topLevelHrefs.shop_index || '',
734
+ href: shopUrl,
732
735
  children: jsxRuntime.jsx(bomMixerUi.Button, {
733
736
  as: "a",
734
737
  variant: "link",
@@ -953,6 +956,7 @@ const CheckoutDiscount = _ref => {
953
956
  const CheckoutEmpty = () => {
954
957
  bomMixerHooks.useLabel();
955
958
  const layout = bomMixerHooks.useLayout();
959
+ const shopUrl = useCart(state => state.shopUrl || layout.topLevelHrefs.shop_index);
956
960
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
957
961
  children: jsxRuntime.jsx(bomMixerUi.Section, {
958
962
  children: jsxRuntime.jsx(bomMixerUi.Container, {
@@ -971,7 +975,7 @@ const CheckoutEmpty = () => {
971
975
  maxWidth: "80ch",
972
976
  children: "All\u2019interno di Mixer Shop \u00E8 possibile acquistare i campioni delle collezioni Tiles, 3D Elements e Paints, complementi d\u2019arredo in materiali inediti, elementi decorativi esclusivi e oggettistica legata all\u2019universo del brand."
973
977
  }), jsxRuntime.jsx(bomMixerUi.NavLink, {
974
- href: layout.topLevelHrefs.shop_index || '',
978
+ href: shopUrl,
975
979
  children: jsxRuntime.jsx(bomMixerUi.Button, {
976
980
  as: "a",
977
981
  variant: "primary",
@@ -1357,7 +1361,7 @@ const CheckoutUserInfo = _ref => {
1357
1361
  hidden: shippingHiddenIfNotItaly
1358
1362
  },
1359
1363
  province: {
1360
- schema: 'autocomplete',
1364
+ schema: 'combobox',
1361
1365
  label: 'field.province',
1362
1366
  options: options === null || options === void 0 ? void 0 : options.provinces,
1363
1367
  validators: shippingRequiredIfItaly,
@@ -1433,7 +1437,7 @@ const CheckoutUserInfo = _ref => {
1433
1437
  hidden: billingHiddenIfNotItaly
1434
1438
  },
1435
1439
  province: {
1436
- schema: 'autocomplete',
1440
+ schema: 'combobox',
1437
1441
  label: 'field.province',
1438
1442
  options: options === null || options === void 0 ? void 0 : options.provinces,
1439
1443
  validators: [billingRequired],
@@ -1470,6 +1474,7 @@ const CheckoutUserInfo = _ref => {
1470
1474
  } // check hidden field for antiforgery
1471
1475
  }, [options]);
1472
1476
  react.useEffect(() => {
1477
+ // console.log('CheckoutUserInfo', options);
1473
1478
  if (checkout.shippingAddress) {
1474
1479
  setValue({
1475
1480
  shippingAddress: checkout.shippingAddress,
@@ -1562,7 +1567,7 @@ const CheckoutUserInfo = _ref => {
1562
1567
  name: 'Italy'
1563
1568
  },
1564
1569
  region: {
1565
- id: 10,
1570
+ id: '11',
1566
1571
  name: 'Marche'
1567
1572
  },
1568
1573
  province: {
@@ -2513,7 +2518,7 @@ const OrderSummaryItem = _ref => {
2513
2518
  }), jsxRuntime.jsxs(bomMixerUi.Flex.Col, {
2514
2519
  alignItems: "flex-start",
2515
2520
  children: [jsxRuntime.jsx(bomMixerUi.Link, {
2516
- href: article.href || '',
2521
+ href: article.href,
2517
2522
  children: jsxRuntime.jsx(bomMixerUi.Button, {
2518
2523
  as: "a",
2519
2524
  variant: "nav",