🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@gadgetinc/react-shopify-app-bridge

Package Overview
Dependencies
Maintainers
6
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gadgetinc/react-shopify-app-bridge - npm Package Compare versions

Comparing version

to
0.12.0

31

dist/src/Provider.js

@@ -65,4 +65,6 @@ "use strict";

(0, react_2.useEffect)(() => {
if (!appBridge)
if (!appBridge) {
console.debug("[gadget-rsab] no app bridge, skipping client auth setup");
return;
}
// setup the api client to always query using the custom shopify auth implementation

@@ -84,2 +86,3 @@ api.connection.setAuthenticationMode({

});
console.debug("[gadget-rsab] set up client auth for session tokens");
}, [api.connection, appBridge]);

@@ -117,2 +120,9 @@ let runningShopifyAuth = false;

const redirectURLWithOAuthParams = redirectURL.toString();
console.debug("[gadget-rsab] redirecting to gadget to initiate oauth process", {
appType: type,
isInstallRequest,
isEmbedded,
redirectURL: redirectURLWithOAuthParams,
gadgetAppUrl,
});
if (isEmbedded && appBridge) {

@@ -127,3 +137,3 @@ actions_1.Redirect.create(appBridge).dispatch(actions_1.Redirect.Action.REMOTE, redirectURLWithOAuthParams);

(0, react_2.useEffect)(() => {
return setContext({
const context = {
isAuthenticated,

@@ -136,3 +146,5 @@ isEmbedded,

isRootFrameRequest,
});
};
console.debug("[gadget-rsab] context changed", context);
return setContext(context);
}, [loading, isEmbedded, appBridge, isAuthenticated, error, isRootFrameRequest]);

@@ -174,4 +186,15 @@ return react_2.default.createElement(index_1.GadgetAuthContext.Provider, { value: context }, children);

react_2.default.createElement(InnerGadgetProvider, { forceRedirect: forceRedirect, isEmbedded: isEmbedded, gadgetAppUrl: gadgetAppUrl, api: api, originalQueryParams: originalQueryParams, isRootFrameRequest: isRootFrameRequest, type: coalescedType, isInstallRequest: !!isInstallRequest }, children)));
const shouldMountAppBridge = host && coalescedType != AppType.Standalone && (!isInstallRequest || inDestinationContext);
console.debug("[gadget-rsab] provider rendering", {
host,
coalescedType,
isInstallRequest,
isReady,
isEmbedded,
isRootFrameRequest,
inDestinationContext,
shouldMountAppBridge,
});
// app bridge provider seems to prevent urql from sending graphql requests when it cannot communicate using postMessage when not embedded so we must skip using the app bridge provider on the very first redirect from shopify
if (host && coalescedType != AppType.Standalone && (!isInstallRequest || inDestinationContext)) {
if (shouldMountAppBridge) {
app = (react_2.default.createElement(app_bridge_react_1.Provider, { config: {

@@ -178,0 +201,0 @@ apiKey: shopifyApiKey,

8

package.json
{
"name": "@gadgetinc/react-shopify-app-bridge",
"version": "0.11.0",
"version": "0.12.0",
"source": "src/index.ts",

@@ -22,3 +22,3 @@ "main": "dist/src/index.js",

"dependencies": {
"@gadgetinc/api-client-core": "^0.14.0",
"@gadgetinc/api-client-core": "^0.15.0",
"@shopify/app-bridge-utils": "^3.1.1",

@@ -35,3 +35,3 @@ "crypto-js": "^4.1.1",

"@types/lodash": "^4.14.191",
"@types/node": "^14.18.26",
"@types/node": "^16.11.7",
"@types/react": "^18.2.9",

@@ -46,3 +46,3 @@ "@types/react-dom": "^18.2.4",

"peerDependencies": {
"@gadgetinc/react": "^0.13.0",
"@gadgetinc/react": "^0.14.0",
"@shopify/app-bridge": "^2.0.0 || ^3.0.0",

@@ -49,0 +49,0 @@ "@shopify/app-bridge-react": "^2.0.0 || ^3.0.0",

Sorry, the diff of this file is not supported yet