@shopgate/engage 7.20.0-beta.10 → 7.20.0-beta.12

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.
@@ -1,4 +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 React,{useContext,useMemo}from'react';import classNames from'classnames';import I18n from'@shopgate/pwa-common/components/I18n';import Link from'@shopgate/pwa-common/components/Link';import{SurroundPortals}from'@shopgate/engage/components';import{CART_CHECKOUT_BUTTON}from'@shopgate/pwa-common-commerce/cart/constants/Portals';import RippleButton from'@shopgate/pwa-ui-shared/RippleButton';import{CHECKOUT_PATH}from'@shopgate/pwa-common/constants/RoutePaths';import{CartContext}from"../../cart.context";import{container,button,disabledButton}from"./CartSummaryWideCheckoutButton.style";import connect from"./CartSummaryWideCheckoutButton.connector";/**
2
2
  * @param {Object} props The component props
3
3
  * @returns {JSX}
4
- */var CartSummaryWideCheckoutButton=function CartSummaryWideCheckoutButton(_ref){var isOrderable=_ref.isOrderable;var _useContext=useContext(CartContext),isLoading=_useContext.isLoading;var isActive=useMemo(function(){return isOrderable&&!isLoading;},[isLoading,isOrderable]);var classes=classNames(button,_defineProperty({},disabledButton,!isActive));return React.createElement("div",{className:container},React.createElement(SurroundPortals,{portalName:CART_CHECKOUT_BUTTON,props:{isActive:isActive}},React.createElement(Link,{href:CHECKOUT_PATH,disabled:!isActive},React.createElement(RippleButton,{disabled:!isActive,type:"regular",className:classes},React.createElement(I18n.Text,{string:"cart.checkout"})))));};CartSummaryWideCheckoutButton.defaultProps={isOrderable:true};export default connect(CartSummaryWideCheckoutButton);
4
+ */var CartSummaryWideCheckoutButton=function CartSummaryWideCheckoutButton(_ref){var isOrderable=_ref.isOrderable;var _useContext=useContext(CartContext),isLoading=_useContext.isLoading;var isActive=useMemo(function(){return isOrderable&&!isLoading;},[isLoading,isOrderable]);var classes=classNames(button,_defineProperty({},disabledButton,!isActive));return React.createElement("div",{className:container},React.createElement(SurroundPortals,{portalName:CART_CHECKOUT_BUTTON,portalProps:{isActive:isActive}},React.createElement(Link,{href:CHECKOUT_PATH,disabled:!isActive},React.createElement(RippleButton,{disabled:!isActive,type:"regular",className:classes},React.createElement(I18n.Text,{string:"cart.checkout"})))));};CartSummaryWideCheckoutButton.defaultProps={isOrderable:true};export default connect(CartSummaryWideCheckoutButton);
@@ -2,4 +2,4 @@ import React,{useContext,useMemo}from'react';import I18n from'@shopgate/pwa-comm
2
2
  * Renders the cart payment bar checkout button.
3
3
  * @param {boolean} isOrderable Whether the cart is orderable.
4
4
  * @return {JSX}
5
- */function PaymentBarCheckoutButton(_ref){var isOrderable=_ref.isOrderable;var _useContext=useContext(CartContext),isLoading=_useContext.isLoading;var isActive=useMemo(function(){return isOrderable&&!isLoading;},[isLoading,isOrderable]);return React.createElement(SurroundPortals,{portalName:CART_CHECKOUT_BUTTON,props:{isActive:isActive}},React.createElement(Link,{href:CHECKOUT_PATH,disabled:!isActive},React.createElement(RippleButton,{disabled:!isActive,type:"regular",className:isActive?button:disabledButton},React.createElement(I18n.Text,{string:"cart.checkout"}))));}PaymentBarCheckoutButton.defaultProps={isOrderable:true};export default connect(PaymentBarCheckoutButton);
5
+ */function PaymentBarCheckoutButton(_ref){var isOrderable=_ref.isOrderable;var _useContext=useContext(CartContext),isLoading=_useContext.isLoading;var isActive=useMemo(function(){return isOrderable&&!isLoading;},[isLoading,isOrderable]);return React.createElement(SurroundPortals,{portalName:CART_CHECKOUT_BUTTON,portalProps:{isActive:isActive}},React.createElement(Link,{href:CHECKOUT_PATH,disabled:!isActive},React.createElement(RippleButton,{disabled:!isActive,type:"regular",className:isActive?button:disabledButton},React.createElement(I18n.Text,{string:"cart.checkout"}))));}PaymentBarCheckoutButton.defaultProps={isOrderable:true};export default connect(PaymentBarCheckoutButton);
@@ -4,4 +4,4 @@ import*as React from'react';import{I18n,SurroundPortals,RippleButton}from'@shopg
4
4
  * @return {JSX}
