@shopgate/engage 7.29.1-beta.2 → 7.29.1-beta.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.
Files changed (113) hide show
  1. package/cart/cart.context.js +18 -1
  2. package/cart/cart.hooks.js +5 -3
  3. package/cart/cart.types.js +35 -1
  4. package/cart/components/CartItem/CartItem.js +3 -1
  5. package/cart/components/CartItem/CartItemCoupon.connector.js +8 -2
  6. package/cart/components/CartItem/CartItemCoupon.js +26 -18
  7. package/cart/components/CartItem/CartItemCoupon.types.js +15 -0
  8. package/cart/components/CartItem/CartItemCouponLayout.js +9 -3
  9. package/cart/components/CartItem/CartItemCouponPrice.js +8 -2
  10. package/cart/components/CartItem/CartItemProduct.js +0 -1
  11. package/cart/components/CartItem/CartItemProductLayoutWide.js +0 -1
  12. package/cart/components/CartItem/CartItemProductLayoutWide.style.js +1 -1
  13. package/cart/components/CartItem/CartItemProductLayoutWideFulfillmentLabel.js +1 -2
  14. package/cart/components/CartItem/CartItemProductLayoutWideFulfillmentLabel.style.js +1 -1
  15. package/cart/components/CartItem/CartItemProductLayoutWideOrderDetails.js +1 -1
  16. package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +1 -2
  17. package/cart/components/CartItem/CartItemProductOrderDetails.js +1 -1
  18. package/cart/components/CartItem/CartItemProductPriceCaption.js +1 -1
  19. package/cart/components/CartItem/CartItemProductPriceList.js +4 -1
  20. package/cart/components/CartItem/CartItemProductPriceListPromotion.js +3 -1
  21. package/cart/components/CartItem/CartItemProductProvider.connector.js +15 -3
  22. package/cart/components/CartItem/CartItemProductProvider.js +10 -4
  23. package/cart/components/CartItem/CartItemProductProvider.types.js +27 -1
  24. package/cart/components/CartItem/CartItemProvider.js +12 -3
  25. package/cart/components/CartItem/CartItemQuantityPicker.js +25 -24
  26. package/cart/components/CartItem/CartItemSubstitution.js +3 -1
  27. package/cart/components/CartItems/CartItemCard.js +8 -3
  28. package/cart/components/CartItems/CartItemCardReservation.js +4 -3
  29. package/cart/components/CartItems/CartItemCardReservationAccordion.js +5 -4
  30. package/cart/components/CartItems/CartItemCardReservationLabel.js +4 -4
  31. package/cart/components/CartItems/CartItemGroup.js +7 -3
  32. package/cart/components/CartItems/CartItemGroupReservation.js +4 -3
  33. package/cart/components/CartItems/CartItemGroupReservationLabel.js +4 -4
  34. package/cart/components/CartItems/CartItems.js +13 -3
  35. package/cart/components/CartItems/CartItemsHeaderWide.js +10 -3
  36. package/cart/components/CartItems/CartItemsHeaderWide.style.js +1 -1
  37. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +3 -2
  38. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.style.js +1 -1
  39. package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +1 -1
  40. package/cart/components/PaymentBar/PaymentBarDiscounts.js +6 -2
  41. package/cart/components/PaymentBar/PaymentBarGrandTotal.js +8 -3
  42. package/cart/components/PaymentBar/PaymentBarReserveButton.js +5 -4
  43. package/cart/components/PaymentBar/PaymentBarShippingCost.js +8 -3
  44. package/cart/components/PaymentBar/PaymentBarSubTotal.js +9 -3
  45. package/cart/components/PaymentBar/PaymentBarTax.js +7 -3
  46. package/cart/index.js +2 -1
  47. package/checkout/paymentMethods/stripe/StripeProvider.js +6 -3
  48. package/checkout/providers/CheckoutProvider.js +41 -10
  49. package/components/SideNavigation/SideNavigation.js +7 -3
  50. package/components/SideNavigation/SideNavigationCategories.js +9 -4
  51. package/components/SideNavigation/SideNavigationCategories.style.js +1 -1
  52. package/components/SideNavigation/SideNavigationCategoriesItem.js +10 -3
  53. package/components/SideNavigation/SideNavigationCategoriesItem.style.js +1 -1
  54. package/components/SideNavigation/SideNavigationCategoriesItemChildren.js +6 -3
  55. package/components/SideNavigation/SideNavigationContent.js +5 -2
  56. package/components/SideNavigation/SideNavigationContent.style.js +1 -1
  57. package/components/SideNavigation/SideNavigationItem.js +14 -4
  58. package/components/SideNavigation/SideNavigationLinksLegal.js +5 -4
  59. package/components/SideNavigation/SideNavigationLinksQuicklinks.js +4 -3
  60. package/components/SideNavigation/SideNavigationNestedItem.js +8 -2
  61. package/components/SideNavigation/SideNavigationProvider.js +12 -3
  62. package/core/config/config.types.js +15 -0
  63. package/core/hooks/useAsyncMemo.js +1 -1
  64. package/i18n/countries.hooks.js +5 -5
  65. package/locations/action-creators/setUserSearchCountryCode.js +11 -4
  66. package/locations/action-creators/setUserSearchPostalCode.js +11 -4
  67. package/locations/components/Cart/CartChangeFulfillmentMethod.connector.js +4 -1
  68. package/locations/components/Cart/CartChangeFulfillmentMethod.js +10 -7
  69. package/locations/components/Cart/CartChangeFulfillmentMethod.types.js +10 -0
  70. package/locations/components/Cart/CartContextMenuChangeFulfillment.js +9 -4
  71. package/locations/components/Cart/CartContextMenuItemChangeLocation.js +7 -6
  72. package/locations/components/Cart/CartItemProductChangeLocation.connector.js +5 -2
  73. package/locations/components/Cart/CartItemProductChangeLocation.js +12 -9
  74. package/locations/components/Cart/CartItemProductChangeLocation.types.js +9 -0
  75. package/locations/components/ChangeLocationButton/ChangeLocationButton.js +6 -3
  76. package/locations/components/FulfillmentPath/FulfillmentPathItem.js +6 -4
  77. package/locations/components/FulfillmentSelector/FulfillmentSelector.connector.js +20 -6
  78. package/locations/components/FulfillmentSelector/FulfillmentSelector.context.js +2 -1
  79. package/locations/components/FulfillmentSelector/FulfillmentSelector.hooks.js +3 -2
  80. package/locations/components/FulfillmentSelector/FulfillmentSelector.js +8 -17
  81. package/locations/components/FulfillmentSelector/FulfillmentSelector.style.js +1 -1
  82. package/locations/components/FulfillmentSelector/FulfillmentSelector.types.js +57 -1
  83. package/locations/components/FulfillmentSelector/FulfillmentSelectorAddToCart.js +5 -8
  84. package/locations/components/FulfillmentSelector/FulfillmentSelectorBOPIS.js +3 -3
  85. package/locations/components/FulfillmentSelector/FulfillmentSelectorDirectShip.js +2 -3
  86. package/locations/components/FulfillmentSelector/FulfillmentSelectorHeader.js +3 -3
  87. package/locations/components/FulfillmentSelector/FulfillmentSelectorHeader.style.js +1 -1
  88. package/locations/components/FulfillmentSelector/FulfillmentSelectorItem.js +9 -5
  89. package/locations/components/FulfillmentSelector/FulfillmentSelectorItem.style.js +1 -1
  90. package/locations/components/ReserveForm/ReserveForm.js +6 -5
  91. package/locations/components/ReserveForm/ReserveForm.style.js +1 -1
  92. package/locations/components/ReserveForm/ReserveFormPhone.connector.js +6 -2
  93. package/locations/components/ReserveForm/ReserveFormPhone.js +8 -3
  94. package/locations/components/ReserveForm/ReserveFormPhone.types.js +11 -0
  95. package/locations/components/StoreFinder/Store.context.js +3 -1
  96. package/locations/components/StoreFinder/StoreFinderLocation.js +1 -1
  97. package/locations/components/StoreList/Store.context.js +3 -1
  98. package/locations/index.js +1 -1
  99. package/locations/locations.context.js +32 -1
  100. package/locations/locations.types.js +130 -1
  101. package/locations/providers/FulfillmentProvider.connector.js +7 -3
  102. package/locations/providers/FulfillmentProvider.js +38 -27
  103. package/locations/providers/FulfillmentProvider.types.js +42 -1
  104. package/locations/providers/StoreFinderProvider.js +1 -1
  105. package/locations/reducers/index.js +3 -1
  106. package/locations/reducers/userFormInput.js +7 -7
  107. package/locations/selectors/index.js +1 -1
  108. package/package.json +7 -7
  109. package/page/widgets/Video/Video.js +1 -1
  110. package/product/product.types.js +32 -0
  111. package/registration/hooks/index.js +1 -1
  112. package/registration/providers/RegistrationProvider.js +12 -2
  113. package/types.js +0 -0
