@shopify/app-bridge
Advanced tools
Comparing version 1.5.2 to 1.5.3
@@ -1,2 +0,2 @@ | ||
import { ClientApplication } from '../client'; | ||
import { ClientApplication } from '../client/types'; | ||
import { Indexable } from './merge'; | ||
@@ -3,0 +3,0 @@ import { ActionCallback, ActionSetInterface, ActionSubscription, Component, ErrorCallback, Unsubscribe } from './types'; |
@@ -31,7 +31,7 @@ "use strict"; | ||
var Error_1 = require("../actions/Error"); | ||
var client_1 = require("../client"); | ||
var types_1 = require("../client/types"); | ||
var collection_1 = require("../util/collection"); | ||
var constants_1 = require("./constants"); | ||
var merge_1 = __importDefault(require("./merge")); | ||
var types_1 = require("./types"); | ||
var types_2 = require("./types"); | ||
var constants_2 = require("./constants"); | ||
@@ -102,3 +102,3 @@ var uuid_1 = __importDefault(require("./uuid")); | ||
} | ||
return (_a = _this.app.hooks).run.apply(_a, [client_1.LifecycleHook.UpdateAction, defaultSet, _this].concat(args)); | ||
return (_a = _this.app.hooks).run.apply(_a, [types_1.LifecycleHook.UpdateAction, defaultSet, _this].concat(args)); | ||
}; | ||
@@ -163,3 +163,3 @@ } | ||
if (Error_1.isErrorEventName(eventName)) { | ||
eventNameSpace = getEventNameSpace(types_1.Group.Error, eventName, __assign({}, eventComponent, { type: '' })); | ||
eventNameSpace = getEventNameSpace(types_2.Group.Error, eventName, __assign({}, eventComponent, { type: '' })); | ||
} | ||
@@ -166,0 +166,0 @@ else { |
@@ -8,3 +8,3 @@ /** | ||
import { Button, Payload as ButtonPayload } from '../Button'; | ||
import { Action, ActionType, ClosePayload, Footer, FooterOptions, IframeOptions, IframePayload, MessageOptions, MessagePayload, Size } from './types'; | ||
import { Action, ActionType, ClosePayload, Footer, FooterOptions, IframeOptions, IframePayload, MessageOptions, MessagePayload, UpdateSizePayload, Size } from './types'; | ||
export interface ActionBase extends MetaAction { | ||
@@ -21,5 +21,20 @@ readonly group: typeof Group.Modal; | ||
} | ||
export declare type ModalAction = OpenAction | UpdateAction | CloseAction | MetaAction; | ||
/** | ||
* Payload options for APP::MODAL::UPDATE_SIZE action | ||
* @public | ||
*/ | ||
export interface UpdateSizeAction extends ActionBase { | ||
readonly payload: UpdateSizePayload; | ||
} | ||
/** | ||
* @internal | ||
*/ | ||
export declare type ModalAction = OpenAction | UpdateAction | CloseAction | MetaAction | UpdateSizeAction; | ||
export declare function openModal(modalPayload: MessagePayload | IframePayload): OpenAction; | ||
export declare function closeModal(modalClosePayload: ClosePayload): CloseAction; | ||
/** | ||
* Action creator for modal update size action | ||
* @internal | ||
*/ | ||
export declare function updateModalSize(updateSizePayload: UpdateSizePayload): UpdateSizeAction; | ||
export declare function clickFooterButton(id: string, payload?: any): ClickAction; | ||
@@ -26,0 +41,0 @@ export declare function update(payload: MessagePayload | IframePayload): UpdateAction; |
@@ -53,2 +53,14 @@ "use strict"; | ||
exports.closeModal = closeModal; | ||
/** | ||
* Action creator for modal update size action | ||
* @internal | ||
*/ | ||
function updateModalSize(updateSizePayload) { | ||
return helper_1.actionWrapper({ | ||
group: types_1.Group.Modal, | ||
payload: updateSizePayload, | ||
type: types_2.ActionType.UPDATE_SIZE, | ||
}); | ||
} | ||
exports.updateModalSize = updateModalSize; | ||
function clickFooterButton(id, payload) { | ||
@@ -55,0 +67,0 @@ var component = __assign({ id: id }, FOOTER_BUTTON_PROPS); |
@@ -8,4 +8,9 @@ /** | ||
CLOSE = "CLOSE", | ||
UPDATE = "UPDATE" | ||
UPDATE = "UPDATE", | ||
UPDATE_SIZE = "UPDATE_SIZE" | ||
} | ||
/** | ||
* Action types for the Modal group | ||
* @public | ||
*/ | ||
export declare enum ActionType { | ||
@@ -16,9 +21,27 @@ OPEN = "APP::MODAL::OPEN", | ||
FOOTER_BUTTON_CLICK = "APP::MODAL::FOOTER::BUTTON::CLICK", | ||
FOOTER_BUTTON_UPDATE = "APP::MODAL::FOOTER::BUTTON::UPDATE" | ||
FOOTER_BUTTON_UPDATE = "APP::MODAL::FOOTER::BUTTON::UPDATE", | ||
UPDATE_SIZE = "APP::MODAL::UPDATE_SIZE" | ||
} | ||
/** | ||
* Options available to the Modal `size` param | ||
* @public | ||
*/ | ||
export declare enum Size { | ||
/** Small modal size */ | ||
Small = "small", | ||
/** Medium modal size */ | ||
Medium = "medium", | ||
/** Large modal size (wider than medium) */ | ||
Large = "large", | ||
Full = "full" | ||
/** Full screen modal size */ | ||
Full = "full", | ||
/** | ||
* Automatic modal sizing. | ||
* | ||
* @remarks | ||
* Requires style `overflow:hidden` on `<body>` element of modal page. | ||
* Avoid `margin`, `padding`, and `height` styles on `<body>` element of modal page. | ||
* See documentation for more information. | ||
*/ | ||
Auto = "auto" | ||
} | ||
@@ -38,2 +61,11 @@ export interface BasePayload { | ||
} | ||
/** | ||
* Payload interface for APP::MODAL::UPDATE_SIZE action | ||
* @internal | ||
*/ | ||
export interface UpdateSizePayload { | ||
readonly id?: string; | ||
/** desired modal height in px, no suffix */ | ||
readonly height?: string; | ||
} | ||
export interface ClosePayload { | ||
@@ -40,0 +72,0 @@ readonly id?: string; |
@@ -11,3 +11,8 @@ "use strict"; | ||
Action["UPDATE"] = "UPDATE"; | ||
Action["UPDATE_SIZE"] = "UPDATE_SIZE"; | ||
})(Action = exports.Action || (exports.Action = {})); | ||
/** | ||
* Action types for the Modal group | ||
* @public | ||
*/ | ||
var ActionType; | ||
@@ -20,9 +25,27 @@ (function (ActionType) { | ||
ActionType["FOOTER_BUTTON_UPDATE"] = "APP::MODAL::FOOTER::BUTTON::UPDATE"; | ||
ActionType["UPDATE_SIZE"] = "APP::MODAL::UPDATE_SIZE"; | ||
})(ActionType = exports.ActionType || (exports.ActionType = {})); | ||
/** | ||
* Options available to the Modal `size` param | ||
* @public | ||
*/ | ||
var Size; | ||
(function (Size) { | ||
/** Small modal size */ | ||
Size["Small"] = "small"; | ||
/** Medium modal size */ | ||
Size["Medium"] = "medium"; | ||
/** Large modal size (wider than medium) */ | ||
Size["Large"] = "large"; | ||
/** Full screen modal size */ | ||
Size["Full"] = "full"; | ||
/** | ||
* Automatic modal sizing. | ||
* | ||
* @remarks | ||
* Requires style `overflow:hidden` on `<body>` element of modal page. | ||
* Avoid `margin`, `padding`, and `height` styles on `<body>` element of modal page. | ||
* See documentation for more information. | ||
*/ | ||
Size["Auto"] = "auto"; | ||
})(Size = exports.Size || (exports.Size = {})); |
import { MetaAction } from './types'; | ||
import { FeaturesAvailable, PermissionType } from '../client'; | ||
import { FeaturesAvailable, PermissionType } from '../client/types'; | ||
/** | ||
@@ -4,0 +4,0 @@ * Predicate to determine if an action is an App Bridge action. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var constants_1 = require("./constants"); | ||
var client_1 = require("../client"); | ||
var types_1 = require("../client/types"); | ||
var helper_1 = require("./helper"); | ||
@@ -61,4 +61,4 @@ /** | ||
var data = event.data; | ||
return data.hasOwnProperty('type') && helper_1.findMatchInEnum(client_1.MessageType, data.type) !== undefined; | ||
return data.hasOwnProperty('type') && helper_1.findMatchInEnum(types_1.MessageType, data.type) !== undefined; | ||
} | ||
exports.isAppMessage = isAppMessage; |
@@ -6,2 +6,14 @@ # Change Log | ||
## [1.5.3](https://github.com/Shopify/app-bridge/compare/v1.5.2...v1.5.3) (2019-05-24) | ||
### Features | ||
* modal auto sizing ([b1b21a1](https://github.com/Shopify/app-bridge/commit/b1b21a1)) | ||
* modal auto sizing ([#892](https://github.com/Shopify/app-bridge/issues/892)) ([4620eec](https://github.com/Shopify/app-bridge/commit/4620eec)) | ||
## [1.5.2](https://github.com/Shopify/app-bridge/compare/v1.5.1...v1.5.2) (2019-05-24) | ||
@@ -8,0 +20,0 @@ |
@@ -26,2 +26,3 @@ "use strict"; | ||
var redirect_1 = require("./redirect"); | ||
var modal_1 = require("./modal"); | ||
var types_1 = require("./types"); | ||
@@ -47,2 +48,3 @@ var Hooks_1 = __importDefault(require("./Hooks")); | ||
app.subscribe(Print_1.ActionType.APP, print_1.handleAppPrint); | ||
modal_1.setupModalAutoSizing(app); | ||
} | ||
@@ -49,0 +51,0 @@ /** |
{ | ||
"name": "@shopify/app-bridge", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"types": "index.d.ts", | ||
@@ -53,3 +53,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "60bb826c1184062605522bb44d188fcb9cfb9e67" | ||
"gitHead": "430d518a0de6a6307a058005424b1c93ca5ae2c4" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
463278
184
7171