5
5
  */function PaymentBarReserveButton(_ref){var historyReset=_ref.historyReset;var _React$useContext=React.useContext(CartContext),orderable=_React$useContext.flags.orderable;/**
6
6
  * Handles the click on the button.
7
- */function handleClick(){FulfillmentSheet.open({stage:STAGE_RESERVE_FORM,callback:function callback(l,p,orderSuccess){if(orderSuccess===true){historyReset();}}});}return React.createElement(SurroundPortals,{portalName:CART_CHECKOUT_BUTTON,props:{isActive:orderable}},React.createElement(RippleButton,{onClick:handleClick,disabled:!orderable,type:"regular",className:orderable?button:disabledButton},React.createElement(I18n.Text,{string:"cart.reserve"})));}export default connect(PaymentBarReserveButton);
7
+ */function handleClick(){FulfillmentSheet.open({stage:STAGE_RESERVE_FORM,callback:function callback(l,p,orderSuccess){if(orderSuccess===true){historyReset();}}});}return React.createElement(SurroundPortals,{portalName:CART_CHECKOUT_BUTTON,portalProps:{isActive:orderable}},React.createElement(RippleButton,{onClick:handleClick,disabled:!orderable,type:"regular",className:orderable?button:disabledButton},React.createElement(I18n.Text,{string:"cart.reserve"})));}export default connect(PaymentBarReserveButton);
@@ -1,4 +1,4 @@
1
- import{ToastProvider}from'@shopgate/pwa-common/providers';import{MODAL_PIPELINE_ERROR}from'@shopgate/pwa-common/constants/ModalTypes';import showModal from'@shopgate/pwa-common/actions/modal/showModal';import{logger,i18n}from'@shopgate/engage/core';/**
1
+ import{ToastProvider}from'@shopgate/pwa-common/providers';import{MODAL_PIPELINE_ERROR}from'@shopgate/pwa-common/constants/ModalTypes';import showModal from'@shopgate/pwa-common/actions/modal/showModal';import{logger,i18n}from'@shopgate/engage/core/helpers';/**
2
2
  * Creates an error message for a pipeline and a code
3
3
  * @param {string} message The pipeline message
4
4
  * @param {Object} params Additional params for the message
@@ -1,4 +1,4 @@
1
- import{themeName,shopNumber}from'@shopgate/pwa-common/helpers/config';import{isDev}from'@shopgate/engage/core';var STORE_KEY_PREFIX="sgFeatureFlag_".concat(shopNumber,"_").concat(themeName,"__");/**
1
+ import{themeName,shopNumber}from'@shopgate/pwa-common/helpers/config';import{isDev}from'@shopgate/engage/core/helpers';var STORE_KEY_PREFIX="sgFeatureFlag_".concat(shopNumber,"_").concat(themeName,"__");/**
2
2
  * @param {string} key key
3
3
  * @returns {string}
4
4
  */export function getFeatureFlag(key){return window.localStorage.getItem("".concat(STORE_KEY_PREFIX).concat(key));}/**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "7.20.0-beta.10",
3
+ "version": "7.20.0-beta.12",
4
4
  "description": "Shopgate's ENGAGE library.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -16,12 +16,12 @@
16
16
  ],
17
17
  "dependencies": {
18
18
  "@shopgate/native-modules": "1.0.0-beta.18",
19
- "@shopgate/pwa-common": "7.20.0-beta.10",
20
- "@shopgate/pwa-common-commerce": "7.20.0-beta.10",
21
- "@shopgate/pwa-core": "7.20.0-beta.10",
22
- "@shopgate/pwa-ui-ios": "7.20.0-beta.10",
23
- "@shopgate/pwa-ui-material": "7.20.0-beta.10",
24
- "@shopgate/pwa-ui-shared": "7.20.0-beta.10",
19
+ "@shopgate/pwa-common": "7.20.0-beta.12",
20
+ "@shopgate/pwa-common-commerce": "7.20.0-beta.12",
21
+ "@shopgate/pwa-core": "7.20.0-beta.12",
22
+ "@shopgate/pwa-ui-ios": "7.20.0-beta.12",
23
+ "@shopgate/pwa-ui-material": "7.20.0-beta.12",
24
+ "@shopgate/pwa-ui-shared": "7.20.0-beta.12",
25
25
  "@stripe/react-stripe-js": "^1.1.2",
26
26
  "@stripe/stripe-js": "^1.3.1",
27
27
  "@virtuous/conductor": "~2.5.0",
@@ -1,4 +1,4 @@
1
- import{getThemeSettings,isBeta,isAfter,isBefore,addDuration}from'@shopgate/engage/core';import{ALWAYS,NEVER}from"./constants";/**
1
+ import{isBeta,isAfter,isBefore,addDuration}from'@shopgate/engage/core/helpers';import{getThemeSettings}from'@shopgate/engage/core/config';import{ALWAYS,NEVER}from"./constants";/**
2
2
  * Build params to fetch category products
3
3
  * @returns {Object|{showScheduled: string}}
4
4
  */export var buildShowScheduledParams=function buildShowScheduledParams(){if(!isBeta()){return{};}var cachedTime=null;var _ref=getThemeSettings('product')||{},_ref$effectivityDates=_ref.effectivityDates,_ref$effectivityDates2=_ref$effectivityDates===void 0?{}:_ref$effectivityDates,showScheduled=_ref$effectivityDates2.showScheduled;if(showScheduled===ALWAYS){showScheduled='P1Y';}else if(showScheduled===NEVER){showScheduled='PT0S';cachedTime=60000;// 1 minute min effective precision
@@ -1,4 +1,4 @@
1
- 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;}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);}import configuration from'@shopgate/pwa-common/collections/Configuration';import{DEFAULT_PRODUCTS_FETCH_PARAMS}from'@shopgate/pwa-common/constants/Configuration';import{getFullImageSource,getThemeSettings,isBeta,loadImage}from'@shopgate/engage/core';import{buildShowScheduledParams}from"../components/EffectivityDates/helpers";export*from'@shopgate/pwa-common-commerce/product/helpers';export*from"../components/Media/helpers";export*from"./redirects";/**
1
+ 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;}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);}import configuration from'@shopgate/pwa-common/collections/Configuration';import{DEFAULT_PRODUCTS_FETCH_PARAMS}from'@shopgate/pwa-common/constants/Configuration';import{getFullImageSource,isBeta,loadImage}from'@shopgate/engage/core/helpers';import{getThemeSettings}from'@shopgate/engage/core/config';import{buildShowScheduledParams}from"../components/EffectivityDates/helpers";export*from'@shopgate/pwa-common-commerce/product/helpers';export*from"../components/Media/helpers";export*from"./redirects";/**
2
2
  * Build params to fetch category products
3
3
  * @returns {undefined|{params: Object}}
4
4
  */export var buildFetchCategoryProductsParams=function buildFetchCategoryProductsParams(){if(!isBeta()){return{params:{}};}var scheduled=buildShowScheduledParams();return _extends({params:_extends({characteristics:true},scheduled.params)},scheduled.cachedTime&&{cachedTime:scheduled.cachedTime});};/**
@@ -1,4 +1,4 @@
1
- import{isBeta,redirects,getThemeSettings,isAfter}from'@shopgate/engage/core';import{ITEM_PATTERN}from'@shopgate/pwa-common-commerce/product/constants';import{makeGetProductEffectivityDates}from"../selectors/product";/**
1
+ import{isBeta,isAfter}from'@shopgate/engage/core/helpers';import{redirects}from'@shopgate/engage/core/collections';import{getThemeSettings}from'@shopgate/engage/core/config';import{ITEM_PATTERN}from'@shopgate/pwa-common-commerce/product/constants';import{makeGetProductEffectivityDates}from"../selectors/product";/**
2
2
  * Enable redirect handler for effectivity dates and more
3
3
  * @returns {void}
4
4
  */export var enableRedirectHandler=function enableRedirectHandler(){if(!isBeta()){return;}/** Effectivity dates */var _ref=getThemeSettings('product')||{},_ref$effectivityDates=_ref.effectivityDates,_ref$effectivityDates2=_ref$effectivityDates===void 0?{}:_ref$effectivityDates,accessExpired=_ref$effectivityDates2.accessExpired;if(accessExpired){return;}var getProductEffectivityDates=makeGetProductEffectivityDates();redirects.set(ITEM_PATTERN,function(_ref2){var action=_ref2.action,getState=_ref2.getState;var pathname=action.params.pathname,productId=action.route.state.productId;var effectivityDates=getProductEffectivityDates(getState(),{productId:productId});if(effectivityDates){// Forbid redirect if endDate is expired
@@ -1,4 +1,4 @@
1
- import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{hasWebBridge}from'@shopgate/engage/core';import{setCSSCustomProp}from"./cssCustomProperties";var defaultBackgroundColor=themeConfig.colors.light;/**
1
+ import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{hasWebBridge}from'@shopgate/engage/core/helpers';import{setCSSCustomProp}from"./cssCustomProperties";var defaultBackgroundColor=themeConfig.colors.light;/**
2
2
  * Updates the page background color.
3
3
  * @param {string} color The new background color.
4
4
  */export var setPageBackgroundColor=function setPageBackgroundColor(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultBackgroundColor;// Curbside website changes never its background color
@@ -1,4 +1,4 @@
1
- import MobileDetect from'mobile-detect';import{logger}from'@shopgate/engage/core';var md=new MobileDetect(navigator.userAgent);var SELECTOR_BODY='html, body';var SELECTOR_CONTENT='#AppContent';var currentRef=null;/**
1
+ import MobileDetect from'mobile-detect';import{logger}from'@shopgate/engage/core/helpers';var md=new MobileDetect(navigator.userAgent);var SELECTOR_BODY='html, body';var SELECTOR_CONTENT='#AppContent';var currentRef=null;/**
2
2
  * Toggles the body scroll on mobile phones
3
3
  * @param {boolean} locked The lock state
4
4
  * @param {*} ref A reference parameter to take care that only the locker can unlock