@shopgate/engage 7.27.0-beta.2 → 7.27.0-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.
@@ -0,0 +1,12 @@
1
+ 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{AndroidNavigationBar}from'@shopgate/native-modules';import{logger,appSupportsAndroidEdgeToEdge}from'@shopgate/engage/core/helpers';/**
2
+ * @typedef {Object} UpdateAndroidNavigationBarOptions
3
+ * @property {string} [color] Color for the navigation bar.
4
+ * Accepts hex, hex with alpha, rgb(), or rgba().
5
+ */var lastOptions=null;/**
6
+ * Updates the Android navigation bar style based on the provided visual options.
7
+ * Typically used to match app UI to system navigation bar for a more native look and feel.
8
+ *
9
+ * @param {UpdateAndroidNavigationBarOptions} [options={}] Visual customization options for
10
+ * the nav bar.
11
+ */export var updateAndroidNavigationBarColor=function updateAndroidNavigationBarColor(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};// Only necessary for Android devices with edge-to-edge screens
12
+ if(!appSupportsAndroidEdgeToEdge()){return;}var color=options.color;var needsUpdate=!lastOptions||options.color!==lastOptions.color;if(needsUpdate){try{AndroidNavigationBar.setColor({color:color});lastOptions=_extends({},options);}catch(e){logger.error('Error updating Android navigation bar color',e);}}};
@@ -1,4 +1,4 @@
1
- import{APP_FEATURE_PUSH_OPT_IN,APP_FEATURE_COOKIE_CONSENT,APP_FEATURE_ANDROID_EDGE_TO_EDGE}from'@shopgate/engage/core/constants';import{hasSGJavaScriptBridge,hasWebBridge,hasNewServices}from'@shopgate/engage/core/helpers';/**
1
+ import{APP_FEATURE_PUSH_OPT_IN,APP_FEATURE_COOKIE_CONSENT,APP_FEATURE_ANDROID_EDGE_TO_EDGE}from'@shopgate/engage/core/constants';import{hasSGJavaScriptBridge,hasWebBridge,hasNewServices,isAndroidOs}from'@shopgate/engage/core/helpers';/**
2
2
  * Checks if a specific feature flag is enabled.
3
3
  *
4
4
  * @param {string} category The top-level category of the featureFlags object
@@ -20,5 +20,6 @@ return false;}if(!hasSGJavaScriptBridge()){// Always supported in development
20
20
  return true;}return isFeatureFlagEnabled('Analytics',APP_FEATURE_COOKIE_CONSENT);};/**
21
21
  * Determines if the app supports Android with edge-to-edge screens
22
22
  * @returns {boolean}
23
- */export var appSupportsAndroidEdgeToEdge=function appSupportsAndroidEdgeToEdge(){if(hasWebBridge()||!hasSGJavaScriptBridge()){// Deactivated in browser mode and development for now
24
- return false;}return isFeatureFlagEnabled('StatusBar',APP_FEATURE_ANDROID_EDGE_TO_EDGE);};
23
+ */export var appSupportsAndroidEdgeToEdge=function appSupportsAndroidEdgeToEdge(){if(hasWebBridge()){// Deactivated in browser mode
24
+ return false;}if(!hasSGJavaScriptBridge()&&isAndroidOs){// Active in dev environment with Android user agent
25
+ return true;}return isFeatureFlagEnabled('StatusBar',APP_FEATURE_ANDROID_EDGE_TO_EDGE);};
@@ -1,4 +1,4 @@
1
- /** @module core */import{getCurrentRoute as getCurrentRouteHelper,router,history,parseQueryStringToObject,parseObjectToQueryString}from'@shopgate/pwa-common/helpers/router';export*from"./environment";export*from"./appFeatures";export*from"./appPermissions";export*from"./baseUrl";export*from"./bridge";export{isBeta}from"../config/isBeta";export{getFullImageSource}from"./getFullImageSource";export{getImageFormat}from"./getImageFormat";export{i18n,getWeekDaysOrder}from"./i18n";export{updateLegacyNavigationBar}from"./updateLegacyNavigationBar";export{default as nl2br}from"./nl2br";export*from"./string";export{isIOSTheme}from"./isIOSTheme";export{isTouchDevice}from"./isTouchDevice";export{generateGoogleMapsDirectionsUrl}from"./googleMaps";export{useScrollContainer}from"./scrollContainer";export{getDeviceTypeForCms}from"./deviceType";export*from"./featureFlag";// --------------- CORE --------------- //
1
+ /** @module core */import{getCurrentRoute as getCurrentRouteHelper,router,history,parseQueryStringToObject,parseObjectToQueryString}from'@shopgate/pwa-common/helpers/router';export*from"./environment";export*from"./appFeatures";export*from"./appPermissions";export*from"./baseUrl";export*from"./bridge";export{isBeta}from"../config/isBeta";export{getFullImageSource}from"./getFullImageSource";export{getImageFormat}from"./getImageFormat";export{i18n,getWeekDaysOrder}from"./i18n";export{updateLegacyNavigationBar}from"./updateLegacyNavigationBar";export{updateAndroidNavigationBarColor}from"./androidNavigationBar";export{default as nl2br}from"./nl2br";export*from"./string";export{isIOSTheme}from"./isIOSTheme";export{isTouchDevice}from"./isTouchDevice";export{generateGoogleMapsDirectionsUrl}from"./googleMaps";export{useScrollContainer}from"./scrollContainer";export{getDeviceTypeForCms}from"./deviceType";export*from"./featureFlag";// --------------- CORE --------------- //
2
2
  export{logger,ajaxUrl,hasSGJavaScriptBridge,useBrowserConnector,hasWebBridgeCore,logDeprecationMessage}from'@shopgate/pwa-core/helpers';export{default as logGroup}from'@shopgate/pwa-core/helpers/logGroup';export*from'@shopgate/pwa-core/helpers/version';export*from'@shopgate/pwa-common/helpers/data';export*from'@shopgate/pwa-common/helpers/date';export*from'@shopgate/pwa-common/helpers/dom';export{env,isDev,isProd,isRemote,isStaging,isWindows}from'@shopgate/pwa-common/helpers/environment';export{default as decodeHTML}from'@shopgate/pwa-common/helpers/html/decodeHTML';export*from'@shopgate/pwa-common/helpers/html/handleDOM';export{default as parseHTML}from'@shopgate/pwa-common/helpers/html/parseHTML';export{default as getTranslator}from'@shopgate/pwa-common/helpers/i18n/getTranslator';export{default as getPriceFormatter}from'@shopgate/pwa-common/helpers/i18n/getPriceFormatter';export{default as getDateFormatter}from'@shopgate/pwa-common/helpers/i18n/getDateFormatter';export{default as getTimeFormatter}from'@shopgate/pwa-common/helpers/i18n/getTimeFormatter';export{default as getNumberFormatter}from'@shopgate/pwa-common/helpers/i18n/getNumberFormatter';export*from'@shopgate/pwa-common/helpers/legacy';// TODO: Can only be exported once the theme uses it. causes issues with the custom routes feature.
