@eldrajs/sdk 0.4.2 → 0.4.3

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/CHANGELOG.md CHANGED
@@ -9,6 +9,45 @@ platform repository.
9
9
 
10
10
  ## Unreleased
11
11
 
12
+ - **Several discount codes on one cart (contract 6.9.0).** `applyDiscount` and `applyCode` (as `DISCOUNT`) now add
13
+ a code after the cart's codes instead of replacing it; each applies to what the codes before it left. Three new
14
+ 409 refusals leave the cart as it was: `CART_DISCOUNT_NOT_COMBINABLE` (the code and one on the cart cannot be
15
+ combined; `errors.blockingCode` names the one on the cart), `CART_DISCOUNT_CODES_LIMIT_REACHED` (`errors.limit`,
16
+ 6) and `CART_DISCOUNT_ALREADY_APPLIED`. `EldraHttpError` gains `errors`, the problem's `errors` object when the
17
+ body carries one. The cart carries `discountCodes` (`{code, amount}` in the order added; the type is
18
+ `EldraCartDiscountCodeEntry`); `cart.removeDiscountEntry(cartId, code, options?)` removes one code and
19
+ `removeDiscount` now removes every code. `applyDiscount`'s `applied` reads `discountCodes` (falling back to
20
+ `discountCode` from an older gateway), so a second code reports `true`. The order read and the checkout summary
21
+ carry `discountCodes` (`EldraOrderDiscountCode`, `EldraOrderPreviewDiscountCode`). The cart's and the order's
22
+ `discountCode` are deprecated in the contract: it answers them for one more version. The contract fixtures are
23
+ regenerated from 6.9.0.
24
+ - **Several gift cards on one cart (contract 6.8.0).** A cart holds any number of gift cards beside its discount
25
+ code: `applyGiftCard` and `applyCode` now add a card after the others instead of replacing one, and the same card
26
+ again is 409 `CART_GIFT_CARD_ALREADY_APPLIED`. The cart carries `giftCards` (`{entryId, last4, balance, applied,
27
+ amountDue}` in the order applied; the type is `EldraCartGiftCardEntry`) and the cart-wide `amountDue`.
28
+ `cart.removeGiftCardEntry(cartId, entryId, options?)` removes one card; `removeGiftCard` now removes every card.
29
+ The checkout summary's type `EldraOrderPreview` carries `giftCards` (`EldraOrderPreviewGiftCard`, `{last4,
30
+ amount}`). The cart's `giftCard` and `EldraCartGiftCard` are deprecated: the contract answers them for one more
31
+ version. The contract fixtures are regenerated from 6.8.0.
32
+ - **One code field (contract 6.7.0).** `cart.applyCode(cartId, code, options?)` applies a gift card or a discount
33
+ code from one input and answers the cart with `appliedAs` (`GIFT_CARD` or `DISCOUNT`); the type is
34
+ `EldraCartAppliedCode`. A code that is neither is 404 `CART_CODE_INVALID`. `applyDiscount` and
35
+ `applyGiftCard` stay.
36
+ - **The shared SEO value on catalog reads (contract 6.6.0).** A product's, category's, collection's and brand's
37
+ `seo` now carries `canonicalUrl`, `ogTitle`, `ogDescription`, `imageAssetId`, `imageUrl` and `noindex` beside
38
+ `title` and `description`: the shape a CMS entry's `seo` field has. Types only; the contract fixtures are
39
+ regenerated from 6.6.0. A product card (the product list and a collection's products) carries `seo` with
40
+ `canonicalUrl` and `noindex` only, which the theme's sitemap reads.
41
+ - **Brands and gift cards (contract 6.4.0).** `catalog.listBrands(options?)` reads the shop's active brands
42
+ (`[]` for none) and `catalog.getBrand(slug, options?)` one of them (404 `CATALOG_BRAND_NOT_FOUND` otherwise);
43
+ `cart.applyGiftCard(cartId, code, options?)` and `cart.removeGiftCard(cartId, options?)` put a gift card on the
44
+ cart and take it off, answering the cart (its `giftCard {last4, balance, applied, amountDue}`). A refused card
45
+ is an `EldraHttpError` with the contract's `errorId` (`CART_GIFT_CARD_INVALID`, `CART_GIFT_CARD_EXHAUSTED`,
46
+ `CART_DISCOUNT_TOO_MANY_ATTEMPTS`, `CART_GIFT_CARD_UNAVAILABLE`). New types `EldraBrand` and `EldraCartGiftCard`.
47
+ A product's `brand` and `seo`, a variant's `regularPrice`, `priorPrice` and `discount`, a card's `priorPrice`
48
+ and `discountLabel`, a cart line's `salePrice` and the list filter `brandId` need nothing new: they come from
49
+ the generated contract. Needs a gateway on contract 6.4.0 or later.
50
+
12
51
  - **Typed product extensions (WS-439, contract 6.1.0).** `EldraProductDetails.extensions` is keyed by
13
52
  the apiId of each CMS schema that extends products, and its type is the new, initially empty
14
53
  `EldraProductExtensions` registry. The CMS types the Vite plugin writes now fill it in (`eldra-theme types` writes the
package/README.md CHANGED
@@ -122,17 +122,17 @@ Lists, relative times, names and sorting are not patched; use the functions abov
122
122
 
123
123
  ## What is in the client
124
124
 
125
- | Group | Methods |
126
- | ----------- | ---------------------------------------------------------------------------------------------------------------------- |
127
- | `catalog` | `listProducts`, `getProduct`, `listCategories`, `listCollections`, `getCollection`, `listCollectionProducts`, `search` |
128
- | `cms` | `list`, `get`, `getEntryByUniqueField`, `resolveEntryList` |
129
- | `cart` | `addItem`, `get`, `updateItem`, `removeItem`, `applyDiscount`, `removeDiscount` |
130
- | `checkout` | `url` |
131
- | `orders` | `get`, `recover` |
132
- | `inventory` | `availability` |
133
- | `features` | `getOrganization`, `list`, `isEnabled`, `getCapabilities`, `getCommerce` |
134
- | `platform` | `config` |
135
- | `forms` | `get`, `submit`, `confirm`, `unsubscribe` |
125
+ | Group | Methods |
126
+ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
127
+ | `catalog` | `listProducts`, `getProduct`, `listCategories`, `listCollections`, `getCollection`, `listCollectionProducts`, `listBrands`, `getBrand`, `search` |
128
+ | `cms` | `list`, `get`, `getEntryByUniqueField`, `resolveEntryList` |
129
+ | `cart` | `addItem`, `get`, `updateItem`, `removeItem`, `applyDiscount`, `removeDiscount`, `removeDiscountEntry`, `applyCode`, `applyGiftCard`, `removeGiftCard`, `removeGiftCardEntry` |
130
+ | `checkout` | `url` |
131
+ | `orders` | `get`, `recover` |
132
+ | `inventory` | `availability` |
133
+ | `features` | `getOrganization`, `list`, `isEnabled`, `getCapabilities`, `getCommerce` |
134
+ | `platform` | `config` |
135
+ | `forms` | `get`, `submit`, `confirm`, `unsubscribe` |
136
136
 
137
137
  `forms` is the site-forms API: `get(key)` reads a form's definition (fields with a label per locale,
138
138
  the honeypot field's name, the Turnstile site key, the success message), and `submit(key, { values,
@@ -272,6 +272,9 @@ createEldraClient({ orgId: 'your-organisation-id', retry: { attempts: 0 } });
272
272
  A consumer-supplied `httpClient` replaces the transport, so the retry is that client's own.
273
273
 
274
274
  Every failed request throws `EldraHttpError` with `status`, the problem's category `code` (such as
275
- `NOT_FOUND`) and its specific `errorId` (such as `CART_NOT_FOUND`); branch on `errorId`.
275
+ `NOT_FOUND`) and its specific `errorId` (such as `CART_NOT_FOUND`); branch on `errorId`. A refusal
276
+ that says more carries it in `errors`, the problem's `errors` object: a discount code refused with
277
+ `CART_DISCOUNT_NOT_COMBINABLE` names the code on the cart that blocks it in `errors.blockingCode`,
278
+ and `CART_DISCOUNT_CODES_LIMIT_REACHED` the limit (6) in `errors.limit`.
276
279
  `createCartSession` and `createOrderAccessTokens` persist the cart id and order tokens without
