@shopify/app-bridge
Advanced tools
Comparing version 1.6.1 to 1.6.2-alpha.0
@@ -101,3 +101,3 @@ import { ClientApplication } from '../../client'; | ||
*/ | ||
export declare function create(app: ClientApplication<any>, options: Options): ContextualSaveBar; | ||
export declare function create(app: ClientApplication<any>, options?: Options): ContextualSaveBar; | ||
export {}; |
@@ -6,2 +6,6 @@ import { ClientApplication } from '../client/types'; | ||
export declare function getVersion(): any; | ||
/** | ||
* Returns full event name with prefix, group, subgroups and type formatted with separators | ||
* @internal | ||
* */ | ||
export declare function getEventNameSpace(group: string, eventName: string, component?: Component): string; | ||
@@ -8,0 +12,0 @@ export declare function isValidOptionalNumber(value?: number): boolean; |
@@ -50,4 +50,8 @@ "use strict"; | ||
exports.getVersion = getVersion; | ||
/** | ||
* Returns full event name with prefix, group, subgroups and type formatted with separators | ||
* @internal | ||
* */ | ||
function getEventNameSpace(group, eventName, component) { | ||
var eventNameSpace = group.toUpperCase(); | ||
var eventNameSpace = groupToEventNameSpace(group); | ||
if (component) { | ||
@@ -367,1 +371,21 @@ var subgroups_1 = component.subgroups, type = component.type; | ||
exports.findMatchInEnum = findMatchInEnum; | ||
function camelCaseToSnakeCase(value) { | ||
return value.replace(/([A-Z])/g, function (matcher, _val, index) { | ||
return "" + (index !== 0 ? '_' : '') + matcher[0].toLowerCase(); | ||
}); | ||
} | ||
/** | ||
* Maps the group name to its event name | ||
* @internal | ||
* @remarks - This method is necessary for the new pattern of using snake case | ||
* which makes it more readable and easier to reconstruct the group from an event name. | ||
* Example: `ContextualSaveBar` becomes `CONTEXTUAL_SAVE_BAR` | ||
* */ | ||
function groupToEventNameSpace(group) { | ||
switch (group) { | ||
case types_2.Group.ContextualSaveBar: | ||
return camelCaseToSnakeCase(group).toUpperCase(); | ||
default: | ||
return group.toUpperCase(); | ||
} | ||
} |
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.6.2-alpha.0](https://github.com/Shopify/app-bridge/compare/v1.6.1...v1.6.2-alpha.0) (2019-06-06) | ||
### Bug Fixes | ||
* **contextual-save-bar:** correctly map the group name to its event name ([ea52b45](https://github.com/Shopify/app-bridge/commit/ea52b45)) | ||
## [1.6.1](https://github.com/Shopify/app-bridge/compare/v1.6.0...v1.6.1) (2019-06-05) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@shopify/app-bridge", | ||
"version": "1.6.1", | ||
"version": "1.6.2-alpha.0", | ||
"types": "index.d.ts", | ||
@@ -53,3 +53,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "c4303abbf6dfbe718590ed1bc3dcdd0d442a2687" | ||
"gitHead": "badbcc0282676a8ddb745c82b6678c0a9fae396b" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
467185
7242
2