@eldrajs/sdk 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,50 @@ platform repository.
9
9
 
10
10
  ## Unreleased
11
11
 
12
+ - **Removed: the checkout summary types.** `EldraOrderPreview`, `EldraOrderPreviewGiftCard` and
13
+ `EldraOrderPreviewDiscountCode` are no longer exported. They typed `POST /order/v1/preview`, which the SDK
14
+ never had a method for: delivery choice, the order summary, order creation and payment belong to the hosted
15
+ checkout, and the SDK stops at the cart and the handoff to it (`checkout.url`). A storefront reads a cart with
16
+ its codes and cards applied from `cart.get` (`discountCodes`, `giftCards`, `totals`, `amountDue`). If you
17
+ imported one of these types, declare the shape you read locally.
18
+ - **Several discount codes on one cart (contract 6.9.0).** `applyDiscount` and `applyCode` (as `DISCOUNT`) now add
19
+ a code after the cart's codes instead of replacing it; each applies to what the codes before it left. Three new
20
+ 409 refusals leave the cart as it was: `CART_DISCOUNT_NOT_COMBINABLE` (the code and one on the cart cannot be
21
+ combined; `errors.blockingCode` names the one on the cart), `CART_DISCOUNT_CODES_LIMIT_REACHED` (`errors.limit`,
22
+ 6) and `CART_DISCOUNT_ALREADY_APPLIED`. `EldraHttpError` gains `errors`, the problem's `errors` object when the
23
+ body carries one. The cart carries `discountCodes` (`{code, amount}` in the order added; the type is
24
+ `EldraCartDiscountCodeEntry`); `cart.removeDiscountEntry(cartId, code, options?)` removes one code and
25
+ `removeDiscount` now removes every code. `applyDiscount`'s `applied` reads `discountCodes` (falling back to
26
+ `discountCode` from an older gateway), so a second code reports `true`. The order read
27
+ carries `discountCodes` (`EldraOrderDiscountCode`). The cart's and the order's
28
+ `discountCode` are deprecated in the contract: it answers them for one more version. The contract fixtures are
29
+ regenerated from 6.9.0.
30
+ - **Several gift cards on one cart (contract 6.8.0).** A cart holds any number of gift cards beside its discount
31
+ code: `applyGiftCard` and `applyCode` now add a card after the others instead of replacing one, and the same card
32
+ again is 409 `CART_GIFT_CARD_ALREADY_APPLIED`. The cart carries `giftCards` (`{entryId, last4, balance, applied,
33
+ amountDue}` in the order applied; the type is `EldraCartGiftCardEntry`) and the cart-wide `amountDue`.
34
+ `cart.removeGiftCardEntry(cartId, entryId, options?)` removes one card; `removeGiftCard` now removes every card.
35
+ The cart's `giftCard` and `EldraCartGiftCard` are deprecated: the contract answers them for one more
36
+ version. The contract fixtures are regenerated from 6.8.0.
37
+ - **One code field (contract 6.7.0).** `cart.applyCode(cartId, code, options?)` applies a gift card or a discount
38
+ code from one input and answers the cart with `appliedAs` (`GIFT_CARD` or `DISCOUNT`); the type is
39
+ `EldraCartAppliedCode`. A code that is neither is 404 `CART_CODE_INVALID`. `applyDiscount` and
40
+ `applyGiftCard` stay.
41
+ - **The shared SEO value on catalog reads (contract 6.6.0).** A product's, category's, collection's and brand's
42
+ `seo` now carries `canonicalUrl`, `ogTitle`, `ogDescription`, `imageAssetId`, `imageUrl` and `noindex` beside
43
+ `title` and `description`: the shape a CMS entry's `seo` field has. Types only; the contract fixtures are
44
+ regenerated from 6.6.0. A product card (the product list and a collection's products) carries `seo` with
45
+ `canonicalUrl` and `noindex` only, which the theme's sitemap reads.
46
+ - **Brands and gift cards (contract 6.4.0).** `catalog.listBrands(options?)` reads the shop's active brands
47
+ (`[]` for none) and `catalog.getBrand(slug, options?)` one of them (404 `CATALOG_BRAND_NOT_FOUND` otherwise);
48
+ `cart.applyGiftCard(cartId, code, options?)` and `cart.removeGiftCard(cartId, options?)` put a gift card on the
49
+ cart and take it off, answering the cart (its `giftCard {last4, balance, applied, amountDue}`). A refused card
50
+ is an `EldraHttpError` with the contract's `errorId` (`CART_GIFT_CARD_INVALID`, `CART_GIFT_CARD_EXHAUSTED`,
51
+ `CART_DISCOUNT_TOO_MANY_ATTEMPTS`, `CART_GIFT_CARD_UNAVAILABLE`). New types `EldraBrand` and `EldraCartGiftCard`.
52
+ A product's `brand` and `seo`, a variant's `regularPrice`, `priorPrice` and `discount`, a card's `priorPrice`
53
+ and `discountLabel`, a cart line's `salePrice` and the list filter `brandId` need nothing new: they come from
54
+ the generated contract. Needs a gateway on contract 6.4.0 or later.
55
+
12
56
  - **Typed product extensions (WS-439, contract 6.1.0).** `EldraProductDetails.extensions` is keyed by
