UNPKG

headless-js-api

Version:

Headless JS client for Ecwid public API

39 lines (31 loc) 1.42 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) { if (typeof require !== "undefined") return require.apply(this, arguments); throw Error('Dynamic require of "' + x + '" is not supported'); }); // src/storefront/utilities/get-store-id.ts function getStoreIdFromEcwid() { var _a, _b; return (_b = (_a = globalThis.window) == null ? void 0 : _a.Ecwid) == null ? void 0 : _b.getOwnerId(); } async function getStoreId() { var _a, _b; const onApiLoadedFn = (_b = (_a = globalThis.window) == null ? void 0 : _a.Ecwid) == null ? void 0 : _b.OnApiLoaded; if (onApiLoadedFn !== void 0) { return new Promise((resolve) => { onApiLoadedFn.add(() => { const storeId2 = getStoreIdFromEcwid(); resolve(storeId2); }); }); } const storeId = getStoreIdFromEcwid(); return Promise.resolve(storeId); } // src/storefront/utilities/get-emulated-config.ts function getEmulatedApiConfig() { var _a, _b; return (_b = (_a = globalThis.window) == null ? void 0 : _a.HeadlessAPI) == null ? void 0 : _b.getEmulatedApiConfig(); } exports.__require = __require; exports.getStoreId = getStoreId; exports.getEmulatedApiConfig = getEmulatedApiConfig;