@spree/sdk 0.6.7 → 0.6.8
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.
- package/README.md +28 -2
- package/dist/index.cjs +32 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -33
- package/dist/index.d.ts +14 -33
- package/dist/index.js +32 -30
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.cts +18 -31
- package/dist/types/index.d.ts +18 -31
- package/dist/zod/index.cjs +19 -39
- package/dist/zod/index.cjs.map +1 -1
- package/dist/zod/index.d.cts +19 -77
- package/dist/zod/index.d.ts +19 -77
- package/dist/zod/index.js +20 -39
- package/dist/zod/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/request.ts","../src/params.ts","../src/store-client.ts","../src/admin-client.ts","../src/client.ts"],"names":[],"mappings":";AAmCO,IAAM,UAAA,GAAN,cAAyB,KAAA,CAAM;AAAA,EACpB,IAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EAEhB,WAAA,CAAY,UAAyB,MAAA,EAAgB;AACnD,IAAA,KAAA,CAAM,QAAA,CAAS,MAAM,OAAO,CAAA;AAC5B,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,SAAS,KAAA,CAAM,IAAA;AAC3B,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,OAAA,GAAU,SAAS,KAAA,CAAM,OAAA;AAAA,EAChC;AACF;AAQA,SAAS,cAAA,CAAe,SAAiB,MAAA,EAAuC;AAC9E,EAAA,MAAM,mBAAmB,MAAA,CAAO,SAAA,GAAY,IAAA,CAAK,GAAA,CAAI,GAAG,OAAO,CAAA;AAC/D,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,MAAA,EAAO,GAAI,MAAA,CAAO,SAAA;AACt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;AAC9B,IAAA,IAAA,CAAK,UAAU,MAAA,GAAS,MAAA;AAAA,EAC1B;AAAA;AAAA,EAGA,YAAY,QAAA,EAAwB;AAClC,IAAA,IAAA,CAAK,UAAU,QAAA,GAAW,QAAA;AAAA,EAC5B;AAAA;AAAA,EAGA,WAAW,OAAA,EAAuB;AAChC,IAAA,IAAA,CAAK,UAAU,OAAA,GAAU,OAAA;AAAA,EAC3B;AACF;AAKO,SAAS,kBAAkB,MAAA,EAAwC;AACxE,EAAA,OAAO,IAAI,YAAY,MAAM,CAAA;AAC/B","file":"index.js","sourcesContent":["import type { ErrorResponse, LocaleDefaults } from './types';\n\nexport interface RetryConfig {\n /** Maximum number of retries (default: 2) */\n maxRetries?: number;\n /** HTTP status codes to retry on (default: [429, 500, 502, 503, 504]) */\n retryOnStatus?: number[];\n /** Base delay in ms for exponential backoff (default: 300) */\n baseDelay?: number;\n /** Maximum delay in ms (default: 10000) */\n maxDelay?: number;\n /** Whether to retry on network errors (default: true) */\n retryOnNetworkError?: boolean;\n}\n\nexport interface RequestOptions {\n /** Bearer token for authenticated requests */\n token?: string;\n /** Order token for guest checkout */\n orderToken?: string;\n /** Locale for translated content (e.g., 'en', 'fr') */\n locale?: string;\n /** Currency for prices (e.g., 'USD', 'EUR') */\n currency?: string;\n /** Country ISO code for market resolution (e.g., 'US', 'DE') */\n country?: string;\n /** Custom headers */\n headers?: Record<string, string>;\n}\n\nexport interface InternalRequestOptions extends RequestOptions {\n body?: unknown;\n params?: Record<string, string | number | boolean | (string | number)[] | undefined>;\n}\n\nexport class SpreeError extends Error {\n public readonly code: string;\n public readonly status: number;\n public readonly details?: Record<string, string[]>;\n\n constructor(response: ErrorResponse, status: number) {\n super(response.error.message);\n this.name = 'SpreeError';\n this.code = response.error.code;\n this.status = status;\n this.details = response.error.details;\n }\n}\n\nexport type RequestFn = <T>(\n method: string,\n path: string,\n options?: InternalRequestOptions\n) => Promise<T>;\n\nfunction calculateDelay(attempt: number, config: Required<RetryConfig>): number {\n const exponentialDelay = config.baseDelay * Math.pow(2, attempt);\n const jitter = Math.random() * config.baseDelay;\n return Math.min(exponentialDelay + jitter, config.maxDelay);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nfunction shouldRetryOnStatus(method: string, status: number, config: Required<RetryConfig>): boolean {\n const isIdempotent = method === 'GET' || method === 'HEAD';\n if (isIdempotent) {\n return config.retryOnStatus.includes(status);\n }\n return status === 429;\n}\n\nfunction shouldRetryOnNetworkError(method: string, config: Required<RetryConfig>): boolean {\n if (!config.retryOnNetworkError) return false;\n return method === 'GET' || method === 'HEAD';\n}\n\nexport interface RequestConfig {\n baseUrl: string;\n fetchFn: typeof fetch;\n retryConfig: Required<RetryConfig> | false;\n}\n\nexport interface AuthConfig {\n headerName: string;\n headerValue: string;\n}\n\n/**\n * Creates a bound request function for a specific API scope (store or admin).\n */\nexport function createRequestFn(\n config: RequestConfig,\n basePath: string,\n auth: AuthConfig,\n defaults?: LocaleDefaults\n): RequestFn {\n return async function request<T>(\n method: string,\n path: string,\n options: InternalRequestOptions = {}\n ): Promise<T> {\n const { token, orderToken, headers = {}, body, params } = options;\n\n // Per-request options override client-level defaults\n const locale = options.locale ?? defaults?.locale;\n const currency = options.currency ?? defaults?.currency;\n const country = options.country ?? defaults?.country;\n\n // Build URL with query params\n const url = new URL(`${config.baseUrl}${basePath}${path}`);\n if (params) {\n Object.entries(params).forEach(([key, value]) => {\n if (value !== undefined) {\n if (Array.isArray(value)) {\n value.forEach((v) => url.searchParams.append(key, String(v)));\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n });\n }\n if (orderToken) {\n url.searchParams.set('order_token', orderToken);\n }\n\n // Build headers\n const requestHeaders: Record<string, string> = {\n 'Content-Type': 'application/json',\n [auth.headerName]: auth.headerValue,\n ...headers,\n };\n\n if (token) {\n requestHeaders['Authorization'] = `Bearer ${token}`;\n }\n\n if (orderToken) {\n requestHeaders['x-spree-order-token'] = orderToken;\n }\n\n if (locale) {\n requestHeaders['x-spree-locale'] = locale;\n }\n\n if (currency) {\n requestHeaders['x-spree-currency'] = currency;\n }\n\n if (country) {\n requestHeaders['x-spree-country'] = country;\n }\n\n const maxAttempts = config.retryConfig ? config.retryConfig.maxRetries + 1 : 1;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n try {\n const response = await config.fetchFn(url.toString(), {\n method,\n headers: requestHeaders,\n body: body ? JSON.stringify(body) : undefined,\n });\n\n if (!response.ok) {\n const isLastAttempt = attempt >= maxAttempts - 1;\n\n if (!isLastAttempt && config.retryConfig && shouldRetryOnStatus(method, response.status, config.retryConfig)) {\n const retryAfter = response.headers.get('Retry-After');\n const delay = retryAfter\n ? Math.min(parseInt(retryAfter, 10) * 1000, config.retryConfig.maxDelay)\n : calculateDelay(attempt, config.retryConfig);\n await sleep(delay);\n continue;\n }\n\n const errorBody = await response.json() as ErrorResponse;\n throw new SpreeError(errorBody, response.status);\n }\n\n // Handle 204 No Content\n if (response.status === 204) {\n return undefined as T;\n }\n\n return response.json() as Promise<T>;\n } catch (error) {\n if (error instanceof SpreeError) {\n throw error;\n }\n\n const isLastAttempt = attempt >= maxAttempts - 1;\n\n if (!isLastAttempt && config.retryConfig && shouldRetryOnNetworkError(method, config.retryConfig)) {\n const delay = calculateDelay(attempt, config.retryConfig);\n await sleep(delay);\n continue;\n }\n\n throw error;\n }\n }\n\n // This should never be reached, but TypeScript needs it\n throw new Error('Unexpected end of retry loop');\n };\n}\n","/**\n * Keys that are passed through to the API without wrapping in q[...].\n */\nconst PASSTHROUGH_KEYS = new Set(['page', 'limit', 'expand', 'sort']);\n\ntype ParamValue = string | number | boolean | (string | number)[] | undefined;\n\n/**\n * Transforms flat SDK params into Ransack-compatible query params.\n *\n * - `page`, `limit`, `expand`, `sort` pass through unchanged\n * - Keys already in `q[...]` format pass through (backward compat)\n * - All other keys are wrapped: `name_cont` → `q[name_cont]`\n */\nexport function transformListParams(\n params: Record<string, unknown>\n): Record<string, ParamValue> {\n const result: Record<string, ParamValue> = {};\n\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined) continue;\n\n if (PASSTHROUGH_KEYS.has(key)) {\n // Join arrays for passthrough keys (e.g., expand: ['variants', 'images'] → 'variants,images')\n result[key] = Array.isArray(value) ? (value as (string | number)[]).join(',') : value as ParamValue;\n continue;\n }\n\n // Backward compat: already-wrapped q[...] keys pass through\n if (key.startsWith('q[')) {\n result[key] = value as ParamValue;\n continue;\n }\n\n // Array values get [] suffix automatically: `foo: [1,2]` → `q[foo][]`\n if (Array.isArray(value)) {\n const base = key.endsWith('[]') ? key.slice(0, -2) : key;\n result[`q[${base}][]`] = value as ParamValue;\n } else {\n result[`q[${key}]`] = value as ParamValue;\n }\n }\n\n return result;\n}\n","import type { RequestFn, RequestOptions } from './request';\nimport { transformListParams } from './params';\n\n/** Join expand array into comma-separated string for the API */\nfunction expandParams(params?: { expand?: string[] }): Record<string, string> | undefined {\n if (!params?.expand?.length) return undefined;\n return { expand: params.expand.join(',') };\n}\nimport type {\n AuthTokens,\n LoginCredentials,\n RegisterParams,\n PaginatedResponse,\n ListParams,\n ProductListParams,\n ProductFiltersParams,\n ProductFiltersResponse,\n TaxonListParams,\n OrderListParams,\n CreateCartParams,\n AddLineItemParams,\n UpdateLineItemParams,\n UpdateOrderParams,\n AddressParams,\n CreatePaymentSessionParams,\n UpdatePaymentSessionParams,\n CompletePaymentSessionParams,\n CreatePaymentSetupSessionParams,\n CompletePaymentSetupSessionParams,\n StoreCreditCard,\n StoreGiftCard,\n StoreProduct,\n StoreOrder,\n StoreCountry,\n StoreCurrency,\n StoreLocale,\n StoreMarket,\n StoreTaxonomy,\n StoreTaxon,\n StorePayment,\n StorePaymentMethod,\n StorePaymentSession,\n StorePaymentSetupSession,\n StoreShipment,\n StoreStore,\n StoreWishlist,\n StoreWishedItem,\n StoreAddress,\n StoreCustomer,\n} from './types';\n\nexport class StoreClient {\n private readonly request: RequestFn;\n\n constructor(request: RequestFn) {\n this.request = request;\n }\n\n // ============================================\n // Authentication\n // ============================================\n\n readonly auth = {\n /**\n * Login with email and password\n */\n login: (credentials: LoginCredentials): Promise<AuthTokens> =>\n this.request<AuthTokens>('POST', '/auth/login', { body: credentials }),\n\n /**\n * Register a new customer account\n */\n register: (params: RegisterParams): Promise<AuthTokens> =>\n this.request<AuthTokens>('POST', '/auth/register', { body: params }),\n\n /**\n * Refresh access token (requires valid Bearer token)\n */\n refresh: (options: RequestOptions): Promise<AuthTokens> =>\n this.request<AuthTokens>('POST', '/auth/refresh', options),\n };\n\n // ============================================\n // Store\n // ============================================\n\n readonly store = {\n /**\n * Get current store information\n */\n get: (options?: RequestOptions): Promise<StoreStore> =>\n this.request<StoreStore>('GET', '/store', options),\n };\n\n // ============================================\n // Products\n // ============================================\n\n readonly products = {\n /**\n * List products\n */\n list: (\n params?: ProductListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreProduct>> =>\n this.request<PaginatedResponse<StoreProduct>>('GET', '/products', {\n ...options,\n params: params ? transformListParams(params) : undefined,\n }),\n\n /**\n * Get a product by ID or slug\n */\n get: (\n idOrSlug: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreProduct> =>\n this.request<StoreProduct>('GET', `/products/${idOrSlug}`, {\n ...options,\n params: expandParams(params),\n }),\n\n /**\n * Get available filters for products\n * Returns filter options (price range, availability, option types, taxons) with counts\n */\n filters: (\n params?: ProductFiltersParams,\n options?: RequestOptions\n ): Promise<ProductFiltersResponse> =>\n this.request<ProductFiltersResponse>('GET', '/products/filters', {\n ...options,\n params: params as Record<string, string | number | undefined>,\n }),\n };\n\n // ============================================\n // Taxonomies & Taxons\n // ============================================\n\n readonly taxonomies = {\n /**\n * List taxonomies\n */\n list: (\n params?: ListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreTaxonomy>> =>\n this.request<PaginatedResponse<StoreTaxonomy>>('GET', '/taxonomies', {\n ...options,\n params: params as Record<string, string | number | undefined>,\n }),\n\n /**\n * Get a taxonomy by ID\n */\n get: (\n id: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreTaxonomy> =>\n this.request<StoreTaxonomy>('GET', `/taxonomies/${id}`, {\n ...options,\n params: expandParams(params),\n }),\n };\n\n readonly taxons = {\n /**\n * List taxons\n */\n list: (\n params?: TaxonListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreTaxon>> =>\n this.request<PaginatedResponse<StoreTaxon>>('GET', '/taxons', {\n ...options,\n params: params ? transformListParams(params) : undefined,\n }),\n\n /**\n * Get a taxon by ID or permalink\n */\n get: (\n idOrPermalink: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreTaxon> =>\n this.request<StoreTaxon>('GET', `/taxons/${idOrPermalink}`, {\n ...options,\n params: expandParams(params),\n }),\n\n /**\n * Nested resource: Products in a taxon\n */\n products: {\n /**\n * List products in a taxon\n * @param taxonId - Taxon ID (prefix_id) or permalink\n */\n list: (\n taxonId: string,\n params?: ProductListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreProduct>> =>\n this.request<PaginatedResponse<StoreProduct>>(\n 'GET',\n `/taxons/${taxonId}/products`,\n {\n ...options,\n params: params ? transformListParams(params) : undefined,\n }\n ),\n },\n };\n\n // ============================================\n // Countries, Currencies & Locales\n // ============================================\n\n readonly countries = {\n /**\n * List countries available in the store\n * Each country includes currency and default_locale derived from its market\n */\n list: (options?: RequestOptions): Promise<{ data: StoreCountry[] }> =>\n this.request<{ data: StoreCountry[] }>('GET', '/countries', options),\n\n /**\n * Get a country by ISO code\n * Use `?expand=states` to expand states for address forms\n * @param iso - ISO 3166-1 alpha-2 code (e.g., \"US\", \"DE\")\n */\n get: (\n iso: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreCountry> =>\n this.request<StoreCountry>('GET', `/countries/${iso}`, {\n ...options,\n params: expandParams(params),\n }),\n };\n\n readonly currencies = {\n /**\n * List currencies supported by the store (derived from markets)\n */\n list: (options?: RequestOptions): Promise<{ data: StoreCurrency[] }> =>\n this.request<{ data: StoreCurrency[] }>('GET', '/currencies', options),\n };\n\n readonly locales = {\n /**\n * List locales supported by the store (derived from markets)\n */\n list: (options?: RequestOptions): Promise<{ data: StoreLocale[] }> =>\n this.request<{ data: StoreLocale[] }>('GET', '/locales', options),\n };\n\n // ============================================\n // Markets\n // ============================================\n\n readonly markets = {\n /**\n * List all markets for the current store\n */\n list: (options?: RequestOptions): Promise<{ data: StoreMarket[] }> =>\n this.request<{ data: StoreMarket[] }>('GET', '/markets', options),\n\n /**\n * Get a market by prefixed ID\n * @param id - Market prefixed ID (e.g., \"mkt_k5nR8xLq\")\n */\n get: (id: string, options?: RequestOptions): Promise<StoreMarket> =>\n this.request<StoreMarket>('GET', `/markets/${id}`, options),\n\n /**\n * Resolve which market applies for a given country\n * @param country - ISO 3166-1 alpha-2 code (e.g., \"DE\", \"US\")\n */\n resolve: (country: string, options?: RequestOptions): Promise<StoreMarket> =>\n this.request<StoreMarket>('GET', '/markets/resolve', {\n ...options,\n params: { country },\n }),\n\n /**\n * Nested resource: Countries in a market\n */\n countries: {\n /**\n * List countries belonging to a market\n * @param marketId - Market prefixed ID\n */\n list: (\n marketId: string,\n options?: RequestOptions\n ): Promise<{ data: StoreCountry[] }> =>\n this.request<{ data: StoreCountry[] }>(\n 'GET',\n `/markets/${marketId}/countries`,\n options\n ),\n\n /**\n * Get a country by ISO code within a market\n * @param marketId - Market prefixed ID\n * @param iso - Country ISO code (e.g., \"DE\")\n */\n get: (\n marketId: string,\n iso: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreCountry> =>\n this.request<StoreCountry>(\n 'GET',\n `/markets/${marketId}/countries/${iso}`,\n { ...options, params: expandParams(params) }\n ),\n },\n };\n\n // ============================================\n // Cart (convenience wrapper for current incomplete order)\n // ============================================\n\n readonly cart = {\n /**\n * Get current cart (returns null if none exists)\n * Pass orderToken for guest checkout, or use JWT for authenticated users\n */\n get: (options?: RequestOptions): Promise<StoreOrder & { token: string }> =>\n this.request<StoreOrder & { token: string }>('GET', '/cart', options),\n\n /**\n * Create a new cart\n * @param params - Optional cart parameters (e.g., metadata)\n */\n create: (params?: CreateCartParams, options?: RequestOptions): Promise<StoreOrder & { token: string }> =>\n this.request<StoreOrder & { token: string }>('POST', '/cart', {\n ...options,\n body: params,\n }),\n\n /**\n * Associate a guest cart with the currently authenticated user\n * Requires both JWT token (for authentication) and orderToken (to identify the cart)\n * @param options - Must include both `token` (JWT) and `orderToken` (guest cart token)\n */\n associate: (options: RequestOptions): Promise<StoreOrder & { token: string }> =>\n this.request<StoreOrder & { token: string }>('PATCH', '/cart/associate', options),\n };\n\n // ============================================\n // Orders (individual order management & checkout)\n // ============================================\n\n readonly orders = {\n /**\n * Get an order by ID or number\n */\n get: (\n idOrNumber: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('GET', `/orders/${idOrNumber}`, {\n ...options,\n params: expandParams(params),\n }),\n\n /**\n * Update an order\n */\n update: (\n idOrNumber: string,\n params: UpdateOrderParams,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('PATCH', `/orders/${idOrNumber}`, {\n ...options,\n body: params,\n }),\n\n /**\n * Advance order to next checkout step\n */\n next: (\n idOrNumber: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('PATCH', `/orders/${idOrNumber}/next`, options),\n\n /**\n * Advance through all checkout steps\n */\n advance: (\n idOrNumber: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'PATCH',\n `/orders/${idOrNumber}/advance`,\n options\n ),\n\n /**\n * Complete the order\n */\n complete: (\n idOrNumber: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'PATCH',\n `/orders/${idOrNumber}/complete`,\n options\n ),\n\n /**\n * Add store credit to order\n */\n addStoreCredit: (\n idOrNumber: string,\n amount?: number,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('POST', `/orders/${idOrNumber}/store_credits`, {\n ...options,\n body: amount ? { amount } : undefined,\n }),\n\n /**\n * Remove store credit from order\n */\n removeStoreCredit: (\n idOrNumber: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'DELETE',\n `/orders/${idOrNumber}/store_credits`,\n options\n ),\n\n /**\n * Nested resource: Line items\n */\n lineItems: {\n /**\n * Add a line item to an order.\n * Returns the updated order with recalculated totals.\n */\n create: (\n orderId: string,\n params: AddLineItemParams,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('POST', `/orders/${orderId}/line_items`, {\n ...options,\n body: params,\n }),\n\n /**\n * Update a line item quantity.\n * Returns the updated order with recalculated totals.\n */\n update: (\n orderId: string,\n lineItemId: string,\n params: UpdateLineItemParams,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'PATCH',\n `/orders/${orderId}/line_items/${lineItemId}`,\n { ...options, body: params }\n ),\n\n /**\n * Remove a line item from an order.\n * Returns the updated order with recalculated totals.\n */\n delete: (\n orderId: string,\n lineItemId: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'DELETE',\n `/orders/${orderId}/line_items/${lineItemId}`,\n options\n ),\n },\n\n /**\n * Nested resource: Payments\n */\n payments: {\n /**\n * List payments for an order\n */\n list: (\n orderId: string,\n options?: RequestOptions\n ): Promise<{ data: StorePayment[]; meta: object }> =>\n this.request<{ data: StorePayment[]; meta: object }>(\n 'GET',\n `/orders/${orderId}/payments`,\n options\n ),\n\n /**\n * Get a payment by ID\n */\n get: (\n orderId: string,\n paymentId: string,\n options?: RequestOptions\n ): Promise<StorePayment> =>\n this.request<StorePayment>(\n 'GET',\n `/orders/${orderId}/payments/${paymentId}`,\n options\n ),\n },\n\n /**\n * Nested resource: Payment methods\n */\n paymentMethods: {\n /**\n * List available payment methods for an order\n */\n list: (\n orderId: string,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StorePaymentMethod>> =>\n this.request<PaginatedResponse<StorePaymentMethod>>(\n 'GET',\n `/orders/${orderId}/payment_methods`,\n options\n ),\n },\n\n /**\n * Nested resource: Payment sessions\n */\n paymentSessions: {\n /**\n * Create a payment session for an order\n * Delegates to the payment gateway to initialize a provider-specific session\n */\n create: (\n orderId: string,\n params: CreatePaymentSessionParams,\n options?: RequestOptions\n ): Promise<StorePaymentSession> =>\n this.request<StorePaymentSession>(\n 'POST',\n `/orders/${orderId}/payment_sessions`,\n { ...options, body: params }\n ),\n\n /**\n * Get a payment session by ID\n */\n get: (\n orderId: string,\n sessionId: string,\n options?: RequestOptions\n ): Promise<StorePaymentSession> =>\n this.request<StorePaymentSession>(\n 'GET',\n `/orders/${orderId}/payment_sessions/${sessionId}`,\n options\n ),\n\n /**\n * Update a payment session\n * Delegates to the payment gateway to sync changes with the provider\n */\n update: (\n orderId: string,\n sessionId: string,\n params: UpdatePaymentSessionParams,\n options?: RequestOptions\n ): Promise<StorePaymentSession> =>\n this.request<StorePaymentSession>(\n 'PATCH',\n `/orders/${orderId}/payment_sessions/${sessionId}`,\n { ...options, body: params }\n ),\n\n /**\n * Complete a payment session\n * Confirms the payment with the provider, triggering capture/authorization\n */\n complete: (\n orderId: string,\n sessionId: string,\n params?: CompletePaymentSessionParams,\n options?: RequestOptions\n ): Promise<StorePaymentSession> =>\n this.request<StorePaymentSession>(\n 'PATCH',\n `/orders/${orderId}/payment_sessions/${sessionId}/complete`,\n { ...options, body: params }\n ),\n },\n\n /**\n * Nested resource: Coupon codes\n */\n couponCodes: {\n /**\n * Apply a coupon code to an order\n */\n apply: (\n orderId: string,\n code: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('POST', `/orders/${orderId}/coupon_codes`, {\n ...options,\n body: { code },\n }),\n\n /**\n * Remove a coupon code from an order\n * @param promotionId - The promotion prefix_id (e.g., 'promo_xxx')\n */\n remove: (\n orderId: string,\n promotionId: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'DELETE',\n `/orders/${orderId}/coupon_codes/${promotionId}`,\n options\n ),\n },\n\n /**\n * Nested resource: Shipments\n */\n shipments: {\n /**\n * List shipments for an order\n */\n list: (\n orderId: string,\n options?: RequestOptions\n ): Promise<{ data: StoreShipment[] }> =>\n this.request<{ data: StoreShipment[] }>(\n 'GET',\n `/orders/${orderId}/shipments`,\n options\n ),\n\n /**\n * Select a shipping rate for a shipment.\n * Returns the updated order with recalculated totals.\n */\n update: (\n orderId: string,\n shipmentId: string,\n params: { selected_shipping_rate_id: string },\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'PATCH',\n `/orders/${orderId}/shipments/${shipmentId}`,\n { ...options, body: params }\n ),\n },\n };\n\n // ============================================\n // Customer\n // ============================================\n\n readonly customer = {\n /**\n * Get current customer profile\n */\n get: (options?: RequestOptions): Promise<StoreCustomer> =>\n this.request<StoreCustomer>('GET', '/customer', options),\n\n /**\n * Update current customer profile\n */\n update: (\n params: {\n first_name?: string\n last_name?: string\n email?: string\n password?: string\n password_confirmation?: string\n accepts_email_marketing?: boolean\n phone?: string\n },\n options?: RequestOptions\n ): Promise<StoreCustomer> =>\n this.request<StoreCustomer>('PATCH', '/customer', {\n ...options,\n body: params,\n }),\n\n /**\n * Nested resource: Addresses\n */\n addresses: {\n /**\n * List customer addresses\n */\n list: (\n params?: ListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreAddress>> =>\n this.request<PaginatedResponse<StoreAddress>>(\n 'GET',\n '/customer/addresses',\n { ...options, params: params as Record<string, string | number | undefined> }\n ),\n\n /**\n * Get an address by ID\n */\n get: (id: string, options?: RequestOptions): Promise<StoreAddress> =>\n this.request<StoreAddress>('GET', `/customer/addresses/${id}`, options),\n\n /**\n * Create an address\n */\n create: (\n params: AddressParams,\n options?: RequestOptions\n ): Promise<StoreAddress> =>\n this.request<StoreAddress>('POST', '/customer/addresses', {\n ...options,\n body: params,\n }),\n\n /**\n * Update an address\n */\n update: (\n id: string,\n params: Partial<AddressParams>,\n options?: RequestOptions\n ): Promise<StoreAddress> =>\n this.request<StoreAddress>('PATCH', `/customer/addresses/${id}`, {\n ...options,\n body: params,\n }),\n\n /**\n * Delete an address\n */\n delete: (id: string, options?: RequestOptions): Promise<void> =>\n this.request<void>('DELETE', `/customer/addresses/${id}`, options),\n\n /**\n * Mark an address as default billing or shipping\n */\n markAsDefault: (\n id: string,\n kind: 'billing' | 'shipping',\n options?: RequestOptions\n ): Promise<StoreAddress> =>\n this.request<StoreAddress>('PATCH', `/customer/addresses/${id}/mark_as_default`, {\n ...options,\n body: { kind },\n }),\n },\n\n /**\n * Nested resource: Credit Cards\n */\n creditCards: {\n /**\n * List customer credit cards\n */\n list: (\n params?: ListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreCreditCard>> =>\n this.request<PaginatedResponse<StoreCreditCard>>(\n 'GET',\n '/customer/credit_cards',\n { ...options, params: params as Record<string, string | number | undefined> }\n ),\n\n /**\n * Get a credit card by ID\n */\n get: (id: string, options?: RequestOptions): Promise<StoreCreditCard> =>\n this.request<StoreCreditCard>('GET', `/customer/credit_cards/${id}`, options),\n\n /**\n * Delete a credit card\n */\n delete: (id: string, options?: RequestOptions): Promise<void> =>\n this.request<void>('DELETE', `/customer/credit_cards/${id}`, options),\n },\n\n /**\n * Nested resource: Gift Cards\n */\n giftCards: {\n /**\n * List customer gift cards\n * Returns gift cards associated with the current user, ordered by newest first\n */\n list: (\n params?: ListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreGiftCard>> =>\n this.request<PaginatedResponse<StoreGiftCard>>(\n 'GET',\n '/customer/gift_cards',\n { ...options, params: params as Record<string, string | number | undefined> }\n ),\n\n /**\n * Get a gift card by ID\n */\n get: (id: string, options?: RequestOptions): Promise<StoreGiftCard> =>\n this.request<StoreGiftCard>('GET', `/customer/gift_cards/${id}`, options),\n },\n\n /**\n * Nested resource: Orders (customer order history)\n */\n orders: {\n /**\n * List orders for the authenticated customer\n */\n list: (\n params?: OrderListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreOrder>> =>\n this.request<PaginatedResponse<StoreOrder>>('GET', '/customer/orders', {\n ...options,\n params: params ? transformListParams(params) : undefined,\n }),\n },\n\n /**\n * Nested resource: Payment Setup Sessions (save payment methods for future use)\n */\n paymentSetupSessions: {\n /**\n * Create a payment setup session\n * Delegates to the payment gateway to initialize a setup flow for saving a payment method\n */\n create: (\n params: CreatePaymentSetupSessionParams,\n options?: RequestOptions\n ): Promise<StorePaymentSetupSession> =>\n this.request<StorePaymentSetupSession>(\n 'POST',\n '/customer/payment_setup_sessions',\n { ...options, body: params }\n ),\n\n /**\n * Get a payment setup session by ID\n */\n get: (id: string, options?: RequestOptions): Promise<StorePaymentSetupSession> =>\n this.request<StorePaymentSetupSession>('GET', `/customer/payment_setup_sessions/${id}`, options),\n\n /**\n * Complete a payment setup session\n * Confirms the setup with the provider, resulting in a saved payment method\n */\n complete: (\n id: string,\n params?: CompletePaymentSetupSessionParams,\n options?: RequestOptions\n ): Promise<StorePaymentSetupSession> =>\n this.request<StorePaymentSetupSession>(\n 'PATCH',\n `/customer/payment_setup_sessions/${id}/complete`,\n { ...options, body: params }\n ),\n },\n };\n\n // ============================================\n // Wishlists\n // ============================================\n\n readonly wishlists = {\n /**\n * List wishlists\n */\n list: (\n params?: ListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreWishlist>> =>\n this.request<PaginatedResponse<StoreWishlist>>('GET', '/wishlists', {\n ...options,\n params: params as Record<string, string | number | undefined>,\n }),\n\n /**\n * Get a wishlist by ID\n */\n get: (\n id: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreWishlist> =>\n this.request<StoreWishlist>('GET', `/wishlists/${id}`, {\n ...options,\n params: expandParams(params),\n }),\n\n /**\n * Create a wishlist\n */\n create: (\n params: { name: string; is_private?: boolean; is_default?: boolean },\n options?: RequestOptions\n ): Promise<StoreWishlist> =>\n this.request<StoreWishlist>('POST', '/wishlists', {\n ...options,\n body: params,\n }),\n\n /**\n * Update a wishlist\n */\n update: (\n id: string,\n params: { name?: string; is_private?: boolean; is_default?: boolean },\n options?: RequestOptions\n ): Promise<StoreWishlist> =>\n this.request<StoreWishlist>('PATCH', `/wishlists/${id}`, {\n ...options,\n body: params,\n }),\n\n /**\n * Delete a wishlist\n */\n delete: (id: string, options?: RequestOptions): Promise<void> =>\n this.request<void>('DELETE', `/wishlists/${id}`, options),\n\n /**\n * Nested resource: Wishlist items\n */\n items: {\n /**\n * Add an item to a wishlist\n */\n create: (\n wishlistId: string,\n params: { variant_id: string; quantity?: number },\n options?: RequestOptions\n ): Promise<StoreWishedItem> =>\n this.request<StoreWishedItem>('POST', `/wishlists/${wishlistId}/items`, {\n ...options,\n body: params,\n }),\n\n /**\n * Update a wishlist item\n */\n update: (\n wishlistId: string,\n itemId: string,\n params: { quantity: number },\n options?: RequestOptions\n ): Promise<StoreWishedItem> =>\n this.request<StoreWishedItem>(\n 'PATCH',\n `/wishlists/${wishlistId}/items/${itemId}`,\n { ...options, body: params }\n ),\n\n /**\n * Remove an item from a wishlist\n */\n delete: (\n wishlistId: string,\n itemId: string,\n options?: RequestOptions\n ): Promise<void> =>\n this.request<void>(\n 'DELETE',\n `/wishlists/${wishlistId}/items/${itemId}`,\n options\n ),\n },\n };\n}\n","import type { RequestFn } from './request';\n\nexport class AdminClient {\n /** @internal */\n private readonly request: RequestFn;\n\n constructor(request: RequestFn) {\n this.request = request;\n\n // Prevent \"unused\" TS error — will be used as admin endpoints are added\n void this.request;\n }\n}\n","import { createRequestFn } from './request';\nimport type { RetryConfig, RequestConfig } from './request';\nimport type { LocaleDefaults } from './types';\nimport { StoreClient } from './store-client';\nimport { AdminClient } from './admin-client';\n\n// Re-export types for convenience\nexport type { AddressParams, StoreCreditCard, LocaleDefaults } from './types';\n\nexport interface SpreeClientConfig {\n /** Base URL of the Spree API (e.g., 'https://api.mystore.com') */\n baseUrl: string;\n /** Publishable API key for Store API access */\n publishableKey: string;\n /** Secret API key for Admin API access (optional) */\n secretKey?: string;\n /** Custom fetch implementation (optional, defaults to global fetch) */\n fetch?: typeof fetch;\n /** Retry configuration. Enabled by default. Pass false to disable. */\n retry?: RetryConfig | false;\n /** Default locale for API requests (e.g., 'fr') */\n locale?: string;\n /** Default currency for API requests (e.g., 'EUR') */\n currency?: string;\n /** Default country ISO code for market resolution (e.g., 'FR') */\n country?: string;\n}\n\nexport class SpreeClient {\n /** Store API — customer-facing endpoints (products, cart, checkout, account) */\n readonly store: StoreClient;\n /** Admin API — administrative endpoints (manage orders, products, settings) */\n readonly admin: AdminClient;\n\n private readonly _defaults: LocaleDefaults;\n\n constructor(config: SpreeClientConfig) {\n const baseUrl = config.baseUrl.replace(/\\/$/, '');\n // Bind fetch to globalThis to avoid \"Illegal invocation\" errors in browsers\n const fetchFn = config.fetch || fetch.bind(globalThis);\n\n this._defaults = {\n locale: config.locale,\n currency: config.currency,\n country: config.country,\n };\n\n let retryConfig: Required<RetryConfig> | false;\n if (config.retry === false) {\n retryConfig = false;\n } else {\n retryConfig = {\n maxRetries: config.retry?.maxRetries ?? 2,\n retryOnStatus: config.retry?.retryOnStatus ?? [429, 500, 502, 503, 504],\n baseDelay: config.retry?.baseDelay ?? 300,\n maxDelay: config.retry?.maxDelay ?? 10000,\n retryOnNetworkError: config.retry?.retryOnNetworkError ?? true,\n };\n }\n\n const requestConfig: RequestConfig = { baseUrl, fetchFn, retryConfig };\n\n const storeRequestFn = createRequestFn(\n requestConfig,\n '/api/v3/store',\n { headerName: 'x-spree-api-key', headerValue: config.publishableKey },\n this._defaults\n );\n\n const adminRequestFn = createRequestFn(\n requestConfig,\n '/api/v3/admin',\n {\n headerName: 'Authorization',\n headerValue: config.secretKey ? `Bearer ${config.secretKey}` : '',\n },\n this._defaults\n );\n\n this.store = new StoreClient(storeRequestFn);\n this.admin = new AdminClient(adminRequestFn);\n }\n\n /** Set default locale for all subsequent requests */\n setLocale(locale: string): void {\n this._defaults.locale = locale;\n }\n\n /** Set default currency for all subsequent requests */\n setCurrency(currency: string): void {\n this._defaults.currency = currency;\n }\n\n /** Set default country for all subsequent requests */\n setCountry(country: string): void {\n this._defaults.country = country;\n }\n}\n\n/**\n * Create a new Spree SDK client\n */\nexport function createSpreeClient(config: SpreeClientConfig): SpreeClient {\n return new SpreeClient(config);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/request.ts","../src/params.ts","../src/store-client.ts","../src/admin-client.ts","../src/client.ts"],"names":[],"mappings":";AAqCO,IAAM,UAAA,GAAN,cAAyB,KAAA,CAAM;AAAA,EACpB,IAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EAEhB,WAAA,CAAY,UAAyB,MAAA,EAAgB;AACnD,IAAA,KAAA,CAAM,QAAA,CAAS,MAAM,OAAO,CAAA;AAC5B,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,SAAS,KAAA,CAAM,IAAA;AAC3B,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,OAAA,GAAU,SAAS,KAAA,CAAM,OAAA;AAAA,EAChC;AACF;AAQA,SAAS,cAAA,CAAe,SAAiB,MAAA,EAAuC;AAC9E,EAAA,MAAM,mBAAmB,MAAA,CAAO,SAAA,GAAY,IAAA,CAAK,GAAA,CAAI,GAAG,OAAO,CAAA;AAC/D,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,MAAA,EAAO,GAAI,MAAA,CAAO,SAAA;AACtC,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,gBAAA,GAAmB,MAAA,EAAQ,OAAO,QAAQ,CAAA;AAC5D;AAEA,SAAS,MAAM,EAAA,EAA2B;AACxC,EAAA,OAAO,IAAI,OAAA,CAAQ,CAA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,MACA,MAAA,CAAO,cAAA,GACH,EAAE,UAAA,EAAY,iBAAA,EAAmB,WAAA,EAAa,MAAA,CAAO,cAAA,EAAe,GACpE,EAAE,UAAA,EAAY,EAAA,EAAI,aAAa,EAAA,EAAG;AAAA,MACtC,IAAA,CAAK;AAAA,KACP;AAEA,IAAA,MAAM,cAAA,GAAiB,eAAA;AAAA,MACrB,aAAA;AAAA,MACA,eAAA;AAAA,MACA;AAAA,QACE,UAAA,EAAY,eAAA;AAAA,QACZ,aAAa,MAAA,CAAO,SAAA,GAAY,CAAA,OAAA,EAAU,MAAA,CAAO,SAAS,CAAA,CAAA,GAAK;AAAA,OACjE;AAAA,MACA,IAAA,CAAK;AAAA,KACP;AAEA,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,WAAA,CAAY,cAAc,CAAA;AAC3C,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,WAAA,CAAY,cAAc,CAAA;AAAA,EAC7C;AAAA;AAAA,EAGA,UAAU,MAAA,EAAsB;AAC9B,IAAA,IAAA,CAAK,UAAU,MAAA,GAAS,MAAA;AAAA,EAC1B;AAAA;AAAA,EAGA,YAAY,QAAA,EAAwB;AAClC,IAAA,IAAA,CAAK,UAAU,QAAA,GAAW,QAAA;AAAA,EAC5B;AAAA;AAAA,EAGA,WAAW,OAAA,EAAuB;AAChC,IAAA,IAAA,CAAK,UAAU,OAAA,GAAU,OAAA;AAAA,EAC3B;AACF;AAKO,SAAS,kBAAkB,MAAA,EAAwC;AACxE,EAAA,OAAO,IAAI,YAAY,MAAM,CAAA;AAC/B","file":"index.js","sourcesContent":["import type { ErrorResponse, LocaleDefaults } from './types';\n\nexport interface RetryConfig {\n /** Maximum number of retries (default: 2) */\n maxRetries?: number;\n /** HTTP status codes to retry on (default: [429, 500, 502, 503, 504]) */\n retryOnStatus?: number[];\n /** Base delay in ms for exponential backoff (default: 300) */\n baseDelay?: number;\n /** Maximum delay in ms (default: 10000) */\n maxDelay?: number;\n /** Whether to retry on network errors (default: true) */\n retryOnNetworkError?: boolean;\n}\n\nexport interface RequestOptions {\n /** Bearer token for authenticated requests */\n token?: string;\n /** Order token for guest checkout */\n orderToken?: string;\n /** Locale for translated content (e.g., 'en', 'fr') */\n locale?: string;\n /** Currency for prices (e.g., 'USD', 'EUR') */\n currency?: string;\n /** Country ISO code for market resolution (e.g., 'US', 'DE') */\n country?: string;\n /** Idempotency key for safe retries of mutating requests (max 255 characters) */\n idempotencyKey?: string;\n /** Custom headers */\n headers?: Record<string, string>;\n}\n\nexport interface InternalRequestOptions extends RequestOptions {\n body?: unknown;\n params?: Record<string, string | number | boolean | (string | number)[] | undefined>;\n}\n\nexport class SpreeError extends Error {\n public readonly code: string;\n public readonly status: number;\n public readonly details?: Record<string, string[]>;\n\n constructor(response: ErrorResponse, status: number) {\n super(response.error.message);\n this.name = 'SpreeError';\n this.code = response.error.code;\n this.status = status;\n this.details = response.error.details;\n }\n}\n\nexport type RequestFn = <T>(\n method: string,\n path: string,\n options?: InternalRequestOptions\n) => Promise<T>;\n\nfunction calculateDelay(attempt: number, config: Required<RetryConfig>): number {\n const exponentialDelay = config.baseDelay * Math.pow(2, attempt);\n const jitter = Math.random() * config.baseDelay;\n return Math.min(exponentialDelay + jitter, config.maxDelay);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nfunction generateIdempotencyKey(): string {\n return `spree-sdk-retry-${crypto.randomUUID()}`;\n}\n\nfunction shouldRetryOnStatus(method: string, status: number, config: Required<RetryConfig>, hasIdempotencyKey: boolean): boolean {\n const isIdempotent = method === 'GET' || method === 'HEAD' || hasIdempotencyKey;\n if (isIdempotent) {\n return config.retryOnStatus.includes(status);\n }\n return status === 429;\n}\n\nfunction shouldRetryOnNetworkError(method: string, config: Required<RetryConfig>, hasIdempotencyKey: boolean): boolean {\n if (!config.retryOnNetworkError) return false;\n return method === 'GET' || method === 'HEAD' || hasIdempotencyKey;\n}\n\nexport interface RequestConfig {\n baseUrl: string;\n fetchFn: typeof fetch;\n retryConfig: Required<RetryConfig> | false;\n}\n\nexport interface AuthConfig {\n headerName: string;\n headerValue: string;\n}\n\n/**\n * Creates a bound request function for a specific API scope (store or admin).\n */\nexport function createRequestFn(\n config: RequestConfig,\n basePath: string,\n auth: AuthConfig,\n defaults?: LocaleDefaults\n): RequestFn {\n return async function request<T>(\n method: string,\n path: string,\n options: InternalRequestOptions = {}\n ): Promise<T> {\n const { token, orderToken, idempotencyKey, headers = {}, body, params } = options;\n\n // Per-request options override client-level defaults\n const locale = options.locale ?? defaults?.locale;\n const currency = options.currency ?? defaults?.currency;\n const country = options.country ?? defaults?.country;\n\n // Build URL with query params\n const url = new URL(`${config.baseUrl}${basePath}${path}`);\n if (params) {\n Object.entries(params).forEach(([key, value]) => {\n if (value !== undefined) {\n if (Array.isArray(value)) {\n value.forEach((v) => url.searchParams.append(key, String(v)));\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n });\n }\n // Build headers\n const requestHeaders: Record<string, string> = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n if (auth.headerName && auth.headerValue) {\n requestHeaders[auth.headerName] = auth.headerValue;\n }\n\n if (token) {\n requestHeaders['Authorization'] = `Bearer ${token}`;\n }\n\n if (orderToken) {\n requestHeaders['x-spree-order-token'] = orderToken;\n }\n\n if (locale) {\n requestHeaders['x-spree-locale'] = locale;\n }\n\n if (currency) {\n requestHeaders['x-spree-currency'] = currency;\n }\n\n if (country) {\n requestHeaders['x-spree-country'] = country;\n }\n\n // Auto-generate idempotency key for mutating requests when retries are enabled (Stripe-style).\n // User-supplied keys take precedence over auto-generated ones.\n const isMutating = method !== 'GET' && method !== 'HEAD';\n const effectiveIdempotencyKey = idempotencyKey ?? (isMutating && config.retryConfig ? generateIdempotencyKey() : undefined);\n\n if (effectiveIdempotencyKey) {\n requestHeaders['Idempotency-Key'] = effectiveIdempotencyKey;\n }\n\n const hasIdempotencyKey = !!effectiveIdempotencyKey;\n const maxAttempts = config.retryConfig ? config.retryConfig.maxRetries + 1 : 1;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n try {\n const response = await config.fetchFn(url.toString(), {\n method,\n headers: requestHeaders,\n body: body ? JSON.stringify(body) : undefined,\n });\n\n if (!response.ok) {\n const isLastAttempt = attempt >= maxAttempts - 1;\n\n if (!isLastAttempt && config.retryConfig && shouldRetryOnStatus(method, response.status, config.retryConfig, hasIdempotencyKey)) {\n const retryAfter = response.headers.get('Retry-After');\n const delay = retryAfter\n ? Math.min(parseInt(retryAfter, 10) * 1000, config.retryConfig.maxDelay)\n : calculateDelay(attempt, config.retryConfig);\n await sleep(delay);\n continue;\n }\n\n const errorBody = await response.json() as ErrorResponse;\n throw new SpreeError(errorBody, response.status);\n }\n\n // Handle 204 No Content\n if (response.status === 204) {\n return undefined as T;\n }\n\n return response.json() as Promise<T>;\n } catch (error) {\n if (error instanceof SpreeError) {\n throw error;\n }\n\n const isLastAttempt = attempt >= maxAttempts - 1;\n\n if (!isLastAttempt && config.retryConfig && shouldRetryOnNetworkError(method, config.retryConfig, hasIdempotencyKey)) {\n const delay = calculateDelay(attempt, config.retryConfig);\n await sleep(delay);\n continue;\n }\n\n throw error;\n }\n }\n\n // This should never be reached, but TypeScript needs it\n throw new Error('Unexpected end of retry loop');\n };\n}\n","/**\n * Keys that are passed through to the API without wrapping in q[...].\n */\nconst PASSTHROUGH_KEYS = new Set(['page', 'limit', 'expand', 'sort']);\n\ntype ParamValue = string | number | boolean | (string | number)[] | undefined;\n\n/**\n * Transforms flat SDK params into Ransack-compatible query params.\n *\n * - `page`, `limit`, `expand`, `sort` pass through unchanged\n * - Keys already in `q[...]` format pass through (backward compat)\n * - All other keys are wrapped: `name_cont` → `q[name_cont]`\n */\nexport function transformListParams(\n params: Record<string, unknown>\n): Record<string, ParamValue> {\n const result: Record<string, ParamValue> = {};\n\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined) continue;\n\n if (PASSTHROUGH_KEYS.has(key)) {\n // Join arrays for passthrough keys (e.g., expand: ['variants', 'images'] → 'variants,images')\n result[key] = Array.isArray(value) ? (value as (string | number)[]).join(',') : value as ParamValue;\n continue;\n }\n\n // Backward compat: already-wrapped q[...] keys pass through\n if (key.startsWith('q[')) {\n result[key] = value as ParamValue;\n continue;\n }\n\n // Array values get [] suffix automatically: `foo: [1,2]` → `q[foo][]`\n if (Array.isArray(value)) {\n const base = key.endsWith('[]') ? key.slice(0, -2) : key;\n result[`q[${base}][]`] = value as ParamValue;\n } else {\n result[`q[${key}]`] = value as ParamValue;\n }\n }\n\n return result;\n}\n","import type { RequestFn, RequestOptions } from './request';\nimport { transformListParams } from './params';\n\n/** Join expand array into comma-separated string for the API */\nfunction expandParams(params?: { expand?: string[] }): Record<string, string> | undefined {\n if (!params?.expand?.length) return undefined;\n return { expand: params.expand.join(',') };\n}\nimport type {\n AuthTokens,\n LoginCredentials,\n RegisterParams,\n ListResponse,\n PaginatedResponse,\n ListParams,\n ProductListParams,\n ProductFiltersParams,\n ProductFiltersResponse,\n TaxonListParams,\n OrderListParams,\n CreateCartParams,\n AddLineItemParams,\n UpdateLineItemParams,\n UpdateOrderParams,\n AddressParams,\n CreatePaymentSessionParams,\n UpdatePaymentSessionParams,\n CompletePaymentSessionParams,\n CreatePaymentSetupSessionParams,\n CompletePaymentSetupSessionParams,\n StoreCreditCard,\n StoreGiftCard,\n StoreProduct,\n StoreOrder,\n StoreCountry,\n StoreCurrency,\n StoreLocale,\n StoreMarket,\n StoreTaxonomy,\n StoreTaxon,\n StorePayment,\n StorePaymentMethod,\n StorePaymentSession,\n StorePaymentSetupSession,\n StoreShipment,\n StoreWishlist,\n StoreWishedItem,\n StoreAddress,\n StoreCustomer,\n} from './types';\n\nexport class StoreClient {\n private readonly request: RequestFn;\n\n constructor(request: RequestFn) {\n this.request = request;\n }\n\n // ============================================\n // Authentication\n // ============================================\n\n readonly auth = {\n /**\n * Login with email and password\n */\n login: (credentials: LoginCredentials): Promise<AuthTokens> =>\n this.request<AuthTokens>('POST', '/auth/login', { body: credentials }),\n\n /**\n * Register a new customer account\n */\n register: (params: RegisterParams): Promise<AuthTokens> =>\n this.request<AuthTokens>('POST', '/auth/register', { body: params }),\n\n /**\n * Refresh access token (requires valid Bearer token)\n */\n refresh: (options: RequestOptions): Promise<AuthTokens> =>\n this.request<AuthTokens>('POST', '/auth/refresh', options),\n };\n\n // ============================================\n // Products\n // ============================================\n\n readonly products = {\n /**\n * List products\n */\n list: (\n params?: ProductListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreProduct>> =>\n this.request<PaginatedResponse<StoreProduct>>('GET', '/products', {\n ...options,\n params: transformListParams({ ...params }),\n }),\n\n /**\n * Get a product by ID or slug\n */\n get: (\n idOrSlug: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreProduct> =>\n this.request<StoreProduct>('GET', `/products/${idOrSlug}`, {\n ...options,\n params: expandParams(params),\n }),\n\n /**\n * Get available filters for products\n * Returns filter options (price range, availability, option types, taxons) with counts\n */\n filters: (\n params?: ProductFiltersParams,\n options?: RequestOptions\n ): Promise<ProductFiltersResponse> =>\n this.request<ProductFiltersResponse>('GET', '/products/filters', {\n ...options,\n params: params as Record<string, string | number | undefined>,\n }),\n };\n\n // ============================================\n // Taxonomies & Taxons\n // ============================================\n\n readonly taxonomies = {\n /**\n * List taxonomies\n */\n list: (\n params?: ListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreTaxonomy>> =>\n this.request<PaginatedResponse<StoreTaxonomy>>('GET', '/taxonomies', {\n ...options,\n params: transformListParams({ ...params }),\n }),\n\n /**\n * Get a taxonomy by ID\n */\n get: (\n id: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreTaxonomy> =>\n this.request<StoreTaxonomy>('GET', `/taxonomies/${id}`, {\n ...options,\n params: expandParams(params),\n }),\n };\n\n readonly taxons = {\n /**\n * List taxons\n */\n list: (\n params?: TaxonListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreTaxon>> =>\n this.request<PaginatedResponse<StoreTaxon>>('GET', '/taxons', {\n ...options,\n params: transformListParams({ ...params }),\n }),\n\n /**\n * Get a taxon by ID or permalink\n */\n get: (\n idOrPermalink: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreTaxon> =>\n this.request<StoreTaxon>('GET', `/taxons/${idOrPermalink}`, {\n ...options,\n params: expandParams(params),\n }),\n\n /**\n * Nested resource: Products in a taxon\n */\n products: {\n /**\n * List products in a taxon\n * @param taxonId - Taxon ID (prefix_id) or permalink\n */\n list: (\n taxonId: string,\n params?: ProductListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreProduct>> =>\n this.request<PaginatedResponse<StoreProduct>>(\n 'GET',\n `/taxons/${taxonId}/products`,\n {\n ...options,\n params: transformListParams({ ...params }),\n }\n ),\n },\n };\n\n // ============================================\n // Countries, Currencies & Locales\n // ============================================\n\n readonly countries = {\n /**\n * List countries available in the store\n * Each country includes currency and default_locale derived from its market\n */\n list: (options?: RequestOptions): Promise<ListResponse<StoreCountry>> =>\n this.request<ListResponse<StoreCountry>>('GET', '/countries', options),\n\n /**\n * Get a country by ISO code\n * Use `?expand=states` to expand states for address forms\n * @param iso - ISO 3166-1 alpha-2 code (e.g., \"US\", \"DE\")\n */\n get: (\n iso: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreCountry> =>\n this.request<StoreCountry>('GET', `/countries/${iso}`, {\n ...options,\n params: expandParams(params),\n }),\n };\n\n readonly currencies = {\n /**\n * List currencies supported by the store (derived from markets)\n */\n list: (options?: RequestOptions): Promise<ListResponse<StoreCurrency>> =>\n this.request<ListResponse<StoreCurrency>>('GET', '/currencies', options),\n };\n\n readonly locales = {\n /**\n * List locales supported by the store (derived from markets)\n */\n list: (options?: RequestOptions): Promise<ListResponse<StoreLocale>> =>\n this.request<ListResponse<StoreLocale>>('GET', '/locales', options),\n };\n\n // ============================================\n // Markets\n // ============================================\n\n readonly markets = {\n /**\n * List all markets for the current store\n */\n list: (options?: RequestOptions): Promise<ListResponse<StoreMarket>> =>\n this.request<ListResponse<StoreMarket>>('GET', '/markets', options),\n\n /**\n * Get a market by prefixed ID\n * @param id - Market prefixed ID (e.g., \"mkt_k5nR8xLq\")\n */\n get: (id: string, options?: RequestOptions): Promise<StoreMarket> =>\n this.request<StoreMarket>('GET', `/markets/${id}`, options),\n\n /**\n * Resolve which market applies for a given country\n * @param country - ISO 3166-1 alpha-2 code (e.g., \"DE\", \"US\")\n */\n resolve: (country: string, options?: RequestOptions): Promise<StoreMarket> =>\n this.request<StoreMarket>('GET', '/markets/resolve', {\n ...options,\n params: { country },\n }),\n\n /**\n * Nested resource: Countries in a market\n */\n countries: {\n /**\n * List countries belonging to a market\n * @param marketId - Market prefixed ID\n */\n list: (\n marketId: string,\n options?: RequestOptions\n ): Promise<ListResponse<StoreCountry>> =>\n this.request<ListResponse<StoreCountry>>(\n 'GET',\n `/markets/${marketId}/countries`,\n options\n ),\n\n /**\n * Get a country by ISO code within a market\n * @param marketId - Market prefixed ID\n * @param iso - Country ISO code (e.g., \"DE\")\n */\n get: (\n marketId: string,\n iso: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreCountry> =>\n this.request<StoreCountry>(\n 'GET',\n `/markets/${marketId}/countries/${iso}`,\n { ...options, params: expandParams(params) }\n ),\n },\n };\n\n // ============================================\n // Cart (convenience wrapper for current incomplete order)\n // ============================================\n\n readonly cart = {\n /**\n * Get current cart (returns null if none exists)\n * Pass orderToken for guest checkout, or use JWT for authenticated users\n */\n get: (options?: RequestOptions): Promise<StoreOrder & { token: string }> =>\n this.request<StoreOrder & { token: string }>('GET', '/cart', options),\n\n /**\n * Create a new cart\n * @param params - Optional cart parameters (e.g., metadata)\n */\n create: (params?: CreateCartParams, options?: RequestOptions): Promise<StoreOrder & { token: string }> =>\n this.request<StoreOrder & { token: string }>('POST', '/cart', {\n ...options,\n body: params,\n }),\n\n /**\n * Associate a guest cart with the currently authenticated user\n * Requires both JWT token (for authentication) and orderToken (to identify the cart)\n * @param options - Must include both `token` (JWT) and `orderToken` (guest cart token)\n */\n associate: (options: RequestOptions): Promise<StoreOrder & { token: string }> =>\n this.request<StoreOrder & { token: string }>('PATCH', '/cart/associate', options),\n };\n\n // ============================================\n // Orders (individual order management & checkout)\n // ============================================\n\n readonly orders = {\n /**\n * Get an order by ID or number\n */\n get: (\n idOrNumber: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('GET', `/orders/${idOrNumber}`, {\n ...options,\n params: expandParams(params),\n }),\n\n /**\n * Update an order\n */\n update: (\n idOrNumber: string,\n params: UpdateOrderParams,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('PATCH', `/orders/${idOrNumber}`, {\n ...options,\n body: params,\n }),\n\n /**\n * Advance order to next checkout step\n */\n next: (\n idOrNumber: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('PATCH', `/orders/${idOrNumber}/next`, options),\n\n /**\n * Advance through all checkout steps\n */\n advance: (\n idOrNumber: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'PATCH',\n `/orders/${idOrNumber}/advance`,\n options\n ),\n\n /**\n * Complete the order\n */\n complete: (\n idOrNumber: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'PATCH',\n `/orders/${idOrNumber}/complete`,\n options\n ),\n\n /**\n * Add store credit to order\n */\n addStoreCredit: (\n idOrNumber: string,\n amount?: number,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('POST', `/orders/${idOrNumber}/store_credits`, {\n ...options,\n body: amount ? { amount } : undefined,\n }),\n\n /**\n * Remove store credit from order\n */\n removeStoreCredit: (\n idOrNumber: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'DELETE',\n `/orders/${idOrNumber}/store_credits`,\n options\n ),\n\n /**\n * Nested resource: Line items\n */\n lineItems: {\n /**\n * Add a line item to an order.\n * Returns the updated order with recalculated totals.\n */\n create: (\n orderId: string,\n params: AddLineItemParams,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('POST', `/orders/${orderId}/line_items`, {\n ...options,\n body: params,\n }),\n\n /**\n * Update a line item quantity.\n * Returns the updated order with recalculated totals.\n */\n update: (\n orderId: string,\n lineItemId: string,\n params: UpdateLineItemParams,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'PATCH',\n `/orders/${orderId}/line_items/${lineItemId}`,\n { ...options, body: params }\n ),\n\n /**\n * Remove a line item from an order.\n * Returns the updated order with recalculated totals.\n */\n delete: (\n orderId: string,\n lineItemId: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'DELETE',\n `/orders/${orderId}/line_items/${lineItemId}`,\n options\n ),\n },\n\n /**\n * Nested resource: Payments\n */\n payments: {\n /**\n * List payments for an order\n */\n list: (\n orderId: string,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StorePayment>> =>\n this.request<PaginatedResponse<StorePayment>>(\n 'GET',\n `/orders/${orderId}/payments`,\n options\n ),\n\n /**\n * Get a payment by ID\n */\n get: (\n orderId: string,\n paymentId: string,\n options?: RequestOptions\n ): Promise<StorePayment> =>\n this.request<StorePayment>(\n 'GET',\n `/orders/${orderId}/payments/${paymentId}`,\n options\n ),\n },\n\n /**\n * Nested resource: Payment methods\n */\n paymentMethods: {\n /**\n * List available payment methods for an order\n */\n list: (\n orderId: string,\n options?: RequestOptions\n ): Promise<ListResponse<StorePaymentMethod>> =>\n this.request<ListResponse<StorePaymentMethod>>(\n 'GET',\n `/orders/${orderId}/payment_methods`,\n options\n ),\n },\n\n /**\n * Nested resource: Payment sessions\n */\n paymentSessions: {\n /**\n * Create a payment session for an order\n * Delegates to the payment gateway to initialize a provider-specific session\n */\n create: (\n orderId: string,\n params: CreatePaymentSessionParams,\n options?: RequestOptions\n ): Promise<StorePaymentSession> =>\n this.request<StorePaymentSession>(\n 'POST',\n `/orders/${orderId}/payment_sessions`,\n { ...options, body: params }\n ),\n\n /**\n * Get a payment session by ID\n */\n get: (\n orderId: string,\n sessionId: string,\n options?: RequestOptions\n ): Promise<StorePaymentSession> =>\n this.request<StorePaymentSession>(\n 'GET',\n `/orders/${orderId}/payment_sessions/${sessionId}`,\n options\n ),\n\n /**\n * Update a payment session\n * Delegates to the payment gateway to sync changes with the provider\n */\n update: (\n orderId: string,\n sessionId: string,\n params: UpdatePaymentSessionParams,\n options?: RequestOptions\n ): Promise<StorePaymentSession> =>\n this.request<StorePaymentSession>(\n 'PATCH',\n `/orders/${orderId}/payment_sessions/${sessionId}`,\n { ...options, body: params }\n ),\n\n /**\n * Complete a payment session\n * Confirms the payment with the provider, triggering capture/authorization\n */\n complete: (\n orderId: string,\n sessionId: string,\n params?: CompletePaymentSessionParams,\n options?: RequestOptions\n ): Promise<StorePaymentSession> =>\n this.request<StorePaymentSession>(\n 'PATCH',\n `/orders/${orderId}/payment_sessions/${sessionId}/complete`,\n { ...options, body: params }\n ),\n },\n\n /**\n * Nested resource: Coupon codes\n */\n couponCodes: {\n /**\n * Apply a coupon code to an order\n */\n apply: (\n orderId: string,\n code: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>('POST', `/orders/${orderId}/coupon_codes`, {\n ...options,\n body: { code },\n }),\n\n /**\n * Remove a coupon code from an order\n * @param promotionId - The promotion prefix_id (e.g., 'promo_xxx')\n */\n remove: (\n orderId: string,\n promotionId: string,\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'DELETE',\n `/orders/${orderId}/coupon_codes/${promotionId}`,\n options\n ),\n },\n\n /**\n * Nested resource: Shipments\n */\n shipments: {\n /**\n * List shipments for an order\n */\n list: (\n orderId: string,\n options?: RequestOptions\n ): Promise<ListResponse<StoreShipment>> =>\n this.request<ListResponse<StoreShipment>>(\n 'GET',\n `/orders/${orderId}/shipments`,\n options\n ),\n\n /**\n * Select a shipping rate for a shipment.\n * Returns the updated order with recalculated totals.\n */\n update: (\n orderId: string,\n shipmentId: string,\n params: { selected_shipping_rate_id: string },\n options?: RequestOptions\n ): Promise<StoreOrder> =>\n this.request<StoreOrder>(\n 'PATCH',\n `/orders/${orderId}/shipments/${shipmentId}`,\n { ...options, body: params }\n ),\n },\n };\n\n // ============================================\n // Customer\n // ============================================\n\n readonly customer = {\n /**\n * Get current customer profile\n */\n get: (options?: RequestOptions): Promise<StoreCustomer> =>\n this.request<StoreCustomer>('GET', '/customer', options),\n\n /**\n * Update current customer profile\n */\n update: (\n params: {\n first_name?: string\n last_name?: string\n email?: string\n password?: string\n password_confirmation?: string\n accepts_email_marketing?: boolean\n phone?: string\n },\n options?: RequestOptions\n ): Promise<StoreCustomer> =>\n this.request<StoreCustomer>('PATCH', '/customer', {\n ...options,\n body: params,\n }),\n\n /**\n * Nested resource: Addresses\n */\n addresses: {\n /**\n * List customer addresses\n */\n list: (\n params?: ListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreAddress>> =>\n this.request<PaginatedResponse<StoreAddress>>(\n 'GET',\n '/customer/addresses',\n { ...options, params: transformListParams({ ...params }) }\n ),\n\n /**\n * Get an address by ID\n */\n get: (id: string, options?: RequestOptions): Promise<StoreAddress> =>\n this.request<StoreAddress>('GET', `/customer/addresses/${id}`, options),\n\n /**\n * Create an address\n */\n create: (\n params: AddressParams,\n options?: RequestOptions\n ): Promise<StoreAddress> =>\n this.request<StoreAddress>('POST', '/customer/addresses', {\n ...options,\n body: params,\n }),\n\n /**\n * Update an address\n */\n update: (\n id: string,\n params: Partial<AddressParams>,\n options?: RequestOptions\n ): Promise<StoreAddress> =>\n this.request<StoreAddress>('PATCH', `/customer/addresses/${id}`, {\n ...options,\n body: params,\n }),\n\n /**\n * Delete an address\n */\n delete: (id: string, options?: RequestOptions): Promise<void> =>\n this.request<void>('DELETE', `/customer/addresses/${id}`, options),\n\n /**\n * Mark an address as default billing or shipping\n */\n markAsDefault: (\n id: string,\n kind: 'billing' | 'shipping',\n options?: RequestOptions\n ): Promise<StoreAddress> =>\n this.request<StoreAddress>('PATCH', `/customer/addresses/${id}/mark_as_default`, {\n ...options,\n body: { kind },\n }),\n },\n\n /**\n * Nested resource: Credit Cards\n */\n creditCards: {\n /**\n * List customer credit cards\n */\n list: (\n params?: ListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreCreditCard>> =>\n this.request<PaginatedResponse<StoreCreditCard>>(\n 'GET',\n '/customer/credit_cards',\n { ...options, params: transformListParams({ ...params }) }\n ),\n\n /**\n * Get a credit card by ID\n */\n get: (id: string, options?: RequestOptions): Promise<StoreCreditCard> =>\n this.request<StoreCreditCard>('GET', `/customer/credit_cards/${id}`, options),\n\n /**\n * Delete a credit card\n */\n delete: (id: string, options?: RequestOptions): Promise<void> =>\n this.request<void>('DELETE', `/customer/credit_cards/${id}`, options),\n },\n\n /**\n * Nested resource: Gift Cards\n */\n giftCards: {\n /**\n * List customer gift cards\n * Returns gift cards associated with the current user, ordered by newest first\n */\n list: (\n params?: ListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreGiftCard>> =>\n this.request<PaginatedResponse<StoreGiftCard>>(\n 'GET',\n '/customer/gift_cards',\n { ...options, params: transformListParams({ ...params }) }\n ),\n\n /**\n * Get a gift card by ID\n */\n get: (id: string, options?: RequestOptions): Promise<StoreGiftCard> =>\n this.request<StoreGiftCard>('GET', `/customer/gift_cards/${id}`, options),\n },\n\n /**\n * Nested resource: Orders (customer order history)\n */\n orders: {\n /**\n * List orders for the authenticated customer\n */\n list: (\n params?: OrderListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreOrder>> =>\n this.request<PaginatedResponse<StoreOrder>>('GET', '/customer/orders', {\n ...options,\n params: transformListParams({ ...params }),\n }),\n },\n\n /**\n * Nested resource: Payment Setup Sessions (save payment methods for future use)\n */\n paymentSetupSessions: {\n /**\n * Create a payment setup session\n * Delegates to the payment gateway to initialize a setup flow for saving a payment method\n */\n create: (\n params: CreatePaymentSetupSessionParams,\n options?: RequestOptions\n ): Promise<StorePaymentSetupSession> =>\n this.request<StorePaymentSetupSession>(\n 'POST',\n '/customer/payment_setup_sessions',\n { ...options, body: params }\n ),\n\n /**\n * Get a payment setup session by ID\n */\n get: (id: string, options?: RequestOptions): Promise<StorePaymentSetupSession> =>\n this.request<StorePaymentSetupSession>('GET', `/customer/payment_setup_sessions/${id}`, options),\n\n /**\n * Complete a payment setup session\n * Confirms the setup with the provider, resulting in a saved payment method\n */\n complete: (\n id: string,\n params?: CompletePaymentSetupSessionParams,\n options?: RequestOptions\n ): Promise<StorePaymentSetupSession> =>\n this.request<StorePaymentSetupSession>(\n 'PATCH',\n `/customer/payment_setup_sessions/${id}/complete`,\n { ...options, body: params }\n ),\n },\n };\n\n // ============================================\n // Wishlists\n // ============================================\n\n readonly wishlists = {\n /**\n * List wishlists\n */\n list: (\n params?: ListParams,\n options?: RequestOptions\n ): Promise<PaginatedResponse<StoreWishlist>> =>\n this.request<PaginatedResponse<StoreWishlist>>('GET', '/wishlists', {\n ...options,\n params: transformListParams({ ...params }),\n }),\n\n /**\n * Get a wishlist by ID\n */\n get: (\n id: string,\n params?: { expand?: string[] },\n options?: RequestOptions\n ): Promise<StoreWishlist> =>\n this.request<StoreWishlist>('GET', `/wishlists/${id}`, {\n ...options,\n params: expandParams(params),\n }),\n\n /**\n * Create a wishlist\n */\n create: (\n params: { name: string; is_private?: boolean; is_default?: boolean },\n options?: RequestOptions\n ): Promise<StoreWishlist> =>\n this.request<StoreWishlist>('POST', '/wishlists', {\n ...options,\n body: params,\n }),\n\n /**\n * Update a wishlist\n */\n update: (\n id: string,\n params: { name?: string; is_private?: boolean; is_default?: boolean },\n options?: RequestOptions\n ): Promise<StoreWishlist> =>\n this.request<StoreWishlist>('PATCH', `/wishlists/${id}`, {\n ...options,\n body: params,\n }),\n\n /**\n * Delete a wishlist\n */\n delete: (id: string, options?: RequestOptions): Promise<void> =>\n this.request<void>('DELETE', `/wishlists/${id}`, options),\n\n /**\n * Nested resource: Wishlist items\n */\n items: {\n /**\n * Add an item to a wishlist\n */\n create: (\n wishlistId: string,\n params: { variant_id: string; quantity?: number },\n options?: RequestOptions\n ): Promise<StoreWishedItem> =>\n this.request<StoreWishedItem>('POST', `/wishlists/${wishlistId}/items`, {\n ...options,\n body: params,\n }),\n\n /**\n * Update a wishlist item\n */\n update: (\n wishlistId: string,\n itemId: string,\n params: { quantity: number },\n options?: RequestOptions\n ): Promise<StoreWishedItem> =>\n this.request<StoreWishedItem>(\n 'PATCH',\n `/wishlists/${wishlistId}/items/${itemId}`,\n { ...options, body: params }\n ),\n\n /**\n * Remove an item from a wishlist\n */\n delete: (\n wishlistId: string,\n itemId: string,\n options?: RequestOptions\n ): Promise<void> =>\n this.request<void>(\n 'DELETE',\n `/wishlists/${wishlistId}/items/${itemId}`,\n options\n ),\n },\n };\n}\n","import type { RequestFn } from './request';\n\nexport class AdminClient {\n /** @internal */\n private readonly request: RequestFn;\n\n constructor(request: RequestFn) {\n this.request = request;\n\n // Prevent \"unused\" TS error — will be used as admin endpoints are added\n void this.request;\n }\n}\n","import { createRequestFn } from './request';\nimport type { RetryConfig, RequestConfig } from './request';\nimport type { LocaleDefaults } from './types';\nimport { StoreClient } from './store-client';\nimport { AdminClient } from './admin-client';\n\n// Re-export types for convenience\nexport type { AddressParams, StoreCreditCard, LocaleDefaults } from './types';\n\nexport interface SpreeClientConfig {\n /** Base URL of the Spree API (e.g., 'https://api.mystore.com') */\n baseUrl: string;\n /** Publishable API key for Store API access (required for Store API) */\n publishableKey?: string;\n /** Secret API key for Admin API access (optional) */\n secretKey?: string;\n /** Custom fetch implementation (optional, defaults to global fetch) */\n fetch?: typeof fetch;\n /** Retry configuration. Enabled by default. Pass false to disable. */\n retry?: RetryConfig | false;\n /** Default locale for API requests (e.g., 'fr') */\n locale?: string;\n /** Default currency for API requests (e.g., 'EUR') */\n currency?: string;\n /** Default country ISO code for market resolution (e.g., 'FR') */\n country?: string;\n}\n\nexport class SpreeClient {\n /** Store API — customer-facing endpoints (products, cart, checkout, account) */\n readonly store: StoreClient;\n /** Admin API — administrative endpoints (manage orders, products, settings) */\n readonly admin: AdminClient;\n\n private readonly _defaults: LocaleDefaults;\n\n constructor(config: SpreeClientConfig) {\n if (!config.publishableKey && !config.secretKey) {\n throw new Error('SpreeClient requires at least one of publishableKey or secretKey');\n }\n\n const baseUrl = config.baseUrl.replace(/\\/$/, '');\n // Bind fetch to globalThis to avoid \"Illegal invocation\" errors in browsers\n const fetchFn = config.fetch || fetch.bind(globalThis);\n\n this._defaults = {\n locale: config.locale,\n currency: config.currency,\n country: config.country,\n };\n\n let retryConfig: Required<RetryConfig> | false;\n if (config.retry === false) {\n retryConfig = false;\n } else {\n retryConfig = {\n maxRetries: config.retry?.maxRetries ?? 2,\n retryOnStatus: config.retry?.retryOnStatus ?? [429, 500, 502, 503, 504],\n baseDelay: config.retry?.baseDelay ?? 300,\n maxDelay: config.retry?.maxDelay ?? 10000,\n retryOnNetworkError: config.retry?.retryOnNetworkError ?? true,\n };\n }\n\n const requestConfig: RequestConfig = { baseUrl, fetchFn, retryConfig };\n\n const storeRequestFn = createRequestFn(\n requestConfig,\n '/api/v3/store',\n config.publishableKey\n ? { headerName: 'x-spree-api-key', headerValue: config.publishableKey }\n : { headerName: '', headerValue: '' },\n this._defaults\n );\n\n const adminRequestFn = createRequestFn(\n requestConfig,\n '/api/v3/admin',\n {\n headerName: 'Authorization',\n headerValue: config.secretKey ? `Bearer ${config.secretKey}` : '',\n },\n this._defaults\n );\n\n this.store = new StoreClient(storeRequestFn);\n this.admin = new AdminClient(adminRequestFn);\n }\n\n /** Set default locale for all subsequent requests */\n setLocale(locale: string): void {\n this._defaults.locale = locale;\n }\n\n /** Set default currency for all subsequent requests */\n setCurrency(currency: string): void {\n this._defaults.currency = currency;\n }\n\n /** Set default country for all subsequent requests */\n setCountry(country: string): void {\n this._defaults.country = country;\n }\n}\n\n/**\n * Create a new Spree SDK client\n */\nexport function createSpreeClient(config: SpreeClientConfig): SpreeClient {\n return new SpreeClient(config);\n}\n"]}
|
package/dist/types/index.d.cts
CHANGED
|
@@ -182,7 +182,7 @@ type AdminProduct = {
|
|
|
182
182
|
make_active_at: string | null;
|
|
183
183
|
discontinue_on: string | null;
|
|
184
184
|
deleted_at: string | null;
|
|
185
|
-
cost_price:
|
|
185
|
+
cost_price: string | null;
|
|
186
186
|
cost_currency: string | null;
|
|
187
187
|
};
|
|
188
188
|
|
|
@@ -252,9 +252,9 @@ type AdminVariant = {
|
|
|
252
252
|
metafields?: Array<AdminMetafield>;
|
|
253
253
|
position: number;
|
|
254
254
|
tax_category_id: string | null;
|
|
255
|
-
|
|
256
|
-
cost_price: number | null;
|
|
255
|
+
cost_price: string | null;
|
|
257
256
|
cost_currency: string | null;
|
|
257
|
+
deleted_at: string | null;
|
|
258
258
|
total_on_hand: number | null;
|
|
259
259
|
prices?: Array<AdminPrice>;
|
|
260
260
|
};
|
|
@@ -281,7 +281,7 @@ type StoreCountry = {
|
|
|
281
281
|
states_required: boolean;
|
|
282
282
|
zipcode_required: boolean;
|
|
283
283
|
states?: Array<StoreState>;
|
|
284
|
-
market?:
|
|
284
|
+
market?: StoreMarket | null;
|
|
285
285
|
};
|
|
286
286
|
|
|
287
287
|
type StoreCreditCard = {
|
|
@@ -368,10 +368,10 @@ type StoreGiftCard = {
|
|
|
368
368
|
code: string;
|
|
369
369
|
state: string;
|
|
370
370
|
currency: string;
|
|
371
|
-
amount:
|
|
372
|
-
amount_used:
|
|
373
|
-
amount_authorized:
|
|
374
|
-
amount_remaining:
|
|
371
|
+
amount: string;
|
|
372
|
+
amount_used: string;
|
|
373
|
+
amount_authorized: string;
|
|
374
|
+
amount_remaining: string;
|
|
375
375
|
display_amount: string;
|
|
376
376
|
display_amount_used: string;
|
|
377
377
|
display_amount_remaining: string;
|
|
@@ -788,7 +788,7 @@ type StoreShippingRate = {
|
|
|
788
788
|
shipping_method_id: string;
|
|
789
789
|
name: string;
|
|
790
790
|
selected: boolean;
|
|
791
|
-
cost:
|
|
791
|
+
cost: string;
|
|
792
792
|
display_cost: string;
|
|
793
793
|
shipping_method: StoreShippingMethod;
|
|
794
794
|
};
|
|
@@ -853,26 +853,6 @@ type StoreStoreCredit = {
|
|
|
853
853
|
currency: string;
|
|
854
854
|
};
|
|
855
855
|
|
|
856
|
-
type StoreStore = {
|
|
857
|
-
id: string;
|
|
858
|
-
name: string;
|
|
859
|
-
url: string;
|
|
860
|
-
meta_description: string | null;
|
|
861
|
-
meta_keywords: string | null;
|
|
862
|
-
seo_title: string | null;
|
|
863
|
-
code: string;
|
|
864
|
-
facebook: string | null;
|
|
865
|
-
twitter: string | null;
|
|
866
|
-
instagram: string | null;
|
|
867
|
-
customer_support_email: string | null;
|
|
868
|
-
created_at: string;
|
|
869
|
-
updated_at: string;
|
|
870
|
-
favicon_image_url: string | null;
|
|
871
|
-
logo_image_url: string | null;
|
|
872
|
-
social_image_url: string | null;
|
|
873
|
-
payment_methods: Array<StorePaymentMethod>;
|
|
874
|
-
};
|
|
875
|
-
|
|
876
856
|
type StoreTaxon = {
|
|
877
857
|
id: string;
|
|
878
858
|
name: string;
|
|
@@ -968,9 +948,16 @@ interface PaginationMeta {
|
|
|
968
948
|
limit: number;
|
|
969
949
|
count: number;
|
|
970
950
|
pages: number;
|
|
951
|
+
from: number;
|
|
952
|
+
to: number;
|
|
953
|
+
in: number;
|
|
954
|
+
previous: number | null;
|
|
955
|
+
next: number | null;
|
|
971
956
|
}
|
|
972
|
-
interface
|
|
957
|
+
interface ListResponse<T> {
|
|
973
958
|
data: T[];
|
|
959
|
+
}
|
|
960
|
+
interface PaginatedResponse<T> extends ListResponse<T> {
|
|
974
961
|
meta: PaginationMeta;
|
|
975
962
|
}
|
|
976
963
|
interface ErrorResponse {
|
|
@@ -1173,4 +1160,4 @@ interface ProductFiltersParams {
|
|
|
1173
1160
|
q?: Record<string, unknown>;
|
|
1174
1161
|
}
|
|
1175
1162
|
|
|
1176
|
-
export type { AddLineItemParams, AddressParams, AdminCustomer, AdminLineItem, AdminMetafield, AdminOrder, AdminPrice, AdminProduct, AdminTaxon, AdminTaxonomy, AdminVariant, AuthTokens, AvailabilityFilter, CompletePaymentSessionParams, CompletePaymentSetupSessionParams, CreateCartParams, CreatePaymentSessionParams, CreatePaymentSetupSessionParams, ErrorResponse, FilterOption, ListParams, LocaleDefaults, LoginCredentials, OptionFilter, OptionFilterOption, OrderListParams, PaginatedResponse, PaginationMeta, PriceRangeFilter, ProductFilter, ProductFiltersParams, ProductFiltersResponse, ProductListParams, RegisterParams, SortOption, StoreAddress, StoreAsset, StoreBase, StoreCountry, StoreCreditCard, StoreCurrency, StoreCustomer, StoreCustomerReturn, StoreDigital, StoreDigitalLink, StoreExport, StoreGiftCard, StoreGiftCardBatch, StoreImage, StoreImport, StoreImportRow, StoreInvitation, StoreLineItem, StoreLocale, StoreMarket, StoreMetafield, StoreNewsletterSubscriber, StoreOptionType, StoreOptionValue, StoreOrder, StoreOrderPromotion, StorePayment, StorePaymentMethod, StorePaymentSession, StorePaymentSetupSession, StorePaymentSource, StorePrice, StoreProduct, StorePromotion, StoreRefund, StoreReimbursement, StoreReport, StoreReturnAuthorization, StoreReturnItem, StoreShipment, StoreShippingMethod, StoreShippingRate, StoreState, StoreStockItem, StoreStockLocation, StoreStockMovement, StoreStockTransfer,
|
|
1163
|
+
export type { AddLineItemParams, AddressParams, AdminCustomer, AdminLineItem, AdminMetafield, AdminOrder, AdminPrice, AdminProduct, AdminTaxon, AdminTaxonomy, AdminVariant, AuthTokens, AvailabilityFilter, CompletePaymentSessionParams, CompletePaymentSetupSessionParams, CreateCartParams, CreatePaymentSessionParams, CreatePaymentSetupSessionParams, ErrorResponse, FilterOption, ListParams, ListResponse, LocaleDefaults, LoginCredentials, OptionFilter, OptionFilterOption, OrderListParams, PaginatedResponse, PaginationMeta, PriceRangeFilter, ProductFilter, ProductFiltersParams, ProductFiltersResponse, ProductListParams, RegisterParams, SortOption, StoreAddress, StoreAsset, StoreBase, StoreCountry, StoreCreditCard, StoreCurrency, StoreCustomer, StoreCustomerReturn, StoreDigital, StoreDigitalLink, StoreExport, StoreGiftCard, StoreGiftCardBatch, StoreImage, StoreImport, StoreImportRow, StoreInvitation, StoreLineItem, StoreLocale, StoreMarket, StoreMetafield, StoreNewsletterSubscriber, StoreOptionType, StoreOptionValue, StoreOrder, StoreOrderPromotion, StorePayment, StorePaymentMethod, StorePaymentSession, StorePaymentSetupSession, StorePaymentSource, StorePrice, StoreProduct, StorePromotion, StoreRefund, StoreReimbursement, StoreReport, StoreReturnAuthorization, StoreReturnItem, StoreShipment, StoreShippingMethod, StoreShippingRate, StoreState, StoreStockItem, StoreStockLocation, StoreStockMovement, StoreStockTransfer, StoreStoreCredit, StoreTaxon, StoreTaxonomy, StoreVariant, StoreWishedItem, StoreWishlist, TaxonFilter, TaxonFilterOption, TaxonListParams, UpdateLineItemParams, UpdateOrderParams, UpdatePaymentSessionParams };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -182,7 +182,7 @@ type AdminProduct = {
|
|
|
182
182
|
make_active_at: string | null;
|
|
183
183
|
discontinue_on: string | null;
|
|
184
184
|
deleted_at: string | null;
|
|
185
|
-
cost_price:
|
|
185
|
+
cost_price: string | null;
|
|
186
186
|
cost_currency: string | null;
|
|
187
187
|
};
|
|
188
188
|
|
|
@@ -252,9 +252,9 @@ type AdminVariant = {
|
|
|
252
252
|
metafields?: Array<AdminMetafield>;
|
|
253
253
|
position: number;
|
|
254
254
|
tax_category_id: string | null;
|
|
255
|
-
|
|
256
|
-
cost_price: number | null;
|
|
255
|
+
cost_price: string | null;
|
|
257
256
|
cost_currency: string | null;
|
|
257
|
+
deleted_at: string | null;
|
|
258
258
|
total_on_hand: number | null;
|
|
259
259
|
prices?: Array<AdminPrice>;
|
|
260
260
|
};
|
|
@@ -281,7 +281,7 @@ type StoreCountry = {
|
|
|
281
281
|
states_required: boolean;
|
|
282
282
|
zipcode_required: boolean;
|
|
283
283
|
states?: Array<StoreState>;
|
|
284
|
-
market?:
|
|
284
|
+
market?: StoreMarket | null;
|
|
285
285
|
};
|
|
286
286
|
|
|
287
287
|
type StoreCreditCard = {
|
|
@@ -368,10 +368,10 @@ type StoreGiftCard = {
|
|
|
368
368
|
code: string;
|
|
369
369
|
state: string;
|
|
370
370
|
currency: string;
|
|
371
|
-
amount:
|
|
372
|
-
amount_used:
|
|
373
|
-
amount_authorized:
|
|
374
|
-
amount_remaining:
|
|
371
|
+
amount: string;
|
|
372
|
+
amount_used: string;
|
|
373
|
+
amount_authorized: string;
|
|
374
|
+
amount_remaining: string;
|
|
375
375
|
display_amount: string;
|
|
376
376
|
display_amount_used: string;
|
|
377
377
|
display_amount_remaining: string;
|
|
@@ -788,7 +788,7 @@ type StoreShippingRate = {
|
|
|
788
788
|
shipping_method_id: string;
|
|
789
789
|
name: string;
|
|
790
790
|
selected: boolean;
|
|
791
|
-
cost:
|
|
791
|
+
cost: string;
|
|
792
792
|
display_cost: string;
|
|
793
793
|
shipping_method: StoreShippingMethod;
|
|
794
794
|
};
|
|
@@ -853,26 +853,6 @@ type StoreStoreCredit = {
|
|
|
853
853
|
currency: string;
|
|
854
854
|
};
|
|
855
855
|
|
|
856
|
-
type StoreStore = {
|
|
857
|
-
id: string;
|
|
858
|
-
name: string;
|
|
859
|
-
url: string;
|
|
860
|
-
meta_description: string | null;
|
|
861
|
-
meta_keywords: string | null;
|
|
862
|
-
seo_title: string | null;
|
|
863
|
-
code: string;
|
|
864
|
-
facebook: string | null;
|
|
865
|
-
twitter: string | null;
|
|
866
|
-
instagram: string | null;
|
|
867
|
-
customer_support_email: string | null;
|
|
868
|
-
created_at: string;
|
|
869
|
-
updated_at: string;
|
|
870
|
-
favicon_image_url: string | null;
|
|
871
|
-
logo_image_url: string | null;
|
|
872
|
-
social_image_url: string | null;
|
|
873
|
-
payment_methods: Array<StorePaymentMethod>;
|
|
874
|
-
};
|
|
875
|
-
|
|
876
856
|
type StoreTaxon = {
|
|
877
857
|
id: string;
|
|
878
858
|
name: string;
|
|
@@ -968,9 +948,16 @@ interface PaginationMeta {
|
|
|
968
948
|
limit: number;
|
|
969
949
|
count: number;
|
|
970
950
|
pages: number;
|
|
951
|
+
from: number;
|
|
952
|
+
to: number;
|
|
953
|
+
in: number;
|
|
954
|
+
previous: number | null;
|
|
955
|
+
next: number | null;
|
|
971
956
|
}
|
|
972
|
-
interface
|
|
957
|
+
interface ListResponse<T> {
|
|
973
958
|
data: T[];
|
|
959
|
+
}
|
|
960
|
+
interface PaginatedResponse<T> extends ListResponse<T> {
|
|
974
961
|
meta: PaginationMeta;
|
|
975
962
|
}
|
|
976
963
|
interface ErrorResponse {
|
|
@@ -1173,4 +1160,4 @@ interface ProductFiltersParams {
|
|
|
1173
1160
|
q?: Record<string, unknown>;
|
|
1174
1161
|
}
|
|
1175
1162
|
|
|
1176
|
-
export type { AddLineItemParams, AddressParams, AdminCustomer, AdminLineItem, AdminMetafield, AdminOrder, AdminPrice, AdminProduct, AdminTaxon, AdminTaxonomy, AdminVariant, AuthTokens, AvailabilityFilter, CompletePaymentSessionParams, CompletePaymentSetupSessionParams, CreateCartParams, CreatePaymentSessionParams, CreatePaymentSetupSessionParams, ErrorResponse, FilterOption, ListParams, LocaleDefaults, LoginCredentials, OptionFilter, OptionFilterOption, OrderListParams, PaginatedResponse, PaginationMeta, PriceRangeFilter, ProductFilter, ProductFiltersParams, ProductFiltersResponse, ProductListParams, RegisterParams, SortOption, StoreAddress, StoreAsset, StoreBase, StoreCountry, StoreCreditCard, StoreCurrency, StoreCustomer, StoreCustomerReturn, StoreDigital, StoreDigitalLink, StoreExport, StoreGiftCard, StoreGiftCardBatch, StoreImage, StoreImport, StoreImportRow, StoreInvitation, StoreLineItem, StoreLocale, StoreMarket, StoreMetafield, StoreNewsletterSubscriber, StoreOptionType, StoreOptionValue, StoreOrder, StoreOrderPromotion, StorePayment, StorePaymentMethod, StorePaymentSession, StorePaymentSetupSession, StorePaymentSource, StorePrice, StoreProduct, StorePromotion, StoreRefund, StoreReimbursement, StoreReport, StoreReturnAuthorization, StoreReturnItem, StoreShipment, StoreShippingMethod, StoreShippingRate, StoreState, StoreStockItem, StoreStockLocation, StoreStockMovement, StoreStockTransfer,
|
|
1163
|
+
export type { AddLineItemParams, AddressParams, AdminCustomer, AdminLineItem, AdminMetafield, AdminOrder, AdminPrice, AdminProduct, AdminTaxon, AdminTaxonomy, AdminVariant, AuthTokens, AvailabilityFilter, CompletePaymentSessionParams, CompletePaymentSetupSessionParams, CreateCartParams, CreatePaymentSessionParams, CreatePaymentSetupSessionParams, ErrorResponse, FilterOption, ListParams, ListResponse, LocaleDefaults, LoginCredentials, OptionFilter, OptionFilterOption, OrderListParams, PaginatedResponse, PaginationMeta, PriceRangeFilter, ProductFilter, ProductFiltersParams, ProductFiltersResponse, ProductListParams, RegisterParams, SortOption, StoreAddress, StoreAsset, StoreBase, StoreCountry, StoreCreditCard, StoreCurrency, StoreCustomer, StoreCustomerReturn, StoreDigital, StoreDigitalLink, StoreExport, StoreGiftCard, StoreGiftCardBatch, StoreImage, StoreImport, StoreImportRow, StoreInvitation, StoreLineItem, StoreLocale, StoreMarket, StoreMetafield, StoreNewsletterSubscriber, StoreOptionType, StoreOptionValue, StoreOrder, StoreOrderPromotion, StorePayment, StorePaymentMethod, StorePaymentSession, StorePaymentSetupSession, StorePaymentSource, StorePrice, StoreProduct, StorePromotion, StoreRefund, StoreReimbursement, StoreReport, StoreReturnAuthorization, StoreReturnItem, StoreShipment, StoreShippingMethod, StoreShippingRate, StoreState, StoreStockItem, StoreStockLocation, StoreStockMovement, StoreStockTransfer, StoreStoreCredit, StoreTaxon, StoreTaxonomy, StoreVariant, StoreWishedItem, StoreWishlist, TaxonFilter, TaxonFilterOption, TaxonListParams, UpdateLineItemParams, UpdateOrderParams, UpdatePaymentSessionParams };
|
package/dist/zod/index.cjs
CHANGED
|
@@ -120,7 +120,7 @@ var StoreShippingRateSchema = zod.z.object({
|
|
|
120
120
|
shipping_method_id: zod.z.string(),
|
|
121
121
|
name: zod.z.string(),
|
|
122
122
|
selected: zod.z.boolean(),
|
|
123
|
-
cost: zod.z.
|
|
123
|
+
cost: zod.z.string(),
|
|
124
124
|
display_cost: zod.z.string(),
|
|
125
125
|
shipping_method: StoreShippingMethodSchema
|
|
126
126
|
});
|
|
@@ -307,9 +307,9 @@ var AdminVariantSchema = zod.z.object({
|
|
|
307
307
|
metafields: zod.z.array(AdminMetafieldSchema).optional(),
|
|
308
308
|
position: zod.z.number(),
|
|
309
309
|
tax_category_id: zod.z.string().nullable(),
|
|
310
|
-
|
|
311
|
-
cost_price: zod.z.number().nullable(),
|
|
310
|
+
cost_price: zod.z.string().nullable(),
|
|
312
311
|
cost_currency: zod.z.string().nullable(),
|
|
312
|
+
deleted_at: zod.z.string().nullable(),
|
|
313
313
|
total_on_hand: zod.z.number().nullable(),
|
|
314
314
|
prices: zod.z.array(AdminPriceSchema).optional()
|
|
315
315
|
});
|
|
@@ -387,7 +387,7 @@ var AdminProductSchema = zod.z.object({
|
|
|
387
387
|
make_active_at: zod.z.string().nullable(),
|
|
388
388
|
discontinue_on: zod.z.string().nullable(),
|
|
389
389
|
deleted_at: zod.z.string().nullable(),
|
|
390
|
-
cost_price: zod.z.
|
|
390
|
+
cost_price: zod.z.string().nullable(),
|
|
391
391
|
cost_currency: zod.z.string().nullable()
|
|
392
392
|
});
|
|
393
393
|
var AdminTaxonSchema = zod.z.object({
|
|
@@ -442,6 +442,16 @@ var StoreAssetSchema = zod.z.object({
|
|
|
442
442
|
var StoreBaseSchema = zod.z.object({
|
|
443
443
|
id: zod.z.string()
|
|
444
444
|
});
|
|
445
|
+
var StoreMarketSchema = zod.z.object({
|
|
446
|
+
id: zod.z.string(),
|
|
447
|
+
name: zod.z.string(),
|
|
448
|
+
currency: zod.z.string(),
|
|
449
|
+
default_locale: zod.z.string(),
|
|
450
|
+
tax_inclusive: zod.z.boolean(),
|
|
451
|
+
default: zod.z.boolean(),
|
|
452
|
+
supported_locales: zod.z.array(zod.z.string()),
|
|
453
|
+
countries: zod.z.array(zod.z.lazy(() => StoreCountrySchema)).optional()
|
|
454
|
+
});
|
|
445
455
|
var StoreStateSchema = zod.z.object({
|
|
446
456
|
abbr: zod.z.string(),
|
|
447
457
|
name: zod.z.string()
|
|
@@ -455,7 +465,7 @@ var StoreCountrySchema = zod.z.object({
|
|
|
455
465
|
states_required: zod.z.boolean(),
|
|
456
466
|
zipcode_required: zod.z.boolean(),
|
|
457
467
|
states: zod.z.array(StoreStateSchema).optional(),
|
|
458
|
-
market: zod.z.
|
|
468
|
+
market: zod.z.lazy(() => StoreMarketSchema).nullable().optional()
|
|
459
469
|
});
|
|
460
470
|
var StoreCreditCardSchema = zod.z.object({
|
|
461
471
|
id: zod.z.string(),
|
|
@@ -510,10 +520,10 @@ var StoreGiftCardSchema = zod.z.object({
|
|
|
510
520
|
code: zod.z.string(),
|
|
511
521
|
state: zod.z.string(),
|
|
512
522
|
currency: zod.z.string(),
|
|
513
|
-
amount: zod.z.
|
|
514
|
-
amount_used: zod.z.
|
|
515
|
-
amount_authorized: zod.z.
|
|
516
|
-
amount_remaining: zod.z.
|
|
523
|
+
amount: zod.z.string(),
|
|
524
|
+
amount_used: zod.z.string(),
|
|
525
|
+
amount_authorized: zod.z.string(),
|
|
526
|
+
amount_remaining: zod.z.string(),
|
|
517
527
|
display_amount: zod.z.string(),
|
|
518
528
|
display_amount_used: zod.z.string(),
|
|
519
529
|
display_amount_remaining: zod.z.string(),
|
|
@@ -610,16 +620,6 @@ var StoreLocaleSchema = zod.z.object({
|
|
|
610
620
|
code: zod.z.string(),
|
|
611
621
|
name: zod.z.string()
|
|
612
622
|
});
|
|
613
|
-
var StoreMarketSchema = zod.z.object({
|
|
614
|
-
id: zod.z.string(),
|
|
615
|
-
name: zod.z.string(),
|
|
616
|
-
currency: zod.z.string(),
|
|
617
|
-
default_locale: zod.z.string(),
|
|
618
|
-
tax_inclusive: zod.z.boolean(),
|
|
619
|
-
default: zod.z.boolean(),
|
|
620
|
-
supported_locales: zod.z.array(zod.z.string()),
|
|
621
|
-
countries: zod.z.array(StoreCountrySchema).optional()
|
|
622
|
-
});
|
|
623
623
|
var StoreNewsletterSubscriberSchema = zod.z.object({
|
|
624
624
|
id: zod.z.string(),
|
|
625
625
|
email: zod.z.string(),
|
|
@@ -861,25 +861,6 @@ var StoreStockTransferSchema = zod.z.object({
|
|
|
861
861
|
source_location_id: zod.z.string().nullable(),
|
|
862
862
|
destination_location_id: zod.z.string().nullable()
|
|
863
863
|
});
|
|
864
|
-
var StoreStoreSchema = zod.z.object({
|
|
865
|
-
id: zod.z.string(),
|
|
866
|
-
name: zod.z.string(),
|
|
867
|
-
url: zod.z.string(),
|
|
868
|
-
meta_description: zod.z.string().nullable(),
|
|
869
|
-
meta_keywords: zod.z.string().nullable(),
|
|
870
|
-
seo_title: zod.z.string().nullable(),
|
|
871
|
-
code: zod.z.string(),
|
|
872
|
-
facebook: zod.z.string().nullable(),
|
|
873
|
-
twitter: zod.z.string().nullable(),
|
|
874
|
-
instagram: zod.z.string().nullable(),
|
|
875
|
-
customer_support_email: zod.z.string().nullable(),
|
|
876
|
-
created_at: zod.z.string(),
|
|
877
|
-
updated_at: zod.z.string(),
|
|
878
|
-
favicon_image_url: zod.z.string().nullable(),
|
|
879
|
-
logo_image_url: zod.z.string().nullable(),
|
|
880
|
-
social_image_url: zod.z.string().nullable(),
|
|
881
|
-
payment_methods: zod.z.array(StorePaymentMethodSchema)
|
|
882
|
-
});
|
|
883
864
|
var StoreStoreCreditSchema = zod.z.object({
|
|
884
865
|
id: zod.z.string(),
|
|
885
866
|
amount: zod.z.string(),
|
|
@@ -978,7 +959,6 @@ exports.StoreStockLocationSchema = StoreStockLocationSchema;
|
|
|
978
959
|
exports.StoreStockMovementSchema = StoreStockMovementSchema;
|
|
979
960
|
exports.StoreStockTransferSchema = StoreStockTransferSchema;
|
|
980
961
|
exports.StoreStoreCreditSchema = StoreStoreCreditSchema;
|
|
981
|
-
exports.StoreStoreSchema = StoreStoreSchema;
|
|
982
962
|
exports.StoreTaxonSchema = StoreTaxonSchema;
|
|
983
963
|
exports.StoreTaxonomySchema = StoreTaxonomySchema;
|
|
984
964
|
exports.StoreVariantSchema = StoreVariantSchema;
|