@eldrajs/sdk 0.4.3 → 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,12 @@ 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.
|
|
12
18
|
- **Several discount codes on one cart (contract 6.9.0).** `applyDiscount` and `applyCode` (as `DISCOUNT`) now add
|
|
13
19
|
a code after the cart's codes instead of replacing it; each applies to what the codes before it left. Three new
|
|
14
20
|
409 refusals leave the cart as it was: `CART_DISCOUNT_NOT_COMBINABLE` (the code and one on the cart cannot be
|
|
@@ -17,8 +23,8 @@ platform repository.
|
|
|
17
23
|
body carries one. The cart carries `discountCodes` (`{code, amount}` in the order added; the type is
|
|
18
24
|
`EldraCartDiscountCodeEntry`); `cart.removeDiscountEntry(cartId, code, options?)` removes one code and
|
|
19
25
|
`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
|
|
21
|
-
|
|
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
|
|
22
28
|
`discountCode` are deprecated in the contract: it answers them for one more version. The contract fixtures are
|
|
23
29
|
regenerated from 6.9.0.
|
|
24
30
|
- **Several gift cards on one cart (contract 6.8.0).** A cart holds any number of gift cards beside its discount
|
|
@@ -26,8 +32,7 @@ platform repository.
|
|
|
26
32
|
again is 409 `CART_GIFT_CARD_ALREADY_APPLIED`. The cart carries `giftCards` (`{entryId, last4, balance, applied,
|
|
27
33
|
amountDue}` in the order applied; the type is `EldraCartGiftCardEntry`) and the cart-wide `amountDue`.
|
|
28
34
|
`cart.removeGiftCardEntry(cartId, entryId, options?)` removes one card; `removeGiftCard` now removes every card.
|
|
29
|
-
The
|
|
30
|
-
amount}`). The cart's `giftCard` and `EldraCartGiftCard` are deprecated: the contract answers them for one more
|
|
35
|
+
The cart's `giftCard` and `EldraCartGiftCard` are deprecated: the contract answers them for one more
|
|
31
36
|
version. The contract fixtures are regenerated from 6.8.0.
|
|
32
37
|
- **One code field (contract 6.7.0).** `cart.applyCode(cartId, code, options?)` applies a gift card or a discount
|
|
33
38
|
code from one input and answers the cart with `appliedAs` (`GIFT_CARD` or `DISCOUNT`); the type is
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as EldraOrderDiscountCode, $t as
|
|
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;
|
|
@@ -121,4 +121,4 @@ interface EldraResponsiveImage {
|
|
|
121
121
|
* as `src` and no `srcset`. Returns `undefined` when there is no URL to render.
|
|
122
122
|
*/
|
|
123
123
|
export declare function responsiveImage(source: EldraImageSource, options: EldraResponsiveImageOptions): EldraResponsiveImage | undefined;
|
|
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
|
|
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 };
|
|
@@ -419,18 +419,6 @@ type EldraOrderLine = EldraContractItem<EldraContractProp<EldraOrder, 'orderLine
|
|
|
419
419
|
type EldraOrderDiscountCode = EldraContractItem<EldraContractProp<EldraOrder, 'discountCodes'>>;
|
|
420
420
|
type EldraRecoveredBasket = EldraContractResponse<'/order/v1/recover', 'post'>;
|
|
421
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'>>;
|
|
434
422
|
interface EldraOrderReadOptions {
|
|
435
423
|
/** The one-time token returned when the order was created. Required unless the caller owns the order. */
|
|
436
424
|
accessToken?: string;
|
|
@@ -667,4 +655,4 @@ interface EldraFormsClient {
|
|
|
667
655
|
/** `POST /site/v1/forms/subscriptions/unsubscribe?token=` (a GET of the link is only a page). */
|
|
668
656
|
unsubscribe(token: string, context?: EldraRequestContext): Promise<EldraFormTokenResult>;
|
|
669
657
|
}
|
|
670
|
-
export { EldraOrderDiscountCode as $,
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eldrajs/sdk",
|
|
3
|
-
"version": "0.
|
|
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",
|