277
280
  throwing where storage is unavailable.
@@ -389,6 +389,13 @@ var EldraHttpError = class extends Error {
389
389
  * than "something went wrong".
390
390
  */
391
391
  errorId;
392
+ /**
393
+ * The gateway's problem `errors` — the refusal's detail, when the body carried it as an object.
394
+ * A refused discount code names what blocked it here: `errors.blockingCode` on
395
+ * `CART_DISCOUNT_NOT_COMBINABLE`, `errors.limit` on `CART_DISCOUNT_CODES_LIMIT_REACHED`. Its
396
+ * members depend on the `errorId`, so read each as unknown and check its type.
397
+ */
398
+ errors;
392
399
  constructor(response, body) {
393
400
  super(`Web Studio request failed with ${response.status} ${response.statusText}`);
394
401
  this.name = "EldraHttpError";
@@ -397,6 +404,7 @@ var EldraHttpError = class extends Error {
397
404
  this.body = body;
398
405
  this.code = problemString(body, "code");
399
406
  this.errorId = problemString(body, "errorId");
407
+ this.errors = problemErrors(body);
400
408
  }
401
409
  };
402
410
  /** One field of an RFC 9457 problem body, when the body is an object that carries it as a string. */
@@ -406,6 +414,24 @@ function problemString(body, key) {
406
414
  return typeof value === "string" ? value : void 0;
407
415
  }
408
416
  }
417
+ /** The problem's `errors` member, when the body is an object that carries it as a plain object. */
418
+ function problemErrors(body) {
419
+ if (body && typeof body === "object" && "errors" in body) {
420
+ const value = body.errors;
421
+ if (value && typeof value === "object" && !Array.isArray(value)) return value;
422
+ }
423
+ }
424
+ /**
425
+ * Whether the cart answered to an apply holds the code: in `discountCodes` (contract 6.9.0, any
426
+ * case), else, from an older gateway that answers only `discountCode`, when that is the code.
427
+ */
428
+ function cartHoldsDiscountCode(cart, code) {
429
+ const wanted = code.toUpperCase();
430
+ const record = cart ?? {};
431
+ const same = (value) => typeof value === "string" && value.trim().toUpperCase() === wanted;
432
+ if (Array.isArray(record.discountCodes)) return record.discountCodes.some((entry) => !!entry && typeof entry === "object" && same(entry.code));
433
+ return same(record.discountCode);
434
+ }
409
435
  function initEldraClient(options) {
410
436
  defaultClient = createEldraClient(options);
411
437
  return defaultClient;
@@ -536,6 +562,16 @@ function createEldraClient(options) {
536
562
  path: `/catalog/v1/collections/${encodeURIComponent(slug)}/products`,
537
563
  query: listOptions
538
564
  }),
565
+ listBrands: async (localeOptions, context) => await request({
566
+ ...context,
567
+ path: "/catalog/v1/brands",
568
+ query: localeOptions
569
+ }) ?? [],
570
+ getBrand: (slug, localeOptions, context) => request({
571
+ ...context,
572
+ path: `/catalog/v1/brands/${encodeURIComponent(slug)}`,
573
+ query: localeOptions
574
+ }),
539
575
  search: (query, searchOptions, context) => request({
540
576
  ...context,
541
577
  path: "/search/v1",
@@ -583,10 +619,9 @@ function createEldraClient(options) {
583
619
  query: localeOptions,
584
620
  body: { code: trimmed }
585
621
  });
586
- const discountCode = cart.discountCode;
587
622
  return {
588
623
  cart,
589
- applied: typeof discountCode === "string" && discountCode.trim().toUpperCase() === trimmed.toUpperCase()
624
+ applied: cartHoldsDiscountCode(cart, trimmed)
590
625
  };
591
626
  },
