@shopify/app-bridge
Advanced tools
Comparing version 1.6.0-alpha.1 to 1.6.0-alpha.2
@@ -37,2 +37,3 @@ import { Group } from '../types'; | ||
feature: Group; | ||
action?: String; | ||
} | ||
@@ -39,0 +40,0 @@ /** |
@@ -6,11 +6,25 @@ /** | ||
import { ActionSet } from '../helper'; | ||
import { Action, Options, OpenPayload } from './types'; | ||
import { Action, Options } from './types'; | ||
/** | ||
* Scanner | ||
* A set of Actions for displaying a Camera or NFC Scanner component | ||
* @public | ||
*/ | ||
export declare class Scanner extends ActionSet { | ||
constructor(app: ClientApplication<any>, options?: Options); | ||
dispatch(action: Action.OPEN, payload: OpenPayload): Scanner; | ||
/** | ||
* @public | ||
*/ | ||
dispatch(action: Action.OPEN_CAMERA): Scanner; | ||
/** | ||
* @public | ||
*/ | ||
dispatch(action: Action.OPEN_NFC): Scanner; | ||
/** | ||
* @internal | ||
*/ | ||
private dispatchScannerAction; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
export declare function create(app: ClientApplication<any>, options?: Options): Scanner; |
@@ -18,13 +18,2 @@ "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 }); | ||
@@ -35,3 +24,4 @@ var helper_1 = require("../helper"); | ||
/** | ||
* Scanner | ||
* A set of Actions for displaying a Camera or NFC Scanner component | ||
* @public | ||
*/ | ||
@@ -43,15 +33,26 @@ var Scanner = /** @class */ (function (_super) { | ||
} | ||
Scanner.prototype.dispatch = function (action, payload) { | ||
/** | ||
* @public | ||
*/ | ||
Scanner.prototype.dispatch = function (action) { | ||
switch (action) { | ||
case types_2.Action.OPEN: | ||
this.dispatchScannerAction(types_2.ActionType.OPEN, payload); | ||
case types_2.Action.OPEN_CAMERA: | ||
this.dispatchScannerAction(types_2.ActionType.OPEN_CAMERA); | ||
break; | ||
case types_2.Action.OPEN_NFC: | ||
this.dispatchScannerAction(types_2.ActionType.OPEN_NFC); | ||
break; | ||
} | ||
return this; | ||
}; | ||
Scanner.prototype.dispatchScannerAction = function (type, payload) { | ||
/** | ||
* @internal | ||
*/ | ||
Scanner.prototype.dispatchScannerAction = function (type) { | ||
this.app.dispatch(helper_1.actionWrapper({ | ||
type: type, | ||
group: types_1.Group.Scanner, | ||
payload: __assign({}, (payload || {}), { id: this.id }), | ||
payload: { | ||
id: this.id, | ||
}, | ||
})); | ||
@@ -62,2 +63,5 @@ }; | ||
exports.Scanner = Scanner; | ||
/** | ||
* @public | ||
*/ | ||
function create(app, options) { | ||
@@ -64,0 +68,0 @@ return new Scanner(app, options); |
/** | ||
* @module Scanner | ||
*/ | ||
/** | ||
* Action Types for the Features group | ||
* @public | ||
*/ | ||
export declare enum ActionType { | ||
OPEN = "APP::SCANNER::OPEN", | ||
OPEN_CAMERA = "APP::SCANNER::OPEN::CAMERA", | ||
OPEN_NFC = "APP::SCANNER::OPEN::NFC", | ||
CAPTURE = "APP::SCANNER::CAPTURE" | ||
} | ||
/** | ||
* Actions available to the Features group | ||
* @public | ||
*/ | ||
export declare enum Action { | ||
OPEN = "OPEN", | ||
OPEN_CAMERA = "OPEN::CAMERA", | ||
OPEN_NFC = "OPEN::NFC", | ||
CAPTURE = "CAPTURE" | ||
} | ||
/** | ||
* Payload for APP::SCANNER::CAPTURE | ||
* @public | ||
*/ | ||
export interface Data { | ||
@@ -21,10 +35,1 @@ scanData?: string; | ||
} | ||
export declare enum OpenType { | ||
Scan = "Scan" | ||
} | ||
export interface OpenData { | ||
type: OpenType; | ||
} | ||
export interface OpenPayload { | ||
readonly data: OpenData; | ||
} |
@@ -6,15 +6,21 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Action Types for the Features group | ||
* @public | ||
*/ | ||
var ActionType; | ||
(function (ActionType) { | ||
ActionType["OPEN"] = "APP::SCANNER::OPEN"; | ||
ActionType["OPEN_CAMERA"] = "APP::SCANNER::OPEN::CAMERA"; | ||
ActionType["OPEN_NFC"] = "APP::SCANNER::OPEN::NFC"; | ||
ActionType["CAPTURE"] = "APP::SCANNER::CAPTURE"; | ||
})(ActionType = exports.ActionType || (exports.ActionType = {})); | ||
/** | ||
* Actions available to the Features group | ||
* @public | ||
*/ | ||
var Action; | ||
(function (Action) { | ||
Action["OPEN"] = "OPEN"; | ||
Action["OPEN_CAMERA"] = "OPEN::CAMERA"; | ||
Action["OPEN_NFC"] = "OPEN::NFC"; | ||
Action["CAPTURE"] = "CAPTURE"; | ||
})(Action = exports.Action || (exports.Action = {})); | ||
var OpenType; | ||
(function (OpenType) { | ||
OpenType["Scan"] = "Scan"; | ||
})(OpenType = exports.OpenType || (exports.OpenType = {})); |
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.6.0-alpha.2](https://github.com/Shopify/app-bridge/compare/v1.6.0-alpha.1...v1.6.0-alpha.2) (2019-06-04) | ||
### Features | ||
* **nfc:** added nfc action support to scanner action ([55b4810](https://github.com/Shopify/app-bridge/commit/55b4810)) | ||
# [1.6.0-alpha.1](https://github.com/Shopify/app-bridge/compare/v1.6.0-alpha.0...v1.6.0-alpha.1) (2019-06-03) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@shopify/app-bridge", | ||
"version": "1.6.0-alpha.1", | ||
"version": "1.6.0-alpha.2", | ||
"types": "index.d.ts", | ||
@@ -53,3 +53,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "bf40fd3f734035f93d87887bc9c47865dc1a1223" | ||
"gitHead": "630d35f2a07342ddad0872a8379c057200643e1e" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
465281
7214