UNPKG

72.2 kBJavaScriptView Raw
1!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()}(window,(function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=32)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Button="Button",t.ButtonGroup="ButtonGroup",t.Cart="Cart",t.Error="Error",t.Features="Features",t.Fullscreen="Fullscreen",t.Toast="Toast",t.Loading="Loading",t.Modal="Modal",t.Navigation="Navigation",t.Print="Print",t.TitleBar="TitleBar",t.ResourcePicker="Resource_Picker",t.ContextualSaveBar="ContextualSaveBar",t.Scanner="Scanner",t.Share="Share"}(e.Group||(e.Group={})),function(t){t.Button="Button",t.ButtonGroup="ButtonGroup"}(e.ComponentType||(e.ComponentType={}))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},c=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=n(2),u=n(4),a=n(6),p=n(7),f=c(n(37)),d=n(0),l=n(7),h=c(n(38)),y=n(39);function A(){return y.version}function E(t,e,n){var o=function(t){switch(t){case d.Group.ContextualSaveBar:return(e=t,e.replace(/([A-Z])/g,(function(t,e,n){return(0!==n?"_":"")+t[0].toLowerCase()}))).toUpperCase();default:return t.toUpperCase()}var e}(t);if(n){var r=n.subgroups,i=n.type;r&&r.length>0&&(o+=o.length>0?l.SEPARATOR:"",r.forEach((function(t,e){o+=""+t.toUpperCase()+(e<r.length-1?l.SEPARATOR:"")}))),i!==t&&i&&(o+=""+(o.length>0?l.SEPARATOR:"")+i.toUpperCase())}return o&&(o+=""+(o.length>0?l.SEPARATOR:"")+e.toUpperCase()),""+p.PREFIX+l.SEPARATOR+o}e.actionWrapper=function(t){return i({},t,{version:A(),clientInterface:{name:y.name,version:A()}})},e.getVersion=A,e.getEventNameSpace=E,e.isValidOptionalNumber=function(t){return null==t||"number"==typeof t},e.isValidOptionalString=function(t){return null==t||"string"==typeof t};var P=function(){function t(t,e,n,o){var r=this;this.app=t,this.type=e,this.group=n,this.subgroups=[],this.subscriptions=[],t||s.throwError(s.ActionType.INVALID_OPTIONS,"Missing required `app`"),this.id=o||h.default(),this.defaultGroup=n;var i=this.set;this.set=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return r.app.hooks?(t=r.app.hooks).run.apply(t,[u.LifecycleHook.UpdateAction,i,r].concat(e)):i.apply(r,e)}}return t.prototype.set=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},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,n){var o,r=t.eventType,i=t.callback,c=t.component;return(o=this.subscriptions.findIndex((function(e){return e===t})))>=0?this.subscriptions[o].unsubscribe():o=void 0,this.group=e,this.subgroups=n,Object.assign(c,{subgroups:this.subgroups}),this.subscribe(r,i,c,o)},t.prototype.error=function(t){var e=this,n=[];return b(s.Action,(function(o){n.push(e.subscriptions.length),e.subscribe(o,t)})),function(){n.map((function(t){return e.subscriptions[t]})).forEach((function(t){a.removeFromCollection(e.subscriptions,t,(function(t){t.unsubscribe()}))}))}},t.prototype.subscribe=function(t,e,n,o){var r,c=this,u=n||this.component,a=t.toUpperCase(),p="number"==typeof o?e:e.bind(this);r=s.isErrorEventName(t)?E(d.Group.Error,t,i({},u,{type:""})):E(this.group,t,u);var f=this.app.subscribe(r,p,n?n.id:this.id),l={eventType:a,unsubscribe:f,callback:p,component:u,updateSubscribe:function(t,e){return c.updateSubscription.call(c,l,t,e)}};return"number"==typeof o&&o>=0&&o<this.subscriptions.length?this.subscriptions[o]=l:this.subscriptions.push(l),f},t.prototype.unsubscribe=function(t){return void 0===t&&(t=!1),T(this.subscriptions,this.defaultGroup,t),this},t}();e.ActionSet=P;var O=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.children=[],e}return r(e,t),e.prototype.unsubscribe=function(t,n){return void 0===t&&(t=!0),void 0===n&&(n=!1),T(this.subscriptions,this.defaultGroup,n),this.children.forEach((function(n){e.prototype.isPrototypeOf(n)?n.unsubscribe(t,!t):n.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(n){return n.component.id===t&&(!e||e===n.eventType)}))},e.prototype.addChild=function(t,n,o){var r=this,i=t.subscriptions;return this.getChild(t.id)||this.children.push(t),!i||n===t.group&&o===t.subgroups?this:(i.forEach((function(t){(0,t.updateSubscribe)(n,o)})),Object.assign(t,{group:n,subgroups:o}),e.prototype.isPrototypeOf(t)&&t.children.forEach((function(t){return r.addChild(t,n,o)})),this)},e.prototype.removeChild=function(t){var e=this;return a.removeFromCollection(this.children,this.getChild(t),(function(){e.subscriptions.filter((function(e){return e.component.id===t})).forEach((function(t){a.removeFromCollection(e.subscriptions,t,(function(t){t.unsubscribe()}))}))})),this},e.prototype.subscribeToChild=function(t,e,n){var o=this,r=n.bind(this);if(e instanceof Array)return e.forEach((function(e){return o.subscribeToChild(t,e,n)})),this;if("string"!=typeof e)return this;var i=e.toUpperCase(),c=this.getChildSubscriptions(t.id,i);if(c.length>0)c.forEach((function(e){return e.updateSubscribe(o.group,t.subgroups)}));else{var s={id:t.id,subgroups:t.subgroups,type:t.type};this.subscribe(i,r,s)}return this},e.prototype.getUpdatedChildActions=function(t,e){if(0!==t.length){for(var n=t.filter((function(t,e,n){return e===n.indexOf(t)})),o=n.map((function(t){return t.id})),r=e.filter((function(t){return o.indexOf(t.id)<0}));r.length>0;){if(!(i=r.pop()))break;this.removeChild(i.id)}return n}for(;e.length>0;){var i;if(!(i=e.pop()))break;this.removeChild(i.id)}},e}(P);function T(t,e,n){void 0===n&&(n=!1),t.forEach((function(t){n?(0,t.updateSubscribe)(e,[]):(0,t.unsubscribe)()})),n||(t.length=0)}function _(t,e){var n=f.default(t,e);return n||Object.assign(t,e)}function b(t,e){Object.keys(t).forEach((function(n){e(t[n])}))}e.ActionSetWithChildren=O,e.updateActionFromPayload=function(t,e){return t.id===e.id&&(Object.assign(t,_(t,e)),!0)},e.getMergedProps=_,e.forEachInEnum=b,e.findMatchInEnum=function(t,e){var n=Object.keys(t).find((function(n){return e===t[n]}));return n?t[n]:void 0}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(35)),o(n(13))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(34)),o(n(16))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);e.AnyAction=o.AnyAction,e.Dispatch=o.Dispatch,e.Unsubscribe=o.Unsubscribe;var r=n(5);e.Handler=r.Handler,e.HandlerData=r.HandlerData,function(t){t.Dispatch="Dispatch",t.Subscribe="Subscribe"}(e.PermissionType||(e.PermissionType={})),function(t){t.GetState="getState",t.Dispatch="dispatch",t.Subscribe="subscribe",t.Unsubscribe="unsubscribe"}(e.MessageType||(e.MessageType={})),function(t){t.UpdateAction="UpdateAction",t.DispatchAction="DispatchAction"}(e.LifecycleHook||(e.LifecycleHook={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),r=n(14),i=n(6),c=n(15);!function(t){t.Modal="Modal",t.Main="Main"}(e.Context||(e.Context={})),e.fromFrame=function(t,e,n){var c=[];if(void 0===t||!t.ownerDocument||!t.ownerDocument.defaultView)throw o.fromAction("App frame is undefined",o.AppActionType.WINDOW_UNDEFINED);var s=t.ownerDocument.defaultView;return s.addEventListener("message",(function(t){if(t.origin===e&&r.isAppMessage(t))for(var n=0,o=c;n<o.length;n++){(0,o[n])(t)}})),{context:n,localOrigin:e,frameWindow:t.contentWindow,hostFrame:s,dispatch:function(e){var n=t.contentWindow;n&&n.postMessage(e,"*")},subscribe:function(t){return i.addAndRemoveFromCollection(c,t)}}},e.fromWindow=function(t,e){var n=[];return void 0!==typeof window&&window.addEventListener("message",(function(e){if((window!==t||c.isFrameless)&&e.source===t&&(r.isAppBridgeAction(e.data.payload)||r.isAppMessage(e)))for(var o=0,i=n;o<i.length;o++){(0,i[o])(e)}})),{localOrigin:e,hostFrame:t,dispatch:function(e){if(e.source&&e.source.shopOrigin)if(c.isFrameless&&window&&window.SmartWebView)window.SmartWebView.handleMessage("frameless://fromClient",JSON.stringify(e));else{var n="https://"+e.source.shopOrigin;t.postMessage(e,n)}},subscribe:function(t){return i.addAndRemoveFromCollection(n,t)}}}},function(t,e,n){"use strict";function o(t,e,n){var o=t.findIndex((function(t){return t===e}));return o>=0&&(t.splice(o,1),n&&n(e),!0)}Object.defineProperty(e,"__esModule",{value:!0}),e.addAndRemoveFromCollection=function(t,e,n){return t.push(e),function(){return o(t,e,n)}},e.removeFromCollection=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PREFIX="APP",e.SEPARATOR="::"},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(40)),o(n(17))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3);e.getSingleButton=function(t,e,n,r){return t.addChild(e,t.group,n),t.subscribeToChild(e,o.Action.UPDATE,r),e.payload}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(45)),o(n(11))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.SHOW="APP::TOAST::SHOW",t.CLEAR="APP::TOAST::CLEAR"}(e.ActionType||(e.ActionType={})),function(t){t.SHOW="SHOW",t.CLEAR="CLEAR"}(e.Action||(e.Action={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.OPEN="OPEN",t.CLOSE="CLOSE",t.UPDATE="UPDATE",t.UPDATE_SIZE="UPDATE_SIZE"}(e.Action||(e.Action={})),function(t){t.OPEN="APP::MODAL::OPEN",t.CLOSE="APP::MODAL::CLOSE",t.UPDATE="APP::MODAL::UPDATE",t.FOOTER_BUTTON_CLICK="APP::MODAL::FOOTER::BUTTON::CLICK",t.FOOTER_BUTTON_UPDATE="APP::MODAL::FOOTER::BUTTON::UPDATE",t.UPDATE_SIZE="APP::MODAL::UPDATE_SIZE"}(e.ActionType||(e.ActionType={})),function(t){t.Small="small",t.Medium="medium",t.Large="large",t.Full="full",t.Auto="auto"}(e.Size||(e.Size={}))},function(t,e,n){"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",t.PERMISSION="PERMISSION"}(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",t.PERMISSION="APP::ERROR::PERMISSION"}(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",t.WINDOW_UNDEFINED="APP::APP_ERROR::WINDOW_UNDEFINED",t.MISSING_LOCAL_ORIGIN="APP::APP_ERROR::MISSING_LOCAL_ORIGIN",t.MISSING_HOST_PROVIDER="APP::APP_ERROR::MISSING_HOST_PROVIDER",t.MISSING_ROUTER_CONTEXT="APP::APP_ERROR::MISSING_ROUTER_CONTEXT"}(e.AppActionType||(e.AppActionType={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(7),r=n(4),i=n(1);function c(t){return t.replace(new RegExp("^"+o.PREFIX+o.SEPARATOR+"\\w+"+o.SEPARATOR),"")}e.isAppBridgeAction=function(t){return t instanceof Object&&t.hasOwnProperty("type")&&t.type.toString().startsWith(o.PREFIX)},e.isFromApp=function(t){return"object"==typeof t&&"object"==typeof t.source&&"string"==typeof t.source.apiKey},e.getPermissionKey=c,e.isPermitted=function(t,e,n){var o=e.group,r=e.type;if(!o||!t.hasOwnProperty(o))return!1;var i=t[o];if(!i)return!1;var s=c(r);return!!i[s]&&!0===i[s][n]},e.isAppMessage=function(t){if("object"!=typeof t||!t.data||"object"!=typeof t.data)return!1;var e=t.data;return e.hasOwnProperty("type")&&void 0!==i.findMatchInEnum(r.MessageType,e.type)}},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.isServer="undefined"==typeof window,e.isClient=!e.isServer,e.isDevelopment=void 0!==t&&t.env&&!1,e.isProduction=!e.isDevelopment,e.isDevelopmentClient=e.isDevelopment&&e.isClient,e.isFrameless=!e.isServer&&window.navigator.userAgent.indexOf(" Frameless ")>0}).call(this,n(36))},function(t,e,n){"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){t.Print="print"}(e.Icon||(e.Icon={})),function(t){t.Danger="danger"}(e.Style||(e.Style={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.UPDATE="UPDATE"}(e.Action||(e.Action={})),function(t){t.UPDATE="APP::BUTTONGROUP::UPDATE"}(e.ActionType||(e.ActionType={}))},function(t,e,n){"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,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.UPDATE="APP::FEATURES::UPDATE",t.REQUEST="APP::FEATURES::REQUEST",t.REQUEST_UPDATE="APP::FEATURES::REQUEST::UPDATE"}(e.ActionType||(e.ActionType={})),function(t){t.UPDATE="UPDATE",t.REQUEST="REQUEST",t.REQUEST_UPDATE="REQUEST::UPDATE"}(e.Action||(e.Action={}))},function(t,e,n){"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,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c=n(9),s=n(1),u=n(0),a=n(3),p=n(12),f={group:u.Group.Modal,subgroups:["Footer"],type:u.ComponentType.Button};function d(t){return s.actionWrapper({group:u.Group.Modal,payload:t,type:p.ActionType.OPEN})}function l(t){return s.actionWrapper({group:u.Group.Modal,payload:t,type:p.ActionType.CLOSE})}function h(t){return s.actionWrapper({payload:t,group:u.Group.Modal,type:p.ActionType.UPDATE})}function y(t){return"string"==typeof t.url||"string"==typeof t.path}e.openModal=d,e.closeModal=l,e.updateModalSize=function(t){return s.actionWrapper({group:u.Group.Modal,payload:t,type:p.ActionType.UPDATE_SIZE})},e.clickFooterButton=function(t,e){var n=i({id:t},f);return a.clickButton(u.Group.Modal,n,e)},e.update=h,e.isIframeModal=y,e.isMessageModal=function(t){return"string"==typeof t.message};var A=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.size=p.Size.Small,e}return r(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(l({id:this.id}))},e.prototype.setFooterPrimaryButton=function(t,e){var n=this,o=f.subgroups;this.footerPrimaryOptions=this.getChildButton(t,this.footerPrimaryOptions),this.footerPrimary=this.footerPrimaryOptions?c.getSingleButton(this,this.footerPrimaryOptions,o,(function(t){n.updatePrimaryFooterButton(t,e)})):void 0},e.prototype.setFooterSecondaryButtons=function(t,e){var n=this,o=f.subgroups,r=t||[],i=this.footerOptions&&this.footerOptions.buttons.secondary||[];this.footerSecondaryOptions=this.getUpdatedChildActions(r,i),this.footerSecondary=this.footerSecondaryOptions?this.footerSecondaryOptions.map((function(t){return c.getSingleButton(n,t,o,(function(t){n.updateSecondaryFooterButton(t,e)}))})):void 0},e.prototype.getChildButton=function(t,e){var n=t?[t]:[],o=e?[e]:[],r=this.getUpdatedChildActions(n,o);return r?r[0]:void 0},e.prototype.updatePrimaryFooterButton=function(t,e){this.footer&&this.footer.buttons.primary&&s.updateActionFromPayload(this.footer.buttons.primary,t)&&e()},e.prototype.updateSecondaryFooterButton=function(t,e){if(this.footer&&this.footer.buttons&&this.footer.buttons.secondary){for(var n,o=0,r=this.footer.buttons.secondary;o<r.length;o++){var i=r[o];if(n=s.updateActionFromPayload(i,t))break}n&&e()}},e}(s.ActionSetWithChildren);e.Modal=A;var E=function(t){function e(e,n){var o=t.call(this,e,u.Group.Modal,u.Group.Modal)||this;return o.set(n,!1),o}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return i({},this.options,{footer:this.footer,id:this.id})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return{footer:this.footerOptions,message:this.message,size:this.size,title:this.title}},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){var n=this;void 0===e&&(e=!0);var o=s.getMergedProps(this.options,t),r=o.title,i=o.footer,c=o.message,u=o.size;return this.title=r,this.message=c,this.size=u,this.setFooterPrimaryButton(i?i.buttons.primary:void 0,(function(){n.dispatch(p.Action.UPDATE)})),this.setFooterSecondaryButtons(i?i.buttons.secondary:void 0,(function(){n.dispatch(p.Action.UPDATE)})),e&&this.dispatch(p.Action.UPDATE),this},e.prototype.dispatch=function(t){switch(t){case p.Action.OPEN:this.app.dispatch(d(this.payload));break;case p.Action.CLOSE:this.close();break;case p.Action.UPDATE:this.app.dispatch(h(this.payload))}return this},e}(A);e.ModalMessage=E;var P=function(t){function e(e,n){var o=t.call(this,e,u.Group.Modal,u.Group.Modal)||this;return o.set(n,!1),o}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return i({},this.options,{footer:this.footer,id:this.id})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return{footer:this.footerOptions,path:this.path,size:this.size,title:this.title,url:this.url}},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){var n=this;void 0===e&&(e=!0);var o=s.getMergedProps(this.options,t),r=o.title,i=o.footer,c=o.path,u=o.url,a=o.size;return this.title=r,this.url=u,this.path=c,this.size=a,this.setFooterPrimaryButton(i?i.buttons.primary:void 0,(function(){n.dispatch(p.Action.UPDATE)})),this.setFooterSecondaryButtons(i?i.buttons.secondary:void 0,(function(){n.dispatch(p.Action.UPDATE)})),e&&this.dispatch(p.Action.UPDATE),this},e.prototype.dispatch=function(t){switch(t){case p.Action.OPEN:this.app.dispatch(d(this.payload));break;case p.Action.CLOSE:this.close();break;case p.Action.UPDATE:this.app.dispatch(h(this.payload))}return this},e}(A);e.ModalIframe=P,e.create=function(t,e){return y(e)?new P(t,e):new E(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.PUSH="APP::NAVIGATION::HISTORY::PUSH",t.REPLACE="APP::NAVIGATION::HISTORY::REPLACE"}(e.ActionType||(e.ActionType={})),function(t){t.PUSH="PUSH",t.REPLACE="REPLACE"}(e.Action||(e.Action={}))},function(t,e,n){"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::NAVIGATION::REDIRECT::ADMIN::SECTION",t.ADMIN_PATH="APP::NAVIGATION::REDIRECT::ADMIN::PATH",t.REMOTE="APP::NAVIGATION::REDIRECT::REMOTE",t.APP="APP::NAVIGATION::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,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(56)),o(n(25))},function(t,e,n){"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,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.OPEN="OPEN",t.SELECT="SELECT",t.CLOSE="CLOSE",t.UPDATE="UPDATE",t.CANCEL="CANCEL"}(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",t.CANCEL="APP::RESOURCE_PICKER::CANCEL"}(e.ActionType||(e.ActionType={})),function(t){t.Manual="MANUAL",t.BestSelling="BEST_SELLING",t.AlphaAsc="ALPHA_ASC",t.AlphaDesc="ALPHA_DESC",t.PriceDesc="PRICE_DESC",t.PriceAsc="PRICE_ASC",t.CreatedDesc="CREATED_DESC",t.Created="CREATED"}(e.CollectionSortOrder||(e.CollectionSortOrder={})),function(t){t.GiftCard="GIFT_CARD",t.Manual="MANUAL",t.ThirdParty="THIRD_PARTY"}(e.FulfillmentServiceType||(e.FulfillmentServiceType={})),function(t){t.Kilograms="KILOGRAMS",t.Grams="GRAMS",t.Pounds="POUNDS",t.Ounces="OUNCES"}(e.WeightUnit||(e.WeightUnit={})),function(t){t.Deny="DENY",t.Continue="CONTINUE"}(e.ProductVariantInventoryPolicy||(e.ProductVariantInventoryPolicy={})),function(t){t.Shopify="SHOPIFY",t.NotManaged="NOT_MANAGED",t.FulfillmentService="FULFILLMENT_SERVICE"}(e.ProductVariantInventoryManagement||(e.ProductVariantInventoryManagement={})),function(t){t.Product="product",t.ProductVariant="variant",t.Collection="collection"}(e.ResourceType||(e.ResourceType={})),function(t){t.Add="add",t.Select="select"}(e.ActionVerb||(e.ActionVerb={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.OPEN_CAMERA="APP::SCANNER::OPEN::CAMERA",t.OPEN_NFC="APP::SCANNER::OPEN::NFC",t.CAPTURE="APP::SCANNER::CAPTURE"}(e.ActionType||(e.ActionType={})),function(t){t.OPEN_CAMERA="OPEN::CAMERA",t.OPEN_NFC="OPEN::NFC",t.CAPTURE="CAPTURE"}(e.Action||(e.Action={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.UPDATE="UPDATE"}(e.Action||(e.Action={})),function(t){t.UPDATE="APP::TITLEBAR::UPDATE",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.ActionType||(e.ActionType={}))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0});var r=n(30);o(n(4)),o(n(30)),e.default=r.createClientApp},function(t,e,n){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),c=n(2),s=n(24),u=n(5),a=n(6),p=n(66),f=n(15),d=n(67),l=n(31),h=n(68),y=n(4),A=r(n(69));function E(){var t={},e=l.getLocation();return e?e.search.slice(e.search.indexOf("?")+1).split("&").reduce((function(t,e){var n,r=e.split("="),i=r[0],c=r[1];return o({},t,((n={})[decodeURIComponent(i)]=decodeURIComponent(c),n))}),t):t}function P(t,n,o){if(void 0===o&&(o=[]),!t)throw c.fromAction(e.WINDOW_UNDEFINED_MESSAGE,c.AppActionType.WINDOW_UNDEFINED);var r=l.getLocation(),i=n||r&&r.origin;if(!i)throw c.fromAction("local origin cannot be blank",c.AppActionType.MISSING_LOCAL_ORIGIN);var s=u.fromWindow(t,i);return e.createClientApp(s,o)}function O(t){var e=l.getWindow();return e?P(e.top)(t):p.serverAppBridge}e.WINDOW_UNDEFINED_MESSAGE="window is not defined. Running an app outside a browser is not supported",e.getUrlParams=E,e.getShopOrigin=function(){return E().shop},e.createClientApp=function(t,e){void 0===e&&(e=[]);var n=[],o=[],r={};return t.subscribe((function(t){var e=t.data;switch(e.type){case"getState":n.splice(0).forEach((function(t){return t(e.payload)}));break;case"dispatch":var s=e.payload;!function(t,e){var n=!1;if(r.hasOwnProperty(t))for(var o=0,s=r[t];o<s.length;o++){var u=s[o],a=u.id,p=u.callback;!(e&&e.id===a)&&a||(p(e),n=!0)}if(!n){var f=i.findMatchInEnum(c.ActionType,t);f&&c.throwError(f,e)}}(s.type,s.payload),o.forEach((function(t){return t.callback(s)}))}})),function(u){if(!u.shopOrigin)throw c.fromAction("shopOrigin must be provided",c.AppActionType.INVALID_CONFIG);var p=/^https?:\/\//;if(p.test(u.shopOrigin)){var E="shopOrigin should not include protocol, please use: "+u.shopOrigin.replace(p,"");throw c.fromAction(E,c.AppActionType.INVALID_CONFIG)}if(!u.apiKey)throw c.fromAction("apiKey must be provided",c.AppActionType.INVALID_CONFIG);var P=function(t,e){return function(n,o){t.dispatch({payload:o,source:e,type:n})}}(t,u);function O(t){return P(y.MessageType.Dispatch,t),t}P(y.MessageType.Unsubscribe),function(t,e){var n=e.apiKey,o=e.shopOrigin,r=e.forceRedirect,i=void 0===r?!f.isDevelopmentClient:r,c=l.getLocation();if(!f.isFrameless&&c&&n&&o&&i&&l.shouldRedirect(t)){var s="https://"+o+"/admin/apps/"+n+c.pathname+(c.search||"");l.redirect(s)}}(t.hostFrame,u);for(var T=new A.default,_={localOrigin:t.localOrigin,hooks:T,dispatch:function(t){return _.hooks?_.hooks.run(y.LifecycleHook.DispatchAction,O,_,t):O(t)},featuresAvailable:function(t){return _.getState("features").then((function(e){return t&&Object.keys(e).forEach((function(n){t.includes(n)||delete e[n]})),e}))},getState:function(t){return new Promise((function(t){n.push(t),P(y.MessageType.GetState)})).then((function(e){return t?t.split(".").reduce((function(t,n){if("object"==typeof e&&!Array.isArray(e))return t=e[n],e=t,t}),void 0):e}))},subscribe:function(){if(arguments.length<2)return a.addAndRemoveFromCollection(o,{callback:arguments[0]});var t=arguments[0],e=arguments[1],n=arguments[2],i={callback:e,id:n},c={type:t,id:n};return r.hasOwnProperty(t)||(r[t]=[]),P(y.MessageType.Subscribe,c),a.addAndRemoveFromCollection(r[t],i,(function(){return P(y.MessageType.Unsubscribe,c)}))},error:function(t,e){var n=this,o=[];return i.forEachInEnum(c.ActionType,(function(r){o.push(n.subscribe(r,t,e))})),function(){o.forEach((function(t){return t()}))}}},b=0,v=e;b<v.length;b++){(0,v[b])(T,_)}return function(t){t.subscribe(s.ActionType.APP,d.handleAppPrint),h.setupModalAutoSizing(t)}(_),_}},e.createAppWrapper=P,e.createApp=O,e.default=O},function(t,e,n){"use strict";function o(){return r()?window.location:void 0}function r(){return"undefined"!=typeof window}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldRedirect=function(t){return t===window},e.redirect=function(t){var e=o();e&&e.assign(t)},e.getLocation=o,e.getWindow=function(){return r()?window:void 0}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}var r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(33));e.actions=i;var c=n(29);e.default=c.createApp,o(n(5)),o(n(29))},function(t,e,n){"use strict";var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var r=o(n(3));e.Button=r;var i=o(n(8));e.ButtonGroup=i;var c=o(n(41));e.Cart=c;var s=o(n(2));e.Error=s;var u=o(n(43));e.Flash=u;var a=o(n(46));e.Features=a;var p=o(n(48));e.Fullscreen=p;var f=o(n(49));e.Loading=f;var d=o(n(51));e.Modal=d;var l=o(n(52));e.History=l;var h=o(n(54));e.Redirect=h;var y=o(n(24));e.Print=y;var A=o(n(57));e.ResourcePicker=A;var E=o(n(59));e.Scanner=E;var P=o(n(61));e.TitleBar=P;var O=o(n(10));e.Toast=O;var T=o(n(64));e.ContextualSaveBar=T;var _=o(n(65));e.Share=_;var b=n(14);e.isAppBridgeAction=b.isAppBridgeAction,function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(0))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c=n(1),s=n(0),u=n(16);function a(t,e,n){var o=e.id,r=c.getEventNameSpace(t,u.Action.CLICK,e),i={id:o,payload:n};return c.actionWrapper({type:r,group:t,payload:i})}function p(t,e,n){var o=e.id,r=n.label,s=c.getEventNameSpace(t,u.Action.UPDATE,e),a=i({id:o,label:r},n);return c.actionWrapper({type:s,group:t,payload:a})}e.clickButton=a,e.update=p,e.isValidButtonProps=function(t){return"string"==typeof t.id&&"string"==typeof t.label};var f=function(t){function e(e,n){var o=t.call(this,e,s.ComponentType.Button,s.Group.Button)||this;return o.disabled=!1,o.set(n,!1),o}return r(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{disabled:this.disabled,icon:this.icon,label:this.label,style:this.style}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return i({id:this.id},this.options)},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var n=c.getMergedProps(this.options,t),o=n.label,r=n.disabled,i=n.icon,s=n.style;return this.label=o,this.disabled=!!r,this.icon=i,this.style=s,e&&this.dispatch(u.Action.UPDATE),this},e.prototype.dispatch=function(t,e){switch(t){case u.Action.CLICK:this.app.dispatch(a(this.group,this.component,e));break;case u.Action.UPDATE:var n=p(this.group,this.component,this.payload);this.app.dispatch(n)}return this},e}(c.ActionSet);e.Button=f,e.create=function(t,e){return new f(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(0),i=n(13);function c(t,e,n){var i=e.payload;return o.actionWrapper({type:t,group:r.Group.Error,payload:{action:e,message:n,type:t,id:i&&i.id?i.id:void 0}})}!function(t){t.MISSING_PAYLOAD="Missing payload",t.INVALID_PAYLOAD_ID="Id in payload is missing or invalid"}(e.Message||(e.Message={})),e.invalidPayload=function(t,e){return c(i.ActionType.INVALID_PAYLOAD,t,e||"The action's payload is missing required properties or has invalid properties")},e.invalidActionType=function(t,e){return o.actionWrapper({group:r.Group.Error,payload:{action:t,message:e||"The action type is invalid or unsupported",type:i.ActionType.INVALID_ACTION_TYPE},type:i.ActionType.INVALID_ACTION_TYPE})},e.invalidAction=function(t,e){return o.actionWrapper({group:r.Group.Error,payload:{action:t,message:e||"The action's has missing/invalid values for `group`, `type` or `version`",type:i.ActionType.INVALID_ACTION},type:i.ActionType.INVALID_ACTION})},e.unexpectedAction=function(t,e){return o.actionWrapper({group:r.Group.Error,payload:{action:t,message:e||"Action cannot be called at this time",type:i.ActionType.UNEXPECTED_ACTION},type:i.ActionType.UNEXPECTED_ACTION})},e.unsupportedOperationAction=function(t,e){return c(i.ActionType.UNSUPPORTED_OPERATION,t,e||"The action type is unsupported")},e.persistenceAction=function(t,e){return c(i.ActionType.PERSISTENCE,t,e||"Action cannot be persisted on server")},e.networkAction=function(t,e){return c(i.ActionType.NETWORK,t,e||"Network error")},e.permissionAction=function(t,e){return c(i.ActionType.PERMISSION,t,e||"Action is not permitted")},e.isErrorEventName=function(t){return"string"==typeof o.findMatchInEnum(i.Action,t)};var s=function(t){this.name="AppBridgeError",this.message=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(this.message).stack};function u(t,e,n){var o=new s(t?e+": "+t:e);return o.action=n,o.type=e,o}e.AppBridgeError=s,s.prototype=Object.create(Error.prototype),e.fromAction=u,e.throwError=function(){var t,e,n=arguments[0];throw"string"==typeof arguments[1]?t=arguments[1]:(e=arguments[1],t=arguments[2]||""),u(t,n,e)}},function(t,e){var n,o,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{o="function"==typeof clearTimeout?clearTimeout:c}catch(t){o=c}}();var u,a=[],p=!1,f=-1;function d(){p&&u&&(p=!1,u.length?a=u.concat(a):f=-1,a.length&&l())}function l(){if(!p){var t=s(d);p=!0;for(var e=a.length;e;){for(u=a,a=[];++f<e;)u&&u[f].run();f=-1,e=a.length}u=null,p=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===c||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function y(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new h(t,e)),1!==a.length||p||s(l)},h.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=y,r.addListener=y,r.once=y,r.off=y,r.removeListener=y,r.removeAllListeners=y,r.emit=y,r.prependListener=y,r.prependOnceListener=y,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t(e,n){if(void 0!==n){if(void 0===e||!Object.getPrototypeOf(e).isPrototypeOf(n)||"Object"!==n.constructor.name&&"Array"!==n.constructor.name)return n;var o={};return Object.keys(n).forEach((function(r){e.hasOwnProperty(r)?"object"!=typeof e[r]||Array.isArray(e[r])?o[r]=n[r]:o[r]=t(e[r],n[r]):o[r]=n[r]})),Object.keys(e).forEach((function(t){n.hasOwnProperty(t)||(o[t]=e[t])})),Object.setPrototypeOf(o,Object.getPrototypeOf(e)),o}}},function(t,e,n){"use strict";function o(t){return Array.from(t).map((function(t){return("00"+t.toString(16)).slice(-2)})).join("")}function r(t){if("function"==typeof Uint8Array&&window.crypto){var e=new Uint8Array(t),n=window.crypto.getRandomValues(e);if(n)return n}return Array.from(new Array(t),(function(){return 255*Math.random()|0}))}function i(){var t=r(1),e=r(2);return t[0]&=191,e[0]&=79,[o(r(4)),"-",o(r(2)),"-",o(e),"-",o(t),o(r(1)),"-",o(r(6))].join("")}Object.defineProperty(e,"__esModule",{value:!0}),e.generateUuid=i,e.default=i},function(t){t.exports=JSON.parse('{"name":"@shopify/app-bridge","version":"1.8.0","types":"index.d.ts","main":"index.js","unpkg":"umd/index.js","jsdelivr":"umd/index.js","files":["/actions/","/client/","/umd/","/util/","/validate/","/MessageTransport.d.ts","/MessageTransport.js","/development.d.ts","/development.js","/index.d.ts","/index.js","/production.d.ts","/production.js"],"private":false,"publishConfig":{"access":"public","@shopify:registry":"https://registry.npmjs.org"},"repository":"git@github.com:Shopify/app-bridge.git","author":"Shopify Inc.","license":"MIT","scripts":{"build":"yarn build:tsc && yarn build:umd","build:tsc":"NODE_ENV=production tsc","build:umd":"NODE_ENV=production webpack -p","check":"tsc --pretty --noEmit","clean":"cat package.json | node -pe \\"JSON.parse(require(\'fs\').readFileSync(\'/dev/stdin\').toString()).files.map(f => \'./\'+f).join(\' \')\\" | xargs rm -rf","pack":"yarn pack","size":"size-limit"},"sideEffects":false,"size-limit":[{"limit":"14.5 KB","path":"production.js"}],"devDependencies":{"@types/node":"^10.12.5","typescript":"3.2.1"},"resolutions":{"sqlite3":"4.0.1"}}')},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c=n(9),s=n(1),u=n(0),a=n(17);function p(t,e,n){return function(t,e,n,o,r){var c=e.id,u=o.label,a=s.getEventNameSpace(t,n,e),p=i({id:c,label:u},o,{payload:r});return s.actionWrapper({type:a,group:t,payload:p})}(t,e,a.Action.UPDATE,n)}e.update=p,e.isGroupedButton=function(t){var e=t;return e.buttons&&e.buttons.length>0&&void 0!==e.label},e.isGroupedButtonPayload=function(t){var e=t;return Array.isArray(e.buttons)&&"string"==typeof e.id&&"string"==typeof e.label};var f=function(t){function e(e,n){var o=t.call(this,e,u.ComponentType.ButtonGroup,u.Group.ButtonGroup)||this;return o.disabled=!1,o.buttonsOptions=[],o.buttons=[],o.set(n,!1),o}return r(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 i({},this.options,{buttons:this.buttons,id:this.id})},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var n=s.getMergedProps(this.options,t),o=n.label,r=n.disabled,i=n.buttons;return this.label=o,this.disabled=!!r,this.buttons=this.getButtons(i),e&&this.dispatch(a.Action.UPDATE),this},e.prototype.dispatch=function(t){switch(t){case a.Action.UPDATE:var e=p(this.group,this.component,this.payload);this.app.dispatch(e)}return this},e.prototype.updateButtons=function(t){if(this.buttons&&0!==this.buttons.length){for(var e,n=0,o=this.buttons;n<o.length;n++){var r=o[n];if(e=s.updateActionFromPayload(r,t))break}e&&this.dispatch(a.Action.UPDATE)}},e.prototype.getSingleButton=function(t){return c.getSingleButton(this,t,this.subgroups,this.updateButtons)},e.prototype.getButtons=function(t){var e=this,n=[];return t?(t.forEach((function(t){var o=c.getSingleButton(e,t,e.subgroups,e.updateButtons);n.push(o)})),this.buttonsOptions=t,n):[]},e}(s.ActionSetWithChildren);e.ButtonGroup=f,e.create=function(t,e){return new f(t,e)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(42)),o(n(18))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c=n(1),s=n(0),u=n(18),a=function(t){function e(e,n){return t.call(this,e,s.Group.Cart,s.Group.Cart,n?n.id:void 0)||this}return r(e,t),e.prototype.dispatch=function(t,e){switch(t){case u.Action.FETCH:this.dispatchCartAction(u.ActionType.FETCH);break;case u.Action.UPDATE:this.dispatchCartAction(u.ActionType.UPDATE,e);break;case u.Action.SET_CUSTOMER:this.dispatchCartAction(u.ActionType.SET_CUSTOMER,e);break;case u.Action.REMOVE_CUSTOMER:this.dispatchCartAction(u.ActionType.REMOVE_CUSTOMER,e);break;case u.Action.ADD_CUSTOMER_ADDRESS:this.dispatchCartAction(u.ActionType.ADD_CUSTOMER_ADDRESS,e);break;case u.Action.UPDATE_CUSTOMER_ADDRESS:this.dispatchCartAction(u.ActionType.UPDATE_CUSTOMER_ADDRESS,e);break;case u.Action.SET_DISCOUNT:this.dispatchCartAction(u.ActionType.SET_DISCOUNT,e);break;case u.Action.REMOVE_DISCOUNT:this.dispatchCartAction(u.ActionType.REMOVE_DISCOUNT,e);break;case u.Action.SET_PROPERTIES:this.dispatchCartAction(u.ActionType.SET_PROPERTIES,e);break;case u.Action.REMOVE_PROPERTIES:this.dispatchCartAction(u.ActionType.REMOVE_PROPERTIES,e);break;case u.Action.CLEAR:this.dispatchCartAction(u.ActionType.CLEAR,e);break;case u.Action.ADD_LINE_ITEM:this.dispatchCartAction(u.ActionType.ADD_LINE_ITEM,e);break;case u.Action.UPDATE_LINE_ITEM:this.dispatchCartAction(u.ActionType.UPDATE_LINE_ITEM,e);break;case u.Action.REMOVE_LINE_ITEM:this.dispatchCartAction(u.ActionType.REMOVE_LINE_ITEM,e);break;case u.Action.SET_LINE_ITEM_DISCOUNT:this.dispatchCartAction(u.ActionType.SET_LINE_ITEM_DISCOUNT,e);break;case u.Action.REMOVE_LINE_ITEM_DISCOUNT:this.dispatchCartAction(u.ActionType.REMOVE_LINE_ITEM_DISCOUNT,e);break;case u.Action.SET_LINE_ITEM_PROPERTIES:this.dispatchCartAction(u.ActionType.SET_LINE_ITEM_PROPERTIES,e);break;case u.Action.REMOVE_LINE_ITEM_PROPERTIES:this.dispatchCartAction(u.ActionType.REMOVE_LINE_ITEM_PROPERTIES,e)}return this},e.prototype.dispatchCartAction=function(t,e){this.app.dispatch(c.actionWrapper({type:t,group:s.Group.Cart,payload:i({},e||{},{id:this.id})}))},e}(c.ActionSet);e.Cart=a,e.create=function(t,e){return new a(t,e)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(44)),o(n(11))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(10),c=n(10);e.ActionBase=c.ActionBase,e.clear=c.clear,e.ClearAction=c.ClearAction,e.show=c.show,e.ShowAction=c.ShowAction,e.FlashAction=c.ToastAction;var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(i.Toast);e.Flash=s,e.create=function(t,e){return new s(t,e)}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c=n(1),s=n(0),u=n(11);function a(t){return c.actionWrapper({group:s.Group.Toast,payload:t,type:u.ActionType.SHOW})}function p(t){return c.actionWrapper({payload:t,group:s.Group.Toast,type:u.ActionType.CLEAR})}e.show=a,e.clear=p;var f=function(t){function e(e,n){var o=t.call(this,e,s.Group.Toast,s.Group.Toast)||this;return o.message="",o.duration=5e3,o.set(n),o}return r(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{duration:this.duration,isError:this.isError,message:this.message}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return i({id:this.id},this.options)},enumerable:!0,configurable:!0}),e.prototype.set=function(t){var e=c.getMergedProps(this.options,t),n=e.message,o=e.duration,r=e.isError;return this.message=n,this.duration=o,this.isError=r,this},e.prototype.dispatch=function(t){switch(t){case u.Action.SHOW:var e=a(this.payload);this.app.dispatch(e);break;case u.Action.CLEAR:this.app.dispatch(p({id:this.id}))}return this},e}(c.ActionSet);e.Toast=f,e.create=function(t,e){return new f(t,e)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(47)),o(n(19))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c=n(1),s=n(0),u=n(19),a=function(t){function e(e,n){return t.call(this,e,s.Group.Features,s.Group.Features,n?n.id:void 0)||this}return r(e,t),e.prototype.dispatch=function(t,e){switch(t){case u.Action.REQUEST:this.dispatchFeaturesAction(u.ActionType.REQUEST,e)}return this},e.prototype.dispatchFeaturesAction=function(t,e){this.app.dispatch(c.actionWrapper({group:s.Group.Features,type:t,payload:i({},e||{},{id:this.id})}))},e}(c.ActionSet);e.Features=a,e.create=function(t,e){return new a(t,e)}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i,c=n(1),s=n(0);!function(t){t.ENTER="ENTER",t.EXIT="EXIT"}(e.Action||(e.Action={})),function(t){t.ENTER="APP::FULLSCREEN::ENTER",t.EXIT="APP::FULLSCREEN::EXIT"}(i=e.ActionType||(e.ActionType={}));var u=function(t){function e(e){return t.call(this,e,s.Group.Fullscreen,s.Group.Fullscreen)||this}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return{id:this.id}},enumerable:!0,configurable:!0}),e.prototype.dispatch=function(t){return this.app.dispatch(c.actionWrapper({group:this.group,type:i[t],payload:this.payload})),this},e}(c.ActionSet);e.Fullscreen=u,e.create=function(t){return new u(t)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(50)),o(n(20))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),c=n(0),s=n(20);function u(t){return i.actionWrapper({payload:t,group:c.Group.Loading,type:s.ActionType.START})}function a(t){return i.actionWrapper({payload:t,group:c.Group.Loading,type:s.ActionType.STOP})}e.start=u,e.stop=a;var p=function(t){function e(e){return t.call(this,e,c.Group.Loading,c.Group.Loading)||this}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return{id:this.id}},enumerable:!0,configurable:!0}),e.prototype.dispatch=function(t){switch(t){case s.Action.START:this.app.dispatch(u(this.payload));break;case s.Action.STOP:this.app.dispatch(a(this.payload))}return this},e}(i.ActionSet);e.Loading=p,e.create=function(t){return new p(t)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(21)),o(n(12))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(53)),o(n(22))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c=n(1),s=n(0),u=n(22);function a(t){return c.actionWrapper({payload:t,group:s.Group.Navigation,type:u.ActionType.PUSH})}function p(t){return c.actionWrapper({payload:t,group:s.Group.Navigation,type:u.ActionType.REPLACE})}e.push=a,e.replace=p;var f=function(t){function e(e){return t.call(this,e,"History",s.Group.Navigation)||this}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return{id:this.id}},enumerable:!0,configurable:!0}),e.prototype.dispatch=function(t,e){var n=i({},this.payload,{path:e});switch(t){case u.Action.PUSH:this.app.dispatch(a(n));break;case u.Action.REPLACE:this.app.dispatch(p(n))}return this},e}(c.ActionSet);e.History=f,e.create=function(t){return new f(t)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(55)),o(n(23))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c=n(1),s=n(0),u=n(23);function a(t){return!0===t.create}function p(t){var e=t;return void 0!==e.id&&void 0!==e.variant}function f(t){return c.actionWrapper({payload:t,group:s.Group.Navigation,type:u.ActionType.ADMIN_PATH})}function d(t){return c.actionWrapper({payload:t,group:s.Group.Navigation,type:u.ActionType.ADMIN_SECTION})}function l(t){return c.actionWrapper({payload:t,group:s.Group.Navigation,type:u.ActionType.REMOTE})}function h(t){return c.actionWrapper({payload:t,group:s.Group.Navigation,type:u.ActionType.APP})}e.isResourcePayload=function(t){return"string"==typeof t.id},e.isCreateResourcePayload=a,e.isProductVariantResourcePayload=p,e.isProductVariantCreateResourcePayload=function(t){return!!p(t)&&a(t.variant)},e.toAdminPath=f,e.toAdminSection=d,e.toRemote=l,e.toApp=h;var y=function(t){function e(e){return t.call(this,e,"Redirect",s.Group.Navigation)||this}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return{id:this.id}},enumerable:!0,configurable:!0}),e.prototype.dispatch=function(t,e){switch(t){case u.Action.ADMIN_PATH:var n=function(t){return"object"==typeof t&&t.hasOwnProperty("path")}(e)?e:{path:e};this.app.dispatch(f(i({},this.payload,n)));break;case u.Action.ADMIN_SECTION:var o=function(t){return"object"==typeof t&&"object"==typeof t.section&&t.section.hasOwnProperty("name")}(e)?e:{section:e};this.app.dispatch(d(i({},this.payload,o)));break;case u.Action.APP:this.app.dispatch(h(i({},this.payload,{path:e})));break;case u.Action.REMOTE:var r=function(t){return"object"==typeof t&&t.hasOwnProperty("url")}(e)?e:{url:e};this.app.dispatch(l(i({},this.payload,r)))}return this},e}(c.ActionSet);e.Redirect=y,e.create=function(t){return new y(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(0),i=n(25);e.app=function(){return o.actionWrapper({group:r.Group.Print,type:i.ActionType.APP})}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(58)),o(n(26))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c=n(1),s=n(0),u=n(26);function a(t){return c.actionWrapper({payload:t,group:s.Group.ResourcePicker,type:u.ActionType.SELECT})}function p(t){return c.actionWrapper({payload:t,group:s.Group.ResourcePicker,type:u.ActionType.OPEN})}function f(t){return c.actionWrapper({payload:t,group:s.Group.ResourcePicker,type:u.ActionType.CANCEL})}function d(t){return c.actionWrapper({payload:t,group:s.Group.ResourcePicker,type:u.ActionType.UPDATE})}e.select=a,e.open=p,e.cancel=f,e.close=function(t){return c.actionWrapper({payload:t,group:s.Group.ResourcePicker,type:u.ActionType.CANCEL})},e.update=d;var l=function(t){function e(e,n,o){var r=t.call(this,e,s.Group.ResourcePicker,s.Group.ResourcePicker)||this;return r.selection=[],r.resourceType=o,r.set(n,!1),r}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return i({},this.options,{id:this.id,resourceType:this.resourceType})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){var t={initialQuery:this.initialQuery,selectMultiple:this.selectMultiple,showHidden:this.showHidden,actionVerb:this.actionVerb};return this.resourceType===u.ResourceType.Product?i({},t,{showVariants:this.showVariants}):t},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var n=c.getMergedProps(this.options,t),o=n.initialQuery,r=n.showHidden,i=void 0===r||r,s=n.showVariants,a=void 0===s||s,p=n.selectMultiple,f=void 0===p||p,d=n.actionVerb,l=void 0===d?u.ActionVerb.Add:d;return this.initialQuery=o,this.showHidden=Boolean(i),this.showVariants=Boolean(a),this.selectMultiple=Boolean(f),this.actionVerb=l,e&&this.update(),this},e.prototype.dispatch=function(t,e){return t===u.Action.OPEN?this.open():t===u.Action.UPDATE?this.update():t===u.Action.CLOSE||t===u.Action.CANCEL?this.cancel():t===u.Action.SELECT&&(this.selection=e,this.app.dispatch(a({id:this.id,selection:this.selection}))),this},e.prototype.update=function(){this.app.dispatch(d(this.payload))},e.prototype.open=function(){this.app.dispatch(p(this.payload))},e.prototype.cancel=function(){this.app.dispatch(f({id:this.id}))},e.prototype.close=function(){this.cancel()},e}(c.ActionSet);e.ResourcePicker=l,e.create=function(t,e){var n=e.resourceType,o=e.options;return new l(t,void 0===o?{}:o,n)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(60)),o(n(27))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),c=n(0),s=n(27),u=function(t){function e(e,n){return t.call(this,e,c.Group.Scanner,c.Group.Scanner,n?n.id:void 0)||this}return r(e,t),e.prototype.dispatch=function(t){switch(t){case s.Action.OPEN_CAMERA:this.dispatchScannerAction(s.ActionType.OPEN_CAMERA);break;case s.Action.OPEN_NFC:this.dispatchScannerAction(s.ActionType.OPEN_NFC)}return this},e.prototype.dispatchScannerAction=function(t){this.app.dispatch(i.actionWrapper({type:t,group:c.Group.Scanner,payload:{id:this.id}}))},e}(i.ActionSet);e.Scanner=u,e.create=function(t,e){return new u(t,e)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(62)),o(n(28))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c=n(3),s=n(8),u=n(63),a=n(9),p=n(1),f=n(0),d=n(28),l={group:f.Group.TitleBar,subgroups:["Buttons"]},h={group:f.Group.TitleBar,subgroups:["Breadcrumbs"],type:f.ComponentType.Button};function y(t){return p.actionWrapper({payload:t,group:f.Group.TitleBar,type:d.ActionType.UPDATE})}e.clickActionButton=function(t,e){var n=f.ComponentType.Button,o=i({id:t,type:n},l);return c.clickButton(f.Group.TitleBar,o,e)},e.clickBreadcrumb=function(t,e){var n=i({id:t},h);return c.clickButton(f.Group.TitleBar,n,e)},e.update=y;var A=function(t){function e(e,n){var o=t.call(this,e,f.Group.TitleBar,f.Group.TitleBar)||this;return o.set(n),o}return r(e,t),Object.defineProperty(e.prototype,"buttons",{get:function(){if(this.primary||this.secondary)return{primary:this.primary,secondary:this.secondary}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonsOptions",{get:function(){if(this.primaryOptions||this.secondaryOptions)return{primary:this.primaryOptions,secondary:this.secondaryOptions}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return{breadcrumbs:this.breadcrumbsOption,buttons:this.buttonsOptions,title:this.title}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return i({},this.options,{breadcrumbs:this.breadcrumb,buttons:this.buttons,id:this.id})},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var n=p.getMergedProps(this.options,t),o=n.title,r=n.buttons,i=n.breadcrumbs;return this.title=o,this.setBreadcrumbs(i),this.setPrimaryButton(r?r.primary:void 0),this.setSecondaryButton(r?r.secondary:void 0),e&&this.dispatch(d.Action.UPDATE),this},e.prototype.dispatch=function(t){switch(t){case d.Action.UPDATE:this.app.dispatch(y(this.payload))}return this},e.prototype.getButton=function(t,e,n){return t instanceof s.ButtonGroup?u.getGroupedButton(this,t,e,n):a.getSingleButton(this,t,e,n)},e.prototype.updatePrimaryButton=function(t){this.primary&&p.updateActionFromPayload(this.primary,t)&&this.dispatch(d.Action.UPDATE)},e.prototype.updateSecondaryButtons=function(t){if(this.secondary){var e=this.secondary.find((function(e){return e.id===t.id}));if(e){(s.isGroupedButtonPayload(t),p.updateActionFromPayload(e,t))&&this.dispatch(d.Action.UPDATE)}}},e.prototype.updateBreadcrumbButton=function(t){this.breadcrumb&&p.updateActionFromPayload(this.breadcrumb,t)&&this.dispatch(d.Action.UPDATE)},e.prototype.setPrimaryButton=function(t){this.primaryOptions=this.getChildButton(t,this.primaryOptions),this.primary=this.primaryOptions?this.getButton(this.primaryOptions,l.subgroups,this.updatePrimaryButton):void 0},e.prototype.setSecondaryButton=function(t){var e=this,n=t||[],o=this.secondaryOptions||[];this.secondaryOptions=this.getUpdatedChildActions(n,o),this.secondary=this.secondaryOptions?this.secondaryOptions.map((function(t){return e.getButton(t,l.subgroups,e.updateSecondaryButtons)})):void 0},e.prototype.setBreadcrumbs=function(t){this.breadcrumbsOption=this.getChildButton(t,this.breadcrumbsOption),this.breadcrumb=this.breadcrumbsOption?this.getButton(this.breadcrumbsOption,h.subgroups,this.updateBreadcrumbButton):void 0},e.prototype.getChildButton=function(t,e){var n=t?[t]:[],o=e?[e]:[],r=this.getUpdatedChildActions(n,o);return r?r[0]:void 0},e}(p.ActionSetWithChildren);e.TitleBar=A,e.create=function(t,e){return new A(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(8);e.getGroupedButton=function(t,e,n,r){t.addChild(e,t.group,n);var i=e.id,c=e.label,s=e.disabled,u=e.buttons;return t.subscribeToChild(e,o.Action.UPDATE,r),{id:i,label:c,buttons:u,disabled:s}}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c,s,u=n(1),a=n(0);function p(t,e){return u.actionWrapper({group:a.Group.ContextualSaveBar,type:s[t],payload:e})}!function(t){t.DISCARD="DISCARD",t.SAVE="SAVE",t.SHOW="SHOW",t.HIDE="HIDE",t.UPDATE="UPDATE"}(c=e.Action||(e.Action={})),function(t){t.DISCARD="APP::CONTEXTUAL_SAVE_BAR::DISCARD",t.SAVE="APP::CONTEXTUAL_SAVE_BAR::SAVE",t.SHOW="APP::CONTEXTUAL_SAVE_BAR::SHOW",t.HIDE="APP::CONTEXTUAL_SAVE_BAR::HIDE",t.UPDATE="APP::CONTEXTUAL_SAVE_BAR::UPDATE"}(s=e.ActionType||(e.ActionType={})),e.show=function(t){return p(c.SHOW,t)},e.hide=function(t){return p(c.HIDE,t)},e.save=function(t){return p(c.SAVE,t)},e.discard=function(t){return p(c.DISCARD,t)};var f=function(t){function e(e,n){void 0===n&&(n={});var o=t.call(this,e,a.Group.ContextualSaveBar,a.Group.ContextualSaveBar)||this;return o.options=n,o.set(n,!1),o}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return i({id:this.id},this.options)},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var n=u.getMergedProps(this.options,t);return this.options=n,e&&this.dispatch(c.UPDATE),this},e.prototype.dispatch=function(t){return this.app.dispatch(p(t,this.payload)),this},e}(u.ActionSet);e.ContextualSaveBar=f,e.create=function(t,e){return new f(t,e)}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var c,s,u=n(0),a=n(1);!function(t){t.SHOW="APP::SHARE::SHOW",t.CLOSE="APP::SHARE::CLOSE"}(c=e.ActionType||(e.ActionType={})),function(t){t.SHOW="SHOW",t.CLOSE="CLOSE"}(s=e.Action||(e.Action={}));var p=function(t){function e(e){return t.call(this,e,u.Group.Share,u.Group.Share)||this}return r(e,t),e.prototype.dispatch=function(t,e){switch(t){case s.SHOW:this.dispatchShareAction(c.SHOW,e);break;default:throw"Action: "+t+" not supported"}return this},e.prototype.dispatchShareAction=function(t,e){this.app.dispatch(a.actionWrapper({type:t,group:u.Group.Share,payload:i({id:this.id},e)}))},e}(a.ActionSet);e.Share=p,e.create=function(t){return new p(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),r=function(){};e.serverAppBridge={dispatch:function(){return{}},error:function(){return r},featuresAvailable:function(){return Promise.reject(o.fromAction("Feature detection is only available on the client side.",o.AppActionType.WINDOW_UNDEFINED))},getState:function(){return Promise.reject(o.fromAction("State is only available on the client side.",o.AppActionType.WINDOW_UNDEFINED))},localOrigin:"",subscribe:function(){return r}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(31);function r(){o.getWindow()&&window.print()}function i(){var t=function(){var t=o.getWindow();if(t&&t.document&&t.document.body){var e=window.document.createElement("input");return e.style.display="none",window.document.body.appendChild(e),e}}();t&&(t.select(),r(),t.remove())}e.handleAppPrint=function(){navigator.userAgent.indexOf("iOS")>=0?i():r()}},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,i){function c(t){try{u(o.next(t))}catch(t){i(t)}}function s(t){try{u(o.throw(t))}catch(t){i(t)}}function u(t){t.done?r(t.value):new n((function(e){e(t.value)})).then(c,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var n,o,r,i,c={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,o=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){c=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){c.label=i[1];break}if(6===i[0]&&c.label<r[1]){c.label=r[1],r=i;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(i);break}r[2]&&c.ops.pop(),c.trys.pop();continue}i=e.call(t,c)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(21),c=n(12),s=n(5);function u(t,e){var n,o=-1;function r(){var n=document.body.scrollHeight;n!==o&&(o=n,t.dispatch(i.updateModalSize({id:e,height:String(n)})))}new MutationObserver((function(){n&&window.clearTimeout(n);n=window.setTimeout(r,16)})).observe(document.body,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),r()}e.setupModalAutoSizing=function(t){return o(this,void 0,void 0,(function(){return r(this,(function(e){return[2,t.getState().then((function(e){if(e.context===s.Context.Modal){var n=e.modal,o=n.id;n.size===c.Size.Auto&&u(t,o)}}))]}))}))},e.createMutationObserver=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(6),r=function(){function t(){this.map={}}return t.prototype.set=function(t,e){this.map.hasOwnProperty(t)||(this.map[t]=[]);var n={handler:e,remove:function(){}},r=o.addAndRemoveFromCollection(this.map[t],n);return n={handler:e,remove:r},r},t.prototype.get=function(t){var e=this.map[t];return e?e.map((function(t){return t.handler})):void 0},t.prototype.run=function(t,e,n){for(var o=[],r=3;r<arguments.length;r++)o[r-3]=arguments[r];var i=0,c=this.get(t)||[];function s(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];var r=c[i++];return r?r(s).apply(n,t):e.apply(n,t)}return s.apply(n,o)},t}();e.default=r}])}));
\No newline at end of file