592
627
  removeDiscount: (cartId, localeOptions, context) => request({
@@ -594,6 +629,38 @@ function createEldraClient(options) {
594
629
  method: "DELETE",
595
630
  path: `/shopping-cart/v1/cart/${encodeURIComponent(cartId)}/discount`,
596
631
  query: localeOptions
632
+ }),
633
+ applyGiftCard: (cartId, code, localeOptions, context) => request({
634
+ ...context,
635
+ method: "PUT",
636
+ path: `/shopping-cart/v1/cart/${encodeURIComponent(cartId)}/gift-card`,
637
+ query: localeOptions,
638
+ body: { code: code.trim() }
639
+ }),
640
+ applyCode: (cartId, code, localeOptions, context) => request({
641
+ ...context,
642
+ method: "PUT",
643
+ path: `/shopping-cart/v1/cart/${encodeURIComponent(cartId)}/code`,
644
+ query: localeOptions,
645
+ body: { code: code.trim() }
646
+ }),
647
+ removeGiftCard: (cartId, localeOptions, context) => request({
648
+ ...context,
649
+ method: "DELETE",
650
+ path: `/shopping-cart/v1/cart/${encodeURIComponent(cartId)}/gift-card`,
651
+ query: localeOptions
652
+ }),
653
+ removeGiftCardEntry: (cartId, entryId, localeOptions, context) => request({
654
+ ...context,
655
+ method: "DELETE",
656
+ path: `/shopping-cart/v1/cart/${encodeURIComponent(cartId)}/gift-cards/${encodeURIComponent(entryId)}`,
657
+ query: localeOptions
658
+ }),
659
+ removeDiscountEntry: (cartId, code, localeOptions, context) => request({
660
+ ...context,
661
+ method: "DELETE",
662
+ path: `/shopping-cart/v1/cart/${encodeURIComponent(cartId)}/discount-codes/${encodeURIComponent(code)}`,
663
+ query: localeOptions
597
664
  })
598
665
  },
599
666
  orders: {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as EldraOrganizationFeature, A as EldraFeature, At as EldraContractItem, B as EldraFormSubmitResult, Bt as clearCampaignAttribution, C as EldraCmsResolveEntryListResponse, Ct as EldraStockAvailability, D as EldraCollectionListOptions, Dt as RuntimeValue, E as EldraCollectionList, Et as RuntimeEnv, F as EldraFormField, Ft as EldraContractQuery, G as EldraInventoryClient, Gt as EldraCartSessionOptions, H as EldraFormsClient, Ht as readCampaignAttribution, I as EldraFormFieldOption, It as EldraContractResponse, J as EldraOrderLine, Jt as EldraOrderAccessTokens, K as EldraLocaleOptions, Kt as EldraKeyValueStorage, L as EldraFormFieldType, Lt as EldraCampaignAttribution, M as EldraFeatureClient, Mt as EldraContractPath, N as EldraFormActionKind, Nt as EldraContractPaths, O as EldraCollectionProductsOptions, Ot as EldraContract, P as EldraFormDefinition, Pt as EldraContractProp, Q as EldraOrganizationDetails, R as EldraFormLocalized, Rt as EldraCampaignAttributionOptions, S as EldraCmsResolveEntryListOptions, St as EldraSearchResponse, T as EldraCollection, Tt as EldraStockAvailabilityItem, U as EldraHttpClient, Ut as withdrawCampaignAttributionConsent, V as EldraFormTokenResult, Vt as grantCampaignAttributionConsent, W as EldraHttpRequest, Wt as EldraCartSession, X as EldraOrdersClient, Xt as createOrderAccessTokens, Y as EldraOrderReadOptions, Yt as createCartSession, Z as EldraOrganizationCommerce, _ as EldraCmsEntryListEntry, _t as EldraRecoveredBasketItem, a as EldraCartTotals, at as EldraPlatformConfig, b as EldraCmsGetOptions, bt as EldraRetryOptions, c as EldraCatalogListProductsOptions, ct as EldraProductExtensions, d as EldraCheckoutUrlOptions, dt as EldraProductMediaLink, et as EldraOrganizationLocales, f as EldraClient, ft as EldraProductOption, g as EldraCmsEntryListDisplayMode, gt as EldraRecoveredBasket, h as EldraCmsEntryList, ht as EldraProductVariant, i as EldraCartItem, it as EldraPlatformClient, j as EldraFeatureCapabilities, jt as EldraContractMethod, k as EldraDiscountResult, kt as EldraContractBody, l as EldraCategory, lt as EldraProductList, m as EldraCmsClient, mt as EldraProductThumbnail, n as EldraCart, nt as EldraPageMeta, o as EldraCatalogClient, ot as EldraPlatformReadOptions, p as EldraClientOptions, pt as EldraProductOptionValue, q as EldraOrder, qt as EldraOrderAccessTokenOptions, r as EldraCartClient, rt as EldraPaginated, s as EldraCatalogGetProductOptions, st as EldraProductDetails, t as EldraAddCartItemInput, tt as EldraOrganizationOptions, u as EldraCheckoutClient, ut as EldraProductListItem, v as EldraCmsEntryListFilterCriterion, vt as EldraRequestContext, w as EldraCmsResolvedEntryList, wt as EldraStockAvailabilityInput, x as EldraCmsListOptions, xt as EldraSearchOptions, y as EldraCmsGetEntryByUniqueFieldOptions, yt as EldraRequestOptions, z as EldraFormSubmitInput, zt as captureCampaignAttribution } from "./types-BN7Y-C9T.js";
