Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/app-bridge

Package Overview
Dependencies
Maintainers
10
Versions
322
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/app-bridge - npm Package Compare versions

Comparing version 0.1.2-3 to 0.1.2

2

actions.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("app-bridge",[],e):"object"==typeof exports?exports["app-bridge"]=e():t["app-bridge"]=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(o){if(r[o])return r[o].exports;var i=r[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,function(t){if(t.exports&&!t.exports.__esModule&&void 0===t.exports.default){if(t.exports.headers&&t.exports.headers.common&&t.exports.headers.common.Accept&&t.exports.adapter&&t.exports.transformRequest&&t.exports.transformResponse)return;t.exports.default=t.exports}}(i),i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,o){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=24)}([function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(28)),o(r(11))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.Button="Button",t.ButtonGroup="ButtonGroup",t.Cart="Cart",t.Error="Error",t.Flash="Flash",t.Loading="Loading",t.Modal="Modal",t.Navigation="Navigation",t.Print="Print",t.TitleBar="TitleBar",t.ResourcePicker="Resource_Picker"}(e.Group||(e.Group={}));!function(t){t.Button="Button",t.ButtonGroup="ButtonGroup"}(e.ComponentType||(e.ComponentType={}))},function(t,e,r){"use strict";function o(t){return A({},t,{version:i()})}function i(){return b.version}function n(t,e,r){var o=t.toUpperCase();if(r){var i=r.subgroups,n=r.type;i&&i.length>0&&(o+=o.length>0?g:"",i.forEach(function(t,e){o+=""+t.toUpperCase()+(e<i.length-1?g:"")})),n!==t&&n&&(o+=""+(o.length>0?g:"")+n.toUpperCase())}return o&&(o+=""+(o.length>0?g:"")+e.toUpperCase()),""+T.PREFIX+g+o}function a(t){return null===t||void 0===t||"number"==typeof t}function s(t){return null===t||void 0===t||"string"==typeof t}function u(t,e,r){void 0===r&&(r=!1),t.forEach(function(t){if(r){(0,t.updateSubscribe)(e,[])}else{(0,t.unsubscribe)()}}),r||(t.length=0)}function p(t,e){var r={};return e.forEach(function(e){t.hasOwnProperty(e)&&(r[e]=t[e])}),r}function c(t,e){return t.id===e.id&&(Object.assign(t,d(t,e)),!0)}function d(t,e){var r=O.default(t,e);if(!r){return Object.assign(t,e)}return r}function l(t,e){Object.keys(t).forEach(function(r){e(t[r])})}function y(t,e){var r=Object.keys(t).find(function(r){return e===t[r]});return r?t[r]:void 0}var f=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),A=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},h=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var E=r(0),P=r(9),T=r(12),O=h(r(29)),v=r(1),_=h(r(30)),b=r(31),g="::";e.actionWrapper=o,e.getVersion=i,e.getEventNameSpace=n,e.isValidOptionalNumber=a,e.isValidOptionalString=s;var I=function(){function t(t,e,r){this.subgroups=[],this.subscriptions=[],t||E.throwError(E.ActionType.INVALID_OPTIONS,"Missing required `app`"),this.id=_.default(),this.app=t,this.type=e,this.group=r,this.defaultGroup=r}return Object.defineProperty(t.prototype,"component",{get:function(){return{id:this.id,subgroups:this.subgroups,type:this.type}},enumerable:!0,configurable:!0}),t.prototype.updateSubscription=function(t,e,r){var o,i=t.eventType,n=t.callback,a=t.component;return o=this.subscriptions.findIndex(function(e){return e===t}),o>=0?this.subscriptions[o].unsubscribe():o=void 0,this.group=e,this.subgroups=r,Object.assign(a,{subgroups:this.subgroups}),this.subscribe(i,n,a,o)},t.prototype.error=function(t){var e=this,r=[];return l(E.Action,function(o){r.push(e.subscriptions.length),e.subscribe(o,t)}),function(){r.map(function(t){return e.subscriptions[t]}).forEach(function(t){P.removeFromCollection(e.subscriptions,t,function(t){t.unsubscribe()})})}},t.prototype.subscribe=function(t,e,r,o){var i,a=this,s=r||this.component,u=t.toUpperCase(),p="number"==typeof o?e:e.bind(this);i=E.isErrorEventName(t)?n(v.Group.Error,t,A({},s,{type:""})):n(this.group,t,s);var c=this.app.subscribe(i,p,r?r.id:this.id),d={eventType:u,unsubscribe:c,callback:p,component:s,updateSubscribe:function(t,e){return a.updateSubscription.call(a,d,t,e)}};return"number"==typeof o&&o>=0&&o<this.subscriptions.length?this.subscriptions[o]=d:this.subscriptions.push(d),c},t.prototype.unsubscribe=function(t){return void 0===t&&(t=!1),u(this.subscriptions,this.defaultGroup,t),this},t}();e.TwoWayAction=I;var S=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.children=[],e}return f(e,t),e.prototype.unsubscribe=function(t,r){return void 0===t&&(t=!0),void 0===r&&(r=!1),u(this.subscriptions,this.defaultGroup,r),this.children.forEach(function(r){e.prototype.isPrototypeOf(r)?r.unsubscribe(t,!t):r.unsubscribe(!t)}),this},e.prototype.getChild=function(t){var e=this.children.findIndex(function(e){return e.id===t});return e>=0?this.children[e]:void 0},e.prototype.getChildIndex=function(t){return this.children.findIndex(function(e){return e.id===t})},e.prototype.getChildSubscriptions=function(t,e){return this.subscriptions.filter(function(r){return r.component.id===t&&(!e||e===r.eventType)})},e.prototype.addChild=function(t,r,o){var i=this,n=t.subscriptions;return this.getChild(t.id)||this.children.push(t),!n||r===t.group&&o===t.subgroups?this:(n.forEach(function(t){(0,t.updateSubscribe)(r,o)}),Object.assign(t,{group:r,subgroups:o}),e.prototype.isPrototypeOf(t)&&t.children.forEach(function(t){return i.addChild(t,r,o)}),this)},e.prototype.removeChild=function(t){var e=this;return P.removeFromCollection(this.children,this.getChild(t),function(){e.subscriptions.filter(function(e){return e.component.id===t}).forEach(function(t){P.removeFromCollection(e.subscriptions,t,function(t){t.unsubscribe()})})}),this},e.prototype.subscribeToChild=function(t,e,r){var o=this,i=r.bind(this);if(e instanceof Array)return e.forEach(function(e){return o.subscribeToChild(t,e,r)}),this;if("string"!=typeof e)return this;var n=e.toUpperCase(),a=this.getChildSubscriptions(t.id,n);if(a.length>0)a.forEach(function(e){return e.updateSubscribe(o.group,t.subgroups)});else{var s={id:t.id,subgroups:t.subgroups,type:t.type};this.subscribe(n,i,s)}return this},e.prototype.getUpdatedChildActions=function(t,e){if(0!==t.length){for(var r=t.filter(function(t,e,r){return e===r.indexOf(t)}),o=r.map(function(t){return t.id}),i=e.filter(function(t){return o.indexOf(t.id)<0});i.length>0;){var n=i.pop();if(!n)break;this.removeChild(n.id)}return r}for(;e.length>0;){var n=e.pop();if(!n)break;this.removeChild(n.id)}},e}(I);e.TwoWayActionWithChildren=S,e.sanitizeProps=p,e.updateActionFromPayload=c,e.getMergedProps=d,e.forEachInEnum=l,e.findMatchInEnum=y},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(32)),o(r(13))},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(33)),o(r(14))},function(t,e,r){"use strict";function o(t,e,r,o){t.addChild(e,t.group,r);var n=e.id,a=e.label,s=e.primary,u=e.disabled,p={disabled:u,id:n,label:a,primary:s};return t.subscribeToChild(e,i.Action.UPDATE,o),p}Object.defineProperty(e,"__esModule",{value:!0});var i=r(3);e.getSingleButton=o},function(t,e,r){"use strict";function o(t){return"string"==typeof t&&(""===t||"/"===t.charAt(0))}function i(t){return"string"==typeof t&&t.match("^https?://")}Object.defineProperty(e,"__esModule",{value:!0}),e.isValidRelativePath=o,e.isValidAbsolutePath=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.PUSH="APP::HISTORY::PUSH",t.REPLACE="APP::HISTORY::REPLACE"}(e.ActionType||(e.ActionType={}));!function(t){t.PUSH="PUSH",t.REPLACE="REPLACE"}(e.Action||(e.Action={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.ADMIN_PATH="ADMIN::PATH",t.ADMIN_SECTION="ADMIN::SECTION",t.REMOTE="REMOTE",t.APP="APP"}(e.Action||(e.Action={}));!function(t){t.ADMIN_SECTION="APP::REDIRECT::ADMIN::SECTION",t.ADMIN_PATH="APP::REDIRECT::ADMIN::PATH",t.REMOTE="APP::REDIRECT::REMOTE",t.APP="APP::REDIRECT::APP"}(e.ActionType||(e.ActionType={}));!function(t){t.Product="products",t.Collection="collections",t.Order="orders",t.Customer="customers",t.Discount="discounts"}(e.ResourceType||(e.ResourceType={}))},function(t,e,r){"use strict";function o(t,e,r){return t.push(e),function(){return i(t,e,r)}}function i(t,e,r){var o=t.findIndex(function(t){return t===e});return o>=0&&(t.splice(o,1),r&&r(e),!0)}Object.defineProperty(e,"__esModule",{value:!0}),e.addAndRemoveFromCollection=o,e.removeFromCollection=i},function(t,e,r){"use strict";function o(t){return t instanceof Object&&t.hasOwnProperty("type")&&t.type.toString().startsWith(d.PREFIX)}function i(t){return"object"==typeof t&&"object"==typeof t.source&&"string"==typeof t.source.apiKey}function n(t){if("object"!=typeof t||!t.data||"object"!=typeof t.data)return!1;var e=t.data;return e.hasOwnProperty("type")&&("getState"===e.type||"dispatch"===e.type)}function a(t,e){switch(t.group){case p.Group.Button:return p.Button.validationError(t)||t;case p.Group.ButtonGroup:return p.ButtonGroup.validationError(t)||t;case p.Group.Cart:return p.Cart.validationError(t)||t;case p.Group.Flash:return p.Flash.validationError(t)||t;case p.Group.Modal:return p.Modal.validationError(t,e)||t;case p.Group.TitleBar:return p.TitleBar.validationError(t)||t;case p.Group.Navigation:return p.Navigation.validationError(t)||t;case p.Group.Error:return t;case p.Group.Print:return p.Print.validationError(t)||t;case p.Group.Loading:return p.Loading.validationError(t)||t;case p.Group.ResourcePicker:return p.ResourcePicker.validationError(t)||t;default:return c.invalidAction(t,"Unknown or unsupported action group")}}function s(t,e){if(!o(t))return t;for(var r=0,i=l;r<i.length;r++){var n=i[r];if(!t.hasOwnProperty(n)||"string"!=typeof t[n])return c.invalidAction(t,"Missing or invalid "+n)}return a(t,e)}var u=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var p=u(r(24)),c=r(0),d=r(12),l=["group","type","version"];e.isEASDKAction=o,e.isFromApp=i,e.isAppMessage=n,e.validatedActionPayload=a,e.validatedAction=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.INVALID_ACTION="INVALID_ACTION",t.INVALID_ACTION_TYPE="INVALID_ACTION_TYPE",t.INVALID_OPTIONS="INVALID_OPTIONS",t.INVALID_PAYLOAD="INVALID_PAYLOAD",t.UNEXPECTED_ACTION="UNEXPECTED_ACTION",t.PERSISTENCE="PERSISTENCE",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK="NETWORK"}(e.Action||(e.Action={}));!function(t){t.INVALID_ACTION="APP::ERROR::INVALID_ACTION",t.INVALID_ACTION_TYPE="APP::ERROR::INVALID_ACTION_TYPE",t.INVALID_PAYLOAD="APP::ERROR::INVALID_PAYLOAD",t.INVALID_OPTIONS="APP::ERROR::INVALID_OPTIONS",t.UNEXPECTED_ACTION="APP::ERROR::UNEXPECTED_ACTION",t.PERSISTENCE="APP::ERROR::PERSISTENCE",t.UNSUPPORTED_OPERATION="APP::ERROR::UNSUPPORTED_OPERATION",t.NETWORK="APP::ERROR::NETWORK"}(e.ActionType||(e.ActionType={}));!function(t){t.INVALID_CONFIG="APP::ERROR:INVALID_CONFIG",t.MISSING_CONFIG="APP::APP_ERROR::MISSING_CONFIG",t.MISSING_EASDK_MIDDLEWARE="APP::APP_ERROR::MISSING_EASDK_MIDDLEWARE"}(e.AppActionType||(e.AppActionType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PREFIX="APP"},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.CLICK="CLICK",t.UPDATE="UPDATE"}(e.Action||(e.Action={}));!function(t){t.CLICK="APP::BUTTON::CLICK",t.UPDATE="APP::BUTTON::UPDATE"}(e.ActionType||(e.ActionType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.UPDATE="UPDATE"}(e.Action||(e.Action={}));!function(t){t.UPDATE="APP::BUTTON::UPDATE"}(e.ActionType||(e.ActionType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.FETCH="APP::CART::FETCH",t.UPDATE="APP::CART::UPDATE",t.SET_CUSTOMER="APP::CART::SET_CUSTOMER",t.REMOVE_CUSTOMER="APP::CART::REMOVE_CUSTOMER",t.ADD_CUSTOMER_ADDRESS="APP::CART::ADD_CUSTOMER_ADDRESS",t.UPDATE_CUSTOMER_ADDRESS="APP::CART::UPDATE_CUSTOMER_ADDRESS",t.SET_DISCOUNT="APP::CART::SET_DISCOUNT",t.REMOVE_DISCOUNT="APP::CART::REMOVE_DISCOUNT",t.SET_PROPERTIES="APP::CART::SET_PROPERTIES",t.REMOVE_PROPERTIES="APP::CART::REMOVE_PROPERTIES",t.CLEAR="APP::CART::CLEAR",t.ADD_LINE_ITEM="APP::CART::ADD_LINE_ITEM",t.UPDATE_LINE_ITEM="APP::CART::UPDATE_LINE_ITEM",t.REMOVE_LINE_ITEM="APP::CART::REMOVE_LINE_ITEM",t.SET_LINE_ITEM_DISCOUNT="APP::CART::SET_LINE_ITEM_DISCOUNT",t.REMOVE_LINE_ITEM_DISCOUNT="APP::CART::REMOVE_LINE_ITEM_DISCOUNT",t.SET_LINE_ITEM_PROPERTIES="APP::CART::SET_LINE_ITEM_PROPERTIES",t.REMOVE_LINE_ITEM_PROPERTIES="APP::CART::REMOVE_LINE_ITEM_PROPERTIES"}(e.ActionType||(e.ActionType={}));!function(t){t.FETCH="FETCH",t.UPDATE="UPDATE",t.SET_CUSTOMER="SET_CUSTOMER",t.REMOVE_CUSTOMER="REMOVE_CUSTOMER",t.ADD_CUSTOMER_ADDRESS="ADD_CUSTOMER_ADDRESS",t.UPDATE_CUSTOMER_ADDRESS="UPDATE_CUSTOMER_ADDRESS",t.SET_DISCOUNT="SET_DISCOUNT",t.REMOVE_DISCOUNT="REMOVE_DISCOUNT",t.SET_PROPERTIES="SET_PROPERTIES",t.REMOVE_PROPERTIES="REMOVE_PROPERTIES",t.CLEAR="CLEAR",t.ADD_LINE_ITEM="ADD_LINE_ITEM",t.UPDATE_LINE_ITEM="UPDATE_LINE_ITEM",t.REMOVE_LINE_ITEM="REMOVE_LINE_ITEM",t.SET_LINE_ITEM_DISCOUNT="SET_LINE_ITEM_DISCOUNT",t.REMOVE_LINE_ITEM_DISCOUNT="REMOVE_LINE_ITEM_DISCOUNT",t.SET_LINE_ITEM_PROPERTIES="SET_LINE_ITEM_PROPERTIES",t.REMOVE_LINE_ITEM_PROPERTIES="REMOVE_LINE_ITEM_PROPERTIES"}(e.Action||(e.Action={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.SHOW="APP::FLASH::SHOW",t.CLEAR="APP::FLASH::CLEAR"}(e.ActionType||(e.ActionType={}));!function(t){t.SHOW="SHOW",t.CLEAR="CLEAR"}(e.Action||(e.Action={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.START="APP::LOADING::START",t.STOP="APP::LOADING::STOP"}(e.ActionType||(e.ActionType={}));!function(t){t.START="START",t.STOP="STOP"}(e.Action||(e.Action={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.OPEN="OPEN",t.CLOSE="CLOSE",t.UPDATE="UPDATE"}(e.Action||(e.Action={}));!function(t){t.OPEN="APP::MODAL::OPEN",t.CLOSE="APP::MODAL::CLOSE",t.UPDATE="APP::MODAL::UPDATE"}(e.ActionType||(e.ActionType={}));!function(t){t.FOOTER_BUTTON_CLICK="APP::MODAL::FOOTER::BUTTON::CLICK",t.FOOTER_BUTTON_UPDATE="APP::MODAL::FOOTER::BUTTON::UPDATE"}(e.FooterActionType||(e.FooterActionType={}));!function(t){t.Small="small",t.Medium="medium",t.Large="large",t.Full="full"}(e.Size||(e.Size={}))},function(t,e,r){"use strict";function o(t){return a.actionWrapper({payload:t,group:s.Group.Navigation,type:c.ActionType.PUSH})}function i(t){return a.actionWrapper({payload:t,group:s.Group.Navigation,type:c.ActionType.REPLACE})}function n(t){var e;switch(t.type){case c.ActionType.REPLACE:case c.ActionType.PUSH:return e=t.payload,void 0===e?u.invalidPayload(t,u.Message.MISSING_PAYLOAD):p.isValidAbsolutePath(e.path)||p.isValidRelativePath(e.path)?void 0:u.invalidPayload(t,"Invalid path provided. Expected a relative or absolute https or http path");default:return u.invalidActionType(t)}}Object.defineProperty(e,"__esModule",{value:!0});var a=r(2),s=r(1),u=r(0),p=r(6),c=r(7);e.push=o,e.replace=i,e.validationError=n},function(t,e,r){"use strict";function o(t){return"string"==typeof t.id}function i(t){return!0===t.create}function n(t){var e=t;return void 0!==e.id&&void 0!==e.variant}function a(t){return!!n(t)&&i(t.variant)}function s(t){return y.actionWrapper({payload:t,group:e.GROUP,type:E.ActionType.ADMIN_PATH})}function u(t){return y.actionWrapper({payload:t,group:e.GROUP,type:E.ActionType.ADMIN_SECTION})}function p(t){return y.actionWrapper({payload:t,group:e.GROUP,type:E.ActionType.REMOTE})}function c(t){return y.actionWrapper({payload:t,group:e.GROUP,type:E.ActionType.APP})}function d(t){if(void 0===t)return!1;var e=t.name,r=t.resource;if(!e)return!1;var s=!1;return y.forEachInEnum(E.ResourceType,function(t){e===t&&(s=!0)}),!!s&&(void 0===r||n(r)||a(r)||i(r)||o(r))}function l(t){var e;switch(t.type){case E.ActionType.ADMIN_PATH:return e=t.payload,void 0===e?A.invalidPayload(t,A.Message.MISSING_PAYLOAD):h.isValidRelativePath(e.path)?void 0:A.invalidPayload(t,"Path is invalid. Expecting relative path");case E.ActionType.REMOTE:return e=t.payload,void 0===e?A.invalidPayload(t,A.Message.MISSING_PAYLOAD):h.isValidAbsolutePath(e.url)?void 0:A.invalidPayload(t,"Url is invalid. Expecting absolute url");case E.ActionType.APP:return e=t.payload,void 0===e?A.invalidPayload(t,A.Message.MISSING_PAYLOAD):h.isValidRelativePath(e.path)?void 0:A.invalidPayload(t,"Path is invalid. Expecting relative path");case E.ActionType.ADMIN_SECTION:return e=t.payload,void 0===e?A.invalidPayload(t,A.Message.MISSING_PAYLOAD):d(e.section)?void 0:A.invalidPayload(t,"Invalid admin section resource");default:return A.invalidActionType(t)}}Object.defineProperty(e,"__esModule",{value:!0});var y=r(2),f=r(1),A=r(0),h=r(6),E=r(8);e.GROUP=f.Group.Navigation,e.isResourcePayload=o,e.isCreateResourcePayload=i,e.isProductVariantResourcePayload=n,e.isProductVariantCreateResourcePayload=a,e.toAdminPath=s,e.toAdminSection=u,e.toRemote=p,e.toApp=c,e.isValidAdminResource=d,e.validationError=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.APP="APP::PRINT::APP"}(e.ActionType||(e.ActionType={}));!function(t){t.APP="APP"}(e.Action||(e.Action={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.OPEN="OPEN",t.SELECT="SELECT",t.CLOSE="CLOSE",t.UPDATE="UPDATE"}(e.Action||(e.Action={}));!function(t){t.OPEN="APP::RESOURCE_PICKER::OPEN",t.SELECT="APP::RESOURCE_PICKER::SELECT",t.CLOSE="APP::RESOURCE_PICKER::CLOSE",t.UPDATE="APP::RESOURCE_PICKER::UPDATE"}(e.ActionType||(e.ActionType={}));!function(t){t.Product="product",t.Collection="collection"}(e.ResourceType||(e.ResourceType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.UPDATE="UPDATE"}(e.Action||(e.Action={}));!function(t){t.UPDATE="APP::TITLEBAR::UPDATE"}(e.ActionType||(e.ActionType={}));!function(t){t.BUTTON_CLICK="APP::TITLEBAR::BUTTONS::BUTTON::CLICK",t.BUTTON_UPDATE="APP::TITLEBAR::BUTTONS::BUTTON::UPDATE",t.BUTTON_GROUP_UPDATE="APP::TITLEBAR::BUTTONS::BUTTONGROUP::UPDATE",t.BREADCRUMBS_CLICK="APP::TITLEBAR::BREADCRUMBS::BUTTON::CLICK",t.BREADCRUMBS_UPDATE="APP::TITLEBAR::BREADCRUMBS::BUTTON::UPDATE"}(e.ButtonsActionType||(e.ButtonsActionType={}))},function(t,e,r){"use strict";var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(r(1));var i=o(r(3));e.Button=i;var n=o(r(4));e.ButtonGroup=n;var a=o(r(34));e.Cart=a;var s=o(r(0));e.Error=s;var u=o(r(36));e.Flash=u;var p=o(r(38));e.Loading=p;var c=o(r(40));e.Modal=c;var d=o(r(43));e.Navigation=d;var l=o(r(45));e.History=l;var y=o(r(46));e.Redirect=y;var f=o(r(25));e.Print=f;var A=o(r(48));e.ResourcePicker=A;var h=o(r(50));e.TitleBar=h;var E=r(10);e.isEASDKAction=E.isEASDKAction},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(47)),o(r(21))},,,function(t,e,r){"use strict";function o(t,e){var r=t.payload;return c.actionWrapper({group:d.Group.Error,payload:{action:t,id:r&&r.id?r.id:void 0,message:e||"The action's payload is missing required properties or has invalid properties",type:l.ActionType.INVALID_PAYLOAD},type:l.ActionType.INVALID_PAYLOAD})}function i(t,e){return c.actionWrapper({group:d.Group.Error,payload:{action:t,message:e||"The action type is invalid or unsupported",type:l.ActionType.INVALID_ACTION_TYPE},type:l.ActionType.INVALID_ACTION_TYPE})}function n(t,e){return c.actionWrapper({group:d.Group.Error,payload:{action:t,message:e||"The action's has missing/invalid values for `group`, `type` or `version`",type:l.ActionType.INVALID_ACTION},type:l.ActionType.INVALID_ACTION})}function a(t,e){return c.actionWrapper({group:d.Group.Error,payload:{action:t,message:e||"Action cannot be called at this time",type:l.ActionType.UNEXPECTED_ACTION},type:l.ActionType.UNEXPECTED_ACTION})}function s(t){return"string"==typeof c.findMatchInEnum(l.Action,t)}function u(t,e,r){var o=t?e+": "+t:e,i=new y(o);return i.action=r,i.type=e,i}function p(){var t,e,r=arguments[0];throw"string"==typeof arguments[1]?t=arguments[1]:(e=arguments[1],t=arguments[2]||""),u(t,r,e)}Object.defineProperty(e,"__esModule",{value:!0});var c=r(2),d=r(1),l=r(11);!function(t){t.MISSING_PAYLOAD="Missing payload",t.INVALID_PAYLOAD_ID="Id in payload is missing or invalid"}(e.Message||(e.Message={})),e.invalidPayload=o,e.invalidActionType=i,e.invalidAction=n,e.unexpectedAction=a,e.isErrorEventName=s;var y=function(){function t(t){this.name="EASDKError",this.message=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(this.message).stack}return t}();e.EASDKError=y,y.prototype=Object.create(Error.prototype),e.fromAction=u,e.throwError=p},function(t,e,r){"use strict";function o(t,e){if(void 0!==e){if(!Object.getPrototypeOf(t).isPrototypeOf(e))return e;var r={};return Object.keys(e).forEach(function(i){t.hasOwnProperty(i)?"object"!=typeof t[i]||Array.isArray(t[i])?r[i]=e[i]:r[i]=o(t[i],e[i]):r[i]=e[i]}),Object.keys(t).forEach(function(o){e.hasOwnProperty(o)||(r[o]=t[o])}),Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=o},function(t,e,r){"use strict";function o(t){return Array.from(t).map(function(t){return("00"+t.toString(16)).slice(-2)}).join("")}function i(t){if("function"==typeof Uint8Array&&window.crypto){var e=new Uint8Array(t),r=window.crypto.getRandomValues(e);if(r)return r}return Array.from(new Array(t),function(){return 255*Math.random()|0})}function n(){var t=i(1),e=i(2);return t[0]&=191,e[0]&=79,[o(i(4)),"-",o(i(2)),"-",o(e),"-",o(t),o(i(1)),"-",o(i(6))].join("")}Object.defineProperty(e,"__esModule",{value:!0}),e.generateUuid=n,e.default=n},function(t,e){t.exports={name:"@shopify/app-bridge",version:"0.1.2-3",types:"index.d.ts",main:"index.js",files:["actions.js","actions.js.map","actions/","client/","index.d.ts","index.js","index.js.map","host.js","host.js.map","host/","types/*","util/"],private:!1,publishConfig:{access:"public","@shopify:registry":"https://registry.npmjs.org"},repository:"git@github.com:Shopify/app-bridge.git",author:"Shopify Inc.",license:"MIT",scripts:{build:"NODE_ENV=production webpack -p && tsc --project ./tsconfig.build.json --emitDeclarationOnly && echo \"/**\n * @module client\n */\n\nimport createClientApp from './client';\nexport * from './client';\nexport default createClientApp;\n\" > index.d.ts","build:docs":"typedoc src/actions --out docs/actions -name app-bridge/actions && typedoc src/host -name app-bridge/host --out docs/host && typedoc src/client -name app-bridge/client --out docs/client",check:"tsc -p ./tsconfig.json --pretty --noEmit",clean:"rm -rf ./**/*.d.ts ./actions* ./client* ./host* ./index* ./util",lint:"tslint -c ./tslint.json -p ./tsconfig.json -t codeFrame",prepublishOnly:"yarn run clean && yarn run build",start:"webpack-dev-server","start:prodShop":"API_KEY=eff9519f64b4108b99ff551aba8d9344 webpack-dev-server",test:"jest 'src'","test:CI":"CI=true yarn test:coverage","test:coverage":"yarn test --coverage --outputFile=coverage --maxWorkers 2","test:watch":"yarn test --watch",watch:"webpack --progress --watch"},devDependencies:{"@shopify/shopify-express":"^1.0.0-alpha.7","@types/enzyme":"^2.8.12","@types/jest":"^22.2.0","@types/react":"^16.0.40","@types/react-dom":"^16.0.3","@types/react-hot-loader":"^3.0.4","@types/react-redux":"^5.0.9","@types/react-router-dom":"^4.0.8","@types/react-router-redux":"^5.0.8","@types/react-test-renderer":"15.5.4","@types/react-transition-group":"^2.0.6","@types/webpack-env":"^1.13.1","awesome-typescript-loader":"^3.4.1","babel-plugin-system-import-transformer":"^3.1.0","css-loader":"^0.28.7",enzyme:"3.3.0","enzyme-adapter-react-15":"^1.0.5","express-session":"^1.15.6","hoist-non-react-statics":"^2.5.0","html-webpack-plugin":"^2.30.1",jest:"22.4.2","postcss-shopify":"^1.0.0",prettier:"1.12.0",react:"^15.5.4","react-dom":"^15.5.4","react-redux":"^5.0.6","react-test-renderer":"15.5.4","react-transition-group":"^2.2.1",redux:"^3.7.2","redux-devtools-extension":"^2.13.2","style-loader":"^0.19.0","ts-jest":"^22.4.1",tslint:"^5.9.1","tslint-config-shopify":"^3.0.1",typedoc:"^0.10.0","typedoc-plugin-external-module-name":"^1.1.1","typedoc-plugin-markdown":"^1.0.14",typescript:"2.8.1",webpack:"^3.10.0","webpack-dev-server":"^2.9.5","webpack-fix-default-import-plugin":"^1.0.3"},prettier:{bracketSpacing:!1,printWidth:100,singleQuote:!0,trailingComma:"all"},jest:{globals:{"ts-jest":{babelConfig:{plugins:["babel-plugin-system-import-transformer"],sourceMaps:"inline"}}},setupTestFrameworkScriptFile:"./test/setup.js",testRegex:".*\\.test\\.tsx?$",testURL:"https://easdk.myshopify.io/",transform:{".tsx?$":"<rootDir>/../../node_modules/ts-jest/preprocessor.js"},moduleFileExtensions:["js","jsx","json","ts","tsx"],collectCoverageFrom:["src/**/*.{js,jsx,ts,tsx}","!**/node_modules/**","!**/index.{ts,tsx}","!**/types.ts"],moduleDirectories:["<rootDir>/node_modules","./node_modules","./src"],moduleNameMapper:{"app-bridge/info":"<rootDir>/package.json"}}}},function(t,e,r){"use strict";function o(t){return d.sanitizeProps(t,["label","primary","disabled","id"])}function i(t,e,r){var o=e.id,i=d.getEventNameSpace(t,f.Action.CLICK,e),n={id:o,payload:r};return d.actionWrapper({type:i,group:t,payload:n})}function n(t,e,r){var i=e.id,n=r.label,a=d.getEventNameSpace(t,f.Action.UPDATE,e),s=c({id:i,label:n},o(r));return d.actionWrapper({type:a,group:t,payload:s})}function a(t){if(!t.hasOwnProperty("payload"))return y.invalidPayload(t,y.Message.MISSING_PAYLOAD);var e;switch(t.type){case f.ActionType.CLICK:return e=t.payload,"string"==typeof e.id?void 0:y.invalidPayload(t,y.Message.INVALID_PAYLOAD_ID);case f.ActionType.UPDATE:return e=t.payload,s(e)?void 0:y.invalidPayload(t);default:return y.invalidActionType(t)}}function s(t){return"string"==typeof t.id&&"string"==typeof t.label}function u(t,e){return new A(t,e)}var p=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),c=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var d=r(2),l=r(1),y=r(0),f=r(13);e.getSafeButtonProps=o,e.clickButton=i,e.update=n,e.validationError=a,e.isValidButtonProps=s;var A=function(t){function e(e,r){var o=t.call(this,e,l.ComponentType.Button,l.Group.Button)||this;return o.primary=!1,o.disabled=!1,o.set(r,!1),o}return p(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{disabled:this.disabled,label:this.label,primary:this.primary}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return c({id:this.id},this.options)},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var r=d.getMergedProps(this.options,t),o=r.label,i=r.primary,n=r.disabled;return this.validateOptions(r)?(this.label=o,this.primary=!!i,this.disabled=!!n,e&&this.dispatch(f.Action.UPDATE),this):this},e.prototype.dispatch=function(t,e){switch(t){case f.Action.CLICK:this.app.dispatch(i(this.group,this.component,e));break;case f.Action.UPDATE:var r=n(this.group,this.component,this.payload);this.app.dispatch(r);break;default:y.throwError(y.ActionType.INVALID_ACTION_TYPE,d.actionWrapper({payload:e,group:this.group,type:t}))}return this},e.prototype.validateOptions=function(t){var e=c({id:this.id},t);if(!s(e)){var r=n(this.group,this.component,e);return y.throwError(y.ActionType.INVALID_OPTIONS,r),!1}return!0},e}(d.TwoWayAction);e.Button=A,e.create=u},function(t,e,r){"use strict";function o(t,e,r){return c(t,e,P.Action.UPDATE,r)}function i(t){var e=t;return e.buttons&&e.buttons.length>0&&void 0!==e.label}function n(t){var e=t;return Array.isArray(e.buttons)&&"string"==typeof e.id&&"string"==typeof e.label}function a(t){return f.sanitizeProps(t,["label","disabled","buttons","id"])}function s(t){if(!t.hasOwnProperty("payload"))return E.invalidPayload(t,E.Message.MISSING_PAYLOAD);switch(t.type){case P.ActionType.UPDATE:return u(t.payload)?void 0:E.invalidPayload(t);default:return E.invalidActionType(t)}}function u(t){if("string"!=typeof t.id||"string"!=typeof t.label||!Array.isArray(t.buttons))return!1;for(var e=0,r=t.buttons;e<r.length;e++){var o=r[e];if(!h.isValidButtonProps(o))return!1}return!0}function p(t,e){return new T(t,e)}function c(t,e,r,o,i){var n=e.id,s=o.label,u=f.getEventNameSpace(t,r,e),p=l({id:n,label:s},a(o),{payload:i});return f.actionWrapper({type:u,group:t,payload:p})}var d=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),l=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var y=r(5),f=r(2),A=r(1),h=r(3),E=r(0),P=r(14);e.update=o,e.isGroupedButton=i,e.isGroupedButtonPayload=n,e.getSafeButtonGroupProps=a,e.validationError=s,e.isValidButtonGroupProps=u;var T=function(t){function e(e,r){var o=t.call(this,e,A.ComponentType.ButtonGroup,A.Group.ButtonGroup)||this;return o.disabled=!1,o.buttonsOptions=[],o.buttons=[],o.set(r,!1),o}return d(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{buttons:this.buttonsOptions,disabled:this.disabled,label:this.label}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return l({},this.options,{buttons:this.buttons,id:this.id})},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var r=f.getMergedProps(this.options,t),o=r.label,i=r.disabled,n=r.buttons;return this.validateOptions(r)?(this.label=o,this.disabled=!!i,this.buttons=this.getButtons(n),e&&this.dispatch(P.Action.UPDATE),this):this},e.prototype.dispatch=function(t){switch(t){case P.Action.UPDATE:var e=o(this.group,this.component,this.payload);this.app.dispatch(e);break;default:E.throwError(E.ActionType.INVALID_ACTION_TYPE,f.actionWrapper({group:this.group,type:t}))}return this},e.prototype.updateButtons=function(t){if(this.buttons&&0!==this.buttons.length){for(var e,r=0,o=this.buttons;r<o.length;r++){var i=o[r];if(e=f.updateActionFromPayload(i,h.getSafeButtonProps(t)))break}e&&this.dispatch(P.Action.UPDATE)}},e.prototype.getSingleButton=function(t){return y.getSingleButton(this,t,this.subgroups,this.updateButtons)},e.prototype.getButtons=function(t){var e=this,r=[];return t?(t.forEach(function(t){var o=y.getSingleButton(e,t,e.subgroups,e.updateButtons);r.push(o)}),this.buttonsOptions=t,r):[]},e.prototype.validateOptions=function(t){var e=l({id:this.id},t);if(!u(e)){var r=o(this.group,this.component,e);return E.throwError(E.ActionType.INVALID_OPTIONS,r),!1}return!0},e}(f.TwoWayActionWithChildren);e.ButtonGroup=T,e.create=p},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(35)),o(r(15))},function(t,e,r){"use strict";function o(){return L.actionWrapper({group:B.Group.Cart,type:V.ActionType.FETCH})}function i(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.SET_CUSTOMER})}function n(){return L.actionWrapper({group:B.Group.Cart,type:V.ActionType.REMOVE_CUSTOMER})}function a(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.ADD_CUSTOMER_ADDRESS})}function s(t,e){return L.actionWrapper({group:B.Group.Cart,payload:{data:e,index:t},type:V.ActionType.UPDATE_CUSTOMER_ADDRESS})}function u(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.SET_DISCOUNT})}function p(){return L.actionWrapper({group:B.Group.Cart,type:V.ActionType.REMOVE_DISCOUNT})}function c(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.SET_PROPERTIES})}function d(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.REMOVE_PROPERTIES})}function l(){return L.actionWrapper({group:B.Group.Cart,type:V.ActionType.CLEAR})}function y(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.ADD_LINE_ITEM})}function f(t,e){return L.actionWrapper({group:B.Group.Cart,payload:{data:e,index:t},type:V.ActionType.UPDATE_LINE_ITEM})}function A(t){return L.actionWrapper({group:B.Group.Cart,payload:{index:t},type:V.ActionType.REMOVE_LINE_ITEM})}function h(t,e){return L.actionWrapper({group:B.Group.Cart,payload:{data:e,index:t},type:V.ActionType.SET_LINE_ITEM_DISCOUNT})}function E(t){return L.actionWrapper({group:B.Group.Cart,payload:{index:t},type:V.ActionType.REMOVE_LINE_ITEM_DISCOUNT})}function P(t,e){return L.actionWrapper({group:B.Group.Cart,payload:{data:e,index:t},type:V.ActionType.SET_LINE_ITEM_PROPERTIES})}function T(t,e){return L.actionWrapper({group:B.Group.Cart,payload:{data:e,index:t},type:V.ActionType.REMOVE_LINE_ITEM_PROPERTIES})}function O(t){return L.isValidOptionalString(t.address1)&&L.isValidOptionalString(t.address2)&&L.isValidOptionalString(t.city)&&L.isValidOptionalString(t.company)&&L.isValidOptionalString(t.firstName)&&L.isValidOptionalString(t.lastName)&&L.isValidOptionalString(t.phone)&&L.isValidOptionalString(t.provice)&&L.isValidOptionalString(t.country)&&L.isValidOptionalString(t.zip)&&L.isValidOptionalString(t.name)&&L.isValidOptionalString(t.proviceCode)&&L.isValidOptionalString(t.countryCode)}function v(t){return!t||Array.isArray(t)&&t.every(O)}function _(t){return(void 0===t.cartDiscount||g(t.cartDiscount))&&(void 0===t.customer||b(t.customer)||v(t.customer.addresses))&&L.isValidOptionalString(t.grandTotal)&&(void 0===t.lineItems||S(t.lineItems))&&R(t.noteAttributes)&&L.isValidOptionalString(t.subTotal)&&L.isValidOptionalString(t.taxTotal)}function b(t){return L.isValidOptionalNumber(t.id)&&L.isValidOptionalString(t.email)&&L.isValidOptionalString(t.firstName)&&L.isValidOptionalString(t.lastName)&&L.isValidOptionalString(t.note)}function g(t){return L.isValidOptionalNumber(t.amount)&&L.isValidOptionalString(t.discountDescription)&&L.isValidOptionalString(t.type)}function I(t){return L.isValidOptionalNumber(t.price)&&"number"==typeof t.quantity&&L.isValidOptionalString(t.title)&&L.isValidOptionalNumber(t.variantId)}function S(t){return!t||Array.isArray(t)&&t.every(I)}function R(t){return void 0===t||Array.isArray(t)&&t.every(function(t){return"string"==typeof t.name&&"string"==typeof t.value})}function m(t){return"object"==typeof t&&!Array.isArray(t)&&Object.keys(t).every(function(e){return"string"==typeof t[e]})}function C(t){return Array.isArray(t)&&t.every(function(t){return"string"==typeof t})}function D(t){if(!t.payload||"string"!=typeof t.payload.id)return j.invalidPayload(t,"Missing payload id");var e;switch(t.type){case V.ActionType.FETCH:return;case V.ActionType.UPDATE:return e=t.payload,e.data&&_(e.data)?void 0:j.invalidPayload(t,"Invalid update payload");case V.ActionType.SET_CUSTOMER:return e=t.payload,e.data&&b(e.data)?void 0:j.invalidPayload(t,"Invalid set customer payload");case V.ActionType.REMOVE_CUSTOMER:return;case V.ActionType.ADD_CUSTOMER_ADDRESS:return e=t.payload,e.data&&O(e.data)?void 0:j.invalidPayload(t,"Invalid add customer address payload");case V.ActionType.UPDATE_CUSTOMER_ADDRESS:return e=t.payload,e.data&&"number"==typeof e.index&&O(e.data)?void 0:j.invalidPayload(t,"Invalid update customer address payload");case V.ActionType.SET_DISCOUNT:return e=t.payload,e.data&&g(e.data)?void 0:j.invalidPayload(t,"Invalid set discount payload");case V.ActionType.REMOVE_DISCOUNT:return;case V.ActionType.SET_PROPERTIES:return e=t.payload,e.data&&m(e.data)?void 0:j.invalidPayload(t,"Invalid add properties payload");case V.ActionType.REMOVE_PROPERTIES:return e=t.payload,e.data&&C(e.data)?void 0:j.invalidPayload(t,"Invalid remove properties payload");case V.ActionType.CLEAR:return;case V.ActionType.ADD_LINE_ITEM:return e=t.payload,e.data&&I(e.data)?void 0:j.invalidPayload(t,"Invalid add line item payload");case V.ActionType.UPDATE_LINE_ITEM:return e=t.payload,e.data&&"number"==typeof e.index&&"number"==typeof e.data.quantity?void 0:j.invalidPayload(t,"Invalid update line item payload");case V.ActionType.REMOVE_LINE_ITEM:return e=t.payload,"number"!=typeof e.index?j.invalidPayload(t,"Invalid remove line item payload"):void 0;case V.ActionType.SET_LINE_ITEM_DISCOUNT:return e=t.payload,e.data&&"number"==typeof e.index&&g(e.data)?void 0:j.invalidPayload(t,"Invalid set line item discount payload");case V.ActionType.REMOVE_LINE_ITEM_DISCOUNT:return e=t.payload,"number"!=typeof e.index?j.invalidPayload(t,"Invalid remove line item discount payload"):void 0;case V.ActionType.SET_LINE_ITEM_PROPERTIES:return e=t.payload,e.data&&"number"==typeof e.index&&m(e.data)?void 0:j.invalidPayload(t,"Invalid add line item properties payload");case V.ActionType.REMOVE_LINE_ITEM_PROPERTIES:return e=t.payload,e.data&&"number"==typeof e.index&&C(e.data)?void 0:j.invalidPayload(t,"Invalid remove line item properties payload");default:return j.invalidActionType(t)}}function N(t){return new w(t)}var M=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),U=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var L=r(2),B=r(1),j=r(0),V=r(15);e.fetch=o,e.setCustomer=i,e.removeCustomer=n,e.addCustomerAddress=a,e.updateCustomerAddress=s,e.setDiscount=u,e.removeDiscount=p,e.setProperties=c,e.removeProperties=d,e.clear=l,e.addLineItem=y,e.updateLineItem=f,e.removeLineItem=A,e.setLineItemDiscount=h,e.removeLineItemDiscount=E,e.setLineItemProperties=P,e.removeLineItemProperties=T,e.validationError=D;var w=function(t){function e(e){return t.call(this,e,B.Group.Cart,B.Group.Cart)||this}return M(e,t),e.prototype.dispatch=function(t){switch(t.type){case V.ActionType.FETCH:case V.ActionType.UPDATE:case V.ActionType.SET_CUSTOMER:case V.ActionType.REMOVE_CUSTOMER:case V.ActionType.ADD_CUSTOMER_ADDRESS:case V.ActionType.UPDATE_CUSTOMER_ADDRESS:case V.ActionType.SET_DISCOUNT:case V.ActionType.REMOVE_DISCOUNT:case V.ActionType.SET_PROPERTIES:case V.ActionType.REMOVE_PROPERTIES:case V.ActionType.CLEAR:case V.ActionType.ADD_LINE_ITEM:case V.ActionType.UPDATE_LINE_ITEM:case V.ActionType.REMOVE_LINE_ITEM:case V.ActionType.SET_LINE_ITEM_DISCOUNT:case V.ActionType.REMOVE_LINE_ITEM_DISCOUNT:case V.ActionType.SET_LINE_ITEM_PROPERTIES:case V.ActionType.REMOVE_LINE_ITEM_PROPERTIES:this.app.dispatch(U({},t,{payload:U({},t.payload,{id:this.id})}));break;default:j.throwError(j.ActionType.INVALID_ACTION_TYPE,L.actionWrapper({group:this.group,type:t}))}return this},e}(L.TwoWayAction);e.Cart=w,e.create=N},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(37)),o(r(16))},function(t,e,r){"use strict";function o(t){return c.actionWrapper({group:d.Group.Flash,payload:t,type:y.ActionType.SHOW})}function i(t){return c.actionWrapper({payload:t,group:d.Group.Flash,type:y.ActionType.CLEAR})}function n(t){var e;switch(t.type){case y.ActionType.CLEAR:return e=t.payload,void 0===e||void 0===e.id||"string"==typeof e.id?void 0:l.invalidPayload(t,"Id in payload is invalid");case y.ActionType.SHOW:return e=t.payload,void 0===e||void 0!==e.id&&"string"!=typeof e.id||!a(e)?l.invalidPayload(t):void 0;default:return l.invalidActionType(t)}}function a(t){return"string"==typeof t.message&&"number"==typeof t.duration}function s(t,e){return new f(t,e)}var u=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),p=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var c=r(2),d=r(1),l=r(0),y=r(16);e.show=o,e.clear=i,e.validationError=n;var f=function(t){function e(e,r){var o=t.call(this,e,d.Group.Flash,d.Group.Flash)||this;return o.message="",o.duration=3e3,o.set(r),o}return u(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{duration:this.duration,isDismissable:this.isDismissable,isError:this.isError,message:this.message}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return p({id:this.id},this.options)},enumerable:!0,configurable:!0}),e.prototype.set=function(t){var e=c.getMergedProps(this.options,t),r=e.message,o=e.isDismissable,i=e.duration,n=e.isError;return this.validateOptions(e)?(this.message=r,this.isDismissable=o,this.duration=i,this.isError=n,this):this},e.prototype.dispatch=function(t){switch(t){case y.Action.SHOW:var e=o(this.payload);this.app.dispatch(e);break;case y.Action.CLEAR:this.app.dispatch(i({id:this.id}));break;default:l.throwError(l.ActionType.INVALID_ACTION_TYPE,c.actionWrapper({group:this.group,type:t}))}return this},e.prototype.validateOptions=function(t){if(!a(t)){var e=c.actionWrapper({group:d.Group.Flash,payload:p({id:this.id},t)});return l.throwError(l.ActionType.INVALID_OPTIONS,e),!1}return!0},e}(c.TwoWayAction);e.Flash=f,e.create=s},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(39)),o(r(17))},function(t,e,r){"use strict";function o(){return a.actionWrapper({group:s.Group.Loading,type:p.ActionType.START})}function i(){return a.actionWrapper({group:s.Group.Loading,type:p.ActionType.STOP})}function n(t){switch(t.type){case p.ActionType.START:case p.ActionType.STOP:return;default:return u.invalidActionType(t)}}Object.defineProperty(e,"__esModule",{value:!0});var a=r(2),s=r(1),u=r(0),p=r(17);e.start=o,e.stop=i,e.validationError=n},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(41)),o(r(18))},function(t,e,r){"use strict";function o(t){return P.actionWrapper({group:e.GROUP,payload:t,type:b.ActionType.OPEN})}function i(t){return P.actionWrapper({group:e.GROUP,payload:t,type:b.ActionType.CLOSE})}function n(t,r){var o=A({id:t},g);return O.clickButton(e.GROUP,o,r)}function a(t){return P.actionWrapper({payload:t,group:e.GROUP,type:b.ActionType.UPDATE})}function s(t,e){var r=t.url,o=t.path;if(!r&&!o)return!1;if(o&&!_.isValidRelativePath(o))return!1;if(r){if(!e)return!1;if(!_.isValidAbsolutePath(r))return!1;var i=void 0;try{i=new URL(e).hostname}catch(t){return!1}if(!h.isSafe(r,{requireAbsolute:!0,requireSSL:!0,whitelist:[i]}))return!1}return!0}function u(t,e){var r;switch(t.type){case b.ActionType.OPEN:return r=t.payload,void 0===r?v.invalidPayload(t,v.Message.MISSING_PAYLOAD):r.id&&"string"!=typeof r.id?v.invalidPayload(t,v.Message.INVALID_PAYLOAD_ID):p(r,e)?void 0:v.invalidPayload(t);case b.ActionType.UPDATE:return r=t.payload,void 0===r?v.invalidPayload(t,v.Message.MISSING_PAYLOAD):"string"!=typeof r.id?v.invalidPayload(t,v.Message.INVALID_PAYLOAD_ID):p(r,e)?void 0:v.invalidPayload(t);case b.ActionType.CLOSE:if((r=t.payload)&&r.id&&"string"!=typeof r.id)return v.invalidPayload(t,v.Message.INVALID_PAYLOAD_ID);return;case b.FooterActionType.FOOTER_BUTTON_CLICK:return O.validationError(A({},t,{type:O.ActionType.CLICK}));case b.FooterActionType.FOOTER_BUTTON_UPDATE:return O.validationError(A({},t,{type:O.ActionType.UPDATE}));default:return v.invalidActionType(t)}}function p(t,e){return void 0!==t&&(!(l(t)&&("string"!=typeof e||!s(t,e)))&&((y(t)||l(t))&&c(t.footer)&&d(t.size)))}function c(t){if(void 0===t||!t.hasOwnProperty("buttons"))return!0;if(t.hasOwnProperty("buttons")&&(Array.isArray(t.buttons)||"object"!=typeof t.buttons))return!1;var e=t.buttons,r=e.secondary,o=e.primary;if(o&&!O.isValidButtonProps(o))return!1;if(r&&!Array.isArray(r))return!1;if(Array.isArray(r))for(var i=0,n=r;i<n.length;i++){var a=n[i];if(!O.isValidButtonProps(a))return!1}return!0}function d(t){if(void 0===t)return!0;var e=!1;return P.forEachInEnum(b.Size,function(r){t===r&&(e=!0)}),e}function l(t){return"string"==typeof t.url||"string"==typeof t.path}function y(t){return"string"==typeof t.message}var f=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),A=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var h=r(42),E=r(5),P=r(2),T=r(1),O=r(3),v=r(0),_=r(6),b=r(18);e.GROUP=T.Group.Modal;var g={group:e.GROUP,subgroups:["Footer"],type:T.ComponentType.Button};e.openModal=o,e.closeModal=i,e.clickFooterButton=n,e.update=a,e.isValidSrc=s,e.validationError=u,e.isValidModalProps=p,e.isValidModalFooter=c,e.isValidModalSize=d,e.isIframeModal=l,e.isMessageModal=y;var I=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.size=b.Size.Small,e}return f(e,t),Object.defineProperty(e.prototype,"footer",{get:function(){if(this.footerPrimary||this.footerSecondary)return{buttons:{primary:this.footerPrimary,secondary:this.footerSecondary}}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"footerOptions",{get:function(){if(this.footerPrimaryOptions||this.footerSecondaryOptions)return{buttons:{primary:this.footerPrimaryOptions,secondary:this.footerSecondaryOptions}}},enumerable:!0,configurable:!0}),e.prototype.close=function(){this.app.dispatch(i({id:this.id}))},e.prototype.setFooterPrimaryButton=function(t,e){var r=this,o=g.subgroups;this.footerPrimaryOptions=this.getChildButton(t,this.footerPrimaryOptions),this.footerPrimary=this.footerPrimaryOptions?E.getSingleButton(this,this.footerPrimaryOptions,o,function(t){r.updatePrimaryFooterButton(t,e)}):void 0},e.prototype.setFooterSecondaryButtons=function(t,e){var r=this,o=g.subgroups,i=t||[],n=this.footerOptions&&this.footerOptions.buttons.secondary||[];this.footerSecondaryOptions=this.getUpdatedChildActions(i,n),this.footerSecondary=this.footerSecondaryOptions?this.footerSecondaryOptions.map(function(t){return E.getSingleButton(r,t,o,function(t){r.updateSecondaryFooterButton(t,e)})}):void 0},e.prototype.getChildButton=function(t,e){var r=t?[t]:[],o=e?[e]:[],i=this.getUpdatedChildActions(r,o);return i?i[0]:void 0},e.prototype.updatePrimaryFooterButton=function(t,e){this.footer&&this.footer.buttons.primary&&P.updateActionFromPayload(this.footer.buttons.primary,O.getSafeButtonProps(t))&&e()},e.prototype.updateSecondaryFooterButton=function(t,e){if(this.footer&&this.footer.buttons&&this.footer.buttons.secondary){for(var r,o=0,i=this.footer.buttons.secondary;o<i.length;o++){var n=i[o];if(r=P.updateActionFromPayload(n,O.getSafeButtonProps(t)))break}r&&e()}},e.prototype.validateOptions=function(t){var e=A({id:this.id},t);if(!p(t,this.app.localOrigin)){var r=a(e);return v.throwError(v.ActionType.INVALID_OPTIONS,r),!1}return!0},e}(P.TwoWayActionWithChildren);e.Modal=I;var S=function(t){function r(r,o){var i=t.call(this,r,e.GROUP,e.GROUP)||this;return i.set(o,!1),i}return f(r,t),Object.defineProperty(r.prototype,"payload",{get:function(){return A({},this.options,{footer:this.footer,id:this.id})},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"options",{get:function(){return{footer:this.footerOptions,message:this.message,size:this.size,title:this.title}},enumerable:!0,configurable:!0}),r.prototype.set=function(t,e){var r=this;void 0===e&&(e=!0);var o=P.getMergedProps(this.options,t),i=o.title,n=o.footer,a=o.message,s=o.size;return this.validateOptions(o)?(this.title=i,this.message=a,this.size=s,this.setFooterPrimaryButton(n?n.buttons.primary:void 0,function(){r.dispatch(b.Action.UPDATE)}),this.setFooterSecondaryButtons(n?n.buttons.secondary:void 0,function(){r.dispatch(b.Action.UPDATE)}),e&&this.dispatch(b.Action.UPDATE),this):this},r.prototype.dispatch=function(t){switch(t){case b.Action.OPEN:this.app.dispatch(o(this.payload));break;case b.Action.CLOSE:this.close();break;case b.Action.UPDATE:this.app.dispatch(a(this.payload));break;default:v.throwError(v.ActionType.INVALID_ACTION_TYPE,P.actionWrapper({group:this.group,type:t}))}return this},r}(I);e.ModalMessage=S;var R=function(t){function r(r,o){var i=t.call(this,r,e.GROUP,e.GROUP)||this;return i.set(o,!1),i}return f(r,t),Object.defineProperty(r.prototype,"payload",{get:function(){return A({},this.options,{footer:this.footer,id:this.id})},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"options",{get:function(){return{footer:this.footerOptions,path:this.path,size:this.size,title:this.title,url:this.url}},enumerable:!0,configurable:!0}),r.prototype.set=function(t,e){var r=this;void 0===e&&(e=!0);var o=P.getMergedProps(this.options,t),i=o.title,n=o.footer,a=o.path,s=o.url,u=o.size;return this.validateOptions(o)?(this.title=i,this.url=s,this.path=a,this.size=u,this.setFooterPrimaryButton(n?n.buttons.primary:void 0,function(){r.dispatch(b.Action.UPDATE)}),this.setFooterSecondaryButtons(n?n.buttons.secondary:void 0,function(){r.dispatch(b.Action.UPDATE)}),e&&this.dispatch(b.Action.UPDATE),this):this},r.prototype.dispatch=function(t){switch(t){case b.Action.OPEN:this.app.dispatch(o(this.payload));break;case b.Action.CLOSE:this.close();break;case b.Action.UPDATE:this.app.dispatch(a(this.payload));break;default:v.throwError(v.ActionType.INVALID_ACTION_TYPE,P.actionWrapper({group:this.group,type:t}))}return this},r}(I);e.ModalIframe=R,e.create=function(t,e){return l(e)?new R(t,e):new S(t,e)}},function(t,e,r){"use strict";function o(t,e){var r=void 0===e?{}:e,o=r.whitelist,a=void 0===o?[]:o,d=r.subdomains,l=void 0===d?[]:d,y=r.matchPath,f=r.requireAbsolute,A=r.requireSSL;if(s.test(t))return!1;if(t.startsWith("/"))return!(a.length>0||l.length>0||f||A)&&(y?n(new URL(t,c),t,y):!u.test(t));var h;try{h=new URL(t)}catch(t){return!1}return!!p.includes(h.protocol)&&((!A||"https:"===h.protocol)&&(!h.username&&!h.password&&(!(y&&!n(h,t,y))&&!!i(h,a,l))))}function i(t,e,r){if(!r.every(function(t){return t.startsWith(".")}))throw new TypeError("Subdomains must begin with .");var o=t.hostname;return 0===e.length&&0===r.length||e.includes(o)||r.some(function(t){return o.endsWith(t)})}function n(t,e,r){var o=t.pathname,i=e.replace(t.origin,"").split("?")[0];return"string"==typeof r?o===r&&i===r:r.test(o)&&r.test(i)}function a(t,e,r){return o(t,r)?encodeURI(t):e}Object.defineProperty(e,"__esModule",{value:!0});var s=/\/\/\//,u=/[\/\\][\/\\]/,p=["https:","http:"],c="http://test.com";e.isSafe=o,e.makeSafe=a},function(t,e,r){"use strict";var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=o(r(44));e.validationError=i.default},function(t,e,r){"use strict";function o(t){return i.findMatchInEnum(p.ActionType,t.type)?u.validationError(t):i.findMatchInEnum(s.ActionType,t.type)?a.validationError(t):n.invalidActionType(t)}Object.defineProperty(e,"__esModule",{value:!0});var i=r(2),n=r(0),a=r(19),s=r(7),u=r(20),p=r(8);e.default=o},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(19)),o(r(7))},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(20)),o(r(8))},function(t,e,r){"use strict";function o(){return n.actionWrapper({group:a.Group.Print,type:u.ActionType.APP})}function i(t){switch(t.type){case u.ActionType.APP:return;default:return s.invalidActionType(t)}}Object.defineProperty(e,"__esModule",{value:!0});var n=r(2),a=r(1),s=r(0),u=r(21);e.app=o,e.validationError=i},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(49)),o(r(22))},function(t,e,r){"use strict";function o(t){return l.actionWrapper({payload:t,group:e.GROUP,type:f.ActionType.SELECT})}function i(t){return l.actionWrapper({payload:t,group:e.GROUP,type:f.ActionType.OPEN})}function n(t){return l.actionWrapper({payload:t,group:e.GROUP,type:f.ActionType.CLOSE})}function a(t){return l.actionWrapper({payload:t,group:e.GROUP,type:f.ActionType.UPDATE})}function s(t){return l.findMatchInEnum(f.ResourceType,t)}function u(t){var e;switch(t.type){case f.ActionType.UPDATE:case f.ActionType.OPEN:return e=t.payload,void 0!==e&&void 0!==e.id&&"string"==typeof e.id&&s(e.resourceType)?void 0:d.invalidPayload(t);case f.ActionType.SELECT:return e=t.payload,void 0!==e&&void 0!==e.id&&"string"==typeof e.id&&Array.isArray(e.selection)?void 0:d.invalidPayload(t);case f.ActionType.CLOSE:return;default:return d.invalidActionType(t)}}var p=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),c=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var d=r(0),l=r(2),y=r(1),f=r(22);e.GROUP=y.Group.ResourcePicker,e.select=o,e.open=i,e.close=n,e.update=a,e.validationError=u;var A=function(t){function r(r,o,i){var n=t.call(this,r,e.GROUP,e.GROUP)||this;if(n.selection=[],!s(i)){var a=l.actionWrapper({group:e.GROUP,payload:c({id:n.id},o,{resourceType:i})});d.throwError(d.ActionType.INVALID_OPTIONS,a)}return n.resourceType=i,n.set(o,!1),n}return p(r,t),Object.defineProperty(r.prototype,"payload",{get:function(){return c({},this.options,{id:this.id,resourceType:this.resourceType})},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"options",{get:function(){return{selectMultiple:this.selectMultiple,showHidden:this.showHidden,title:this.title}},enumerable:!0,configurable:!0}),r.prototype.set=function(t,e){void 0===e&&(e=!0);var r=l.getMergedProps(this.options,t),o=r.title,i=r.showHidden,n=r.selectMultiple;return this.title=o,this.showHidden=!1===i||!0,this.selectMultiple=!!n,e&&this.update(),this},r.prototype.dispatch=function(t,e){return t===f.Action.OPEN?this.open():t===f.Action.UPDATE?this.update():t===f.Action.CLOSE?this.close():t===f.Action.SELECT?(this.selection=e,this.app.dispatch(o({id:this.id,selection:this.selection}))):d.throwError(d.ActionType.INVALID_ACTION_TYPE,l.actionWrapper({group:this.group,type:t})),this},r.prototype.update=function(){this.app.dispatch(a(this.payload))},r.prototype.open=function(){this.app.dispatch(i(this.payload))},r.prototype.close=function(){this.app.dispatch(n({id:this.id}))},r}(l.TwoWayAction);e.ResourcePicker=A,e.create=function(t,e){var r=e.resourceType,o=e.options;return new A(t,o,r)}},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(51)),o(r(23))},function(t,e,r){"use strict";function o(t,r){var o=T.ComponentType.Button,i=y({id:t,type:o},_);return f.clickButton(e.GROUP,i,r)}function i(t,r){var o=y({id:t},b);return f.clickButton(e.GROUP,o,r)}function n(t){return P.actionWrapper({payload:t,group:e.GROUP,type:v.ActionType.UPDATE})}function a(t){return!!t&&((void 0===t.id||"string"==typeof t.id)&&s(t))}function s(t){return("string"==typeof t.title||void 0===t.title)&&u(t.buttons)&&p(t.breadcrumbs)}function u(t){if(void 0===t)return!0;if("object"!=typeof t||Array.isArray(t))return!1;var e=t.primary,r=t.secondary;if(e&&!f.isValidButtonProps(e))return!1;if(void 0!==r&&!Array.isArray(r))return!1;if(Array.isArray(r))for(var o=0,i=r;o<i.length;o++){var n=i[o];if((!A.isGroupedButtonPayload(n)||!A.isValidButtonGroupProps(n))&&(A.isGroupedButtonPayload(n)||!f.isValidButtonProps(n)))return!1}return!0}function p(t){return!(void 0!==t&&!f.isValidButtonProps(t))}function c(t){var e;switch(t.type){case v.ActionType.UPDATE:return e=t.payload,void 0===e?O.invalidPayload(t,O.Message.MISSING_PAYLOAD):"string"!=typeof e.id?O.invalidPayload(t,O.Message.INVALID_PAYLOAD_ID):a(e)?void 0:O.invalidPayload(t);case v.ButtonsActionType.BUTTON_CLICK:case v.ButtonsActionType.BREADCRUMBS_CLICK:return f.validationError(y({},t,{type:f.ActionType.CLICK}));case v.ButtonsActionType.BUTTON_UPDATE:case v.ButtonsActionType.BREADCRUMBS_UPDATE:return f.validationError(y({},t,{type:f.ActionType.UPDATE}));case v.ButtonsActionType.BUTTON_GROUP_UPDATE:return A.validationError(y({},t,{type:A.ActionType.UPDATE}));default:return O.invalidActionType(t)}}function d(t,e){return new g(t,e)}var l=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),y=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var f=r(3),A=r(4),h=r(52),E=r(5),P=r(2),T=r(1),O=r(0),v=r(23);e.GROUP=T.Group.TitleBar;var _={group:e.GROUP,subgroups:["Buttons"]},b={group:e.GROUP,subgroups:["Breadcrumbs"],type:T.ComponentType.Button};e.clickActionButton=o,e.clickBreadcrumb=i,e.update=n,e.isValidTitleBarPayload=a,e.isValidTitleBarProps=s,e.isValidTitleBarButtons=u,e.isValidTitleBarBreadcrumbs=p,e.validationError=c;var g=function(t){function r(r,o){var i=t.call(this,r,e.GROUP,e.GROUP)||this;return i.set(o),i}return l(r,t),Object.defineProperty(r.prototype,"buttons",{get:function(){if(this.primary||this.secondary)return{primary:this.primary,secondary:this.secondary}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"buttonsOptions",{get:function(){if(this.primaryOptions||this.secondaryOptions)return{primary:this.primaryOptions,secondary:this.secondaryOptions}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"options",{get:function(){return{breadcrumbs:this.breadcrumbsOption,buttons:this.buttonsOptions,title:this.title}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"payload",{get:function(){return y({},this.options,{breadcrumbs:this.breadcrumb,buttons:this.buttons,id:this.id})},enumerable:!0,configurable:!0}),r.prototype.set=function(t,e){void 0===e&&(e=!0);var r=P.getMergedProps(this.options,t),o=r.title,i=r.buttons,n=r.breadcrumbs;return this.validateOptions(r)?(this.title=o,this.setBreadcrumbs(n),this.setPrimaryButton(i?i.primary:void 0),this.setSecondaryButton(i?i.secondary:void 0),e&&this.dispatch(v.Action.UPDATE),this):this},r.prototype.dispatch=function(t){switch(t){case v.Action.UPDATE:this.app.dispatch(n(this.payload));break;default:O.throwError(O.ActionType.INVALID_ACTION_TYPE,P.actionWrapper({group:this.group,type:t}))}return this},r.prototype.getButton=function(t,e,r){return t instanceof A.ButtonGroup?h.getGroupedButton(this,t,e,r):E.getSingleButton(this,t,e,r)},r.prototype.updatePrimaryButton=function(t){this.primary&&P.updateActionFromPayload(this.primary,f.getSafeButtonProps(t))&&this.dispatch(v.Action.UPDATE)},r.prototype.updateSecondaryButtons=function(t){if(this.secondary){var e=this.secondary.find(function(e){return e.id===t.id});if(e){var r=!1;r=A.isGroupedButtonPayload(t)?P.updateActionFromPayload(e,A.getSafeButtonGroupProps(t)):P.updateActionFromPayload(e,f.getSafeButtonProps(t)),r&&this.dispatch(v.Action.UPDATE)}}},r.prototype.updateBreadcrumbButton=function(t){this.breadcrumb&&P.updateActionFromPayload(this.breadcrumb,f.getSafeButtonProps(t))&&this.dispatch(v.Action.UPDATE)},r.prototype.setPrimaryButton=function(t){this.primaryOptions=this.getChildButton(t,this.primaryOptions),this.primary=this.primaryOptions?this.getButton(this.primaryOptions,_.subgroups,this.updatePrimaryButton):void 0},r.prototype.setSecondaryButton=function(t){var e=this,r=t||[],o=this.secondaryOptions||[];this.secondaryOptions=this.getUpdatedChildActions(r,o),this.secondary=this.secondaryOptions?this.secondaryOptions.map(function(t){return e.getButton(t,_.subgroups,e.updateSecondaryButtons)}):void 0},r.prototype.setBreadcrumbs=function(t){this.breadcrumbsOption=this.getChildButton(t,this.breadcrumbsOption),this.breadcrumb=this.breadcrumbsOption?this.getButton(this.breadcrumbsOption,b.subgroups,this.updateBreadcrumbButton):void 0},r.prototype.getChildButton=function(t,e){var r=t?[t]:[],o=e?[e]:[],i=this.getUpdatedChildActions(r,o);return i?i[0]:void 0},r.prototype.validateOptions=function(t){var e=y({id:this.id},t);if(!s(t)){var r=n(e);return O.throwError(O.ActionType.INVALID_OPTIONS,r),!1}return!0},r}(P.TwoWayActionWithChildren);e.TitleBar=g,e.create=d},function(t,e,r){"use strict";function o(t,e,r,o){t.addChild(e,t.group,r);var n=e.id,a=e.label,s=e.disabled,u=e.buttons;return t.subscribeToChild(e,i.Action.UPDATE,o),{id:n,label:a,buttons:u,disabled:s}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(4);e.getGroupedButton=o}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("app-bridge",[],e):"object"==typeof exports?exports["app-bridge"]=e():t["app-bridge"]=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(o){if(r[o])return r[o].exports;var i=r[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,function(t){if(t.exports&&!t.exports.__esModule&&void 0===t.exports.default){if(t.exports.headers&&t.exports.headers.common&&t.exports.headers.common.Accept&&t.exports.adapter&&t.exports.transformRequest&&t.exports.transformResponse)return;t.exports.default=t.exports}}(i),i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,o){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=24)}([function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(28)),o(r(11))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.Button="Button",t.ButtonGroup="ButtonGroup",t.Cart="Cart",t.Error="Error",t.Flash="Flash",t.Loading="Loading",t.Modal="Modal",t.Navigation="Navigation",t.Print="Print",t.TitleBar="TitleBar",t.ResourcePicker="Resource_Picker"}(e.Group||(e.Group={}));!function(t){t.Button="Button",t.ButtonGroup="ButtonGroup"}(e.ComponentType||(e.ComponentType={}))},function(t,e,r){"use strict";function o(t){return A({},t,{version:i()})}function i(){return b.version}function n(t,e,r){var o=t.toUpperCase();if(r){var i=r.subgroups,n=r.type;i&&i.length>0&&(o+=o.length>0?g:"",i.forEach(function(t,e){o+=""+t.toUpperCase()+(e<i.length-1?g:"")})),n!==t&&n&&(o+=""+(o.length>0?g:"")+n.toUpperCase())}return o&&(o+=""+(o.length>0?g:"")+e.toUpperCase()),""+T.PREFIX+g+o}function a(t){return null===t||void 0===t||"number"==typeof t}function s(t){return null===t||void 0===t||"string"==typeof t}function p(t,e,r){void 0===r&&(r=!1),t.forEach(function(t){if(r){(0,t.updateSubscribe)(e,[])}else{(0,t.unsubscribe)()}}),r||(t.length=0)}function u(t,e){var r={};return e.forEach(function(e){t.hasOwnProperty(e)&&(r[e]=t[e])}),r}function c(t,e){return t.id===e.id&&(Object.assign(t,d(t,e)),!0)}function d(t,e){var r=O.default(t,e);if(!r){return Object.assign(t,e)}return r}function l(t,e){Object.keys(t).forEach(function(r){e(t[r])})}function y(t,e){var r=Object.keys(t).find(function(r){return e===t[r]});return r?t[r]:void 0}var f=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),A=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},h=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var E=r(0),P=r(9),T=r(12),O=h(r(29)),v=r(1),_=h(r(30)),b=r(31),g="::";e.actionWrapper=o,e.getVersion=i,e.getEventNameSpace=n,e.isValidOptionalNumber=a,e.isValidOptionalString=s;var I=function(){function t(t,e,r){this.subgroups=[],this.subscriptions=[],t||E.throwError(E.ActionType.INVALID_OPTIONS,"Missing required `app`"),this.id=_.default(),this.app=t,this.type=e,this.group=r,this.defaultGroup=r}return Object.defineProperty(t.prototype,"component",{get:function(){return{id:this.id,subgroups:this.subgroups,type:this.type}},enumerable:!0,configurable:!0}),t.prototype.updateSubscription=function(t,e,r){var o,i=t.eventType,n=t.callback,a=t.component;return o=this.subscriptions.findIndex(function(e){return e===t}),o>=0?this.subscriptions[o].unsubscribe():o=void 0,this.group=e,this.subgroups=r,Object.assign(a,{subgroups:this.subgroups}),this.subscribe(i,n,a,o)},t.prototype.error=function(t){var e=this,r=[];return l(E.Action,function(o){r.push(e.subscriptions.length),e.subscribe(o,t)}),function(){r.map(function(t){return e.subscriptions[t]}).forEach(function(t){P.removeFromCollection(e.subscriptions,t,function(t){t.unsubscribe()})})}},t.prototype.subscribe=function(t,e,r,o){var i,a=this,s=r||this.component,p=t.toUpperCase(),u="number"==typeof o?e:e.bind(this);i=E.isErrorEventName(t)?n(v.Group.Error,t,A({},s,{type:""})):n(this.group,t,s);var c=this.app.subscribe(i,u,r?r.id:this.id),d={eventType:p,unsubscribe:c,callback:u,component:s,updateSubscribe:function(t,e){return a.updateSubscription.call(a,d,t,e)}};return"number"==typeof o&&o>=0&&o<this.subscriptions.length?this.subscriptions[o]=d:this.subscriptions.push(d),c},t.prototype.unsubscribe=function(t){return void 0===t&&(t=!1),p(this.subscriptions,this.defaultGroup,t),this},t}();e.TwoWayAction=I;var S=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.children=[],e}return f(e,t),e.prototype.unsubscribe=function(t,r){return void 0===t&&(t=!0),void 0===r&&(r=!1),p(this.subscriptions,this.defaultGroup,r),this.children.forEach(function(r){e.prototype.isPrototypeOf(r)?r.unsubscribe(t,!t):r.unsubscribe(!t)}),this},e.prototype.getChild=function(t){var e=this.children.findIndex(function(e){return e.id===t});return e>=0?this.children[e]:void 0},e.prototype.getChildIndex=function(t){return this.children.findIndex(function(e){return e.id===t})},e.prototype.getChildSubscriptions=function(t,e){return this.subscriptions.filter(function(r){return r.component.id===t&&(!e||e===r.eventType)})},e.prototype.addChild=function(t,r,o){var i=this,n=t.subscriptions;return this.getChild(t.id)||this.children.push(t),!n||r===t.group&&o===t.subgroups?this:(n.forEach(function(t){(0,t.updateSubscribe)(r,o)}),Object.assign(t,{group:r,subgroups:o}),e.prototype.isPrototypeOf(t)&&t.children.forEach(function(t){return i.addChild(t,r,o)}),this)},e.prototype.removeChild=function(t){var e=this;return P.removeFromCollection(this.children,this.getChild(t),function(){e.subscriptions.filter(function(e){return e.component.id===t}).forEach(function(t){P.removeFromCollection(e.subscriptions,t,function(t){t.unsubscribe()})})}),this},e.prototype.subscribeToChild=function(t,e,r){var o=this,i=r.bind(this);if(e instanceof Array)return e.forEach(function(e){return o.subscribeToChild(t,e,r)}),this;if("string"!=typeof e)return this;var n=e.toUpperCase(),a=this.getChildSubscriptions(t.id,n);if(a.length>0)a.forEach(function(e){return e.updateSubscribe(o.group,t.subgroups)});else{var s={id:t.id,subgroups:t.subgroups,type:t.type};this.subscribe(n,i,s)}return this},e.prototype.getUpdatedChildActions=function(t,e){if(0!==t.length){for(var r=t.filter(function(t,e,r){return e===r.indexOf(t)}),o=r.map(function(t){return t.id}),i=e.filter(function(t){return o.indexOf(t.id)<0});i.length>0;){var n=i.pop();if(!n)break;this.removeChild(n.id)}return r}for(;e.length>0;){var n=e.pop();if(!n)break;this.removeChild(n.id)}},e}(I);e.TwoWayActionWithChildren=S,e.sanitizeProps=u,e.updateActionFromPayload=c,e.getMergedProps=d,e.forEachInEnum=l,e.findMatchInEnum=y},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(32)),o(r(13))},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(33)),o(r(14))},function(t,e,r){"use strict";function o(t,e,r,o){t.addChild(e,t.group,r);var n=e.id,a=e.label,s=e.primary,p=e.disabled,u={disabled:p,id:n,label:a,primary:s};return t.subscribeToChild(e,i.Action.UPDATE,o),u}Object.defineProperty(e,"__esModule",{value:!0});var i=r(3);e.getSingleButton=o},function(t,e,r){"use strict";function o(t){return"string"==typeof t&&(""===t||"/"===t.charAt(0))}function i(t){return"string"==typeof t&&t.match("^https?://")}Object.defineProperty(e,"__esModule",{value:!0}),e.isValidRelativePath=o,e.isValidAbsolutePath=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.PUSH="APP::HISTORY::PUSH",t.REPLACE="APP::HISTORY::REPLACE"}(e.ActionType||(e.ActionType={}));!function(t){t.PUSH="PUSH",t.REPLACE="REPLACE"}(e.Action||(e.Action={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.ADMIN_PATH="ADMIN::PATH",t.ADMIN_SECTION="ADMIN::SECTION",t.REMOTE="REMOTE",t.APP="APP"}(e.Action||(e.Action={}));!function(t){t.ADMIN_SECTION="APP::REDIRECT::ADMIN::SECTION",t.ADMIN_PATH="APP::REDIRECT::ADMIN::PATH",t.REMOTE="APP::REDIRECT::REMOTE",t.APP="APP::REDIRECT::APP"}(e.ActionType||(e.ActionType={}));!function(t){t.Product="products",t.Collection="collections",t.Order="orders",t.Customer="customers",t.Discount="discounts"}(e.ResourceType||(e.ResourceType={}))},function(t,e,r){"use strict";function o(t,e,r){return t.push(e),function(){return i(t,e,r)}}function i(t,e,r){var o=t.findIndex(function(t){return t===e});return o>=0&&(t.splice(o,1),r&&r(e),!0)}Object.defineProperty(e,"__esModule",{value:!0}),e.addAndRemoveFromCollection=o,e.removeFromCollection=i},function(t,e,r){"use strict";function o(t){return t instanceof Object&&t.hasOwnProperty("type")&&t.type.toString().startsWith(d.PREFIX)}function i(t){return"object"==typeof t&&"object"==typeof t.source&&"string"==typeof t.source.apiKey}function n(t){if("object"!=typeof t||!t.data||"object"!=typeof t.data)return!1;var e=t.data;return e.hasOwnProperty("type")&&("getState"===e.type||"dispatch"===e.type)}function a(t,e){switch(t.group){case u.Group.Button:return u.Button.validationError(t)||t;case u.Group.ButtonGroup:return u.ButtonGroup.validationError(t)||t;case u.Group.Cart:return u.Cart.validationError(t)||t;case u.Group.Flash:return u.Flash.validationError(t)||t;case u.Group.Modal:return u.Modal.validationError(t,e)||t;case u.Group.TitleBar:return u.TitleBar.validationError(t)||t;case u.Group.Navigation:return u.Navigation.validationError(t)||t;case u.Group.Error:return t;case u.Group.Print:return u.Print.validationError(t)||t;case u.Group.Loading:return u.Loading.validationError(t)||t;case u.Group.ResourcePicker:return u.ResourcePicker.validationError(t)||t;default:return c.invalidAction(t,"Unknown or unsupported action group")}}function s(t,e){if(!o(t))return t;for(var r=0,i=l;r<i.length;r++){var n=i[r];if(!t.hasOwnProperty(n)||"string"!=typeof t[n])return c.invalidAction(t,"Missing or invalid "+n)}return a(t,e)}var p=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var u=p(r(24)),c=r(0),d=r(12),l=["group","type","version"];e.isAppBridgeAction=o,e.isFromApp=i,e.isAppMessage=n,e.validatedActionPayload=a,e.validatedAction=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.INVALID_ACTION="INVALID_ACTION",t.INVALID_ACTION_TYPE="INVALID_ACTION_TYPE",t.INVALID_OPTIONS="INVALID_OPTIONS",t.INVALID_PAYLOAD="INVALID_PAYLOAD",t.UNEXPECTED_ACTION="UNEXPECTED_ACTION",t.PERSISTENCE="PERSISTENCE",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK="NETWORK"}(e.Action||(e.Action={}));!function(t){t.INVALID_ACTION="APP::ERROR::INVALID_ACTION",t.INVALID_ACTION_TYPE="APP::ERROR::INVALID_ACTION_TYPE",t.INVALID_PAYLOAD="APP::ERROR::INVALID_PAYLOAD",t.INVALID_OPTIONS="APP::ERROR::INVALID_OPTIONS",t.UNEXPECTED_ACTION="APP::ERROR::UNEXPECTED_ACTION",t.PERSISTENCE="APP::ERROR::PERSISTENCE",t.UNSUPPORTED_OPERATION="APP::ERROR::UNSUPPORTED_OPERATION",t.NETWORK="APP::ERROR::NETWORK"}(e.ActionType||(e.ActionType={}));!function(t){t.INVALID_CONFIG="APP::ERROR:INVALID_CONFIG",t.MISSING_CONFIG="APP::APP_ERROR::MISSING_CONFIG",t.MISSING_APP_BRIDGE_MIDDLEWARE="APP::APP_ERROR::MISSING_APP_BRIDGE_MIDDLEWARE"}(e.AppActionType||(e.AppActionType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PREFIX="APP"},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.CLICK="CLICK",t.UPDATE="UPDATE"}(e.Action||(e.Action={}));!function(t){t.CLICK="APP::BUTTON::CLICK",t.UPDATE="APP::BUTTON::UPDATE"}(e.ActionType||(e.ActionType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.UPDATE="UPDATE"}(e.Action||(e.Action={}));!function(t){t.UPDATE="APP::BUTTON::UPDATE"}(e.ActionType||(e.ActionType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.FETCH="APP::CART::FETCH",t.UPDATE="APP::CART::UPDATE",t.SET_CUSTOMER="APP::CART::SET_CUSTOMER",t.REMOVE_CUSTOMER="APP::CART::REMOVE_CUSTOMER",t.ADD_CUSTOMER_ADDRESS="APP::CART::ADD_CUSTOMER_ADDRESS",t.UPDATE_CUSTOMER_ADDRESS="APP::CART::UPDATE_CUSTOMER_ADDRESS",t.SET_DISCOUNT="APP::CART::SET_DISCOUNT",t.REMOVE_DISCOUNT="APP::CART::REMOVE_DISCOUNT",t.SET_PROPERTIES="APP::CART::SET_PROPERTIES",t.REMOVE_PROPERTIES="APP::CART::REMOVE_PROPERTIES",t.CLEAR="APP::CART::CLEAR",t.ADD_LINE_ITEM="APP::CART::ADD_LINE_ITEM",t.UPDATE_LINE_ITEM="APP::CART::UPDATE_LINE_ITEM",t.REMOVE_LINE_ITEM="APP::CART::REMOVE_LINE_ITEM",t.SET_LINE_ITEM_DISCOUNT="APP::CART::SET_LINE_ITEM_DISCOUNT",t.REMOVE_LINE_ITEM_DISCOUNT="APP::CART::REMOVE_LINE_ITEM_DISCOUNT",t.SET_LINE_ITEM_PROPERTIES="APP::CART::SET_LINE_ITEM_PROPERTIES",t.REMOVE_LINE_ITEM_PROPERTIES="APP::CART::REMOVE_LINE_ITEM_PROPERTIES"}(e.ActionType||(e.ActionType={}));!function(t){t.FETCH="FETCH",t.UPDATE="UPDATE",t.SET_CUSTOMER="SET_CUSTOMER",t.REMOVE_CUSTOMER="REMOVE_CUSTOMER",t.ADD_CUSTOMER_ADDRESS="ADD_CUSTOMER_ADDRESS",t.UPDATE_CUSTOMER_ADDRESS="UPDATE_CUSTOMER_ADDRESS",t.SET_DISCOUNT="SET_DISCOUNT",t.REMOVE_DISCOUNT="REMOVE_DISCOUNT",t.SET_PROPERTIES="SET_PROPERTIES",t.REMOVE_PROPERTIES="REMOVE_PROPERTIES",t.CLEAR="CLEAR",t.ADD_LINE_ITEM="ADD_LINE_ITEM",t.UPDATE_LINE_ITEM="UPDATE_LINE_ITEM",t.REMOVE_LINE_ITEM="REMOVE_LINE_ITEM",t.SET_LINE_ITEM_DISCOUNT="SET_LINE_ITEM_DISCOUNT",t.REMOVE_LINE_ITEM_DISCOUNT="REMOVE_LINE_ITEM_DISCOUNT",t.SET_LINE_ITEM_PROPERTIES="SET_LINE_ITEM_PROPERTIES",t.REMOVE_LINE_ITEM_PROPERTIES="REMOVE_LINE_ITEM_PROPERTIES"}(e.Action||(e.Action={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.SHOW="APP::FLASH::SHOW",t.CLEAR="APP::FLASH::CLEAR"}(e.ActionType||(e.ActionType={}));!function(t){t.SHOW="SHOW",t.CLEAR="CLEAR"}(e.Action||(e.Action={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.START="APP::LOADING::START",t.STOP="APP::LOADING::STOP"}(e.ActionType||(e.ActionType={}));!function(t){t.START="START",t.STOP="STOP"}(e.Action||(e.Action={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.OPEN="OPEN",t.CLOSE="CLOSE",t.UPDATE="UPDATE"}(e.Action||(e.Action={}));!function(t){t.OPEN="APP::MODAL::OPEN",t.CLOSE="APP::MODAL::CLOSE",t.UPDATE="APP::MODAL::UPDATE"}(e.ActionType||(e.ActionType={}));!function(t){t.FOOTER_BUTTON_CLICK="APP::MODAL::FOOTER::BUTTON::CLICK",t.FOOTER_BUTTON_UPDATE="APP::MODAL::FOOTER::BUTTON::UPDATE"}(e.FooterActionType||(e.FooterActionType={}));!function(t){t.Small="small",t.Medium="medium",t.Large="large",t.Full="full"}(e.Size||(e.Size={}))},function(t,e,r){"use strict";function o(t){return a.actionWrapper({payload:t,group:s.Group.Navigation,type:c.ActionType.PUSH})}function i(t){return a.actionWrapper({payload:t,group:s.Group.Navigation,type:c.ActionType.REPLACE})}function n(t){var e;switch(t.type){case c.ActionType.REPLACE:case c.ActionType.PUSH:return e=t.payload,void 0===e?p.invalidPayload(t,p.Message.MISSING_PAYLOAD):u.isValidAbsolutePath(e.path)||u.isValidRelativePath(e.path)?void 0:p.invalidPayload(t,"Invalid path provided. Expected a relative or absolute https or http path");default:return p.invalidActionType(t)}}Object.defineProperty(e,"__esModule",{value:!0});var a=r(2),s=r(1),p=r(0),u=r(6),c=r(7);e.push=o,e.replace=i,e.validationError=n},function(t,e,r){"use strict";function o(t){return"string"==typeof t.id}function i(t){return!0===t.create}function n(t){var e=t;return void 0!==e.id&&void 0!==e.variant}function a(t){return!!n(t)&&i(t.variant)}function s(t){return y.actionWrapper({payload:t,group:e.GROUP,type:E.ActionType.ADMIN_PATH})}function p(t){return y.actionWrapper({payload:t,group:e.GROUP,type:E.ActionType.ADMIN_SECTION})}function u(t){return y.actionWrapper({payload:t,group:e.GROUP,type:E.ActionType.REMOTE})}function c(t){return y.actionWrapper({payload:t,group:e.GROUP,type:E.ActionType.APP})}function d(t){if(void 0===t)return!1;var e=t.name,r=t.resource;if(!e)return!1;var s=!1;return y.forEachInEnum(E.ResourceType,function(t){e===t&&(s=!0)}),!!s&&(void 0===r||n(r)||a(r)||i(r)||o(r))}function l(t){var e;switch(t.type){case E.ActionType.ADMIN_PATH:return e=t.payload,void 0===e?A.invalidPayload(t,A.Message.MISSING_PAYLOAD):h.isValidRelativePath(e.path)?void 0:A.invalidPayload(t,"Path is invalid. Expecting relative path");case E.ActionType.REMOTE:return e=t.payload,void 0===e?A.invalidPayload(t,A.Message.MISSING_PAYLOAD):h.isValidAbsolutePath(e.url)?void 0:A.invalidPayload(t,"Url is invalid. Expecting absolute url");case E.ActionType.APP:return e=t.payload,void 0===e?A.invalidPayload(t,A.Message.MISSING_PAYLOAD):h.isValidRelativePath(e.path)?void 0:A.invalidPayload(t,"Path is invalid. Expecting relative path");case E.ActionType.ADMIN_SECTION:return e=t.payload,void 0===e?A.invalidPayload(t,A.Message.MISSING_PAYLOAD):d(e.section)?void 0:A.invalidPayload(t,"Invalid admin section resource");default:return A.invalidActionType(t)}}Object.defineProperty(e,"__esModule",{value:!0});var y=r(2),f=r(1),A=r(0),h=r(6),E=r(8);e.GROUP=f.Group.Navigation,e.isResourcePayload=o,e.isCreateResourcePayload=i,e.isProductVariantResourcePayload=n,e.isProductVariantCreateResourcePayload=a,e.toAdminPath=s,e.toAdminSection=p,e.toRemote=u,e.toApp=c,e.isValidAdminResource=d,e.validationError=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.APP="APP::PRINT::APP"}(e.ActionType||(e.ActionType={}));!function(t){t.APP="APP"}(e.Action||(e.Action={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.OPEN="OPEN",t.SELECT="SELECT",t.CLOSE="CLOSE",t.UPDATE="UPDATE"}(e.Action||(e.Action={}));!function(t){t.OPEN="APP::RESOURCE_PICKER::OPEN",t.SELECT="APP::RESOURCE_PICKER::SELECT",t.CLOSE="APP::RESOURCE_PICKER::CLOSE",t.UPDATE="APP::RESOURCE_PICKER::UPDATE"}(e.ActionType||(e.ActionType={}));!function(t){t.Product="product",t.Collection="collection"}(e.ResourceType||(e.ResourceType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t.UPDATE="UPDATE"}(e.Action||(e.Action={}));!function(t){t.UPDATE="APP::TITLEBAR::UPDATE"}(e.ActionType||(e.ActionType={}));!function(t){t.BUTTON_CLICK="APP::TITLEBAR::BUTTONS::BUTTON::CLICK",t.BUTTON_UPDATE="APP::TITLEBAR::BUTTONS::BUTTON::UPDATE",t.BUTTON_GROUP_UPDATE="APP::TITLEBAR::BUTTONS::BUTTONGROUP::UPDATE",t.BREADCRUMBS_CLICK="APP::TITLEBAR::BREADCRUMBS::BUTTON::CLICK",t.BREADCRUMBS_UPDATE="APP::TITLEBAR::BREADCRUMBS::BUTTON::UPDATE"}(e.ButtonsActionType||(e.ButtonsActionType={}))},function(t,e,r){"use strict";var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(r(1));var i=o(r(3));e.Button=i;var n=o(r(4));e.ButtonGroup=n;var a=o(r(34));e.Cart=a;var s=o(r(0));e.Error=s;var p=o(r(36));e.Flash=p;var u=o(r(38));e.Loading=u;var c=o(r(40));e.Modal=c;var d=o(r(43));e.Navigation=d;var l=o(r(45));e.History=l;var y=o(r(46));e.Redirect=y;var f=o(r(25));e.Print=f;var A=o(r(48));e.ResourcePicker=A;var h=o(r(50));e.TitleBar=h;var E=r(10);e.isAppBridgeAction=E.isAppBridgeAction},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(47)),o(r(21))},,,function(t,e,r){"use strict";function o(t,e){var r=t.payload;return c.actionWrapper({group:d.Group.Error,payload:{action:t,id:r&&r.id?r.id:void 0,message:e||"The action's payload is missing required properties or has invalid properties",type:l.ActionType.INVALID_PAYLOAD},type:l.ActionType.INVALID_PAYLOAD})}function i(t,e){return c.actionWrapper({group:d.Group.Error,payload:{action:t,message:e||"The action type is invalid or unsupported",type:l.ActionType.INVALID_ACTION_TYPE},type:l.ActionType.INVALID_ACTION_TYPE})}function n(t,e){return c.actionWrapper({group:d.Group.Error,payload:{action:t,message:e||"The action's has missing/invalid values for `group`, `type` or `version`",type:l.ActionType.INVALID_ACTION},type:l.ActionType.INVALID_ACTION})}function a(t,e){return c.actionWrapper({group:d.Group.Error,payload:{action:t,message:e||"Action cannot be called at this time",type:l.ActionType.UNEXPECTED_ACTION},type:l.ActionType.UNEXPECTED_ACTION})}function s(t){return"string"==typeof c.findMatchInEnum(l.Action,t)}function p(t,e,r){var o=t?e+": "+t:e,i=new y(o);return i.action=r,i.type=e,i}function u(){var t,e,r=arguments[0];throw"string"==typeof arguments[1]?t=arguments[1]:(e=arguments[1],t=arguments[2]||""),p(t,r,e)}Object.defineProperty(e,"__esModule",{value:!0});var c=r(2),d=r(1),l=r(11);!function(t){t.MISSING_PAYLOAD="Missing payload",t.INVALID_PAYLOAD_ID="Id in payload is missing or invalid"}(e.Message||(e.Message={})),e.invalidPayload=o,e.invalidActionType=i,e.invalidAction=n,e.unexpectedAction=a,e.isErrorEventName=s;var y=function(){function t(t){this.name="AppBridgeError",this.message=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(this.message).stack}return t}();e.AppBridgeError=y,y.prototype=Object.create(Error.prototype),e.fromAction=p,e.throwError=u},function(t,e,r){"use strict";function o(t,e){if(void 0!==e){if(!Object.getPrototypeOf(t).isPrototypeOf(e))return e;var r={};return Object.keys(e).forEach(function(i){t.hasOwnProperty(i)?"object"!=typeof t[i]||Array.isArray(t[i])?r[i]=e[i]:r[i]=o(t[i],e[i]):r[i]=e[i]}),Object.keys(t).forEach(function(o){e.hasOwnProperty(o)||(r[o]=t[o])}),Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=o},function(t,e,r){"use strict";function o(t){return Array.from(t).map(function(t){return("00"+t.toString(16)).slice(-2)}).join("")}function i(t){if("function"==typeof Uint8Array&&window.crypto){var e=new Uint8Array(t),r=window.crypto.getRandomValues(e);if(r)return r}return Array.from(new Array(t),function(){return 255*Math.random()|0})}function n(){var t=i(1),e=i(2);return t[0]&=191,e[0]&=79,[o(i(4)),"-",o(i(2)),"-",o(e),"-",o(t),o(i(1)),"-",o(i(6))].join("")}Object.defineProperty(e,"__esModule",{value:!0}),e.generateUuid=n,e.default=n},function(t,e){t.exports={name:"@shopify/app-bridge",version:"0.1.2",types:"index.d.ts",main:"index.js",files:["actions.js","actions.js.map","actions/","client/","index.d.ts","index.js","index.js.map","host.js","host.js.map","host/","types/*","util/"],private:!1,publishConfig:{access:"public","@shopify:registry":"https://registry.npmjs.org"},repository:"git@github.com:Shopify/app-bridge.git",author:"Shopify Inc.",license:"MIT",scripts:{build:"NODE_ENV=production webpack -p && tsc --project ./tsconfig.build.json --emitDeclarationOnly && echo \"/**\n * @module client\n */\n\nimport createClientApp from './client';\nexport * from './client';\nexport default createClientApp;\n\" > index.d.ts","build:docs":"typedoc src/actions --out docs/actions -name app-bridge/actions && typedoc src/host -name app-bridge/host --out docs/host && typedoc src/client -name app-bridge/client --out docs/client",check:"tsc -p ./tsconfig.json --pretty --noEmit",clean:"rm -rf ./**/*.d.ts ./actions* ./client* ./host* ./index* ./util",lint:"tslint -c ./tslint.json -p ./tsconfig.json -t codeFrame",prepublishOnly:"yarn run clean && yarn run build",start:"webpack-dev-server","start:prodShop":"API_KEY=eff9519f64b4108b99ff551aba8d9344 webpack-dev-server",test:"jest 'src'","test:CI":"CI=true yarn test:coverage","test:coverage":"yarn test --coverage --outputFile=coverage --maxWorkers 2","test:watch":"yarn test --watch",watch:"webpack --progress --watch"},devDependencies:{"@shopify/shopify-express":"^1.0.0-alpha.7","@types/enzyme":"^2.8.12","@types/jest":"^22.2.0","@types/react":"^16.0.40","@types/react-dom":"^16.0.3","@types/react-hot-loader":"^3.0.4","@types/react-redux":"^5.0.9","@types/react-router-dom":"^4.0.8","@types/react-router-redux":"^5.0.8","@types/react-test-renderer":"15.5.4","@types/react-transition-group":"^2.0.6","@types/webpack-env":"^1.13.1","awesome-typescript-loader":"^3.4.1","babel-plugin-system-import-transformer":"^3.1.0","css-loader":"^0.28.7",enzyme:"3.3.0","enzyme-adapter-react-15":"^1.0.5","express-session":"^1.15.6","hoist-non-react-statics":"^2.5.0","html-webpack-plugin":"^2.30.1",jest:"22.4.2","postcss-shopify":"^1.0.0",prettier:"1.12.0",react:"^15.5.4","react-dom":"^15.5.4","react-redux":"^5.0.6","react-test-renderer":"15.5.4","react-transition-group":"^2.2.1",redux:"^3.7.2","redux-devtools-extension":"^2.13.2","style-loader":"^0.19.0","ts-jest":"^22.4.1",tslint:"^5.9.1","tslint-config-shopify":"^3.0.1",typedoc:"^0.10.0","typedoc-plugin-external-module-name":"^1.1.1","typedoc-plugin-markdown":"^1.0.14",typescript:"2.8.1",webpack:"^3.10.0","webpack-dev-server":"^2.9.5","webpack-fix-default-import-plugin":"^1.0.3"},prettier:{bracketSpacing:!1,printWidth:100,singleQuote:!0,trailingComma:"all"},jest:{globals:{"ts-jest":{babelConfig:{plugins:["babel-plugin-system-import-transformer"],sourceMaps:"inline"}}},setupTestFrameworkScriptFile:"./test/setup.js",testRegex:".*\\.test\\.tsx?$",testURL:"https://app-bridge.myshopify.io/",transform:{".tsx?$":"<rootDir>/../../node_modules/ts-jest/preprocessor.js"},moduleFileExtensions:["js","jsx","json","ts","tsx"],collectCoverageFrom:["src/**/*.{js,jsx,ts,tsx}","!**/node_modules/**","!**/index.{ts,tsx}","!**/types.ts"],moduleDirectories:["<rootDir>/node_modules","./node_modules","./src"],moduleNameMapper:{"app-bridge/info":"<rootDir>/package.json"}}}},function(t,e,r){"use strict";function o(t){return d.sanitizeProps(t,["label","primary","disabled","id"])}function i(t,e,r){var o=e.id,i=d.getEventNameSpace(t,f.Action.CLICK,e),n={id:o,payload:r};return d.actionWrapper({type:i,group:t,payload:n})}function n(t,e,r){var i=e.id,n=r.label,a=d.getEventNameSpace(t,f.Action.UPDATE,e),s=c({id:i,label:n},o(r));return d.actionWrapper({type:a,group:t,payload:s})}function a(t){if(!t.hasOwnProperty("payload"))return y.invalidPayload(t,y.Message.MISSING_PAYLOAD);var e;switch(t.type){case f.ActionType.CLICK:return e=t.payload,"string"==typeof e.id?void 0:y.invalidPayload(t,y.Message.INVALID_PAYLOAD_ID);case f.ActionType.UPDATE:return e=t.payload,s(e)?void 0:y.invalidPayload(t);default:return y.invalidActionType(t)}}function s(t){return"string"==typeof t.id&&"string"==typeof t.label}function p(t,e){return new A(t,e)}var u=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),c=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var d=r(2),l=r(1),y=r(0),f=r(13);e.getSafeButtonProps=o,e.clickButton=i,e.update=n,e.validationError=a,e.isValidButtonProps=s;var A=function(t){function e(e,r){var o=t.call(this,e,l.ComponentType.Button,l.Group.Button)||this;return o.primary=!1,o.disabled=!1,o.set(r,!1),o}return u(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{disabled:this.disabled,label:this.label,primary:this.primary}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return c({id:this.id},this.options)},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var r=d.getMergedProps(this.options,t),o=r.label,i=r.primary,n=r.disabled;return this.validateOptions(r)?(this.label=o,this.primary=!!i,this.disabled=!!n,e&&this.dispatch(f.Action.UPDATE),this):this},e.prototype.dispatch=function(t,e){switch(t){case f.Action.CLICK:this.app.dispatch(i(this.group,this.component,e));break;case f.Action.UPDATE:var r=n(this.group,this.component,this.payload);this.app.dispatch(r);break;default:y.throwError(y.ActionType.INVALID_ACTION_TYPE,d.actionWrapper({payload:e,group:this.group,type:t}))}return this},e.prototype.validateOptions=function(t){var e=c({id:this.id},t);if(!s(e)){var r=n(this.group,this.component,e);return y.throwError(y.ActionType.INVALID_OPTIONS,r),!1}return!0},e}(d.TwoWayAction);e.Button=A,e.create=p},function(t,e,r){"use strict";function o(t,e,r){return c(t,e,P.Action.UPDATE,r)}function i(t){var e=t;return e.buttons&&e.buttons.length>0&&void 0!==e.label}function n(t){var e=t;return Array.isArray(e.buttons)&&"string"==typeof e.id&&"string"==typeof e.label}function a(t){return f.sanitizeProps(t,["label","disabled","buttons","id"])}function s(t){if(!t.hasOwnProperty("payload"))return E.invalidPayload(t,E.Message.MISSING_PAYLOAD);switch(t.type){case P.ActionType.UPDATE:return p(t.payload)?void 0:E.invalidPayload(t);default:return E.invalidActionType(t)}}function p(t){if("string"!=typeof t.id||"string"!=typeof t.label||!Array.isArray(t.buttons))return!1;for(var e=0,r=t.buttons;e<r.length;e++){var o=r[e];if(!h.isValidButtonProps(o))return!1}return!0}function u(t,e){return new T(t,e)}function c(t,e,r,o,i){var n=e.id,s=o.label,p=f.getEventNameSpace(t,r,e),u=l({id:n,label:s},a(o),{payload:i});return f.actionWrapper({type:p,group:t,payload:u})}var d=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),l=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var y=r(5),f=r(2),A=r(1),h=r(3),E=r(0),P=r(14);e.update=o,e.isGroupedButton=i,e.isGroupedButtonPayload=n,e.getSafeButtonGroupProps=a,e.validationError=s,e.isValidButtonGroupProps=p;var T=function(t){function e(e,r){var o=t.call(this,e,A.ComponentType.ButtonGroup,A.Group.ButtonGroup)||this;return o.disabled=!1,o.buttonsOptions=[],o.buttons=[],o.set(r,!1),o}return d(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{buttons:this.buttonsOptions,disabled:this.disabled,label:this.label}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return l({},this.options,{buttons:this.buttons,id:this.id})},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var r=f.getMergedProps(this.options,t),o=r.label,i=r.disabled,n=r.buttons;return this.validateOptions(r)?(this.label=o,this.disabled=!!i,this.buttons=this.getButtons(n),e&&this.dispatch(P.Action.UPDATE),this):this},e.prototype.dispatch=function(t){switch(t){case P.Action.UPDATE:var e=o(this.group,this.component,this.payload);this.app.dispatch(e);break;default:E.throwError(E.ActionType.INVALID_ACTION_TYPE,f.actionWrapper({group:this.group,type:t}))}return this},e.prototype.updateButtons=function(t){if(this.buttons&&0!==this.buttons.length){for(var e,r=0,o=this.buttons;r<o.length;r++){var i=o[r];if(e=f.updateActionFromPayload(i,h.getSafeButtonProps(t)))break}e&&this.dispatch(P.Action.UPDATE)}},e.prototype.getSingleButton=function(t){return y.getSingleButton(this,t,this.subgroups,this.updateButtons)},e.prototype.getButtons=function(t){var e=this,r=[];return t?(t.forEach(function(t){var o=y.getSingleButton(e,t,e.subgroups,e.updateButtons);r.push(o)}),this.buttonsOptions=t,r):[]},e.prototype.validateOptions=function(t){var e=l({id:this.id},t);if(!p(e)){var r=o(this.group,this.component,e);return E.throwError(E.ActionType.INVALID_OPTIONS,r),!1}return!0},e}(f.TwoWayActionWithChildren);e.ButtonGroup=T,e.create=u},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(35)),o(r(15))},function(t,e,r){"use strict";function o(){return L.actionWrapper({group:B.Group.Cart,type:V.ActionType.FETCH})}function i(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.SET_CUSTOMER})}function n(){return L.actionWrapper({group:B.Group.Cart,type:V.ActionType.REMOVE_CUSTOMER})}function a(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.ADD_CUSTOMER_ADDRESS})}function s(t,e){return L.actionWrapper({group:B.Group.Cart,payload:{data:e,index:t},type:V.ActionType.UPDATE_CUSTOMER_ADDRESS})}function p(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.SET_DISCOUNT})}function u(){return L.actionWrapper({group:B.Group.Cart,type:V.ActionType.REMOVE_DISCOUNT})}function c(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.SET_PROPERTIES})}function d(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.REMOVE_PROPERTIES})}function l(){return L.actionWrapper({group:B.Group.Cart,type:V.ActionType.CLEAR})}function y(t){return L.actionWrapper({group:B.Group.Cart,payload:{data:t},type:V.ActionType.ADD_LINE_ITEM})}function f(t,e){return L.actionWrapper({group:B.Group.Cart,payload:{data:e,index:t},type:V.ActionType.UPDATE_LINE_ITEM})}function A(t){return L.actionWrapper({group:B.Group.Cart,payload:{index:t},type:V.ActionType.REMOVE_LINE_ITEM})}function h(t,e){return L.actionWrapper({group:B.Group.Cart,payload:{data:e,index:t},type:V.ActionType.SET_LINE_ITEM_DISCOUNT})}function E(t){return L.actionWrapper({group:B.Group.Cart,payload:{index:t},type:V.ActionType.REMOVE_LINE_ITEM_DISCOUNT})}function P(t,e){return L.actionWrapper({group:B.Group.Cart,payload:{data:e,index:t},type:V.ActionType.SET_LINE_ITEM_PROPERTIES})}function T(t,e){return L.actionWrapper({group:B.Group.Cart,payload:{data:e,index:t},type:V.ActionType.REMOVE_LINE_ITEM_PROPERTIES})}function O(t){return L.isValidOptionalString(t.address1)&&L.isValidOptionalString(t.address2)&&L.isValidOptionalString(t.city)&&L.isValidOptionalString(t.company)&&L.isValidOptionalString(t.firstName)&&L.isValidOptionalString(t.lastName)&&L.isValidOptionalString(t.phone)&&L.isValidOptionalString(t.provice)&&L.isValidOptionalString(t.country)&&L.isValidOptionalString(t.zip)&&L.isValidOptionalString(t.name)&&L.isValidOptionalString(t.proviceCode)&&L.isValidOptionalString(t.countryCode)}function v(t){return!t||Array.isArray(t)&&t.every(O)}function _(t){return(void 0===t.cartDiscount||g(t.cartDiscount))&&(void 0===t.customer||b(t.customer)||v(t.customer.addresses))&&L.isValidOptionalString(t.grandTotal)&&(void 0===t.lineItems||S(t.lineItems))&&R(t.noteAttributes)&&L.isValidOptionalString(t.subTotal)&&L.isValidOptionalString(t.taxTotal)}function b(t){return L.isValidOptionalNumber(t.id)&&L.isValidOptionalString(t.email)&&L.isValidOptionalString(t.firstName)&&L.isValidOptionalString(t.lastName)&&L.isValidOptionalString(t.note)}function g(t){return L.isValidOptionalNumber(t.amount)&&L.isValidOptionalString(t.discountDescription)&&L.isValidOptionalString(t.type)}function I(t){return L.isValidOptionalNumber(t.price)&&"number"==typeof t.quantity&&L.isValidOptionalString(t.title)&&L.isValidOptionalNumber(t.variantId)}function S(t){return!t||Array.isArray(t)&&t.every(I)}function R(t){return void 0===t||Array.isArray(t)&&t.every(function(t){return"string"==typeof t.name&&"string"==typeof t.value})}function m(t){return"object"==typeof t&&!Array.isArray(t)&&Object.keys(t).every(function(e){return"string"==typeof t[e]})}function C(t){return Array.isArray(t)&&t.every(function(t){return"string"==typeof t})}function D(t){if(!t.payload||"string"!=typeof t.payload.id)return j.invalidPayload(t,"Missing payload id");var e;switch(t.type){case V.ActionType.FETCH:return;case V.ActionType.UPDATE:return e=t.payload,e.data&&_(e.data)?void 0:j.invalidPayload(t,"Invalid update payload");case V.ActionType.SET_CUSTOMER:return e=t.payload,e.data&&b(e.data)?void 0:j.invalidPayload(t,"Invalid set customer payload");case V.ActionType.REMOVE_CUSTOMER:return;case V.ActionType.ADD_CUSTOMER_ADDRESS:return e=t.payload,e.data&&O(e.data)?void 0:j.invalidPayload(t,"Invalid add customer address payload");case V.ActionType.UPDATE_CUSTOMER_ADDRESS:return e=t.payload,e.data&&"number"==typeof e.index&&O(e.data)?void 0:j.invalidPayload(t,"Invalid update customer address payload");case V.ActionType.SET_DISCOUNT:return e=t.payload,e.data&&g(e.data)?void 0:j.invalidPayload(t,"Invalid set discount payload");case V.ActionType.REMOVE_DISCOUNT:return;case V.ActionType.SET_PROPERTIES:return e=t.payload,e.data&&m(e.data)?void 0:j.invalidPayload(t,"Invalid add properties payload");case V.ActionType.REMOVE_PROPERTIES:return e=t.payload,e.data&&C(e.data)?void 0:j.invalidPayload(t,"Invalid remove properties payload");case V.ActionType.CLEAR:return;case V.ActionType.ADD_LINE_ITEM:return e=t.payload,e.data&&I(e.data)?void 0:j.invalidPayload(t,"Invalid add line item payload");case V.ActionType.UPDATE_LINE_ITEM:return e=t.payload,e.data&&"number"==typeof e.index&&"number"==typeof e.data.quantity?void 0:j.invalidPayload(t,"Invalid update line item payload");case V.ActionType.REMOVE_LINE_ITEM:return e=t.payload,"number"!=typeof e.index?j.invalidPayload(t,"Invalid remove line item payload"):void 0;case V.ActionType.SET_LINE_ITEM_DISCOUNT:return e=t.payload,e.data&&"number"==typeof e.index&&g(e.data)?void 0:j.invalidPayload(t,"Invalid set line item discount payload");case V.ActionType.REMOVE_LINE_ITEM_DISCOUNT:return e=t.payload,"number"!=typeof e.index?j.invalidPayload(t,"Invalid remove line item discount payload"):void 0;case V.ActionType.SET_LINE_ITEM_PROPERTIES:return e=t.payload,e.data&&"number"==typeof e.index&&m(e.data)?void 0:j.invalidPayload(t,"Invalid add line item properties payload");case V.ActionType.REMOVE_LINE_ITEM_PROPERTIES:return e=t.payload,e.data&&"number"==typeof e.index&&C(e.data)?void 0:j.invalidPayload(t,"Invalid remove line item properties payload");default:return j.invalidActionType(t)}}function N(t){return new w(t)}var M=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),U=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var L=r(2),B=r(1),j=r(0),V=r(15);e.fetch=o,e.setCustomer=i,e.removeCustomer=n,e.addCustomerAddress=a,e.updateCustomerAddress=s,e.setDiscount=p,e.removeDiscount=u,e.setProperties=c,e.removeProperties=d,e.clear=l,e.addLineItem=y,e.updateLineItem=f,e.removeLineItem=A,e.setLineItemDiscount=h,e.removeLineItemDiscount=E,e.setLineItemProperties=P,e.removeLineItemProperties=T,e.validationError=D;var w=function(t){function e(e){return t.call(this,e,B.Group.Cart,B.Group.Cart)||this}return M(e,t),e.prototype.dispatch=function(t){switch(t.type){case V.ActionType.FETCH:case V.ActionType.UPDATE:case V.ActionType.SET_CUSTOMER:case V.ActionType.REMOVE_CUSTOMER:case V.ActionType.ADD_CUSTOMER_ADDRESS:case V.ActionType.UPDATE_CUSTOMER_ADDRESS:case V.ActionType.SET_DISCOUNT:case V.ActionType.REMOVE_DISCOUNT:case V.ActionType.SET_PROPERTIES:case V.ActionType.REMOVE_PROPERTIES:case V.ActionType.CLEAR:case V.ActionType.ADD_LINE_ITEM:case V.ActionType.UPDATE_LINE_ITEM:case V.ActionType.REMOVE_LINE_ITEM:case V.ActionType.SET_LINE_ITEM_DISCOUNT:case V.ActionType.REMOVE_LINE_ITEM_DISCOUNT:case V.ActionType.SET_LINE_ITEM_PROPERTIES:case V.ActionType.REMOVE_LINE_ITEM_PROPERTIES:this.app.dispatch(U({},t,{payload:U({},t.payload,{id:this.id})}));break;default:j.throwError(j.ActionType.INVALID_ACTION_TYPE,L.actionWrapper({group:this.group,type:t}))}return this},e}(L.TwoWayAction);e.Cart=w,e.create=N},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(37)),o(r(16))},function(t,e,r){"use strict";function o(t){return c.actionWrapper({group:d.Group.Flash,payload:t,type:y.ActionType.SHOW})}function i(t){return c.actionWrapper({payload:t,group:d.Group.Flash,type:y.ActionType.CLEAR})}function n(t){var e;switch(t.type){case y.ActionType.CLEAR:return e=t.payload,void 0===e||void 0===e.id||"string"==typeof e.id?void 0:l.invalidPayload(t,"Id in payload is invalid");case y.ActionType.SHOW:return e=t.payload,void 0===e||void 0!==e.id&&"string"!=typeof e.id||!a(e)?l.invalidPayload(t):void 0;default:return l.invalidActionType(t)}}function a(t){return"string"==typeof t.message&&"number"==typeof t.duration}function s(t,e){return new f(t,e)}var p=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),u=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var c=r(2),d=r(1),l=r(0),y=r(16);e.show=o,e.clear=i,e.validationError=n;var f=function(t){function e(e,r){var o=t.call(this,e,d.Group.Flash,d.Group.Flash)||this;return o.message="",o.duration=3e3,o.set(r),o}return p(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{duration:this.duration,isDismissable:this.isDismissable,isError:this.isError,message:this.message}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return u({id:this.id},this.options)},enumerable:!0,configurable:!0}),e.prototype.set=function(t){var e=c.getMergedProps(this.options,t),r=e.message,o=e.isDismissable,i=e.duration,n=e.isError;return this.validateOptions(e)?(this.message=r,this.isDismissable=o,this.duration=i,this.isError=n,this):this},e.prototype.dispatch=function(t){switch(t){case y.Action.SHOW:var e=o(this.payload);this.app.dispatch(e);break;case y.Action.CLEAR:this.app.dispatch(i({id:this.id}));break;default:l.throwError(l.ActionType.INVALID_ACTION_TYPE,c.actionWrapper({group:this.group,type:t}))}return this},e.prototype.validateOptions=function(t){if(!a(t)){var e=c.actionWrapper({group:d.Group.Flash,payload:u({id:this.id},t)});return l.throwError(l.ActionType.INVALID_OPTIONS,e),!1}return!0},e}(c.TwoWayAction);e.Flash=f,e.create=s},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(39)),o(r(17))},function(t,e,r){"use strict";function o(){return a.actionWrapper({group:s.Group.Loading,type:u.ActionType.START})}function i(){return a.actionWrapper({group:s.Group.Loading,type:u.ActionType.STOP})}function n(t){switch(t.type){case u.ActionType.START:case u.ActionType.STOP:return;default:return p.invalidActionType(t)}}Object.defineProperty(e,"__esModule",{value:!0});var a=r(2),s=r(1),p=r(0),u=r(17);e.start=o,e.stop=i,e.validationError=n},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(41)),o(r(18))},function(t,e,r){"use strict";function o(t){return P.actionWrapper({group:e.GROUP,payload:t,type:b.ActionType.OPEN})}function i(t){return P.actionWrapper({group:e.GROUP,payload:t,type:b.ActionType.CLOSE})}function n(t,r){var o=A({id:t},g);return O.clickButton(e.GROUP,o,r)}function a(t){return P.actionWrapper({payload:t,group:e.GROUP,type:b.ActionType.UPDATE})}function s(t,e){var r=t.url,o=t.path;if(!r&&!o)return!1;if(o&&!_.isValidRelativePath(o))return!1;if(r){if(!e)return!1;if(!_.isValidAbsolutePath(r))return!1;var i=void 0;try{i=new URL(e).hostname}catch(t){return!1}if(!h.isSafe(r,{requireAbsolute:!0,requireSSL:!0,whitelist:[i]}))return!1}return!0}function p(t,e){var r;switch(t.type){case b.ActionType.OPEN:return r=t.payload,void 0===r?v.invalidPayload(t,v.Message.MISSING_PAYLOAD):r.id&&"string"!=typeof r.id?v.invalidPayload(t,v.Message.INVALID_PAYLOAD_ID):u(r,e)?void 0:v.invalidPayload(t);case b.ActionType.UPDATE:return r=t.payload,void 0===r?v.invalidPayload(t,v.Message.MISSING_PAYLOAD):"string"!=typeof r.id?v.invalidPayload(t,v.Message.INVALID_PAYLOAD_ID):u(r,e)?void 0:v.invalidPayload(t);case b.ActionType.CLOSE:if((r=t.payload)&&r.id&&"string"!=typeof r.id)return v.invalidPayload(t,v.Message.INVALID_PAYLOAD_ID);return;case b.FooterActionType.FOOTER_BUTTON_CLICK:return O.validationError(A({},t,{type:O.ActionType.CLICK}));case b.FooterActionType.FOOTER_BUTTON_UPDATE:return O.validationError(A({},t,{type:O.ActionType.UPDATE}));default:return v.invalidActionType(t)}}function u(t,e){return void 0!==t&&(!(l(t)&&("string"!=typeof e||!s(t,e)))&&((y(t)||l(t))&&c(t.footer)&&d(t.size)))}function c(t){if(void 0===t||!t.hasOwnProperty("buttons"))return!0;if(t.hasOwnProperty("buttons")&&(Array.isArray(t.buttons)||"object"!=typeof t.buttons))return!1;var e=t.buttons,r=e.secondary,o=e.primary;if(o&&!O.isValidButtonProps(o))return!1;if(r&&!Array.isArray(r))return!1;if(Array.isArray(r))for(var i=0,n=r;i<n.length;i++){var a=n[i];if(!O.isValidButtonProps(a))return!1}return!0}function d(t){if(void 0===t)return!0;var e=!1;return P.forEachInEnum(b.Size,function(r){t===r&&(e=!0)}),e}function l(t){return"string"==typeof t.url||"string"==typeof t.path}function y(t){return"string"==typeof t.message}var f=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),A=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var h=r(42),E=r(5),P=r(2),T=r(1),O=r(3),v=r(0),_=r(6),b=r(18);e.GROUP=T.Group.Modal;var g={group:e.GROUP,subgroups:["Footer"],type:T.ComponentType.Button};e.openModal=o,e.closeModal=i,e.clickFooterButton=n,e.update=a,e.isValidSrc=s,e.validationError=p,e.isValidModalProps=u,e.isValidModalFooter=c,e.isValidModalSize=d,e.isIframeModal=l,e.isMessageModal=y;var I=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.size=b.Size.Small,e}return f(e,t),Object.defineProperty(e.prototype,"footer",{get:function(){if(this.footerPrimary||this.footerSecondary)return{buttons:{primary:this.footerPrimary,secondary:this.footerSecondary}}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"footerOptions",{get:function(){if(this.footerPrimaryOptions||this.footerSecondaryOptions)return{buttons:{primary:this.footerPrimaryOptions,secondary:this.footerSecondaryOptions}}},enumerable:!0,configurable:!0}),e.prototype.close=function(){this.app.dispatch(i({id:this.id}))},e.prototype.setFooterPrimaryButton=function(t,e){var r=this,o=g.subgroups;this.footerPrimaryOptions=this.getChildButton(t,this.footerPrimaryOptions),this.footerPrimary=this.footerPrimaryOptions?E.getSingleButton(this,this.footerPrimaryOptions,o,function(t){r.updatePrimaryFooterButton(t,e)}):void 0},e.prototype.setFooterSecondaryButtons=function(t,e){var r=this,o=g.subgroups,i=t||[],n=this.footerOptions&&this.footerOptions.buttons.secondary||[];this.footerSecondaryOptions=this.getUpdatedChildActions(i,n),this.footerSecondary=this.footerSecondaryOptions?this.footerSecondaryOptions.map(function(t){return E.getSingleButton(r,t,o,function(t){r.updateSecondaryFooterButton(t,e)})}):void 0},e.prototype.getChildButton=function(t,e){var r=t?[t]:[],o=e?[e]:[],i=this.getUpdatedChildActions(r,o);return i?i[0]:void 0},e.prototype.updatePrimaryFooterButton=function(t,e){this.footer&&this.footer.buttons.primary&&P.updateActionFromPayload(this.footer.buttons.primary,O.getSafeButtonProps(t))&&e()},e.prototype.updateSecondaryFooterButton=function(t,e){if(this.footer&&this.footer.buttons&&this.footer.buttons.secondary){for(var r,o=0,i=this.footer.buttons.secondary;o<i.length;o++){var n=i[o];if(r=P.updateActionFromPayload(n,O.getSafeButtonProps(t)))break}r&&e()}},e.prototype.validateOptions=function(t){var e=A({id:this.id},t);if(!u(t,this.app.localOrigin)){var r=a(e);return v.throwError(v.ActionType.INVALID_OPTIONS,r),!1}return!0},e}(P.TwoWayActionWithChildren);e.Modal=I;var S=function(t){function r(r,o){var i=t.call(this,r,e.GROUP,e.GROUP)||this;return i.set(o,!1),i}return f(r,t),Object.defineProperty(r.prototype,"payload",{get:function(){return A({},this.options,{footer:this.footer,id:this.id})},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"options",{get:function(){return{footer:this.footerOptions,message:this.message,size:this.size,title:this.title}},enumerable:!0,configurable:!0}),r.prototype.set=function(t,e){var r=this;void 0===e&&(e=!0);var o=P.getMergedProps(this.options,t),i=o.title,n=o.footer,a=o.message,s=o.size;return this.validateOptions(o)?(this.title=i,this.message=a,this.size=s,this.setFooterPrimaryButton(n?n.buttons.primary:void 0,function(){r.dispatch(b.Action.UPDATE)}),this.setFooterSecondaryButtons(n?n.buttons.secondary:void 0,function(){r.dispatch(b.Action.UPDATE)}),e&&this.dispatch(b.Action.UPDATE),this):this},r.prototype.dispatch=function(t){switch(t){case b.Action.OPEN:this.app.dispatch(o(this.payload));break;case b.Action.CLOSE:this.close();break;case b.Action.UPDATE:this.app.dispatch(a(this.payload));break;default:v.throwError(v.ActionType.INVALID_ACTION_TYPE,P.actionWrapper({group:this.group,type:t}))}return this},r}(I);e.ModalMessage=S;var R=function(t){function r(r,o){var i=t.call(this,r,e.GROUP,e.GROUP)||this;return i.set(o,!1),i}return f(r,t),Object.defineProperty(r.prototype,"payload",{get:function(){return A({},this.options,{footer:this.footer,id:this.id})},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"options",{get:function(){return{footer:this.footerOptions,path:this.path,size:this.size,title:this.title,url:this.url}},enumerable:!0,configurable:!0}),r.prototype.set=function(t,e){var r=this;void 0===e&&(e=!0);var o=P.getMergedProps(this.options,t),i=o.title,n=o.footer,a=o.path,s=o.url,p=o.size;return this.validateOptions(o)?(this.title=i,this.url=s,this.path=a,this.size=p,this.setFooterPrimaryButton(n?n.buttons.primary:void 0,function(){r.dispatch(b.Action.UPDATE)}),this.setFooterSecondaryButtons(n?n.buttons.secondary:void 0,function(){r.dispatch(b.Action.UPDATE)}),e&&this.dispatch(b.Action.UPDATE),this):this},r.prototype.dispatch=function(t){switch(t){case b.Action.OPEN:this.app.dispatch(o(this.payload));break;case b.Action.CLOSE:this.close();break;case b.Action.UPDATE:this.app.dispatch(a(this.payload));break;default:v.throwError(v.ActionType.INVALID_ACTION_TYPE,P.actionWrapper({group:this.group,type:t}))}return this},r}(I);e.ModalIframe=R,e.create=function(t,e){return l(e)?new R(t,e):new S(t,e)}},function(t,e,r){"use strict";function o(t,e){var r=void 0===e?{}:e,o=r.whitelist,a=void 0===o?[]:o,d=r.subdomains,l=void 0===d?[]:d,y=r.matchPath,f=r.requireAbsolute,A=r.requireSSL;if(s.test(t))return!1;if(t.startsWith("/"))return!(a.length>0||l.length>0||f||A)&&(y?n(new URL(t,c),t,y):!p.test(t));var h;try{h=new URL(t)}catch(t){return!1}return!!u.includes(h.protocol)&&((!A||"https:"===h.protocol)&&(!h.username&&!h.password&&(!(y&&!n(h,t,y))&&!!i(h,a,l))))}function i(t,e,r){if(!r.every(function(t){return t.startsWith(".")}))throw new TypeError("Subdomains must begin with .");var o=t.hostname;return 0===e.length&&0===r.length||e.includes(o)||r.some(function(t){return o.endsWith(t)})}function n(t,e,r){var o=t.pathname,i=e.replace(t.origin,"").split("?")[0];return"string"==typeof r?o===r&&i===r:r.test(o)&&r.test(i)}function a(t,e,r){return o(t,r)?encodeURI(t):e}Object.defineProperty(e,"__esModule",{value:!0});var s=/\/\/\//,p=/[\/\\][\/\\]/,u=["https:","http:"],c="http://test.com";e.isSafe=o,e.makeSafe=a},function(t,e,r){"use strict";var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=o(r(44));e.validationError=i.default},function(t,e,r){"use strict";function o(t){return i.findMatchInEnum(u.ActionType,t.type)?p.validationError(t):i.findMatchInEnum(s.ActionType,t.type)?a.validationError(t):n.invalidActionType(t)}Object.defineProperty(e,"__esModule",{value:!0});var i=r(2),n=r(0),a=r(19),s=r(7),p=r(20),u=r(8);e.default=o},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(19)),o(r(7))},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(20)),o(r(8))},function(t,e,r){"use strict";function o(){return n.actionWrapper({group:a.Group.Print,type:p.ActionType.APP})}function i(t){switch(t.type){case p.ActionType.APP:return;default:return s.invalidActionType(t)}}Object.defineProperty(e,"__esModule",{value:!0});var n=r(2),a=r(1),s=r(0),p=r(21);e.app=o,e.validationError=i},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(49)),o(r(22))},function(t,e,r){"use strict";function o(t){return l.actionWrapper({payload:t,group:e.GROUP,type:f.ActionType.SELECT})}function i(t){return l.actionWrapper({payload:t,group:e.GROUP,type:f.ActionType.OPEN})}function n(t){return l.actionWrapper({payload:t,group:e.GROUP,type:f.ActionType.CLOSE})}function a(t){return l.actionWrapper({payload:t,group:e.GROUP,type:f.ActionType.UPDATE})}function s(t){return l.findMatchInEnum(f.ResourceType,t)}function p(t){var e;switch(t.type){case f.ActionType.UPDATE:case f.ActionType.OPEN:return e=t.payload,void 0!==e&&void 0!==e.id&&"string"==typeof e.id&&s(e.resourceType)?void 0:d.invalidPayload(t);case f.ActionType.SELECT:return e=t.payload,void 0!==e&&void 0!==e.id&&"string"==typeof e.id&&Array.isArray(e.selection)?void 0:d.invalidPayload(t);case f.ActionType.CLOSE:return;default:return d.invalidActionType(t)}}var u=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),c=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var d=r(0),l=r(2),y=r(1),f=r(22);e.GROUP=y.Group.ResourcePicker,e.select=o,e.open=i,e.close=n,e.update=a,e.validationError=p;var A=function(t){function r(r,o,i){var n=t.call(this,r,e.GROUP,e.GROUP)||this;if(n.selection=[],!s(i)){var a=l.actionWrapper({group:e.GROUP,payload:c({id:n.id},o,{resourceType:i})});d.throwError(d.ActionType.INVALID_OPTIONS,a)}return n.resourceType=i,n.set(o,!1),n}return u(r,t),Object.defineProperty(r.prototype,"payload",{get:function(){return c({},this.options,{id:this.id,resourceType:this.resourceType})},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"options",{get:function(){return{selectMultiple:this.selectMultiple,showHidden:this.showHidden,title:this.title}},enumerable:!0,configurable:!0}),r.prototype.set=function(t,e){void 0===e&&(e=!0);var r=l.getMergedProps(this.options,t),o=r.title,i=r.showHidden,n=r.selectMultiple;return this.title=o,this.showHidden=!1===i||!0,this.selectMultiple=!!n,e&&this.update(),this},r.prototype.dispatch=function(t,e){return t===f.Action.OPEN?this.open():t===f.Action.UPDATE?this.update():t===f.Action.CLOSE?this.close():t===f.Action.SELECT?(this.selection=e,this.app.dispatch(o({id:this.id,selection:this.selection}))):d.throwError(d.ActionType.INVALID_ACTION_TYPE,l.actionWrapper({group:this.group,type:t})),this},r.prototype.update=function(){this.app.dispatch(a(this.payload))},r.prototype.open=function(){this.app.dispatch(i(this.payload))},r.prototype.close=function(){this.app.dispatch(n({id:this.id}))},r}(l.TwoWayAction);e.ResourcePicker=A,e.create=function(t,e){var r=e.resourceType,o=e.options;return new A(t,o,r)}},function(t,e,r){"use strict";function o(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),o(r(51)),o(r(23))},function(t,e,r){"use strict";function o(t,r){var o=T.ComponentType.Button,i=y({id:t,type:o},_);return f.clickButton(e.GROUP,i,r)}function i(t,r){var o=y({id:t},b);return f.clickButton(e.GROUP,o,r)}function n(t){return P.actionWrapper({payload:t,group:e.GROUP,type:v.ActionType.UPDATE})}function a(t){return!!t&&((void 0===t.id||"string"==typeof t.id)&&s(t))}function s(t){return("string"==typeof t.title||void 0===t.title)&&p(t.buttons)&&u(t.breadcrumbs)}function p(t){if(void 0===t)return!0;if("object"!=typeof t||Array.isArray(t))return!1;var e=t.primary,r=t.secondary;if(e&&!f.isValidButtonProps(e))return!1;if(void 0!==r&&!Array.isArray(r))return!1;if(Array.isArray(r))for(var o=0,i=r;o<i.length;o++){var n=i[o];if((!A.isGroupedButtonPayload(n)||!A.isValidButtonGroupProps(n))&&(A.isGroupedButtonPayload(n)||!f.isValidButtonProps(n)))return!1}return!0}function u(t){return!(void 0!==t&&!f.isValidButtonProps(t))}function c(t){var e;switch(t.type){case v.ActionType.UPDATE:return e=t.payload,void 0===e?O.invalidPayload(t,O.Message.MISSING_PAYLOAD):"string"!=typeof e.id?O.invalidPayload(t,O.Message.INVALID_PAYLOAD_ID):a(e)?void 0:O.invalidPayload(t);case v.ButtonsActionType.BUTTON_CLICK:case v.ButtonsActionType.BREADCRUMBS_CLICK:return f.validationError(y({},t,{type:f.ActionType.CLICK}));case v.ButtonsActionType.BUTTON_UPDATE:case v.ButtonsActionType.BREADCRUMBS_UPDATE:return f.validationError(y({},t,{type:f.ActionType.UPDATE}));case v.ButtonsActionType.BUTTON_GROUP_UPDATE:return A.validationError(y({},t,{type:A.ActionType.UPDATE}));default:return O.invalidActionType(t)}}function d(t,e){return new g(t,e)}var l=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),y=this&&this.__assign||Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var f=r(3),A=r(4),h=r(52),E=r(5),P=r(2),T=r(1),O=r(0),v=r(23);e.GROUP=T.Group.TitleBar;var _={group:e.GROUP,subgroups:["Buttons"]},b={group:e.GROUP,subgroups:["Breadcrumbs"],type:T.ComponentType.Button};e.clickActionButton=o,e.clickBreadcrumb=i,e.update=n,e.isValidTitleBarPayload=a,e.isValidTitleBarProps=s,e.isValidTitleBarButtons=p,e.isValidTitleBarBreadcrumbs=u,e.validationError=c;var g=function(t){function r(r,o){var i=t.call(this,r,e.GROUP,e.GROUP)||this;return i.set(o),i}return l(r,t),Object.defineProperty(r.prototype,"buttons",{get:function(){if(this.primary||this.secondary)return{primary:this.primary,secondary:this.secondary}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"buttonsOptions",{get:function(){if(this.primaryOptions||this.secondaryOptions)return{primary:this.primaryOptions,secondary:this.secondaryOptions}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"options",{get:function(){return{breadcrumbs:this.breadcrumbsOption,buttons:this.buttonsOptions,title:this.title}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"payload",{get:function(){return y({},this.options,{breadcrumbs:this.breadcrumb,buttons:this.buttons,id:this.id})},enumerable:!0,configurable:!0}),r.prototype.set=function(t,e){void 0===e&&(e=!0);var r=P.getMergedProps(this.options,t),o=r.title,i=r.buttons,n=r.breadcrumbs;return this.validateOptions(r)?(this.title=o,this.setBreadcrumbs(n),this.setPrimaryButton(i?i.primary:void 0),this.setSecondaryButton(i?i.secondary:void 0),e&&this.dispatch(v.Action.UPDATE),this):this},r.prototype.dispatch=function(t){switch(t){case v.Action.UPDATE:this.app.dispatch(n(this.payload));break;default:O.throwError(O.ActionType.INVALID_ACTION_TYPE,P.actionWrapper({group:this.group,type:t}))}return this},r.prototype.getButton=function(t,e,r){return t instanceof A.ButtonGroup?h.getGroupedButton(this,t,e,r):E.getSingleButton(this,t,e,r)},r.prototype.updatePrimaryButton=function(t){this.primary&&P.updateActionFromPayload(this.primary,f.getSafeButtonProps(t))&&this.dispatch(v.Action.UPDATE)},r.prototype.updateSecondaryButtons=function(t){if(this.secondary){var e=this.secondary.find(function(e){return e.id===t.id});if(e){var r=!1;r=A.isGroupedButtonPayload(t)?P.updateActionFromPayload(e,A.getSafeButtonGroupProps(t)):P.updateActionFromPayload(e,f.getSafeButtonProps(t)),r&&this.dispatch(v.Action.UPDATE)}}},r.prototype.updateBreadcrumbButton=function(t){this.breadcrumb&&P.updateActionFromPayload(this.breadcrumb,f.getSafeButtonProps(t))&&this.dispatch(v.Action.UPDATE)},r.prototype.setPrimaryButton=function(t){this.primaryOptions=this.getChildButton(t,this.primaryOptions),this.primary=this.primaryOptions?this.getButton(this.primaryOptions,_.subgroups,this.updatePrimaryButton):void 0},r.prototype.setSecondaryButton=function(t){var e=this,r=t||[],o=this.secondaryOptions||[];this.secondaryOptions=this.getUpdatedChildActions(r,o),this.secondary=this.secondaryOptions?this.secondaryOptions.map(function(t){return e.getButton(t,_.subgroups,e.updateSecondaryButtons)}):void 0},r.prototype.setBreadcrumbs=function(t){this.breadcrumbsOption=this.getChildButton(t,this.breadcrumbsOption),this.breadcrumb=this.breadcrumbsOption?this.getButton(this.breadcrumbsOption,b.subgroups,this.updateBreadcrumbButton):void 0},r.prototype.getChildButton=function(t,e){var r=t?[t]:[],o=e?[e]:[],i=this.getUpdatedChildActions(r,o);return i?i[0]:void 0},r.prototype.validateOptions=function(t){var e=y({id:this.id},t);if(!s(t)){var r=n(e);return O.throwError(O.ActionType.INVALID_OPTIONS,r),!1}return!0},r}(P.TwoWayActionWithChildren);e.TitleBar=g,e.create=d},function(t,e,r){"use strict";function o(t,e,r,o){t.addChild(e,t.group,r);var n=e.id,a=e.label,s=e.disabled,p=e.buttons;return t.subscribeToChild(e,i.Action.UPDATE,o),{id:n,label:a,buttons:p,disabled:s}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(4);e.getGroupedButton=o}])});
//# sourceMappingURL=actions.js.map

@@ -18,3 +18,3 @@ import { MetaAction } from '../types';

export declare function isErrorEventName(eventName: string): boolean;
export declare class EASDKError {
export declare class AppBridgeError {
message: string;

@@ -27,4 +27,4 @@ name: string;

}
export declare function fromAction(message: string, type: string, action?: Payload): EASDKError;
export declare function fromAction(message: string, type: string, action?: Payload): AppBridgeError;
export declare function throwError(type: Type | string, action: Payload, message?: string): void;
export declare function throwError(type: Type | string, message: string): void;

@@ -25,4 +25,4 @@ import { AnyAction, MetaAction } from '../types';

MISSING_CONFIG = "APP::APP_ERROR::MISSING_CONFIG",
MISSING_EASDK_MIDDLEWARE = "APP::APP_ERROR::MISSING_EASDK_MIDDLEWARE",
MISSING_APP_BRIDGE_MIDDLEWARE = "APP::APP_ERROR::MISSING_APP_BRIDGE_MIDDLEWARE",
}
export declare type Payload = MetaAction | AnyAction;

@@ -15,3 +15,3 @@ export * from './types';

import * as TitleBar from './TitleBar';
import { isEASDKAction } from './validator';
export { isEASDKAction, Button, ButtonGroup, Cart, Error, Flash, Navigation, History, Loading, Modal, Print, Redirect, ResourcePicker, TitleBar };
import { isAppBridgeAction } from './validator';
export { isAppBridgeAction, Button, ButtonGroup, Cart, Error, Flash, Navigation, History, Loading, Modal, Print, Redirect, ResourcePicker, TitleBar };
import { MetaAction } from '../actions/types';
import { ErrorAction } from '../actions/Error';
import { Indexable } from './merge';
export declare function isEASDKAction(action: any): action is MetaAction;
export declare function isAppBridgeAction(action: any): action is MetaAction;
export declare function isFromApp(action: any): boolean;

@@ -6,0 +6,0 @@ export declare function isAppMessage(event: any): boolean;

@@ -6,3 +6,3 @@ /// <reference types="react" />

export interface Context {
easdkMiddleware: Middleware;
appBridgeMiddleware: Middleware;
}

@@ -9,0 +9,0 @@ export interface DispatchToProps {

@@ -9,3 +9,3 @@ /**

export { buildMiddleware } from './Middleware';
export { easdkMiddlewareProptype } from './PropTypes';
export { appBridgeMiddlewareProptype } from './PropTypes';
export { Provider } from './Provider';

@@ -1,1 +0,1 @@

export declare function easdkMiddlewareProptype(object: any, key: string, componentName: string): Error | null;
export declare function appBridgeMiddlewareProptype(object: any, key: string, componentName: string): Error | null;

@@ -6,5 +6,5 @@ /// <reference types="react" />

import React from 'react';
import { easdkMiddlewareProptype, Middleware } from './';
import { appBridgeMiddlewareProptype, Middleware } from './';
export interface Context {
easdkMiddleware: Middleware;
appBridgeMiddleware: Middleware;
}

@@ -16,3 +16,3 @@ export interface Props {

static childContextTypes: {
easdkMiddleware: typeof easdkMiddlewareProptype;
appBridgeMiddleware: typeof appBridgeMiddlewareProptype;
};

@@ -19,0 +19,0 @@ middleware: Middleware;

{
"name": "@shopify/app-bridge",
"version": "0.1.2-3",
"version": "0.1.2",
"types": "index.d.ts",

@@ -105,3 +105,3 @@ "main": "index.js",

"testRegex": ".*\\.test\\.tsx?$",
"testURL": "https://easdk.myshopify.io/",
"testURL": "https://app-bridge.myshopify.io/",
"transform": {

@@ -108,0 +108,0 @@ ".tsx?$": "<rootDir>/../../node_modules/ts-jest/preprocessor.js"

@@ -1,36 +0,15 @@

# EASDK
# App Bridge
[![Build Status](https://travis-ci.com/Shopify/easdk.svg?token=RBRyvqQyN525bnfz7J8p&branch=master)](https://travis-ci.com/Shopify/easdk) [![codecov](https://codecov.io/gh/Shopify/easdk/branch/master/graph/badge.svg?token=nZ21m39Dr6)](https://codecov.io/gh/Shopify/easdk)
[![Build Status](https://travis-ci.com/Shopify/app-bridge.svg?token=RBRyvqQyN525bnfz7J8p&branch=master)](https://travis-ci.com/Shopify/app-bridge) [![codecov](https://codecov.io/gh/Shopify/app-bridge/branch/master/graph/badge.svg?token=nZ21m39Dr6)](https://codecov.io/gh/Shopify/app-bridge)
EASDK (Embedded App SDK) is Shopify's solution to give Embedded App developers access to the user interface that is native in Shopify admin such as Title Bar or Product Picker Modal.
This project (EASDK 1.0) is a re-write of the current EASDK in Shopfiy core.
> The App Bridge enables Apps on Shopify to access native Shopify features across different platforms.
## What's new in EASDK 1.0
* Use of **actions** to communicate between `app` and Shopify admin (`host`)
* Consistent action names between components
* Resource Picker with variants
* Control over **Modal Buttons**
### Use App Bridge in a project
`yarn add @shopify/app-bridge`
## What’s planned
* Feature detection
* Context bar API (i.e. unsaved state indicator)
* Mobile-centric API (i.e. barcode scanner)
## Getting Started
### Prerequisites
EASDK 1.0 is currently hidden behind feature flags. Shops **must** have the below enabled for EASDK 1.0 to work:
* [Shop beta (`easdkv1`)](./docs/internal-settings.md#shop-beta-easdkv1) or [API Client beta (`app_easdkv1`)](./docs/internal-settings.md#api_client-beta-app_easdkv1)
* [Internal routes](./docs/internal-settings.md#enable-internal-routes)
### Use EASDK 1.0 in a project
`yarn add @shopify/easdk`
### Set up a client
Import the client library from the easdk package and provide configuration:
Import the client library from the `app-bridge` package and provide configuration:
```js
import createApp, {getShopOrigin} from '@shopify/easdk';
import createApp, {getShopOrigin} from '@shopify/app-bridge';

@@ -44,42 +23,19 @@ const app = createApp({

### Use actions
A list of available actions can be found in the [actions source folder](./src/actions).
### Run EASDK 1.0 Playground app locally (optional)
This project comes with an example app demonstrating all features available from the EASDK. The app can be run and installed for testing against `web`:
* Ensure `shopify` and `web` are both running locally
* **Clone the EASDK source code**: `dev clone easdk`
* **Install external dependencies**: `dev up`
* **Run the server**: `dev start`
* **Install the app on your local instance of shopify (shop1)** by visiting [http://easdk.myshopify.io/auth/shopify?shop=shop1.myshopify.io](http://easdk.myshopify.io/auth/shopify?shop=shop1.myshopify.io)
* **See the app in action** by visiting [https://shop1.myshopify.io/admin/apps/easdk](https://shop1.myshopify.io/admin/apps/easdk)
[Similar steps](#installing-as-an-app-on-a-shop) can be taken to install the EASDK 1.0 Playground on a production shop.
## Development
### Build Scripts
- `yarn build` build the files into CommonJS into the `lib` and ES6 inside the`lib-esm` folder with source map
- `yarn start` build a development version of the libraries, and run the test app inside `test`
- `yarn watch` build a development version of the libraries and automatically rebuild when files have changed
- `yarn clean` remove the `lib` and `lib-esm` folders
- `yarn lint` run the linter
- `yarn check` run typescript checking
`yarn build` : build the files into CommonJS into the `lib` and ES6 inside the`lib-esm` folder with source map
`yarn start` : build a development version of the libraries, and run the test app inside `test`
`yarn watch` : build a development version of the libraries and automatically rebuild when files have changed
`yarn clean` remove the `lib` and `lib-esm` folders
`yarn lint` run the linter
`yarn check` run typescript checking
### Test Scripts
- `yarn test` run all tests using `jest`
- `yarn test:watch` run all tests in watch mode and auto-run on changes
- `yarn test:coverage` run all tests and generate coverage report
`yarn test` run all tests using `jest`
`yarn test:watch` run all tests in watch mode and auto-run on changes
`yarn test:coverage` run all tests and generate coverage report
### Prettier config
To enable automatic prettier formatting copy or link the pre-commit script to

@@ -91,42 +47,1 @@ `.git/hooks/pre-commit` and make sure it's executable, e.g.:

```
### Installing as an app on a shop
#### Local
Follow the steps under [Run EASDK 1.0 Playground app locally](#run-easdk-10-playground-app-locally-optional) in the Getting Started section.
#### Production
Run the EASDK Playground locally using `yarn start:prodShop`, visit the following URL with `shopOrigin` replaced with your shop's origin:
```
{shopOrigin}/admin/oauth/authorize?client_id=eff9519f64b4108b99ff551aba8d9344&redirect_uri=https%3A%2F%2Feasdk.myshopify.io%2Fauth%2Fcallback&scope=read_products
```
**Note:** You may see message `HMAC validation failed` right after app authorization, but the app should be installed regardless. This bug is currently being worked on.
## Documentation
### Current Public Documentation
#### Embedded App SDK
https://help.shopify.com/api/sdks/merchant-apps/embedded-app-sdk
#### POS App SDK
https://help.shopify.com/api/sdks/shopify-apps/shopify-pos-app-sdk
#### Polaris EASDK client
https://github.com/Shopify/polaris/blob/master/documentation/Embedded%20apps.md
### Private WIP Documentation
#### App Actions API
https://codepen.io/gf3/project/live/f7a2ae8c01bb52c48985641357fa859e/ZpvrKE/
#### EASDK ¯\_(ツ)\_/¯ guide
knowledge dump on how to navigate the current implementation within Shopify core code base
https://goo.gl/DD5I10

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc