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

@shopify/app-bridge-core

Package Overview
Dependencies
Maintainers
24
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/app-bridge-core - npm Package Compare versions

Comparing version 1.2.1-snapshot-20240606192113 to 1.3.0-snapshot-20240607111514

esm/actions/ActionSet.js

84

actions/ActionSet.js

@@ -1,44 +0,11 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsubscribeActions = exports.ActionSetWithChildren = exports.ActionSet = void 0;
var types_1 = require("../client/types");
var collection_1 = require("../util/collection");
var Error_1 = require("./Error");
var types_2 = require("./types");
var uuid_1 = __importDefault(require("./uuid"));
var helper_1 = require("./helper");
'use strict';
var tslib_es6 = require('../node_modules/tslib/tslib.es6.js');
var client_types = require('../client/types.js');
var util_collection = require('../util/collection.js');
var actions_Error_index = require('./Error/index.js');
var actions_types = require('./types.js');
var actions_uuid = require('./uuid.js');
var actions_helper = require('./helper.js');
var ActionSet = /** @class */ (function () {

@@ -53,5 +20,5 @@ function ActionSet(app, type, group, id) {

if (!app) {
Error_1.throwError(Error_1.Action.INVALID_ACTION, 'Missing required `app`');
actions_Error_index.throwError(actions_Error_index.Action.INVALID_ACTION, 'Missing required `app`');
}
this.id = id || uuid_1.default();
this.id = id || actions_uuid.generateUuid();
this.defaultGroup = group;

@@ -68,10 +35,6 @@ var defaultSet = this.set;

}
return (_a = _this.app.hooks).run.apply(_a, __spreadArray([types_1.LifecycleHook.UpdateAction, defaultSet, _this], args));
return (_a = _this.app.hooks).run.apply(_a, tslib_es6.__spreadArray([client_types.LifecycleHook.UpdateAction, defaultSet, _this], args));
};
}
ActionSet.prototype.set = function () {
var _ = [];
for (var _i = 0; _i < arguments.length; _i++) {
_[_i] = arguments[_i];
}
};

