@lightspeed/ecom-headless 0.1.1 → 1.0.0

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/api/index.cjs +2 -1
  3. package/dist/api/index.cjs.map +1 -0
  4. package/dist/api/index.d.cts +14 -1288
  5. package/dist/api/index.d.mts +14 -1288
  6. package/dist/api/index.d.ts +14 -1288
  7. package/dist/api/index.mjs +2 -1
  8. package/dist/api/index.mjs.map +1 -0
  9. package/dist/index.cjs +2 -2
  10. package/dist/index.cjs.map +1 -0
  11. package/dist/index.d.cts +4 -22
  12. package/dist/index.d.mts +4 -22
  13. package/dist/index.d.ts +4 -22
  14. package/dist/index.mjs +2 -2
  15. package/dist/index.mjs.map +1 -0
  16. package/dist/plugin-visualizer/bundle.html +1 -1
  17. package/dist/shared/ecom-headless.BTRqua6N.d.cts +475 -0
  18. package/dist/shared/ecom-headless.BTRqua6N.d.mts +475 -0
  19. package/dist/shared/ecom-headless.BTRqua6N.d.ts +475 -0
  20. package/dist/shared/ecom-headless.BaNiBjDE.d.cts +1297 -0
  21. package/dist/shared/ecom-headless.BaNiBjDE.d.mts +1297 -0
  22. package/dist/shared/ecom-headless.BaNiBjDE.d.ts +1297 -0
  23. package/dist/shared/ecom-headless.CiGkSfL9.cjs +5 -0
  24. package/dist/shared/ecom-headless.CiGkSfL9.cjs.map +1 -0
  25. package/dist/shared/ecom-headless.D2QPHn5F.d.ts +676 -0
  26. package/dist/shared/ecom-headless.biFHUae1.mjs +5 -0
  27. package/dist/shared/ecom-headless.biFHUae1.mjs.map +1 -0
  28. package/dist/shared/ecom-headless.fwEDqznC.d.mts +676 -0
  29. package/dist/shared/ecom-headless.n2b3FM61.d.cts +676 -0
  30. package/dist/storefront/index.cjs +2 -1
  31. package/dist/storefront/index.cjs.map +1 -0
  32. package/dist/storefront/index.d.cts +2 -3
  33. package/dist/storefront/index.d.mts +2 -3
  34. package/dist/storefront/index.d.ts +2 -3
  35. package/dist/storefront/index.mjs +2 -1
  36. package/dist/storefront/index.mjs.map +1 -0
  37. package/dist/types/index.cjs +2 -0
  38. package/dist/types/index.cjs.map +1 -0
  39. package/dist/types/index.d.cts +31 -0
  40. package/dist/types/index.d.mts +31 -0
  41. package/dist/types/index.d.ts +31 -0
  42. package/dist/types/index.mjs +2 -0
  43. package/dist/types/index.mjs.map +1 -0
  44. package/package.json +45 -4
