@shopify/app-bridge-react 2.0.22 → 2.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/components/ClientRouter/ClientRouter.js +1 -1
- package/components/ClientRouter/hook.js +3 -3
- package/components/ContextualSaveBar/ContextualSaveBar.js +5 -5
- package/components/Modal/Modal.js +1 -1
- package/components/NavigationMenu/NavigationMenu.d.ts +17 -0
- package/components/NavigationMenu/NavigationMenu.js +55 -0
- package/components/NavigationMenu/index.d.ts +3 -0
- package/components/NavigationMenu/index.js +7 -0
- package/components/Provider/Provider.d.ts +1 -2
- package/components/Provider/Provider.js +2 -6
- package/components/RoutePropagator/RoutePropagator.js +2 -2
- package/components/RoutePropagator/globals.d.ts +1 -1
- package/components/RoutePropagator/hook.js +3 -3
- package/components/RoutePropagator/route-propagator.js +5 -5
- package/components/TitleBar/TitleBar.js +2 -2
- package/components/index.d.ts +4 -3
- package/components/index.js +10 -12
- package/context.d.ts +1 -1
- package/context.js +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +3 -1
- package/hooks/useAppBridgeState/index.d.ts +1 -0
- package/hooks/useAppBridgeState/index.js +13 -0
- package/hooks/useAppBridgeState/useAppBridgeState.d.ts +10 -0
- package/hooks/useAppBridgeState/useAppBridgeState.js +75 -0
- package/hooks/useContextualSaveBar/useContextualSaveBar.js +6 -6
- package/hooks/useLocale/index.d.ts +1 -0
- package/hooks/useLocale/index.js +5 -0
- package/hooks/useLocale/useLocale.d.ts +1 -0
- package/hooks/useLocale/useLocale.js +8 -0
- package/hooks/useNavigationHistory/useNavigationHistory.js +2 -2
- package/hooks/useToast/useToast.js +4 -4
- package/index.d.ts +1 -0
- package/index.js +2 -5
- package/package.json +3 -3
- package/umd/index.js +3 -3
- package/useAppBridge.js +1 -1
- package/utilities/transformers.js +7 -11
package/useAppBridge.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.useAppBridge = void 0;
|
|
|
4
4
|
var react_1 = require("react");
|
|
5
5
|
var context_1 = require("./context");
|
|
6
6
|
function useAppBridge() {
|
|
7
|
-
var appBridge =
|
|
7
|
+
var appBridge = react_1.useContext(context_1.AppBridgeContext);
|
|
8
8
|
if (!appBridge) {
|
|
9
9
|
throw new Error('No AppBridge context provided. Your component must be wrapped in the <Provider> component from App Bridge React.');
|
|
10
10
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
3
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
4
|
+
to[j] = from[i];
|
|
5
|
+
return to;
|
|
10
6
|
};
|
|
11
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
8
|
exports.transformActions = exports.generateRedirect = void 0;
|
|
@@ -37,7 +33,7 @@ function redirectAction(target, external) {
|
|
|
37
33
|
function transformActions(appBridge, _a) {
|
|
38
34
|
var primaryAction = _a.primaryAction, secondaryActions = _a.secondaryActions, actionGroups = _a.actionGroups;
|
|
39
35
|
var primary = transformPrimaryAction(appBridge, primaryAction);
|
|
40
|
-
var secondary = __spreadArray(__spreadArray([], transformSecondaryActions(appBridge, secondaryActions)
|
|
36
|
+
var secondary = __spreadArray(__spreadArray([], transformSecondaryActions(appBridge, secondaryActions)), transformActionGroups(appBridge, actionGroups));
|
|
41
37
|
return {
|
|
42
38
|
primary: primary,
|
|
43
39
|
secondary: secondary,
|
|
@@ -73,7 +69,7 @@ function transformSecondaryActions(appBridge, secondaryActions) {
|
|
|
73
69
|
if (secondaryActions === void 0) { secondaryActions = []; }
|
|
74
70
|
var secondary = __spreadArray([], secondaryActions.map(function (secondaryAction) {
|
|
75
71
|
return transformAction(appBridge, secondaryAction);
|
|
76
|
-
})
|
|
72
|
+
}));
|
|
77
73
|
return secondary;
|
|
78
74
|
}
|
|
79
75
|
function transformActionGroups(appBridge, actionGroups) {
|
|
@@ -83,6 +79,6 @@ function transformActionGroups(appBridge, actionGroups) {
|
|
|
83
79
|
return transformAction(appBridge, groupAction);
|
|
84
80
|
});
|
|
85
81
|
return actions_1.ButtonGroup.create(appBridge, { label: group.title, plain: group.plain, buttons: buttons });
|
|
86
|
-
})
|
|
82
|
+
}));
|
|
87
83
|
return buttonGroups;
|
|
88
84
|
}
|