3
3
  /*
4
4
  export { default as portalCollection } from '@shopgate/pwa-common/helpers/portals/portalCollection';
@@ -1,4 +1,4 @@
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);});};}import{withScope,captureMessage,Severity as SentrySeverity}from'@sentry/browser';import moment from'moment';import{configureStore}from'@shopgate/pwa-common/store';import{appWillInit,appWillStart}from'@shopgate/pwa-common/action-creators/app';import{i18n}from'@shopgate/engage/core';import fetchClientInformation from'@shopgate/pwa-common/actions/client/fetchClientInformation';import appConfig from'@shopgate/pwa-common/helpers/config';import{appInitialization,configuration}from'@shopgate/engage/core/collections';import{CONFIGURATION_COLLECTION_KEY_BASE_URL}from'@shopgate/engage/core/constants';import{getAppBaseUrl}from'@shopgate/engage/core/helpers';import{receiveShopSettings,receiveMerchantSettings,errorShopSettings}from"../action-creators";var _appConfig$locales=appConfig.locales,_appConfig$locales2=_appConfig$locales===void 0?{}:_appConfig$locales,_appConfig$locales2$c=_appConfig$locales2.currency,currencyLocale=_appConfig$locales2$c===void 0?null:_appConfig$locales2$c,settingsUrl=appConfig.settingsUrl,merchantSettingsUrl=appConfig.merchantSettingsUrl;var REQUEST_TIMEOUT=3000;/**
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);});};}import{withScope,captureMessage,Severity as SentrySeverity}from'@sentry/browser';import moment from'moment';import{configureStore}from'@shopgate/pwa-common/store';import{appWillInit,appWillStart}from'@shopgate/pwa-common/action-creators/app';import{i18n}from'@shopgate/engage/core';import fetchClientInformation from'@shopgate/pwa-common/actions/client/fetchClientInformation';import appConfig from'@shopgate/pwa-common/helpers/config';import{appInitialization,configuration}from'@shopgate/engage/core/collections';import{CONFIGURATION_COLLECTION_KEY_BASE_URL}from'@shopgate/engage/core/constants';import{getAppBaseUrl,isDev,hasSGJavaScriptBridge,hasWebBridge}from'@shopgate/engage/core/helpers';import{receiveShopSettings,receiveMerchantSettings,errorShopSettings}from"../action-creators";var _appConfig$locales=appConfig.locales,_appConfig$locales2=_appConfig$locales===void 0?{}:_appConfig$locales,_appConfig$locales2$c=_appConfig$locales2.currency,currencyLocale=_appConfig$locales2$c===void 0?null:_appConfig$locales2$c,settingsUrl=appConfig.settingsUrl,merchantSettingsUrl=appConfig.merchantSettingsUrl;var REQUEST_TIMEOUT=3000;/**
2
2
  * Injects a script tag to fetch the shop settings JSONP.
3
3
  * @param {string} id The script id
4
4
  * @param {string} src The script url
@@ -16,6 +16,9 @@ injectScript('shop-settings-jsonp',settingsUrl,function(error){withScope(functio
16
16
  * @param {Object} locales An object with locales.
17
17
  * @param {Function} reducers The reducers from the theme.
18
18
  * @param {Array} subscribers The subscribers to the streams middleware.
19
- */export var initialize=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(locales,reducers,subscribers){var store;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:moment.locale(process.env.LOCALE);i18n.init({locales:locales,lang:process.env.LOCALE,currencyLocale:currencyLocale});store=configureStore(reducers,subscribers);_context.prev=3;_context.next=6;return store.dispatch(fetchClientInformation());case 6:_context.next=10;break;case 8:_context.prev=8;_context.t0=_context["catch"](3);case 10:// Save the base url inside the configuration collection before any other code can apply
19
+ */export var initialize=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(locales,reducers,subscribers){var store;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:moment.locale(process.env.LOCALE);if(isDev){// Inject an object to the window that can be used to check if the PWA is running in dev mode
20
+ window.SGConnectDev={// Indicates the the current dev app is running in a browser - not in the real app
21
+ isDevBrowser:!hasWebBridge()&&!hasSGJavaScriptBridge(),// Indicates that the PWA is running in a dev environment
22
+ isDev:isDev};}i18n.init({locales:locales,lang:process.env.LOCALE,currencyLocale:currencyLocale});store=configureStore(reducers,subscribers);_context.prev=4;_context.next=7;return store.dispatch(fetchClientInformation());case 7:_context.next=11;break;case 9:_context.prev=9;_context.t0=_context["catch"](4);case 11:// Save the base url inside the configuration collection before any other code can apply
20
23
  // url manipulations.
21
- configuration.set(CONFIGURATION_COLLECTION_KEY_BASE_URL,getAppBaseUrl());store.dispatch(appWillInit("".concat(window.location.pathname).concat(window.location.search)));_context.prev=12;_context.next=15;return fetchSettings(store);case 15:_context.next=19;break;case 17:_context.prev=17;_context.t1=_context["catch"](12);case 19:_context.next=21;return appInitialization.initialize({dispatch:store.dispatch,getState:store.getState});case 21:store.dispatch(appWillStart("".concat(window.location.pathname).concat(window.location.search)));return _context.abrupt("return",{store:store});case 23:case"end":return _context.stop();}},_callee,null,[[3,8],[12,17]]);}));return function initialize(_x,_x2,_x3){return _ref.apply(this,arguments);};}();
24
+ configuration.set(CONFIGURATION_COLLECTION_KEY_BASE_URL,getAppBaseUrl());store.dispatch(appWillInit("".concat(window.location.pathname).concat(window.location.search)));_context.prev=13;_context.next=16;return fetchSettings(store);case 16:_context.next=20;break;case 18:_context.prev=18;_context.t1=_context["catch"](13);case 20:_context.next=22;return appInitialization.initialize({dispatch:store.dispatch,getState:store.getState});case 22:store.dispatch(appWillStart("".concat(window.location.pathname).concat(window.location.search)));return _context.abrupt("return",{store:store});case 24:case"end":return _context.stop();}},_callee,null,[[4,9],[13,18]]);}));return function initialize(_x,_x2,_x3){return _ref.apply(this,arguments);};}();
@@ -1,7 +1,8 @@
1
- import{appWillStart$}from'@shopgate/engage/core/streams';import{configuration}from'@shopgate/engage/core/collections';import{hasNewServices}from'@shopgate/engage/core/helpers';import{CONFIGURATION_COLLECTION_KEY_BASE_URL}from'@shopgate/engage/core/constants';import{reloadApp$}from"../streams";import{reloadApp}from"../action-creators";/**
1
+ import{appWillStart$}from'@shopgate/engage/core/streams';import{configuration}from'@shopgate/engage/core/collections';import{hasNewServices,appSupportsAndroidEdgeToEdge,updateAndroidNavigationBarColor}from'@shopgate/engage/core/helpers';import{CONFIGURATION_COLLECTION_KEY_BASE_URL}from'@shopgate/engage/core/constants';import{appConfig}from'@shopgate/engage';import{reloadApp$}from"../streams";import{reloadApp}from"../action-creators";var androidNavigationBarDefaultColor=appConfig.androidNavigationBarDefaultColor;/**
2
2
  * App subscriptions
3
3
  * @param {Function} subscribe The subscribe function
4
4
  */export default function app(subscribe){subscribe(appWillStart$,function(_ref){var dispatch=_ref.dispatch;console.log("%c\u2139\uFE0F PWA uses ".concat(hasNewServices()?'NEW':'OLD'," services"),'color: blue');// Add global function to enable PWA reload from the console
5
- window.reloadSGApp=function(){dispatch(reloadApp());};});subscribe(reloadApp$,function(){// A deployed app can only be reloaded on the base url. So we first set this as current route
5
+ window.reloadSGApp=function(){dispatch(reloadApp());};if(appSupportsAndroidEdgeToEdge()&&androidNavigationBarDefaultColor){// Set the navigation bar color for android devices with edge-to-edge screens
6
+ updateAndroidNavigationBarColor({color:androidNavigationBarDefaultColor});}});subscribe(reloadApp$,function(){// A deployed app can only be reloaded on the base url. So we first set this as current route
6
7
  // before the reload happens.
7
8
  window.history.replaceState({},null,configuration.get(CONFIGURATION_COLLECTION_KEY_BASE_URL));window.location.reload();});}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "7.27.0-beta.2",
