@shopify/shopify-app-remix
Version:
Shopify Remix - to simplify the building of Shopify Apps with Remix
22 lines (18 loc) • 801 B
JavaScript
;
var errors = require('../../errors.js');
var factory = require('../../clients/storefront/factory.js');
var getOfflineSession = require('../helpers/get-offline-session.js');
function unauthenticatedStorefrontContextFactory(params) {
return async (shop) => {
const session = await getOfflineSession.getOfflineSession(shop, params);
if (!session) {
throw new errors.SessionNotFoundError(`Could not find a session for shop ${shop} when creating unauthenticated storefront context`);
}
return {
session,
storefront: factory.storefrontClientFactory({ params, session }),
};
};
}
exports.unauthenticatedStorefrontContextFactory = unauthenticatedStorefrontContextFactory;
//# sourceMappingURL=factory.js.map