@shopgate/pwa-common
Version:
Common library for the Shopgate Connect PWA.
17 lines • 2.16 kB
JavaScript
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{getCurrentRoute}from"../selectors/router";import{APP_WILL_INIT,APP_DID_START,APP_WILL_START,PWA_DID_APPEAR,PWA_DID_DISAPPEAR,OPEN_PUSH_NOTIFICATION,OPEN_UNIVERSAL_LINK,OPEN_DEEP_LINK}from"../constants/ActionTypes";import{main$}from"./main";export var appWillInit$=main$.filter(function(_ref){var action=_ref.action;return action.type===APP_WILL_INIT;});/**
* Gets triggered before the app starts.
* @type {Observable}
*/export var appWillStart$=main$.filter(function(_ref2){var action=_ref2.action;return action.type===APP_WILL_START;});/**
* Gets triggered when the app starts.
* @type {Observable}
*/export var appDidStart$=main$.filter(function(_ref3){var action=_ref3.action;return action.type===APP_DID_START;});/**
* Emits when the PWA appeared again after navigating back from a legacy page.
*/export var pwaDidAppear$=main$.filter(function(_ref4){var action=_ref4.action;return action.type===PWA_DID_APPEAR;}).map(function(params){return _extends({},params,{action:_extends({},params.action,{route:getCurrentRoute(params.getState())})});});/**
* Emits when the PWA disappears
*/export var pwaDidDisappear$=main$.filter(function(_ref5){var action=_ref5.action;return action.type===PWA_DID_DISAPPEAR;}).map(function(params){return _extends({},params,{action:_extends({},params.action,{route:getCurrentRoute(params.getState())})});});/**
* Emits when a push message was opened.
*/export var pushNotificationOpened$=main$.filter(function(_ref6){var action=_ref6.action;return action.type===OPEN_PUSH_NOTIFICATION;});/**
* Emits when a universal link was opened.
*/export var universalLinkOpened$=main$.filter(function(_ref7){var action=_ref7.action;return action.type===OPEN_UNIVERSAL_LINK;});/**
* Emits when a deeplink was opened.
*/export var deeplinkOpened$=main$.filter(function(_ref8){var action=_ref8.action;return action.type===OPEN_DEEP_LINK;});