@@ -1,10 +1,7 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{useEffect}from'react';import{isProductAvailable}from"../../helpers";import{MULTI_LINE_RESERVE,QUICK_RESERVE,DIRECT_SHIP,ROPIS,BOPIS,STAGE_RESERVE_FORM}from"../../constants";import{FulfillmentSheet}from"../FulfillmentSheet";import{FulfillmentPathSelector}from"../FulfillmentPathSelector";import{useFulfillmentSelectorState}from"./FulfillmentSelector.hooks";/**
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{useEffect}from'react';import{isProductAvailable}from"../../helpers";import{MULTI_LINE_RESERVE,QUICK_RESERVE,DIRECT_SHIP,ROPIS,BOPIS,STAGE_RESERVE_FORM}from"../../constants";import{FulfillmentSheet}from"../FulfillmentSheet";import{FulfillmentPathSelector}from"../FulfillmentPathSelector";import{useFulfillmentSelectorState}from"./FulfillmentSelector.hooks";/** @typedef {import('../../locations.types').FulfillmentPath} FulfillmentPath */ /**
2
2
  * Opens the fulfillment path selector and returns a promise that resolves after selection.
3
- * @returns {Promise}
4
- */function promisifiedFulfillmentPathSelector(){return new Promise(function(resolve){FulfillmentPathSelector.open(function(selectedPath){resolve(selectedPath);});});}/**
3
+ * @returns {Promise<FulfillmentPath>} A promise resolving to the selected fulfillment path.
4
+ */var promisifiedFulfillmentPathSelector=function promisifiedFulfillmentPathSelector(){return new Promise(function(resolve){FulfillmentPathSelector.open(function(selectedPath){resolve(selectedPath);});});};/**
5
5
  * Interject add to cart flow.
6
- * @returns {JSX}
7
- */export function FulfillmentSelectorAddToCart(){var _useFulfillmentSelect=useFulfillmentSelectorState(),preferredLocation=_useFulfillmentSelect.preferredLocation,inventory=_useFulfillmentSelect.inventory,selectedLocation=_useFulfillmentSelect.selectedLocation,conditioner=_useFulfillmentSelect.conditioner,fulfillmentPaths=_useFulfillmentSelect.fulfillmentPaths,selection=_useFulfillmentSelect.selection,isDirectShipEnabled=_useFulfillmentSelect.isDirectShipEnabled,isROPISEnabled=_useFulfillmentSelect.isROPISEnabled,isBOPISEnabled=_useFulfillmentSelect.isBOPISEnabled;var usedLocation=selectedLocation||preferredLocation;// Add to cart effect to validate inventory
8
- useEffect(function(){// Add most late conditioner
9
- conditioner.addConditioner('fulfillment-inventory',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var mapping,selectedPath;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!(isDirectShipEnabled&&selection===DIRECT_SHIP)){_context.next=2;break;}return _context.abrupt("return",true);case 2:mapping=_defineProperty(_defineProperty(_defineProperty({},DIRECT_SHIP,isDirectShipEnabled),ROPIS,isROPISEnabled),BOPIS,isBOPISEnabled);if(!(!selection||!mapping[selection]||!usedLocation)){_context.next=5;break;}return _context.abrupt("return",false);case 5:if(isProductAvailable(usedLocation,inventory)){_context.next=7;break;}return _context.abrupt("return",false);case 7:if(!(fulfillmentPaths.length>1)){_context.next=19;break;}_context.next=10;return promisifiedFulfillmentPathSelector();case 10:selectedPath=_context.sent;if(!(selectedPath==='')){_context.next=13;break;}return _context.abrupt("return",false);case 13:if(!(selectedPath===MULTI_LINE_RESERVE)){_context.next=15;break;}return _context.abrupt("return",true);case 15:if(!(selectedPath===QUICK_RESERVE)){_context.next=18;break;}FulfillmentSheet.open({stage:STAGE_RESERVE_FORM,fulfillmentPath:selectedPath});return _context.abrupt("return",false);case 18:return _context.abrupt("return",false);case 19:if(fulfillmentPaths.includes(MULTI_LINE_RESERVE)){_context.next=22;break;}// Open reservation form. Stop adding to a cart
10
- FulfillmentSheet.open({stage:STAGE_RESERVE_FORM});return _context.abrupt("return",false);case 22:return _context.abrupt("return",isProductAvailable(usedLocation,inventory));case 23:case"end":return _context.stop();}},_callee);})),100);return function(){return conditioner.removeConditioner('fulfillment-inventory');};},[conditioner,fulfillmentPaths,selection,usedLocation,isDirectShipEnabled,isROPISEnabled,isBOPISEnabled,inventory]);return null;}
6
+ * @returns {JSX.Element|null} The rendered component or null.
7
+ */export var FulfillmentSelectorAddToCart=function FulfillmentSelectorAddToCart(){var _useFulfillmentSelect=useFulfillmentSelectorState(),preferredLocation=_useFulfillmentSelect.preferredLocation,inventory=_useFulfillmentSelect.inventory,selectedLocation=_useFulfillmentSelect.selectedLocation,conditioner=_useFulfillmentSelect.conditioner,fulfillmentPaths=_useFulfillmentSelect.fulfillmentPaths,selection=_useFulfillmentSelect.selection,isDirectShipEnabled=_useFulfillmentSelect.isDirectShipEnabled,isROPISEnabled=_useFulfillmentSelect.isROPISEnabled,isBOPISEnabled=_useFulfillmentSelect.isBOPISEnabled;var usedLocation=selectedLocation||preferredLocation;useEffect(function(){conditioner.addConditioner('fulfillment-inventory',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var mapping,selectedPath;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!(isDirectShipEnabled&&selection===DIRECT_SHIP)){_context.next=2;break;}return _context.abrupt("return",true);case 2:mapping=_defineProperty(_defineProperty(_defineProperty({},DIRECT_SHIP,isDirectShipEnabled),ROPIS,isROPISEnabled),BOPIS,isBOPISEnabled);if(!(!selection||!mapping[selection]||!usedLocation)){_context.next=5;break;}return _context.abrupt("return",false);case 5:if(isProductAvailable(usedLocation,inventory)){_context.next=7;break;}return _context.abrupt("return",false);case 7:if(!(fulfillmentPaths.length>1)){_context.next=19;break;}_context.next=10;return promisifiedFulfillmentPathSelector();case 10:selectedPath=_context.sent;if(!(selectedPath==='')){_context.next=13;break;}return _context.abrupt("return",false);case 13:if(!(selectedPath===MULTI_LINE_RESERVE)){_context.next=15;break;}return _context.abrupt("return",true);case 15:if(!(selectedPath===QUICK_RESERVE)){_context.next=18;break;}FulfillmentSheet.open({stage:STAGE_RESERVE_FORM,fulfillmentPath:selectedPath});return _context.abrupt("return",false);case 18:return _context.abrupt("return",false);case 19:if(fulfillmentPaths.includes(MULTI_LINE_RESERVE)){_context.next=22;break;}FulfillmentSheet.open({stage:STAGE_RESERVE_FORM});return _context.abrupt("return",false);case 22:return _context.abrupt("return",isProductAvailable(usedLocation,inventory));case 23:case"end":return _context.stop();}},_callee);})),100);return function(){return conditioner.removeConditioner('fulfillment-inventory');};},[conditioner,fulfillmentPaths,selection,usedLocation,isDirectShipEnabled,isROPISEnabled,isBOPISEnabled,inventory]);return null;};
@@ -1,4 +1,4 @@
1
- function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import classNames from'classnames';import{i18n}from"../../../core";import{IN_STORE_PICKUP_BOPIS_LABEL}from"../../constants";import{itemRowDisabled}from"./FulfillmentSelectorItem.style";import{useFulfillmentSelectorState}from"./FulfillmentSelector.hooks";/**
1
+ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import classNames from'classnames';import{i18n}from'@shopgate/engage/core/helpers';import{IN_STORE_PICKUP_BOPIS_LABEL}from"../../constants";import{itemRowDisabled}from"./FulfillmentSelectorItem.style";import{useFulfillmentSelectorState}from"./FulfillmentSelector.hooks";/**
2
2
  * Renders the FulfillmentSelectorBOPIS components.
3
- * @returns {JSX}
4
- */export function FulfillmentSelectorBOPIS(){var _useFulfillmentSelect=useFulfillmentSelectorState(),isBOPISEnabled=_useFulfillmentSelect.isBOPISEnabled,isReady=_useFulfillmentSelect.isReady;var classes=classNames(_defineProperty({},itemRowDisabled.toString(),!isReady||!isBOPISEnabled));return React.createElement("div",{className:classes},i18n.text(IN_STORE_PICKUP_BOPIS_LABEL));}
3
+ * @returns {JSX.Element}
4
+ */export var FulfillmentSelectorBOPIS=function FulfillmentSelectorBOPIS(){var _useFulfillmentSelect=useFulfillmentSelectorState(),isBOPISEnabled=_useFulfillmentSelect.isBOPISEnabled,isReady=_useFulfillmentSelect.isReady;var classes=classNames(_defineProperty({},itemRowDisabled.toString(),!isReady||!isBOPISEnabled));return React.createElement("div",{className:classes},i18n.text(IN_STORE_PICKUP_BOPIS_LABEL));};
@@ -1,5 +1,4 @@
1
1
  function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import*as React from'react';import classNames from'classnames';import{Grid}from'@shopgate/engage/components';import{i18n}from"../../../core";import{Availability}from"../../../product";import{DIRECT_SHIP_LABEL,DIRECT_SHIP}from"../../constants";import{itemRow,itemColumn,itemRowDisabled}from"./FulfillmentSelectorItem.style";import{useFulfillmentSelectorState}from"./FulfillmentSelector.hooks";import{FulfillmentSelectorImpossibleError}from"./FulfillmentSelectorImpossibleError";/**
2
2
  * Renders the direct ship item label.
3
- * @param {Object} props The component props.
4
- * @returns {JSX}
5
- */export function FulfillmentSelectorDirectShip(){var _useFulfillmentSelect=useFulfillmentSelectorState(),productId=_useFulfillmentSelect.productId,selection=_useFulfillmentSelect.selection,isOrderable=_useFulfillmentSelect.isOrderable,isDirectShipEnabled=_useFulfillmentSelect.isDirectShipEnabled,isReady=_useFulfillmentSelect.isReady;var rowClasses=React.useMemo(function(){return classNames(itemRow,_defineProperty({},itemRowDisabled.toString(),!isReady||!isDirectShipEnabled));},[isDirectShipEnabled,isReady]);var selected=selection===DIRECT_SHIP;if(selected&&!isOrderable){return React.createElement(React.Fragment,null,React.createElement("div",null,i18n.text(DIRECT_SHIP_LABEL)),React.createElement(FulfillmentSelectorImpossibleError,null));}return React.createElement(Grid,{className:rowClasses,component:"div"},React.createElement(Grid.Item,{className:itemColumn,grow:1,shrink:0,component:"div"},i18n.text(DIRECT_SHIP_LABEL)),React.createElement(Grid.Item,{className:itemColumn,grow:1,shrink:0,component:"div"},isReady&&isDirectShipEnabled&&isOrderable&&React.createElement(Availability,{productId:productId,fulfillmentSelection:DIRECT_SHIP})));}
3
+ * @returns {JSX.Element}
4
+ */export var FulfillmentSelectorDirectShip=function FulfillmentSelectorDirectShip(){var _useFulfillmentSelect=useFulfillmentSelectorState(),productId=_useFulfillmentSelect.productId,selection=_useFulfillmentSelect.selection,isOrderable=_useFulfillmentSelect.isOrderable,isDirectShipEnabled=_useFulfillmentSelect.isDirectShipEnabled,isReady=_useFulfillmentSelect.isReady;var rowClasses=React.useMemo(function(){return classNames(itemRow,_defineProperty({},itemRowDisabled.toString(),!isReady||!isDirectShipEnabled));},[isDirectShipEnabled,isReady]);var selected=selection===DIRECT_SHIP;if(selected&&!isOrderable){return React.createElement(React.Fragment,null,React.createElement("div",null,i18n.text(DIRECT_SHIP_LABEL)),React.createElement(FulfillmentSelectorImpossibleError,null));}return React.createElement(Grid,{className:rowClasses,component:"div"},React.createElement(Grid.Item,{className:itemColumn,grow:1,shrink:0,component:"div"},i18n.text(DIRECT_SHIP_LABEL)),React.createElement(Grid.Item,{className:itemColumn,grow:1,shrink:0,component:"div"},isReady&&isDirectShipEnabled&&isOrderable&&React.createElement(Availability,{productId:productId,fulfillmentSelection:DIRECT_SHIP})));};
@@ -1,4 +1,4 @@
1
- import React from'react';import{i18n}from'@shopgate/engage/core';import{container}from"./FulfillmentSelectorHeader.style";/**
1
+ import React from'react';import{i18n}from'@shopgate/engage/core/helpers';import{container}from"./FulfillmentSelectorHeader.style";/**
2
2
  * Renders the fulfillment selector title.
3
- * @returns {JSX}
4
- */export function FulfillmentSelectorHeader(){return React.createElement("div",{role:"heading",className:container},i18n.text('locations.fulfillment.heading'));}
3
+ * @returns {JSX.Element}
4
+ */export var FulfillmentSelectorHeader=function FulfillmentSelectorHeader(){return React.createElement("div",{role:"heading",className:container},i18n.text('locations.fulfillment.heading'));};
@@ -1 +1 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export var container=css({fontWeight:500,marginBottom:variables.gap.xsmall});
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export var container=css({fontWeight:500,marginBottom:variables.gap.xsmall}).toString();
@@ -1,8 +1,12 @@
1
- function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import*as React from'react';import classNames from'classnames';import CheckedIcon from'@shopgate/pwa-ui-shared/icons/RadioCheckedIcon';import UncheckedIcon from'@shopgate/pwa-ui-shared/icons/RadioUncheckedIcon';import{radioContainer,disabled as radioContainerDisabled,activeIcon,activeIconDisabled,inactiveIcon,inactiveIconDisabled,radio,content}from"./FulfillmentSelectorItem.style";import{useFulfillmentSelectorState}from"./FulfillmentSelector.hooks";/**
1
+ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import CheckedIcon from'@shopgate/pwa-ui-shared/icons/RadioCheckedIcon';import UncheckedIcon from'@shopgate/pwa-ui-shared/icons/RadioUncheckedIcon';import{radioContainer,disabled as radioContainerDisabled,activeIcon,activeIconDisabled,inactiveIcon,inactiveIconDisabled,radio,content}from"./FulfillmentSelectorItem.style";import{useFulfillmentSelectorState}from"./FulfillmentSelector.hooks";import{DIRECT_SHIP,ROPIS,BOPIS}from"../../constants";/** @typedef {import('./FulfillmentSelector.types').Selection} Selection */ /**
2
2
  * Renders a fulfillment selector radio item.
3
3
  * @param {Object} props The component props.
4
- * @returns {JSX}
5
- */function FulfillmentSelectorItemUnwrapped(props){var name=props.name,children=props.children,onChange=props.onChange,disabled=props.disabled;var _useFulfillmentSelect=useFulfillmentSelectorState(),selection=_useFulfillmentSelect.selection;var checked=selection===name;/**
4
+ * @param {Selection} props.name The name of the selection.
5
+ * @param {React.ReactNode} props.children The child elements.
6
+ * @param {function(Selection): void} props.onChange The change handler.
7
+ * @param {boolean} [props.disabled=false] Whether the item is disabled.
8
+ * @returns {JSX.Element} The rendered component.
9
+ */var FulfillmentSelectorItemUnwrapped=function FulfillmentSelectorItemUnwrapped(_ref){var name=_ref.name,children=_ref.children,onChange=_ref.onChange,disabled=_ref.disabled;var _useFulfillmentSelect=useFulfillmentSelectorState(),selection=_useFulfillmentSelect.selection;var checked=selection===name;/**
6
10
  * Handle the change to the radio item.
7
- * @param {Object} event The change event.
8
- */function handleChange(event){event.preventDefault();if(disabled){return;}onChange(name);}var containerClasses=classNames(radioContainer.toString(),_defineProperty({},radioContainerDisabled.toString(),disabled));return React.createElement("label",{htmlFor:name,className:containerClasses,onClick:handleChange,role:"radio","aria-checked":checked,tabIndex:"0"},checked?React.createElement(CheckedIcon,{className:disabled?activeIconDisabled:activeIcon}):React.createElement(UncheckedIcon,{className:disabled?inactiveIconDisabled:inactiveIcon}),React.createElement("input",{type:"radio",checked:checked,name:name,className:radio,readOnly:true}),React.createElement("div",{className:content},children));}FulfillmentSelectorItemUnwrapped.defaultProps={disabled:false};export var FulfillmentSelectorItem=React.memo(FulfillmentSelectorItemUnwrapped);
11
+ * @param {React.MouseEvent<HTMLLabelElement>} event The click event.
12
+ */var handleChange=function handleChange(event){event.preventDefault();if(disabled){return;}onChange(name);};var containerClasses=classNames(radioContainer.toString(),_defineProperty({},radioContainerDisabled.toString(),disabled));return React.createElement("label",{htmlFor:name,className:containerClasses,onClick:handleChange,role:"radio","aria-checked":checked,tabIndex:"0"},checked?React.createElement(CheckedIcon,{className:disabled?activeIconDisabled:activeIcon}):React.createElement(UncheckedIcon,{className:disabled?inactiveIconDisabled:inactiveIcon}),React.createElement("input",{type:"radio",checked:checked,name:name,className:radio,readOnly:true}),React.createElement("div",{className:content},children));};FulfillmentSelectorItemUnwrapped.defaultProps={disabled:false};export var FulfillmentSelectorItem=React.memo(FulfillmentSelectorItemUnwrapped);
@@ -1 +1 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables,colors=themeConfig.colors;export var radioContainer=css({display:'flex',flexFlow:'row nowrap',padding:"".concat(variables.gap.xsmall,"px 0")});export var disabled=css({cursor:'not-allowed'});var icon={width:24,height:24,flexShrink:0,marginTop:'-1px',marginRight:variables.gap.small,color:'var(--color-text-medium-emphasis)'};export var inactiveIcon=css(icon).toString();export var inactiveIconDisabled=css(icon,{opacity:0.3}).toString();export var activeIcon=css(icon,{color:"var(--color-primary, ".concat(colors.primary,")")}).toString();export var activeIconDisabled=css(icon,{color:"var(--color-primary, ".concat(colors.primary,")"),opacity:0.3}).toString();export var radio=css({display:'none'});export var content=css({flexGrow:1,color:'var(--color-text-high-emphasis)'});export var itemRow=css({alignContent:'stretch',alignItems:'baseline'}).toString();export var itemRowDisabled=css({opacity:0.3});export var itemSpacer=css({marginLeft:16});export var itemColumn=css({display:'block',width:'50%','&:first-of-type':{paddingRight:variables.gap.small},'&:last-of-type':{textAlign:'right'}}).toString();
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables,colors=themeConfig.colors;export var radioContainer=css({display:'flex',flexFlow:'row nowrap',padding:"".concat(variables.gap.xsmall,"px 0")});export var disabled=css({cursor:'not-allowed'});var icon={width:24,height:24,flexShrink:0,marginTop:'-1px',marginRight:variables.gap.small,color:'var(--color-text-medium-emphasis)'};export var inactiveIcon=css(icon).toString();export var inactiveIconDisabled=css(icon,{opacity:0.3}).toString();export var activeIcon=css(icon,{color:"var(--color-primary, ".concat(colors.primary,")")}).toString();export var activeIconDisabled=css(icon,{color:"var(--color-primary, ".concat(colors.primary,")"),opacity:0.3}).toString();export var radio=css({display:'none'}).toString();export var content=css({flexGrow:1,color:'var(--color-text-high-emphasis)'}).toString();export var itemRow=css({alignContent:'stretch',alignItems:'baseline'}).toString();export var itemRowDisabled=css({opacity:0.3});export var itemSpacer=css({marginLeft:16});export var itemColumn=css({display:'block',width:'50%','&:first-of-type':{paddingRight:variables.gap.small},'&:last-of-type':{textAlign:'right'}}).toString();
@@ -1,10 +1,11 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import{hot}from'react-hot-loader/root';import'react-phone-number-input/style.css';import React,{useState,useContext,useMemo,useRef,useLayoutEffect,useCallback,Fragment}from'react';import{TextField,RippleButton,RadioGroup,RadioGroupItem,ProgressBar}from'@shopgate/engage/components';import{useFormState}from"../../../core/hooks/useFormState";import{i18n}from"../../../core/helpers/i18n";import{FulfillmentContext}from"../../locations.context";import{ReserveFormPhone}from"./ReserveFormPhone";import{constraints}from"./ReserveForm.constraints";import{form,fieldset,formField,formHeading,pickerSwitch,pickerItem,button,progressBar}from"./ReserveForm.style";var PICKUP_PERSON_ME='me';var PICKUP_PERSON_OTHER='someoneelse';/**
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import{hot}from'react-hot-loader/root';import'react-phone-number-input/style.css';import React,{useState,useContext,useMemo,useRef,useLayoutEffect,useCallback,Fragment}from'react';import{TextField,RippleButton,RadioGroup,RadioGroupItem,ProgressBar}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core/helpers';import{useFormState}from"../../../core/hooks/useFormState";import{FulfillmentContext}from"../../locations.context";import{ReserveFormPhone}from"./ReserveFormPhone";import{constraints}from"./ReserveForm.constraints";import{form,fieldset,formField,formHeading,pickerSwitch,pickerItem,button,progressBar}from"./ReserveForm.style";// eslint-disable-next-line max-len
2
+ /** @typedef {import('@shopgate/engage/locations/locations.types').ReservationFormValues} ReservationFormValues */var PICKUP_PERSON_ME='me';var PICKUP_PERSON_OTHER='someoneelse';/**
2
3
  * Determines the pick up person.
3
- * @param {Object} userInput The current user input
4
+ * @param {ReservationFormValues|null} userInput The current user input
4
5
  * @return {string}
5
6
  */var determinePickupPerson=function determinePickupPerson(userInput){if(!userInput){return PICKUP_PERSON_ME;}var meFields=['firstName','lastName','email','cellPhone'];var otherFields=['firstName2','lastName2','email2','cellPhone2'];var hasMeFields=meFields.every(function(field){return typeof userInput[field]!=='undefined';});var hasOtherFields=otherFields.every(function(field){return typeof userInput[field]!=='undefined';});if(!hasOtherFields||!hasMeFields){return PICKUP_PERSON_ME;}var valuesEqual=meFields.every(function(field,index){return userInput[field]===userInput[otherFields[index]];});return valuesEqual?PICKUP_PERSON_ME:PICKUP_PERSON_OTHER;};/**
6
7
  * Renders the quick reservation form.
7
- * @returns {JSX}
8
- */function ReserveFormUnwrapped(){var _useContext=useContext(FulfillmentContext),sendReservation=_useContext.sendReservation,userInput=_useContext.userInput;var _useState=useState(determinePickupPerson(userInput)),_useState2=_slicedToArray(_useState,2),picker=_useState2[0],setPicker=_useState2[1];var defaultState={firstName:'',lastName:'',cellPhone:'',email:'',firstName2:'',lastName2:'',cellPhone2:'',email2:''};var validationConstraints=useMemo(function(){return _extends({},constraints,{},picker===PICKUP_PERSON_OTHER&&{firstName2:constraints.firstName,lastName2:constraints.lastName,cellPhone2:constraints.cellPhone,email2:constraints.email});},[picker]);var initialState=userInput?_extends({},defaultState,{},userInput):defaultState;/**
8
+ * @returns {JSX.Element}
9
+ */function ReserveFormUnwrapped(){var _useContext=useContext(FulfillmentContext),sendReservation=_useContext.sendReservation,userInput=_useContext.userInput;var _useState=useState(determinePickupPerson(userInput)),_useState2=_slicedToArray(_useState,2),picker=_useState2[0],setPicker=_useState2[1];/** @type {ReservationFormValues} */var defaultState={firstName:'',lastName:'',cellPhone:'',email:'',firstName2:'',lastName2:'',cellPhone2:'',email2:''};var validationConstraints=useMemo(function(){return _extends({},constraints,{},picker===PICKUP_PERSON_OTHER&&{firstName2:constraints.firstName,lastName2:constraints.lastName,cellPhone2:constraints.cellPhone,email2:constraints.email});},[picker]);/** @type {ReservationFormValues} */var initialState=userInput?_extends({},defaultState,{},userInput):defaultState;/**
9
10
  * @param {Object} values The form values.
10
- */var complete=useCallback(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(values){var response;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:response=values;if(picker===PICKUP_PERSON_ME){response.firstName2=response.firstName;response.lastName2=response.lastName;response.cellPhone2=response.cellPhone;response.email2=response.email;}else{response.firstName2=response.firstName2||response.firstName;response.lastName2=response.lastName2||response.lastName;response.cellPhone2=response.cellPhone2||response.cellPhone;response.email2=response.email2||response.email;}_context.next=4;return sendReservation(response);case 4:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}(),[picker,sendReservation]);var _useFormState=useFormState(initialState,complete,validationConstraints),values=_useFormState.values,handleChange=_useFormState.handleChange,handleSubmit=_useFormState.handleSubmit,changed=_useFormState.changed,valid=_useFormState.valid,_useFormState$validat=_useFormState.validationErrors,validationErrors=_useFormState$validat===void 0?{}:_useFormState$validat,isSubmitting=_useFormState.isSubmitting;var someoneElseRef=useRef(null);useLayoutEffect(function(){if(someoneElseRef.current&&picker===PICKUP_PERSON_OTHER){someoneElseRef.current.scrollIntoView({behavior:'smooth'});}},[picker,someoneElseRef]);return React.createElement(Fragment,null,React.createElement("div",{className:progressBar},React.createElement(ProgressBar,{isVisible:isSubmitting})),React.createElement("form",{onSubmit:handleSubmit,className:form},React.createElement("fieldset",{className:fieldset},React.createElement(TextField,{name:"firstName",value:values.firstName,onChange:handleChange,label:i18n.text('locations.firstName'),className:formField,errorText:i18n.text(validationErrors.firstName)}),React.createElement(TextField,{name:"lastName",value:values.lastName,onChange:handleChange,label:i18n.text('locations.lastName'),className:formField,errorText:i18n.text(validationErrors.lastName)}),React.createElement(ReserveFormPhone,{name:"cellPhone",value:values.cellPhone,onChange:handleChange,label:i18n.text('locations.cellPhone'),errorText:i18n.text(validationErrors.cellPhone)}),React.createElement(TextField,{name:"email",value:values.email,onChange:handleChange,label:i18n.text('locations.emailAddress'),className:formField,errorText:i18n.text(validationErrors.email)})),React.createElement("p",{className:formHeading},i18n.text('locations.who_will_pickup')),React.createElement("div",{className:pickerSwitch},React.createElement(RadioGroup,{name:"picker",direction:"row",value:picker,onChange:setPicker},React.createElement(RadioGroupItem,{label:i18n.text('locations.me'),name:PICKUP_PERSON_ME,className:pickerItem}),React.createElement(RadioGroupItem,{label:i18n.text('locations.someone_else'),name:PICKUP_PERSON_OTHER,className:pickerItem}))),picker===PICKUP_PERSON_OTHER&&React.createElement("fieldset",{className:fieldset,ref:someoneElseRef},React.createElement(TextField,{name:"firstName2",value:values.firstName2,onChange:handleChange,label:i18n.text('locations.firstName'),className:formField,errorText:i18n.text(validationErrors.firstName2)}),React.createElement(TextField,{name:"lastName2",value:values.lastName2,onChange:handleChange,label:i18n.text('locations.lastName'),className:formField,errorText:i18n.text(validationErrors.lastName2)}),React.createElement(ReserveFormPhone,{name:"cellPhone2",value:values.cellPhone2,onChange:handleChange,label:i18n.text('locations.cellPhone'),errorText:i18n.text(validationErrors.cellPhone2)}),React.createElement(TextField,{name:"email2",value:values.email2,onChange:handleChange,label:i18n.text('locations.emailAddress'),className:formField,errorText:i18n.text(validationErrors.email2)})),React.createElement(RippleButton,{type:"secondary",disabled:changed||valid===false||isSubmitting,className:button},i18n.text('locations.place_reservation'))));}export var ReserveForm=hot(ReserveFormUnwrapped);
11
+ */ /** @param {ReservationFormValues} values */var complete=useCallback(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(values){var response;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:response=values;if(picker===PICKUP_PERSON_ME){response.firstName2=response.firstName;response.lastName2=response.lastName;response.cellPhone2=response.cellPhone;response.email2=response.email;}else{response.firstName2=response.firstName2||response.firstName;response.lastName2=response.lastName2||response.lastName;response.cellPhone2=response.cellPhone2||response.cellPhone;response.email2=response.email2||response.email;}_context.next=4;return sendReservation(response);case 4:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}(),[picker,sendReservation]);var _useFormState=useFormState(initialState,complete,validationConstraints),values=_useFormState.values,handleChange=_useFormState.handleChange,handleSubmit=_useFormState.handleSubmit,changed=_useFormState.changed,valid=_useFormState.valid,_useFormState$validat=_useFormState.validationErrors,validationErrors=_useFormState$validat===void 0?{}:_useFormState$validat,isSubmitting=_useFormState.isSubmitting;var someoneElseRef=useRef(null);useLayoutEffect(function(){if(someoneElseRef.current&&picker===PICKUP_PERSON_OTHER){someoneElseRef.current.scrollIntoView({behavior:'smooth'});}},[picker,someoneElseRef]);return React.createElement(Fragment,null,React.createElement("div",{className:progressBar},React.createElement(ProgressBar,{isVisible:isSubmitting})),React.createElement("form",{onSubmit:handleSubmit,className:form},React.createElement("fieldset",{className:fieldset},React.createElement(TextField,{name:"firstName",value:values.firstName,onChange:handleChange,label:i18n.text('locations.firstName'),className:formField,errorText:i18n.text(validationErrors.firstName)}),React.createElement(TextField,{name:"lastName",value:values.lastName,onChange:handleChange,label:i18n.text('locations.lastName'),className:formField,errorText:i18n.text(validationErrors.lastName)}),React.createElement(ReserveFormPhone,{name:"cellPhone",value:values.cellPhone,onChange:handleChange,label:i18n.text('locations.cellPhone'),errorText:i18n.text(validationErrors.cellPhone)}),React.createElement(TextField,{name:"email",value:values.email,onChange:handleChange,label:i18n.text('locations.emailAddress'),className:formField,errorText:i18n.text(validationErrors.email)})),React.createElement("p",{className:formHeading},i18n.text('locations.who_will_pickup')),React.createElement("div",{className:pickerSwitch},React.createElement(RadioGroup,{name:"picker",direction:"row",value:picker,onChange:setPicker},React.createElement(RadioGroupItem,{label:i18n.text('locations.me'),name:PICKUP_PERSON_ME,className:pickerItem}),React.createElement(RadioGroupItem,{label:i18n.text('locations.someone_else'),name:PICKUP_PERSON_OTHER,className:pickerItem}))),picker===PICKUP_PERSON_OTHER&&React.createElement("fieldset",{className:fieldset,ref:someoneElseRef},React.createElement(TextField,{name:"firstName2",value:values.firstName2,onChange:handleChange,label:i18n.text('locations.firstName'),className:formField,errorText:i18n.text(validationErrors.firstName2)}),React.createElement(TextField,{name:"lastName2",value:values.lastName2,onChange:handleChange,label:i18n.text('locations.lastName'),className:formField,errorText:i18n.text(validationErrors.lastName2)}),React.createElement(ReserveFormPhone,{name:"cellPhone2",value:values.cellPhone2,onChange:handleChange,label:i18n.text('locations.cellPhone'),errorText:i18n.text(validationErrors.cellPhone2)}),React.createElement(TextField,{name:"email2",value:values.email2,onChange:handleChange,label:i18n.text('locations.emailAddress'),className:formField,errorText:i18n.text(validationErrors.email2)})),React.createElement(RippleButton,{type:"secondary",disabled:changed||valid===false||isSubmitting,className:button},i18n.text('locations.place_reservation'))));}export var ReserveForm=hot(ReserveFormUnwrapped);
@@ -1 +1 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables,colors=themeConfig.colors;export var form=css({background:colors.background,padding:"".concat(variables.gap.small*1.5,"px ").concat(variables.gap.small*1.5,"px ").concat(variables.gap.big,"px"),boxShadow:'inset rgba(0, 0, 0, .117647) 0 1px 6px, inset rgba(0, 0, 0, .117647) 0 1px 4px'});export var formHeading=css({fontSize:'1.125rem',fontWeight:'bold',margin:"0 0 ".concat(variables.gap.small,"px")});export var fieldset=css({padding:0,margin:"0 0 ".concat(variables.gap.big,"px"),border:0});export var formField=css({width:'100%',paddingBottom:variables.gap.small});export var phoneField=css({position:'relative',width:'100%',paddingTop:variables.gap.big*0.75,paddingBottom:variables.gap.big*1.25,marginBottom:variables.gap.small,' input.PhoneInputInput':{outline:'none',fontSize:'1rem',lineHeight:'1.1875rem',borderRadius:0,paddingBottom:variables.gap.xsmall*1.5,borderBottom:"1px solid ".concat(colors.shade12),'&:focus':{borderBottom:"2px solid ".concat(colors.primary),paddingBottom:variables.gap.xsmall*1.5-1}}});export var phoneFieldError=css({' input.PhoneInputInput':{borderBottom:"2px solid var(--color-state-alert, ".concat(colors.error,") !important"),paddingBottom:variables.gap.xsmall*1.5-1}});export var phoneFieldErrorText=css({position:'absolute',width:'100%',bottom:2,fontSize:'0.75rem',lineHeight:0.875,color:"var(--color-state-alert, ".concat(colors.error,")"),overflow:'hidden',whiteSpace:'nowrap',textOverflow:'ellipsis'});export var pickerSwitch=css({marginTop:'-1rem'});export var pickerItem=css({paddingRight:variables.gap.xbig,':last-of-type':{paddingRight:0}}).toString();export var button=css({width:'100%'}).toString();export var progressBar=css({height:'4px',position:'relative'});
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables,colors=themeConfig.colors;export var form=css({background:colors.background,padding:"".concat(variables.gap.small*1.5,"px ").concat(variables.gap.small*1.5,"px ").concat(variables.gap.big,"px"),boxShadow:'inset rgba(0, 0, 0, .117647) 0 1px 6px, inset rgba(0, 0, 0, .117647) 0 1px 4px'});export var formHeading=css({fontSize:'1.125rem',fontWeight:'bold',margin:"0 0 ".concat(variables.gap.small,"px")});export var fieldset=css({padding:0,margin:"0 0 ".concat(variables.gap.big,"px"),border:0});export var formField=css({width:'100%',paddingBottom:variables.gap.small});export var phoneField=css({position:'relative',width:'100%',paddingTop:variables.gap.big*0.75,paddingBottom:variables.gap.big*1.25,marginBottom:variables.gap.small,' input.PhoneInputInput':{outline:'none',fontSize:'1rem',lineHeight:'1.1875rem',borderRadius:0,paddingBottom:variables.gap.xsmall*1.5,borderBottom:"1px solid ".concat(colors.shade12),'&:focus':{borderBottom:"2px solid ".concat(colors.primary),paddingBottom:variables.gap.xsmall*1.5-1}}});export var phoneFieldError=css({' input.PhoneInputInput':{borderBottom:"2px solid var(--color-state-alert, ".concat(colors.error,") !important"),paddingBottom:variables.gap.xsmall*1.5-1}});export var phoneFieldErrorText=css({position:'absolute',width:'100%',bottom:2,fontSize:'0.75rem',lineHeight:0.875,color:"var(--color-state-alert, ".concat(colors.error,")"),overflow:'hidden',whiteSpace:'nowrap',textOverflow:'ellipsis'}).toString();export var pickerSwitch=css({marginTop:'-1rem'});export var pickerItem=css({paddingRight:variables.gap.xbig,':last-of-type':{paddingRight:0}}).toString();export var button=css({width:'100%'}).toString();export var progressBar=css({height:'4px',position:'relative'});
@@ -1,3 +1,7 @@
1
1
  import{connect}from'react-redux';import{getPreferredLocationAddress}from"../../selectors";/**
2
- * @returns {Function}
3
- */function makeMapStateToProps(){return function(state){return{userLocation:getPreferredLocationAddress(state)};};}export default connect(makeMapStateToProps);
2
+ * @typedef {import('./ReserveFormPhone.types').OwnProps} OwnProps
3
+ * @typedef {import('./ReserveFormPhone.types').StateProps} StateProps
4
+ */ /**
5
+ * Maps state to props.
6
+ * @returns {function(Object): StateProps} A function that maps state to props.
7
+ */var makeMapStateToProps=function makeMapStateToProps(){return function(state){return{userLocation:getPreferredLocationAddress(state)};};};export default connect(makeMapStateToProps);
@@ -1,5 +1,10 @@
1
- function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import*as React from'react';import classnames from'classnames';import{i18n}from'@shopgate/engage/core';import{parsePhoneNumber}from'react-phone-number-input';import PhoneInput from'react-phone-number-input/mobile';import{getCountries}from'react-phone-number-input/input';import en from'react-phone-number-input/locale/en';import de from'react-phone-number-input/locale/de';import es from'react-phone-number-input/locale/es';import fr from'react-phone-number-input/locale/fr';import pt from'react-phone-number-input/locale/pt';import flags from'react-phone-number-input/flags';import TextField from'@shopgate/pwa-ui-shared/TextField';import{useCountriesNames}from'@shopgate/engage/i18n';import{FulfillmentContext}from"../../locations.context";import{formField,phoneField,phoneFieldError,phoneFieldErrorText}from"./ReserveForm.style";import connect from"./ReserveFormPhone.connector";var builtInCountries=getCountries();var locales={en:en,de:de,es:es,fr:fr,pt:pt};/**
1
+ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useMemo,useContext,memo,useCallback}from'react';import PropTypes from'prop-types';import classnames from'classnames';import{i18n}from'@shopgate/engage/core';import{parsePhoneNumber}from'react-phone-number-input';import PhoneInput from'react-phone-number-input/mobile';import{getCountries}from'react-phone-number-input/input';import en from'react-phone-number-input/locale/en';import de from'react-phone-number-input/locale/de';import es from'react-phone-number-input/locale/es';import fr from'react-phone-number-input/locale/fr';import pt from'react-phone-number-input/locale/pt';import flags from'react-phone-number-input/flags';import TextField from'@shopgate/pwa-ui-shared/TextField';import{useCountriesNames}from'@shopgate/engage/i18n';import{FulfillmentContext}from"../../locations.context";import{formField,phoneField,phoneFieldError,phoneFieldErrorText}from"./ReserveForm.style";import connect from"./ReserveFormPhone.connector";/**
2
+ * @typedef {import('./ReserveFormPhone.types').OwnProps} OwnProps
3
+ * @typedef {import('./ReserveFormPhone.types').StateProps} StateProps
4
+ */ /**
5
+ * @typedef {OwnProps & StateProps} Props
6
+ */var builtInCountries=getCountries();var locales={en:en,de:de,es:es,fr:fr,pt:pt};/**
2
7
  * Renders the reserve form phone input maybe with country selection.
3
- * @param {Object} props The component props.
8
+ * @param {Props} props The component props.
4
9
  * @returns {JSX.Element}
5
- */var ReserveFormPhoneUnwrapped=React.memo(function(props){var name=props.name,value=props.value,onChange=props.onChange,label=props.label,errorText=props.errorText,userLocation=props.userLocation;var _React$useContext=React.useContext(FulfillmentContext),shopSettings=_React$useContext.shopSettings,userInput=_React$useContext.userInput;var initialValue=React.useMemo(function(){return userInput&&userInput[name]?userInput[name]:'';},[name,userInput]);var supportedCountries=React.useMemo(function(){return shopSettings?shopSettings.supportedCountries:[];},[shopSettings]);var countries=React.useMemo(function(){if(!supportedCountries){return builtInCountries;}var sortedCountries=[].concat(builtInCountries);var sanitizedSupportedCountries=supportedCountries.map(function(country){var pieces=country.split('_');return pieces[0];});sanitizedSupportedCountries.forEach(function(country){sortedCountries.splice(sortedCountries.indexOf(country),1);});return[].concat(sanitizedSupportedCountries,sortedCountries);},[supportedCountries]);var countriesNames=useCountriesNames(supportedCountries,locales);var labels=React.useMemo(function(){var output={};if(!countries){return output;}countries.forEach(function(key){var pieces=key.split('_');output[pieces[0]]=countriesNames[key];});return output;},[countries,countriesNames]);var defaultCountry=React.useMemo(function(){if(!initialValue&&!value&&userLocation){return userLocation.country;}var phoneNumber=parsePhoneNumber(value||'');if(phoneNumber&&phoneNumber.country){return phoneNumber.country;}if(userLocation){return userLocation.country;}return i18n.getLang().split('-')[1];},[initialValue,userLocation,value]);var handleChange=React.useCallback(function(phoneValue){onChange(phoneValue,{target:{name:name}});},[name,onChange]);var phoneClasses=classnames(_defineProperty(_defineProperty({},phoneField,true),phoneFieldError,!!errorText));if(!countries||countries.length===0){return React.createElement(TextField,{name:name,value:value,onChange:onChange,label:label,className:formField,errorText:errorText});}return React.createElement("div",{className:phoneClasses},React.createElement(PhoneInput,{defaultCountry:defaultCountry,addInternationalOption:false,flags:flags,name:name,value:value||'',onChange:handleChange,placeholder:label,countries:countries,labels:labels}),!!errorText&&React.createElement("div",{className:phoneFieldErrorText},errorText));});export var ReserveFormPhone=connect(ReserveFormPhoneUnwrapped);
10
+ */var ReserveFormPhoneUnwrapped=memo(function(props){var name=props.name,value=props.value,onChange=props.onChange,label=props.label,errorText=props.errorText,userLocation=props.userLocation;var _useContext=useContext(FulfillmentContext),shopSettings=_useContext.shopSettings,userInput=_useContext.userInput;var initialValue=useMemo(function(){return userInput&&userInput[name]?userInput[name]:'';},[name,userInput]);var supportedCountries=useMemo(function(){return shopSettings?shopSettings.supportedCountries:[];},[shopSettings]);var countries=useMemo(function(){if(!supportedCountries){return builtInCountries;}var sortedCountries=[].concat(builtInCountries);var sanitizedSupportedCountries=supportedCountries.map(function(country){var pieces=country.split('_');return pieces[0];});sanitizedSupportedCountries.forEach(function(country){sortedCountries.splice(sortedCountries.indexOf(country),1);});return[].concat(sanitizedSupportedCountries,sortedCountries);},[supportedCountries]);var countriesNames=useCountriesNames(supportedCountries,locales);var labels=useMemo(function(){var output={};if(!countries||!Array.isArray(countries)||countries.length===0){return output;}countries.forEach(function(key){var pieces=key.split('_');output[pieces[0]]=countriesNames[key];});return output;},[countries,countriesNames]);var defaultCountry=useMemo(function(){if(!initialValue&&!value&&userLocation){return userLocation.country;}var phoneNumber=parsePhoneNumber(value||'');if(phoneNumber&&phoneNumber.country){return phoneNumber.country;}if(userLocation&&userLocation.country){return userLocation.country;}return i18n.getLang().split('-')[1];},[initialValue,userLocation,value]);var handleChange=useCallback(function(phoneValue){onChange(phoneValue,{target:{name:name}});},[name,onChange]);var phoneClasses=classnames(_defineProperty(_defineProperty({},phoneField,true),phoneFieldError,!!errorText));if(!countries||countries.length===0){return React.createElement(TextField,{name:name,value:value,onChange:onChange,label:label,className:formField,errorText:errorText});}return React.createElement("div",{className:phoneClasses},React.createElement(PhoneInput,{defaultCountry:defaultCountry,addInternationalOption:false,flags:flags,name:name,value:value||'',onChange:handleChange,placeholder:label,countries:countries,labels:labels}),!!errorText&&React.createElement("div",{className:phoneFieldErrorText},errorText));});ReserveFormPhoneUnwrapped.defaultProps={errorText:'',userLocation:null,value:''};export var ReserveFormPhone=connect(ReserveFormPhoneUnwrapped);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @typedef {Object} OwnProps
3
+ * @property {string} name
4
+ * @property {string} value
5
+ * @property {string} label
6
+ * @property {string} errorText
7
+ * @property {(value: string, event: any) => void} onChange
8
+ */ /**
9
+ * @typedef {Object} StateProps
10
+ * @property {Object<string, any> | null} userLocation
11
+ */
@@ -1 +1,3 @@
1
- import{createContext}from'react';export var StoreContext=createContext({});
1
+ import{createContext}from'react';/**
2
+ * @typedef {import('../../locations.types').Location} Location
3
+ */export var StoreContext=createContext(/** @type {Location} */{});
@@ -1,3 +1,3 @@
1
1
  function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useContext,useMemo}from'react';import classNames from'classnames';import{StoreContext}from"./Store.context";import{StoreFinderContext}from"../../locations.context";import StoreFinderLocationHeader from"./StoreFinderLocationHeader";import{container,selected}from"./StoreFinderLocation.style";import{StoreFinderSelectLocationButton}from"./StoreFinderSelectLocationButton";import StoreFinderStoreInfoButton from"./StoreFinderStoreInfoButton";/**
2
- * @returns {JSX}
2
+ * @returns {JSX.Element}
3
3
  */var StoreFinderLocation=function StoreFinderLocation(){var store=useContext(StoreContext);var _useContext=useContext(StoreFinderContext),selectedLocation=_useContext.selectedLocation;var isSelected=useMemo(function(){var _ref=selectedLocation||{},code=_ref.code;return store.code===code;},[selectedLocation,store.code]);return React.createElement("div",{className:classNames(container,_defineProperty({},selected,isSelected)),"data-location-code":store.code},React.createElement(StoreFinderLocationHeader,null),React.createElement(StoreFinderSelectLocationButton,null),React.createElement(StoreFinderStoreInfoButton,null));};export default StoreFinderLocation;
