@liquidcommerce/elements-sdk 2.6.0-beta.136 → 2.6.0-beta.137
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/dist/index.checkout.esm.js +9172 -9121
- package/dist/index.esm.js +14982 -14900
- package/dist/types/core/store/interfaces/cart.interface.d.ts +2 -1
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +2 -0
- package/dist/types/interfaces/api/cart.interface.d.ts +7 -0
- package/dist/types/interfaces/api/checkout.interface.d.ts +2 -1
- package/dist/types/modules/cart/components/cart-footer.component.d.ts +3 -0
- package/dist/types/modules/checkout/checkout.commands.d.ts +1 -0
- package/dist/types/utils/discounts.d.ts +2 -0
- package/docs/v1/api/actions/checkout-actions.md +9 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ICartEvent, ICartFulfillment, ICartItemAttributes, ICartPromoCode, ICartRetailer } from '@/interfaces/api/cart.interface';
|
|
1
|
+
import type { IAutomaticDiscount, ICartEvent, ICartFulfillment, ICartItemAttributes, ICartPromoCode, ICartRetailer } from '@/interfaces/api/cart.interface';
|
|
2
2
|
export interface ICartItemStore {
|
|
3
3
|
id: string;
|
|
4
4
|
variantId: string;
|
|
@@ -47,6 +47,7 @@ export interface ICartStore {
|
|
|
47
47
|
fulfillments: Record<string, ICartFulfillmentStore>;
|
|
48
48
|
retailers: Record<string, ICartRetailerStore>;
|
|
49
49
|
promoCode: ICartPromoCode | null;
|
|
50
|
+
automaticDiscounts: IAutomaticDiscount[];
|
|
50
51
|
events: ICartEvent[];
|
|
51
52
|
loading: boolean;
|
|
52
53
|
error: string | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IAutomaticDiscount } from '@/interfaces/api/cart.interface';
|
|
1
2
|
import type { ICheckoutAmounts, ICheckoutBilling, ICheckoutCustomer, ICheckoutEvent, ICheckoutFulfillment, ICheckoutFulfillmentMethod, ICheckoutGiftCard, ICheckoutGiftRecipient, ICheckoutItem, ICheckoutMarketingPreferences, ICheckoutPaymentConfirm, ICheckoutPaymentSession, ICheckoutPresale, ICheckoutPromoCode, ICheckoutRetailer, ICheckoutShippingAddress } from '@/interfaces/api/checkout.interface';
|
|
2
3
|
export type DeliveryWindowLapse = 'expired' | 'unavailable' | 'required';
|
|
3
4
|
export interface ICheckoutItemStore extends ICheckoutItem {
|
|
@@ -61,6 +62,7 @@ export interface ICheckoutStore {
|
|
|
61
62
|
express: ICheckoutExpressStore;
|
|
62
63
|
shippingAddress: ICheckoutShippingAddress;
|
|
63
64
|
promoCode: ICheckoutPromoCode | null;
|
|
65
|
+
automaticDiscounts: IAutomaticDiscount[];
|
|
64
66
|
giftCards: ICheckoutGiftCard[];
|
|
65
67
|
itemsQuantity: number;
|
|
66
68
|
items: Record<string, ICheckoutItemStore>;
|
|
@@ -77,6 +77,12 @@ export interface ICartEvent {
|
|
|
77
77
|
message: string;
|
|
78
78
|
level: CartEventLevel;
|
|
79
79
|
}
|
|
80
|
+
export interface IAutomaticDiscount {
|
|
81
|
+
code: string;
|
|
82
|
+
title: string;
|
|
83
|
+
target: 'products' | 'fulfillment';
|
|
84
|
+
discount: number;
|
|
85
|
+
}
|
|
80
86
|
export interface ICart {
|
|
81
87
|
id: string;
|
|
82
88
|
subtotal: number;
|
|
@@ -84,6 +90,7 @@ export interface ICart {
|
|
|
84
90
|
items: Record<string, ICartItem>;
|
|
85
91
|
retailers: Record<string, ICartRetailer>;
|
|
86
92
|
promoCode: ICartPromoCode | null;
|
|
93
|
+
automaticDiscounts?: IAutomaticDiscount[];
|
|
87
94
|
events: ICartEvent[];
|
|
88
95
|
}
|
|
89
96
|
export interface ICartItemEngraving {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CheckoutEventLevel, CheckoutEventType, FulfillmentType } from '@/enums';
|
|
2
2
|
import type { IAddressAddress, IAddressCoordinates, ILocation } from '@/interfaces/api/address.interface';
|
|
3
|
-
import type { ICart, ICartUpdateItem } from '@/interfaces/api/cart.interface';
|
|
3
|
+
import type { IAutomaticDiscount, ICart, ICartUpdateItem } from '@/interfaces/api/cart.interface';
|
|
4
4
|
import type { CheckoutDeliveryScheduling, CheckoutDeliverySelection, DeliveryAvailability } from '@/interfaces/api/delivery.interface';
|
|
5
5
|
import type { IProductPresale } from '@/interfaces/api/product.interface';
|
|
6
6
|
export interface ICheckoutComplete {
|
|
@@ -267,6 +267,7 @@ export interface ICheckoutPrepare {
|
|
|
267
267
|
shippingAddress: ICheckoutShippingAddress;
|
|
268
268
|
billingAddress: ICheckoutBilling;
|
|
269
269
|
promoCode: ICheckoutPromoCode | null;
|
|
270
|
+
automaticDiscounts?: IAutomaticDiscount[];
|
|
270
271
|
amounts: ICheckoutAmounts;
|
|
271
272
|
giftCards: ICheckoutGiftCard[];
|
|
272
273
|
presale: ICheckoutPresale | null;
|
|
@@ -7,6 +7,8 @@ export declare class CartFooterComponent extends BaseComponent<ICartFooterCompon
|
|
|
7
7
|
get hostClasses(): string[];
|
|
8
8
|
private subtotalText;
|
|
9
9
|
private subtotalPrice;
|
|
10
|
+
private itemsPrice;
|
|
11
|
+
private automaticDiscountRows;
|
|
10
12
|
private checkoutButton;
|
|
11
13
|
constructor();
|
|
12
14
|
onStoreWatch(changes: IOnStoreChanged[]): void;
|
|
@@ -15,6 +17,7 @@ export declare class CartFooterComponent extends BaseComponent<ICartFooterCompon
|
|
|
15
17
|
private shouldDisableCheckout;
|
|
16
18
|
private updateCheckoutButtonState;
|
|
17
19
|
private updateSubtotalItemsCount;
|
|
20
|
+
private renderAutomaticDiscounts;
|
|
18
21
|
private handleCheckout;
|
|
19
22
|
protected template(): HTMLElement[];
|
|
20
23
|
}
|
|
@@ -152,6 +152,7 @@ export declare class CheckoutCommands extends BaseCommand {
|
|
|
152
152
|
checkoutComplete(options?: {
|
|
153
153
|
expressPaymentIntentId?: string;
|
|
154
154
|
}): Promise<void>;
|
|
155
|
+
private discountUpdates;
|
|
155
156
|
private updateStoreFromCheckoutResponse;
|
|
156
157
|
private getDeliveryMethodLocation;
|
|
157
158
|
loadDeliveryMethods(): Promise<void>;
|
|
@@ -156,6 +156,15 @@ interface ICheckoutPrepare {
|
|
|
156
156
|
items: Record<string /* cart item ID */, ICheckoutItem>;
|
|
157
157
|
retailers: Record<string /* retailer ID */, ICheckoutRetailer>;
|
|
158
158
|
events: ICheckoutEvent[];
|
|
159
|
+
automaticDiscounts?: IAutomaticDiscount[];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// A discount the store applied without a code being typed. Its savings are already in `amounts`.
|
|
163
|
+
interface IAutomaticDiscount {
|
|
164
|
+
code: string;
|
|
165
|
+
title: string;
|
|
166
|
+
target: 'products' | 'fulfillment';
|
|
167
|
+
discount: number; // cents
|
|
159
168
|
}
|
|
160
169
|
```
|
|
161
170
|
|
package/package.json
CHANGED