1
+ import { $ as EldraOrderDiscountCode, $t as EldraCartSession, A as EldraCollection, At as EldraSearchOptions, B as EldraFormField, Bt as EldraContractMethod, C as EldraCmsEntryListFilterCriterion, Ct as EldraProductThumbnail, D as EldraCmsResolveEntryListOptions, Dt as EldraRequestContext, E as EldraCmsListOptions, Et as EldraRecoveredBasketItem, F as EldraFeature, Ft as RuntimeEnv, G as EldraFormSubmitResult, Gt as EldraContractResponse, H as EldraFormFieldType, Ht as EldraContractPaths, I as EldraFeatureCapabilities, It as RuntimeValue, J as EldraHttpClient, Jt as captureCampaignAttribution, K as EldraFormTokenResult, Kt as EldraCampaignAttribution, L as EldraFeatureClient, Lt as EldraContract, M as EldraCollectionListOptions, Mt as EldraStockAvailability, N as EldraCollectionProductsOptions, Nt as EldraStockAvailabilityInput, O as EldraCmsResolveEntryListResponse, Ot as EldraRequestOptions, P as EldraDiscountResult, Pt as EldraStockAvailabilityItem, Q as EldraOrder, Qt as withdrawCampaignAttributionConsent, R as EldraFormActionKind, Rt as EldraContractBody, S as EldraCmsEntryListEntry, St as EldraProductOptionValue, T as EldraCmsGetOptions, Tt as EldraRecoveredBasket, U as EldraFormLocalized, Ut as EldraContractProp, V as EldraFormFieldOption, Vt as EldraContractPath, W as EldraFormSubmitInput, Wt as EldraContractQuery, X as EldraInventoryClient, Xt as grantCampaignAttributionConsent, Y as EldraHttpRequest, Yt as clearCampaignAttribution, Z as EldraLocaleOptions, Zt as readCampaignAttribution, _ as EldraClient, _t as EldraProductExtensions, a as EldraCartClient, an as createOrderAccessTokens, at as EldraOrdersClient, b as EldraCmsEntryList, bt as EldraProductMediaLink, c as EldraCartGiftCardEntry, ct as EldraOrganizationFeature, d as EldraCatalogClient, dt as EldraPageMeta, en as EldraCartSessionOptions, et as EldraOrderLine, f as EldraCatalogGetProductOptions, ft as EldraPaginated, g as EldraCheckoutUrlOptions, gt as EldraProductDetails, h as EldraCheckoutClient, ht as EldraPlatformReadOptions, i as EldraCartAppliedCode, in as createCartSession, it as EldraOrderReadOptions, j as EldraCollectionList, jt as EldraSearchResponse, k as EldraCmsResolvedEntryList, kt as EldraRetryOptions, l as EldraCartItem, lt as EldraOrganizationLocales, m as EldraCategory, mt as EldraPlatformConfig, n as EldraBrand, nn as EldraOrderAccessTokenOptions, nt as EldraOrderPreviewDiscountCode, o as EldraCartDiscountCodeEntry, ot as EldraOrganizationCommerce, p as EldraCatalogListProductsOptions, pt as EldraPlatformClient, q as EldraFormsClient, qt as EldraCampaignAttributionOptions, r as EldraCart, rn as EldraOrderAccessTokens, rt as EldraOrderPreviewGiftCard, s as EldraCartGiftCard, st as EldraOrganizationDetails, t as EldraAddCartItemInput, tn as EldraKeyValueStorage, tt as EldraOrderPreview, u as EldraCartTotals, ut as EldraOrganizationOptions, v as EldraClientOptions, vt as EldraProductList, w as EldraCmsGetEntryByUniqueFieldOptions, wt as EldraProductVariant, x as EldraCmsEntryListDisplayMode, xt as EldraProductOption, y as EldraCmsClient, yt as EldraProductListItem, z as EldraFormDefinition, zt as EldraContractItem } from "./types-D71CuE-g.js";
2
2
  export declare const DEFAULT_ELDRA_API_BASE_URL = "https://web.eldra.app/api";
