@liquidcommerce/elements-sdk 2.6.0-beta.132 → 2.6.0-beta.134

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.
@@ -4,6 +4,7 @@ export interface IApiErrorDetail {
4
4
  code?: string;
5
5
  retailerId?: string;
6
6
  fulfillmentId?: string;
7
+ closedNow?: boolean;
7
8
  }
8
9
  export interface ApiError {
9
10
  status: number;
@@ -41,6 +41,7 @@ export declare class CheckoutCommands extends BaseCommand {
41
41
  private freshCart;
42
42
  private dropDeliveryScheduling;
43
43
  private lapsedWindowGroupIds;
44
+ private scheduledGroupIds;
44
45
  private forgetDeliveryWindow;
45
46
  private assertDeliverySlotChoosable;
46
47
  private responseFulfillments;
@@ -18,8 +18,10 @@ export declare const DELIVERY_SCHEDULING_UNAVAILABLE_MESSAGE = "Scheduled delive
18
18
  export declare const MULTIPLE_FULFILLMENT_OPTIONS_PER_STORE_CODE = "multiple_fulfillment_options_per_store";
19
19
  export declare const MULTIPLE_FULFILLMENT_OPTIONS_PER_STORE_MESSAGE = "Scheduled delivery cannot be combined with another delivery method from the same store. Choose ASAP delivery, or use one delivery method for all items from this store.";
20
20
  export declare const CLOSED_STORE_MULTIPLE_FULFILLMENT_OPTIONS_MESSAGE = "This store is closed now. Use one delivery method for all items from this store.";
21
- export declare function splitStoreRefusalMessage(store: Pick<StoreService, 'get'>): string;
22
- export declare function freshCartSplitStoreRefusalMessage(cart: Pick<ICart, 'retailers'>): string;
21
+ export declare function splitStoreMessageFromStore(store: Pick<StoreService, 'get'>): string;
22
+ export declare function splitStoreMessageFromError(error: Pick<ApiError, 'errors'> | null | undefined): string | null;
23
+ export declare function splitStoreRefusalText(error: Pick<ApiError, 'errors'> | null | undefined, store: Pick<StoreService, 'get'>): string;
24
+ export declare function splitStoreMessageFromCart(cart: Pick<ICart, 'retailers'>): string;
23
25
  export declare function expiredDeliveryFulfillmentIds(store: Pick<StoreService, 'get'>): string[];
24
26
  export declare function deliveryWindowLapseOf(error: Pick<ApiError, 'errors'> | null | undefined): DeliveryWindowLapse;
25
27
  export type DeliveryWindowLapseText = 'message' | 'label';
@@ -41,9 +43,8 @@ export declare function hasDeliveryScheduling(fulfillments: Record<string, IChec
41
43
  export declare function retailerOfFulfillment(retailers: Record<string, ICheckoutRetailer> | null | undefined, fulfillmentId: string): ICheckoutRetailer | undefined;
42
44
  export declare function deliveryWindowNeededMessage(store: Pick<StoreService, 'get'>, fulfillmentIds: string[]): string;
43
45
  export declare function hasSeveralDeliveryGroups(fulfillments: Record<string, ICheckoutFulfillment> | null | undefined): boolean;
44
- export declare function deliveryTimeZone(timezone: string | null | undefined): string;
46
+ export declare function deliveryTimeZone(): string;
45
47
  export declare function deliveryDateTimeFormat(timezone: string, options: Omit<Intl.DateTimeFormatOptions, 'timeZone'>): Intl.DateTimeFormat;
46
- export declare function deliveryDateLabel(slot: DeliverySlot, timezone: string): string;
47
48
  export declare function deliveryTimeZoneName(timezone: string, style?: 'short' | 'long'): string;
48
49
  export declare function deliveryTimeLabel(slot: DeliverySlot, timezone: string): string;
49
50
  export declare function deliveryWindowLabel(slot: DeliverySlot, timezone: string): string;
@@ -67,6 +68,8 @@ export declare function isDeliveryPurchasable(fulfillment: FulfillmentAvailabili
67
68
  export declare function isOnDemandUnpurchasable(type: FulfillmentType, fulfillment: FulfillmentAvailability): boolean;
68
69
  export declare function preferredOnDemandFulfillment<T extends FulfillmentAvailability>(fulfillments: T[], now?: number): T | undefined;
69
70
  export declare function nextArrivalLabel(fulfillment: SchedulingAvailability, now?: number): string | null;
71
+ export declare const DELIVERY_TEXT_LINE_BREAK = "\n";
70
72
  export declare function scheduleDeliveryText(fulfillment: SchedulingAvailability, now?: number): string | null;
73
+ export declare function spokenDeliveryText(text: string): string;
71
74
  export declare function resolveDeliverySlot(scheduling: CheckoutDeliveryScheduling | undefined, advertised: DeliverySlot, now?: number): DeliverySlot | null;
72
75
  export {};
@@ -589,7 +589,7 @@ export interface DeliveryAvailability {
589
589
  status: 'available' | 'unavailable'; // available when the store can deliver now or offers windows
590
590
  canDeliverNow: boolean;
591
591
  canSchedule: boolean;
592
- timezone: string | null; // store IANA time zone; null when the server has none (the SDK then shows UTC)
592
+ timezone: string | null; // store IANA time zone; null when the server has none. The SDK shows times in the viewer's browser time zone, not this one
593
593
  nextSlot: DeliverySlot | null; // null on a product fulfillment of a closed store: checkout gives the windows
594
594
  checkedAt: string;
595
595
  }
@@ -154,7 +154,7 @@ on render, and a live region recreated with its text already in place is not ann
154
154
  option names the retailer, the price, the timing, the delivery fee and — for same-day — the
155
155
  store address and whether it is currently closed. A closed store that schedules delivery leads
156
156
  with that instead ("Columbus Avenue Wines, closed now, schedule delivery"), followed by
157
- "next arrival Thu, Oct 8, 1 PM – 2 PM ET" only when the server sends a next window; its card
157
+ "next arrival Thu, 1 PM – 2 PM" only when the server sends a next window; its card
158
158
  stays enabled.
159
159
  - The California Proposition 65 warning on the product is a native `<details>` / `<summary>`
160
160
  disclosure: the summary is a button that exposes its expanded state, and `Enter` / `Space` toggle
@@ -295,4 +295,4 @@ keeps that channel visible when account data arrives later.
295
295
 
296
296
  ### Delivery date and arrival windows
297
297
 
298
- The delivery picker is a named native modal dialog opened from each delivery's Schedule delivery or Edit control. Dates and arrival windows are radio groups with one tab stop each and arrow-key selection; the date strip scrolls inside the dialog and unavailable dates are disabled. While windows load, the dialog is marked busy and shows a loading line; Cancel and Close stay available. Changes are drafts until Save; Cancel, Close and Escape discard them, and closing returns focus to the opening control. The dialog stays the same modal while it is open: a date or window change updates its contents in place, so it is not announced again. Save errors keep the dialog open and move focus to the error. Success is announced politely; errors and an expired or unavailable window are announced assertively, each with its own message. The time zone is named once above the windows ("Times in Eastern Time"); the first window's accessible name also carries its "Order by" time. The window list scrolls inside the dialog, and the chosen or focused window is kept in view as the picker opens, the date changes and arrow keys move.
298
+ The delivery picker is a named native modal dialog opened from each delivery's Schedule delivery or Edit control. Dates and arrival windows are radio groups with one tab stop each and arrow-key selection; the date strip scrolls inside the dialog and unavailable dates are disabled. While windows load, the dialog is marked busy and shows a loading line; Cancel and Close stay available. Changes are drafts until Save; Cancel, Close and Escape discard them, and closing returns focus to the opening control. The dialog stays the same modal while it is open: a date or window change updates its contents in place, so it is not announced again. Save errors keep the dialog open and move focus to the error. Success is announced politely; errors and an expired or unavailable window are announced assertively, each with its own message. No time zone is shown above the windows; the ASAP window's accessible name is "As soon as possible", and the first window's accessible name also carries its "Order by" time. The window list scrolls inside the dialog, and the chosen or focused window is kept in view as the picker opens, the date changes and arrow keys move.
@@ -907,13 +907,13 @@ fails, the shopper can retry or explicitly choose the visible channel preference
907
907
 
908
908
  ## Scheduled delivery
909
909
 
910
- When an AccelPay retailer has scheduled delivery turned on, checkout shows a **Delivery time** row for that delivery, between the delivery details and payment. It reads "As soon as possible" while the store can deliver now, or asks for a window when it cannot. The row's button reads **Schedule** while the row is on as soon as possible, **Edit** after a window is saved, and **Schedule delivery** when the shopper must choose a window. It opens a dialog that loads the windows for that delivery: date cards for today and the next 7 days, then arrival windows in the retailer's time zone, named once above the list ("Times in Eastern Time"). The window list scrolls inside the dialog and keeps the chosen window in view. The first window shows "Order by" with its cutoff, and **As soon as possible** sits next to it when the store can deliver now. Choices are drafts until **Save**; Cancel, Close and Escape discard them.
910
+ When an AccelPay retailer has scheduled delivery turned on, checkout shows a **Delivery time** row for that delivery, between the delivery details and payment. It reads "ASAP" while the store can deliver now, or asks for a window when it cannot. The row's button reads **Schedule** while the row is on as soon as possible, **Edit** after a window is saved, and **Schedule delivery** when the shopper must choose a window. It opens a dialog that loads the windows for that delivery: date cards for today and the next 7 days, then arrival windows. Days and times are in the shopper's own time zone (the browser's), so "Today" is the shopper's today; no time zone is shown. The window list scrolls inside the dialog and keeps the chosen window in view. The first window shows "Order by" with its cutoff, and **ASAP** sits next to it when the store can deliver now (screen readers hear "As soon as possible"). Choices are drafts until **Save**; Cancel, Close and Escape discard them.
911
911
 
912
- The accepted window shows in the row and on the items in the order summary ("Scheduled for Thu, Oct 8, 1 PM – 2 PM ET"), and on the thank-you page as "Delivery time" with "Thu, Oct 8, 1 PM – 2 PM ET". An ASAP order adds no line there. If the window's cutoff passes before the order is placed, the SDK clears it, shows "Your delivery window has passed. Choose a new delivery time.", reopens the picker and keeps Place Order disabled until a new choice is saved. If the store no longer offers the window, the same happens with "Your delivery window is no longer available. Choose a new delivery time." Everything else the shopper entered stays.
912
+ The accepted window shows in the row and on the items in the order summary ("Scheduled for Thu, 1 PM – 2 PM"), and on the thank-you page as "Delivery time" with "Thu, 1 PM – 2 PM". An ASAP order adds no line there. If the window's cutoff passes before the order is placed, the SDK clears it, shows "Your delivery window has passed. Choose a new delivery time.", reopens the picker and keeps Place Order disabled until a new choice is saved. If the store no longer offers the window, the same happens with "Your delivery window is no longer available. Choose a new delivery time." Everything else the shopper entered stays.
913
913
 
914
914
  A store that was added to the cart while closed cannot deliver now, so checkout asks for a window and offers no ASAP. If a store closes after the shopper chose ASAP, Place Order answers `delivery_window_required`: the SDK shows "The store cannot deliver now. Choose a delivery time.", opens the picker and keeps Place Order disabled until a window is saved.
915
915
 
916
- In a checkout with more than one fulfillment group (another store, or shipping), each same-day group with scheduled delivery gets its own **Delivery time** row and its own picker, which loads that group's windows. Its button reads **Schedule this store's delivery** (**Edit** after a window is saved), and the picker is named after the store ("Schedule delivery from Columbus Avenue Wines"). Every prepare sends each group's current choice, so saving one group keeps the other's window. A group whose store can deliver now stays on as soon as possible; a group whose store cannot needs its own window before payment and Place Order. When a window lapses, only that group's window is cleared and only its picker reopens: the SDK clears the window whose cutoff passed on the page, and for `delivery_window_required` marks the groups that have no window. When an error names its group (`fulfillmentId` on the error entry), only that group is cleared; when it names none and the SDK cannot place it, every saved window is cleared. Until each store that cannot deliver now has a window, payment says which: "Choose a delivery window for Amsterdam Liquors before continuing." In an order with more than one fulfillment group, the thank-you page has one line per group, named after its store: the accepted window for a scheduled group ("Columbus Avenue Wines" with "Thu, Oct 8, 1 PM – 2 PM ET"), and the group's own expectation for the others ("Harbor Spirits" with "Ships in 3-5 days"). A scheduled group never shows the as-soon-as-possible expectation. While a store that cannot deliver now has no accepted window, the express wallet buttons stay off, like the card form. When checkout refuses a store that has scheduled delivery and also another delivery method (`multiple_fulfillment_options_per_store`, code 5516), the SDK shows the refusal as the checkout error and keeps the saved windows: "Scheduled delivery cannot be combined with another delivery method from the same store. Choose ASAP delivery, or use one delivery method for all items from this store." When that store is closed now, the text leaves out ASAP: "This store is closed now. Use one delivery method for all items from this store." When Place Order is refused, the SDK reads the cart again and decides "closed now" from its `deliveryAvailability`, because a store can close after the last prepare. Place Order and the express wallet stay off until a prepare succeeds after a change to the cart or to a delivery choice.
916
+ In a checkout with more than one fulfillment group (another store, or shipping), each same-day group with scheduled delivery gets its own **Delivery time** row and its own picker, which loads that group's windows. Its button reads **Schedule this store's delivery** (**Edit** after a window is saved), and the picker is named after the store ("Schedule delivery from Columbus Avenue Wines"). Every prepare sends each group's current choice, so saving one group keeps the other's window. A group whose store can deliver now stays on as soon as possible; a group whose store cannot needs its own window before payment and Place Order. When a window lapses, only that group's window is cleared and only its picker reopens: the SDK clears the window whose cutoff passed on the page, and for `delivery_window_required` marks the groups that have no window. When an error names its group (`fulfillmentId` on the error entry), only that group is cleared. A name that is not a scheduling group of this checkout counts as no name; when the error names no group and the SDK cannot place it, every saved window is cleared (a refused window save clears nothing and asks for another time). When the save of one store's window is refused because the window of another store lapsed, the SDK clears that other window and names its store: "Choose a delivery window for Columbus Avenue Wines before continuing." Until each store that cannot deliver now has a window, payment says which: "Choose a delivery window for Amsterdam Liquors before continuing." In an order with more than one fulfillment group, the thank-you page has one line per group, named after its store: the accepted window for a scheduled group ("Columbus Avenue Wines" with "Thu, 1 PM – 2 PM"), and the group's own expectation for the others ("Harbor Spirits" with "Ships in 3-5 days"). A scheduled group never shows the as-soon-as-possible expectation. While a store that cannot deliver now has no accepted window, the express wallet buttons stay off, like the card form. When checkout refuses a store that has scheduled delivery and also another delivery method (`multiple_fulfillment_options_per_store`, code 5516), the SDK shows the refusal as the checkout error and keeps the saved windows: "Scheduled delivery cannot be combined with another delivery method from the same store. Choose ASAP delivery, or use one delivery method for all items from this store." When that store is closed now, the text leaves out ASAP: "This store is closed now. Use one delivery method for all items from this store." When the refusal says whether the store is closed now (`closedNow` on the error entry), the SDK uses that. Otherwise, when Place Order is refused, the SDK reads the cart again and decides "closed now" from its `deliveryAvailability`, because a store can close after the last prepare. Place Order and the express wallet stay off until a prepare succeeds after a change to the cart or to a delivery choice.
917
917
 
918
918
  In the delivery-method switch, a same-day method whose `deliveryAvailability` says the store cannot deliver now but can schedule shows "Schedule delivery" in place of its delivery estimate. Without `deliveryAvailability` the card shows the estimate as before.
919
919
 
@@ -482,7 +482,7 @@ await window.LiquidCommerce.elements.actions.address.setAddressManually(
482
482
 
483
483
  ## Buying when a retailer is closed
484
484
 
485
- A same-day retailer whose store schedules delivery can take orders while it is closed. Its fulfillment then carries `deliveryAvailability`. When that says the store cannot deliver now but can schedule (`status: 'available'`, `canSchedule: true`), the retailer card stays on and shows "Schedule delivery". The product page shows no time: the server sends `nextSlot: null` for a closed store, and checkout asks the shopper to choose a delivery window. Add to Cart stays on. Screen readers hear "Columbus Avenue Wines, closed now, schedule delivery" in place of "Currently closed". When the server does send a `nextSlot`, the card adds it in the retailer's time zone ("Schedule delivery · Thu, Oct 8, 1 PM – 2 PM ET") and screen readers hear "…, next arrival Thu, Oct 8, 1 PM – 2 PM ET". The SDK selects a retailer that can deliver now first, then one that schedules delivery, and goes to shipping only when neither is available.
485
+ A same-day retailer whose store schedules delivery can take orders while it is closed. Its fulfillment then carries `deliveryAvailability`. When that says the store cannot deliver now but can schedule (`status: 'available'`, `canSchedule: true`), the retailer card stays on and shows "Schedule delivery". The product page shows no time: the server sends `nextSlot: null` for a closed store, and checkout asks the shopper to choose a delivery window. Add to Cart stays on. Screen readers hear "Columbus Avenue Wines, closed now, schedule delivery" in place of "Currently closed". When the server does send a `nextSlot`, the card adds it on a second line, in the shopper's own time zone ("Schedule delivery", then "Thu, 1 PM – 2 PM") and screen readers hear "…, next arrival Thu, 1 PM – 2 PM". The SDK selects a retailer that can deliver now first, then one that schedules delivery, and goes to shipping only when neither is available.
486
486
 
487
487
  A closed store without scheduled delivery is blocked as before. An unknown or unavailable `deliveryAvailability`, or a `nextSlot` whose order cutoff has passed, never turns purchase on.
488
488
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "LiquidCommerce Elements SDK",
4
4
  "license": "UNLICENSED",
5
5
  "author": "LiquidCommerce Team",
6
- "version": "2.6.0-beta.132",
6
+ "version": "2.6.0-beta.134",
7
7
  "homepage": "https://docs.liquidcommerce.co/elements-sdk",
8
8
  "repository": {
9
9
  "type": "git",