@@ -1 +1,3 @@
1
- import{createContext}from'react';export var StoreContext=createContext({});
1
+ /**
2
+ * @typedef {import('../../locations.types').Location} Location
3
+ */import{createContext}from'react';export var StoreContext=createContext(/** @type {Location} */{});
@@ -5,5 +5,5 @@ export{PRODUCT_FULFILLMENT_SELECTOR,PRODUCT_LOCATION_STOCK_INFO,DIRECT_SHIP,DIRE
5
5
  export*from"./selectors";// STREAMS
6
6
  export{submitReservationSuccess$,preferredLocationDidUpdate$,preferredLocationDidUpdateGlobal$,preferredLocationDidUpdateGlobalNotOnCategory$,preferredLocationDidUpdateGlobalOnCategory$,preferredLocationDidUpdateGlobalNotOnSearch$,preferredLocationDidUpdateGlobalOnSearch$,sendDefaultLocationCodeSuccess$}from"./locations.streams";// HOOKS
7
7
  export{useFulfillmentState}from"./locations.hooks";// TYPES
8
- // CONTEXT
8
+ export{}from/** @typedef {import('./locations.types').LocationAddress} */ /** @typedef {import('./locations.types').Location} */ /** @typedef {import('./locations.types').LocationsByIdState} */ /** @typedef {import('./locations.types').LocationsByProductIdState} */ /** @typedef {import('./locations.types').FulfillmentPath} */ /** @typedef {import('./locations.types').UserLocationState} */ /** @typedef {import('./locations.types').ReservationFormValues} */ /** @typedef {import('./locations.types').UserLocationFulfillmentMethod} */ /** @typedef {import('./locations.types').UserLocationLocationCode} */ /** @typedef {import('./locations.types').UserFormInputState} */ /** @typedef {import('./locations.types').LocationsState} */ /** @typedef {import('./locations.types').SheetStage} */ /** @typedef {import('./locations.types').SheetCallbackFn} */ /** @typedef {import('./locations.types').SheetOpenParams} */ /** @typedef {import('./locations.types').ReservationResponse} */ /** @typedef {import('./locations.types').LocationOperationHours} */ /** @typedef {import('./locations.types').LocationAware} */ /** @typedef {import('./locations.types').OptionalLocationAware} */"./locations.types";// CONTEXT
9
9
  export{FulfillmentContext}from"./locations.context";
@@ -1 +1,32 @@
1
- import{createContext}from'react';import{STAGE_SELECT_STORE}from"./constants";export var FulfillmentContext=createContext({selectLocation:function selectLocation(){return Promise.resolve();},selectStoreFinderLocation:function selectStoreFinderLocation(){},changeFulfillment:function changeFulfillment(){},sendReservation:function sendReservation(){return Promise.resolve();},isStage:function isStage(){return false;},handleOpen:function handleOpen(){},handleClose:function handleClose(){},setIsLoading:function setIsLoading(){},location:null,storeFinderLocation:null,locations:[],orderNumbers:[],baseProduct:null,product:null,userInput:null,stage:STAGE_SELECT_STORE,title:null,fulfillmentPath:null,fulfillmentMethods:null,enabledFulfillmentMethods:null,shopSettings:null,isOpen:false,errors:null,noLocationSelection:false,isStoreFinder:false,isLoading:false});export var StoreFinderContext=createContext({});
1
+ import{createContext}from'react';import{STAGE_SELECT_STORE}from"./constants";/* eslint-disable max-len */ /** @typedef {import('@shopgate/engage/locations/locations.types').Location} Location */ /** @typedef {import('@shopgate/engage/locations/locations.types').ReservationFormValues} ReservationFormValues */ /** @typedef {import('@shopgate/engage/locations/locations.types').SheetStage} SheetStage */ /** @typedef {import('@shopgate/engage/locations/locations.types').FulfillmentPath} FulfillmentPath */ /** @typedef {import('@shopgate/engage/locations/locations.types').SheetOpenParams} SheetOpenParams */ /** @typedef {import('@shopgate/engage/locations/locations.types').SheetCallbackFn} SheetCallbackFn */ /** @typedef {import('../product/product.types').Product} Product */ /** @typedef {import('../core/config/config.types').ShopSettings} ShopSettings */ /* eslint-enable max-len */ /**
2
+ * @typedef {Object} FulfillmentContextProps
3
+ * @property {function(Location): Promise<void>} selectLocation
4
+ * @property {function(Location): void} selectStoreFinderLocation
5
+ * @property {(method: string, cartItem: Object<string, any>) => void} changeFulfillment
6
+ * @property {function(ReservationFormValues): Promise<void>} sendReservation
7
+ * @property {function(SheetStage): boolean} isStage
8
+ * @property {function(SheetOpenParams): void} handleOpen
9
+ * @property {(isLoading: boolean) => void} setIsLoading
10
+ * @property {SheetCallbackFn} handleClose
11
+ * @property {Location|null} location
12
+ * @property {Location|null} storeFinderLocation
13
+ * @property {Location[]|null} locations
14
+ * @property {string[]|null} orderNumbers
15
+ * @property {Product|null} baseProduct
16
+ * @property {Product|null} product
17
+ * @property {ReservationFormValues|null} userInput
18
+ * @property {SheetStage|null} stage
19
+ * @property {string|null} title
20
+ * @property {FulfillmentPath|null} fulfillmentPath
21
+ * @property {string[]|null} fulfillmentMethods
22
+ * @property {string[]|null} enabledFulfillmentMethods
23
+ * @property {ShopSettings|null} shopSettings
24
+ * @property {boolean} isOpen
25
+ * @property {string[]|null} errors
26
+ * @property {boolean} [noLocationSelection]
27
+ * @property {boolean} [isStoreFinder]
28
+ * @property {boolean} [isLoading]
29
+ * @property {Object} [meta]
30
+ */export var FulfillmentContext=createContext(/** @type {FulfillmentContextProps} */{selectLocation:function selectLocation(){return Promise.resolve();},selectStoreFinderLocation:function selectStoreFinderLocation(){},changeFulfillment:function changeFulfillment(){},sendReservation:function sendReservation(){return Promise.resolve();},isStage:function isStage(){return false;},handleOpen:function handleOpen(){},handleClose:function handleClose(){},setIsLoading:function setIsLoading(){},location:null,storeFinderLocation:null,locations:[],orderNumbers:[],baseProduct:null,product:null,userInput:null,stage:STAGE_SELECT_STORE,title:null,fulfillmentPath:null,fulfillmentMethods:null,enabledFulfillmentMethods:null,shopSettings:null,isOpen:false,errors:null,noLocationSelection:false,isStoreFinder:false,isLoading:false});/**
31
+ * @typedef {Object} StoreFinderContextProps
32
+ */export var StoreFinderContext=createContext(/** @type {StoreFinderContextProps} */{});
@@ -1 +1,130 @@
1
- import{DIRECT_SHIP,ROPIS,BOPIS,STAGE_SELECT_STORE,STAGE_RESERVE_FORM,STAGE_RESPONSE_SUCCESS,STAGE_RESPONSE_ERROR,QUICK_RESERVE,MULTI_LINE_RESERVE}from"./constants";
1
+ /**
2
+ * @typedef {Object} LocationType
3
+ * @property {string} code
4
+ * @property {string} name
5
+ */ /**
6
+ * @typedef {Object} LocationOperationHours
7
+ * @property {string|null} sun
8
+ * @property {string|null} mon
9
+ * @property {string|null} tue
10
+ * @property {string|null} wed
11
+ * @property {string|null} thu
12
+ * @property {string|null} fri
13
+ * @property {string|null} sat
14
+ */ /**
15
+ * @typedef {Object} LocationProductInventory
16
+ * @property {boolean} isAvailable
17
+ * @property {number|null} visible
18
+ */ /**
19
+ * @typedef {Object} LocationAddress
20
+ * @property {string} code
21
+ * @property {string} name
22
+ * @property {string} street
23
+ * @property {string|null} street2
24
+ * @property {string|null} street3
25
+ * @property {string|null} street4
26
+ * @property {string} postalCode
27
+ * @property {string} city
28
+ * @property {string} region
29
+ * @property {string} country
30
+ * @property {string} [phoneNumber]
31
+ * @property {string} [faxNumber]
32
+ * @property {string} [emailAddress]
33
+ * @property {boolean} isPrimary
34
+ */ /**
35
+ * @typedef {Object} Location
36
+ * @property {string|null} code
37
+ * @property {string|null} name
38
+ * @property {string} [status]
39
+ * @property {string[]} [supportedFulfillmentMethods]
40
+ * @property {number} [latitude]
41
+ * @property {number} [longitude]
42
+ * @property {string} [timeZone]
43
+ * @property {string} [localeCode]
44
+ * @property {boolean} [isComingSoon]
45
+ * @property {boolean} [isDefault]
46
+ * @property {LocationType} [type]
47
+ * @property {LocationOperationHours} [operationHours]
48
+ * @property {LocationAddress} [address]
49
+ * @property {LocationAddress[]} [addresses]
50
+ * @property {LocationProductInventory} [productInventory]
51
+ * @property {number} [distance]
52
+ * @property {string} [unitSystem]
53
+ * @property {Object} [inventory]
54
+ */ /**
55
+ * @typedef {Object} LocationAware
56
+ * @property {Location} location
57
+ * @property {string|null} [fulfillmentMethod]
58
+ */ /**
59
+ * @typedef {Object} OptionalLocationAware
60
+ * @property {Location|null} [location]
61
+ * @property {string|null} [fulfillmentMethod]
62
+ */ /**
63
+ * @typedef {Object} ProductLocations
64
+ * @property {boolean} isFetching
65
+ * @property {number} expires
66
+ * @property {Location[]} locations
67
+ */ /**
68
+ * @typedef {Object<string, Location>} LocationsByIdState
69
+ */ /**
70
+ * @typedef {Object<string, ProductLocations>} LocationsByProductIdState
71
+ */ /**
72
+ * @typedef {Object} UserLocationState
73
+ * @property {string|null} code
74
+ * @property {string|null} name
75
+ * @property {string|null} productCode
76
+ * @property {number|null} visibleInventory
77
+ * @property {string|null} addressCode
78
+ * @property {string|null} fulfillmentMethod
79
+ */ /**
80
+ * @typedef {Object} ReservationFormValues
81
+ * @property {string} [firstName]
82
+ * @property {string} [lastName]
83
+ * @property {string} [cellPhone]
84
+ * @property {string} [email]
85
+ * @property {string} [firstName2]
86
+ * @property {string} [lastName2]
87
+ * @property {string} [cellPhone2]
88
+ * @property {string} [email2]
89
+ */ /**
90
+ * @typedef {Object<string, string|null>} UserFormInputState
91
+ */ /**
92
+ * @typedef {(
93
+ * typeof import('./constants').QUICK_RESERVE |
94
+ * typeof import('./constants').MULTI_LINE_RESERVE
95
+ * )} FulfillmentPath
96
+ */ /**
97
+ * @callback SheetCallbackFn
98
+ * @param {import('../../locations.types').Location | null} location
99
+ * @param {string | null} productId
100
+ * @param {boolean | null} orderSuccess
101
+ * @returns {void}
102
+ */ /**
103
+ * @typedef {(typeof DIRECT_SHIP | typeof ROPIS| typeof BOPIS)} UserLocationFulfillmentMethod
104
+ */ /**
105
+ * @typedef {string | null} UserLocationLocationCode
106
+ */ /**
107
+ * @typedef {Object} LocationsState
108
+ * @property {LocationsByIdState|{}} locationsById
109
+ * @property {LocationsByProductIdState|{}} locationsByProductId
110
+ * @property {UserLocationState|{}} userLocation
111
+ * @property {ReservationFormValues} userFormInput
112
+ * @property {string} userSearchQuery
113
+ */ /**
114
+ * @typedef {(
115
+ * typeof import('./constants').STAGE_SELECT_STORE |
116
+ * typeof import('./constants').STAGE_RESERVE_FORM |
117
+ * typeof import('./constants').STAGE_RESPONSE_SUCCESS |
118
+ * typeof import('./constants').STAGE_RESPONSE_ERROR
119
+ * )} SheetStage
120
+ */ /**
121
+ * @typedef {Object} SheetOpenParams
122
+ * @property {SheetCallbackFn} [callback]
123
+ * @property {SheetStage} [stage]
124
+ * @property {FulfillmentPath} [fulfillmentPath]
125
+ * @property {boolean} [changeOnly]
126
+ */ /**
127
+ * @typedef {Object} ReservationResponse
128
+ * @property {string[]|null} orderNumbers
129
+ * @property {string[]|null} errors
130
+ */
@@ -1,10 +1,14 @@
1
1
  import{connect}from'react-redux';import _showModal from'@shopgate/pwa-common/actions/modal/showModal';import{getBaseProduct,getProduct}from'@shopgate/pwa-common-commerce/product/selectors/product';import _addProductsToCart from'@shopgate/pwa-common-commerce/cart/actions/addProductsToCart';import _updateProductsInCart from'@shopgate/pwa-common-commerce/cart/actions/updateProductsInCart';import{getCartProducts,getActiveFulfillmentSlot,getActiveFulfillmentSlotLocationCode}from'@shopgate/engage/cart/cart.selectors';import{makeGetFulfillmentPaths,makeGetEnabledFulfillmentMethods,getShopSettings}from'@shopgate/engage/core/config';import{getRestrictMultiLocationOrders,getFulfillmentSchedulingEnabled}from'@shopgate/engage/core';import{selectLocation as _selectLocation,storeFormInput as _storeFormInput}from"../action-creators";import{getFilteredLocations,makeGetLocationInventory,makeGetLocationsForProduct,getPreferredLocation,getUserFormInput,getProductFulfillmentMethods,getIsFetching}from"../selectors";import{submitReservation as _submitReservation}from"../actions";/**
2
+ * @typedef {import('./FulfillmentProvider.types').OwnProps} OwnProps
3
+ * @typedef {import('./FulfillmentProvider.types').StateProps} StateProps
4
+ * @typedef {import('./FulfillmentProvider.types').DispatchProps} DispatchProps
5
+ */ /**
2
6
  * @returns {Function}
3
7
  */function makeMapStateToProps(){/* eslint-disable require-jsdoc */var getProductCode=function getProductCode(_,props){return props.variantId||props.productId||null;};/* eslint-enable require-jsdoc */var getInventory=makeGetLocationInventory(function(state,props){var _getPreferredLocation;return((_getPreferredLocation=getPreferredLocation(state,props))===null||_getPreferredLocation===void 0?void 0:_getPreferredLocation.code)||null;},getProductCode);var getProductLocations=makeGetLocationsForProduct(getProductCode);var getFulfillmentPaths=makeGetFulfillmentPaths();var getEnabledFulfillmentMethods=makeGetEnabledFulfillmentMethods();/**
4
- * @param {Object} state The application state.
5
- * @param {Object} props The component props.
8
+ * @param {StateProps} state The application state.
9
+ * @param {OwnProps} props The component props.
6
10
  * @returns {Object}
7
11
  */return function(state,props){return{locations:props.noProduct?getFilteredLocations(state,props):getProductLocations(state,props),baseProduct:getBaseProduct(state,props),product:getProduct(state,props),location:getPreferredLocation(state,props),inventory:getInventory(state,props),userInput:getUserFormInput(state),fulfillmentPaths:getFulfillmentPaths(state),fulfillmentMethods:getProductFulfillmentMethods(state,props),enabledFulfillmentMethods:getEnabledFulfillmentMethods(state,props),shopSettings:getShopSettings(state),isFetching:getIsFetching(state),restrictMultiLocationOrders:getRestrictMultiLocationOrders(state),cartProducts:getCartProducts(state),fulfillmentSchedulingEnabled:getFulfillmentSchedulingEnabled(state),activeFulfillmentSlot:getActiveFulfillmentSlot(state),activeFulfillmentSlotLocationCode:getActiveFulfillmentSlotLocationCode(state)};};}/**
8
- * @param {Function} dispatch The dispatch function.
12
+ * @param {DispatchProps} dispatch The dispatch function.
9
13
  * @returns {Object}
10
14
  */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{selectLocation:function selectLocation(){return dispatch(_selectLocation.apply(void 0,arguments));},submitReservation:function submitReservation(){return dispatch(_submitReservation.apply(void 0,arguments));},storeFormInput:function storeFormInput(){return dispatch(_storeFormInput.apply(void 0,arguments));},addProductsToCart:function addProductsToCart(){return dispatch(_addProductsToCart.apply(void 0,arguments));},updateProductsInCart:function updateProductsInCart(){return dispatch(_updateProductsInCart.apply(void 0,arguments));},showModal:function showModal(){return dispatch(_showModal.apply(void 0,arguments));}};};export default connect(makeMapStateToProps,mapDispatchToProps);