@lana-commerce/core 14.0.0-alpha.22 → 14.0.0-alpha.24
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
|
@@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning][semantic versioning].
|
|
|
26
26
|
- Add "jobs" option to Mutator. Limits the number of simultaneously running jobs.
|
|
27
27
|
- Add "reviewsSummary" to "product" module.
|
|
28
28
|
- Add "wrapperClassName" to react/preact SixDigitInput component. Using this class wraps individual input DOM nodes with div nodes.
|
|
29
|
+
- New "cart" module config option: "initialCartCurrency".
|
|
29
30
|
|
|
30
31
|
### Patch Changes
|
|
31
32
|
|
package/cjs/modules/cart.js
CHANGED
|
@@ -169,7 +169,7 @@ function lineItemsToAPIMutation(lineItems) {
|
|
|
169
169
|
function createCart(config, init) {
|
|
170
170
|
let initialized = false;
|
|
171
171
|
let configWithJWT = Object.assign({}, config);
|
|
172
|
-
let savedCurrency = "";
|
|
172
|
+
let savedCurrency = config.initialCartCurrency || "";
|
|
173
173
|
const queue = new controlledQueue_js_1.ControlledQueue();
|
|
174
174
|
const setActivity = (0, effector_1.createEvent)();
|
|
175
175
|
const setLocked = (0, effector_1.createEvent)();
|
|
@@ -198,7 +198,7 @@ function createCart(config, init) {
|
|
|
198
198
|
.on(setAllState, (_, v) => v.discountCode);
|
|
199
199
|
const discountCodePending = (0, effector_1.restore)(setDiscountCodePending, false).on(setAllState, (_, v) => v.discountCodePending);
|
|
200
200
|
const discountCodeResult = (0, effector_1.restore)(setDiscountCodeResult, { kind: "ok" }).on(setAllState, (_, v) => v.discountCodeResult);
|
|
201
|
-
const currency = (0, effector_1.restore)(setCurrencyValue, "")
|
|
201
|
+
const currency = (0, effector_1.restore)(setCurrencyValue, config.initialCartCurrency || "")
|
|
202
202
|
.on(setCartData, (_, v) => (v === null || v === void 0 ? void 0 : v.cart.currency) || "")
|
|
203
203
|
.on(setAllState, (_, v) => v.currency);
|
|
204
204
|
let persistLoaded = false;
|
package/esm/modules/cart.js
CHANGED
|
@@ -166,7 +166,7 @@ function lineItemsToAPIMutation(lineItems) {
|
|
|
166
166
|
export function createCart(config, init) {
|
|
167
167
|
let initialized = false;
|
|
168
168
|
let configWithJWT = { ...config };
|
|
169
|
-
let savedCurrency = "";
|
|
169
|
+
let savedCurrency = config.initialCartCurrency || "";
|
|
170
170
|
const queue = new ControlledQueue();
|
|
171
171
|
const setActivity = createEvent();
|
|
172
172
|
const setLocked = createEvent();
|
|
@@ -195,7 +195,7 @@ export function createCart(config, init) {
|
|
|
195
195
|
.on(setAllState, (_, v) => v.discountCode);
|
|
196
196
|
const discountCodePending = restore(setDiscountCodePending, false).on(setAllState, (_, v) => v.discountCodePending);
|
|
197
197
|
const discountCodeResult = restore(setDiscountCodeResult, { kind: "ok" }).on(setAllState, (_, v) => v.discountCodeResult);
|
|
198
|
-
const currency = restore(setCurrencyValue, "")
|
|
198
|
+
const currency = restore(setCurrencyValue, config.initialCartCurrency || "")
|
|
199
199
|
.on(setCartData, (_, v) => v?.cart.currency || "")
|
|
200
200
|
.on(setAllState, (_, v) => v.currency);
|
|
201
201
|
let persistLoaded = false;
|
package/package.json
CHANGED
|
@@ -4731,6 +4731,8 @@ export interface Product {
|
|
|
4731
4731
|
tiered_pricing_mode: TieredPricingMode;
|
|
4732
4732
|
/** The name of the product */
|
|
4733
4733
|
title: string;
|
|
4734
|
+
/** Type of the product */
|
|
4735
|
+
type: ProductType;
|
|
4734
4736
|
/** The date and time when the product was last updated, RFC 3339 format */
|
|
4735
4737
|
updated_at: string;
|
|
4736
4738
|
/** Variants of the product */
|
|
@@ -4797,6 +4799,8 @@ export interface ProductCreate {
|
|
|
4797
4799
|
tiered_pricing_mode?: TieredPricingMode | null;
|
|
4798
4800
|
/** The name of the product */
|
|
4799
4801
|
title: string;
|
|
4802
|
+
/** Type of the product */
|
|
4803
|
+
type?: ProductType | null;
|
|
4800
4804
|
}
|
|
4801
4805
|
export interface ProductExpandableItems {
|
|
4802
4806
|
/** Generic array of expandable items */
|
|
@@ -4888,6 +4892,8 @@ export interface ProductModify {
|
|
|
4888
4892
|
tiered_pricing_mode?: TieredPricingMode | null;
|
|
4889
4893
|
/** The name of the product */
|
|
4890
4894
|
title?: string | null;
|
|
4895
|
+
/** Type of the product */
|
|
4896
|
+
type?: ProductType | null;
|
|
4891
4897
|
}
|
|
4892
4898
|
export interface ProductPage {
|
|
4893
4899
|
/** Total number of items in the collection */
|
|
@@ -5275,6 +5281,7 @@ export interface ProductSearchResult {
|
|
|
5275
5281
|
/** Minimum price for given search conditions */
|
|
5276
5282
|
price_min: number;
|
|
5277
5283
|
}
|
|
5284
|
+
export type ProductType = "bundle" | "digital_good" | "gift_card" | "physical" | "service";
|
|
5278
5285
|
export interface ProductVariant {
|
|
5279
5286
|
/** File attachment for digital good product variants */
|
|
5280
5287
|
attachment?: {
|
|
@@ -5424,8 +5431,6 @@ export interface ProductVariantCreate {
|
|
|
5424
5431
|
/** Specifies whether or not a tax is charged when the product variant is sold */
|
|
5425
5432
|
taxable?: boolean | null;
|
|
5426
5433
|
tiered_pricing?: TieredPricingCreate | null;
|
|
5427
|
-
/** Type of the variant */
|
|
5428
|
-
type?: VariantType | null;
|
|
5429
5434
|
/** Width of the product (in millimeters) used which can be used when calculating shipping costs */
|
|
5430
5435
|
width?: number | null;
|
|
5431
5436
|
}
|
|
@@ -5487,8 +5492,6 @@ export interface ProductVariantModify {
|
|
|
5487
5492
|
/** Specifies whether or not a tax is charged when the product variant is sold */
|
|
5488
5493
|
taxable?: boolean | null;
|
|
5489
5494
|
tiered_pricing?: TieredPricingCreate | null;
|
|
5490
|
-
/** Type of the variant */
|
|
5491
|
-
type?: VariantType | null;
|
|
5492
5495
|
/** Width of the product (in millimeters) used which can be used when calculating shipping costs */
|
|
5493
5496
|
width?: number | null;
|
|
5494
5497
|
}
|
|
@@ -12766,6 +12769,8 @@ export interface EndpointProductVariantsPriceHistory extends Endpoint<EndpointPr
|
|
|
12766
12769
|
/** Query price history of a customer group */
|
|
12767
12770
|
customer_group_id(v: string): EndpointProductVariantsPriceHistory;
|
|
12768
12771
|
from(v: string): EndpointProductVariantsPriceHistory;
|
|
12772
|
+
/** Query price history for a particular sales channel */
|
|
12773
|
+
sales_channel_id(v: string): EndpointProductVariantsPriceHistory;
|
|
12769
12774
|
/** Unique shop identifier. See also: [Unique Identifiers](/overview/concepts/unique-identifiers) */
|
|
12770
12775
|
shop_id(v: string): EndpointProductVariantsPriceHistory;
|
|
12771
12776
|
to(v: string): EndpointProductVariantsPriceHistory;
|
|
@@ -1152,6 +1152,7 @@ export interface ProductSearchOptionValueAgg {
|
|
|
1152
1152
|
/** ID of the option value */
|
|
1153
1153
|
name: string;
|
|
1154
1154
|
}
|
|
1155
|
+
export type ProductType = "bundle" | "digital_good" | "gift_card" | "physical" | "service";
|
|
1155
1156
|
export type ProductVariantsPageSortBy = "created_at";
|
|
1156
1157
|
export type ProductsPageSortBy = "created_at" | "updated_at";
|
|
1157
1158
|
export type ProfileImage = "auto" | "file";
|
|
@@ -2187,6 +2188,8 @@ export interface StorefrontProduct {
|
|
|
2187
2188
|
tiered_pricing_mode: TieredPricingMode;
|
|
2188
2189
|
/** The name of the product */
|
|
2189
2190
|
title: string;
|
|
2191
|
+
/** Type of the product */
|
|
2192
|
+
type: ProductType;
|
|
2190
2193
|
/** The date and time when the product was last updated, RFC 3339 format */
|
|
2191
2194
|
updated_at: string;
|
|
2192
2195
|
variants: Array<{
|
package/types/modules/cart.d.ts
CHANGED
|
@@ -90,6 +90,13 @@ export interface CartConfig<Variant> {
|
|
|
90
90
|
readonly jwt: Store<string>;
|
|
91
91
|
/** Current locale. Module will react to its changes. */
|
|
92
92
|
readonly locale: Store<string>;
|
|
93
|
+
/**
|
|
94
|
+
* Initial cart currency value. Setting it has similar effect to setCurrency(currency, "soft"). Except in some
|
|
95
|
+
* cases you cannot call setCurrency before cart is loaded, that is when cart is initialized with "kind" other
|
|
96
|
+
* than "new". But setting the default currency is often desirable as cart's currency might be the source of truth
|
|
97
|
+
* for currency parameter.
|
|
98
|
+
*/
|
|
99
|
+
readonly initialCartCurrency?: string;
|
|
93
100
|
/** Persist data across multiple browser tabs (good for multi-page applications). */
|
|
94
101
|
readonly persist?: {
|
|
95
102
|
/** Load data from persistent storage. */
|