@@ -107,3 +70,3 @@ Object.defineProperty(ActionSet.prototype, "component", {

var subscriptionIndices = [];
helper_1.forEachInEnum(Error_1.Action, function (eventNameSpace) {
actions_helper.forEachInEnum(actions_Error_index.Action, function (eventNameSpace) {
// Keep track of subscription index so we can call unsubscribe later

@@ -117,3 +80,3 @@ // This ensure it will continue to work even when the subscription has been updated

subscriptionsToRemove.forEach(function (toRemove) {
collection_1.removeFromCollection(_this.subscriptions, toRemove, function (removed) {
util_collection.removeFromCollection(_this.subscriptions, toRemove, function (removed) {
removed.unsubscribe();

@@ -130,7 +93,7 @@ });

var eventNameSpace;
if (Error_1.isErrorEventName(eventName)) {
eventNameSpace = helper_1.getEventNameSpace(types_2.Group.Error, eventName, __assign(__assign({}, eventComponent), { type: '' }));
if (actions_Error_index.isErrorEventName(eventName)) {
eventNameSpace = actions_helper.getEventNameSpace(actions_types.Group.Error, eventName, tslib_es6.__assign(tslib_es6.__assign({}, eventComponent), { type: '' }));
}
else {
eventNameSpace = helper_1.getEventNameSpace(this.group, eventName, eventComponent);
eventNameSpace = actions_helper.getEventNameSpace(this.group, eventName, eventComponent);
}

@@ -164,5 +127,4 @@ var unsubscribe = this.app.subscribe(eventNameSpace, boundedCallback, component ? component.id : this.id);

}());
exports.ActionSet = ActionSet;
var ActionSetWithChildren = /** @class */ (function (_super) {
__extends(ActionSetWithChildren, _super);
tslib_es6.__extends(ActionSetWithChildren, _super);
function ActionSetWithChildren() {

@@ -224,6 +186,6 @@ var _this = _super !== null && _super.apply(this, arguments) || this;

var _this = this;
collection_1.removeFromCollection(this.children, this.getChild(id), function () {
util_collection.removeFromCollection(this.children, this.getChild(id), function () {
var toBeRemoved = _this.subscriptions.filter(function (subs) { return subs.component.id === id; });
toBeRemoved.forEach(function (toRemove) {
collection_1.removeFromCollection(_this.subscriptions, toRemove, function (removed) {
util_collection.removeFromCollection(_this.subscriptions, toRemove, function (removed) {
removed.unsubscribe();

@@ -290,3 +252,2 @@ });

}(ActionSet));
exports.ActionSetWithChildren = ActionSetWithChildren;
function unsubscribeActions(subscriptions, defaultGroup, reassign) {

@@ -310,2 +271,5 @@ if (reassign === void 0) { reassign = false; }

}
exports.ActionSet = ActionSet;
exports.ActionSetWithChildren = ActionSetWithChildren;
exports.unsubscribeActions = unsubscribeActions;

@@ -1,18 +0,19 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.respond = exports.Action = void 0;
var helper_1 = require("../helper");
var types_1 = require("../types");
var Action;
'use strict';
var actions_helper = require('../helper.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {
Action["REQUEST"] = "APP::AUTH_CODE::REQUEST";
Action["RESPOND"] = "APP::AUTH_CODE::RESPOND";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function respond(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.AuthCode,
type: Action.RESPOND,
group: actions_types.Group.AuthCode,
type: exports.Action.RESPOND,
});
}
exports.respond = respond;

@@ -1,49 +0,24 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Button = exports.update = exports.clickButton = exports.Style = exports.Icon = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
var Action;
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {
Action["CLICK"] = "CLICK";
Action["UPDATE"] = "UPDATE";
})(Action = exports.Action || (exports.Action = {}));
var Icon;
})(exports.Action || (exports.Action = {}));
exports.Icon = void 0;
(function (Icon) {
Icon["Print"] = "print";
})(Icon = exports.Icon || (exports.Icon = {}));
var Style;
})(exports.Icon || (exports.Icon = {}));
exports.Style = void 0;
(function (Style) {
Style["Danger"] = "danger";
})(Style = exports.Style || (exports.Style = {}));
})(exports.Style || (exports.Style = {}));
function clickButton(group, component, payload) {
var id = component.id;
var action = helper_1.getEventNameSpace(group, Action.CLICK, component);
var action = actions_helper.getEventNameSpace(group, exports.Action.CLICK, component);
var buttonPayload = {

@@ -53,17 +28,15 @@ id: id,

};
return helper_1.actionWrapper({ type: action, group: group, payload: buttonPayload });
return actions_helper.actionWrapper({ type: action, group: group, payload: buttonPayload });
}
exports.clickButton = clickButton;
function update(group, component, props) {
var id = component.id;
var label = props.label;
var action = helper_1.getEventNameSpace(group, Action.UPDATE, component);
var buttonPayload = __assign(__assign({}, props), { id: id, label: label });
return helper_1.actionWrapper({ type: action, group: group, payload: buttonPayload });
var action = actions_helper.getEventNameSpace(group, exports.Action.UPDATE, component);
var buttonPayload = tslib_es6.__assign(tslib_es6.__assign({}, props), { id: id, label: label });
return actions_helper.actionWrapper({ type: action, group: group, payload: buttonPayload });
}
exports.update = update;
var Button = /** @class */ (function (_super) {
__extends(Button, _super);
tslib_es6.__extends(Button, _super);
function Button(app, options) {
var _this = _super.call(this, app, types_1.ComponentType.Button, types_1.Group.Button) || this;
var _this = _super.call(this, app, actions_types.ComponentType.Button, actions_types.Group.Button) || this;
_this.disabled = false;

@@ -91,3 +64,3 @@ _this.loading = false;

get: function () {
return __assign(__assign({}, this.options), { id: this.id });
return tslib_es6.__assign(tslib_es6.__assign({}, this.options), { id: this.id });
},

@@ -99,3 +72,3 @@ enumerable: false,

if (shouldUpdate === void 0) { shouldUpdate = true; }
var mergedOptions = helper_1.getMergedProps(this.options, options);
var mergedOptions = actions_helper.getMergedProps(this.options, options);
var label = mergedOptions.label, disabled = mergedOptions.disabled, icon = mergedOptions.icon, style = mergedOptions.style, loading = mergedOptions.loading, plain = mergedOptions.plain;

@@ -109,3 +82,3 @@ this.label = label;

if (shouldUpdate) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}

@@ -116,6 +89,6 @@ return this;

switch (action) {
case Action.CLICK:
case exports.Action.CLICK:
this.app.dispatch(clickButton(this.group, this.component, payload));
break;
case Action.UPDATE: {
case exports.Action.UPDATE: {
var updateAction = update(this.group, this.component, this.payload);

@@ -129,3 +102,6 @@ this.app.dispatch(updateAction);

return Button;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.Button = Button;
exports.clickButton = clickButton;
exports.update = update;

@@ -1,42 +0,16 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.create = exports.ButtonGroup = exports.isGroupedButtonPayload = exports.isGroupedButton = exports.update = exports.Action = void 0;
var buttonHelper_1 = require("../buttonHelper");
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
var Action;
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_buttonHelper = require('../buttonHelper.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {
Action["UPDATE"] = "UPDATE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function update(group, component, props) {
return buttonActionWrapper(group, component, Action.UPDATE, props);
return buttonActionWrapper(group, component, exports.Action.UPDATE, props);
}
exports.update = update;
function isGroupedButton(options) {

@@ -46,3 +20,2 @@ var castOptions = options;

}
exports.isGroupedButton = isGroupedButton;
function isGroupedButtonPayload(payload) {

@@ -54,7 +27,6 @@ var castOptions = payload;

}
exports.isGroupedButtonPayload = isGroupedButtonPayload;
var ButtonGroup = /** @class */ (function (_super) {
__extends(ButtonGroup, _super);
tslib_es6.__extends(ButtonGroup, _super);
function ButtonGroup(app, options) {
var _this = _super.call(this, app, types_1.ComponentType.ButtonGroup, types_1.Group.ButtonGroup) || this;
var _this = _super.call(this, app, actions_types.ComponentType.ButtonGroup, actions_types.Group.ButtonGroup) || this;
_this.disabled = false;

@@ -81,3 +53,3 @@ _this.plain = false;

get: function () {
return __assign(__assign({}, this.options), { buttons: this.buttons, id: this.id });
return tslib_es6.__assign(tslib_es6.__assign({}, this.options), { buttons: this.buttons, id: this.id });
},

@@ -89,3 +61,3 @@ enumerable: false,

if (shouldUpdate === void 0) { shouldUpdate = true; }
var mergedOptions = helper_1.getMergedProps(this.options, options);
var mergedOptions = actions_helper.getMergedProps(this.options, options);
var label = mergedOptions.label, disabled = mergedOptions.disabled, buttons = mergedOptions.buttons, plain = mergedOptions.plain;

@@ -97,3 +69,3 @@ this.label = label;

if (shouldUpdate) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}

@@ -104,3 +76,3 @@ return this;

switch (action) {
case Action.UPDATE: {
case exports.Action.UPDATE: {
var updateAction = update(this.group, this.component, this.payload);

@@ -120,3 +92,3 @@ this.app.dispatch(updateAction);

var action = _a[_i];
updated = helper_1.updateActionFromPayload(action, newPayload);
updated = actions_helper.updateActionFromPayload(action, newPayload);
if (updated) {

@@ -127,7 +99,7 @@ break;

if (updated) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}
};
ButtonGroup.prototype.getSingleButton = function (button) {
return buttonHelper_1.getSingleButton(this, button, this.subgroups, this.updateButtons);
return actions_buttonHelper.getSingleButton(this, button, this.subgroups, this.updateButtons);
};

@@ -141,3 +113,3 @@ ButtonGroup.prototype.getButtons = function (buttonOptions) {

buttonOptions.forEach(function (button) {
var singleButton = buttonHelper_1.getSingleButton(_this, button, _this.subgroups, _this.updateButtons);
var singleButton = actions_buttonHelper.getSingleButton(_this, button, _this.subgroups, _this.updateButtons);
buttons.push(singleButton);

@@ -149,14 +121,18 @@ });

return ButtonGroup;
}(ActionSet_1.ActionSetWithChildren));
exports.ButtonGroup = ButtonGroup;
}(actions_ActionSet.ActionSetWithChildren));
function create(app, options) {
return new ButtonGroup(app, options);
}
exports.create = create;
function buttonActionWrapper(group, component, eventName, props, payload) {
var id = component.id;
var label = props.label;
var action = helper_1.getEventNameSpace(group, eventName, component);
var buttonPayload = __assign(__assign({}, props), { id: id, label: label, payload: payload });
return helper_1.actionWrapper({ type: action, group: group, payload: buttonPayload });
var action = actions_helper.getEventNameSpace(group, eventName, component);
var buttonPayload = tslib_es6.__assign(tslib_es6.__assign({}, props), { id: id, label: label, payload: payload });
return actions_helper.actionWrapper({ type: action, group: group, payload: buttonPayload });
}
exports.ButtonGroup = ButtonGroup;
exports.create = create;
exports.isGroupedButton = isGroupedButton;
exports.isGroupedButtonPayload = isGroupedButtonPayload;
exports.update = update;

@@ -1,11 +0,12 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGroupedButton = void 0;
var ButtonGroup_1 = require("./ButtonGroup");
'use strict';
var actions_ButtonGroup_index = require('./ButtonGroup/index.js');
function getGroupedButton(action, button, subgroups, updateCb) {
action.addChild(button, action.group, subgroups);
var id = button.id, label = button.label, disabled = button.disabled, buttons = button.buttons, plain = button.plain;
action.subscribeToChild(button, ButtonGroup_1.Action.UPDATE, updateCb);
action.subscribeToChild(button, actions_ButtonGroup_index.Action.UPDATE, updateCb);
return { id: id, label: label, buttons: buttons, disabled: disabled, plain: plain };
}
exports.getGroupedButton = getGroupedButton;

@@ -1,10 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSingleButton = void 0;
var Button_1 = require("./Button");
'use strict';
var actions_Button_index = require('./Button/index.js');
function getSingleButton(action, button, subgroups, updateCb) {
action.addChild(button, action.group, subgroups);
action.subscribeToChild(button, Button_1.Action.UPDATE, updateCb);
action.subscribeToChild(button, actions_Button_index.Action.UPDATE, updateCb);
return button.payload;
}
exports.getSingleButton = getSingleButton;

@@ -1,34 +0,9 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cart = exports.setLineItemProperties = exports.removeLineItemDiscount = exports.setLineItemDiscount = exports.removeLineItem = exports.updateLineItem = exports.addLineItem = exports.removeProperties = exports.setProperties = exports.removeAllDiscounts = exports.setCodeDiscount = exports.setDiscount = exports.updateCustomerAddress = exports.addCustomerAddress = exports.setCustomer = exports.update = exports.fetch = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
var Action;
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {

@@ -55,3 +30,3 @@ Action["FETCH"] = "APP::CART::FETCH";

Action["REMOVE_LINE_ITEM_PROPERTIES"] = "APP::CART::REMOVE_LINE_ITEM_PROPERTIES";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
/**

@@ -63,4 +38,4 @@ * Cart action

if (payload === void 0) { payload = {}; }
return helper_1.actionWrapper({
group: types_1.Group.Cart,
return actions_helper.actionWrapper({
group: actions_types.Group.Cart,
type: type,

@@ -71,65 +46,49 @@ payload: payload,

function fetch() {
return createCartAction(Action.FETCH);
return createCartAction(exports.Action.FETCH);
}
exports.fetch = fetch;
function update(payload) {
return createCartAction(Action.UPDATE, payload);
return createCartAction(exports.Action.UPDATE, payload);
}
exports.update = update;
function setCustomer(payload) {
return createCartAction(Action.SET_CUSTOMER, payload);
return createCartAction(exports.Action.SET_CUSTOMER, payload);
}
exports.setCustomer = setCustomer;
function addCustomerAddress(payload) {
return createCartAction(Action.ADD_CUSTOMER_ADDRESS, payload);
return createCartAction(exports.Action.ADD_CUSTOMER_ADDRESS, payload);
}
exports.addCustomerAddress = addCustomerAddress;
function updateCustomerAddress(payload) {
return createCartAction(Action.UPDATE_CUSTOMER_ADDRESS, payload);
return createCartAction(exports.Action.UPDATE_CUSTOMER_ADDRESS, payload);
}
exports.updateCustomerAddress = updateCustomerAddress;
function setDiscount(payload) {
return createCartAction(Action.SET_DISCOUNT, payload);
return createCartAction(exports.Action.SET_DISCOUNT, payload);
}
exports.setDiscount = setDiscount;
function setCodeDiscount(payload) {
return createCartAction(Action.SET_CODE_DISCOUNT, payload);
return createCartAction(exports.Action.SET_CODE_DISCOUNT, payload);
}
exports.setCodeDiscount = setCodeDiscount;
function removeAllDiscounts(payload) {
return createCartAction(Action.REMOVE_ALL_DISCOUNTS, payload);
return createCartAction(exports.Action.REMOVE_ALL_DISCOUNTS, payload);
}
exports.removeAllDiscounts = removeAllDiscounts;
function setProperties(payload) {
return createCartAction(Action.SET_PROPERTIES, payload);
return createCartAction(exports.Action.SET_PROPERTIES, payload);
}
exports.setProperties = setProperties;
function removeProperties(payload) {
return createCartAction(Action.REMOVE_PROPERTIES, payload);
return createCartAction(exports.Action.REMOVE_PROPERTIES, payload);
}
exports.removeProperties = removeProperties;
function addLineItem(payload) {
return createCartAction(Action.ADD_LINE_ITEM, payload);
return createCartAction(exports.Action.ADD_LINE_ITEM, payload);
}
exports.addLineItem = addLineItem;
function updateLineItem(payload) {
return createCartAction(Action.UPDATE_LINE_ITEM, payload);
return createCartAction(exports.Action.UPDATE_LINE_ITEM, payload);
}
exports.updateLineItem = updateLineItem;
function removeLineItem(payload) {
return createCartAction(Action.REMOVE_LINE_ITEM, payload);
return createCartAction(exports.Action.REMOVE_LINE_ITEM, payload);
}
exports.removeLineItem = removeLineItem;
function setLineItemDiscount(payload) {
return createCartAction(Action.SET_LINE_ITEM_DISCOUNT, payload);
return createCartAction(exports.Action.SET_LINE_ITEM_DISCOUNT, payload);
}
exports.setLineItemDiscount = setLineItemDiscount;
function removeLineItemDiscount(payload) {
return createCartAction(Action.REMOVE_LINE_ITEM_DISCOUNT, payload);
return createCartAction(exports.Action.REMOVE_LINE_ITEM_DISCOUNT, payload);
}
exports.removeLineItemDiscount = removeLineItemDiscount;
function setLineItemProperties(payload) {
return createCartAction(Action.SET_LINE_ITEM_PROPERTIES, payload);
return createCartAction(exports.Action.SET_LINE_ITEM_PROPERTIES, payload);
}
exports.setLineItemProperties = setLineItemProperties;
/**

@@ -139,67 +98,67 @@ * Cart

var Cart = /** @class */ (function (_super) {
__extends(Cart, _super);
tslib_es6.__extends(Cart, _super);
function Cart(app, options) {
return _super.call(this, app, types_1.Group.Cart, types_1.Group.Cart, options ? options.id : undefined) || this;
return _super.call(this, app, actions_types.Group.Cart, actions_types.Group.Cart, options ? options.id : undefined) || this;
}
Cart.prototype.dispatch = function (action, payload) {
switch (action) {
case Action.FETCH:
this.dispatchCartAction(Action.FETCH);
case exports.Action.FETCH:
this.dispatchCartAction(exports.Action.FETCH);
break;
case Action.UPDATE:
this.dispatchCartAction(Action.UPDATE, payload);
case exports.Action.UPDATE:
this.dispatchCartAction(exports.Action.UPDATE, payload);
break;
case Action.SET_CUSTOMER:
this.dispatchCartAction(Action.SET_CUSTOMER, payload);
case exports.Action.SET_CUSTOMER:
this.dispatchCartAction(exports.Action.SET_CUSTOMER, payload);
break;
case Action.REMOVE_CUSTOMER:
this.dispatchCartAction(Action.REMOVE_CUSTOMER, payload);
case exports.Action.REMOVE_CUSTOMER:
this.dispatchCartAction(exports.Action.REMOVE_CUSTOMER, payload);
break;
case Action.ADD_CUSTOMER_ADDRESS:
this.dispatchCartAction(Action.ADD_CUSTOMER_ADDRESS, payload);
case exports.Action.ADD_CUSTOMER_ADDRESS:
this.dispatchCartAction(exports.Action.ADD_CUSTOMER_ADDRESS, payload);
break;
case Action.UPDATE_CUSTOMER_ADDRESS:
this.dispatchCartAction(Action.UPDATE_CUSTOMER_ADDRESS, payload);
case exports.Action.UPDATE_CUSTOMER_ADDRESS:
this.dispatchCartAction(exports.Action.UPDATE_CUSTOMER_ADDRESS, payload);
break;
case Action.SET_DISCOUNT:
this.dispatchCartAction(Action.SET_DISCOUNT, payload);
case exports.Action.SET_DISCOUNT:
this.dispatchCartAction(exports.Action.SET_DISCOUNT, payload);
break;
case Action.SET_CODE_DISCOUNT:
this.dispatchCartAction(Action.SET_CODE_DISCOUNT, payload);
case exports.Action.SET_CODE_DISCOUNT:
this.dispatchCartAction(exports.Action.SET_CODE_DISCOUNT, payload);
break;
case Action.REMOVE_DISCOUNT:
this.dispatchCartAction(Action.REMOVE_DISCOUNT, payload);
case exports.Action.REMOVE_DISCOUNT:
this.dispatchCartAction(exports.Action.REMOVE_DISCOUNT, payload);
break;
case Action.REMOVE_ALL_DISCOUNTS:
this.dispatchCartAction(Action.REMOVE_ALL_DISCOUNTS, payload);
case exports.Action.REMOVE_ALL_DISCOUNTS:
this.dispatchCartAction(exports.Action.REMOVE_ALL_DISCOUNTS, payload);
break;
case Action.SET_PROPERTIES:
this.dispatchCartAction(Action.SET_PROPERTIES, payload);
case exports.Action.SET_PROPERTIES:
this.dispatchCartAction(exports.Action.SET_PROPERTIES, payload);
break;
case Action.REMOVE_PROPERTIES:
this.dispatchCartAction(Action.REMOVE_PROPERTIES, payload);
case exports.Action.REMOVE_PROPERTIES:
this.dispatchCartAction(exports.Action.REMOVE_PROPERTIES, payload);
break;
case Action.CLEAR:
this.dispatchCartAction(Action.CLEAR, payload);
case exports.Action.CLEAR:
this.dispatchCartAction(exports.Action.CLEAR, payload);
break;
case Action.ADD_LINE_ITEM:
this.dispatchCartAction(Action.ADD_LINE_ITEM, payload);
case exports.Action.ADD_LINE_ITEM:
this.dispatchCartAction(exports.Action.ADD_LINE_ITEM, payload);
break;
case Action.UPDATE_LINE_ITEM:
this.dispatchCartAction(Action.UPDATE_LINE_ITEM, payload);
case exports.Action.UPDATE_LINE_ITEM:
this.dispatchCartAction(exports.Action.UPDATE_LINE_ITEM, payload);
break;
case Action.REMOVE_LINE_ITEM:
this.dispatchCartAction(Action.REMOVE_LINE_ITEM, payload);
case exports.Action.REMOVE_LINE_ITEM:
this.dispatchCartAction(exports.Action.REMOVE_LINE_ITEM, payload);
break;
case Action.SET_LINE_ITEM_DISCOUNT:
this.dispatchCartAction(Action.SET_LINE_ITEM_DISCOUNT, payload);
case exports.Action.SET_LINE_ITEM_DISCOUNT:
this.dispatchCartAction(exports.Action.SET_LINE_ITEM_DISCOUNT, payload);
break;
case Action.REMOVE_LINE_ITEM_DISCOUNT:
this.dispatchCartAction(Action.REMOVE_LINE_ITEM_DISCOUNT, payload);
case exports.Action.REMOVE_LINE_ITEM_DISCOUNT:
this.dispatchCartAction(exports.Action.REMOVE_LINE_ITEM_DISCOUNT, payload);
break;
case Action.SET_LINE_ITEM_PROPERTIES:
this.dispatchCartAction(Action.SET_LINE_ITEM_PROPERTIES, payload);
case exports.Action.SET_LINE_ITEM_PROPERTIES:
this.dispatchCartAction(exports.Action.SET_LINE_ITEM_PROPERTIES, payload);
break;
case Action.REMOVE_LINE_ITEM_PROPERTIES:
this.dispatchCartAction(Action.REMOVE_LINE_ITEM_PROPERTIES, payload);
case exports.Action.REMOVE_LINE_ITEM_PROPERTIES:
this.dispatchCartAction(exports.Action.REMOVE_LINE_ITEM_PROPERTIES, payload);
break;

@@ -210,6 +169,23 @@ }

Cart.prototype.dispatchCartAction = function (type, payload) {
this.app.dispatch(createCartAction(type, __assign(__assign({}, payload), { id: this.id })));
this.app.dispatch(createCartAction(type, tslib_es6.__assign(tslib_es6.__assign({}, payload), { id: this.id })));
};
return Cart;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.Cart = Cart;
exports.addCustomerAddress = addCustomerAddress;
exports.addLineItem = addLineItem;
exports.fetch = fetch;
exports.removeAllDiscounts = removeAllDiscounts;
exports.removeLineItem = removeLineItem;
exports.removeLineItemDiscount = removeLineItemDiscount;
exports.removeProperties = removeProperties;
exports.setCodeDiscount = setCodeDiscount;
exports.setCustomer = setCustomer;
exports.setDiscount = setDiscount;
exports.setLineItemDiscount = setLineItemDiscount;
exports.setLineItemProperties = setLineItemProperties;
exports.setProperties = setProperties;
exports.update = update;
exports.updateCustomerAddress = updateCustomerAddress;
exports.updateLineItem = updateLineItem;

@@ -1,7 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
exports.Action = void 0;
var Action;
(function (Action) {
Action["INITIALIZE"] = "APP::CLIENT::INITIALIZE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));

@@ -1,5 +0,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SEPARATOR = exports.PREFIX = void 0;
exports.PREFIX = 'APP';
exports.SEPARATOR = '::';
'use strict';
var PREFIX = 'APP';
var SEPARATOR = '::';
exports.PREFIX = PREFIX;
exports.SEPARATOR = SEPARATOR;

@@ -1,37 +0,12 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextualSaveBar = exports.update = exports.discard = exports.save = exports.hide = exports.show = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
/**
* ContextualSaveBar action enum
*/
var Action;
exports.Action = void 0;
(function (Action) {

@@ -43,6 +18,6 @@ Action["DISCARD"] = "APP::CONTEXTUAL_SAVE_BAR::DISCARD";

Action["UPDATE"] = "APP::CONTEXTUAL_SAVE_BAR::UPDATE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function createContextBarAction(action, payload) {
return helper_1.actionWrapper({
group: types_1.Group.ContextualSaveBar,
return actions_helper.actionWrapper({
group: actions_types.Group.ContextualSaveBar,
type: action,

@@ -53,21 +28,16 @@ payload: payload,

function show(payload) {
return createContextBarAction(Action.SHOW, payload);
return createContextBarAction(exports.Action.SHOW, payload);
}
exports.show = show;
function hide(payload) {
return createContextBarAction(Action.HIDE, payload);
return createContextBarAction(exports.Action.HIDE, payload);
}
exports.hide = hide;
function save(payload) {
return createContextBarAction(Action.SAVE, payload);
return createContextBarAction(exports.Action.SAVE, payload);
}
exports.save = save;
function discard(payload) {
return createContextBarAction(Action.DISCARD, payload);
return createContextBarAction(exports.Action.DISCARD, payload);
}
exports.discard = discard;
function update(payload) {
return createContextBarAction(Action.UPDATE, payload);
return createContextBarAction(exports.Action.UPDATE, payload);
}
exports.update = update;
/**

@@ -77,3 +47,3 @@ * ContextualSaveBar action set

var ContextualSaveBar = /** @class */ (function (_super) {
__extends(ContextualSaveBar, _super);
tslib_es6.__extends(ContextualSaveBar, _super);
/**

@@ -85,3 +55,3 @@ * Returns a new instance of a ContextualSaveBar action set

if (options === void 0) { options = {}; }
var _this = _super.call(this, app, types_1.Group.ContextualSaveBar, types_1.Group.ContextualSaveBar) || this;
var _this = _super.call(this, app, actions_types.Group.ContextualSaveBar, actions_types.Group.ContextualSaveBar) || this;
_this.options = options;

@@ -96,3 +66,3 @@ _this.set(options, false);

get: function () {
return __assign({ id: this.id }, this.options);
return tslib_es6.__assign({ id: this.id }, this.options);
},

@@ -104,6 +74,6 @@ enumerable: false,

if (shouldUpdate === void 0) { shouldUpdate = true; }
var mergedOptions = helper_1.getMergedProps(this.options, options);
var mergedOptions = actions_helper.getMergedProps(this.options, options);
this.options = mergedOptions;
if (shouldUpdate) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}

@@ -122,3 +92,9 @@ return this;

return ContextualSaveBar;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.ContextualSaveBar = ContextualSaveBar;
exports.discard = discard;
exports.hide = hide;
exports.save = save;
exports.show = show;
exports.update = update;

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.permissionAction = exports.isErrorEventName = exports.throwError = exports.invalidOriginAction = exports.fromAction = exports.AppBridgeError = exports.AppActionType = exports.Action = void 0;
var types_1 = require("../types");
var helper_1 = require("../helper");
'use strict';
var actions_types = require('../types.js');
var actions_helper = require('../helper.js');
// Errors triggered in response to an action
var Action;
exports.Action = void 0;
(function (Action) {

@@ -20,5 +20,5 @@ Action["INVALID_ACTION"] = "APP::ERROR::INVALID_ACTION";

Action["INVALID_ORIGIN"] = "APP::ERROR::INVALID_ORIGIN";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
// Errors thrown in response to app setup
var AppActionType;
exports.AppActionType = void 0;
(function (AppActionType) {

@@ -34,3 +34,3 @@ AppActionType["INVALID_CONFIG"] = "APP::ERROR::INVALID_CONFIG";

AppActionType["MISSING_HISTORY_BLOCK"] = "APP::APP_ERROR::MISSING_HISTORY_BLOCK";
})(AppActionType = exports.AppActionType || (exports.AppActionType = {}));
})(exports.AppActionType || (exports.AppActionType = {}));
var AppBridgeError = /** @class */ (function () {

@@ -49,3 +49,2 @@ function AppBridgeError(message) {

}());
exports.AppBridgeError = AppBridgeError;
AppBridgeError.prototype = Object.create(Error.prototype);

@@ -59,14 +58,12 @@ function fromAction(message, type, action) {

}
exports.fromAction = fromAction;
function invalidOriginAction(message) {
return helper_1.actionWrapper({
group: types_1.Group.Error,
return actions_helper.actionWrapper({
group: actions_types.Group.Error,
payload: {
message: message,
type: Action.INVALID_ORIGIN,
type: exports.Action.INVALID_ORIGIN,
},
type: Action.INVALID_ORIGIN,
type: exports.Action.INVALID_ORIGIN,
});
}
exports.invalidOriginAction = invalidOriginAction;
function throwError() {

@@ -89,13 +86,11 @@ var args = [];

}
exports.throwError = throwError;
function isErrorEventName(eventName) {
var match = helper_1.findMatchInEnum(Action, eventName);
var match = actions_helper.findMatchInEnum(exports.Action, eventName);
return typeof match === 'string';
}
exports.isErrorEventName = isErrorEventName;
function errorActionWrapperWithId(type, action, message) {
var castPayload = action.payload;
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
type: type,
group: types_1.Group.Error,
group: actions_types.Group.Error,
payload: {

@@ -110,4 +105,10 @@ action: action,

function permissionAction(action, message) {
return errorActionWrapperWithId(Action.PERMISSION, action, message || 'Action is not permitted');
return errorActionWrapperWithId(exports.Action.PERMISSION, action, message || 'Action is not permitted');
}
exports.AppBridgeError = AppBridgeError;
exports.fromAction = fromAction;
exports.invalidOriginAction = invalidOriginAction;
exports.isErrorEventName = isErrorEventName;
exports.permissionAction = permissionAction;
exports.throwError = throwError;

@@ -1,14 +0,12 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./actions"), exports);
__exportStar(require("./types"), exports);
'use strict';
var actions = require('../../packages/app-bridge-core/src/actions/Features/actions.js');
var types = require('../../packages/app-bridge-core/src/actions/Features/types.js');
exports.Features = actions.Features;
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return types.Action; }
});

@@ -1,33 +0,8 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.create = exports.FeedbackModal = exports.close = exports.open = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
/**

@@ -37,23 +12,21 @@ * Action for the Feedback Modal group

*/
var Action;
exports.Action = void 0;
(function (Action) {
Action["OPEN"] = "APP::FEEDBACK_MODAL::OPEN";
Action["CLOSE"] = "APP::FEEDBACK_MODAL::CLOSE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function open(payload) {
return helper_1.actionWrapper({
group: types_1.Group.FeedbackModal,
return actions_helper.actionWrapper({
group: actions_types.Group.FeedbackModal,
payload: payload,
type: Action.OPEN,
type: exports.Action.OPEN,
});
}
exports.open = open;
function close(payload) {
return helper_1.actionWrapper({
group: types_1.Group.FeedbackModal,
return actions_helper.actionWrapper({
group: actions_types.Group.FeedbackModal,
payload: payload,
type: Action.CLOSE,
type: exports.Action.CLOSE,
});
}
exports.close = close;
/**

@@ -63,3 +36,3 @@ * FeedbackModal action set

var FeedbackModal = /** @class */ (function (_super) {
__extends(FeedbackModal, _super);
tslib_es6.__extends(FeedbackModal, _super);
/**

@@ -70,3 +43,3 @@ * Returns a new instance of a FeedbackModal action set

function FeedbackModal(app, options) {
var _this = _super.call(this, app, types_1.Group.FeedbackModal, types_1.Group.FeedbackModal) || this;
var _this = _super.call(this, app, actions_types.Group.FeedbackModal, actions_types.Group.FeedbackModal) || this;
_this.options = options;

@@ -81,3 +54,3 @@ _this.set(options);

get: function () {
return __assign({ id: this.id }, this.options);
return tslib_es6.__assign({ id: this.id }, this.options);
},

@@ -88,3 +61,3 @@ enumerable: false,

FeedbackModal.prototype.set = function (options) {
this.options = helper_1.getMergedProps(this.options, options);
this.options = actions_helper.getMergedProps(this.options, options);
return this;

@@ -99,3 +72,3 @@ };

switch (action) {
case Action.OPEN: {
case exports.Action.OPEN: {
var openAction = open(this.payload);

@@ -105,3 +78,3 @@ this.app.dispatch(openAction);

}
case Action.CLOSE: {
case exports.Action.CLOSE: {
var closeAction = close(this.payload);

@@ -115,4 +88,3 @@ this.app.dispatch(closeAction);

return FeedbackModal;
}(ActionSet_1.ActionSet));
exports.FeedbackModal = FeedbackModal;
}(actions_ActionSet.ActionSet));
/**

@@ -125,2 +97,6 @@ * Returns a new instance of a FeedbackModal action set

}
exports.FeedbackModal = FeedbackModal;
exports.close = close;
exports.create = create;
exports.open = open;

@@ -1,22 +0,8 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Fullscreen = exports.exit = exports.enter = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
/**

@@ -28,21 +14,19 @@ * Fullscreen action type enum

*/
var Action;
exports.Action = void 0;
(function (Action) {
Action["ENTER"] = "APP::FULLSCREEN::ENTER";
Action["EXIT"] = "APP::FULLSCREEN::EXIT";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function enter() {
return helper_1.actionWrapper({
group: types_1.Group.Fullscreen,
type: Action.ENTER,
return actions_helper.actionWrapper({
group: actions_types.Group.Fullscreen,
type: exports.Action.ENTER,
});
}
exports.enter = enter;
function exit() {
return helper_1.actionWrapper({
group: types_1.Group.Fullscreen,
type: Action.EXIT,
return actions_helper.actionWrapper({
group: actions_types.Group.Fullscreen,
type: exports.Action.EXIT,
});
}
exports.exit = exit;
/**

@@ -53,3 +37,3 @@ * Fullscreen action set

var Fullscreen = /** @class */ (function (_super) {
__extends(Fullscreen, _super);
tslib_es6.__extends(Fullscreen, _super);
/**

@@ -60,3 +44,3 @@ * Returns a new instance of a Fullscreen action set

function Fullscreen(app) {
return _super.call(this, app, types_1.Group.Fullscreen, types_1.Group.Fullscreen) || this;
return _super.call(this, app, actions_types.Group.Fullscreen, actions_types.Group.Fullscreen) || this;
}

@@ -79,3 +63,3 @@ Object.defineProperty(Fullscreen.prototype, "payload", {

Fullscreen.prototype.dispatch = function (action) {
this.app.dispatch(helper_1.actionWrapper({
this.app.dispatch(actions_helper.actionWrapper({
group: this.group,

@@ -88,3 +72,6 @@ type: action,

return Fullscreen;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.Fullscreen = Fullscreen;
exports.enter = enter;
exports.exit = exit;

@@ -1,36 +0,32 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateActionFromPayload = exports.isValidOptionalString = exports.isValidOptionalNumber = exports.forEachInEnum = exports.getMergedProps = exports.findMatchInEnum = exports.getEventNameSpace = exports.NonSnakeCaseGroup = exports.actionWrapper = void 0;
var merge_1 = __importDefault(require("./merge"));
var constants_1 = require("./constants");
var types_1 = require("./types");
'use strict';
var actions_merge = require('./merge.js');
var actions_constants = require('./constants.js');
var actions_types = require('./types.js');
function actionWrapper(action) {
return action;
}
exports.actionWrapper = actionWrapper;
exports.NonSnakeCaseGroup = [
types_1.Group.AuthCode,
types_1.Group.Button,
types_1.Group.ButtonGroup,
types_1.Group.Cart,
types_1.Group.Error,
types_1.Group.Features,
types_1.Group.Fullscreen,
types_1.Group.Link,
types_1.Group.Loading,
types_1.Group.Menu,
types_1.Group.Modal,
types_1.Group.Navigation,
types_1.Group.Pos,
types_1.Group.Print,
types_1.Group.ResourcePicker,
types_1.Group.Scanner,
types_1.Group.SessionToken,
types_1.Group.Share,
types_1.Group.TitleBar,
types_1.Group.Toast,
types_1.Group.unstable_Picker,
var NonSnakeCaseGroup = [
actions_types.Group.AuthCode,
actions_types.Group.Button,
actions_types.Group.ButtonGroup,
actions_types.Group.Cart,
actions_types.Group.Error,
actions_types.Group.Features,
actions_types.Group.Fullscreen,
actions_types.Group.Link,
actions_types.Group.Loading,
actions_types.Group.Menu,
actions_types.Group.Modal,
actions_types.Group.Navigation,
actions_types.Group.Pos,
actions_types.Group.Print,
actions_types.Group.ResourcePicker,
actions_types.Group.Scanner,
actions_types.Group.SessionToken,
actions_types.Group.Share,
actions_types.Group.TitleBar,
actions_types.Group.Toast,
actions_types.Group.unstable_Picker,
];

@@ -50,3 +46,3 @@ function camelCaseToSnakeCase(value) {

function groupToEventNameSpace(group) {
if (exports.NonSnakeCaseGroup.includes(group)) {
if (NonSnakeCaseGroup.includes(group)) {
return group.toUpperCase();

@@ -61,3 +57,3 @@ }

function getEventNameSpace(group, eventName, component) {
if (eventName.startsWith("" + constants_1.PREFIX + constants_1.SEPARATOR)) {
if (eventName.startsWith("" + actions_constants.PREFIX + actions_constants.SEPARATOR)) {
return eventName;

@@ -69,17 +65,16 @@ }

if (subgroups_1 && subgroups_1.length > 0) {
eventNameSpace += eventNameSpace.length > 0 ? constants_1.SEPARATOR : '';
eventNameSpace += eventNameSpace.length > 0 ? actions_constants.SEPARATOR : '';
subgroups_1.forEach(function (subgroup, index) {
eventNameSpace += "" + subgroup.toUpperCase() + (index < subgroups_1.length - 1 ? constants_1.SEPARATOR : '');
eventNameSpace += "" + subgroup.toUpperCase() + (index < subgroups_1.length - 1 ? actions_constants.SEPARATOR : '');
});
}
if (type !== group && type) {
eventNameSpace += "" + (eventNameSpace.length > 0 ? constants_1.SEPARATOR : '') + type.toUpperCase();
eventNameSpace += "" + (eventNameSpace.length > 0 ? actions_constants.SEPARATOR : '') + type.toUpperCase();
}
}
if (eventNameSpace) {
eventNameSpace += "" + (eventNameSpace.length > 0 ? constants_1.SEPARATOR : '') + eventName.toUpperCase();
eventNameSpace += "" + (eventNameSpace.length > 0 ? actions_constants.SEPARATOR : '') + eventName.toUpperCase();
}
return "" + constants_1.PREFIX + constants_1.SEPARATOR + eventNameSpace;
return "" + actions_constants.PREFIX + actions_constants.SEPARATOR + eventNameSpace;
}
exports.getEventNameSpace = getEventNameSpace;
function findMatchInEnum(types, lookup) {

@@ -91,5 +86,4 @@ var match = Object.keys(types).find(function (key) {

}
exports.findMatchInEnum = findMatchInEnum;
function getMergedProps(props, newProps) {
var merged = merge_1.default(props, newProps);
var merged = actions_merge(props, newProps);
if (!merged) {

@@ -102,3 +96,2 @@ // tslint:disable-next-line:prefer-object-spread

}
exports.getMergedProps = getMergedProps;
function forEachInEnum(types, callback) {

@@ -109,11 +102,8 @@ Object.keys(types).forEach(function (key) {

}
exports.forEachInEnum = forEachInEnum;
function isValidOptionalNumber(value) {
return value === null || value === undefined || typeof value === 'number';
}
exports.isValidOptionalNumber = isValidOptionalNumber;
function isValidOptionalString(value) {
return value === null || value === undefined || typeof value === 'string';
}
exports.isValidOptionalString = isValidOptionalString;
function updateActionFromPayload(action, newProps) {

@@ -128,2 +118,11 @@ var id = action.id;

}
exports.NonSnakeCaseGroup = NonSnakeCaseGroup;
exports.actionWrapper = actionWrapper;
exports.findMatchInEnum = findMatchInEnum;
exports.forEachInEnum = forEachInEnum;
exports.getEventNameSpace = getEventNameSpace;
exports.getMergedProps = getMergedProps;
exports.isValidOptionalNumber = isValidOptionalNumber;
exports.isValidOptionalString = isValidOptionalString;
exports.updateActionFromPayload = updateActionFromPayload;

@@ -1,88 +0,76 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
'use strict';
var actions_Link_AppLink_index = require('./Link/AppLink/index.js');
var actions_AuthCode_index = require('./AuthCode/index.js');
var actions_Button_index = require('./Button/index.js');
var actions_ButtonGroup_index = require('./ButtonGroup/index.js');
var actions_Cart_index = require('./Cart/index.js');
var actions_Menu_ChannelMenu_index = require('./Menu/ChannelMenu/index.js');
var actions_Client_index = require('./Client/index.js');
var actions_ContextualSaveBar_index = require('./ContextualSaveBar/index.js');
var actions_Error_index = require('./Error/index.js');
var actions_Features_index = require('./Features/index.js');
var actions_FeedbackModal_index = require('./FeedbackModal/index.js');
var actions_Fullscreen_index = require('./Fullscreen/index.js');
var actions_Navigation_History_index = require('./Navigation/History/index.js');
var actions_LeaveConfirmation_index = require('./LeaveConfirmation/index.js');
var actions_Loading_index = require('./Loading/index.js');
var actions_MarketingExternalActivityTopBar_index = require('./MarketingExternalActivityTopBar/index.js');
var actions_Modal_index = require('./Modal/index.js');
var actions_Menu_NavigationMenu_index = require('./Menu/NavigationMenu/index.js');
var actions_Performance_index = require('./Performance/index.js');
var actions_Pos_index = require('./Pos/index.js');
var actions_Print_index = require('./Print/index.js');
var actions_Navigation_Redirect_index = require('./Navigation/Redirect/index.js');
var actions_ResourcePicker_index = require('./ResourcePicker/index.js');
var actions_Scanner_index = require('./Scanner/index.js');
var actions_SessionToken_index = require('./SessionToken/index.js');
var actions_Share_index = require('./Share/index.js');
var actions_TitleBar_index = require('./TitleBar/index.js');
var actions_Toast_index = require('./Toast/index.js');
var actions_Picker_index = require('./Picker/index.js');
var actions_WebVitals_index = require('./WebVitals/index.js');
var actions_validator = require('./validator.js');
var actions_types = require('./types.js');
exports.AppLink = actions_Link_AppLink_index;
exports.AuthCode = actions_AuthCode_index;
exports.Button = actions_Button_index;
exports.ButtonGroup = actions_ButtonGroup_index;
exports.Cart = actions_Cart_index;
exports.ChannelMenu = actions_Menu_ChannelMenu_index;
exports.Client = actions_Client_index;
exports.ContextualSaveBar = actions_ContextualSaveBar_index;
exports.Error = actions_Error_index;
exports.Features = actions_Features_index;
exports.FeedbackModal = actions_FeedbackModal_index;
exports.Fullscreen = actions_Fullscreen_index;
exports.History = actions_Navigation_History_index;
exports.LeaveConfirmation = actions_LeaveConfirmation_index;
exports.Loading = actions_Loading_index;
exports.MarketingExternalActivityTopBar = actions_MarketingExternalActivityTopBar_index;
exports.Modal = actions_Modal_index;
exports.NavigationMenu = actions_Menu_NavigationMenu_index;
exports.Performance = actions_Performance_index;
exports.Pos = actions_Pos_index;
exports.Print = actions_Print_index;
exports.Redirect = actions_Navigation_Redirect_index;
exports.ResourcePicker = actions_ResourcePicker_index;
exports.Scanner = actions_Scanner_index;
exports.SessionToken = actions_SessionToken_index;
exports.Share = actions_Share_index;
exports.TitleBar = actions_TitleBar_index;
exports.Toast = actions_Toast_index;
exports.unstable_Picker = actions_Picker_index;
exports.WebVitals = actions_WebVitals_index;
exports.isAppBridgeAction = actions_validator.isAppBridgeAction;
Object.defineProperty(exports, "ComponentType", {
enumerable: true,
get: function () { return actions_types.ComponentType; }
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebVitals = exports.unstable_Picker = exports.Toast = exports.TitleBar = exports.Share = exports.SessionToken = exports.Scanner = exports.ResourcePicker = exports.Redirect = exports.Print = exports.Pos = exports.Performance = exports.NavigationMenu = exports.Modal = exports.MarketingExternalActivityTopBar = exports.Loading = exports.LeaveConfirmation = exports.History = exports.Fullscreen = exports.FeedbackModal = exports.Features = exports.Error = exports.ContextualSaveBar = exports.Client = exports.ChannelMenu = exports.Cart = exports.ButtonGroup = exports.Button = exports.AuthCode = exports.AppLink = exports.isAppBridgeAction = void 0;
var AppLink = __importStar(require("./Link/AppLink"));
exports.AppLink = AppLink;
var AuthCode = __importStar(require("./AuthCode"));
exports.AuthCode = AuthCode;
var Button = __importStar(require("./Button"));
exports.Button = Button;
var ButtonGroup = __importStar(require("./ButtonGroup"));
exports.ButtonGroup = ButtonGroup;
var Cart = __importStar(require("./Cart"));
exports.Cart = Cart;
var ChannelMenu = __importStar(require("./Menu/ChannelMenu"));
exports.ChannelMenu = ChannelMenu;
var Client = __importStar(require("./Client"));
exports.Client = Client;
var ContextualSaveBar = __importStar(require("./ContextualSaveBar"));
exports.ContextualSaveBar = ContextualSaveBar;
var Error = __importStar(require("./Error"));
exports.Error = Error;
var Features = __importStar(require("./Features"));
exports.Features = Features;
var FeedbackModal = __importStar(require("./FeedbackModal"));
exports.FeedbackModal = FeedbackModal;
var Fullscreen = __importStar(require("./Fullscreen"));
exports.Fullscreen = Fullscreen;
var History = __importStar(require("./Navigation/History"));
exports.History = History;
var LeaveConfirmation = __importStar(require("./LeaveConfirmation"));
exports.LeaveConfirmation = LeaveConfirmation;
var Loading = __importStar(require("./Loading"));
exports.Loading = Loading;
var MarketingExternalActivityTopBar = __importStar(require("./MarketingExternalActivityTopBar"));
exports.MarketingExternalActivityTopBar = MarketingExternalActivityTopBar;
var Modal = __importStar(require("./Modal"));
exports.Modal = Modal;
var NavigationMenu = __importStar(require("./Menu/NavigationMenu"));
exports.NavigationMenu = NavigationMenu;
var Performance = __importStar(require("./Performance"));
exports.Performance = Performance;
var Pos = __importStar(require("./Pos"));
exports.Pos = Pos;
var Print = __importStar(require("./Print"));
exports.Print = Print;
var Redirect = __importStar(require("./Navigation/Redirect"));
exports.Redirect = Redirect;
var ResourcePicker = __importStar(require("./ResourcePicker"));
exports.ResourcePicker = ResourcePicker;
var Scanner = __importStar(require("./Scanner"));
exports.Scanner = Scanner;
var SessionToken = __importStar(require("./SessionToken"));
exports.SessionToken = SessionToken;
var Share = __importStar(require("./Share"));
exports.Share = Share;
var TitleBar = __importStar(require("./TitleBar"));
exports.TitleBar = TitleBar;
var Toast = __importStar(require("./Toast"));
exports.Toast = Toast;
var unstable_Picker = __importStar(require("./Picker"));
exports.unstable_Picker = unstable_Picker;
var WebVitals = __importStar(require("./WebVitals"));
exports.WebVitals = WebVitals;
var validator_1 = require("./validator");
Object.defineProperty(exports, "isAppBridgeAction", { enumerable: true, get: function () { return validator_1.isAppBridgeAction; } });
__exportStar(require("./types"), exports);
Object.defineProperty(exports, "Group", {
enumerable: true,
get: function () { return actions_types.Group; }
});

@@ -1,33 +0,8 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LeaveConfirmation = exports.confirm = exports.disable = exports.enable = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
/**

@@ -37,3 +12,3 @@ * Action for the Leave Confirmation group

*/
var Action;
exports.Action = void 0;
(function (Action) {

@@ -43,30 +18,27 @@ Action["ENABLE"] = "APP::LEAVE_CONFIRMATION::ENABLE";

Action["CONFIRM"] = "APP::LEAVE_CONFIRMATION::CONFIRM";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function enable(payload) {
if (payload === void 0) { payload = {}; }
return helper_1.actionWrapper({
group: types_1.Group.LeaveConfirmation,
return actions_helper.actionWrapper({
group: actions_types.Group.LeaveConfirmation,
payload: payload,
type: Action.ENABLE,
type: exports.Action.ENABLE,
});
}
exports.enable = enable;
function disable(payload) {
if (payload === void 0) { payload = {}; }
return helper_1.actionWrapper({
group: types_1.Group.LeaveConfirmation,
return actions_helper.actionWrapper({
group: actions_types.Group.LeaveConfirmation,
payload: payload,
type: Action.DISABLE,
type: exports.Action.DISABLE,
});
}
exports.disable = disable;
function confirm(payload) {
if (payload === void 0) { payload = {}; }
return helper_1.actionWrapper({
group: types_1.Group.LeaveConfirmation,
return actions_helper.actionWrapper({
group: actions_types.Group.LeaveConfirmation,
payload: payload,
type: Action.CONFIRM,
type: exports.Action.CONFIRM,
});
}
exports.confirm = confirm;
/**

@@ -76,3 +48,3 @@ * Leave Confirmation action set

var LeaveConfirmation = /** @class */ (function (_super) {
__extends(LeaveConfirmation, _super);
tslib_es6.__extends(LeaveConfirmation, _super);
/**

@@ -84,3 +56,3 @@ * Returns a new instance of a Leave Confirmation action set

if (options === void 0) { options = {}; }
var _this = _super.call(this, app, types_1.Group.LeaveConfirmation, types_1.Group.LeaveConfirmation) || this;
var _this = _super.call(this, app, actions_types.Group.LeaveConfirmation, actions_types.Group.LeaveConfirmation) || this;
_this.options = options;

@@ -95,3 +67,3 @@ _this.set(options);

get: function () {
return __assign({ id: this.id }, this.options);
return tslib_es6.__assign({ id: this.id }, this.options);
},

@@ -102,3 +74,3 @@ enumerable: false,

LeaveConfirmation.prototype.set = function (options) {
this.options = helper_1.getMergedProps(this.options, options);
this.options = actions_helper.getMergedProps(this.options, options);
return this;

@@ -113,3 +85,3 @@ };

switch (action) {
case Action.ENABLE: {
case exports.Action.ENABLE: {
var enableAction = enable(this.payload);

@@ -119,3 +91,3 @@ this.app.dispatch(enableAction);

}
case Action.DISABLE: {
case exports.Action.DISABLE: {
var disableAction = disable(this.payload);

@@ -125,3 +97,3 @@ this.app.dispatch(disableAction);

}
case Action.CONFIRM: {
case exports.Action.CONFIRM: {
var confirmAction = confirm(this.payload);

@@ -135,3 +107,7 @@ this.app.dispatch(confirmAction);

return LeaveConfirmation;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.LeaveConfirmation = LeaveConfirmation;
exports.confirm = confirm;
exports.disable = disable;
exports.enable = enable;

@@ -1,53 +0,27 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppLink = exports.update = exports.Action = void 0;
var helper_1 = require("../../helper");
var ActionSet_1 = require("../../ActionSet");
var types_1 = require("../../types");
var Redirect_1 = require("../../Navigation/Redirect");
var Action;
'use strict';
var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../../helper.js');
var actions_ActionSet = require('../../ActionSet.js');
var actions_types = require('../../types.js');
var actions_Navigation_Redirect_index = require('../../Navigation/Redirect/index.js');
exports.Action = void 0;
(function (Action) {
Action["UPDATE"] = "UPDATE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function update(group, component, updatePayload) {
var id = component.id;
var label = updatePayload.label, destination = updatePayload.destination;
var linkPayload = __assign(__assign({}, updatePayload), { id: id, label: label, destination: destination });
return helper_1.actionWrapper({
var linkPayload = tslib_es6.__assign(tslib_es6.__assign({}, updatePayload), { id: id, label: label, destination: destination });
return actions_helper.actionWrapper({
group: group,
type: helper_1.getEventNameSpace(group, Action.UPDATE, component),
type: actions_helper.getEventNameSpace(group, exports.Action.UPDATE, component),
payload: linkPayload,
});
}
exports.update = update;
var AppLink = /** @class */ (function (_super) {
__extends(AppLink, _super);
tslib_es6.__extends(AppLink, _super);
function AppLink(app, options) {
var _this = _super.call(this, app, types_1.Group.Link, types_1.Group.Link) || this;
var _this = _super.call(this, app, actions_types.Group.Link, actions_types.Group.Link) || this;
_this.label = '';

@@ -64,3 +38,3 @@ _this.destination = '';

destination: destination,
redirectType: Redirect_1.Action.APP,
redirectType: actions_Navigation_Redirect_index.Action.APP,
};

@@ -87,7 +61,7 @@ },

if (shouldUpdate === void 0) { shouldUpdate = true; }
var _a = helper_1.getMergedProps(this.options, options), label = _a.label, destination = _a.destination;
var _a = actions_helper.getMergedProps(this.options, options), label = _a.label, destination = _a.destination;
this.label = label;
this.destination = destination;
if (shouldUpdate) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}

@@ -98,3 +72,3 @@ return this;

switch (action) {
case Action.UPDATE: {
case exports.Action.UPDATE: {
var updateAction = update(this.group, this.component, this.payload);

@@ -108,3 +82,5 @@ this.app.dispatch(updateAction);

return AppLink;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.AppLink = AppLink;
exports.update = update;

@@ -1,47 +0,31 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Loading = exports.stop = exports.start = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
var Action;
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {
Action["START"] = "APP::LOADING::START";
Action["STOP"] = "APP::LOADING::STOP";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function start(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Loading,
type: Action.START,
group: actions_types.Group.Loading,
type: exports.Action.START,
});
}
exports.start = start;
function stop(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Loading,
type: Action.STOP,
group: actions_types.Group.Loading,
type: exports.Action.STOP,
});
}
exports.stop = stop;
var Loading = /** @class */ (function (_super) {
__extends(Loading, _super);
tslib_es6.__extends(Loading, _super);
function Loading(app) {
return _super.call(this, app, types_1.Group.Loading, types_1.Group.Loading) || this;
return _super.call(this, app, actions_types.Group.Loading, actions_types.Group.Loading) || this;
}

@@ -57,6 +41,6 @@ Object.defineProperty(Loading.prototype, "payload", {

switch (action) {
case Action.START:
case exports.Action.START:
this.app.dispatch(start(this.payload));
break;
case Action.STOP:
case exports.Action.STOP:
this.app.dispatch(stop(this.payload));

@@ -68,3 +52,6 @@ break;

return Loading;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.Loading = Loading;
exports.start = start;
exports.stop = stop;

@@ -1,5 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
exports.Action = void 0;
var Action;
(function (Action) {

@@ -9,2 +8,2 @@ Action["UPDATE"] = "APP::MARKETING_EXTERNAL_ACTIVITY_TOP_BAR::UPDATE";

Action["BUTTON_UPDATE"] = "APP::MARKETING_EXTERNAL_ACTIVITY_TOP_BAR::BUTTONS::BUTTON::UPDATE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));

@@ -1,52 +0,26 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChannelMenu = exports.update = exports.Action = void 0;
var AppLink_1 = require("../../Link/AppLink");
var helper_1 = require("../../helper");
var ActionSet_1 = require("../../ActionSet");
var types_1 = require("../../types");
'use strict';
var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
var actions_Link_AppLink_index = require('../../Link/AppLink/index.js');
var actions_helper = require('../../helper.js');
var actions_ActionSet = require('../../ActionSet.js');
var actions_types = require('../../types.js');
var SUBGROUPS = ['Channel_Menu'];
var Action;
exports.Action = void 0;
(function (Action) {
Action["UPDATE"] = "APP::MENU::CHANNEL_MENU::UPDATE";
Action["LINK_UPDATE"] = "APP::MENU::CHANNEL_MENU::LINK::UPDATE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function update(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Menu,
type: Action.UPDATE,
group: actions_types.Group.Menu,
type: exports.Action.UPDATE,
});
}
exports.update = update;
var ChannelMenu = /** @class */ (function (_super) {
__extends(ChannelMenu, _super);
tslib_es6.__extends(ChannelMenu, _super);
function ChannelMenu(app, options) {
var _this = _super.call(this, app, 'Channel_Menu', types_1.Group.Menu) || this;
var _this = _super.call(this, app, 'Channel_Menu', actions_types.Group.Menu) || this;
_this.items = [];

@@ -69,3 +43,3 @@ // Trigger 'update' on creation

get: function () {
return __assign(__assign({}, this.options), { active: this.active, items: this.items, id: this.id });
return tslib_es6.__assign(tslib_es6.__assign({}, this.options), { active: this.active, items: this.items, id: this.id });
},

@@ -77,3 +51,3 @@ enumerable: false,

if (shouldUpdate === void 0) { shouldUpdate = true; }
var mergedOptions = helper_1.getMergedProps(this.options, options);
var mergedOptions = actions_helper.getMergedProps(this.options, options);
var items = mergedOptions.items, active = mergedOptions.active;

@@ -84,3 +58,3 @@ this.setItems(items);

if (shouldUpdate) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}

@@ -91,3 +65,3 @@ return this;

switch (action) {
case Action.UPDATE:
case exports.Action.UPDATE:
this.app.dispatch(update(this.payload));

@@ -106,4 +80,4 @@ break;

}
if (helper_1.updateActionFromPayload(itemToUpdate, newPayload)) {
this.dispatch(Action.UPDATE);
if (actions_helper.updateActionFromPayload(itemToUpdate, newPayload)) {
this.dispatch(exports.Action.UPDATE);
}

@@ -119,3 +93,3 @@ };

_this.addChild(action, _this.group, SUBGROUPS);
_this.subscribeToChild(action, AppLink_1.Action.UPDATE, _this.updateItem);
_this.subscribeToChild(action, actions_Link_AppLink_index.Action.UPDATE, _this.updateItem);
return action.payload;

@@ -126,3 +100,5 @@ })

return ChannelMenu;
}(ActionSet_1.ActionSetWithChildren));
}(actions_ActionSet.ActionSetWithChildren));
exports.ChannelMenu = ChannelMenu;
exports.update = update;

@@ -1,52 +0,26 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NavigationMenu = exports.update = exports.Action = void 0;
var AppLink_1 = require("../../Link/AppLink");
var helper_1 = require("../../helper");
var ActionSet_1 = require("../../ActionSet");
var types_1 = require("../../types");
'use strict';
var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
var actions_Link_AppLink_index = require('../../Link/AppLink/index.js');
var actions_helper = require('../../helper.js');
var actions_ActionSet = require('../../ActionSet.js');
var actions_types = require('../../types.js');
var SUBGROUPS = ['Navigation_Menu'];
var Action;
exports.Action = void 0;
(function (Action) {
Action["UPDATE"] = "APP::MENU::NAVIGATION_MENU::UPDATE";
Action["LINK_UPDATE"] = "APP::MENU::NAVIGATION_MENU::LINK::UPDATE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function update(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Menu,
type: Action.UPDATE,
group: actions_types.Group.Menu,
type: exports.Action.UPDATE,
});
}
exports.update = update;
var NavigationMenu = /** @class */ (function (_super) {
__extends(NavigationMenu, _super);
tslib_es6.__extends(NavigationMenu, _super);
function NavigationMenu(app, options) {
var _this = _super.call(this, app, 'Navigation_Menu', types_1.Group.Menu) || this;
var _this = _super.call(this, app, 'Navigation_Menu', actions_types.Group.Menu) || this;
_this.items = [];

@@ -69,3 +43,3 @@ // Trigger 'update' on creation

get: function () {
return __assign(__assign({}, this.options), { active: this.active, items: this.items, id: this.id });
return tslib_es6.__assign(tslib_es6.__assign({}, this.options), { active: this.active, items: this.items, id: this.id });
},

@@ -77,3 +51,3 @@ enumerable: false,

if (shouldUpdate === void 0) { shouldUpdate = true; }
var mergedOptions = helper_1.getMergedProps(this.options, options);
var mergedOptions = actions_helper.getMergedProps(this.options, options);
var items = mergedOptions.items, active = mergedOptions.active;

@@ -84,3 +58,3 @@ this.setItems(items);

if (shouldUpdate) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}

@@ -91,3 +65,3 @@ return this;

switch (action) {
case Action.UPDATE:
case exports.Action.UPDATE:
this.app.dispatch(update(this.payload));

@@ -106,4 +80,4 @@ break;

}
if (helper_1.updateActionFromPayload(itemToUpdate, newPayload)) {
this.dispatch(Action.UPDATE);
if (actions_helper.updateActionFromPayload(itemToUpdate, newPayload)) {
this.dispatch(exports.Action.UPDATE);
}

@@ -119,3 +93,3 @@ };

_this.addChild(action, _this.group, SUBGROUPS);
_this.subscribeToChild(action, AppLink_1.Action.UPDATE, _this.updateItem);
_this.subscribeToChild(action, actions_Link_AppLink_index.Action.UPDATE, _this.updateItem);
return action.payload;

@@ -126,3 +100,5 @@ })

return NavigationMenu;
}(ActionSet_1.ActionSetWithChildren));
}(actions_ActionSet.ActionSetWithChildren));
exports.NavigationMenu = NavigationMenu;
exports.update = update;

@@ -11,2 +11,1 @@ export interface Indexable {

export default function mergeProps<T extends Indexable, T2 extends Indexable>(obj: T, newObj: T2): T | T2;
export { mergeProps };

@@ -1,4 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeProps = void 0;
'use strict';
/**

@@ -44,3 +43,3 @@ * Returns a deeply merged object with properties from the 2 provided objects

}
exports.default = mergeProps;
exports.mergeProps = mergeProps;
module.exports = mergeProps;

@@ -1,36 +0,11 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModalIframe = exports.ModalMessage = exports.Modal = exports.isMessageModal = exports.isIframeModal = exports.data = exports.update = exports.clickFooterButton = exports.updateModalSize = exports.closeModal = exports.openModal = exports.Size = exports.Action = void 0;
var buttonHelper_1 = require("../buttonHelper");
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
var Button_1 = require("../Button");
var Action;
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_buttonHelper = require('../buttonHelper.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
var actions_Button_index = require('../Button/index.js');
exports.Action = void 0;
(function (Action) {

@@ -45,3 +20,3 @@ Action["OPEN"] = "APP::MODAL::OPEN";

Action["DATA"] = "APP::MODAL::DATA";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
/**

@@ -51,3 +26,3 @@ * Options available to the Modal `size` param

*/
var Size;
exports.Size = void 0;
(function (Size) {

@@ -68,24 +43,22 @@ /** Small modal size */

Size["Auto"] = "auto";
})(Size = exports.Size || (exports.Size = {}));
})(exports.Size || (exports.Size = {}));
var FOOTER_BUTTON_PROPS = {
group: types_1.Group.Modal,
group: actions_types.Group.Modal,
subgroups: ['Footer'],
type: types_1.ComponentType.Button,
type: actions_types.ComponentType.Button,
};
function openModal(modalPayload) {
return helper_1.actionWrapper({
group: types_1.Group.Modal,
return actions_helper.actionWrapper({
group: actions_types.Group.Modal,
payload: modalPayload,
type: Action.OPEN,
type: exports.Action.OPEN,
});
}
exports.openModal = openModal;
function closeModal(modalClosePayload) {
return helper_1.actionWrapper({
group: types_1.Group.Modal,
return actions_helper.actionWrapper({
group: actions_types.Group.Modal,
payload: modalClosePayload,
type: Action.CLOSE,
type: exports.Action.CLOSE,
});
}
exports.closeModal = closeModal;
/**

@@ -96,30 +69,26 @@ * Action creator for modal update size action

function updateModalSize(updateSizePayload) {
return helper_1.actionWrapper({
group: types_1.Group.Modal,
return actions_helper.actionWrapper({
group: actions_types.Group.Modal,
payload: updateSizePayload,
type: Action.UPDATE_SIZE,
type: exports.Action.UPDATE_SIZE,
});
}
exports.updateModalSize = updateModalSize;
function clickFooterButton(id, payload) {
var component = __assign({ id: id }, FOOTER_BUTTON_PROPS);
return Button_1.clickButton(types_1.Group.Modal, component, payload);
var component = tslib_es6.__assign({ id: id }, FOOTER_BUTTON_PROPS);
return actions_Button_index.clickButton(actions_types.Group.Modal, component, payload);
}
exports.clickFooterButton = clickFooterButton;
function update(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Modal,
type: Action.UPDATE,
group: actions_types.Group.Modal,
type: exports.Action.UPDATE,
});
}
exports.update = update;
function data(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Modal,
type: Action.DATA,
group: actions_types.Group.Modal,
type: exports.Action.DATA,
});
}
exports.data = data;
function isIframeModal(options) {

@@ -129,12 +98,10 @@ return (typeof options.url === 'string' ||

}
exports.isIframeModal = isIframeModal;
function isMessageModal(options) {
return typeof options.message === 'string';
}
exports.isMessageModal = isMessageModal;
var Modal = /** @class */ (function (_super) {
__extends(Modal, _super);
tslib_es6.__extends(Modal, _super);
function Modal() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.size = Size.Small;
_this.size = exports.Size.Small;
return _this;

@@ -180,3 +147,3 @@ }

this.footerPrimary = this.footerPrimaryOptions
? buttonHelper_1.getSingleButton(this, this.footerPrimaryOptions, subgroups, function (newPayload) {
? actions_buttonHelper.getSingleButton(this, this.footerPrimaryOptions, subgroups, function (newPayload) {
_this.updatePrimaryFooterButton(newPayload, updateCb);

@@ -194,3 +161,3 @@ })

? this.footerSecondaryOptions.map(function (action) {
return buttonHelper_1.getSingleButton(_this, action, subgroups, function (newPayload) {
return actions_buttonHelper.getSingleButton(_this, action, subgroups, function (newPayload) {
_this.updateSecondaryFooterButton(newPayload, updateCb);

@@ -211,3 +178,3 @@ });

}
if (helper_1.updateActionFromPayload(this.footer.buttons.primary, newPayload)) {
if (actions_helper.updateActionFromPayload(this.footer.buttons.primary, newPayload)) {
updateCb();

@@ -223,3 +190,3 @@ }

var action = _a[_i];
updated = helper_1.updateActionFromPayload(action, newPayload);
updated = actions_helper.updateActionFromPayload(action, newPayload);
if (updated) {

@@ -234,8 +201,7 @@ break;

return Modal;
}(ActionSet_1.ActionSetWithChildren));
exports.Modal = Modal;
}(actions_ActionSet.ActionSetWithChildren));
var ModalMessage = /** @class */ (function (_super) {
__extends(ModalMessage, _super);
tslib_es6.__extends(ModalMessage, _super);
function ModalMessage(app, options) {
var _this = _super.call(this, app, types_1.Group.Modal, types_1.Group.Modal) || this;
var _this = _super.call(this, app, actions_types.Group.Modal, actions_types.Group.Modal) || this;
_this.set(options, false);

@@ -246,3 +212,3 @@ return _this;

get: function () {
return __assign(__assign({}, this.options), { footer: this.footer, id: this.id });
return tslib_es6.__assign(tslib_es6.__assign({}, this.options), { footer: this.footer, id: this.id });
},

@@ -267,3 +233,3 @@ enumerable: false,

if (shouldUpdate === void 0) { shouldUpdate = true; }
var mergedOptions = helper_1.getMergedProps(this.options, options);
var mergedOptions = actions_helper.getMergedProps(this.options, options);
var title = mergedOptions.title, footer = mergedOptions.footer, message = mergedOptions.message, size = mergedOptions.size;

@@ -274,9 +240,9 @@ this.title = title;

this.setFooterPrimaryButton(footer ? footer.buttons.primary : undefined, function () {
_this.dispatch(Action.UPDATE);
_this.dispatch(exports.Action.UPDATE);
});
this.setFooterSecondaryButtons(footer ? footer.buttons.secondary : undefined, function () {
_this.dispatch(Action.UPDATE);
_this.dispatch(exports.Action.UPDATE);
});
if (shouldUpdate) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}

@@ -287,9 +253,9 @@ return this;

switch (action) {
case Action.OPEN:
case exports.Action.OPEN:
this.app.dispatch(openModal(this.payload));
break;
case Action.CLOSE:
case exports.Action.CLOSE:
this.close();
break;
case Action.UPDATE:
case exports.Action.UPDATE:
this.app.dispatch(update(this.payload));

@@ -302,7 +268,6 @@ break;

}(Modal));
exports.ModalMessage = ModalMessage;
var ModalIframe = /** @class */ (function (_super) {
__extends(ModalIframe, _super);
tslib_es6.__extends(ModalIframe, _super);
function ModalIframe(app, options) {
var _this = _super.call(this, app, types_1.Group.Modal, types_1.Group.Modal) || this;
var _this = _super.call(this, app, actions_types.Group.Modal, actions_types.Group.Modal) || this;
_this.set(options, false);

@@ -313,3 +278,3 @@ return _this;

get: function () {
return __assign(__assign({}, this.options), { footer: this.footer, id: this.id });
return tslib_es6.__assign(tslib_es6.__assign({}, this.options), { footer: this.footer, id: this.id });
},

@@ -336,3 +301,3 @@ enumerable: false,

if (shouldUpdate === void 0) { shouldUpdate = true; }
var mergedOptions = helper_1.getMergedProps(this.options, options);
var mergedOptions = actions_helper.getMergedProps(this.options, options);
var title = mergedOptions.title, footer = mergedOptions.footer, path = mergedOptions.path, url = mergedOptions.url, size = mergedOptions.size, loading = mergedOptions.loading;

@@ -345,9 +310,9 @@ this.title = title;

this.setFooterPrimaryButton(footer ? footer.buttons.primary : undefined, function () {
_this.dispatch(Action.UPDATE);
_this.dispatch(exports.Action.UPDATE);
});
this.setFooterSecondaryButtons(footer ? footer.buttons.secondary : undefined, function () {
_this.dispatch(Action.UPDATE);
_this.dispatch(exports.Action.UPDATE);
});
if (shouldUpdate) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}

@@ -358,12 +323,12 @@ return this;

switch (action) {
case Action.OPEN:
case exports.Action.OPEN:
this.app.dispatch(openModal(this.payload));
break;
case Action.CLOSE:
case exports.Action.CLOSE:
this.close();
break;
case Action.UPDATE:
case exports.Action.UPDATE:
this.app.dispatch(update(this.payload));
break;
case Action.DATA:
case exports.Action.DATA:
this.app.dispatch(data(payload || {}));

@@ -376,2 +341,13 @@ break;

}(Modal));
exports.Modal = Modal;
exports.ModalIframe = ModalIframe;
exports.ModalMessage = ModalMessage;
exports.clickFooterButton = clickFooterButton;
exports.closeModal = closeModal;
exports.data = data;
exports.isIframeModal = isIframeModal;
exports.isMessageModal = isMessageModal;
exports.openModal = openModal;
exports.update = update;
exports.updateModalSize = updateModalSize;

@@ -1,75 +0,14 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModalContent = exports.Action = void 0;
var helper_1 = require("../../helper");
var ActionSet_1 = require("../../ActionSet");
var types_1 = require("../../types");
var index_1 = require("../index");
var Action;
'use strict';
var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../../helper.js');
var actions_ActionSet = require('../../ActionSet.js');
var actions_types = require('../../types.js');
var actions_Modal_index = require('../index.js');
exports.Action = void 0;
(function (Action) {
Action["LOADING"] = "LOADING";
Action["LOADED"] = "LOADED";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
/**

@@ -80,11 +19,11 @@ * A set of Actions for updating the modal component

var ModalContent = /** @class */ (function (_super) {
__extends(ModalContent, _super);
tslib_es6.__extends(ModalContent, _super);
function ModalContent(app, options) {
return _super.call(this, app, types_1.Group.Modal, types_1.Group.Modal, options ? options.id : undefined) || this;
return _super.call(this, app, actions_types.Group.Modal, actions_types.Group.Modal, options ? options.id : undefined) || this;
}
ModalContent.prototype.loaded = function () {
this.dispatch(Action.LOADED);
this.dispatch(exports.Action.LOADED);
};
ModalContent.prototype.loading = function () {
this.dispatch(Action.LOADING);
this.dispatch(exports.Action.LOADING);
};

@@ -96,7 +35,7 @@ /**

switch (action) {
case Action.LOADED:
this.dispatchModalAction(index_1.Action.UPDATE_CONTENT, { loading: false });
case exports.Action.LOADED:
this.dispatchModalAction(actions_Modal_index.Action.UPDATE_CONTENT, { loading: false });
break;
case Action.LOADING:
this.dispatchModalAction(index_1.Action.UPDATE_CONTENT, { loading: true });
case exports.Action.LOADING:
this.dispatchModalAction(actions_Modal_index.Action.UPDATE_CONTENT, { loading: true });
break;

@@ -110,9 +49,9 @@ }

ModalContent.prototype.dispatchModalAction = function (type, payload) {
return __awaiter(this, void 0, void 0, function () {
return tslib_es6.__awaiter(this, void 0, void 0, function () {
var updateAction;
return __generator(this, function (_a) {
updateAction = helper_1.actionWrapper({
return tslib_es6.__generator(this, function (_a) {
updateAction = actions_helper.actionWrapper({
type: type,
group: types_1.Group.Modal,
payload: __assign({}, payload),
group: actions_types.Group.Modal,
payload: tslib_es6.__assign({}, payload),
});

@@ -125,3 +64,4 @@ this.app.dispatch(updateAction);

return ModalContent;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.ModalContent = ModalContent;

@@ -1,58 +0,31 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.History = exports.replace = exports.push = exports.Action = void 0;
var helper_1 = require("../../helper");
var ActionSet_1 = require("../../ActionSet");
var types_1 = require("../../types");
var Action;
'use strict';
var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../../helper.js');
var actions_ActionSet = require('../../ActionSet.js');
var actions_types = require('../../types.js');
exports.Action = void 0;
(function (Action) {
Action["PUSH"] = "APP::NAVIGATION::HISTORY::PUSH";
Action["REPLACE"] = "APP::NAVIGATION::HISTORY::REPLACE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function push(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Navigation,
type: Action.PUSH,
group: actions_types.Group.Navigation,
type: exports.Action.PUSH,
});
}
exports.push = push;
function replace(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Navigation,
type: Action.REPLACE,
group: actions_types.Group.Navigation,
type: exports.Action.REPLACE,
});
}
exports.replace = replace;
var History = /** @class */ (function (_super) {
__extends(History, _super);
tslib_es6.__extends(History, _super);
function History(app) {
return _super.call(this, app, 'History', types_1.Group.Navigation) || this;
return _super.call(this, app, 'History', actions_types.Group.Navigation) || this;
}

@@ -67,8 +40,8 @@ Object.defineProperty(History.prototype, "payload", {

History.prototype.dispatch = function (type, path) {
var payload = __assign(__assign({}, this.payload), { path: path });
var payload = tslib_es6.__assign(tslib_es6.__assign({}, this.payload), { path: path });
switch (type) {
case Action.PUSH:
case exports.Action.PUSH:
this.app.dispatch(push(payload));
break;
case Action.REPLACE:
case exports.Action.REPLACE:
this.app.dispatch(replace(payload));

@@ -80,3 +53,6 @@ break;

return History;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.History = History;
exports.push = push;
exports.replace = replace;

@@ -1,34 +0,9 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Redirect = exports.isProductVariantResourcePayload = exports.isCreateResourcePayload = exports.isAdminSection = exports.isRemotePayload = exports.isAdminSectionPayload = exports.isAdminPathPayload = exports.isAppPayload = exports.getRelativePath = exports.normalizeUrl = exports.getPathWithSearchAndHash = exports.toDestination = exports.toApp = exports.toRemote = exports.toAdminSection = exports.toAdminPath = exports.isResourcePayload = exports.ResourceType = exports.Action = void 0;
var helper_1 = require("../../helper");
var ActionSet_1 = require("../../ActionSet");
var types_1 = require("../../types");
var Action;
'use strict';
var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../../helper.js');
var actions_ActionSet = require('../../ActionSet.js');
var actions_types = require('../../types.js');
exports.Action = void 0;
(function (Action) {

@@ -39,4 +14,4 @@ Action["ADMIN_SECTION"] = "APP::NAVIGATION::REDIRECT::ADMIN::SECTION";

Action["APP"] = "APP::NAVIGATION::REDIRECT::APP";
})(Action = exports.Action || (exports.Action = {}));
var ResourceType;
})(exports.Action || (exports.Action = {}));
exports.ResourceType = void 0;
(function (ResourceType) {

@@ -48,3 +23,3 @@ ResourceType["Product"] = "products";

ResourceType["Discount"] = "discounts";
})(ResourceType = exports.ResourceType || (exports.ResourceType = {}));
})(exports.ResourceType || (exports.ResourceType = {}));
function isResourcePayload(resource) {

@@ -54,58 +29,52 @@ // tslint:disable-next-line:no-boolean-literal-compare

}
exports.isResourcePayload = isResourcePayload;
function toAdminPath(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Navigation,
type: Action.ADMIN_PATH,
group: actions_types.Group.Navigation,
type: exports.Action.ADMIN_PATH,
});
}
exports.toAdminPath = toAdminPath;
function toAdminSection(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Navigation,
type: Action.ADMIN_SECTION,
group: actions_types.Group.Navigation,
type: exports.Action.ADMIN_SECTION,
});
}
exports.toAdminSection = toAdminSection;
function toRemote(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Navigation,
type: Action.REMOTE,
group: actions_types.Group.Navigation,
type: exports.Action.REMOTE,
});
}
exports.toRemote = toRemote;
function toApp(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Navigation,
type: Action.APP,
group: actions_types.Group.Navigation,
type: exports.Action.APP,
});
}
exports.toApp = toApp;
function toDestination(action, payload, id) {
switch (action) {
case Action.APP: {
case exports.Action.APP: {
var appPayload = isAppPayload(payload) ? payload : { path: payload };
return toApp(__assign({ id: id }, appPayload));
return toApp(tslib_es6.__assign({ id: id }, appPayload));
}
case Action.ADMIN_PATH: {
case exports.Action.ADMIN_PATH: {
var adminPathPayload = isAdminPathPayload(payload) ? payload : { path: payload };
return toAdminPath(__assign({ id: id }, adminPathPayload));
return toAdminPath(tslib_es6.__assign({ id: id }, adminPathPayload));
}
case Action.ADMIN_SECTION: {
case exports.Action.ADMIN_SECTION: {
var adminSectionPayload = isAdminSectionPayload(payload)
? payload
: { section: payload };
return toAdminSection(__assign({ id: id }, adminSectionPayload));
return toAdminSection(tslib_es6.__assign({ id: id }, adminSectionPayload));
}
case Action.REMOTE: {
case exports.Action.REMOTE: {
var remotePayload = isRemotePayload(payload) ? payload : { url: payload };
return toRemote(__assign({ id: id }, remotePayload));
return toRemote(tslib_es6.__assign({ id: id }, remotePayload));
}
}
}
exports.toDestination = toDestination;
function getPathWithSearchAndHash(_a) {

@@ -115,3 +84,2 @@ var pathname = _a.pathname, search = _a.search, hash = _a.hash;

}
exports.getPathWithSearchAndHash = getPathWithSearchAndHash;
function normalizeUrl(to) {

@@ -126,3 +94,2 @@ if (to instanceof URL) {

}
exports.normalizeUrl = normalizeUrl;
function getRelativePath(to) {

@@ -136,13 +103,10 @@ if (typeof to === 'string') {

var search = to.search instanceof URLSearchParams ? to.search.toString() : to.search;
return getPathWithSearchAndHash(__assign(__assign({}, to), { search: search }));
return getPathWithSearchAndHash(tslib_es6.__assign(tslib_es6.__assign({}, to), { search: search }));
}
exports.getRelativePath = getRelativePath;
function isAppPayload(payload) {
return typeof payload === 'object' && Object.prototype.hasOwnProperty.call(payload, 'path');
}
exports.isAppPayload = isAppPayload;
function isAdminPathPayload(payload) {
return typeof payload === 'object' && Object.prototype.hasOwnProperty.call(payload, 'path');
}
exports.isAdminPathPayload = isAdminPathPayload;
function isAdminSectionPayload(payload) {

@@ -153,11 +117,8 @@ return (typeof payload === 'object' &&

}
exports.isAdminSectionPayload = isAdminSectionPayload;
function isRemotePayload(payload) {
return typeof payload === 'object' && Object.prototype.hasOwnProperty.call(payload, 'url');
}
exports.isRemotePayload = isRemotePayload;
function isAdminSection(to) {
return typeof to === 'object' && typeof (to === null || to === void 0 ? void 0 : to.name) === 'string';
}
exports.isAdminSection = isAdminSection;
function isCreateResourcePayload(resource) {

@@ -167,3 +128,2 @@ // tslint:disable-next-line:no-boolean-literal-compare

}
exports.isCreateResourcePayload = isCreateResourcePayload;
function isProductVariantResourcePayload(resource) {

@@ -174,7 +134,6 @@ var castResource = resource;

}
exports.isProductVariantResourcePayload = isProductVariantResourcePayload;
var Redirect = /** @class */ (function (_super) {
__extends(Redirect, _super);
tslib_es6.__extends(Redirect, _super);
function Redirect(app) {
return _super.call(this, app, 'Redirect', types_1.Group.Navigation) || this;
return _super.call(this, app, 'Redirect', actions_types.Group.Navigation) || this;
}

@@ -194,3 +153,20 @@ Object.defineProperty(Redirect.prototype, "payload", {

return Redirect;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.Redirect = Redirect;
exports.getPathWithSearchAndHash = getPathWithSearchAndHash;
exports.getRelativePath = getRelativePath;
exports.isAdminPathPayload = isAdminPathPayload;
exports.isAdminSection = isAdminSection;
exports.isAdminSectionPayload = isAdminSectionPayload;
exports.isAppPayload = isAppPayload;
exports.isCreateResourcePayload = isCreateResourcePayload;
exports.isProductVariantResourcePayload = isProductVariantResourcePayload;
exports.isRemotePayload = isRemotePayload;
exports.isResourcePayload = isResourcePayload;
exports.normalizeUrl = normalizeUrl;
exports.toAdminPath = toAdminPath;
exports.toAdminSection = toAdminSection;
exports.toApp = toApp;
exports.toDestination = toDestination;
exports.toRemote = toRemote;

@@ -1,24 +0,25 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fullPageLoad = exports.skeletonPageLoad = exports.Action = void 0;
var types_1 = require("../types");
var helper_1 = require("../helper");
var Action;
'use strict';
var actions_types = require('../types.js');
var actions_helper = require('../helper.js');
exports.Action = void 0;
(function (Action) {
Action["SKELETON_PAGE_LOAD"] = "APP::PERFORMANCE::SKELETON_PAGE_LOAD";
Action["FULL_PAGE_LOAD"] = "APP::PERFORMANCE::FULL_PAGE_LOAD";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function skeletonPageLoad() {
return helper_1.actionWrapper({
group: types_1.Group.Performance,
type: Action.SKELETON_PAGE_LOAD,
return actions_helper.actionWrapper({
group: actions_types.Group.Performance,
type: exports.Action.SKELETON_PAGE_LOAD,
});
}
exports.skeletonPageLoad = skeletonPageLoad;
function fullPageLoad() {
return helper_1.actionWrapper({
group: types_1.Group.Performance,
type: Action.FULL_PAGE_LOAD,
return actions_helper.actionWrapper({
group: actions_types.Group.Performance,
type: exports.Action.FULL_PAGE_LOAD,
});
}
exports.fullPageLoad = fullPageLoad;
exports.skeletonPageLoad = skeletonPageLoad;

@@ -1,34 +0,9 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.unstable_Picker = exports.loadMore = exports.search = exports.update = exports.cancel = exports.open = exports.select = exports.ALL_RESOURCE_VERTICAL_ALIGNMENT = exports.ALL_MEDIA_KINDS = exports.ALL_BADGE_STATUSES = exports.ALL_BADGE_PROGRESSES = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
var Action;
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {

@@ -41,3 +16,3 @@ Action["OPEN"] = "APP::PICKER::OPEN";

Action["LOAD_MORE"] = "APP::PICKER::LOAD_MORE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
/**

@@ -50,3 +25,3 @@ * To be used on validator as matchEnum(...). Make sure as new values are added to update

*/
exports.ALL_BADGE_PROGRESSES = [
var ALL_BADGE_PROGRESSES = [
'incomplete',

@@ -56,3 +31,3 @@ 'partiallyComplete',

];
exports.ALL_BADGE_STATUSES = [
var ALL_BADGE_STATUSES = [
'success',

@@ -65,4 +40,4 @@ 'info',

];
exports.ALL_MEDIA_KINDS = ['Avatar', 'Thumbnail'];
exports.ALL_RESOURCE_VERTICAL_ALIGNMENT = [
var ALL_MEDIA_KINDS = ['Avatar', 'Thumbnail'];
var ALL_RESOURCE_VERTICAL_ALIGNMENT = [
'leading',

@@ -73,49 +48,43 @@ 'trailing',

function select(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.unstable_Picker,
type: Action.SELECT,
group: actions_types.Group.unstable_Picker,
type: exports.Action.SELECT,
});
}
exports.select = select;
function open(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.unstable_Picker,
type: Action.OPEN,
group: actions_types.Group.unstable_Picker,
type: exports.Action.OPEN,
});
}
exports.open = open;
function cancel(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.unstable_Picker,
type: Action.CANCEL,
group: actions_types.Group.unstable_Picker,
type: exports.Action.CANCEL,
});
}
exports.cancel = cancel;
function update(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.unstable_Picker,
type: Action.UPDATE,
group: actions_types.Group.unstable_Picker,
type: exports.Action.UPDATE,
});
}
exports.update = update;
function search(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.unstable_Picker,
type: Action.SEARCH,
group: actions_types.Group.unstable_Picker,
type: exports.Action.SEARCH,
});
}
exports.search = search;
function loadMore(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.unstable_Picker,
type: Action.LOAD_MORE,
group: actions_types.Group.unstable_Picker,
type: exports.Action.LOAD_MORE,
});
}
exports.loadMore = loadMore;
/**

@@ -125,5 +94,5 @@ * @unstable This API may be updated without warning in the future

var unstable_Picker = /** @class */ (function (_super) {
__extends(unstable_Picker, _super);
tslib_es6.__extends(unstable_Picker, _super);
function unstable_Picker(app, options) {
var _this = _super.call(this, app, types_1.Group.unstable_Picker, types_1.Group.unstable_Picker) || this;
var _this = _super.call(this, app, actions_types.Group.unstable_Picker, actions_types.Group.unstable_Picker) || this;
_this.items = [];

@@ -136,3 +105,3 @@ _this.selectedItems = [];

get: function () {
return __assign(__assign({}, this.options), { id: this.id });
return tslib_es6.__assign(tslib_es6.__assign({}, this.options), { id: this.id });
},

@@ -167,3 +136,3 @@ enumerable: false,

if (shouldUpdate === void 0) { shouldUpdate = true; }
var mergedOptions = helper_1.getMergedProps(this.options, options);
var mergedOptions = actions_helper.getMergedProps(this.options, options);
var _a = mergedOptions.selectedItems, selectedItems = _a === void 0 ? [] : _a, _b = mergedOptions.maxSelectable, maxSelectable = _b === void 0 ? 0 : _b, _c = mergedOptions.items, items = _c === void 0 ? [] : _c, _d = mergedOptions.loading, loading = _d === void 0 ? false : _d, title = mergedOptions.title, searchQuery = mergedOptions.searchQuery, searchQueryPlaceholder = mergedOptions.searchQueryPlaceholder, primaryActionLabel = mergedOptions.primaryActionLabel, secondaryActionLabel = mergedOptions.secondaryActionLabel, emptySearchLabel = mergedOptions.emptySearchLabel, _e = mergedOptions.canLoadMore, canLoadMore = _e === void 0 ? false : _e, _f = mergedOptions.loadingMore, loadingMore = _f === void 0 ? false : _f, verticalAlignment = mergedOptions.verticalAlignment, allowEmptySelection = mergedOptions.allowEmptySelection, resourceName = mergedOptions.resourceName;

@@ -191,20 +160,20 @@ this.title = title;

unstable_Picker.prototype.dispatch = function (action, payload) {
if (action === Action.OPEN) {
if (action === exports.Action.OPEN) {
this.open();
}
else if (action === Action.UPDATE) {
else if (action === exports.Action.UPDATE) {
this.update();
}
else if (action === Action.CANCEL) {
else if (action === exports.Action.CANCEL) {
this.cancel();
}
else if (action === Action.SELECT) {
else if (action === exports.Action.SELECT) {
this.selectedItems = (payload === null || payload === void 0 ? void 0 : payload.selectedItems) || [];
this.app.dispatch(select({ id: this.id, selectedItems: this.selectedItems }));
}
else if (action === Action.SEARCH) {
else if (action === exports.Action.SEARCH) {
this.searchQuery = (payload === null || payload === void 0 ? void 0 : payload.searchQuery) || '';
this.app.dispatch(search({ id: this.id, searchQuery: this.searchQuery }));
}
else if (action === Action.LOAD_MORE) {
else if (action === exports.Action.LOAD_MORE) {
this.loadMore();

@@ -227,3 +196,14 @@ }

return unstable_Picker;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.ALL_BADGE_PROGRESSES = ALL_BADGE_PROGRESSES;
exports.ALL_BADGE_STATUSES = ALL_BADGE_STATUSES;
exports.ALL_MEDIA_KINDS = ALL_MEDIA_KINDS;
exports.ALL_RESOURCE_VERTICAL_ALIGNMENT = ALL_RESOURCE_VERTICAL_ALIGNMENT;
exports.cancel = cancel;
exports.loadMore = loadMore;
exports.open = open;
exports.search = search;
exports.select = select;
exports.unstable_Picker = unstable_Picker;
exports.update = update;

@@ -1,22 +0,8 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pos = exports.close = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
/**

@@ -27,3 +13,3 @@ * Pos action type enum

*/
var Action;
exports.Action = void 0;
(function (Action) {

@@ -34,18 +20,17 @@ Action["CLOSE"] = "APP::POS::CLOSE";

Action["DEVICE_UPDATE"] = "APP::POS::DEVICE::UPDATE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function close() {
return helper_1.actionWrapper({
group: types_1.Group.Pos,
type: Action.CLOSE,
return actions_helper.actionWrapper({
group: actions_types.Group.Pos,
type: exports.Action.CLOSE,
});
}
exports.close = close;
var Pos = /** @class */ (function (_super) {
__extends(Pos, _super);
tslib_es6.__extends(Pos, _super);
function Pos(app) {
return _super.call(this, app, types_1.Group.Pos, types_1.Group.Pos) || this;
return _super.call(this, app, actions_types.Group.Pos, actions_types.Group.Pos) || this;
}
Pos.prototype.dispatch = function (action) {
switch (action) {
case Action.CLOSE:
case exports.Action.CLOSE:
this.app.dispatch(close());

@@ -57,3 +42,5 @@ break;

return Pos;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.Pos = Pos;
exports.close = close;

@@ -1,16 +0,17 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.app = exports.Action = void 0;
var helper_1 = require("../helper");
var types_1 = require("../types");
var Action;
'use strict';
var actions_helper = require('../helper.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {
Action["APP"] = "APP::PRINT::APP";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function app() {
return helper_1.actionWrapper({
group: types_1.Group.Print,
type: Action.APP,
return actions_helper.actionWrapper({
group: actions_types.Group.Print,
type: exports.Action.APP,
});
}
exports.app = app;

@@ -1,34 +0,9 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResourcePicker = exports.update = exports.close = exports.cancel = exports.open = exports.select = exports.ActionVerb = exports.ResourceType = exports.ProductStatus = exports.ProductVariantInventoryManagement = exports.ProductVariantInventoryPolicy = exports.WeightUnit = exports.FulfillmentServiceType = exports.CollectionSortOrder = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
var Action;
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {

@@ -41,4 +16,4 @@ Action["OPEN"] = "APP::RESOURCE_PICKER::OPEN";

Action["CANCEL"] = "APP::RESOURCE_PICKER::CANCEL";
})(Action = exports.Action || (exports.Action = {}));
var CollectionSortOrder;
})(exports.Action || (exports.Action = {}));
exports.CollectionSortOrder = void 0;
(function (CollectionSortOrder) {

@@ -54,4 +29,4 @@ CollectionSortOrder["Manual"] = "MANUAL";

CollectionSortOrder["MostRelevant"] = "MOST_RELEVANT";
})(CollectionSortOrder = exports.CollectionSortOrder || (exports.CollectionSortOrder = {}));
var FulfillmentServiceType;
})(exports.CollectionSortOrder || (exports.CollectionSortOrder = {}));
exports.FulfillmentServiceType = void 0;
(function (FulfillmentServiceType) {

@@ -61,4 +36,4 @@ FulfillmentServiceType["GiftCard"] = "GIFT_CARD";

FulfillmentServiceType["ThirdParty"] = "THIRD_PARTY";
})(FulfillmentServiceType = exports.FulfillmentServiceType || (exports.FulfillmentServiceType = {}));
var WeightUnit;
})(exports.FulfillmentServiceType || (exports.FulfillmentServiceType = {}));
exports.WeightUnit = void 0;
(function (WeightUnit) {

@@ -69,9 +44,9 @@ WeightUnit["Kilograms"] = "KILOGRAMS";

WeightUnit["Ounces"] = "OUNCES";
})(WeightUnit = exports.WeightUnit || (exports.WeightUnit = {}));
var ProductVariantInventoryPolicy;
})(exports.WeightUnit || (exports.WeightUnit = {}));
exports.ProductVariantInventoryPolicy = void 0;
(function (ProductVariantInventoryPolicy) {
ProductVariantInventoryPolicy["Deny"] = "DENY";
ProductVariantInventoryPolicy["Continue"] = "CONTINUE";
})(ProductVariantInventoryPolicy = exports.ProductVariantInventoryPolicy || (exports.ProductVariantInventoryPolicy = {}));
var ProductVariantInventoryManagement;
})(exports.ProductVariantInventoryPolicy || (exports.ProductVariantInventoryPolicy = {}));
exports.ProductVariantInventoryManagement = void 0;
(function (ProductVariantInventoryManagement) {

@@ -81,4 +56,4 @@ ProductVariantInventoryManagement["Shopify"] = "SHOPIFY";

ProductVariantInventoryManagement["FulfillmentService"] = "FULFILLMENT_SERVICE";
})(ProductVariantInventoryManagement = exports.ProductVariantInventoryManagement || (exports.ProductVariantInventoryManagement = {}));
var ProductStatus;
})(exports.ProductVariantInventoryManagement || (exports.ProductVariantInventoryManagement = {}));
exports.ProductStatus = void 0;
(function (ProductStatus) {

@@ -88,4 +63,4 @@ ProductStatus["Active"] = "ACTIVE";

ProductStatus["Draft"] = "DRAFT";
})(ProductStatus = exports.ProductStatus || (exports.ProductStatus = {}));
var ResourceType;
})(exports.ProductStatus || (exports.ProductStatus = {}));
exports.ResourceType = void 0;
(function (ResourceType) {

@@ -95,52 +70,47 @@ ResourceType["Product"] = "product";

ResourceType["Collection"] = "collection";
})(ResourceType = exports.ResourceType || (exports.ResourceType = {}));
var ActionVerb;
})(exports.ResourceType || (exports.ResourceType = {}));
exports.ActionVerb = void 0;
(function (ActionVerb) {
ActionVerb["Add"] = "add";
ActionVerb["Select"] = "select";
})(ActionVerb = exports.ActionVerb || (exports.ActionVerb = {}));
})(exports.ActionVerb || (exports.ActionVerb = {}));
function select(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.ResourcePicker,
type: Action.SELECT,
group: actions_types.Group.ResourcePicker,
type: exports.Action.SELECT,
});
}
exports.select = select;
function open(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.ResourcePicker,
type: Action.OPEN,
group: actions_types.Group.ResourcePicker,
type: exports.Action.OPEN,
});
}
exports.open = open;
function cancel(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.ResourcePicker,
type: Action.CANCEL,
group: actions_types.Group.ResourcePicker,
type: exports.Action.CANCEL,
});
}
exports.cancel = cancel;
function close(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.ResourcePicker,
type: Action.CANCEL,
group: actions_types.Group.ResourcePicker,
type: exports.Action.CANCEL,
});
}
exports.close = close;
function update(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.ResourcePicker,
type: Action.UPDATE,
group: actions_types.Group.ResourcePicker,
type: exports.Action.UPDATE,
});
}
exports.update = update;
var ResourcePicker = /** @class */ (function (_super) {
__extends(ResourcePicker, _super);
tslib_es6.__extends(ResourcePicker, _super);
function ResourcePicker(app, options, resourceType) {
var _this = _super.call(this, app, types_1.Group.ResourcePicker, types_1.Group.ResourcePicker) || this;
var _this = _super.call(this, app, actions_types.Group.ResourcePicker, actions_types.Group.ResourcePicker) || this;
_this.initialSelectionIds = [];

@@ -154,3 +124,3 @@ _this.selection = [];

get: function () {
return __assign(__assign({}, this.options), { id: this.id, resourceType: this.resourceType });
return tslib_es6.__assign(tslib_es6.__assign({}, this.options), { id: this.id, resourceType: this.resourceType });
},

@@ -170,4 +140,4 @@ enumerable: false,

};
if (this.resourceType === ResourceType.Product) {
var productOptions = __assign(__assign({}, options), { showVariants: this.showVariants, showDraft: this.showDraft, showArchived: this.showArchived, showDraftBadge: this.showDraftBadge, showArchivedBadge: this.showArchivedBadge });
if (this.resourceType === exports.ResourceType.Product) {
var productOptions = tslib_es6.__assign(tslib_es6.__assign({}, options), { showVariants: this.showVariants, showDraft: this.showDraft, showArchived: this.showArchived, showDraftBadge: this.showDraftBadge, showArchivedBadge: this.showArchivedBadge });
return productOptions;

@@ -182,4 +152,4 @@ }

if (shouldUpdate === void 0) { shouldUpdate = true; }
var mergedOptions = helper_1.getMergedProps(this.options, options);
var initialQuery = mergedOptions.initialQuery, filterQuery = mergedOptions.filterQuery, _a = mergedOptions.initialSelectionIds, initialSelectionIds = _a === void 0 ? [] : _a, _b = mergedOptions.showHidden, showHidden = _b === void 0 ? true : _b, _c = mergedOptions.showVariants, showVariants = _c === void 0 ? true : _c, _d = mergedOptions.showDraft, showDraft = _d === void 0 ? true : _d, _e = mergedOptions.showArchived, showArchived = _e === void 0 ? true : _e, _f = mergedOptions.showDraftBadge, showDraftBadge = _f === void 0 ? false : _f, _g = mergedOptions.showArchivedBadge, showArchivedBadge = _g === void 0 ? false : _g, _h = mergedOptions.selectMultiple, selectMultiple = _h === void 0 ? true : _h, _j = mergedOptions.actionVerb, actionVerb = _j === void 0 ? ActionVerb.Add : _j;
var mergedOptions = actions_helper.getMergedProps(this.options, options);
var initialQuery = mergedOptions.initialQuery, filterQuery = mergedOptions.filterQuery, _a = mergedOptions.initialSelectionIds, initialSelectionIds = _a === void 0 ? [] : _a, _b = mergedOptions.showHidden, showHidden = _b === void 0 ? true : _b, _c = mergedOptions.showVariants, showVariants = _c === void 0 ? true : _c, _d = mergedOptions.showDraft, showDraft = _d === void 0 ? true : _d, _e = mergedOptions.showArchived, showArchived = _e === void 0 ? true : _e, _f = mergedOptions.showDraftBadge, showDraftBadge = _f === void 0 ? false : _f, _g = mergedOptions.showArchivedBadge, showArchivedBadge = _g === void 0 ? false : _g, _h = mergedOptions.selectMultiple, selectMultiple = _h === void 0 ? true : _h, _j = mergedOptions.actionVerb, actionVerb = _j === void 0 ? exports.ActionVerb.Add : _j;
this.initialQuery = initialQuery;

@@ -202,12 +172,12 @@ this.filterQuery = filterQuery;

ResourcePicker.prototype.dispatch = function (action, selection) {
if (action === Action.OPEN) {
if (action === exports.Action.OPEN) {
this.open();
}
else if (action === Action.UPDATE) {
else if (action === exports.Action.UPDATE) {
this.update();
}
else if (action === Action.CLOSE || action === Action.CANCEL) {
else if (action === exports.Action.CLOSE || action === exports.Action.CANCEL) {
this.cancel();
}
else if (action === Action.SELECT) {
else if (action === exports.Action.SELECT) {
this.selection = selection;

@@ -231,3 +201,9 @@ this.app.dispatch(select({ id: this.id, selection: this.selection }));

return ResourcePicker;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.ResourcePicker = ResourcePicker;
exports.cancel = cancel;
exports.close = close;
exports.open = open;
exports.select = select;
exports.update = update;

@@ -1,22 +0,8 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.capture = exports.openCamera = exports.Scanner = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
/**

@@ -26,7 +12,7 @@ * Action Types for the Features group

*/
var Action;
exports.Action = void 0;
(function (Action) {
Action["OPEN_CAMERA"] = "APP::SCANNER::OPEN::CAMERA";
Action["CAPTURE"] = "APP::SCANNER::CAPTURE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
/**

@@ -37,5 +23,5 @@ * A set of Actions for displaying a Camera Scanner component

var Scanner = /** @class */ (function (_super) {
__extends(Scanner, _super);
tslib_es6.__extends(Scanner, _super);
function Scanner(app, options) {
return _super.call(this, app, types_1.Group.Scanner, types_1.Group.Scanner, options ? options.id : undefined) || this;
return _super.call(this, app, actions_types.Group.Scanner, actions_types.Group.Scanner, options ? options.id : undefined) || this;
}

@@ -47,4 +33,4 @@ /**

switch (action) {
case Action.OPEN_CAMERA:
this.dispatchScannerAction(Action.OPEN_CAMERA);
case exports.Action.OPEN_CAMERA:
this.dispatchScannerAction(exports.Action.OPEN_CAMERA);
break;

@@ -58,5 +44,5 @@ }

Scanner.prototype.dispatchScannerAction = function (type) {
this.app.dispatch(helper_1.actionWrapper({
this.app.dispatch(actions_helper.actionWrapper({
type: type,
group: types_1.Group.Scanner,
group: actions_types.Group.Scanner,
payload: {

@@ -68,18 +54,19 @@ id: this.id,

return Scanner;
}(ActionSet_1.ActionSet));
exports.Scanner = Scanner;
}(actions_ActionSet.ActionSet));
function openCamera() {
return helper_1.actionWrapper({
group: types_1.Group.Scanner,
type: Action.OPEN_CAMERA,
return actions_helper.actionWrapper({
group: actions_types.Group.Scanner,
type: exports.Action.OPEN_CAMERA,
});
}
exports.openCamera = openCamera;
function capture(payload) {
return helper_1.actionWrapper({
group: types_1.Group.Scanner,
type: Action.CAPTURE,
return actions_helper.actionWrapper({
group: actions_types.Group.Scanner,
type: exports.Action.CAPTURE,
payload: payload,
});
}
exports.Scanner = Scanner;
exports.capture = capture;
exports.openCamera = openCamera;

@@ -1,25 +0,26 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.respond = exports.request = exports.Action = void 0;
var helper_1 = require("../helper");
var types_1 = require("../types");
var Action;
'use strict';
var actions_helper = require('../helper.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {
Action["REQUEST"] = "APP::SESSION_TOKEN::REQUEST";
Action["RESPOND"] = "APP::SESSION_TOKEN::RESPOND";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function request() {
return helper_1.actionWrapper({
group: types_1.Group.SessionToken,
type: Action.REQUEST,
return actions_helper.actionWrapper({
group: actions_types.Group.SessionToken,
type: exports.Action.REQUEST,
});
}
exports.request = request;
function respond(sessionToken) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: sessionToken,
group: types_1.Group.SessionToken,
type: Action.RESPOND,
group: actions_types.Group.SessionToken,
type: exports.Action.RESPOND,
});
}
exports.request = request;
exports.respond = respond;

@@ -1,33 +0,8 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.close = exports.show = exports.Share = exports.Action = void 0;
var types_1 = require("../types");
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_types = require('../types.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
/**

@@ -39,7 +14,7 @@ * Types

*/
var Action;
exports.Action = void 0;
(function (Action) {
Action["SHOW"] = "APP::SHARE::SHOW";
Action["CLOSE"] = "APP::SHARE::CLOSE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
/**

@@ -53,13 +28,13 @@ * Action

var Share = /** @class */ (function (_super) {
__extends(Share, _super);
tslib_es6.__extends(Share, _super);
function Share(app) {
return _super.call(this, app, types_1.Group.Share, types_1.Group.Share) || this;
return _super.call(this, app, actions_types.Group.Share, actions_types.Group.Share) || this;
}
Share.prototype.dispatch = function (action, payload) {
switch (action) {
case Action.SHOW:
this.dispatchShareAction(Action.SHOW, payload);
case exports.Action.SHOW:
this.dispatchShareAction(exports.Action.SHOW, payload);
break;
case Action.CLOSE:
this.dispatchShareAction(Action.CLOSE, payload);
case exports.Action.CLOSE:
this.dispatchShareAction(exports.Action.CLOSE, payload);
break;

@@ -75,25 +50,26 @@ default:

Share.prototype.dispatchShareAction = function (actionType, payload) {
this.app.dispatch(helper_1.actionWrapper({
this.app.dispatch(actions_helper.actionWrapper({
type: actionType,
group: types_1.Group.Share,
payload: __assign({ id: this.id }, payload),
group: actions_types.Group.Share,
payload: tslib_es6.__assign({ id: this.id }, payload),
}));
};
return Share;
}(ActionSet_1.ActionSet));
exports.Share = Share;
}(actions_ActionSet.ActionSet));
function show() {
return helper_1.actionWrapper({
group: types_1.Group.Share,
type: Action.SHOW,
return actions_helper.actionWrapper({
group: actions_types.Group.Share,
type: exports.Action.SHOW,
});
}
exports.show = show;
function close(payload) {
return helper_1.actionWrapper({
group: types_1.Group.Share,
type: Action.CLOSE,
return actions_helper.actionWrapper({
group: actions_types.Group.Share,
type: exports.Action.CLOSE,
payload: payload,
});
}
exports.Share = Share;
exports.close = close;
exports.show = show;

@@ -1,38 +0,13 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TitleBar = exports.update = exports.clickBreadcrumb = exports.clickActionButton = exports.Action = void 0;
var ActionSet_1 = require("../ActionSet");
var Button_1 = require("../Button");
var ButtonGroup_1 = require("../ButtonGroup");
var buttonGroupHelper_1 = require("../buttonGroupHelper");
var buttonHelper_1 = require("../buttonHelper");
var helper_1 = require("../helper");
var types_1 = require("../types");
var Action;
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_Button_index = require('../Button/index.js');
var actions_ButtonGroup_index = require('../ButtonGroup/index.js');
var actions_buttonGroupHelper = require('../buttonGroupHelper.js');
var actions_buttonHelper = require('../buttonHelper.js');
var actions_helper = require('../helper.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {

@@ -45,35 +20,32 @@ Action["UPDATE"] = "APP::TITLEBAR::UPDATE";

Action["BREADCRUMBS_UPDATE"] = "APP::TITLEBAR::BREADCRUMBS::BUTTON::UPDATE";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
var TITLEBAR_BUTTON_PROPS = {
group: types_1.Group.TitleBar,
group: actions_types.Group.TitleBar,
subgroups: ['Buttons'],
};
var BREADCRUMB_BUTTON_PROPS = {
group: types_1.Group.TitleBar,
group: actions_types.Group.TitleBar,
subgroups: ['Breadcrumbs'],
type: types_1.ComponentType.Button,
type: actions_types.ComponentType.Button,
};
function clickActionButton(id, payload) {
var type = types_1.ComponentType.Button;
var component = __assign({ id: id, type: type }, TITLEBAR_BUTTON_PROPS);
return Button_1.clickButton(types_1.Group.TitleBar, component, payload);
var type = actions_types.ComponentType.Button;
var component = tslib_es6.__assign({ id: id, type: type }, TITLEBAR_BUTTON_PROPS);
return actions_Button_index.clickButton(actions_types.Group.TitleBar, component, payload);
}
exports.clickActionButton = clickActionButton;
function clickBreadcrumb(id, payload) {
var component = __assign({ id: id }, BREADCRUMB_BUTTON_PROPS);
return Button_1.clickButton(types_1.Group.TitleBar, component, payload);
var component = tslib_es6.__assign({ id: id }, BREADCRUMB_BUTTON_PROPS);
return actions_Button_index.clickButton(actions_types.Group.TitleBar, component, payload);
}
exports.clickBreadcrumb = clickBreadcrumb;
function update(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.TitleBar,
type: Action.UPDATE,
group: actions_types.Group.TitleBar,
type: exports.Action.UPDATE,
});
}
exports.update = update;
var TitleBar = /** @class */ (function (_super) {
__extends(TitleBar, _super);
tslib_es6.__extends(TitleBar, _super);
function TitleBar(app, options) {
var _this = _super.call(this, app, types_1.Group.TitleBar, types_1.Group.TitleBar) || this;
var _this = _super.call(this, app, actions_types.Group.TitleBar, actions_types.Group.TitleBar) || this;
if (!options.title && !options.breadcrumbs && !options.buttons) {

@@ -125,3 +97,3 @@ return _this;

get: function () {
return __assign(__assign({}, this.options), { breadcrumbs: this.breadcrumb, buttons: this.buttons, id: this.id });
return tslib_es6.__assign(tslib_es6.__assign({}, this.options), { breadcrumbs: this.breadcrumb, buttons: this.buttons, id: this.id });
},

@@ -133,3 +105,3 @@ enumerable: false,

if (shouldUpdate === void 0) { shouldUpdate = true; }
var mergedOptions = helper_1.getMergedProps(this.options, options);
var mergedOptions = actions_helper.getMergedProps(this.options, options);
var title = mergedOptions.title, buttons = mergedOptions.buttons, breadcrumbs = mergedOptions.breadcrumbs;

@@ -141,3 +113,3 @@ this.title = title;

if (shouldUpdate) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}

@@ -148,3 +120,3 @@ return this;

switch (action) {
case Action.UPDATE:
case exports.Action.UPDATE:
this.app.dispatch(update(this.payload));

@@ -156,6 +128,6 @@ break;

TitleBar.prototype.getButton = function (button, subgroups, updateCb) {
if (button instanceof ButtonGroup_1.ButtonGroup) {
return buttonGroupHelper_1.getGroupedButton(this, button, subgroups, updateCb);
if (button instanceof actions_ButtonGroup_index.ButtonGroup) {
return actions_buttonGroupHelper.getGroupedButton(this, button, subgroups, updateCb);
}
return buttonHelper_1.getSingleButton(this, button, subgroups, updateCb);
return actions_buttonHelper.getSingleButton(this, button, subgroups, updateCb);
};

@@ -166,4 +138,4 @@ TitleBar.prototype.updatePrimaryButton = function (newPayload) {

}
if (helper_1.updateActionFromPayload(this.primary, newPayload)) {
this.dispatch(Action.UPDATE);
if (actions_helper.updateActionFromPayload(this.primary, newPayload)) {
this.dispatch(exports.Action.UPDATE);
}

@@ -180,10 +152,10 @@ };

var updated = false;
if (ButtonGroup_1.isGroupedButtonPayload(newPayload)) {
updated = helper_1.updateActionFromPayload(buttonToUpdate, newPayload);
if (actions_ButtonGroup_index.isGroupedButtonPayload(newPayload)) {
updated = actions_helper.updateActionFromPayload(buttonToUpdate, newPayload);
}
else {
updated = helper_1.updateActionFromPayload(buttonToUpdate, newPayload);
updated = actions_helper.updateActionFromPayload(buttonToUpdate, newPayload);
}
if (updated) {
this.dispatch(Action.UPDATE);
this.dispatch(exports.Action.UPDATE);
}

@@ -195,4 +167,4 @@ };

}
if (helper_1.updateActionFromPayload(this.breadcrumb, newPayload)) {
this.dispatch(Action.UPDATE);
if (actions_helper.updateActionFromPayload(this.breadcrumb, newPayload)) {
this.dispatch(exports.Action.UPDATE);
}

@@ -230,3 +202,7 @@ };

return TitleBar;
}(ActionSet_1.ActionSetWithChildren));
}(actions_ActionSet.ActionSetWithChildren));
exports.TitleBar = TitleBar;
exports.clickActionButton = clickActionButton;
exports.clickBreadcrumb = clickBreadcrumb;
exports.update = update;

@@ -1,34 +0,9 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Toast = exports.primaryAction = exports.clear = exports.show = exports.Action = void 0;
var helper_1 = require("../helper");
var ActionSet_1 = require("../ActionSet");
var types_1 = require("../types");
var Action;
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_helper = require('../helper.js');
var actions_ActionSet = require('../ActionSet.js');
var actions_types = require('../types.js');
exports.Action = void 0;
(function (Action) {

@@ -38,31 +13,28 @@ Action["SHOW"] = "APP::TOAST::SHOW";

Action["ACTION"] = "APP::TOAST::ACTION";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));
function show(toastMessage) {
return helper_1.actionWrapper({
group: types_1.Group.Toast,
return actions_helper.actionWrapper({
group: actions_types.Group.Toast,
payload: toastMessage,
type: Action.SHOW,
type: exports.Action.SHOW,
});
}
exports.show = show;
function clear(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Toast,
type: Action.CLEAR,
group: actions_types.Group.Toast,
type: exports.Action.CLEAR,
});
}
exports.clear = clear;
function primaryAction(payload) {
return helper_1.actionWrapper({
return actions_helper.actionWrapper({
payload: payload,
group: types_1.Group.Toast,
type: Action.ACTION,
group: actions_types.Group.Toast,
type: exports.Action.ACTION,
});
}
exports.primaryAction = primaryAction;
var Toast = /** @class */ (function (_super) {
__extends(Toast, _super);
tslib_es6.__extends(Toast, _super);
function Toast(app, options) {
var _this = _super.call(this, app, types_1.Group.Toast, types_1.Group.Toast) || this;
var _this = _super.call(this, app, actions_types.Group.Toast, actions_types.Group.Toast) || this;
_this.message = '';

@@ -92,3 +64,3 @@ _this.duration = 5000;

get: function () {
return __assign({ id: this.id }, this.options);
return tslib_es6.__assign({ id: this.id }, this.options);
},

@@ -99,3 +71,3 @@ enumerable: false,

Toast.prototype.set = function (options) {
var mergedOptions = helper_1.getMergedProps(this.options, options);
var mergedOptions = actions_helper.getMergedProps(this.options, options);
var message = mergedOptions.message, duration = mergedOptions.duration, isError = mergedOptions.isError, action = mergedOptions.action;

@@ -114,3 +86,3 @@ this.message = message;

switch (action) {
case Action.SHOW: {
case exports.Action.SHOW: {
var openAction = show(this.payload);

@@ -120,6 +92,6 @@ this.app.dispatch(openAction);

}
case Action.CLEAR:
case exports.Action.CLEAR:
this.app.dispatch(clear({ id: this.id }));
break;
case Action.ACTION:
case exports.Action.ACTION:
this.app.dispatch(primaryAction({ id: this.id }));

@@ -131,3 +103,7 @@ break;

return Toast;
}(ActionSet_1.ActionSet));
}(actions_ActionSet.ActionSet));
exports.Toast = Toast;
exports.clear = clear;
exports.primaryAction = primaryAction;
exports.show = show;

@@ -1,4 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComponentType = exports.Group = void 0;
'use strict';
/**

@@ -8,3 +7,3 @@ * Various action groups.

*/
var Group;
exports.Group = void 0;
(function (Group) {

@@ -42,10 +41,10 @@ Group["AuthCode"] = "AuthCode";

Group["WebVitals"] = "WebVitals";
})(Group = exports.Group || (exports.Group = {}));
})(exports.Group || (exports.Group = {}));
/**
* @internal
*/
var ComponentType;
exports.ComponentType = void 0;
(function (ComponentType) {
ComponentType["Button"] = "Button";
ComponentType["ButtonGroup"] = "ButtonGroup";
})(ComponentType = exports.ComponentType || (exports.ComponentType = {}));
})(exports.ComponentType || (exports.ComponentType = {}));

@@ -1,4 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateUuid = void 0;
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
/**

@@ -58,3 +59,4 @@ * Convert a number or array of integers to a string of padded hex octets.

}
exports.default = generateUuid;
exports.generateUuid = generateUuid;
exports.default = generateUuid;

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPermitted = exports.getPermissionKey = exports.isPerformanceOrWebVitalsAction = exports.isAppMessage = exports.isAppBridgeAction = void 0;
var types_1 = require("../client/types");
var constants_1 = require("./constants");
var helper_1 = require("./helper");
'use strict';
var client_types = require('../client/types.js');
var actions_constants = require('./constants.js');
var actions_helper = require('./helper.js');
/**

@@ -14,5 +14,4 @@ * Predicate to determine if an action is an App Bridge action.

Object.prototype.hasOwnProperty.call(action, 'type') &&
action.type.toString().startsWith(constants_1.PREFIX));
action.type.toString().startsWith(actions_constants.PREFIX));
}
exports.isAppBridgeAction = isAppBridgeAction;
/**

@@ -28,5 +27,4 @@ * Predicate to determine if an event originated from an application.

return (Object.prototype.hasOwnProperty.call(data, 'type') &&
helper_1.findMatchInEnum(types_1.MessageType, data.type) !== undefined);
actions_helper.findMatchInEnum(client_types.MessageType, data.type) !== undefined);
}
exports.isAppMessage = isAppMessage;
/**

@@ -40,3 +38,2 @@ * Function used to determine if an action is in the Performance or WebVitals groups

}
exports.isPerformanceOrWebVitalsAction = isPerformanceOrWebVitalsAction;
/**

@@ -47,5 +44,4 @@ * Returns the action type without the prefix and group

function getPermissionKey(type) {
return type.replace(new RegExp("^" + constants_1.PREFIX + constants_1.SEPARATOR + "\\w+" + constants_1.SEPARATOR), '');
return type.replace(new RegExp("^" + actions_constants.PREFIX + actions_constants.SEPARATOR + "\\w+" + actions_constants.SEPARATOR), '');
}
exports.getPermissionKey = getPermissionKey;
/**

@@ -67,2 +63,7 @@ * Predicate to determine if an action is permitted

}
exports.getPermissionKey = getPermissionKey;
exports.isAppBridgeAction = isAppBridgeAction;
exports.isAppMessage = isAppMessage;
exports.isPerformanceOrWebVitalsAction = isPerformanceOrWebVitalsAction;
exports.isPermitted = isPermitted;

@@ -1,5 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
exports.Action = void 0;
var Action;
(function (Action) {

@@ -12,2 +11,2 @@ Action["LARGEST_CONTENTFUL_PAINT"] = "APP::WEB_VITALS::LARGEST_CONTENTFUL_PAINT";

Action["INTERACTION_TO_NEXT_PAINT"] = "APP::WEB_VITALS::INTERACTION_TO_NEXT_PAINT";
})(Action = exports.Action || (exports.Action = {}));
})(exports.Action || (exports.Action = {}));

@@ -1,13 +0,18 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./types"), exports);
'use strict';
var client_types = require('./types.js');
Object.defineProperty(exports, "LifecycleHook", {
enumerable: true,
get: function () { return client_types.LifecycleHook; }
});
Object.defineProperty(exports, "MessageType", {
enumerable: true,
get: function () { return client_types.MessageType; }
});
Object.defineProperty(exports, "PermissionType", {
enumerable: true,
get: function () { return client_types.PermissionType; }
});

@@ -1,8 +0,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LifecycleHook = exports.PermissionType = exports.MessageType = void 0;
'use strict';
/**
* @internal
*/
var MessageType;
exports.MessageType = void 0;
(function (MessageType) {

@@ -13,11 +12,11 @@ MessageType["GetState"] = "getState";

MessageType["Unsubscribe"] = "unsubscribe";
})(MessageType = exports.MessageType || (exports.MessageType = {}));
})(exports.MessageType || (exports.MessageType = {}));
/**
* @internal
*/
var PermissionType;
exports.PermissionType = void 0;
(function (PermissionType) {
PermissionType["Dispatch"] = "Dispatch";
PermissionType["Subscribe"] = "Subscribe";
})(PermissionType = exports.PermissionType || (exports.PermissionType = {}));
})(exports.PermissionType || (exports.PermissionType = {}));
/**

@@ -43,6 +42,6 @@ *

*/
var LifecycleHook;
exports.LifecycleHook = void 0;
(function (LifecycleHook) {
LifecycleHook["UpdateAction"] = "UpdateAction";
LifecycleHook["DispatchAction"] = "DispatchAction";
})(LifecycleHook = exports.LifecycleHook || (exports.LifecycleHook = {}));
})(exports.LifecycleHook || (exports.LifecycleHook = {}));

@@ -1,14 +0,26 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./MessageTransport"), exports);
__exportStar(require("./client"), exports);
'use strict';
var MessageTransport = require('./MessageTransport.js');
var client_types = require('./client/types.js');
Object.defineProperty(exports, "Context", {
enumerable: true,
get: function () { return MessageTransport.Context; }
});
exports.createTransportListener = MessageTransport.createTransportListener;
exports.fromFrame = MessageTransport.fromFrame;
exports.fromWindow = MessageTransport.fromWindow;
Object.defineProperty(exports, "LifecycleHook", {
enumerable: true,
get: function () { return client_types.LifecycleHook; }
});
Object.defineProperty(exports, "MessageType", {
enumerable: true,
get: function () { return client_types.MessageType; }
});
Object.defineProperty(exports, "PermissionType", {
enumerable: true,
get: function () { return client_types.PermissionType; }
});

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTransportListener = exports.fromWindow = exports.fromFrame = exports.Context = void 0;
var Error_1 = require("./actions/Error");
var validator_1 = require("./actions/validator");
var types_1 = require("./client/types");
var collection_1 = require("./util/collection");
var env_1 = require("./util/env");
var Context;
'use strict';
var actions_Error_index = require('./actions/Error/index.js');
var actions_validator = require('./actions/validator.js');
var client_types = require('./client/types.js');
var util_collection = require('./util/collection.js');
var util_env = require('./util/env.js');
exports.Context = void 0;
(function (Context) {
Context["Modal"] = "Modal";
Context["Main"] = "Main";
})(Context = exports.Context || (exports.Context = {}));
})(exports.Context || (exports.Context = {}));
/**

@@ -24,5 +24,5 @@ * Create a MessageTransport from a Frame.

if (!host) {
throw Error_1.fromAction('App frame is undefined', Error_1.AppActionType.WINDOW_UNDEFINED);
throw actions_Error_index.fromAction('App frame is undefined', actions_Error_index.AppActionType.WINDOW_UNDEFINED);
}
if (env_1.isUnframed && window.MobileWebView) {
if (util_env.isUnframed && window.MobileWebView) {
Object.assign(window.MobileWebView, {

@@ -54,3 +54,3 @@ postMessageToIframe: function (message, origin) {

host.addEventListener('message', function (event) {
if (event.source === host || !validator_1.isAppMessage(event)) {
if (event.source === host || !actions_validator.isAppMessage(event)) {
return;

@@ -60,3 +60,3 @@ }

var errorMessage = "Message origin '" + event.origin + "' does not match app origin '" + localOrigin + "'.";
var payload = Error_1.invalidOriginAction(errorMessage);
var payload = actions_Error_index.invalidOriginAction(errorMessage);
var message = {

@@ -69,3 +69,3 @@ type: 'dispatch',

}
if (env_1.isUnframed && window.MobileWebView) {
if (util_env.isUnframed && window.MobileWebView) {
var payload = JSON.stringify({

@@ -93,7 +93,6 @@ id: 'unframed://fromClient',

subscribe: function (handler) {
return collection_1.addAndRemoveFromCollection(handlers, handler);
return util_collection.addAndRemoveFromCollection(handlers, handler);
},
};
}
exports.fromFrame = fromFrame;
/**

@@ -111,5 +110,5 @@ * Create a MessageTransport from a parent window.

window.addEventListener('message', function (event) {
if ((window === contentWindow && !env_1.isUnframed) ||
if ((window === contentWindow && !util_env.isUnframed) ||
event.source !== contentWindow ||
!(validator_1.isAppBridgeAction(event.data.payload) || validator_1.isAppMessage(event))) {
!(actions_validator.isAppBridgeAction(event.data.payload) || actions_validator.isAppMessage(event))) {
return;

@@ -131,3 +130,3 @@ }

}
if (env_1.isUnframed && window && window.MobileWebView) {
if (util_env.isUnframed && window && window.MobileWebView) {
var payload = JSON.stringify({

@@ -145,7 +144,6 @@ id: 'unframed://fromClient',

subscribe: function (handler) {
return collection_1.addAndRemoveFromCollection(handlers, handler);
return util_collection.addAndRemoveFromCollection(handlers, handler);
},
};
}
exports.fromWindow = fromWindow;
function createTransportListener() {

@@ -158,3 +156,3 @@ var listeners = [];

// eslint-disable-next-line prefer-rest-params
return collection_1.addAndRemoveFromCollection(listeners, { callback: arguments[0] });
return util_collection.addAndRemoveFromCollection(listeners, { callback: arguments[0] });
}

@@ -169,7 +167,7 @@ // eslint-disable-next-line prefer-rest-params

if (dispatcher) {
dispatcher(types_1.MessageType.Subscribe, payload);
dispatcher(client_types.MessageType.Subscribe, payload);
}
return collection_1.addAndRemoveFromCollection(actionListeners[type], actionCallback, function () {
return util_collection.addAndRemoveFromCollection(actionListeners[type], actionCallback, function () {
if (dispatcher) {
dispatcher(types_1.MessageType.Unsubscribe, payload);
dispatcher(client_types.MessageType.Unsubscribe, payload);
}

@@ -203,3 +201,2 @@ });

}
exports.createTransportListener = createTransportListener;
function isDispatchAction(message) {

@@ -212,1 +209,5 @@ return (message !== null &&

}
exports.createTransportListener = createTransportListener;
exports.fromFrame = fromFrame;
exports.fromWindow = fromWindow;
{
"name": "@shopify/app-bridge-core",
"version": "1.2.1-snapshot-20240606192113",
"version": "1.3.0-snapshot-20240607111514",
"types": "index.d.ts",
"main": "index.js",
"module": "./esm/index.js",
"files": [
"/esm/",
"/actions/",

@@ -16,2 +18,34 @@ "/client/",

],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./esm/index.js",
"default": "./index.js"
},
"./actions": {
"types": "./actions/index.d.ts",
"import": "./esm/actions/index.js",
"default": "./actions/index.js"
},
"./actions/*": {
"types": "./actions/*/index.d.ts",
"import": "./esm/actions/*/index.js",
"default": "./actions/*/index.js"
},
"./client": {
"types": "./client/index.d.ts",
"import": "./esm/client/index.js",
"default": "./client/index.js"
},
"./util/*": {
"types": "./util/*.d.ts",
"import": "./esm/util/*.js",
"default": "./util/*.js"
},
"./validate/*": {
"types": "./validate/*.d.ts",
"import": "./esm/validate/*.js",
"default": "./validate/*.js"
}
},
"private": false,

@@ -27,7 +61,4 @@ "publishConfig": {

"scripts": {
"build": "yarn build:tsc",
"build:tsc": "NODE_ENV=production tsc",
"check": "tsc",
"clean": "NODE_ENV=production tsc --build --clean",
"size": "size-limit"
"build": "rollup --config ./rollup.config.mjs",
"clean": "tsc --build --clean"
},

@@ -34,0 +65,0 @@ "sideEffects": false,

@@ -1,4 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeFromCollection = exports.addAndRemoveFromCollection = void 0;
'use strict';
/**

@@ -17,3 +16,2 @@ * Add an item to a collection, return a function that can then be used to

}
exports.addAndRemoveFromCollection = addAndRemoveFromCollection;
/**

@@ -36,2 +34,4 @@ * Remove the item from the collection. Optionally accepting a callback that is

}
exports.addAndRemoveFromCollection = addAndRemoveFromCollection;
exports.removeFromCollection = removeFromCollection;

@@ -1,8 +0,11 @@

"use strict";
'use strict';
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isUnframed = exports.isClient = exports.isServer = void 0;
exports.isServer = typeof window === 'undefined';
exports.isClient = !exports.isServer;
var isServer = typeof window === 'undefined';
var isClient = !isServer;
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
exports.isUnframed = exports.isClient && ((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.indexOf('Unframed')) > 0;
var isUnframed = isClient && ((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.indexOf('Unframed')) > 0;
exports.isClient = isClient;
exports.isServer = isServer;
exports.isUnframed = isUnframed;

@@ -1,27 +0,33 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = exports.validateAction = exports.validateProps = exports.buttonSchemaWithId = exports.buttonSchema = void 0;
var Button_1 = require("../../actions/Button");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return Button_1.Action; } });
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
exports.buttonSchema = type_validate_1.matchesObject({
disabled: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
label: type_validate_1.matchesString(),
style: type_validate_1.makeOptional(type_validate_1.matchesEnum(Button_1.Style)),
icon: type_validate_1.makeOptional(type_validate_1.matchesEnum(Button_1.Icon)),
loading: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
plain: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
'use strict';
var actions_Button_index = require('../../actions/Button/index.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
var buttonSchema = validate_typeValidate.matchesObject({
disabled: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
label: validate_typeValidate.matchesString(),
style: validate_typeValidate.makeOptional(validate_typeValidate.matchesEnum(actions_Button_index.Style)),
icon: validate_typeValidate.makeOptional(validate_typeValidate.matchesEnum(actions_Button_index.Icon)),
loading: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
plain: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
});
exports.buttonSchemaWithId = type_validate_1.composeSchemas(type_validate_1.matchesObject({
id: type_validate_1.matchesString(),
}), exports.buttonSchema);
var buttonSchemaWithId = validate_typeValidate.composeSchemas(validate_typeValidate.matchesObject({
id: validate_typeValidate.matchesString(),
}), buttonSchema);
function validateProps(props) {
return type_validate_1.validate(props, exports.buttonSchema);
return validate_typeValidate.validate(props, buttonSchema);
}
exports.validateProps = validateProps;
function validateAction(action) {
var validator = utils_1.createActionValidator(Button_1.Action, action.type === Button_1.Action.UPDATE ? exports.buttonSchema : undefined, true, true);
return type_validate_1.validate(action, validator);
var validator = validate_utils.createActionValidator(actions_Button_index.Action, action.type === actions_Button_index.Action.UPDATE ? buttonSchema : undefined, true, true);
return validate_typeValidate.validate(action, validator);
}
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return actions_Button_index.Action; }
});
exports.buttonSchema = buttonSchema;
exports.buttonSchemaWithId = buttonSchemaWithId;
exports.validateAction = validateAction;
exports.validateProps = validateProps;

@@ -1,20 +0,25 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = exports.validateAction = exports.validateProps = exports.buttonGroupSchema = void 0;
var ButtonGroup_1 = require("../../actions/ButtonGroup");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return ButtonGroup_1.Action; } });
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
var button_1 = require("./button");
exports.buttonGroupSchema = type_validate_1.composeSchemas(button_1.buttonSchema, type_validate_1.matchesObject({
buttons: type_validate_1.matchesArray(type_validate_1.makeOptional(button_1.buttonSchemaWithId)),
'use strict';
var actions_ButtonGroup_index = require('../../actions/ButtonGroup/index.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
var validate_actions_button = require('./button.js');
var buttonGroupSchema = validate_typeValidate.composeSchemas(validate_actions_button.buttonSchema, validate_typeValidate.matchesObject({
buttons: validate_typeValidate.matchesArray(validate_typeValidate.makeOptional(validate_actions_button.buttonSchemaWithId)),
}));
function validateProps(props) {
return type_validate_1.validate(props, exports.buttonGroupSchema);
return validate_typeValidate.validate(props, buttonGroupSchema);
}
exports.validateProps = validateProps;
function validateAction(action) {
var validator = utils_1.createActionValidator(ButtonGroup_1.Action, exports.buttonGroupSchema, true, true);
return type_validate_1.validate(action, validator);
var validator = validate_utils.createActionValidator(actions_ButtonGroup_index.Action, buttonGroupSchema, true, true);
return validate_typeValidate.validate(action, validator);
}
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return actions_ButtonGroup_index.Action; }
});
exports.buttonGroupSchema = buttonGroupSchema;
exports.validateAction = validateAction;
exports.validateProps = validateProps;

@@ -1,27 +0,32 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = exports.validateAction = exports.validateProps = exports.contextSaveBarSchema = void 0;
var type_validate_1 = require("../type-validate");
var ContextualSaveBar_1 = require("../../actions/ContextualSaveBar");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return ContextualSaveBar_1.Action; } });
var utils_1 = require("../utils");
exports.contextSaveBarSchema = type_validate_1.makeOptional(type_validate_1.matchesObject({
fullWidth: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
discardAction: type_validate_1.makeOptional(type_validate_1.matchesObject({
disabled: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
discardConfirmationModal: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
'use strict';
var validate_typeValidate = require('../type-validate.js');
var actions_ContextualSaveBar_index = require('../../actions/ContextualSaveBar/index.js');
var validate_utils = require('../utils.js');
var contextSaveBarSchema = validate_typeValidate.makeOptional(validate_typeValidate.matchesObject({
fullWidth: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
discardAction: validate_typeValidate.makeOptional(validate_typeValidate.matchesObject({
disabled: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
discardConfirmationModal: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
})),
saveAction: type_validate_1.makeOptional(type_validate_1.matchesObject({
disabled: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
saveAction: validate_typeValidate.makeOptional(validate_typeValidate.matchesObject({
disabled: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
})),
leaveConfirmationDisable: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
leaveConfirmationDisable: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
}));
function validateProps(props) {
return type_validate_1.validate(props, exports.contextSaveBarSchema);
return validate_typeValidate.validate(props, contextSaveBarSchema);
}
exports.validateProps = validateProps;
function validateAction(action) {
var validator = utils_1.createActionValidator(ContextualSaveBar_1.Action, exports.contextSaveBarSchema);
return type_validate_1.validate(action, validator);
var validator = validate_utils.createActionValidator(actions_ContextualSaveBar_index.Action, contextSaveBarSchema);
return validate_typeValidate.validate(action, validator);
}
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return actions_ContextualSaveBar_index.Action; }
});
exports.contextSaveBarSchema = contextSaveBarSchema;
exports.validateAction = validateAction;
exports.validateProps = validateProps;

@@ -1,24 +0,29 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = exports.validateAction = exports.validateProps = exports.feedbackModalSchema = void 0;
var FeedbackModal_1 = require("../../actions/FeedbackModal");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return FeedbackModal_1.Action; } });
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
exports.feedbackModalSchema = type_validate_1.matchesObject({
formId: type_validate_1.matchesPositiveInteger(),
'use strict';
var actions_FeedbackModal_index = require('../../actions/FeedbackModal/index.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
var feedbackModalSchema = validate_typeValidate.matchesObject({
formId: validate_typeValidate.matchesPositiveInteger(),
});
function validateProps(props) {
return type_validate_1.validate(props, exports.feedbackModalSchema);
return validate_typeValidate.validate(props, feedbackModalSchema);
}
exports.validateProps = validateProps;
function validateAction(action) {
switch (action.type) {
case FeedbackModal_1.Action.OPEN:
return type_validate_1.validate(action, utils_1.createActionValidator(FeedbackModal_1.Action, exports.feedbackModalSchema, true));
case FeedbackModal_1.Action.CLOSE:
case actions_FeedbackModal_index.Action.OPEN:
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_FeedbackModal_index.Action, feedbackModalSchema, true));
case actions_FeedbackModal_index.Action.CLOSE:
default:
return type_validate_1.validate(action, utils_1.createActionValidator(FeedbackModal_1.Action));
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_FeedbackModal_index.Action));
}
}
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return actions_FeedbackModal_index.Action; }
});
exports.feedbackModalSchema = feedbackModalSchema;
exports.validateAction = validateAction;
exports.validateProps = validateProps;

@@ -1,48 +0,31 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.unstable_Picker = exports.Toast = exports.TitleBar = exports.ResourcePicker = exports.Navigation = exports.Modal = exports.Menu = exports.Link = exports.LeaveConfirmation = exports.FeedbackModal = exports.ContextualSaveBar = exports.ButtonGroup = exports.Button = void 0;
var Button = __importStar(require("./button"));
exports.Button = Button;
var ButtonGroup = __importStar(require("./buttonGroup"));
exports.ButtonGroup = ButtonGroup;
var ContextualSaveBar = __importStar(require("./contextualSaveBar"));
exports.ContextualSaveBar = ContextualSaveBar;
var FeedbackModal = __importStar(require("./feedbackModal"));
exports.FeedbackModal = FeedbackModal;
var LeaveConfirmation = __importStar(require("./leaveConfirmation"));
exports.LeaveConfirmation = LeaveConfirmation;
var Link = __importStar(require("./link"));
exports.Link = Link;
var Menu = __importStar(require("./menu"));
exports.Menu = Menu;
var Modal = __importStar(require("./modal"));
exports.Modal = Modal;
var Navigation = __importStar(require("./navigation"));
exports.Navigation = Navigation;
var ResourcePicker = __importStar(require("./resourcePicker"));
exports.ResourcePicker = ResourcePicker;
var TitleBar = __importStar(require("./titleBar"));
exports.TitleBar = TitleBar;
var Toast = __importStar(require("./toast"));
exports.Toast = Toast;
var unstable_Picker = __importStar(require("./picker"));
exports.unstable_Picker = unstable_Picker;
'use strict';
var validate_actions_button = require('./button.js');
var validate_actions_buttonGroup = require('./buttonGroup.js');
var validate_actions_contextualSaveBar = require('./contextualSaveBar.js');
var validate_actions_feedbackModal = require('./feedbackModal.js');
var validate_actions_leaveConfirmation = require('./leaveConfirmation.js');
var validate_actions_link = require('./link.js');
var validate_actions_menu = require('./menu.js');
var validate_actions_modal = require('./modal.js');
var validate_actions_navigation = require('./navigation.js');
var validate_actions_resourcePicker = require('./resourcePicker.js');
var validate_actions_titleBar = require('./titleBar.js');
var toast = require('../../packages/app-bridge-core/src/validate/actions/toast.js');
var validate_actions_picker = require('./picker.js');
exports.Button = validate_actions_button;
exports.ButtonGroup = validate_actions_buttonGroup;
exports.ContextualSaveBar = validate_actions_contextualSaveBar;
exports.FeedbackModal = validate_actions_feedbackModal;
exports.LeaveConfirmation = validate_actions_leaveConfirmation;
exports.Link = validate_actions_link;
exports.Menu = validate_actions_menu;
exports.Modal = validate_actions_modal;
exports.Navigation = validate_actions_navigation;
exports.ResourcePicker = validate_actions_resourcePicker;
exports.TitleBar = validate_actions_titleBar;
exports.Toast = toast;
exports.unstable_Picker = validate_actions_picker;

@@ -1,12 +0,16 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = exports.validateAction = void 0;
var LeaveConfirmation_1 = require("../../actions/LeaveConfirmation");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return LeaveConfirmation_1.Action; } });
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
'use strict';
var actions_LeaveConfirmation_index = require('../../actions/LeaveConfirmation/index.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
function validateAction(action) {
var validator = utils_1.createActionValidator(LeaveConfirmation_1.Action);
return type_validate_1.validate(action, validator);
var validator = validate_utils.createActionValidator(actions_LeaveConfirmation_index.Action);
return validate_typeValidate.validate(action, validator);
}
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return actions_LeaveConfirmation_index.Action; }
});
exports.validateAction = validateAction;

@@ -1,8 +0,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = exports.validateAction = exports.validateProps = exports.linkActionSchema = exports.linkPropsSchema = void 0;
var AppLink_1 = require("../../actions/Link/AppLink");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return AppLink_1.Action; } });
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
'use strict';
var actions_Link_AppLink_index = require('../../actions/Link/AppLink/index.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
var AllowedRedirectType;

@@ -13,19 +12,26 @@ (function (AllowedRedirectType) {

})(AllowedRedirectType || (AllowedRedirectType = {}));
exports.linkPropsSchema = type_validate_1.matchesObject({
label: type_validate_1.matchesString(),
destination: utils_1.relativeUrlSchema,
redirectType: type_validate_1.matchesEnum(AllowedRedirectType),
var linkPropsSchema = validate_typeValidate.matchesObject({
label: validate_typeValidate.matchesString(),
destination: validate_utils.relativeUrlSchema,
redirectType: validate_typeValidate.matchesEnum(AllowedRedirectType),
});
exports.linkActionSchema = type_validate_1.matchesObject({
label: type_validate_1.matchesString(),
destination: utils_1.relativePathSchema,
redirectType: type_validate_1.matchesEnum(AllowedRedirectType),
var linkActionSchema = validate_typeValidate.matchesObject({
label: validate_typeValidate.matchesString(),
destination: validate_utils.relativePathSchema,
redirectType: validate_typeValidate.matchesEnum(AllowedRedirectType),
});
function validateProps(props) {
return type_validate_1.validate(props, exports.linkPropsSchema);
return validate_typeValidate.validate(props, linkPropsSchema);
}
exports.validateProps = validateProps;
function validateAction(action) {
return type_validate_1.validate(action, utils_1.createActionValidator(AppLink_1.Action, exports.linkActionSchema, true, true));
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_Link_AppLink_index.Action, linkActionSchema, true, true));
}
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return actions_Link_AppLink_index.Action; }
});
exports.linkActionSchema = linkActionSchema;
exports.linkPropsSchema = linkPropsSchema;
exports.validateAction = validateAction;
exports.validateProps = validateProps;

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateAction = exports.validateProps = void 0;
var NavigationMenu_1 = require("../../actions/Menu/NavigationMenu");
var ChannelMenu_1 = require("../../actions/Menu/ChannelMenu");
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
var helper_1 = require("../../actions/helper");
var link_1 = require("./link");
var linkOptionsValidator = type_validate_1.matchesObject({ id: type_validate_1.matchesString(), options: link_1.linkPropsSchema });
'use strict';
var actions_Menu_NavigationMenu_index = require('../../actions/Menu/NavigationMenu/index.js');
var actions_Menu_ChannelMenu_index = require('../../actions/Menu/ChannelMenu/index.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
var actions_helper = require('../../actions/helper.js');
var validate_actions_link = require('./link.js');
var linkOptionsValidator = validate_typeValidate.matchesObject({ id: validate_typeValidate.matchesString(), options: validate_actions_link.linkPropsSchema });
function activeLinkError(value) {

@@ -21,14 +21,14 @@ return [

function getOptionsSchema(options) {
var baseSchema = type_validate_1.matchesObject({
items: type_validate_1.makeOptional(type_validate_1.matchesArray(linkOptionsValidator)),
active: type_validate_1.makeOptional(linkOptionsValidator),
var baseSchema = validate_typeValidate.matchesObject({
items: validate_typeValidate.makeOptional(validate_typeValidate.matchesArray(linkOptionsValidator)),
active: validate_typeValidate.makeOptional(linkOptionsValidator),
});
var items = options.items, active = options.active;
if (items && active) {
var activeItemSchema = type_validate_1.matchesObject({
active: type_validate_1.composeSchemas(linkOptionsValidator, function (value) {
var activeItemSchema = validate_typeValidate.matchesObject({
active: validate_typeValidate.composeSchemas(linkOptionsValidator, function (value) {
return items.find(function (item) { return item.id === value.id; }) ? undefined : activeLinkError(value);
}),
});
return type_validate_1.composeSchemas(baseSchema, activeItemSchema);
return validate_typeValidate.composeSchemas(baseSchema, activeItemSchema);
}

@@ -38,10 +38,10 @@ return baseSchema;

function getPayloadSchema(payload) {
var baseSchema = type_validate_1.matchesObject({
items: type_validate_1.makeOptional(type_validate_1.matchesArray(link_1.linkActionSchema)),
active: type_validate_1.makeOptional(type_validate_1.matchesString()),
var baseSchema = validate_typeValidate.matchesObject({
items: validate_typeValidate.makeOptional(validate_typeValidate.matchesArray(validate_actions_link.linkActionSchema)),
active: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
});
var items = payload.items, active = payload.active;
if (items && active) {
var activeItemSchema = type_validate_1.matchesObject({
active: type_validate_1.composeSchemas(type_validate_1.matchesString(), function (value) {
var activeItemSchema = validate_typeValidate.matchesObject({
active: validate_typeValidate.composeSchemas(validate_typeValidate.matchesString(), function (value) {
return items.find(function (item) { return item.id === value; })

@@ -52,3 +52,3 @@ ? undefined

});
return type_validate_1.composeSchemas(baseSchema, activeItemSchema);
return validate_typeValidate.composeSchemas(baseSchema, activeItemSchema);
}

@@ -58,13 +58,14 @@ return baseSchema;

function validateProps(props) {
var result = type_validate_1.validate(props, getOptionsSchema(props));
var result = validate_typeValidate.validate(props, getOptionsSchema(props));
return result;
}
exports.validateProps = validateProps;
function validateAction(action) {
var actionType = NavigationMenu_1.Action;
if (helper_1.findMatchInEnum(ChannelMenu_1.Action, action.type)) {
actionType = ChannelMenu_1.Action;
var actionType = actions_Menu_NavigationMenu_index.Action;
if (actions_helper.findMatchInEnum(actions_Menu_ChannelMenu_index.Action, action.type)) {
actionType = actions_Menu_ChannelMenu_index.Action;
}
return type_validate_1.validate(action, utils_1.createActionValidator(actionType, getPayloadSchema(action.payload), true, false));
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actionType, getPayloadSchema(action.payload), true, false));
}
exports.validateAction = validateAction;
exports.validateProps = validateProps;

@@ -1,22 +0,11 @@

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = exports.validateAction = exports.validateProps = void 0;
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
var Modal_1 = require("../../actions/Modal");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return Modal_1.Action; } });
var Button_1 = require("../../actions/Button");
var safe_redirect_1 = require("../safe-redirect");
var button_1 = require("./button");
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
var actions_Modal_index = require('../../actions/Modal/index.js');
var actions_Button_index = require('../../actions/Button/index.js');
var validate_safeRedirect = require('../safe-redirect.js');
var validate_actions_button = require('./button.js');
function matchesSafeOrigin(value, localOrigin) {

@@ -36,3 +25,3 @@ var hostName;

}
var isSafeSrc = safe_redirect_1.isSafe(value, {
var isSafeSrc = validate_safeRedirect.isSafe(value, {
requireAbsolute: true,

@@ -55,3 +44,3 @@ requireSSL: true,

return function (value) {
var values = [Modal_1.Size.Small, Modal_1.Size.Medium, Modal_1.Size.Large];
var values = [actions_Modal_index.Size.Small, actions_Modal_index.Size.Medium, actions_Modal_index.Size.Large];
if (values.includes(value)) {

@@ -61,6 +50,6 @@ return;

var message = "expected:" + values.map(function (val) { return "`" + val + "`"; }).join(' or ');
if (value === Modal_1.Size.Full) {
if (value === actions_Modal_index.Size.Full) {
message += ". Size `" + value + "` is deprecated as of version 1.6.5 and will fall back to size `medium`";
}
if (value === Modal_1.Size.Auto) {
if (value === actions_Modal_index.Size.Auto) {
message += ". Size `" + value + "` is deprecated as of version 1.12.x and will fall back to size `medium`. Use the `setUpModalAutoSizing` utility from `app-bridge` instead";

@@ -79,44 +68,49 @@ }

if (props === void 0) { props = {}; }
var baseModalSchema = type_validate_1.matchesObject({
title: type_validate_1.makeOptional(type_validate_1.matchesString()),
footer: type_validate_1.makeOptional(type_validate_1.matchesObject({
buttons: type_validate_1.matchesObject({
primary: type_validate_1.makeOptional(button_1.buttonSchemaWithId),
secondary: type_validate_1.makeOptional(type_validate_1.matchesArray(button_1.buttonSchemaWithId)),
var baseModalSchema = validate_typeValidate.matchesObject({
title: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
footer: validate_typeValidate.makeOptional(validate_typeValidate.matchesObject({
buttons: validate_typeValidate.matchesObject({
primary: validate_typeValidate.makeOptional(validate_actions_button.buttonSchemaWithId),
secondary: validate_typeValidate.makeOptional(validate_typeValidate.matchesArray(validate_actions_button.buttonSchemaWithId)),
}),
})),
size: type_validate_1.makeOptional(matchesSize()),
size: validate_typeValidate.makeOptional(matchesSize()),
});
if (Modal_1.isIframeModal(props)) {
if (actions_Modal_index.isIframeModal(props)) {
if (props.url) {
var urlSchema = type_validate_1.matchesObject({
url: type_validate_1.composeSchemas(type_validate_1.matchesString(), function (value) {
var urlSchema = validate_typeValidate.matchesObject({
url: validate_typeValidate.composeSchemas(validate_typeValidate.matchesString(), function (value) {
return localOrigin ? matchesSafeOrigin(value, localOrigin) : undefined;
}),
});
return type_validate_1.composeSchemas(baseModalSchema, urlSchema);
return validate_typeValidate.composeSchemas(baseModalSchema, urlSchema);
}
return type_validate_1.composeSchemas(baseModalSchema, utils_1.relativePathSchema);
return validate_typeValidate.composeSchemas(baseModalSchema, validate_utils.relativePathSchema);
}
return type_validate_1.composeSchemas(baseModalSchema, type_validate_1.matchesObject({ message: type_validate_1.matchesString() }));
return validate_typeValidate.composeSchemas(baseModalSchema, validate_typeValidate.matchesObject({ message: validate_typeValidate.matchesString() }));
}
function validateProps(props, localOrigin) {
return type_validate_1.validate(props, getModalSchema(props, localOrigin));
return validate_typeValidate.validate(props, getModalSchema(props, localOrigin));
}
exports.validateProps = validateProps;
function validateAction(action, localOrigin) {
var schema = getModalSchema(action.payload, localOrigin);
switch (action.type) {
case Modal_1.Action.OPEN:
case Modal_1.Action.UPDATE:
return type_validate_1.validate(action, utils_1.createActionValidator(Modal_1.Action, schema, true, action.type === Modal_1.Action.UPDATE));
case Modal_1.Action.FOOTER_BUTTON_CLICK:
return button_1.validateAction(__assign(__assign({}, action), { type: Button_1.Action.CLICK }));
case Modal_1.Action.FOOTER_BUTTON_UPDATE:
return button_1.validateAction(__assign(__assign({}, action), { type: Button_1.Action.UPDATE }));
case Modal_1.Action.CLOSE:
case actions_Modal_index.Action.OPEN:
case actions_Modal_index.Action.UPDATE:
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_Modal_index.Action, schema, true, action.type === actions_Modal_index.Action.UPDATE));
case actions_Modal_index.Action.FOOTER_BUTTON_CLICK:
return validate_actions_button.validateAction(tslib_es6.__assign(tslib_es6.__assign({}, action), { type: actions_Button_index.Action.CLICK }));
case actions_Modal_index.Action.FOOTER_BUTTON_UPDATE:
return validate_actions_button.validateAction(tslib_es6.__assign(tslib_es6.__assign({}, action), { type: actions_Button_index.Action.UPDATE }));
case actions_Modal_index.Action.CLOSE:
default:
return type_validate_1.validate(action, utils_1.createActionValidator(Modal_1.Action));
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_Modal_index.Action));
}
}
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return actions_Modal_index.Action; }
});
exports.validateAction = validateAction;
exports.validateProps = validateProps;

@@ -1,38 +0,9 @@

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateAction = exports.getSectionSchema = exports.matchesAbsolutePath = void 0;
var History = __importStar(require("../../actions/Navigation/History"));
var Redirect = __importStar(require("../../actions/Navigation/Redirect"));
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_Navigation_History_index = require('../../actions/Navigation/History/index.js');
var actions_Navigation_Redirect_index = require('../../actions/Navigation/Redirect/index.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
function matchesAbsolutePath(value) {

@@ -49,3 +20,2 @@ return value.match('^https?://')

}
exports.matchesAbsolutePath = matchesAbsolutePath;
function getSectionSchema(payload) {

@@ -55,43 +25,45 @@ var isProductVariant = payload &&

payload.section.resource &&
payload.section.name === Redirect.ResourceType.Product;
payload.section.name === actions_Navigation_Redirect_index.ResourceType.Product;
var resourceSchema = {
create: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
id: type_validate_1.makeOptional(type_validate_1.matchesString()),
create: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
id: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
};
var productVariantSchema = __assign(__assign({}, resourceSchema), { variant: type_validate_1.makeOptional(type_validate_1.matchesObject(resourceSchema)) });
return type_validate_1.matchesObject({
section: type_validate_1.matchesObject({
name: type_validate_1.matchesEnum(Redirect.ResourceType),
resource: type_validate_1.makeOptional(type_validate_1.matchesObject(isProductVariant ? productVariantSchema : resourceSchema)),
var productVariantSchema = tslib_es6.__assign(tslib_es6.__assign({}, resourceSchema), { variant: validate_typeValidate.makeOptional(validate_typeValidate.matchesObject(resourceSchema)) });
return validate_typeValidate.matchesObject({
section: validate_typeValidate.matchesObject({
name: validate_typeValidate.matchesEnum(actions_Navigation_Redirect_index.ResourceType),
resource: validate_typeValidate.makeOptional(validate_typeValidate.matchesObject(isProductVariant ? productVariantSchema : resourceSchema)),
}),
});
}
exports.getSectionSchema = getSectionSchema;
function validateAction(action) {
var newContextSchema = type_validate_1.matchesObject({ newContext: type_validate_1.makeOptional(type_validate_1.matchesBoolean()) });
var actionType = Redirect.Action;
var newContextSchema = validate_typeValidate.matchesObject({ newContext: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()) });
var actionType = actions_Navigation_Redirect_index.Action;
var schema;
switch (action.type) {
case History.Action.PUSH:
case History.Action.REPLACE:
actionType = History.Action;
schema = utils_1.relativePathSchema;
case actions_Navigation_History_index.Action.PUSH:
case actions_Navigation_History_index.Action.REPLACE:
actionType = actions_Navigation_History_index.Action;
schema = validate_utils.relativePathSchema;
break;
case Redirect.Action.APP:
schema = utils_1.relativePathSchema;
case actions_Navigation_Redirect_index.Action.APP:
schema = validate_utils.relativePathSchema;
break;
case Redirect.Action.REMOTE:
schema = type_validate_1.composeSchemas(type_validate_1.matchesObject({
url: type_validate_1.composeSchemas(type_validate_1.matchesString(), function (value) { return matchesAbsolutePath(value); }),
case actions_Navigation_Redirect_index.Action.REMOTE:
schema = validate_typeValidate.composeSchemas(validate_typeValidate.matchesObject({
url: validate_typeValidate.composeSchemas(validate_typeValidate.matchesString(), function (value) { return matchesAbsolutePath(value); }),
}), newContextSchema);
break;
case Redirect.Action.ADMIN_PATH:
schema = type_validate_1.composeSchemas(utils_1.relativePathSchema, newContextSchema);
case actions_Navigation_Redirect_index.Action.ADMIN_PATH:
schema = validate_typeValidate.composeSchemas(validate_utils.relativePathSchema, newContextSchema);
break;
case Redirect.Action.ADMIN_SECTION:
schema = type_validate_1.composeSchemas(getSectionSchema(action.payload), newContextSchema);
case actions_Navigation_Redirect_index.Action.ADMIN_SECTION:
schema = validate_typeValidate.composeSchemas(getSectionSchema(action.payload), newContextSchema);
break;
}
return type_validate_1.validate(action, utils_1.createActionValidator(actionType, schema));
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actionType, schema));
}
exports.getSectionSchema = getSectionSchema;
exports.matchesAbsolutePath = matchesAbsolutePath;
exports.validateAction = validateAction;

@@ -1,79 +0,68 @@

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = exports.validateAction = exports.validateProps = void 0;
var Picker_1 = require("../../actions/Picker");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return Picker_1.Action; } });
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
var resourceBadge = type_validate_1.matchesObject({
content: type_validate_1.matchesString(),
id: type_validate_1.matchesString(),
progress: type_validate_1.matchesEnum(Picker_1.ALL_BADGE_PROGRESSES),
status: type_validate_1.matchesEnum(Picker_1.ALL_BADGE_STATUSES),
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_Picker_index = require('../../actions/Picker/index.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
var resourceBadge = validate_typeValidate.matchesObject({
content: validate_typeValidate.matchesString(),
id: validate_typeValidate.matchesString(),
progress: validate_typeValidate.matchesEnum(actions_Picker_index.ALL_BADGE_PROGRESSES),
status: validate_typeValidate.matchesEnum(actions_Picker_index.ALL_BADGE_STATUSES),
});
var resourceMedia = type_validate_1.matchesObject({
accessibilityLabel: type_validate_1.makeOptional(type_validate_1.matchesString()),
alt: type_validate_1.makeOptional(type_validate_1.matchesString()),
initials: type_validate_1.makeOptional(type_validate_1.matchesString()),
kind: type_validate_1.makeOptional(type_validate_1.matchesEnum(Picker_1.ALL_MEDIA_KINDS)),
name: type_validate_1.makeOptional(type_validate_1.matchesString()),
source: type_validate_1.matchesString(),
var resourceMedia = validate_typeValidate.matchesObject({
accessibilityLabel: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
alt: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
initials: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
kind: validate_typeValidate.makeOptional(validate_typeValidate.matchesEnum(actions_Picker_index.ALL_MEDIA_KINDS)),
name: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
source: validate_typeValidate.matchesString(),
});
var sharedResourceSchema = {
accessibilityLabel: type_validate_1.makeOptional(type_validate_1.matchesString()),
badges: type_validate_1.makeOptional(type_validate_1.matchesArray(resourceBadge)),
disabled: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
id: type_validate_1.matchesString(),
loading: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
media: type_validate_1.makeOptional(resourceMedia),
name: type_validate_1.makeOptional(type_validate_1.matchesString()),
caption: type_validate_1.makeOptional(type_validate_1.matchesString()),
selectable: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
accessibilityLabel: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
badges: validate_typeValidate.makeOptional(validate_typeValidate.matchesArray(resourceBadge)),
disabled: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
id: validate_typeValidate.matchesString(),
loading: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
media: validate_typeValidate.makeOptional(resourceMedia),
name: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
caption: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
selectable: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
};
var resourceOption = type_validate_1.matchesObject(__assign({}, sharedResourceSchema));
var resourceSelectionSchema = type_validate_1.matchesArray(type_validate_1.matchesObject(__assign(__assign({}, sharedResourceSchema), { options: type_validate_1.makeOptional(type_validate_1.matchesArray(resourceOption)) })));
var resourceName = type_validate_1.matchesObject({
plural: type_validate_1.matchesString(),
singular: type_validate_1.matchesString(),
var resourceOption = validate_typeValidate.matchesObject(tslib_es6.__assign({}, sharedResourceSchema));
var resourceSelectionSchema = validate_typeValidate.matchesArray(validate_typeValidate.matchesObject(tslib_es6.__assign(tslib_es6.__assign({}, sharedResourceSchema), { options: validate_typeValidate.makeOptional(validate_typeValidate.matchesArray(resourceOption)) })));
var resourceName = validate_typeValidate.matchesObject({
plural: validate_typeValidate.matchesString(),
singular: validate_typeValidate.matchesString(),
});
var pickerOptions = type_validate_1.matchesObject({
canLoadMore: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
emptySearchLabel: type_validate_1.makeOptional(type_validate_1.matchesObject({
title: type_validate_1.matchesString(),
description: type_validate_1.matchesString(),
withIllustration: type_validate_1.matchesBoolean(),
var pickerOptions = validate_typeValidate.matchesObject({
canLoadMore: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
emptySearchLabel: validate_typeValidate.makeOptional(validate_typeValidate.matchesObject({
title: validate_typeValidate.matchesString(),
description: validate_typeValidate.matchesString(),
withIllustration: validate_typeValidate.matchesBoolean(),
})),
items: type_validate_1.makeOptional(resourceSelectionSchema),
loading: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
loadingMore: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
maxSelectable: type_validate_1.makeOptional(type_validate_1.matchesPositiveInteger()),
primaryActionLabel: type_validate_1.makeOptional(type_validate_1.matchesString()),
searchQuery: type_validate_1.makeOptional(type_validate_1.matchesString()),
searchQueryPlaceholder: type_validate_1.makeOptional(type_validate_1.matchesString()),
secondaryActionLabel: type_validate_1.makeOptional(type_validate_1.matchesString()),
selectedItems: type_validate_1.makeOptional(type_validate_1.matchesArray(type_validate_1.matchesObject(sharedResourceSchema))),
title: type_validate_1.makeOptional(type_validate_1.matchesString()),
verticalAlignment: type_validate_1.makeOptional(type_validate_1.matchesEnum(Picker_1.ALL_RESOURCE_VERTICAL_ALIGNMENT)),
allowEmptySelection: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
resourceName: type_validate_1.makeOptional(resourceName),
items: validate_typeValidate.makeOptional(resourceSelectionSchema),
loading: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
loadingMore: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
maxSelectable: validate_typeValidate.makeOptional(validate_typeValidate.matchesPositiveInteger()),
primaryActionLabel: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
searchQuery: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
searchQueryPlaceholder: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
secondaryActionLabel: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
selectedItems: validate_typeValidate.makeOptional(validate_typeValidate.matchesArray(validate_typeValidate.matchesObject(sharedResourceSchema))),
title: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
verticalAlignment: validate_typeValidate.makeOptional(validate_typeValidate.matchesEnum(actions_Picker_index.ALL_RESOURCE_VERTICAL_ALIGNMENT)),
allowEmptySelection: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
resourceName: validate_typeValidate.makeOptional(resourceName),
});
var pickerActionSchema = type_validate_1.matchesObject({
options: type_validate_1.makeOptional(resourceSelectionSchema),
var pickerActionSchema = validate_typeValidate.matchesObject({
options: validate_typeValidate.makeOptional(resourceSelectionSchema),
});
var selectionSchema = type_validate_1.matchesObject({
var selectionSchema = validate_typeValidate.matchesObject({
selectedItems: resourceSelectionSchema,
});
var searchSchema = type_validate_1.matchesObject({
searchQuery: type_validate_1.makeOptional(type_validate_1.matchesString()),
var searchSchema = validate_typeValidate.matchesObject({
searchQuery: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
});

@@ -84,5 +73,4 @@ /**

function validateProps(props) {
return type_validate_1.validate(props, pickerOptions);
return validate_typeValidate.validate(props, pickerOptions);
}
exports.validateProps = validateProps;
/**

@@ -93,16 +81,22 @@ * @unstable This API may be updated without warning in the future

switch (action.type) {
case Picker_1.Action.UPDATE:
case Picker_1.Action.OPEN:
return type_validate_1.validate(action, utils_1.createActionValidator(Picker_1.Action, pickerActionSchema, false, true));
case Picker_1.Action.SELECT:
return type_validate_1.validate(action, utils_1.createActionValidator(Picker_1.Action, selectionSchema, true, true));
case Picker_1.Action.SEARCH:
return type_validate_1.validate(action, utils_1.createActionValidator(Picker_1.Action, searchSchema, true, true));
case Picker_1.Action.CANCEL:
case Picker_1.Action.LOAD_MORE:
return type_validate_1.validate(action, utils_1.createActionValidator(Picker_1.Action));
case actions_Picker_index.Action.UPDATE:
case actions_Picker_index.Action.OPEN:
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_Picker_index.Action, pickerActionSchema, false, true));
case actions_Picker_index.Action.SELECT:
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_Picker_index.Action, selectionSchema, true, true));
case actions_Picker_index.Action.SEARCH:
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_Picker_index.Action, searchSchema, true, true));
case actions_Picker_index.Action.CANCEL:
case actions_Picker_index.Action.LOAD_MORE:
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_Picker_index.Action));
default:
return type_validate_1.validate(action, utils_1.createActionValidator(Picker_1.Action));
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_Picker_index.Action));
}
}
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return actions_Picker_index.Action; }
});
exports.validateAction = validateAction;
exports.validateProps = validateProps;

@@ -1,48 +0,52 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = exports.validateAction = exports.validateProps = void 0;
var ResourcePicker_1 = require("../../actions/ResourcePicker");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return ResourcePicker_1.Action; } });
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
var resourceSelectionSchema = type_validate_1.matchesArray(type_validate_1.matchesObject({
id: type_validate_1.matchesString(),
'use strict';
var actions_ResourcePicker_index = require('../../actions/ResourcePicker/index.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
var resourceSelectionSchema = validate_typeValidate.matchesArray(validate_typeValidate.matchesObject({
id: validate_typeValidate.matchesString(),
}));
var resourcePickerOptions = type_validate_1.matchesObject({
initialQuery: type_validate_1.makeOptional(type_validate_1.matchesString()),
filterQuery: type_validate_1.makeOptional(type_validate_1.matchesString()),
initialSelectionIds: type_validate_1.makeOptional(resourceSelectionSchema),
selectMultiple: type_validate_1.makeOptional(type_validate_1.oneOf(type_validate_1.matchesBoolean(), type_validate_1.matchesPositiveInteger())),
showHidden: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
showVariants: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
showDraft: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
showArchived: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
showDraftBadge: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
showArchivedBadge: type_validate_1.makeOptional(type_validate_1.matchesBoolean()),
actionVerb: type_validate_1.makeOptional(type_validate_1.matchesEnum(ResourcePicker_1.ActionVerb)),
var resourcePickerOptions = validate_typeValidate.matchesObject({
initialQuery: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
filterQuery: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
initialSelectionIds: validate_typeValidate.makeOptional(resourceSelectionSchema),
selectMultiple: validate_typeValidate.makeOptional(validate_typeValidate.oneOf(validate_typeValidate.matchesBoolean(), validate_typeValidate.matchesPositiveInteger())),
showHidden: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
showVariants: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
showDraft: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
showArchived: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
showDraftBadge: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
showArchivedBadge: validate_typeValidate.makeOptional(validate_typeValidate.matchesBoolean()),
actionVerb: validate_typeValidate.makeOptional(validate_typeValidate.matchesEnum(actions_ResourcePicker_index.ActionVerb)),
});
var resourcePickerActionSchema = type_validate_1.matchesObject({
resourceType: type_validate_1.matchesEnum(ResourcePicker_1.ResourceType),
options: type_validate_1.makeOptional(resourcePickerOptions),
var resourcePickerActionSchema = validate_typeValidate.matchesObject({
resourceType: validate_typeValidate.matchesEnum(actions_ResourcePicker_index.ResourceType),
options: validate_typeValidate.makeOptional(resourcePickerOptions),
});
var selectionSchema = type_validate_1.matchesObject({
var selectionSchema = validate_typeValidate.matchesObject({
selection: resourceSelectionSchema,
});
function validateProps(props) {
return type_validate_1.validate(props, resourcePickerOptions);
return validate_typeValidate.validate(props, resourcePickerOptions);
}
exports.validateProps = validateProps;
function validateAction(action) {
switch (action.type) {
case ResourcePicker_1.Action.UPDATE:
case ResourcePicker_1.Action.OPEN:
return type_validate_1.validate(action, utils_1.createActionValidator(ResourcePicker_1.Action, resourcePickerActionSchema, false, true));
case ResourcePicker_1.Action.SELECT:
return type_validate_1.validate(action, utils_1.createActionValidator(ResourcePicker_1.Action, selectionSchema, true, true));
case ResourcePicker_1.Action.CANCEL:
case ResourcePicker_1.Action.CLOSE:
case actions_ResourcePicker_index.Action.UPDATE:
case actions_ResourcePicker_index.Action.OPEN:
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_ResourcePicker_index.Action, resourcePickerActionSchema, false, true));
case actions_ResourcePicker_index.Action.SELECT:
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_ResourcePicker_index.Action, selectionSchema, true, true));
case actions_ResourcePicker_index.Action.CANCEL:
case actions_ResourcePicker_index.Action.CLOSE:
default:
return type_validate_1.validate(action, utils_1.createActionValidator(ResourcePicker_1.Action));
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_ResourcePicker_index.Action));
}
}
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return actions_ResourcePicker_index.Action; }
});
exports.validateAction = validateAction;
exports.validateProps = validateProps;

@@ -1,33 +0,22 @@

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = exports.validateAction = exports.validateProps = exports.titleBarSchema = void 0;
var TitleBar_1 = require("../../actions/TitleBar");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return TitleBar_1.Action; } });
var Button_1 = require("../../actions/Button");
var ButtonGroup_1 = require("../../actions/ButtonGroup");
var type_validate_1 = require("../type-validate");
var utils_1 = require("../utils");
var button_1 = require("./button");
var buttonGroup_1 = require("./buttonGroup");
var buttonSchemaWithId = type_validate_1.composeSchemas(button_1.buttonSchema, type_validate_1.matchesObject({
id: type_validate_1.matchesString(),
'use strict';
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var actions_TitleBar_index = require('../../actions/TitleBar/index.js');
var actions_Button_index = require('../../actions/Button/index.js');
var actions_ButtonGroup_index = require('../../actions/ButtonGroup/index.js');
var validate_typeValidate = require('../type-validate.js');
var validate_utils = require('../utils.js');
var validate_actions_button = require('./button.js');
var validate_actions_buttonGroup = require('./buttonGroup.js');
var buttonSchemaWithId = validate_typeValidate.composeSchemas(validate_actions_button.buttonSchema, validate_typeValidate.matchesObject({
id: validate_typeValidate.matchesString(),
}));
exports.titleBarSchema = type_validate_1.matchesObject({
breadcrumbs: type_validate_1.makeOptional(button_1.buttonSchema),
title: type_validate_1.makeOptional(type_validate_1.matchesString()),
buttons: type_validate_1.makeOptional(type_validate_1.matchesObject({
primary: type_validate_1.makeOptional(buttonSchemaWithId),
secondary: type_validate_1.makeOptional(type_validate_1.matchesArray(type_validate_1.composeSchemas(buttonSchemaWithId, type_validate_1.matchesObject({
buttons: type_validate_1.makeOptional(type_validate_1.matchesArray(buttonSchemaWithId)),
var titleBarSchema = validate_typeValidate.matchesObject({
breadcrumbs: validate_typeValidate.makeOptional(validate_actions_button.buttonSchema),
title: validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
buttons: validate_typeValidate.makeOptional(validate_typeValidate.matchesObject({
primary: validate_typeValidate.makeOptional(buttonSchemaWithId),
secondary: validate_typeValidate.makeOptional(validate_typeValidate.matchesArray(validate_typeValidate.composeSchemas(buttonSchemaWithId, validate_typeValidate.matchesObject({
buttons: validate_typeValidate.makeOptional(validate_typeValidate.matchesArray(buttonSchemaWithId)),
})))),

@@ -37,20 +26,26 @@ })),

function validateProps(props) {
return type_validate_1.validate(props, exports.titleBarSchema);
return validate_typeValidate.validate(props, titleBarSchema);
}
exports.validateProps = validateProps;
function validateAction(action) {
switch (action.type) {
default:
case TitleBar_1.Action.UPDATE:
return type_validate_1.validate(action, utils_1.createActionValidator(TitleBar_1.Action, exports.titleBarSchema, true, false));
case TitleBar_1.Action.BUTTON_CLICK:
case TitleBar_1.Action.BREADCRUMBS_CLICK:
return button_1.validateAction(__assign(__assign({}, action), { type: Button_1.Action.CLICK }));
case TitleBar_1.Action.BUTTON_UPDATE:
case TitleBar_1.Action.BREADCRUMBS_UPDATE:
return button_1.validateAction(__assign(__assign({}, action), { type: Button_1.Action.UPDATE }));
case TitleBar_1.Action.BUTTON_GROUP_UPDATE:
return buttonGroup_1.validateAction(__assign(__assign({}, action), { type: ButtonGroup_1.Action.UPDATE }));
case actions_TitleBar_index.Action.UPDATE:
return validate_typeValidate.validate(action, validate_utils.createActionValidator(actions_TitleBar_index.Action, titleBarSchema, true, false));
case actions_TitleBar_index.Action.BUTTON_CLICK:
case actions_TitleBar_index.Action.BREADCRUMBS_CLICK:
return validate_actions_button.validateAction(tslib_es6.__assign(tslib_es6.__assign({}, action), { type: actions_Button_index.Action.CLICK }));
case actions_TitleBar_index.Action.BUTTON_UPDATE:
case actions_TitleBar_index.Action.BREADCRUMBS_UPDATE:
return validate_actions_button.validateAction(tslib_es6.__assign(tslib_es6.__assign({}, action), { type: actions_Button_index.Action.UPDATE }));
case actions_TitleBar_index.Action.BUTTON_GROUP_UPDATE:
return validate_actions_buttonGroup.validateAction(tslib_es6.__assign(tslib_es6.__assign({}, action), { type: actions_ButtonGroup_index.Action.UPDATE }));
}
}
Object.defineProperty(exports, "Action", {
enumerable: true,
get: function () { return actions_TitleBar_index.Action; }
});
exports.titleBarSchema = titleBarSchema;
exports.validateAction = validateAction;
exports.validateProps = validateProps;

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSafe = void 0;
var constants_1 = require("../util/constants");
'use strict';
var constants = require('../packages/app-bridge-core/src/util/constants.js');
var FILE_URI_MATCH = /\/\/\//;

@@ -31,3 +31,3 @@ var INVALID_RELATIVE_URL = /[/\\][/\\]/;

}
if (allowInternalProtocol && url.protocol === constants_1.INTERNAL_PROTOCOL) {
if (allowInternalProtocol && url.protocol === constants.INTERNAL_PROTOCOL) {
return true;

@@ -52,3 +52,2 @@ }

}
exports.isSafe = isSafe;
function hostIsValid(url, allowedDomains, subdomains) {

@@ -71,1 +70,3 @@ if (!subdomains.every(function (subdomain) { return subdomain.startsWith('.'); })) {

}
exports.isSafe = isSafe;

@@ -1,21 +0,6 @@

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validate = exports.matchesPositiveInteger = exports.matchesBoolean = exports.makeOptional = exports.matchesString = exports.matchesObject = exports.getErrors = exports.oneOf = exports.matchesArray = exports.matchesEnum = exports.composeSchemas = exports.TYPE_ERROR = void 0;
exports.TYPE_ERROR = 'type_error_expected';
'use strict';
var tslib_es6 = require('../node_modules/tslib/tslib.es6.js');
var TYPE_ERROR = 'type_error_expected';
function composeSchemas() {

@@ -39,3 +24,2 @@ var validators = [];

}
exports.composeSchemas = composeSchemas;
/**

@@ -52,10 +36,9 @@ * Returns a validator that matches values in the given enum

? undefined
: constructErrors(value, 'invalid_enum_value', __assign(__assign({}, options), { message: message }));
: constructErrors(value, 'invalid_enum_value', tslib_es6.__assign(tslib_es6.__assign({}, options), { message: message }));
};
}
exports.matchesEnum = matchesEnum;
function matchesArray(validator, options) {
return function (value) {
if (!Array.isArray(value)) {
return constructErrors(value, exports.TYPE_ERROR + "_array", options);
return constructErrors(value, TYPE_ERROR + "_array", options);
}

@@ -69,3 +52,3 @@ if (!validator) {

if (objectError) {
errors = errors.concat(objectError.map(function (error) { return (__assign(__assign({}, error), { path: "['" + key + "']" + (error.path || '') })); }));
errors = errors.concat(objectError.map(function (error) { return (tslib_es6.__assign(tslib_es6.__assign({}, error), { path: "['" + key + "']" + (error.path || '') })); }));
}

@@ -76,3 +59,2 @@ });

}
exports.matchesArray = matchesArray;
function oneOf() {

@@ -95,3 +77,2 @@ var validators = [];

}
exports.oneOf = oneOf;
function constructErrors(value, error, options) {

@@ -114,12 +95,11 @@ if (options === void 0) { options = { message: undefined }; }

}
return error.map(function (errorObj) { return (__assign(__assign({}, errorObj), { path: "" + (path || '') + (errorObj.path || '') || undefined })); });
return error.map(function (errorObj) { return (tslib_es6.__assign(tslib_es6.__assign({}, errorObj), { path: "" + (path || '') + (errorObj.path || '') || undefined })); });
}
exports.getErrors = getErrors;
function matchesObject(schema, options) {
return function (val) {
if (typeof val !== 'object' || !val || Array.isArray(val)) {
return constructErrors(val, exports.TYPE_ERROR + "_object", options);
return constructErrors(val, TYPE_ERROR + "_object", options);
}
var flattened = Object.keys(schema).reduce(function (acc, key) {
return __spreadArray(__spreadArray([], acc), (getErrors(val, schema[key], key) || []));
return tslib_es6.__spreadArray(tslib_es6.__spreadArray([], acc), (getErrors(val, schema[key], key) || []));
}, []);

@@ -129,9 +109,7 @@ return flattened.length ? flattened : undefined;

}
exports.matchesObject = matchesObject;
function matchesString(options) {
return function (value) {
return typeof value === 'string' ? undefined : constructErrors(value, exports.TYPE_ERROR + "_string", options);
return typeof value === 'string' ? undefined : constructErrors(value, TYPE_ERROR + "_string", options);
};
}
exports.matchesString = matchesString;
function makeOptional(validator) {

@@ -145,3 +123,2 @@ return function (value) {

}
exports.makeOptional = makeOptional;
function matchesBoolean(options) {

@@ -151,17 +128,27 @@ return function (value) {

? undefined
: constructErrors(value, exports.TYPE_ERROR + "_boolean", options);
: constructErrors(value, TYPE_ERROR + "_boolean", options);
};
}
exports.matchesBoolean = matchesBoolean;
function matchesPositiveInteger(options) {
return function (value) {
return !Number.isInteger(value) || value < 0
? constructErrors(value, exports.TYPE_ERROR + "_integer", options)
? constructErrors(value, TYPE_ERROR + "_integer", options)
: undefined;
};
}
exports.matchesPositiveInteger = matchesPositiveInteger;
function validate(obj, validator) {
return getErrors(obj, validator);
}
exports.TYPE_ERROR = TYPE_ERROR;
exports.composeSchemas = composeSchemas;
exports.getErrors = getErrors;
exports.makeOptional = makeOptional;
exports.matchesArray = matchesArray;
exports.matchesBoolean = matchesBoolean;
exports.matchesEnum = matchesEnum;
exports.matchesObject = matchesObject;
exports.matchesPositiveInteger = matchesPositiveInteger;
exports.matchesString = matchesString;
exports.oneOf = oneOf;
exports.validate = validate;

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.relativePathSchema = exports.relativeUrlSchema = exports.isValidRelativePath = exports.createActionValidator = void 0;
var type_validate_1 = require("./type-validate");
'use strict';
var validate_typeValidate = require('./type-validate.js');
function createActionValidator(type, payloadSchema, payloadRequired, idRequired) {

@@ -9,19 +9,17 @@ if (payloadSchema === void 0) { payloadSchema = undefined; }

if (idRequired === void 0) { idRequired = false; }
var idSchema = type_validate_1.matchesObject({
id: idRequired ? type_validate_1.matchesString() : type_validate_1.makeOptional(type_validate_1.matchesString()),
var idSchema = validate_typeValidate.matchesObject({
id: idRequired ? validate_typeValidate.matchesString() : validate_typeValidate.makeOptional(validate_typeValidate.matchesString()),
});
var schema = payloadSchema ? type_validate_1.composeSchemas(idSchema, payloadSchema) : idSchema;
return type_validate_1.matchesObject({
type: type_validate_1.matchesEnum(type, {
var schema = payloadSchema ? validate_typeValidate.composeSchemas(idSchema, payloadSchema) : idSchema;
return validate_typeValidate.matchesObject({
type: validate_typeValidate.matchesEnum(type, {
message: function (_, val) { return "The action type `" + val + "` is invalid or unsupported"; },
}),
payload: payloadRequired ? schema : type_validate_1.makeOptional(schema),
payload: payloadRequired ? schema : validate_typeValidate.makeOptional(schema),
});
}
exports.createActionValidator = createActionValidator;
function isValidRelativePath(path) {
return typeof path === 'string' && (path === '' || path.startsWith('/'));
}
exports.isValidRelativePath = isValidRelativePath;
exports.relativeUrlSchema = type_validate_1.composeSchemas(type_validate_1.matchesString(), function (value) {
var relativeUrlSchema = validate_typeValidate.composeSchemas(validate_typeValidate.matchesString(), function (value) {
return isValidRelativePath(value)

@@ -31,4 +29,9 @@ ? undefined

});
exports.relativePathSchema = type_validate_1.matchesObject({
path: exports.relativeUrlSchema,
var relativePathSchema = validate_typeValidate.matchesObject({
path: relativeUrlSchema,
});
exports.createActionValidator = createActionValidator;
exports.isValidRelativePath = isValidRelativePath;
exports.relativePathSchema = relativePathSchema;
exports.relativeUrlSchema = relativeUrlSchema;
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