13
57
  the apiId of each CMS schema that extends products, and its type is the new, initially empty
14
58
  `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 EldraOrderAccessTokenOptions, A as EldraCollection, At as EldraStockAvailabilityInput, B as EldraFormField, Bt as EldraContractProp, C as EldraCmsEntryListFilterCriterion, Ct as EldraRecoveredBasketItem, D as EldraCmsResolveEntryListOptions, Dt as EldraSearchOptions, E as EldraCmsListOptions, Et as EldraRetryOptions, F as EldraFeature, Ft as EldraContractBody, G as EldraFormSubmitResult, Gt as captureCampaignAttribution, H as EldraFormFieldType, Ht as EldraContractResponse, I as EldraFeatureCapabilities, It as EldraContractItem, J as EldraHttpClient, Jt as readCampaignAttribution, K as EldraFormTokenResult, Kt as clearCampaignAttribution, L as EldraFeatureClient, Lt as EldraContractMethod, M as EldraCollectionListOptions, Mt as RuntimeEnv, N as EldraCollectionProductsOptions, Nt as RuntimeValue, O as EldraCmsResolveEntryListResponse, Ot as EldraSearchResponse, P as EldraDiscountResult, Pt as EldraContract, Q as EldraOrder, Qt as EldraKeyValueStorage, R as EldraFormActionKind, Rt as EldraContractPath, S as EldraCmsEntryListEntry, St as EldraRecoveredBasket, T as EldraCmsGetOptions, Tt as EldraRequestOptions, U as EldraFormLocalized, Ut as EldraCampaignAttribution, V as EldraFormFieldOption, Vt as EldraContractQuery, W as EldraFormSubmitInput, Wt as EldraCampaignAttributionOptions, X as EldraInventoryClient, Xt as EldraCartSession, Y as EldraHttpRequest, Yt as withdrawCampaignAttributionConsent, Z as EldraLocaleOptions, Zt as EldraCartSessionOptions, _ as EldraClient, _t as EldraProductMediaLink, a as EldraCartClient, at as EldraOrganizationFeature, b as EldraCmsEntryList, bt as EldraProductThumbnail, c as EldraCartGiftCardEntry, ct as EldraPageMeta, d as EldraCatalogClient, dt as EldraPlatformConfig, en as EldraOrderAccessTokens, et as EldraOrderLine, f as EldraCatalogGetProductOptions, ft as EldraPlatformReadOptions, g as EldraCheckoutUrlOptions, gt as EldraProductListItem, h as EldraCheckoutClient, ht as EldraProductList, i as EldraCartAppliedCode, it as EldraOrganizationDetails, j as EldraCollectionList, jt as EldraStockAvailabilityItem, k as EldraCmsResolvedEntryList, kt as EldraStockAvailability, l as EldraCartItem, lt as EldraPaginated, m as EldraCategory, mt as EldraProductExtensions, n as EldraBrand, nn as createOrderAccessTokens, nt as EldraOrdersClient, o as EldraCartDiscountCodeEntry, ot as EldraOrganizationLocales, p as EldraCatalogListProductsOptions, pt as EldraProductDetails, q as EldraFormsClient, qt as grantCampaignAttributionConsent, r as EldraCart, rt as EldraOrganizationCommerce, s as EldraCartGiftCard, st as EldraOrganizationOptions, t as EldraAddCartItemInput, tn as createCartSession, tt as EldraOrderReadOptions, u as EldraCartTotals, ut as EldraPlatformClient, v as EldraClientOptions, vt as EldraProductOption, w as EldraCmsGetEntryByUniqueFieldOptions, wt as EldraRequestContext, x as EldraCmsEntryListDisplayMode, xt as EldraProductVariant, y as EldraCmsClient, yt as EldraProductOptionValue, z as EldraFormDefinition, zt as EldraContractPaths } from "./types-r819aFGS.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 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,19 +367,56 @@ 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'>>;
381
422
  interface EldraOrderReadOptions {
@@ -422,8 +463,72 @@ interface EldraCartClient {
422
463
  quantity: number;
423
464
  }, context?: EldraRequestContext): Promise<EldraCart>;
424
465
  removeItem(cartId: string, itemId: string, context?: EldraRequestContext): Promise<EldraCart>;
466
+ /**
467
+ * Applies a discount code and answers the cart with `applied` (see {@link EldraDiscountResult}).
468
+ * Since contract 6.9.0 a discount code is **added** after the cart's codes instead of replacing
469
+ * one; each applies to what the codes before it left, at most 6 per cart, and two codes sit
470
+ * together only when both allow combining. Three refusals leave the cart exactly as it was, each a
471
+ * 409 `EldraHttpError` read from `errorId`, with its detail in `errors` (the problem's `errors`
472
+ * object): `CART_DISCOUNT_NOT_COMBINABLE` (the code and a code on the cart cannot both be used;
473
+ * `errors.blockingCode` is the code on the cart that blocks it, for "cannot be combined with
474
+ * SUMMER10"; remove it with `removeDiscountEntry` and apply again to change codes),
475
+ * `CART_DISCOUNT_CODES_LIMIT_REACHED` (the cart already holds `errors.limit` codes, 6) and
476
+ * `CART_DISCOUNT_ALREADY_APPLIED` (the cart already holds this code).
477
+ * Other refusals are unchanged: `CART_DISCOUNT_NOT_USABLE`, `CART_DISCOUNT_EXHAUSTED`,
478
+ * `CART_DISCOUNT_TOO_MANY_ATTEMPTS`.
479
+ */
425
480
  applyDiscount(cartId: string, code: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraDiscountResult>;
481
+ /**
482
+ * Removes every discount code on the cart (contract 6.9.0; before it, the one code); succeeds
483
+ * when none is applied. To take off one code, use `removeDiscountEntry`.
484
+ */
426
485
  removeDiscount(cartId: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCart>;
486
+ /**
487
+ * Adds a gift card (contract 6.4.0; since 6.8.0 it adds the card after the cart's other cards
488
+ * instead of replacing one, with no limit, and the discount code stays). A refusal is an
489
+ * `EldraHttpError` whose `errorId` names it: `CART_GIFT_CARD_INVALID`, `CART_GIFT_CARD_EXHAUSTED`,
490
+ * `CART_GIFT_CARD_ALREADY_APPLIED` (409, the cart already holds this card),
491
+ * `CART_DISCOUNT_TOO_MANY_ATTEMPTS`, `CART_GIFT_CARD_UNAVAILABLE`.
492
+ */
493
+ applyGiftCard(cartId: string, code: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCart>;
494
+ /**
495
+ * Applies a code from one field, as whichever it is (contract 6.7.0): a gift card or a discount
496
+ * code. The answer is the cart with `appliedAs` (`GIFT_CARD` or `DISCOUNT`). Since 6.8.0 a gift
497
+ * card is added after the cart's other cards; remove one with `removeGiftCardEntry`, or one
498
+ * discount code with `removeDiscountEntry`. A refusal is an `EldraHttpError` whose `errorId` names it:
499
+ * `CART_CODE_INVALID` (neither kind; the answer does not say which exists), `CART_CODE_REQUIRED`,
500
+ * `CART_GIFT_CARD_EXHAUSTED`, `CART_GIFT_CARD_ALREADY_APPLIED` (409, the cart already holds this
501
+ * card; the code is not then tried as a discount code), `CART_DISCOUNT_EXHAUSTED`,
502
+ * `CART_DISCOUNT_TOO_MANY_ATTEMPTS`, `CART_GIFT_CARD_UNAVAILABLE`.
503
+ *
504
+ * Since contract 6.9.0 a discount code is **added** after the cart's codes instead of replacing
505
+ * one; each applies to what the codes before it left, at most 6 per cart, and two codes sit
506
+ * together only when both allow combining. Three refusals leave the cart exactly as it was, each a
507
+ * 409 `EldraHttpError` read from `errorId`, with its detail in `errors` (the problem's `errors`
508
+ * object): `CART_DISCOUNT_NOT_COMBINABLE` (the code and a code on the cart cannot both be used;
509
+ * `errors.blockingCode` is the code on the cart that blocks it, for "cannot be combined with
510
+ * SUMMER10"; remove it with `removeDiscountEntry` and apply again to change codes),
511
+ * `CART_DISCOUNT_CODES_LIMIT_REACHED` (the cart already holds `errors.limit` codes, 6) and
512
+ * `CART_DISCOUNT_ALREADY_APPLIED` (the cart already holds this code).
513
+ */
514
+ applyCode(cartId: string, code: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCartAppliedCode>;
515
+ /**
516
+ * Removes every gift card on the cart (contract 6.8.0; before it, the one card); succeeds when
517
+ * none is applied. To take off one card, use `removeGiftCardEntry`.
518
+ */
519
+ removeGiftCard(cartId: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCart>;
520
+ /**
521
+ * Removes one gift card, the one whose `giftCards[].entryId` is `entryId` (contract 6.8.0), and
522
+ * answers the cart; the other cards keep their order. An `entryId` the cart does not hold answers
523
+ * the cart unchanged, so a double click does not fail.
524
+ */
525
+ removeGiftCardEntry(cartId: string, entryId: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCart>;
526
+ /**
527
+ * Removes one discount code, the one whose `discountCodes[].code` is `code` (any case; contract
528
+ * 6.9.0), and answers the cart; the other codes keep their order. A code the cart does not hold
529
+ * answers the cart unchanged, so a double click does not fail.
530
+ */
531
+ removeDiscountEntry(cartId: string, code: string, options?: EldraLocaleOptions, context?: EldraRequestContext): Promise<EldraCart>;
427
532
  }
428
533
  interface EldraOrdersClient {
429
534
  get(orderId: string, options?: EldraOrderReadOptions, context?: EldraRequestContext): Promise<EldraOrder>;
@@ -550,4 +655,4 @@ interface EldraFormsClient {
550
655
  /** `POST /site/v1/forms/subscriptions/unsubscribe?token=` (a GET of the link is only a page). */
551
656
  unsubscribe(token: string, context?: EldraRequestContext): Promise<EldraFormTokenResult>;
552
657
  }
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 };
658
+ export { EldraOrderDiscountCode as $, EldraOrderAccessTokenOptions as $t, EldraCollection as A, EldraStockAvailabilityInput as At, EldraFormField as B, EldraContractProp as Bt, EldraCmsEntryListFilterCriterion as C, EldraRecoveredBasketItem as Ct, EldraCmsResolveEntryListOptions as D, EldraSearchOptions as Dt, EldraCmsListOptions as E, EldraRetryOptions as Et, EldraFeature as F, EldraContractBody as Ft, EldraFormSubmitResult as G, captureCampaignAttribution as Gt, EldraFormFieldType as H, EldraContractResponse as Ht, EldraFeatureCapabilities as I, EldraContractItem as It, EldraHttpClient as J, readCampaignAttribution as Jt, EldraFormTokenResult as K, clearCampaignAttribution as Kt, EldraFeatureClient as L, EldraContractMethod as Lt, EldraCollectionListOptions as M, RuntimeEnv as Mt, EldraCollectionProductsOptions as N, RuntimeValue as Nt, EldraCmsResolveEntryListResponse as O, EldraSearchResponse as Ot, EldraDiscountResult as P, EldraContract as Pt, EldraOrder as Q, EldraKeyValueStorage as Qt, EldraFormActionKind as R, EldraContractPath as Rt, EldraCmsEntryListEntry as S, EldraRecoveredBasket as St, EldraCmsGetOptions as T, EldraRequestOptions as Tt, EldraFormLocalized as U, EldraCampaignAttribution as Ut, EldraFormFieldOption as V, EldraContractQuery as Vt, EldraFormSubmitInput as W, EldraCampaignAttributionOptions as Wt, EldraInventoryClient as X, EldraCartSession as Xt, EldraHttpRequest as Y, withdrawCampaignAttributionConsent as Yt, EldraLocaleOptions as Z, EldraCartSessionOptions as Zt, EldraClient as _, EldraProductMediaLink as _t, EldraCartClient as a, EldraOrganizationFeature as at, EldraCmsEntryList as b, EldraProductThumbnail as bt, EldraCartGiftCardEntry as c, EldraPageMeta as ct, EldraCatalogClient as d, EldraPlatformConfig as dt, EldraOrderAccessTokens as en, EldraOrderLine as et, EldraCatalogGetProductOptions as f, EldraPlatformReadOptions as ft, EldraCheckoutUrlOptions as g, EldraProductListItem as gt, EldraCheckoutClient as h, EldraProductList as ht, EldraCartAppliedCode as i, EldraOrganizationDetails as it, EldraCollectionList as j, EldraStockAvailabilityItem as jt, EldraCmsResolvedEntryList as k, EldraStockAvailability as kt, EldraCartItem as l, EldraPaginated as lt, EldraCategory as m, EldraProductExtensions as mt, EldraBrand as n, createOrderAccessTokens as nn, EldraOrdersClient as nt, EldraCartDiscountCodeEntry as o, EldraOrganizationLocales as ot, EldraCatalogListProductsOptions as p, EldraProductDetails as pt, EldraFormsClient as q, grantCampaignAttributionConsent as qt, EldraCart as r, EldraOrganizationCommerce as rt, EldraCartGiftCard as s, EldraOrganizationOptions as st, EldraAddCartItemInput as t, createCartSession as tn, EldraOrderReadOptions as tt, EldraCartTotals as u, EldraPlatformClient as ut, EldraClientOptions as v, EldraProductOption as vt, EldraCmsGetEntryByUniqueFieldOptions as w, EldraRequestContext as wt, EldraCmsEntryListDisplayMode as x, EldraProductVariant as xt, EldraCmsClient as y, EldraProductOptionValue as yt, EldraFormDefinition as z, EldraContractPaths 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 { Mt as RuntimeEnv, Nt as RuntimeValue } from "./types-r819aFGS.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.5.0",
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",