3
3
  export declare class EldraHttpError extends Error {
4
4
  readonly status: number;
@@ -15,6 +15,13 @@ export declare class EldraHttpError extends Error {
15
15
  * than "something went wrong".
16
16
  */
17
17
  readonly errorId: string | undefined;
18
+ /**
19
+ * The gateway's problem `errors` — the refusal's detail, when the body carried it as an object.
20
+ * A refused discount code names what blocked it here: `errors.blockingCode` on
21
+ * `CART_DISCOUNT_NOT_COMBINABLE`, `errors.limit` on `CART_DISCOUNT_CODES_LIMIT_REACHED`. Its
22
+ * members depend on the `errorId`, so read each as unknown and check its type.
23
+ */
24
+ readonly errors: Readonly<Record<string, unknown>> | undefined;
18
25
  constructor(response: Response, body: unknown);
19
26
  }
20
27
  export declare function initEldraClient(options: EldraClientOptions): EldraClient;
@@ -114,4 +121,4 @@ interface EldraResponsiveImage {
114
121
  * as `src` and no `srcset`. Returns `undefined` when there is no URL to render.
115
122
  */
116
123
  export declare function responsiveImage(source: EldraImageSource, options: EldraResponsiveImageOptions): EldraResponsiveImage | undefined;
117
- export { type EldraAddCartItemInput, type EldraCampaignAttribution, type EldraCampaignAttributionOptions, type EldraCart, type EldraCartClient, type EldraCartItem, type EldraCartSession, type EldraCartSessionOptions, type EldraCartTotals, type EldraCatalogClient, type EldraCatalogGetProductOptions, type EldraCatalogListProductsOptions, type EldraCategory, type EldraCheckoutClient, type EldraCheckoutUrlOptions, type EldraClient, type EldraClientOptions, type EldraCmsClient, type EldraCmsEntryList, type EldraCmsEntryListDisplayMode, type EldraCmsEntryListEntry, type EldraCmsEntryListFilterCriterion, type EldraCmsGetEntryByUniqueFieldOptions, type EldraCmsGetOptions, type EldraCmsListOptions, type EldraCmsResolveEntryListOptions, type EldraCmsResolveEntryListResponse, type EldraCmsResolvedEntryList, type EldraCollection, type EldraCollectionList, type EldraCollectionListOptions, type EldraCollectionProductsOptions, type EldraContract, type EldraContractBody, type EldraContractItem, type EldraContractMethod, type EldraContractPath, type EldraContractPaths, type EldraContractProp, type EldraContractQuery, type EldraContractResponse, type EldraDiscountResult, type EldraFeature, type EldraFeatureCapabilities, type EldraFeatureClient, type EldraFormActionKind, type EldraFormDefinition, type EldraFormField, type EldraFormFieldOption, type EldraFormFieldType, type EldraFormLocalized, type EldraFormSubmitInput, type EldraFormSubmitResult, type EldraFormTokenResult, type EldraFormsClient, type EldraHttpClient, type EldraHttpRequest, type EldraImageSource, type EldraImageSrcsetOptions, type EldraImageVariant, type EldraInventoryClient, type EldraKeyValueStorage, type EldraLocaleOptions, type EldraOrder, type EldraOrderAccessTokenOptions, type EldraOrderAccessTokens, type EldraOrderLine, type EldraOrderReadOptions, type EldraOrdersClient, type EldraOrganizationCommerce, type EldraOrganizationDetails, type EldraOrganizationFeature, type EldraOrganizationLocales, type EldraOrganizationOptions, type EldraPageMeta, type EldraPaginated, type EldraPlatformClient, type EldraPlatformConfig, type EldraPlatformReadOptions, type EldraProductDetails, type EldraProductExtensions, type EldraProductList, type EldraProductListItem, type EldraProductMediaLink, type EldraProductOption, type EldraProductOptionValue, type EldraProductThumbnail, type EldraProductVariant, type EldraRecoveredBasket, type EldraRecoveredBasketItem, type EldraRequestContext, type EldraRequestOptions, type EldraResponsiveImage, type EldraResponsiveImageOptions, type EldraRetryOptions, type EldraSearchOptions, type EldraSearchResponse, type EldraSizedImageVariant, type EldraStockAvailability, type EldraStockAvailabilityInput, type EldraStockAvailabilityItem, type EldraTrackerScript, type EldraTrackerScriptOptions, type RuntimeEnv, type RuntimeValue, captureCampaignAttribution, clearCampaignAttribution, createCartSession, createOrderAccessTokens, grantCampaignAttributionConsent, readCampaignAttribution, withdrawCampaignAttributionConsent };
124
+ export { type EldraAddCartItemInput, type EldraBrand, type EldraCampaignAttribution, type EldraCampaignAttributionOptions, type EldraCart, type EldraCartAppliedCode, type EldraCartClient, type EldraCartDiscountCodeEntry, type EldraCartGiftCard, type EldraCartGiftCardEntry, type EldraCartItem, type EldraCartSession, type EldraCartSessionOptions, type EldraCartTotals, type EldraCatalogClient, type EldraCatalogGetProductOptions, type EldraCatalogListProductsOptions, type EldraCategory, type EldraCheckoutClient, type EldraCheckoutUrlOptions, type EldraClient, type EldraClientOptions, type EldraCmsClient, type EldraCmsEntryList, type EldraCmsEntryListDisplayMode, type EldraCmsEntryListEntry, type EldraCmsEntryListFilterCriterion, type EldraCmsGetEntryByUniqueFieldOptions, type EldraCmsGetOptions, type EldraCmsListOptions, type EldraCmsResolveEntryListOptions, type EldraCmsResolveEntryListResponse, type EldraCmsResolvedEntryList, type EldraCollection, type EldraCollectionList, type EldraCollectionListOptions, type EldraCollectionProductsOptions, type EldraContract, type EldraContractBody, type EldraContractItem, type EldraContractMethod, type EldraContractPath, type EldraContractPaths, type EldraContractProp, type EldraContractQuery, type EldraContractResponse, type EldraDiscountResult, type EldraFeature, type EldraFeatureCapabilities, type EldraFeatureClient, type EldraFormActionKind, type EldraFormDefinition, type EldraFormField, type EldraFormFieldOption, type EldraFormFieldType, type EldraFormLocalized, type EldraFormSubmitInput, type EldraFormSubmitResult, type EldraFormTokenResult, type EldraFormsClient, type EldraHttpClient, type EldraHttpRequest, type EldraImageSource, type EldraImageSrcsetOptions, type EldraImageVariant, type EldraInventoryClient, type EldraKeyValueStorage, type EldraLocaleOptions, type EldraOrder, type EldraOrderAccessTokenOptions, type EldraOrderAccessTokens, type EldraOrderDiscountCode, type EldraOrderLine, type EldraOrderPreview, type EldraOrderPreviewDiscountCode, type EldraOrderPreviewGiftCard, type EldraOrderReadOptions, type EldraOrdersClient, type EldraOrganizationCommerce, type EldraOrganizationDetails, type EldraOrganizationFeature, type EldraOrganizationLocales, type EldraOrganizationOptions, type EldraPageMeta, type EldraPaginated, type EldraPlatformClient, type EldraPlatformConfig, type EldraPlatformReadOptions, type EldraProductDetails, type EldraProductExtensions, type EldraProductList, type EldraProductListItem, type EldraProductMediaLink, type EldraProductOption, type EldraProductOptionValue, type EldraProductThumbnail, type EldraProductVariant, type EldraRecoveredBasket, type EldraRecoveredBasketItem, type EldraRequestContext, type EldraRequestOptions, type EldraResponsiveImage, type EldraResponsiveImageOptions, type EldraRetryOptions, type EldraSearchOptions, type EldraSearchResponse, type EldraSizedImageVariant, type EldraStockAvailability, type EldraStockAvailabilityInput, type EldraStockAvailabilityItem, type EldraTrackerScript, type EldraTrackerScriptOptions, type RuntimeEnv, type RuntimeValue, captureCampaignAttribution, clearCampaignAttribution, createCartSession, createOrderAccessTokens, grantCampaignAttributionConsent, readCampaignAttribution, withdrawCampaignAttributionConsent };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as initEldraClient, c as captureCampaignAttribution, d as readCampaignAttribution, f as withdrawCampaignAttributionConsent, i as getEldraClient, l as clearCampaignAttribution, m as createOrderAccessTokens, n as EldraHttpError, o as resolveApiBaseUrl, p as createCartSession, r as createEldraClient, s as resolveOrgId, t as DEFAULT_ELDRA_API_BASE_URL, u as grantCampaignAttributionConsent } from "./client-C7hMOeGA.js";
1
+ import { a as initEldraClient, c as captureCampaignAttribution, d as readCampaignAttribution, f as withdrawCampaignAttributionConsent, i as getEldraClient, l as clearCampaignAttribution, m as createOrderAccessTokens, n as EldraHttpError, o as resolveApiBaseUrl, p as createCartSession, r as createEldraClient, s as resolveOrgId, t as DEFAULT_ELDRA_API_BASE_URL, u as grantCampaignAttributionConsent } from "./client-DCs3cAQK.js";
2
2
  // src/tracker.ts
3
3
  /**
4
4
  * Builds the tracker `<script>` attributes from the same configuration the client uses, so the
@@ -317,6 +317,10 @@ interface EldraCatalogClient {
317
317
  listCollections(options?: EldraCollectionListOptions, context?: EldraRequestContext): Promise<EldraCollectionList>;
318
318
  getCollection(slug: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCollection>;
319
319
  listCollectionProducts(slug: string, options?: EldraCollectionProductsOptions, context?: EldraRequestContext): Promise<EldraProductList>;
320
+ /** The shop's active brands, ordered by name; `[]` for none (contract 6.4.0). */
321
+ listBrands(options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraBrand[]>;
322
+ /** One active brand; 404 `CATALOG_BRAND_NOT_FOUND` for a slug that is missing or not active. */
323
+ getBrand(slug: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraBrand>;
320
324
  search(query: string, options?: EldraSearchOptions, context?: EldraRequestContext): Promise<EldraSearchResponse>;
321
325
  }
322
326
  interface EldraFeatureClient {
@@ -363,21 +367,70 @@ type EldraCollectionList = EldraContractResponse<'/catalog/v1/collections', 'get
363
367
  type EldraCollection = EldraContractResponse<'/catalog/v1/collections/{slug}', 'get'>;
364
368
  type EldraCollectionListOptions = EldraContractQuery<'/catalog/v1/collections', 'get'>;
365
369
  type EldraCollectionProductsOptions = EldraContractQuery<'/catalog/v1/collections/{slug}/products', 'get'>;
370
+ type EldraBrand = EldraContractResponse<'/catalog/v1/brands/{slug}', 'get'>;
366
371
  type EldraSearchOptions = Omit<EldraContractQuery<'/search/v1', 'get'>, 'q'>;
367
372
  type EldraSearchResponse = EldraContractResponse<'/search/v1', 'get'>;
368
373
  type EldraCart = EldraContractResponse<'/shopping-cart/v1/cart/{cartID}', 'get'>;
369
374
  type EldraCartItem = EldraContractItem<EldraContractProp<EldraCart, 'items'>>;
370
375
  type EldraCartTotals = EldraContractProp<EldraCart, 'totals'>;
376
+ /**
377
+ * @deprecated Contract 6.8.0: a cart holds several gift cards. The cart's `giftCard` is the first
378
+ * of `giftCards`, except that its `amountDue` is the cart's `amountDue` (what is due after every
379
+ * card); it is answered for one more contract version. Read `giftCards`
380
+ * ({@link EldraCartGiftCardEntry}) and the cart's `amountDue` instead.
381
+ */
382
+ type EldraCartGiftCard = EldraContractProp<EldraCart, 'giftCard'>;
383
+ /**
384
+ * One gift card on the cart (contract 6.8.0), from `giftCards`, in the order applied:
385
+ * `{entryId, last4, balance, applied, amountDue}`. `applied` is what it pays after the cards
386
+ * before it (0 when they already cover the total; such a card stays on the cart), `amountDue`
387
+ * what is still due after it. `entryId` names the card on this cart for
388
+ * `cart.removeGiftCardEntry`; it is not the card's id or code.
389
+ */
390
+ type EldraCartGiftCardEntry = EldraContractItem<EldraContractProp<EldraCart, 'giftCards'>>;
391
+ /**
392
+ * One discount code on the cart (contract 6.9.0), from `discountCodes`, in the order added:
393
+ * `{code, amount}`. Each code applies to what the codes before it left, and `amount` (major
394
+ * units) is what it takes now: 0 for a code that reduces nothing at the moment (nothing left to
395
+ * reduce, only gift-card lines, or a code the shop has since stopped letting combine); such a
396
+ * code stays on the cart. `code` names it for `cart.removeDiscountEntry`. The cart's deprecated
397
+ * `discountCode` is the first of these whose `amount` is above 0.
398
+ */
399
+ type EldraCartDiscountCodeEntry = EldraContractItem<EldraContractProp<EldraCart, 'discountCodes'>>;
400
+ /** The cart after `cart.applyCode`, with `appliedAs` saying which kind the code was. */
401
+ type EldraCartAppliedCode = EldraContractResponse<'/shopping-cart/v1/cart/{cartID}/code', 'put'>;
371
402
  type EldraAddCartItemInput = EldraContractBody<'/shopping-cart/v1/cart/items', 'post'>;
372
403
  interface EldraDiscountResult {
373
404
  cart: EldraCart;
374
- /** The server drops a code it will not honour, so the returned cart is the verdict. */
405
+ /**
406
+ * The server drops a code it will not honour, so the returned cart is the verdict: true when the
407
+ * cart's `discountCodes` holds the code (any case; since contract 6.9.0, even while it takes 0),
408
+ * or, from a gateway older than 6.9.0, when its single `discountCode` is the code.
409
+ */
375
410
  applied: boolean;
376
411
  }
377
412
  type EldraOrder = EldraContractResponse<'/order/v1/{orderId}', 'get'>;
378
413
  type EldraOrderLine = EldraContractItem<EldraContractProp<EldraOrder, 'orderLines'>>;
414
+ /**
415
+ * One discount code of an order (contract 6.9.0), from the order's `discountCodes`: each code that
416
+ * reduced the order, in the order applied, as `{code, amount}`. The order's `discountCode` is
417
+ * deprecated (the first of these).
418
+ */
419
+ type EldraOrderDiscountCode = EldraContractItem<EldraContractProp<EldraOrder, 'discountCodes'>>;
379
420
  type EldraRecoveredBasket = EldraContractResponse<'/order/v1/recover', 'post'>;
380
421
  type EldraRecoveredBasketItem = EldraContractItem<EldraContractProp<EldraRecoveredBasket, 'items'>>;
422
+ /** The checkout summary `POST /order/v1/preview` answers (the hosted checkout reads it). */
423
+ type EldraOrderPreview = EldraContractResponse<'/order/v1/preview', 'post'>;
424
+ /**
425
+ * One gift card of the checkout summary (contract 6.8.0), from `giftCards`: each card that would
426
+ * pay something, in the order applied, as `{last4, amount}`; they sum to `giftCardAmount`.
427
+ */
428
+ type EldraOrderPreviewGiftCard = EldraContractItem<EldraContractProp<EldraOrderPreview, 'giftCards'>>;
429
+ /**
430
+ * One discount code of the checkout summary (contract 6.9.0), from `discountCodes`: each code that
431
+ * would reduce the order, in the order applied, as `{code, amount}`.
432
+ */
433
+ type EldraOrderPreviewDiscountCode = EldraContractItem<EldraContractProp<EldraOrderPreview, 'discountCodes'>>;
381
434
  interface EldraOrderReadOptions {
382
435
  /** The one-time token returned when the order was created. Required unless the caller owns the order. */
383
436
  accessToken?: string;
@@ -422,8 +475,72 @@ interface EldraCartClient {
422
475
  quantity: number;
423
476
  }, context?: EldraRequestContext): Promise<EldraCart>;
424
477
  removeItem(cartId: string, itemId: string, context?: EldraRequestContext): Promise<EldraCart>;
478
+ /**
479
+ * Applies a discount code and answers the cart with `applied` (see {@link EldraDiscountResult}).
480
+ * Since contract 6.9.0 a discount code is **added** after the cart's codes instead of replacing
481
+ * one; each applies to what the codes before it left, at most 6 per cart, and two codes sit
482
+ * together only when both allow combining. Three refusals leave the cart exactly as it was, each a
483
+ * 409 `EldraHttpError` read from `errorId`, with its detail in `errors` (the problem's `errors`
484
+ * object): `CART_DISCOUNT_NOT_COMBINABLE` (the code and a code on the cart cannot both be used;
485
+ * `errors.blockingCode` is the code on the cart that blocks it, for "cannot be combined with
486
+ * SUMMER10"; remove it with `removeDiscountEntry` and apply again to change codes),
487
+ * `CART_DISCOUNT_CODES_LIMIT_REACHED` (the cart already holds `errors.limit` codes, 6) and
488
+ * `CART_DISCOUNT_ALREADY_APPLIED` (the cart already holds this code).
489
+ * Other refusals are unchanged: `CART_DISCOUNT_NOT_USABLE`, `CART_DISCOUNT_EXHAUSTED`,
490
+ * `CART_DISCOUNT_TOO_MANY_ATTEMPTS`.
491
+ */
425
492
  applyDiscount(cartId: string, code: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraDiscountResult>;
493
+ /**
494
+ * Removes every discount code on the cart (contract 6.9.0; before it, the one code); succeeds
495
+ * when none is applied. To take off one code, use `removeDiscountEntry`.
496
+ */
426
497
  removeDiscount(cartId: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCart>;
498
+ /**
499
+ * Adds a gift card (contract 6.4.0; since 6.8.0 it adds the card after the cart's other cards
500
+ * instead of replacing one, with no limit, and the discount code stays). A refusal is an
501
+ * `EldraHttpError` whose `errorId` names it: `CART_GIFT_CARD_INVALID`, `CART_GIFT_CARD_EXHAUSTED`,
502
+ * `CART_GIFT_CARD_ALREADY_APPLIED` (409, the cart already holds this card),
503
+ * `CART_DISCOUNT_TOO_MANY_ATTEMPTS`, `CART_GIFT_CARD_UNAVAILABLE`.
504
+ */
505
+ applyGiftCard(cartId: string, code: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCart>;
506
+ /**
507
+ * Applies a code from one field, as whichever it is (contract 6.7.0): a gift card or a discount
508
+ * code. The answer is the cart with `appliedAs` (`GIFT_CARD` or `DISCOUNT`). Since 6.8.0 a gift
509
+ * card is added after the cart's other cards; remove one with `removeGiftCardEntry`, or one
510
+ * discount code with `removeDiscountEntry`. A refusal is an `EldraHttpError` whose `errorId` names it:
511
+ * `CART_CODE_INVALID` (neither kind; the answer does not say which exists), `CART_CODE_REQUIRED`,
512
+ * `CART_GIFT_CARD_EXHAUSTED`, `CART_GIFT_CARD_ALREADY_APPLIED` (409, the cart already holds this
513
+ * card; the code is not then tried as a discount code), `CART_DISCOUNT_EXHAUSTED`,
514
+ * `CART_DISCOUNT_TOO_MANY_ATTEMPTS`, `CART_GIFT_CARD_UNAVAILABLE`.
515
+ *
516
+ * Since contract 6.9.0 a discount code is **added** after the cart's codes instead of replacing
517
+ * one; each applies to what the codes before it left, at most 6 per cart, and two codes sit
518
+ * together only when both allow combining. Three refusals leave the cart exactly as it was, each a
519
+ * 409 `EldraHttpError` read from `errorId`, with its detail in `errors` (the problem's `errors`
520
+ * object): `CART_DISCOUNT_NOT_COMBINABLE` (the code and a code on the cart cannot both be used;
521
+ * `errors.blockingCode` is the code on the cart that blocks it, for "cannot be combined with
522
+ * SUMMER10"; remove it with `removeDiscountEntry` and apply again to change codes),
523
+ * `CART_DISCOUNT_CODES_LIMIT_REACHED` (the cart already holds `errors.limit` codes, 6) and
524
+ * `CART_DISCOUNT_ALREADY_APPLIED` (the cart already holds this code).
525
+ */
526
+ applyCode(cartId: string, code: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCartAppliedCode>;
527
+ /**
528
+ * Removes every gift card on the cart (contract 6.8.0; before it, the one card); succeeds when
529
+ * none is applied. To take off one card, use `removeGiftCardEntry`.
530
+ */
531
+ removeGiftCard(cartId: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCart>;
532
+ /**
533
+ * Removes one gift card, the one whose `giftCards[].entryId` is `entryId` (contract 6.8.0), and
534
+ * answers the cart; the other cards keep their order. An `entryId` the cart does not hold answers
535
+ * the cart unchanged, so a double click does not fail.
536
+ */
537
+ removeGiftCardEntry(cartId: string, entryId: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCart>;
538
+ /**
539
+ * Removes one discount code, the one whose `discountCodes[].code` is `code` (any case; contract
540
+ * 6.9.0), and answers the cart; the other codes keep their order. A code the cart does not hold
541
+ * answers the cart unchanged, so a double click does not fail.
542
+ */
543
+ removeDiscountEntry(cartId: string, code: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCart>;
427
544
  }
428
545
  interface EldraOrdersClient {
429
546
  get(orderId: string, options?: EldraOrderReadOptions, context?: EldraRequestContext): Promise<EldraOrder>;
@@ -550,4 +667,4 @@ interface EldraFormsClient {
550
667
  /** `POST /site/v1/forms/subscriptions/unsubscribe?token=` (a GET of the link is only a page). */
551
668
  unsubscribe(token: string, context?: EldraRequestContext): Promise<EldraFormTokenResult>;
552
669
  }
553
- export { EldraOrganizationFeature as $, EldraFeature as A, EldraContractItem as At, EldraFormSubmitResult as B, clearCampaignAttribution as Bt, EldraCmsResolveEntryListResponse as C, EldraStockAvailability as Ct, EldraCollectionListOptions as D, RuntimeValue as Dt, EldraCollectionList as E, RuntimeEnv as Et, EldraFormField as F, EldraContractQuery as Ft, EldraInventoryClient as G, EldraCartSessionOptions as Gt, EldraFormsClient as H, readCampaignAttribution as Ht, EldraFormFieldOption as I, EldraContractResponse as It, EldraOrderLine as J, EldraOrderAccessTokens as Jt, EldraLocaleOptions as K, EldraKeyValueStorage as Kt, EldraFormFieldType as L, EldraCampaignAttribution as Lt, EldraFeatureClient as M, EldraContractPath as Mt, EldraFormActionKind as N, EldraContractPaths as Nt, EldraCollectionProductsOptions as O, EldraContract as Ot, EldraFormDefinition as P, EldraContractProp as Pt, EldraOrganizationDetails as Q, EldraFormLocalized as R, EldraCampaignAttributionOptions as Rt, EldraCmsResolveEntryListOptions as S, EldraSearchResponse as St, EldraCollection as T, EldraStockAvailabilityItem as Tt, EldraHttpClient as U, withdrawCampaignAttributionConsent as Ut, EldraFormTokenResult as V, grantCampaignAttributionConsent as Vt, EldraHttpRequest as W, EldraCartSession as Wt, EldraOrdersClient as X, createOrderAccessTokens as Xt, EldraOrderReadOptions as Y, createCartSession as Yt, EldraOrganizationCommerce as Z, EldraCmsEntryListEntry as _, EldraRecoveredBasketItem as _t, EldraCartTotals as a, EldraPlatformConfig as at, EldraCmsGetOptions as b, EldraRetryOptions as bt, EldraCatalogListProductsOptions as c, EldraProductExtensions as ct, EldraCheckoutUrlOptions as d, EldraProductMediaLink as dt, EldraOrganizationLocales as et, EldraClient as f, EldraProductOption as ft, EldraCmsEntryListDisplayMode as g, EldraRecoveredBasket as gt, EldraCmsEntryList as h, EldraProductVariant as ht, EldraCartItem as i, EldraPlatformClient as it, EldraFeatureCapabilities as j, EldraContractMethod as jt, EldraDiscountResult as k, EldraContractBody as kt, EldraCategory as l, EldraProductList as lt, EldraCmsClient as m, EldraProductThumbnail as mt, EldraCart as n, EldraPageMeta as nt, EldraCatalogClient as o, EldraPlatformReadOptions as ot, EldraClientOptions as p, EldraProductOptionValue as pt, EldraOrder as q, EldraOrderAccessTokenOptions as qt, EldraCartClient as r, EldraPaginated as rt, EldraCatalogGetProductOptions as s, EldraProductDetails as st, EldraAddCartItemInput as t, EldraOrganizationOptions as tt, EldraCheckoutClient as u, EldraProductListItem as ut, EldraCmsEntryListFilterCriterion as v, EldraRequestContext as vt, EldraCmsResolvedEntryList as w, EldraStockAvailabilityInput as wt, EldraCmsListOptions as x, EldraSearchOptions as xt, EldraCmsGetEntryByUniqueFieldOptions as y, EldraRequestOptions as yt, EldraFormSubmitInput as z, captureCampaignAttribution as zt };
670
+ export { EldraOrderDiscountCode as $, EldraCartSession as $t, EldraCollection as A, EldraSearchOptions as At, EldraFormField as B, EldraContractMethod as Bt, EldraCmsEntryListFilterCriterion as C, EldraProductThumbnail as Ct, EldraCmsResolveEntryListOptions as D, EldraRequestContext as Dt, EldraCmsListOptions as E, EldraRecoveredBasketItem as Et, EldraFeature as F, RuntimeEnv as Ft, EldraFormSubmitResult as G, EldraContractResponse as Gt, EldraFormFieldType as H, EldraContractPaths as Ht, EldraFeatureCapabilities as I, RuntimeValue as It, EldraHttpClient as J, captureCampaignAttribution as Jt, EldraFormTokenResult as K, EldraCampaignAttribution as Kt, EldraFeatureClient as L, EldraContract as Lt, EldraCollectionListOptions as M, EldraStockAvailability as Mt, EldraCollectionProductsOptions as N, EldraStockAvailabilityInput as Nt, EldraCmsResolveEntryListResponse as O, EldraRequestOptions as Ot, EldraDiscountResult as P, EldraStockAvailabilityItem as Pt, EldraOrder as Q, withdrawCampaignAttributionConsent as Qt, EldraFormActionKind as R, EldraContractBody as Rt, EldraCmsEntryListEntry as S, EldraProductOptionValue as St, EldraCmsGetOptions as T, EldraRecoveredBasket as Tt, EldraFormLocalized as U, EldraContractProp as Ut, EldraFormFieldOption as V, EldraContractPath as Vt, EldraFormSubmitInput as W, EldraContractQuery as Wt, EldraInventoryClient as X, grantCampaignAttributionConsent as Xt, EldraHttpRequest as Y, clearCampaignAttribution as Yt, EldraLocaleOptions as Z, readCampaignAttribution as Zt, EldraClient as _, EldraProductExtensions as _t, EldraCartClient as a, createOrderAccessTokens as an, EldraOrdersClient as at, EldraCmsEntryList as b, EldraProductMediaLink as bt, EldraCartGiftCardEntry as c, EldraOrganizationFeature as ct, EldraCatalogClient as d, EldraPageMeta as dt, EldraCartSessionOptions as en, EldraOrderLine as et, EldraCatalogGetProductOptions as f, EldraPaginated as ft, EldraCheckoutUrlOptions as g, EldraProductDetails as gt, EldraCheckoutClient as h, EldraPlatformReadOptions as ht, EldraCartAppliedCode as i, createCartSession as in, EldraOrderReadOptions as it, EldraCollectionList as j, EldraSearchResponse as jt, EldraCmsResolvedEntryList as k, EldraRetryOptions as kt, EldraCartItem as l, EldraOrganizationLocales as lt, EldraCategory as m, EldraPlatformConfig as mt, EldraBrand as n, EldraOrderAccessTokenOptions as nn, EldraOrderPreviewDiscountCode as nt, EldraCartDiscountCodeEntry as o, EldraOrganizationCommerce as ot, EldraCatalogListProductsOptions as p, EldraPlatformClient as pt, EldraFormsClient as q, EldraCampaignAttributionOptions as qt, EldraCart as r, EldraOrderAccessTokens as rn, EldraOrderPreviewGiftCard as rt, EldraCartGiftCard as s, EldraOrganizationDetails as st, EldraAddCartItemInput as t, EldraKeyValueStorage as tn, EldraOrderPreview as tt, EldraCartTotals as u, EldraOrganizationOptions as ut, EldraClientOptions as v, EldraProductList as vt, EldraCmsGetEntryByUniqueFieldOptions as w, EldraProductVariant as wt, EldraCmsEntryListDisplayMode as x, EldraProductOption as xt, EldraCmsClient as y, EldraProductListItem as yt, EldraFormDefinition as z, EldraContractItem as zt };
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Dt as RuntimeValue, Et as RuntimeEnv } from "./types-BN7Y-C9T.js";
1
+ import { Ft as RuntimeEnv, It as RuntimeValue } from "./types-D71CuE-g.js";
2
2
  import { Plugin } from "vite";
3
3
  export interface EldraVitePluginOptions {
4
4
  apiBaseUrl?: RuntimeValue<string>;
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./client-C7hMOeGA.js";
1
+ import "./client-DCs3cAQK.js";
2
2
  import { access, mkdir, writeFile } from "node:fs/promises";
3
3
  import { dirname, resolve } from "node:path";
4
4
  import openapiTS, { astToString } from "openapi-typescript";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eldrajs/sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Framework-free client for the Eldra Web Studio public storefront API: CMS, catalog, cart, checkout handoff, orders, inventory. Types generated from your gateway's OpenAPI document and CMS schemas at build time.",
5
5
  "keywords": [
6
6
  "cms",