@shopify/shopify-app-remix
Version:
Shopify Remix - to simplify the building of Shopify Apps with Remix
22 lines (19 loc) • 836 B
JavaScript
import { SessionNotFoundError } from '../../errors.mjs';
import { storefrontClientFactory } from '../../clients/storefront/factory.mjs';
import { ensureValidOfflineSession } from '../../helpers/ensure-valid-offline-session.mjs';
import '../../types.mjs';
import '@shopify/shopify-api';
function unauthenticatedStorefrontContextFactory(params) {
return async (shop) => {
const session = await ensureValidOfflineSession(params, shop);
if (!session) {
throw new SessionNotFoundError(`Could not find a session for shop ${shop} when creating unauthenticated storefront context`);
}
return {
session,
storefront: storefrontClientFactory({ params, session }),
};
};
}
export { unauthenticatedStorefrontContextFactory };
//# sourceMappingURL=factory.mjs.map