@lightspeed/ecom-headless 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export{d as downloadProductFile,g as getApiConfig,a as getProduct,c as getStoreProfile,i as initStorefrontApi,b as searchCategories,s as searchProducts}from"../shared/ecom-headless.BCjY03ea.mjs";import"../storefront/index.mjs";import"axios";
1
+ export{downloadProductFile,getProduct,getStoreProfile,searchCategories,searchProducts}from"../index.mjs";import"../storefront/index.mjs";
package/dist/index.cjs CHANGED
@@ -1 +1,2 @@
1
- "use strict";const index=require("./shared/ecom-headless.Cr34mwOt.cjs"),storefront_index=require("./storefront/index.cjs");require("axios"),exports.downloadProductFile=index.downloadProductFile,exports.getApiConfig=index.getApiConfig,exports.getProduct=index.getProduct,exports.getStoreProfile=index.getStoreProfile,exports.initStorefrontApi=index.initStorefrontApi,exports.searchCategories=index.searchCategories,exports.searchProducts=index.searchProducts,exports.getShouldUseMocks=storefront_index.getShouldUseMocks,exports.getStoreId=storefront_index.getStoreId;
1
+ "use strict";const storefront_index=require("./storefront/index.cjs"),API_BASE_URL="https://app.ecwid.com/api/v3/",API_TIMEOUT=1e4;class TimeoutError extends Error{constructor(e,n,i){super(`Request timeout${i?` after ${i}ms`:""}${e?` for ${n} ${e}`:""}`),this.name="TimeoutError"}}function createTimeoutError(r,e,n){return new TimeoutError(r,e,n)}function isAbortError(r){return r instanceof Error&&r.name==="AbortError"}function isObject(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function isFetchAvailable(){return typeof globalThis.fetch=="function"}function buildRequestHeaders(r,e={}){return{Authorization:`Bearer ${r}`,"X-Lightspeed-Request-Origin":"ecom-headless",redirect:"follow",...e.headers}}function prepareRequestBody(r,e){if(!(r==="GET"||e===void 0)){if(typeof e=="string")return e;if(isObject(e))return JSON.stringify(e)}}async function parseResponseData(r,e){switch(e){case"json":return r.json();case"blob":return r.blob();default:try{return await r.json()}catch{return r}}}function createTimeoutController(r){if(typeof AbortController>"u")return{};const e=new AbortController,n=setTimeout(()=>{e.abort()},r);return{controller:e,timer:n}}function clearTimeoutController(r){r.timer!==void 0&&clearTimeout(r.timer)}const ERROR_MESSAGES={FETCH_API_NOT_AVAILABLE:["Cannot initialize the API client.","Please use Node 18+ or a runtime with fetch() support. ","For older Node.js versions, consider using a fetch polyfill."].join(`
2
+ `),CONFIG_NOT_INITIALIZED:"Error initializing Storefront API: Please call initStorefrontApi() method first.",CONFIG_PUBLIC_TOKEN_REQUIRED:"Error initializing Storefront API: publicToken is required",CONFIG_STORE_ID_NOT_FOUND:"Error initializing Storefront API: storeId not found"};let o;const getApiConfig=()=>{if(o===void 0)throw new Error(ERROR_MESSAGES.CONFIG_NOT_INITIALIZED);return o},initStorefrontApi=async r=>{if(r.publicToken===void 0)throw new Error(ERROR_MESSAGES.CONFIG_PUBLIC_TOKEN_REQUIRED);const e=r.storeId??await storefront_index.getStoreId();if(e===void 0)throw new Error(ERROR_MESSAGES.CONFIG_STORE_ID_NOT_FOUND);o={baseURL:r.baseURL??API_BASE_URL,publicToken:r.publicToken,storeId:e}};function u(r,e){if(e!==void 0)return`${encodeURIComponent(r)}=${encodeURIComponent(String(e))}`}function a(r){if(r.startsWith("http://")||r.startsWith("https://"))return r;const{baseURL:e}=getApiConfig(),n=e.endsWith("/")?e:e+"/",i=r.startsWith("/")?r.slice(1):r;return n+i}function buildUrlWithParams(r,e){const n=a(r);if(e===void 0)return n;const i=Object.entries(e).map(([s,c])=>u(s,c)).filter(s=>s!==void 0);return i.length>0?`${n}?${i.join("&")}`:n}function createClient(){const{publicToken:r}=getApiConfig();async function e(n,i,s,c){const d=s?.timeout??API_TIMEOUT,f=createTimeoutController(d);try{const l=buildRequestHeaders(r,s),I=buildUrlWithParams(i,s?.params),p=await fetch(I,{method:n,headers:l,body:prepareRequestBody(n,c),signal:f.controller?.signal}),h=await parseResponseData(p,s?.responseType);return Object.assign(p,{data:h})}catch(l){throw isAbortError(l)?createTimeoutError(i,n,d):l}finally{clearTimeoutController(f)}}return{get:(n,i)=>e("GET",n,i),post:(n,i,s)=>e("POST",n,s,i),put:(n,i,s)=>e("PUT",n,s,i),patch:(n,i,s)=>e("PATCH",n,s,i),delete:(n,i)=>e("DELETE",n,i)}}let t;function getApiClient(){if(t!==void 0)return t;if(!isFetchAvailable())throw new Error(ERROR_MESSAGES.FETCH_API_NOT_AVAILABLE);return t=createClient(),t}const searchCategories=async r=>{const e=getApiClient(),{storeId:n}=getApiConfig(),i={params:r},s=`${n}/categories`;return(await e.get(s,i)).data},downloadProductFile=async r=>{const e=getApiClient(),{storeId:n}=getApiConfig(),{productId:i,fileId:s}=r,c={responseType:"blob"},d=`${n}/products/${i}/files/${s}`;return(await e.get(d,c)).data},getProduct=async r=>{const e=getApiClient(),{storeId:n}=getApiConfig(),{productId:i}=r,s={params:r},c=`${n}/products/${i}`;return(await e.get(c,s)).data},searchProducts=async r=>{const e=getApiClient(),{storeId:n}=getApiConfig(),i={params:r},s=`${n}/products`;return(await e.get(s,i)).data},getStoreProfile=async r=>{const e=getApiClient(),{storeId:n}=getApiConfig(),i={params:r},s=`${n}/profile`;return(await e.get(s,i)).data};exports.getStoreId=storefront_index.getStoreId,exports.downloadProductFile=downloadProductFile,exports.getApiConfig=getApiConfig,exports.getProduct=getProduct,exports.getStoreProfile=getStoreProfile,exports.initStorefrontApi=initStorefrontApi,exports.searchCategories=searchCategories,exports.searchProducts=searchProducts;
package/dist/index.d.cts CHANGED
@@ -1,3 +1,23 @@
1
- export { Account, AccountBilling, Address, AddressFormat, ApplePay, Category, Company, CurrencyFormat, DesignSettings, DestinationZone, DownloadProductFileParams, DownloadProductFileResponse, EstimatedShippingTimeAtCheckoutSettings, FeatureToggle, FilterSection, FlatRate, FormatsAndUnits, GeneralInfo, GetProductParams, GetProductResponse, GetStoreProfileParams, GetStoreProfileResponse, HandlingFee, InstructionsForCustomer, Languages, LegalPage, LegalPagesSettings, LowestPriceSettings, MailNotifications, NotificationSetting, OrderInvoiceSettings, Payment, PaymentOption, PhoneNotifications, Product, ProductAttribute, ProductBorderInfo, ProductCategory, ProductColor, ProductCombination, ProductCombinationOption, ProductDimensions, ProductFavorites, ProductFile, ProductFiltersSettings, ProductGalleryImage, ProductImage, ProductImageAlt, ProductMedia, ProductMediaImage, ProductMediaVideo, ProductOption, ProductOptionChoice, ProductRecurringChargeSettings, ProductRelatedCategory, ProductRelatedProducts, ProductShipping, ProductSubscriptionSettings, ProductTax, RegistrationAnswers, SalePrice, SearchCategoriesParams, SearchCategoriesResponse, SearchProductsParams, SearchProductsResponse, Shipping, ShippingOption, ShippingOrigin, ShippingSettings, ShippingZone, SocialLink, SocialLinksSettings, StarterSite, StoreProfile, StoreSettings, Tax, TaxInvoiceSettings, TaxSettings, TipsSettings, WholesalePrice, Zone, downloadProductFile, getApiConfig, getProduct, getStoreProfile, initStorefrontApi, searchCategories, searchProducts } from './api/index.cjs';
2
- export { getShouldUseMocks, getStoreId } from './storefront/index.cjs';
1
+ export { Account, AccountBilling, Address, AddressFormat, ApplePay, Category, Company, CurrencyFormat, DesignSettings, DestinationZone, DownloadProductFileParams, DownloadProductFileResponse, EstimatedShippingTimeAtCheckoutSettings, FeatureToggle, FilterSection, FlatRate, FormatsAndUnits, GeneralInfo, GetProductParams, GetProductResponse, GetStoreProfileParams, GetStoreProfileResponse, HandlingFee, InstructionsForCustomer, Languages, LegalPage, LegalPagesSettings, LowestPriceSettings, MailNotifications, NotificationSetting, OrderInvoiceSettings, Payment, PaymentOption, PhoneNotifications, Product, ProductAttribute, ProductBorderInfo, ProductCategory, ProductColor, ProductCombination, ProductCombinationOption, ProductDimensions, ProductFavorites, ProductFile, ProductFiltersSettings, ProductGalleryImage, ProductImage, ProductImageAlt, ProductMedia, ProductMediaImage, ProductMediaVideo, ProductOption, ProductOptionChoice, ProductRecurringChargeSettings, ProductRelatedCategory, ProductRelatedProducts, ProductShipping, ProductSubscriptionSettings, ProductTax, RegistrationAnswers, SalePrice, SearchCategoriesParams, SearchCategoriesResponse, SearchProductsParams, SearchProductsResponse, Shipping, ShippingOption, ShippingOrigin, ShippingSettings, ShippingZone, SocialLink, SocialLinksSettings, StarterSite, StoreProfile, StoreSettings, Tax, TaxInvoiceSettings, TaxSettings, TipsSettings, WholesalePrice, Zone, downloadProductFile, getProduct, getStoreProfile, searchCategories, searchProducts } from './api/index.cjs';
2
+ export { getStoreId } from './storefront/index.cjs';
3
3
  import 'buffer';
4
+
5
+ /**
6
+ * Configuration object for initializing the API client.
7
+ *
8
+ * @property {string} publicToken - The public access token for your store's API.
9
+ * This token is used to authenticate requests that do not require a private token, such as fetching product or category data.
10
+ * @property {string} [baseURL] - The base URL for the Ecwid API.
11
+ * Default to 'https://app.ecwid.com/api/v3/'. This can be overridden for testing or specific regional API endpoints.
12
+ * @property {string} [storeId] - The unique identifier for your Ecwid store. This ID is used to specify which store's data to access.
13
+ */
14
+ interface ApiConfig {
15
+ publicToken: string;
16
+ storeId?: number;
17
+ baseURL?: string;
18
+ }
19
+
20
+ declare const getApiConfig: () => Required<ApiConfig>;
21
+ declare const initStorefrontApi: (config: ApiConfig) => Promise<void>;
22
+
23
+ export { getApiConfig, initStorefrontApi };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,23 @@
1
- export { Account, AccountBilling, Address, AddressFormat, ApplePay, Category, Company, CurrencyFormat, DesignSettings, DestinationZone, DownloadProductFileParams, DownloadProductFileResponse, EstimatedShippingTimeAtCheckoutSettings, FeatureToggle, FilterSection, FlatRate, FormatsAndUnits, GeneralInfo, GetProductParams, GetProductResponse, GetStoreProfileParams, GetStoreProfileResponse, HandlingFee, InstructionsForCustomer, Languages, LegalPage, LegalPagesSettings, LowestPriceSettings, MailNotifications, NotificationSetting, OrderInvoiceSettings, Payment, PaymentOption, PhoneNotifications, Product, ProductAttribute, ProductBorderInfo, ProductCategory, ProductColor, ProductCombination, ProductCombinationOption, ProductDimensions, ProductFavorites, ProductFile, ProductFiltersSettings, ProductGalleryImage, ProductImage, ProductImageAlt, ProductMedia, ProductMediaImage, ProductMediaVideo, ProductOption, ProductOptionChoice, ProductRecurringChargeSettings, ProductRelatedCategory, ProductRelatedProducts, ProductShipping, ProductSubscriptionSettings, ProductTax, RegistrationAnswers, SalePrice, SearchCategoriesParams, SearchCategoriesResponse, SearchProductsParams, SearchProductsResponse, Shipping, ShippingOption, ShippingOrigin, ShippingSettings, ShippingZone, SocialLink, SocialLinksSettings, StarterSite, StoreProfile, StoreSettings, Tax, TaxInvoiceSettings, TaxSettings, TipsSettings, WholesalePrice, Zone, downloadProductFile, getApiConfig, getProduct, getStoreProfile, initStorefrontApi, searchCategories, searchProducts } from './api/index.mjs';
2
- export { getShouldUseMocks, getStoreId } from './storefront/index.mjs';
1
+ export { Account, AccountBilling, Address, AddressFormat, ApplePay, Category, Company, CurrencyFormat, DesignSettings, DestinationZone, DownloadProductFileParams, DownloadProductFileResponse, EstimatedShippingTimeAtCheckoutSettings, FeatureToggle, FilterSection, FlatRate, FormatsAndUnits, GeneralInfo, GetProductParams, GetProductResponse, GetStoreProfileParams, GetStoreProfileResponse, HandlingFee, InstructionsForCustomer, Languages, LegalPage, LegalPagesSettings, LowestPriceSettings, MailNotifications, NotificationSetting, OrderInvoiceSettings, Payment, PaymentOption, PhoneNotifications, Product, ProductAttribute, ProductBorderInfo, ProductCategory, ProductColor, ProductCombination, ProductCombinationOption, ProductDimensions, ProductFavorites, ProductFile, ProductFiltersSettings, ProductGalleryImage, ProductImage, ProductImageAlt, ProductMedia, ProductMediaImage, ProductMediaVideo, ProductOption, ProductOptionChoice, ProductRecurringChargeSettings, ProductRelatedCategory, ProductRelatedProducts, ProductShipping, ProductSubscriptionSettings, ProductTax, RegistrationAnswers, SalePrice, SearchCategoriesParams, SearchCategoriesResponse, SearchProductsParams, SearchProductsResponse, Shipping, ShippingOption, ShippingOrigin, ShippingSettings, ShippingZone, SocialLink, SocialLinksSettings, StarterSite, StoreProfile, StoreSettings, Tax, TaxInvoiceSettings, TaxSettings, TipsSettings, WholesalePrice, Zone, downloadProductFile, getProduct, getStoreProfile, searchCategories, searchProducts } from './api/index.mjs';
2
+ export { getStoreId } from './storefront/index.mjs';
3
3
  import 'buffer';
4
+
5
+ /**
6
+ * Configuration object for initializing the API client.
7
+ *
8
+ * @property {string} publicToken - The public access token for your store's API.
9
+ * This token is used to authenticate requests that do not require a private token, such as fetching product or category data.
10
+ * @property {string} [baseURL] - The base URL for the Ecwid API.
11
+ * Default to 'https://app.ecwid.com/api/v3/'. This can be overridden for testing or specific regional API endpoints.
12
+ * @property {string} [storeId] - The unique identifier for your Ecwid store. This ID is used to specify which store's data to access.
13
+ */
14
+ interface ApiConfig {
15
+ publicToken: string;
16
+ storeId?: number;
17
+ baseURL?: string;
18
+ }
19
+
20
+ declare const getApiConfig: () => Required<ApiConfig>;
21
+ declare const initStorefrontApi: (config: ApiConfig) => Promise<void>;
22
+
23
+ export { getApiConfig, initStorefrontApi };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,23 @@
1
- export { Account, AccountBilling, Address, AddressFormat, ApplePay, Category, Company, CurrencyFormat, DesignSettings, DestinationZone, DownloadProductFileParams, DownloadProductFileResponse, EstimatedShippingTimeAtCheckoutSettings, FeatureToggle, FilterSection, FlatRate, FormatsAndUnits, GeneralInfo, GetProductParams, GetProductResponse, GetStoreProfileParams, GetStoreProfileResponse, HandlingFee, InstructionsForCustomer, Languages, LegalPage, LegalPagesSettings, LowestPriceSettings, MailNotifications, NotificationSetting, OrderInvoiceSettings, Payment, PaymentOption, PhoneNotifications, Product, ProductAttribute, ProductBorderInfo, ProductCategory, ProductColor, ProductCombination, ProductCombinationOption, ProductDimensions, ProductFavorites, ProductFile, ProductFiltersSettings, ProductGalleryImage, ProductImage, ProductImageAlt, ProductMedia, ProductMediaImage, ProductMediaVideo, ProductOption, ProductOptionChoice, ProductRecurringChargeSettings, ProductRelatedCategory, ProductRelatedProducts, ProductShipping, ProductSubscriptionSettings, ProductTax, RegistrationAnswers, SalePrice, SearchCategoriesParams, SearchCategoriesResponse, SearchProductsParams, SearchProductsResponse, Shipping, ShippingOption, ShippingOrigin, ShippingSettings, ShippingZone, SocialLink, SocialLinksSettings, StarterSite, StoreProfile, StoreSettings, Tax, TaxInvoiceSettings, TaxSettings, TipsSettings, WholesalePrice, Zone, downloadProductFile, getApiConfig, getProduct, getStoreProfile, initStorefrontApi, searchCategories, searchProducts } from './api/index.js';
2
- export { getShouldUseMocks, getStoreId } from './storefront/index.js';
1
+ export { Account, AccountBilling, Address, AddressFormat, ApplePay, Category, Company, CurrencyFormat, DesignSettings, DestinationZone, DownloadProductFileParams, DownloadProductFileResponse, EstimatedShippingTimeAtCheckoutSettings, FeatureToggle, FilterSection, FlatRate, FormatsAndUnits, GeneralInfo, GetProductParams, GetProductResponse, GetStoreProfileParams, GetStoreProfileResponse, HandlingFee, InstructionsForCustomer, Languages, LegalPage, LegalPagesSettings, LowestPriceSettings, MailNotifications, NotificationSetting, OrderInvoiceSettings, Payment, PaymentOption, PhoneNotifications, Product, ProductAttribute, ProductBorderInfo, ProductCategory, ProductColor, ProductCombination, ProductCombinationOption, ProductDimensions, ProductFavorites, ProductFile, ProductFiltersSettings, ProductGalleryImage, ProductImage, ProductImageAlt, ProductMedia, ProductMediaImage, ProductMediaVideo, ProductOption, ProductOptionChoice, ProductRecurringChargeSettings, ProductRelatedCategory, ProductRelatedProducts, ProductShipping, ProductSubscriptionSettings, ProductTax, RegistrationAnswers, SalePrice, SearchCategoriesParams, SearchCategoriesResponse, SearchProductsParams, SearchProductsResponse, Shipping, ShippingOption, ShippingOrigin, ShippingSettings, ShippingZone, SocialLink, SocialLinksSettings, StarterSite, StoreProfile, StoreSettings, Tax, TaxInvoiceSettings, TaxSettings, TipsSettings, WholesalePrice, Zone, downloadProductFile, getProduct, getStoreProfile, searchCategories, searchProducts } from './api/index.js';
2
+ export { getStoreId } from './storefront/index.js';
3
3
  import 'buffer';
4
+
5
+ /**
6
+ * Configuration object for initializing the API client.
7
+ *
8
+ * @property {string} publicToken - The public access token for your store's API.
9
+ * This token is used to authenticate requests that do not require a private token, such as fetching product or category data.
10
+ * @property {string} [baseURL] - The base URL for the Ecwid API.
11
+ * Default to 'https://app.ecwid.com/api/v3/'. This can be overridden for testing or specific regional API endpoints.
12
+ * @property {string} [storeId] - The unique identifier for your Ecwid store. This ID is used to specify which store's data to access.
13
+ */
14
+ interface ApiConfig {
15
+ publicToken: string;
16
+ storeId?: number;
17
+ baseURL?: string;
18
+ }
19
+
20
+ declare const getApiConfig: () => Required<ApiConfig>;
21
+ declare const initStorefrontApi: (config: ApiConfig) => Promise<void>;
22
+
23
+ export { getApiConfig, initStorefrontApi };
package/dist/index.mjs CHANGED
@@ -1 +1,2 @@
1
- export{d as downloadProductFile,g as getApiConfig,a as getProduct,c as getStoreProfile,i as initStorefrontApi,b as searchCategories,s as searchProducts}from"./shared/ecom-headless.BCjY03ea.mjs";export{getShouldUseMocks,getStoreId}from"./storefront/index.mjs";import"axios";
1
+ import{getStoreId as E}from"./storefront/index.mjs";const m="https://app.ecwid.com/api/v3/",A=1e4;class b extends Error{constructor(r,e,o){super(`Request timeout${o?` after ${o}ms`:""}${r?` for ${e} ${r}`:""}`),this.name="TimeoutError"}}function g(t,r,e){return new b(t,r,e)}function _(t){return t instanceof Error&&t.name==="AbortError"}function O(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function w(){return typeof globalThis.fetch=="function"}function y(t,r={}){return{Authorization:`Bearer ${t}`,"X-Lightspeed-Request-Origin":"ecom-headless",redirect:"follow",...r.headers}}function C(t,r){if(!(t==="GET"||r===void 0)){if(typeof r=="string")return r;if(O(r))return JSON.stringify(r)}}async function N(t,r){switch(r){case"json":return t.json();case"blob":return t.blob();default:try{return await t.json()}catch{return t}}}function P(t){if(typeof AbortController>"u")return{};const r=new AbortController,e=setTimeout(()=>{r.abort()},t);return{controller:r,timer:e}}function R(t){t.timer!==void 0&&clearTimeout(t.timer)}const l={FETCH_API_NOT_AVAILABLE:["Cannot initialize the API client.","Please use Node 18+ or a runtime with fetch() support. ","For older Node.js versions, consider using a fetch polyfill."].join(`
2
+ `),CONFIG_NOT_INITIALIZED:"Error initializing Storefront API: Please call initStorefrontApi() method first.",CONFIG_PUBLIC_TOKEN_REQUIRED:"Error initializing Storefront API: publicToken is required",CONFIG_STORE_ID_NOT_FOUND:"Error initializing Storefront API: storeId not found"};let f;const i=()=>{if(f===void 0)throw new Error(l.CONFIG_NOT_INITIALIZED);return f},$=async t=>{if(t.publicToken===void 0)throw new Error(l.CONFIG_PUBLIC_TOKEN_REQUIRED);const r=t.storeId??await E();if(r===void 0)throw new Error(l.CONFIG_STORE_ID_NOT_FOUND);f={baseURL:t.baseURL??m,publicToken:t.publicToken,storeId:r}};function S(t,r){if(r!==void 0)return`${encodeURIComponent(t)}=${encodeURIComponent(String(r))}`}function U(t){if(t.startsWith("http://")||t.startsWith("https://"))return t;const{baseURL:r}=i(),e=r.endsWith("/")?r:r+"/",o=t.startsWith("/")?t.slice(1):t;return e+o}function L(t,r){const e=U(t);if(r===void 0)return e;const o=Object.entries(r).map(([n,s])=>S(n,s)).filter(n=>n!==void 0);return o.length>0?`${e}?${o.join("&")}`:e}function F(){const{publicToken:t}=i();async function r(e,o,n,s){const c=n?.timeout??A,p=P(c);try{const u=y(t,n),T=L(o,n?.params),I=await fetch(T,{method:e,headers:u,body:C(e,s),signal:p.controller?.signal}),h=await N(I,n?.responseType);return Object.assign(I,{data:h})}catch(u){throw _(u)?g(o,e,c):u}finally{R(p)}}return{get:(e,o)=>r("GET",e,o),post:(e,o,n)=>r("POST",e,n,o),put:(e,o,n)=>r("PUT",e,n,o),patch:(e,o,n)=>r("PATCH",e,n,o),delete:(e,o)=>r("DELETE",e,o)}}let d;function a(){if(d!==void 0)return d;if(!w())throw new Error(l.FETCH_API_NOT_AVAILABLE);return d=F(),d}const v=async t=>{const r=a(),{storeId:e}=i(),o={params:t},n=`${e}/categories`;return(await r.get(n,o)).data},j=async t=>{const r=a(),{storeId:e}=i(),{productId:o,fileId:n}=t,s={responseType:"blob"},c=`${e}/products/${o}/files/${n}`;return(await r.get(c,s)).data},D=async t=>{const r=a(),{storeId:e}=i(),{productId:o}=t,n={params:t},s=`${e}/products/${o}`;return(await r.get(s,n)).data},G=async t=>{const r=a(),{storeId:e}=i(),o={params:t},n=`${e}/products`;return(await r.get(n,o)).data},B=async t=>{const r=a(),{storeId:e}=i(),o={params:t},n=`${e}/profile`;return(await r.get(n,o)).data};export{j as downloadProductFile,i as getApiConfig,D as getProduct,E as getStoreId,B as getStoreProfile,$ as initStorefrontApi,v as searchCategories,G as searchProducts};