3
+ "version": "7.27.0-beta.3",
4
4
  "description": "Shopgate's ENGAGE library.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -15,13 +15,13 @@
15
15
  "connect"
16
16
  ],
17
17
  "dependencies": {
18
- "@shopgate/native-modules": "^1.0.0-beta.22",
19
- "@shopgate/pwa-common": "7.27.0-beta.2",
20
- "@shopgate/pwa-common-commerce": "7.27.0-beta.2",
21
- "@shopgate/pwa-core": "7.27.0-beta.2",
22
- "@shopgate/pwa-ui-ios": "7.27.0-beta.2",
23
- "@shopgate/pwa-ui-material": "7.27.0-beta.2",
24
- "@shopgate/pwa-ui-shared": "7.27.0-beta.2",
18
+ "@shopgate/native-modules": "1.0.0-beta.25",
19
+ "@shopgate/pwa-common": "7.27.0-beta.3",
20
+ "@shopgate/pwa-common-commerce": "7.27.0-beta.3",
21
+ "@shopgate/pwa-core": "7.27.0-beta.3",
22
+ "@shopgate/pwa-ui-ios": "7.27.0-beta.3",
23
+ "@shopgate/pwa-ui-material": "7.27.0-beta.3",
24
+ "@shopgate/pwa-ui-shared": "7.27.0-beta.3",
25
25
  "@stripe/react-stripe-js": "^1.16.5",
26
26
  "@stripe/stripe-js": "^1.3.1",
27
27
  "@virtuous/conductor": "~2.5.0",