@@ -1 +1,2 @@
1
- export{downloadProductFile,getProduct,getStoreProfile,searchCategories,searchProducts}from"../index.mjs";import"../storefront/index.mjs";
1
+ import{E as l,a as E}from"../shared/ecom-headless.biFHUae1.mjs";const I="https://app.ecwid.com/api/v3/",b=1e4;let f;const i=()=>{if(f===void 0)throw new Error(l.CONFIG_NOT_INITIALIZED);return f},g=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??I,publicToken:t.publicToken,storeId:r}};class w extends Error{constructor(r,e,o){super(`Request timeout${o?` after ${o}ms`:""}${r?` for ${e} ${r}`:""}`),this.name="TimeoutError"}}function y(t,r,e){return new w(t,r,e)}function A(t){return t instanceof Error&&t.name==="AbortError"}function $(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function O(){return typeof globalThis.fetch=="function"}function R(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($(r))return JSON.stringify(r)}}async function _(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 U(t){t.timer!==void 0&&clearTimeout(t.timer)}function v(t,r){if(r!==void 0)return`${encodeURIComponent(t)}=${encodeURIComponent(String(r))}`}function S(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=S(t);if(r===void 0)return e;const o=Object.entries(r).map(([n,s])=>v(n,s)).filter(n=>n!==void 0);return o.length>0?`${e}?${o.join("&")}`:e}function N(){const{publicToken:t}=i();async function r(e,o,n,s){const c=n?.timeout??b,p=P(c);try{const u=R(t,n),T=L(o,n?.params),h=await fetch(T,{method:e,headers:u,body:C(e,s),signal:p.controller?.signal}),m=await _(h,n?.responseType);return Object.assign(h,{data:m})}catch(u){throw A(u)?y(o,e,c):u}finally{U(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(!O())throw new Error(l.FETCH_API_NOT_AVAILABLE);return d=N(),d}const j=async t=>{const r=a(),{storeId:e}=i(),o={params:t},n=`${e}/categories`;return(await r.get(n,o)).data},F=async t=>{const r=a(),{storeId:e}=i(),o={params:t},n=`${e}/products`;return(await r.get(n,o)).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(),{productId:o,fileId:n}=t,s={responseType:"blob"},c=`${e}/products/${o}/files/${n}`;return(await r.get(c,s)).data},B=async t=>{const r=a(),{storeId:e}=i(),o={params:t},n=`${e}/profile`;return(await r.get(n,o)).data};export{G as downloadProductFile,i as getApiConfig,D as getProduct,B as getStoreProfile,g as initStorefrontApi,j as searchCategories,F as searchProducts};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/api/config/constants.ts","../../src/api/config/index.ts","../../src/client/utils/errors.ts","../../src/client/utils/is-object.ts","../../src/client/utils/request.ts","../../src/client/utils/response.ts","../../src/client/utils/timeout.ts","../../src/client/utils/url.ts","../../src/client/create-client.ts","../../src/client/index.ts","../../src/api/categories/search-categories.ts","../../src/api/products/search-products.ts","../../src/api/products/get-product.ts","../../src/api/products/download-product-file.ts","../../src/api/store/get-store-profile.ts"],"sourcesContent":["export const API_BASE_URL = 'https://app.ecwid.com/api/v3/';\nexport const API_TIMEOUT = 10000;\n","import { API_BASE_URL } from '@/api/config/constants';\nimport { ERROR_MESSAGES } from '@/client/constants';\nimport { getStoreId } from '@/storefront';\nimport { ApiConfig } from '@/types';\n\nlet apiConfig: Required<ApiConfig> | undefined;\n\nexport const getApiConfig = (): Required<ApiConfig> => {\n if (apiConfig === undefined) {\n throw new Error(ERROR_MESSAGES.CONFIG_NOT_INITIALIZED);\n }\n return apiConfig;\n};\n\nexport const initStorefrontApi = async (config: ApiConfig): Promise<void> => {\n if (config.publicToken === undefined) {\n throw new Error(ERROR_MESSAGES.CONFIG_PUBLIC_TOKEN_REQUIRED);\n }\n\n const storeId = config.storeId ?? await getStoreId();\n if (storeId === undefined) {\n throw new Error(ERROR_MESSAGES.CONFIG_STORE_ID_NOT_FOUND);\n }\n\n apiConfig = {\n baseURL: config.baseURL ?? API_BASE_URL,\n publicToken: config.publicToken,\n storeId,\n } satisfies Required<ApiConfig>;\n};\n","export class TimeoutError extends Error {\n constructor(url?: string, method?: string, timeout?: number) {\n super(\n `Request timeout${timeout ? ` after ${timeout}ms` : ''}${url ? ` for ${method} ${url}` : ''}`,\n );\n this.name = 'TimeoutError';\n }\n}\n\nexport function createTimeoutError(url?: string, method?: string, timeout?: number): TimeoutError {\n return new TimeoutError(url, method, timeout);\n}\n\nexport function isAbortError(error: unknown): boolean {\n return error instanceof Error && error.name === 'AbortError';\n}\n","export function isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n","import { isObject } from '@/client/utils';\nimport { BaseHeaders, RequestConfig, RequestData } from '@/types';\n\nexport function isFetchAvailable(): boolean {\n return typeof globalThis.fetch === 'function';\n}\n\nexport function buildRequestHeaders(\n publicToken: string,\n config: RequestConfig = {},\n): Record<string, string> & BaseHeaders {\n return {\n 'Authorization': `Bearer ${publicToken}`,\n 'X-Lightspeed-Request-Origin': 'ecom-headless',\n 'redirect': 'follow',\n ...config.headers,\n };\n}\n\nexport function prepareRequestBody(\n method: string,\n data: RequestData,\n): BodyInit | undefined {\n if (method === 'GET' || data === undefined) {\n return undefined;\n }\n\n if (typeof data === 'string') {\n return data;\n }\n\n if (isObject(data)) {\n return JSON.stringify(data);\n }\n\n return undefined;\n}\n","import { ResponseType } from '@/types';\n\nexport async function parseResponseData(\n response: Response,\n responseType?: ResponseType,\n): Promise<ReturnType<typeof response.json> | ReturnType<typeof response.blob> | Response> {\n switch (responseType) {\n case 'json':\n return response.json();\n case 'blob':\n return response.blob();\n default:\n try {\n return await response.json();\n } catch {\n return response;\n }\n }\n}\n","interface TimeoutController {\n controller?: AbortController;\n timer?: ReturnType<typeof setTimeout>;\n}\n\nexport function createTimeoutController(timeout: number): {\n controller?: AbortController;\n timer?: ReturnType<typeof setTimeout>;\n} {\n if (typeof AbortController === 'undefined') {\n return {};\n }\n\n const controller = new AbortController();\n const timer = setTimeout(() => {\n controller.abort();\n }, timeout);\n\n return { controller, timer };\n}\n\nexport function clearTimeoutController(timeoutController: TimeoutController): void {\n if (timeoutController.timer !== undefined) {\n clearTimeout(timeoutController.timer);\n }\n}\n","import { getApiConfig } from '@/api';\nimport { QueryParams } from '@/types';\n\nfunction processQueryParam(\n key: string,\n value: QueryParams[string],\n): string | undefined {\n if (value === undefined) {\n return;\n }\n\n return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`;\n}\n\nfunction createUrl(path: string): string {\n if (path.startsWith('http://') || path.startsWith('https://')) {\n return path;\n }\n\n const { baseURL } = getApiConfig();\n const normalizedBase = baseURL.endsWith('/') ? baseURL : baseURL + '/';\n const normalizedPath = path.startsWith('/') ? path.slice(1) : path;\n\n return normalizedBase + normalizedPath;\n}\n\nexport function buildUrlWithParams(path: string, params?: QueryParams): string {\n const url = createUrl(path);\n\n if (params === undefined) {\n return url;\n }\n\n const queryParams = Object\n .entries(params)\n .map(([key, value]) => processQueryParam(key, value))\n .filter((param): param is string => param !== undefined);\n\n if (queryParams.length > 0) {\n return `${url}?${queryParams.join('&')}`;\n }\n\n return url;\n}\n","import { getApiConfig } from '@/api/config';\nimport { API_TIMEOUT } from '@/api/config/constants';\nimport {\n buildRequestHeaders,\n buildUrlWithParams,\n clearTimeoutController,\n createTimeoutController,\n createTimeoutError,\n isAbortError,\n parseResponseData,\n prepareRequestBody,\n} from '@/client/utils';\nimport { HttpClient, RequestConfig, RequestData, HttpResponse } from '@/types';\n\nexport function createClient(): HttpClient {\n const { publicToken } = getApiConfig();\n\n async function request<T = unknown>(\n method: string,\n path: string,\n config?: RequestConfig,\n requestData?: RequestData,\n ): Promise<HttpResponse<T>> {\n const timeout = config?.timeout ?? API_TIMEOUT;\n const timeoutController = createTimeoutController(timeout);\n\n try {\n const headers = buildRequestHeaders(publicToken, config);\n const finalUrl = buildUrlWithParams(path, config?.params);\n\n const response = await fetch(finalUrl, {\n method,\n headers,\n body: prepareRequestBody(method, requestData),\n signal: timeoutController.controller?.signal,\n });\n\n const parsedResponseData = await parseResponseData(response, config?.responseType);\n\n return Object.assign(response, {\n data: parsedResponseData,\n }) satisfies HttpResponse<T>;\n } catch (error) {\n if (isAbortError(error)) {\n throw createTimeoutError(path, method, timeout);\n }\n\n throw error;\n } finally {\n clearTimeoutController(timeoutController);\n }\n }\n\n return {\n get: <T>(url: string, config?: RequestConfig) => request<T>('GET', url, config),\n post: <T>(url: string, data?: RequestData, config?: RequestConfig) => request<T>('POST', url, config, data),\n put: <T>(url: string, data?: RequestData, config?: RequestConfig) => request<T>('PUT', url, config, data),\n patch: <T>(url: string, data?: RequestData, config?: RequestConfig) => request<T>('PATCH', url, config, data),\n delete: <T>(url: string, config?: RequestConfig) => request<T>('DELETE', url, config),\n };\n}\n","import { ERROR_MESSAGES } from '@/client/constants';\nimport { createClient } from '@/client/create-client';\nimport { isFetchAvailable } from '@/client/utils';\nimport { HttpClient } from '@/types';\n\nlet client: HttpClient | undefined;\n\n/**\n * Get the singleton instance of the API client.\n * @returns The HTTP client instance\n * @throws {Error} If the fetch API is not available or client creation fails\n */\nexport function getApiClient(): HttpClient {\n if (client !== undefined) {\n return client;\n }\n\n if (!isFetchAvailable()) {\n throw new Error(ERROR_MESSAGES.FETCH_API_NOT_AVAILABLE);\n }\n\n client = createClient();\n\n return client;\n}\n\n/**\n * Reset the singleton API client instance.\n * Useful for testing or when configuration changes require a fresh client.\n */\nexport function resetApiClient(): void {\n client = undefined;\n}\n","import { getApiConfig } from '@/api/config';\nimport { getApiClient } from '@/client';\nimport { SearchCategoriesParams, SearchCategoriesResponse, RequestConfig } from '@/types';\n\n/**\n * Search categories in the store based on provided parameters.\n *\n * @param {SearchCategoriesParams} params - The parameters for the searchCategories request.\n * @returns {Promise<SearchCategoriesResponse>} A promise that resolves to the categories search results.\n */\nexport const searchCategories = async (\n params?: SearchCategoriesParams,\n): Promise<SearchCategoriesResponse> => {\n const apiClient = getApiClient();\n const { storeId } = getApiConfig();\n const options: RequestConfig<SearchCategoriesParams> = {\n params,\n };\n\n const url = `${storeId}/categories`;\n const response = await apiClient.get<SearchCategoriesResponse>(url, options);\n return response.data;\n};\n","import { getApiConfig } from '@/api/config';\nimport { getApiClient } from '@/client';\nimport { SearchProductsParams, SearchProductsResponse, RequestConfig } from '@/types';\n\n/**\n * Search for products.\n *\n * @param {SearchProductsParams} params - The parameters for the searchProducts request.\n * @returns {Promise<SearchProductsResponse>} A promise that resolves to the search results.\n */\nexport const searchProducts = async (\n params?: SearchProductsParams,\n): Promise<SearchProductsResponse> => {\n const apiClient = getApiClient();\n const { storeId } = getApiConfig();\n const options: RequestConfig<SearchProductsParams> = {\n params,\n };\n\n const url = `${storeId}/products`;\n const response = await apiClient.get<SearchProductsResponse>(url, options);\n return response.data;\n};\n","import { getApiConfig } from '@/api/config';\nimport { getApiClient } from '@/client';\nimport { GetProductParams, GetProductResponse, RequestConfig } from '@/types';\n\n/**\n * Fetches a single product by its ID.\n *\n * @param {GetProductParams} params - The parameters for the getProduct request.\n * @returns {Promise<GetProductResponse>} A promise that resolves to the product details.\n */\nexport const getProduct = async (\n params: GetProductParams,\n): Promise<GetProductResponse> => {\n const apiClient = getApiClient();\n const { storeId } = getApiConfig();\n const { productId } = params;\n const options: RequestConfig<GetProductParams> = {\n params,\n };\n\n const url = `${storeId}/products/${productId}`;\n const response = await apiClient.get<GetProductResponse>(url, options);\n return response.data;\n};\n","import { getApiConfig } from '@/api/config';\nimport { getApiClient } from '@/client';\nimport { DownloadProductFileParams, DownloadProductFileResponse, RequestConfig } from '@/types';\n\n/**\n * Download a product file\n * @param {DownloadProductFileParams} params - The parameters for the downloadProductFile request.\n * @returns {Promise<DownloadProductFileResponse>} A promise that resolves to the download product file results.\n */\nexport const downloadProductFile = async (\n params: DownloadProductFileParams,\n): Promise<DownloadProductFileResponse> => {\n const apiClient = getApiClient();\n const { storeId } = getApiConfig();\n const { productId, fileId } = params;\n const options: RequestConfig<DownloadProductFileParams> = {\n responseType: 'blob',\n };\n\n const url = `${storeId}/products/${productId}/files/${fileId}`;\n const response = await apiClient.get<DownloadProductFileResponse>(url, options);\n return response.data;\n};\n","import { getApiConfig } from '@/api/config';\nimport { getApiClient } from '@/client';\nimport { GetStoreProfileParams, GetStoreProfileResponse, RequestConfig } from '@/types';\n\n/**\n * Fetches the store profile.\n *\n * @param {GetStoreProfileParams} params - Optional parameters for the getStoreProfile request.\n * @returns {Promise<GetStoreProfileResponse>} A promise that resolves to the store profile.\n */\nexport const getStoreProfile = async (\n params?: GetStoreProfileParams,\n): Promise<GetStoreProfileResponse> => {\n const apiClient = getApiClient();\n const { storeId } = getApiConfig();\n const options: RequestConfig<GetStoreProfileParams> = {\n params,\n };\n\n const url = `${storeId}/profile`;\n const response = await apiClient.get<GetStoreProfileResponse>(url, options);\n return response.data;\n};\n"],"names":["API_BASE_URL","API_TIMEOUT","apiConfig","getApiConfig","ERROR_MESSAGES","initStorefrontApi","config","storeId","getStoreId","TimeoutError","url","method","timeout","createTimeoutError","isAbortError","error","isObject","value","isFetchAvailable","buildRequestHeaders","publicToken","prepareRequestBody","data","parseResponseData","response","responseType","createTimeoutController","controller","timer","clearTimeoutController","timeoutController","processQueryParam","key","createUrl","path","baseURL","normalizedBase","normalizedPath","buildUrlWithParams","params","queryParams","param","createClient","request","requestData","headers","finalUrl","parsedResponseData","client","getApiClient","searchCategories","apiClient","options","searchProducts","getProduct","productId","downloadProductFile","fileId","getStoreProfile"],"mappings":"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"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
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;
1
+ "use strict";const api_index=require("./api/index.cjs"),storefront_index=require("./storefront/index.cjs"),getStoreId=require("./shared/ecom-headless.CiGkSfL9.cjs"),CustomerCookieConsentValues={UNDEFINED:"UNDEFINED",ACCEPTED:"ACCEPTED",DECLINED:"DECLINED",ANALYTICS_ONLY:"ANALYTICS_ONLY",PERSONALIZATION_ONLY:"PERSONALIZATION_ONLY"},EcwidWidgetValues={MINICART:"Minicart",SEARCH_PANEL:"SearchPanel",PRODUCT_BROWSER:"ProductBrowser",CATEGORIES:"Categories",PRODUCT:"Product"},JsApiPageValues={ACCOUNT_REGISTRATION:"ACCOUNT_REGISTRATION",ACCOUNT_RESET_PASSWORD:"ACCOUNT_RESET_PASSWORD",ACCOUNT_REVIEWS:"ACCOUNT_REVIEWS",ACCOUNT_ROOT:"ACCOUNT_ROOT",ACCOUNT_SUBSCRIPTION:"ACCOUNT_SUBSCRIPTION",CART:"CART",CATEGORY:"CATEGORY",CHECKOUT_ADDRESS:"CHECKOUT_ADDRESS",CHECKOUT_DELIVERY:"CHECKOUT_DELIVERY",CHECKOUT_ORDER_CONFIRMATION:"ORDER_CONFIRMATION",CHECKOUT_ORDER_FAILURE:"ORDER_FAILURE",CHECKOUT_PAYMENT:"CHECKOUT_PAYMENT_DETAILS",CHECKOUT_RESULT:"CHECKOUT_RESULT",CHECKOUT_TAX_INFORMATION:"CHECKOUT_TAX_INFORMATION",DOWNLOAD_ERROR:"DOWNLOAD_ERROR",FAVORITES:"FAVORITES",MISSING:"MISSING",PRODUCT:"PRODUCT",SEARCH:"SEARCH",SIGN_IN:"SIGN_IN",SUBSCRIBE:"SUBSCRIBE_PAGE",TERMS:"TERMS",UNSUBSCRIBE:"UNSUBSCRIBE_PAGE"},LegalPageTypeValues={ABOUT:"about",PRIVACY_POLICY:"privacy-policy",RETURNS:"returns",SHIPPING_PAYMENT:"shipping-payment",TERMS:"terms"},SortByValues={RELEVANCE:"RELEVANCE",DEFINED_BY_STORE_OWNER:"DEFINED_BY_STORE_OWNER",ADDED_TIME_DESC:"ADDED_TIME_DESC",ADDED_TIME_ASC:"ADDED_TIME_ASC",NAME_ASC:"NAME_ASC",NAME_DESC:"NAME_DESC",PRICE_ASC:"PRICE_ASC",PRICE_DESC:"PRICE_DESC",UPDATED_TIME_ASC:"UPDATED_TIME_ASC",UPDATED_TIME_DESC:"UPDATED_TIME_DESC"},VisitorLocationSourceValues={SHIPPING_ADDRESS:"SHIPPING_ADDRESS",BILLING_ADDRESS:"BILLING_ADDRESS",IP_ADDRESS:"IP_ADDRESS"};exports.downloadProductFile=api_index.downloadProductFile;exports.getApiConfig=api_index.getApiConfig;exports.getProduct=api_index.getProduct;exports.getStoreProfile=api_index.getStoreProfile;exports.initStorefrontApi=api_index.initStorefrontApi;exports.searchCategories=api_index.searchCategories;exports.searchProducts=api_index.searchProducts;exports.Cart=storefront_index.Cart;exports.Customer=storefront_index.Customer;exports.OnCartChanged=storefront_index.OnCartChanged;exports.OnConsentChanged=storefront_index.OnConsentChanged;exports.OnPageLoad=storefront_index.OnPageLoad;exports.OnPageLoaded=storefront_index.OnPageLoaded;exports.OnPageSwitch=storefront_index.OnPageSwitch;exports.OnSetProfile=storefront_index.OnSetProfile;exports.formatCurrency=storefront_index.formatCurrency;exports.getAppPublicConfig=storefront_index.getAppPublicConfig;exports.getAppPublicToken=storefront_index.getAppPublicToken;exports.getInitializedWidgets=storefront_index.getInitializedWidgets;exports.getStorefrontLang=storefront_index.getStorefrontLang;exports.getTrackingConsent=storefront_index.getTrackingConsent;exports.getVisitorLocation=storefront_index.getVisitorLocation;exports.isStorefrontV3=storefront_index.isStorefrontV3;exports.openPage=storefront_index.openPage;exports.setTrackingConsent=storefront_index.setTrackingConsent;exports.getOwnerId=getStoreId.getOwnerId;exports.getStoreId=getStoreId.getStoreId;exports.CustomerCookieConsentValues=CustomerCookieConsentValues;exports.EcwidWidgetValues=EcwidWidgetValues;exports.JsApiPageValues=JsApiPageValues;exports.LegalPageTypeValues=LegalPageTypeValues;exports.SortByValues=SortByValues;exports.VisitorLocationSourceValues=VisitorLocationSourceValues;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/constants/customer-cookie-consent.ts","../src/constants/ecwid-widget.ts","../src/constants/js-api-page.ts","../src/constants/legal-page-type.ts","../src/constants/sort-by.ts","../src/constants/visitor-location-source.ts"],"sourcesContent":["export const CustomerCookieConsentValues = {\n /** Customer hasn't given their consent yet. */\n UNDEFINED: 'UNDEFINED',\n /** Collect all types of cookies. */\n ACCEPTED: 'ACCEPTED',\n /** Collect only essential cookies. */\n DECLINED: 'DECLINED',\n /** Collect essential and analytics cookies only. */\n ANALYTICS_ONLY: 'ANALYTICS_ONLY',\n /** Collect essential and personalization cookies. */\n PERSONALIZATION_ONLY: 'PERSONALIZATION_ONLY',\n} as const;\n\nexport type CustomerCookieConsentType = typeof CustomerCookieConsentValues[keyof typeof CustomerCookieConsentValues];\n","export const EcwidWidgetValues = {\n /** Minicart widget */\n MINICART: 'Minicart',\n /** Search widget */\n SEARCH_PANEL: 'SearchPanel',\n /** Main storefront widget, contains full Ecwid store */\n PRODUCT_BROWSER: 'ProductBrowser',\n /** Horizontal categories menu widget */\n CATEGORIES: 'Categories',\n /** Widget with an embedded product page */\n PRODUCT: 'Product',\n} as const;\n\nexport type EcwidWidgetType = typeof EcwidWidgetValues[keyof typeof EcwidWidgetValues];\n","export const JsApiPageValues = {\n ACCOUNT_REGISTRATION: 'ACCOUNT_REGISTRATION',\n ACCOUNT_RESET_PASSWORD: 'ACCOUNT_RESET_PASSWORD',\n ACCOUNT_REVIEWS: 'ACCOUNT_REVIEWS',\n ACCOUNT_ROOT: 'ACCOUNT_ROOT',\n ACCOUNT_SUBSCRIPTION: 'ACCOUNT_SUBSCRIPTION',\n CART: 'CART',\n CATEGORY: 'CATEGORY',\n CHECKOUT_ADDRESS: 'CHECKOUT_ADDRESS',\n CHECKOUT_DELIVERY: 'CHECKOUT_DELIVERY',\n CHECKOUT_ORDER_CONFIRMATION: 'ORDER_CONFIRMATION',\n CHECKOUT_ORDER_FAILURE: 'ORDER_FAILURE',\n CHECKOUT_PAYMENT: 'CHECKOUT_PAYMENT_DETAILS',\n CHECKOUT_RESULT: 'CHECKOUT_RESULT',\n CHECKOUT_TAX_INFORMATION: 'CHECKOUT_TAX_INFORMATION',\n DOWNLOAD_ERROR: 'DOWNLOAD_ERROR',\n FAVORITES: 'FAVORITES',\n MISSING: 'MISSING',\n PRODUCT: 'PRODUCT',\n SEARCH: 'SEARCH',\n SIGN_IN: 'SIGN_IN',\n SUBSCRIBE: 'SUBSCRIBE_PAGE',\n TERMS: 'TERMS',\n UNSUBSCRIBE: 'UNSUBSCRIBE_PAGE',\n} as const;\n\nexport type JsApiPageType = typeof JsApiPageValues[keyof typeof JsApiPageValues];\n","export const LegalPageTypeValues = {\n ABOUT: 'about',\n PRIVACY_POLICY: 'privacy-policy',\n RETURNS: 'returns',\n SHIPPING_PAYMENT: 'shipping-payment',\n TERMS: 'terms',\n} as const;\n\nexport type LegalPageType = typeof LegalPageTypeValues[keyof typeof LegalPageTypeValues];\n","export const SortByValues = {\n RELEVANCE: 'RELEVANCE',\n DEFINED_BY_STORE_OWNER: 'DEFINED_BY_STORE_OWNER',\n ADDED_TIME_DESC: 'ADDED_TIME_DESC',\n ADDED_TIME_ASC: 'ADDED_TIME_ASC',\n NAME_ASC: 'NAME_ASC',\n NAME_DESC: 'NAME_DESC',\n PRICE_ASC: 'PRICE_ASC',\n PRICE_DESC: 'PRICE_DESC',\n UPDATED_TIME_ASC: 'UPDATED_TIME_ASC',\n UPDATED_TIME_DESC: 'UPDATED_TIME_DESC',\n} as const;\n\nexport type SortByType = typeof SortByValues[keyof typeof SortByValues];\n","export const VisitorLocationSourceValues = {\n SHIPPING_ADDRESS: 'SHIPPING_ADDRESS',\n BILLING_ADDRESS: 'BILLING_ADDRESS',\n IP_ADDRESS: 'IP_ADDRESS',\n} as const;\n\nexport type VisitorLocationSourceType = typeof VisitorLocationSourceValues[keyof typeof VisitorLocationSourceValues];\n"],"names":[],"mappings":"qKAAa,4BAA8B,CAEzC,UAAW,YAEX,SAAU,WAEV,SAAU,WAEV,eAAgB,iBAEhB,qBAAsB,sBACxB,ECXa,kBAAoB,CAE/B,SAAU,WAEV,aAAc,cAEd,gBAAiB,iBAEjB,WAAY,aAEZ,QAAS,SACX,ECXa,gBAAkB,CAC7B,qBAAsB,uBACtB,uBAAwB,yBACxB,gBAAiB,kBACjB,aAAc,eACd,qBAAsB,uBACtB,KAAM,OACN,SAAU,WACV,iBAAkB,mBAClB,kBAAmB,oBACnB,4BAA6B,qBAC7B,uBAAwB,gBACxB,iBAAkB,2BAClB,gBAAiB,kBACjB,yBAA0B,2BAC1B,eAAgB,iBAChB,UAAW,YACX,QAAS,UACT,QAAS,UACT,OAAQ,SACR,QAAS,UACT,UAAW,iBACX,MAAO,QACP,YAAa,kBACf,ECxBa,oBAAsB,CACjC,MAAO,QACP,eAAgB,iBAChB,QAAS,UACT,iBAAkB,mBAClB,MAAO,OACT,ECNa,aAAe,CAC1B,UAAW,YACX,uBAAwB,yBACxB,gBAAiB,kBACjB,eAAgB,iBAChB,SAAU,WACV,UAAW,YACX,UAAW,YACX,WAAY,aACZ,iBAAkB,mBAClB,kBAAmB,mBACrB,ECXa,4BAA8B,CACzC,iBAAkB,mBAClB,gBAAiB,kBACjB,WAAY,YACd"}
package/dist/index.d.cts CHANGED
@@ -1,23 +1,5 @@
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';
1
+ export { downloadProductFile, getApiConfig, getProduct, getStoreProfile, initStorefrontApi, searchCategories, searchProducts } from './api/index.cjs';
2
+ export { q as Cart, r as Customer, E as EcwidWidgetValues, O as OnCartChanged, k as OnConsentChanged, l as OnPageLoad, m as OnPageLoaded, n as OnPageSwitch, p as OnSetProfile, f as formatCurrency, g as getAppPublicConfig, a as getAppPublicToken, b as getInitializedWidgets, c as getOwnerId, d as getStoreId, e as getStorefrontLang, h as getTrackingConsent, i as getVisitorLocation, j as isStorefrontV3, o as openPage, s as setTrackingConsent } from './shared/ecom-headless.n2b3FM61.cjs';
3
+ export { a as AddProductData, b as AddProductParameter, A as AddProductRecurringChargeSettings, v as BaseJsApiPage, B as BillingPerson, d as CartAddProductCallback, i as CartApi, g as CartCalculateTotalCallback, f as CartClearCallback, p as CartData, n as CartDominatingColor, c as CartGetCallback, h as CartGoToCheckoutCallback, m as CartImageBorderInfo, o as CartItem, k as CartMediaItem, j as CartProduct, e as CartRemoveProductCallback, l as CartVideoInfo, s as CustomerApi, C as CustomerCookieConsentValues, t as CustomerData, q as CustomerGetCallback, r as CustomerSignOutCallback, E as EcwidApiPromise, w as JsApiFilterParams, u as JsApiPage, J as JsApiPageValues, L as LegalPageTypeValues, O as Order, R as RecurringChargeSettings, S as ShippingAddress, T as TrackingConsent, x as VisitorLocation, V as VisitorLocationSourceValues } from './shared/ecom-headless.BTRqua6N.cjs';
4
+ export { H as Account, I as AccountBilling, J as Address, U as AddressFormat, au as ApiConfig, K as ApplePay, C as Category, M as Company, N as CurrencyFormat, O as DesignSettings, ac as DestinationZone, E as DownloadProductFileParams, D as DownloadProductFileResponse, ad as EstimatedShippingTimeAtCheckoutSettings, R as FeatureToggle, T as FilterSection, ab as FlatRate, V as FormatsAndUnits, X as GeneralInfo, B as GetProductParams, G as GetProductResponse, at as GetStoreProfileParams, as as GetStoreProfileResponse, a9 as HandlingFee, Y as InstructionsForCustomer, Z as Languages, _ as LegalPage, $ as LegalPagesSettings, L as LowestPriceSettings, a0 as MailNotifications, a1 as NotificationSetting, a2 as OrderInvoiceSettings, F as PaginatedResponse, a3 as Payment, a4 as PaymentOption, a5 as PhoneNotifications, P as Product, c as ProductAttribute, d as ProductBorderInfo, e as ProductCategory, f as ProductColor, g as ProductCombination, h as ProductCombinationOption, i as ProductDimensions, j as ProductFavorites, k as ProductFile, a6 as ProductFiltersSettings, l as ProductGalleryImage, m as ProductImage, n as ProductImageAlt, o as ProductMedia, p as ProductMediaImage, q as ProductMediaVideo, r as ProductOption, s as ProductOptionChoice, t as ProductRecurringChargeSettings, u as ProductRelatedCategory, v as ProductRelatedProducts, w as ProductShipping, x as ProductSubscriptionSettings, y as ProductTax, Q as QueryParams, a7 as RegistrationAnswers, a8 as SalePrice, b as SearchCategoriesParams, a as SearchCategoriesResponse, A as SearchProductsParams, z as SearchProductsResponse, af as Shipping, ae as ShippingOption, aa as ShippingOrigin, ag as ShippingSettings, ah as ShippingZone, ai as SocialLink, aj as SocialLinksSettings, S as SortByValues, ak as StarterSite, al as StoreProfile, am as StoreSettings, an as Tax, ao as TaxInvoiceSettings, ap as TaxSettings, aq as TipsSettings, W as WholesalePrice, ar as Zone } from './shared/ecom-headless.BaNiBjDE.cjs';
3
5
  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,23 +1,5 @@
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';
1
+ export { downloadProductFile, getApiConfig, getProduct, getStoreProfile, initStorefrontApi, searchCategories, searchProducts } from './api/index.mjs';
2
+ export { q as Cart, r as Customer, E as EcwidWidgetValues, O as OnCartChanged, k as OnConsentChanged, l as OnPageLoad, m as OnPageLoaded, n as OnPageSwitch, p as OnSetProfile, f as formatCurrency, g as getAppPublicConfig, a as getAppPublicToken, b as getInitializedWidgets, c as getOwnerId, d as getStoreId, e as getStorefrontLang, h as getTrackingConsent, i as getVisitorLocation, j as isStorefrontV3, o as openPage, s as setTrackingConsent } from './shared/ecom-headless.fwEDqznC.mjs';
3
+ export { a as AddProductData, b as AddProductParameter, A as AddProductRecurringChargeSettings, v as BaseJsApiPage, B as BillingPerson, d as CartAddProductCallback, i as CartApi, g as CartCalculateTotalCallback, f as CartClearCallback, p as CartData, n as CartDominatingColor, c as CartGetCallback, h as CartGoToCheckoutCallback, m as CartImageBorderInfo, o as CartItem, k as CartMediaItem, j as CartProduct, e as CartRemoveProductCallback, l as CartVideoInfo, s as CustomerApi, C as CustomerCookieConsentValues, t as CustomerData, q as CustomerGetCallback, r as CustomerSignOutCallback, E as EcwidApiPromise, w as JsApiFilterParams, u as JsApiPage, J as JsApiPageValues, L as LegalPageTypeValues, O as Order, R as RecurringChargeSettings, S as ShippingAddress, T as TrackingConsent, x as VisitorLocation, V as VisitorLocationSourceValues } from './shared/ecom-headless.BTRqua6N.mjs';
4
+ export { H as Account, I as AccountBilling, J as Address, U as AddressFormat, au as ApiConfig, K as ApplePay, C as Category, M as Company, N as CurrencyFormat, O as DesignSettings, ac as DestinationZone, E as DownloadProductFileParams, D as DownloadProductFileResponse, ad as EstimatedShippingTimeAtCheckoutSettings, R as FeatureToggle, T as FilterSection, ab as FlatRate, V as FormatsAndUnits, X as GeneralInfo, B as GetProductParams, G as GetProductResponse, at as GetStoreProfileParams, as as GetStoreProfileResponse, a9 as HandlingFee, Y as InstructionsForCustomer, Z as Languages, _ as LegalPage, $ as LegalPagesSettings, L as LowestPriceSettings, a0 as MailNotifications, a1 as NotificationSetting, a2 as OrderInvoiceSettings, F as PaginatedResponse, a3 as Payment, a4 as PaymentOption, a5 as PhoneNotifications, P as Product, c as ProductAttribute, d as ProductBorderInfo, e as ProductCategory, f as ProductColor, g as ProductCombination, h as ProductCombinationOption, i as ProductDimensions, j as ProductFavorites, k as ProductFile, a6 as ProductFiltersSettings, l as ProductGalleryImage, m as ProductImage, n as ProductImageAlt, o as ProductMedia, p as ProductMediaImage, q as ProductMediaVideo, r as ProductOption, s as ProductOptionChoice, t as ProductRecurringChargeSettings, u as ProductRelatedCategory, v as ProductRelatedProducts, w as ProductShipping, x as ProductSubscriptionSettings, y as ProductTax, Q as QueryParams, a7 as RegistrationAnswers, a8 as SalePrice, b as SearchCategoriesParams, a as SearchCategoriesResponse, A as SearchProductsParams, z as SearchProductsResponse, af as Shipping, ae as ShippingOption, aa as ShippingOrigin, ag as ShippingSettings, ah as ShippingZone, ai as SocialLink, aj as SocialLinksSettings, S as SortByValues, ak as StarterSite, al as StoreProfile, am as StoreSettings, an as Tax, ao as TaxInvoiceSettings, ap as TaxSettings, aq as TipsSettings, W as WholesalePrice, ar as Zone } from './shared/ecom-headless.BaNiBjDE.mjs';
3
5
  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,23 +1,5 @@
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';
1
+ export { downloadProductFile, getApiConfig, getProduct, getStoreProfile, initStorefrontApi, searchCategories, searchProducts } from './api/index.js';
2
+ export { q as Cart, r as Customer, E as EcwidWidgetValues, O as OnCartChanged, k as OnConsentChanged, l as OnPageLoad, m as OnPageLoaded, n as OnPageSwitch, p as OnSetProfile, f as formatCurrency, g as getAppPublicConfig, a as getAppPublicToken, b as getInitializedWidgets, c as getOwnerId, d as getStoreId, e as getStorefrontLang, h as getTrackingConsent, i as getVisitorLocation, j as isStorefrontV3, o as openPage, s as setTrackingConsent } from './shared/ecom-headless.D2QPHn5F.js';
3
+ export { a as AddProductData, b as AddProductParameter, A as AddProductRecurringChargeSettings, v as BaseJsApiPage, B as BillingPerson, d as CartAddProductCallback, i as CartApi, g as CartCalculateTotalCallback, f as CartClearCallback, p as CartData, n as CartDominatingColor, c as CartGetCallback, h as CartGoToCheckoutCallback, m as CartImageBorderInfo, o as CartItem, k as CartMediaItem, j as CartProduct, e as CartRemoveProductCallback, l as CartVideoInfo, s as CustomerApi, C as CustomerCookieConsentValues, t as CustomerData, q as CustomerGetCallback, r as CustomerSignOutCallback, E as EcwidApiPromise, w as JsApiFilterParams, u as JsApiPage, J as JsApiPageValues, L as LegalPageTypeValues, O as Order, R as RecurringChargeSettings, S as ShippingAddress, T as TrackingConsent, x as VisitorLocation, V as VisitorLocationSourceValues } from './shared/ecom-headless.BTRqua6N.js';
4
+ export { H as Account, I as AccountBilling, J as Address, U as AddressFormat, au as ApiConfig, K as ApplePay, C as Category, M as Company, N as CurrencyFormat, O as DesignSettings, ac as DestinationZone, E as DownloadProductFileParams, D as DownloadProductFileResponse, ad as EstimatedShippingTimeAtCheckoutSettings, R as FeatureToggle, T as FilterSection, ab as FlatRate, V as FormatsAndUnits, X as GeneralInfo, B as GetProductParams, G as GetProductResponse, at as GetStoreProfileParams, as as GetStoreProfileResponse, a9 as HandlingFee, Y as InstructionsForCustomer, Z as Languages, _ as LegalPage, $ as LegalPagesSettings, L as LowestPriceSettings, a0 as MailNotifications, a1 as NotificationSetting, a2 as OrderInvoiceSettings, F as PaginatedResponse, a3 as Payment, a4 as PaymentOption, a5 as PhoneNotifications, P as Product, c as ProductAttribute, d as ProductBorderInfo, e as ProductCategory, f as ProductColor, g as ProductCombination, h as ProductCombinationOption, i as ProductDimensions, j as ProductFavorites, k as ProductFile, a6 as ProductFiltersSettings, l as ProductGalleryImage, m as ProductImage, n as ProductImageAlt, o as ProductMedia, p as ProductMediaImage, q as ProductMediaVideo, r as ProductOption, s as ProductOptionChoice, t as ProductRecurringChargeSettings, u as ProductRelatedCategory, v as ProductRelatedProducts, w as ProductShipping, x as ProductSubscriptionSettings, y as ProductTax, Q as QueryParams, a7 as RegistrationAnswers, a8 as SalePrice, b as SearchCategoriesParams, a as SearchCategoriesResponse, A as SearchProductsParams, z as SearchProductsResponse, af as Shipping, ae as ShippingOption, aa as ShippingOrigin, ag as ShippingSettings, ah as ShippingZone, ai as SocialLink, aj as SocialLinksSettings, S as SortByValues, ak as StarterSite, al as StoreProfile, am as StoreSettings, an as Tax, ao as TaxInvoiceSettings, ap as TaxSettings, aq as TipsSettings, W as WholesalePrice, ar as Zone } from './shared/ecom-headless.BaNiBjDE.js';
3
5
  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,2 +1,2 @@
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};
1
+ export{downloadProductFile,getApiConfig,getProduct,getStoreProfile,initStorefrontApi,searchCategories,searchProducts}from"./api/index.mjs";export{Cart,Customer,OnCartChanged,OnConsentChanged,OnPageLoad,OnPageLoaded,OnPageSwitch,OnSetProfile,formatCurrency,getAppPublicConfig,getAppPublicToken,getInitializedWidgets,getStorefrontLang,getTrackingConsent,getVisitorLocation,isStorefrontV3,openPage,setTrackingConsent}from"./storefront/index.mjs";export{g as getOwnerId,a as getStoreId}from"./shared/ecom-headless.biFHUae1.mjs";const E={UNDEFINED:"UNDEFINED",ACCEPTED:"ACCEPTED",DECLINED:"DECLINED",ANALYTICS_ONLY:"ANALYTICS_ONLY",PERSONALIZATION_ONLY:"PERSONALIZATION_ONLY"},C={MINICART:"Minicart",SEARCH_PANEL:"SearchPanel",PRODUCT_BROWSER:"ProductBrowser",CATEGORIES:"Categories",PRODUCT:"Product"},S={ACCOUNT_REGISTRATION:"ACCOUNT_REGISTRATION",ACCOUNT_RESET_PASSWORD:"ACCOUNT_RESET_PASSWORD",ACCOUNT_REVIEWS:"ACCOUNT_REVIEWS",ACCOUNT_ROOT:"ACCOUNT_ROOT",ACCOUNT_SUBSCRIPTION:"ACCOUNT_SUBSCRIPTION",CART:"CART",CATEGORY:"CATEGORY",CHECKOUT_ADDRESS:"CHECKOUT_ADDRESS",CHECKOUT_DELIVERY:"CHECKOUT_DELIVERY",CHECKOUT_ORDER_CONFIRMATION:"ORDER_CONFIRMATION",CHECKOUT_ORDER_FAILURE:"ORDER_FAILURE",CHECKOUT_PAYMENT:"CHECKOUT_PAYMENT_DETAILS",CHECKOUT_RESULT:"CHECKOUT_RESULT",CHECKOUT_TAX_INFORMATION:"CHECKOUT_TAX_INFORMATION",DOWNLOAD_ERROR:"DOWNLOAD_ERROR",FAVORITES:"FAVORITES",MISSING:"MISSING",PRODUCT:"PRODUCT",SEARCH:"SEARCH",SIGN_IN:"SIGN_IN",SUBSCRIBE:"SUBSCRIBE_PAGE",TERMS:"TERMS",UNSUBSCRIBE:"UNSUBSCRIBE_PAGE"},A={ABOUT:"about",PRIVACY_POLICY:"privacy-policy",RETURNS:"returns",SHIPPING_PAYMENT:"shipping-payment",TERMS:"terms"},R={RELEVANCE:"RELEVANCE",DEFINED_BY_STORE_OWNER:"DEFINED_BY_STORE_OWNER",ADDED_TIME_DESC:"ADDED_TIME_DESC",ADDED_TIME_ASC:"ADDED_TIME_ASC",NAME_ASC:"NAME_ASC",NAME_DESC:"NAME_DESC",PRICE_ASC:"PRICE_ASC",PRICE_DESC:"PRICE_DESC",UPDATED_TIME_ASC:"UPDATED_TIME_ASC",UPDATED_TIME_DESC:"UPDATED_TIME_DESC"},T={SHIPPING_ADDRESS:"SHIPPING_ADDRESS",BILLING_ADDRESS:"BILLING_ADDRESS",IP_ADDRESS:"IP_ADDRESS"};export{E as CustomerCookieConsentValues,C as EcwidWidgetValues,S as JsApiPageValues,A as LegalPageTypeValues,R as SortByValues,T as VisitorLocationSourceValues};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../src/constants/customer-cookie-consent.ts","../src/constants/ecwid-widget.ts","../src/constants/js-api-page.ts","../src/constants/legal-page-type.ts","../src/constants/sort-by.ts","../src/constants/visitor-location-source.ts"],"sourcesContent":["export const CustomerCookieConsentValues = {\n /** Customer hasn't given their consent yet. */\n UNDEFINED: 'UNDEFINED',\n /** Collect all types of cookies. */\n ACCEPTED: 'ACCEPTED',\n /** Collect only essential cookies. */\n DECLINED: 'DECLINED',\n /** Collect essential and analytics cookies only. */\n ANALYTICS_ONLY: 'ANALYTICS_ONLY',\n /** Collect essential and personalization cookies. */\n PERSONALIZATION_ONLY: 'PERSONALIZATION_ONLY',\n} as const;\n\nexport type CustomerCookieConsentType = typeof CustomerCookieConsentValues[keyof typeof CustomerCookieConsentValues];\n","export const EcwidWidgetValues = {\n /** Minicart widget */\n MINICART: 'Minicart',\n /** Search widget */\n SEARCH_PANEL: 'SearchPanel',\n /** Main storefront widget, contains full Ecwid store */\n PRODUCT_BROWSER: 'ProductBrowser',\n /** Horizontal categories menu widget */\n CATEGORIES: 'Categories',\n /** Widget with an embedded product page */\n PRODUCT: 'Product',\n} as const;\n\nexport type EcwidWidgetType = typeof EcwidWidgetValues[keyof typeof EcwidWidgetValues];\n","export const JsApiPageValues = {\n ACCOUNT_REGISTRATION: 'ACCOUNT_REGISTRATION',\n ACCOUNT_RESET_PASSWORD: 'ACCOUNT_RESET_PASSWORD',\n ACCOUNT_REVIEWS: 'ACCOUNT_REVIEWS',\n ACCOUNT_ROOT: 'ACCOUNT_ROOT',\n ACCOUNT_SUBSCRIPTION: 'ACCOUNT_SUBSCRIPTION',\n CART: 'CART',\n CATEGORY: 'CATEGORY',\n CHECKOUT_ADDRESS: 'CHECKOUT_ADDRESS',\n CHECKOUT_DELIVERY: 'CHECKOUT_DELIVERY',\n CHECKOUT_ORDER_CONFIRMATION: 'ORDER_CONFIRMATION',\n CHECKOUT_ORDER_FAILURE: 'ORDER_FAILURE',\n CHECKOUT_PAYMENT: 'CHECKOUT_PAYMENT_DETAILS',\n CHECKOUT_RESULT: 'CHECKOUT_RESULT',\n CHECKOUT_TAX_INFORMATION: 'CHECKOUT_TAX_INFORMATION',\n DOWNLOAD_ERROR: 'DOWNLOAD_ERROR',\n FAVORITES: 'FAVORITES',\n MISSING: 'MISSING',\n PRODUCT: 'PRODUCT',\n SEARCH: 'SEARCH',\n SIGN_IN: 'SIGN_IN',\n SUBSCRIBE: 'SUBSCRIBE_PAGE',\n TERMS: 'TERMS',\n UNSUBSCRIBE: 'UNSUBSCRIBE_PAGE',\n} as const;\n\nexport type JsApiPageType = typeof JsApiPageValues[keyof typeof JsApiPageValues];\n","export const LegalPageTypeValues = {\n ABOUT: 'about',\n PRIVACY_POLICY: 'privacy-policy',\n RETURNS: 'returns',\n SHIPPING_PAYMENT: 'shipping-payment',\n TERMS: 'terms',\n} as const;\n\nexport type LegalPageType = typeof LegalPageTypeValues[keyof typeof LegalPageTypeValues];\n","export const SortByValues = {\n RELEVANCE: 'RELEVANCE',\n DEFINED_BY_STORE_OWNER: 'DEFINED_BY_STORE_OWNER',\n ADDED_TIME_DESC: 'ADDED_TIME_DESC',\n ADDED_TIME_ASC: 'ADDED_TIME_ASC',\n NAME_ASC: 'NAME_ASC',\n NAME_DESC: 'NAME_DESC',\n PRICE_ASC: 'PRICE_ASC',\n PRICE_DESC: 'PRICE_DESC',\n UPDATED_TIME_ASC: 'UPDATED_TIME_ASC',\n UPDATED_TIME_DESC: 'UPDATED_TIME_DESC',\n} as const;\n\nexport type SortByType = typeof SortByValues[keyof typeof SortByValues];\n","export const VisitorLocationSourceValues = {\n SHIPPING_ADDRESS: 'SHIPPING_ADDRESS',\n BILLING_ADDRESS: 'BILLING_ADDRESS',\n IP_ADDRESS: 'IP_ADDRESS',\n} as const;\n\nexport type VisitorLocationSourceType = typeof VisitorLocationSourceValues[keyof typeof VisitorLocationSourceValues];\n"],"names":["CustomerCookieConsentValues","EcwidWidgetValues","JsApiPageValues","LegalPageTypeValues","SortByValues","VisitorLocationSourceValues"],"mappings":"4gBAAa,MAAAA,EAA8B,CAEzC,UAAW,YAEX,SAAU,WAEV,SAAU,WAEV,eAAgB,iBAEhB,qBAAsB,sBACxB,ECXaC,EAAoB,CAE/B,SAAU,WAEV,aAAc,cAEd,gBAAiB,iBAEjB,WAAY,aAEZ,QAAS,SACX,ECXaC,EAAkB,CAC7B,qBAAsB,uBACtB,uBAAwB,yBACxB,gBAAiB,kBACjB,aAAc,eACd,qBAAsB,uBACtB,KAAM,OACN,SAAU,WACV,iBAAkB,mBAClB,kBAAmB,oBACnB,4BAA6B,qBAC7B,uBAAwB,gBACxB,iBAAkB,2BAClB,gBAAiB,kBACjB,yBAA0B,2BAC1B,eAAgB,iBAChB,UAAW,YACX,QAAS,UACT,QAAS,UACT,OAAQ,SACR,QAAS,UACT,UAAW,iBACX,MAAO,QACP,YAAa,kBACf,ECxBaC,EAAsB,CACjC,MAAO,QACP,eAAgB,iBAChB,QAAS,UACT,iBAAkB,mBAClB,MAAO,OACT,ECNaC,EAAe,CAC1B,UAAW,YACX,uBAAwB,yBACxB,gBAAiB,kBACjB,eAAgB,iBAChB,SAAU,WACV,UAAW,YACX,UAAW,YACX,WAAY,aACZ,iBAAkB,mBAClB,kBAAmB,mBACrB,ECXaC,EAA8B,CACzC,iBAAkB,mBAClB,gBAAiB,kBACjB,WAAY,YACd"}