You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@gadgetinc/react-shopify-app-bridge

Package Overview
Dependencies
Maintainers
6
Versions
60
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.15.2

14

dist/cjs/Provider.js

@@ -75,2 +75,3 @@ "use strict";

const hasFetchedOrInstalledShop = (0, react_2.useRef)(false);
const hasStartedFetchingOrInstallingShop = (0, react_2.useRef)(false);
const [{ data: fetchOrInstallShopData, fetching: fetchingOrInstallingShop, error: fetchingOrInstallingShopError }, fetchOrInstallShop] = (0, react_1.useMutation)(FetchOrInstallShopMutation);

@@ -83,2 +84,9 @@ if (fetchOrInstallShopData) {

}
// we want to show the loading state until we've started fetching or installing the shop
// or the mutation to fetch or install the shop has completed
(0, react_2.useEffect)(() => {
if (fetchingOrInstallingShop) {
hasStartedFetchingOrInstallingShop.current = true;
}
}, [fetchingOrInstallingShop]);
// always run one fetch to the gadget backend on boot to discover if this app is installed

@@ -91,6 +99,7 @@ (0, react_2.useEffect)(() => {

hasFetchedOrInstalledShop.current = true;
console.debug("[gadget-rsab] fetching or installing shop");
console.debug("[gadget-rsab] getting sessionToken to fetch or install shop");
appBridge
.idToken()
.then((idToken) => {
console.debug("[gadget-rsab] fetching or installing shop");
fetchOrInstallShop({ shopifySessionToken: idToken }).catch((err) => {

@@ -120,3 +129,3 @@ console.error({ err }, "[gadget-rsab] error fetching or installing shop");

}, [gadgetAppUrl, isRootFrameRequest, originalQueryParams, redirectToOauth]);
const loading = (forceRedirect || redirectToOauth || fetchingOrInstallingShop) && !isRootFrameRequest;
const loading = forceRedirect || redirectToOauth || fetchingOrInstallingShop || !hasStartedFetchingOrInstallingShop.current;
(0, react_2.useEffect)(() => {

@@ -199,2 +208,3 @@ const context = {

host,
location,
coalescedType,

@@ -201,0 +211,0 @@ isReady,

@@ -71,2 +71,3 @@ import { Provider as GadgetUrqlProvider, useMutation } from "@gadgetinc/react";

const hasFetchedOrInstalledShop = useRef(false);
const hasStartedFetchingOrInstallingShop = useRef(false);
const [{ data: fetchOrInstallShopData, fetching: fetchingOrInstallingShop, error: fetchingOrInstallingShopError }, fetchOrInstallShop] = useMutation(FetchOrInstallShopMutation);

@@ -79,2 +80,9 @@ if (fetchOrInstallShopData) {

}
// we want to show the loading state until we've started fetching or installing the shop
// or the mutation to fetch or install the shop has completed
useEffect(() => {
if (fetchingOrInstallingShop) {
hasStartedFetchingOrInstallingShop.current = true;
}
}, [fetchingOrInstallingShop]);
// always run one fetch to the gadget backend on boot to discover if this app is installed

@@ -87,6 +95,7 @@ useEffect(() => {

hasFetchedOrInstalledShop.current = true;
console.debug("[gadget-rsab] fetching or installing shop");
console.debug("[gadget-rsab] getting sessionToken to fetch or install shop");
appBridge
.idToken()
.then((idToken) => {
console.debug("[gadget-rsab] fetching or installing shop");
fetchOrInstallShop({ shopifySessionToken: idToken }).catch((err) => {

@@ -116,3 +125,3 @@ console.error({ err }, "[gadget-rsab] error fetching or installing shop");

}, [gadgetAppUrl, isRootFrameRequest, originalQueryParams, redirectToOauth]);
const loading = (forceRedirect || redirectToOauth || fetchingOrInstallingShop) && !isRootFrameRequest;
const loading = forceRedirect || redirectToOauth || fetchingOrInstallingShop || !hasStartedFetchingOrInstallingShop.current;
useEffect(() => {

@@ -195,2 +204,3 @@ const context = {

host,
location,
coalescedType,

@@ -197,0 +207,0 @@ isReady,

2

package.json
{
"name": "@gadgetinc/react-shopify-app-bridge",
"version": "0.15.1",
"version": "0.15.2",
"files": [

@@ -5,0 +5,0 @@ "README.md",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet