@shopgate/engage 7.6.1-beta.3 → 7.7.0
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.
|
@@ -2,7 +2,7 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
2
2
|
* Converts order line items to cart items
|
|
3
3
|
* @param {Array} lineItems The line items to be converted
|
|
4
4
|
* @return {Array}
|
|
5
|
-
*/export var convertLineItemsToCartItems=function convertLineItemsToCartItems(){var lineItems=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];return lineItems.map(function(lineItem){var id=lineItem.code,quantity=lineItem.quantity,_lineItem$orderedQuan=lineItem.orderedQuantity,orderedQuantity=_lineItem$orderedQuan===void 0?null:_lineItem$orderedQuan,salePrice=lineItem.salePrice,lineItemPrice=lineItem.price,promoAmount=lineItem.promoAmount,extendedPrice=lineItem.extendedPrice,discountAmount=lineItem.discountAmount,unitDiscountAmount=lineItem.unitDiscountAmount,unitPromoAmount=lineItem.unitPromoAmount,product=lineItem.product,status=lineItem.status,subStatus=lineItem.subStatus,fulfillmentMethod=lineItem.fulfillmentMethod,fulfillmentLocationCode=lineItem.fulfillmentLocationCode,substitutionAllowed=lineItem.substitutionAllowed;var productCode=product.code,productPrice=product.price,productSalePrice=product.salePrice,productEffectivePrice=product.effectivePrice,name=product.name,image=product.image,unit=product.unit,_product$hasCatchWeig=product.hasCatchWeight,hasCatchWeight=_product$hasCatchWeig===void 0?false:_product$hasCatchWeig,options=product.options;var properties=[];var appliedDiscounts=[];var additionalInfo=[];var coupon=null;var messages=[];var fulfillmentMethods;var fulfillment;var featuredImageUrl=null;if(Array.isArray(options)){properties=options.map(function(option){return{label:option.name,value:option.values[0]
|
|
5
|
+
*/export var convertLineItemsToCartItems=function convertLineItemsToCartItems(){var lineItems=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];return lineItems.map(function(lineItem){var id=lineItem.code,quantity=lineItem.quantity,_lineItem$orderedQuan=lineItem.orderedQuantity,orderedQuantity=_lineItem$orderedQuan===void 0?null:_lineItem$orderedQuan,salePrice=lineItem.salePrice,lineItemPrice=lineItem.price,promoAmount=lineItem.promoAmount,extendedPrice=lineItem.extendedPrice,discountAmount=lineItem.discountAmount,unitDiscountAmount=lineItem.unitDiscountAmount,unitPromoAmount=lineItem.unitPromoAmount,product=lineItem.product,status=lineItem.status,subStatus=lineItem.subStatus,fulfillmentMethod=lineItem.fulfillmentMethod,fulfillmentLocationCode=lineItem.fulfillmentLocationCode,substitutionAllowed=lineItem.substitutionAllowed;var productCode=product.code,productPrice=product.price,productSalePrice=product.salePrice,productEffectivePrice=product.effectivePrice,name=product.name,image=product.image,unit=product.unit,_product$hasCatchWeig=product.hasCatchWeight,hasCatchWeight=_product$hasCatchWeig===void 0?false:_product$hasCatchWeig,options=product.options;var properties=[];var appliedDiscounts=[];var additionalInfo=[];var coupon=null;var messages=[];var fulfillmentMethods;var fulfillment;var featuredImageUrl=null;if(Array.isArray(options)){properties=options.map(function(option){var _option$value,_option$values,_option$values$;return{label:option.name,value:(option===null||option===void 0?void 0:(_option$value=option.value)===null||_option$value===void 0?void 0:_option$value.name)||(option===null||option===void 0?void 0:(_option$values=option.values)===null||_option$values===void 0?void 0:(_option$values$=_option$values[0])===null||_option$values$===void 0?void 0:_option$values$.name)};});}if(fulfillmentMethod!==DIRECT_SHIP){fulfillmentMethods=[fulfillmentMethod];fulfillment={method:fulfillmentMethod,location:{code:fulfillmentLocationCode}};}if(image){if(image.includes('?')){featuredImageUrl="".concat(image,"&width=440&height=440&format=jpeg&fill=fff");}else{featuredImageUrl="".concat(image,"?width=440&height=440&format=jpeg&fill=fff");}}return{id:id,quantity:quantity,orderedQuantity:orderedQuantity,coupon:coupon,messages:messages,type:'product',status:status,subStatus:subStatus,product:{id:productCode,featuredImageUrl:featuredImageUrl,name:name,properties:properties,appliedDiscounts:appliedDiscounts,additionalInfo:additionalInfo,unit:unit,hasCatchWeight:hasCatchWeight,price:{unit:productPrice,unitSpecial:productSalePrice,"default":lineItemPrice,special:salePrice||null,unitSale:productSalePrice,unitEffective:productEffectivePrice,info:''},fulfillmentMethods:fulfillmentMethods},unitPromoAmount:unitPromoAmount,unitDiscountAmount:unitDiscountAmount,price:lineItemPrice,extendedPrice:extendedPrice,promoAmount:promoAmount,discountAmount:discountAmount,fulfillment:fulfillment,fulfillmentLocationId:fulfillmentLocationCode,substitutionAllowed:substitutionAllowed};});};/**
|
|
6
6
|
* Extracts the promotions without coupon from the order.
|
|
7
7
|
* @param {Object} order An order object
|
|
8
8
|
* @returns {Array}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{hasWebBridge}from'@shopgate/engage/core';/* eslint-disable extra-rules/no-single-line-objects */var breakpoints=[{name:'xs',from:0,to:600},{name:'sm',from:600,to:960},{name:'md',from:960,to:1280},{name:'lg',from:1280,to:1920},{name:'xl',from:1920,to:Number.MAX_VALUE}];/* eslint-enable extra-rules/no-single-line-objects */ /**
|
|
1
|
+
import{hasWebBridge,isIOSTheme}from'@shopgate/engage/core';var iosThemeActive=isIOSTheme();/* eslint-disable extra-rules/no-single-line-objects */var breakpoints=[{name:'xs',from:0,to:600},{name:'sm',from:600,to:960},{name:'md',from:960,to:1280},{name:'lg',from:1280,to:1920},{name:'xl',from:1920,to:Number.MAX_VALUE}];/* eslint-enable extra-rules/no-single-line-objects */ /**
|
|
2
2
|
* Generates a media query for different breakpoints and platform.
|
|
3
3
|
* @param {Object} comparators Comparators.
|
|
4
4
|
* @param {string} breakpoint Breakpoint rule.
|
|
@@ -7,6 +7,7 @@ import{hasWebBridge}from'@shopgate/engage/core';/* eslint-disable extra-rules/no
|
|
|
7
7
|
*/export var parser=function parser(comparators,breakpoint){var _ref=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},_ref$appAlways=_ref.appAlways,appAlways=_ref$appAlways===void 0?false:_ref$appAlways,_ref$appOnly=_ref.appOnly,appOnly=_ref$appOnly===void 0?false:_ref$appOnly,_ref$webOnly=_ref.webOnly,webOnly=_ref$webOnly===void 0?false:_ref$webOnly,_ref$webAlways=_ref.webAlways,webAlways=_ref$webAlways===void 0?false:_ref$webAlways;// Parse breakpoint prop into the comparator and the breakpoint name.
|
|
8
8
|
var breakpointStart=breakpoint.search(/[a-zA-Z]/);var comparatorString=breakpoint.substring(0,breakpointStart===-1?0:breakpointStart);var breakpointString=breakpoint.substring(breakpointStart===-1?0:breakpointStart);// Get configuration.
|
|
9
9
|
var comparator=comparators[comparatorString];var config=breakpoints.find(function(b){return b.name===breakpointString;});// Web / App config.
|
|
10
|
-
|
|
10
|
+
// Handle iOS theme as app for now so that media queries in shared components only work for app
|
|
11
|
+
var isWeb=hasWebBridge()&&!iosThemeActive;// Always mode.
|
|
11
12
|
if(webAlways&&isWeb||appAlways&&!isWeb){return true;}// Return media query that never evaluates for now.
|
|
12
13
|
if(appOnly&&isWeb||webOnly&&!isWeb){return false;}return comparator(config.from,config.to,window.innerWidth);};export default breakpoints;
|
|
@@ -1 +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;}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{css}from'glamor';import{useScrollContainer}from'@shopgate/engage/core';import{responsiveMediaQuery}from'@shopgate/engage/styles';export default css(_extends({display:'flex',flexDirection:'column',width:'100vw'},useScrollContainer()?{bottom:0,top:0,overflowScrolling:'touch',position:'absolute',WebkitOverflowScrolling:'touch'}:{backgroundColor:'var(--page-background-color)'},_defineProperty({},responsiveMediaQuery('>xs',{webOnly:true}),{width:'var(--page-content-width)'})));
|
|
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;}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{css}from'glamor';import{useScrollContainer}from'@shopgate/engage/core';import{responsiveMediaQuery}from'@shopgate/engage/styles';export default css(_extends({display:'flex',flexDirection:'column',width:'100vw'},useScrollContainer()?{bottom:0,top:0,overflowScrolling:'touch',position:'absolute',WebkitOverflowScrolling:'touch'}:{height:'100%',backgroundColor:'var(--page-background-color)'},_defineProperty({},responsiveMediaQuery('>xs',{webOnly:true}),{width:'var(--page-content-width)'})));
|
package/components/View/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export{ViewContext};/**
|
|
|
3
3
|
* The View container component.
|
|
4
4
|
* @param {Object} props The component props.
|
|
5
5
|
* @return {JSX}
|
|
6
|
-
*/function ViewContainer(_ref){var background=_ref.background,children=_ref.children,noScrollOnKeyboard=_ref.noScrollOnKeyboard,visible=_ref.visible,ariaHidden=_ref['aria-hidden'],noContentPortal=_ref.noContentPortal;if(visible){setPageBackgroundColor(background);}var style={display:visible?'
|
|
6
|
+
*/function ViewContainer(_ref){var background=_ref.background,children=_ref.children,noScrollOnKeyboard=_ref.noScrollOnKeyboard,visible=_ref.visible,ariaHidden=_ref['aria-hidden'],noContentPortal=_ref.noContentPortal;if(visible){setPageBackgroundColor(background);}var style={display:visible?'flex':'none'};return React.createElement(ViewProvider,null,React.createElement(ViewContext.Consumer,null,function(_ref2){var setContentRef=_ref2.setContentRef,ariaHiddenContext=_ref2.ariaHidden;return React.createElement("section",{className:styles,style:style,"aria-hidden":ariaHidden||ariaHiddenContext},React.createElement(Content,{noScrollOnKeyboard:noScrollOnKeyboard,setContentRef:setContentRef,noContentPortal:noContentPortal},children));}));}ViewContainer.defaultProps={'aria-hidden':false,background:colors.light,children:null,noScrollOnKeyboard:false,noContentPortal:false};/**
|
|
7
7
|
* @param {Object} props The component props.
|
|
8
8
|
* @returns {JSX}
|
|
9
9
|
*/export default function View(props){return React.createElement(RouteContext.Consumer,null,function(_ref3){var visible=_ref3.visible;return React.createElement(ViewContainer,_extends({},props,{visible:visible}));});}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/engage",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0",
|
|
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
|
-
"@shopgate/pwa-common-commerce": "7.
|
|
21
|
-
"@shopgate/pwa-core": "7.
|
|
22
|
-
"@shopgate/pwa-ui-ios": "7.
|
|
23
|
-
"@shopgate/pwa-ui-material": "7.
|
|
24
|
-
"@shopgate/pwa-ui-shared": "7.
|
|
19
|
+
"@shopgate/pwa-common": "7.7.0",
|
|
20
|
+
"@shopgate/pwa-common-commerce": "7.7.0",
|
|
21
|
+
"@shopgate/pwa-core": "7.7.0",
|
|
22
|
+
"@shopgate/pwa-ui-ios": "7.7.0",
|
|
23
|
+
"@shopgate/pwa-ui-material": "7.7.0",
|
|
24
|
+
"@shopgate/pwa-ui-shared": "7.7.0",
|
|
25
25
|
"@stripe/react-stripe-js": "^1.1.2",
|
|
26
26
|
"@stripe/stripe-js": "^1.3.1",
|
|
27
27
|
"@virtuous/conductor": "~2.5.0",
|
package/styles/reset/root.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{useScrollContainer,hasWebBridge}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var typography=themeConfig.typography;css.global('*, *:before, *:after',{boxSizing:'border-box'});css.global('*',{touchAction:'manipulation'});css.global('::-moz-focus-inner',{border:0});css.global('html, body',{WebkitTapHighlightColor:'transparent',width:'100%',height:'100%'});css.global('html',{overflow:useScrollContainer()?'hidden':'inherit',MozOsxFontSmoothing:'grayscale',WebkitFontSmoothing:'antialiased',MsTextSizeAdjust:'100%',WebkitTextSizeAdjust:'100%',minHeight:'100%'});css.global('body',{font:"".concat(typography.rootSize,"px/").concat(typography.lineHeight," ").concat(typography.family),overflow:'auto',margin:0,WebkitOverflowScrolling:'touch',WebkitUserSelect:hasWebBridge()?'inherit':'none',userSelect:hasWebBridge()?'inherit':'none',color:'var(--color-text-high-emphasis)'});css.global('[data-pattern]',{height:'100% !important'});css.global('html, body',{backgroundColor:'var(--page-background-color)'});if(hasWebBridge()){css.insert("@media(min-width: 600px) {\n html, body {\n background-color: var(--color-background-gutter-body, var(--page-background-color))\n }\n }");}
|
|
1
|
+
import{css}from'glamor';import{useScrollContainer,hasWebBridge,isIOSTheme}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var typography=themeConfig.typography;var iosThemeActive=isIOSTheme();css.global('*, *:before, *:after',{boxSizing:'border-box'});css.global('*',{touchAction:'manipulation'});css.global('::-moz-focus-inner',{border:0});css.global('html, body',{WebkitTapHighlightColor:'transparent',width:'100%',height:'100%'});css.global('html',{overflow:useScrollContainer()?'hidden':'inherit',MozOsxFontSmoothing:'grayscale',WebkitFontSmoothing:'antialiased',MsTextSizeAdjust:'100%',WebkitTextSizeAdjust:'100%',minHeight:'100%'});css.global('body',{font:"".concat(typography.rootSize,"px/").concat(typography.lineHeight," ").concat(typography.family),overflow:'auto',margin:0,WebkitOverflowScrolling:'touch',WebkitUserSelect:hasWebBridge()?'inherit':'none',userSelect:hasWebBridge()?'inherit':'none',color:'var(--color-text-high-emphasis)'});css.global('[data-pattern]',{height:'100% !important'});css.global('html, body',{backgroundColor:'var(--page-background-color)'});if(hasWebBridge()&&!iosThemeActive){css.insert("@media(min-width: 600px) {\n html, body {\n background-color: var(--color-background-gutter-body, var(--page-background-color))\n }\n }");}
|