@shoplix-ai/block-kit 4.6.0 → 5.16.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/README.md +116 -10
- package/dist/account-links.d.ts +96 -0
- package/dist/account-links.d.ts.map +1 -0
- package/dist/account-links.js +121 -0
- package/dist/account-links.js.map +1 -0
- package/dist/address-list.d.ts +58 -0
- package/dist/address-list.d.ts.map +1 -0
- package/dist/address-list.js +57 -0
- package/dist/address-list.js.map +1 -0
- package/dist/buy-box.d.ts +8 -0
- package/dist/buy-box.d.ts.map +1 -1
- package/dist/buy-box.js +8 -0
- package/dist/buy-box.js.map +1 -1
- package/dist/capabilities.d.ts +12 -2
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js.map +1 -1
- package/dist/category-grid.d.ts +92 -0
- package/dist/category-grid.d.ts.map +1 -0
- package/dist/category-grid.js +123 -0
- package/dist/category-grid.js.map +1 -0
- package/dist/color-choice.d.ts +4 -0
- package/dist/color-choice.d.ts.map +1 -0
- package/dist/color-choice.js +11 -0
- package/dist/color-choice.js.map +1 -0
- package/dist/content-direction.d.ts +10 -0
- package/dist/content-direction.d.ts.map +1 -0
- package/dist/content-direction.js +20 -0
- package/dist/content-direction.js.map +1 -0
- package/dist/contract.d.ts +20 -14
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +3 -2
- package/dist/contract.js.map +1 -1
- package/dist/description.d.ts +60 -0
- package/dist/description.d.ts.map +1 -0
- package/dist/description.js +332 -0
- package/dist/description.js.map +1 -0
- package/dist/hero-banner.d.ts +10 -1
- package/dist/hero-banner.d.ts.map +1 -1
- package/dist/hero-banner.js +17 -0
- package/dist/hero-banner.js.map +1 -1
- package/dist/index.d.ts +32 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/listing-filters.d.ts +114 -0
- package/dist/listing-filters.d.ts.map +1 -0
- package/dist/listing-filters.js +195 -0
- package/dist/listing-filters.js.map +1 -0
- package/dist/listing-toolbar.d.ts +117 -0
- package/dist/listing-toolbar.d.ts.map +1 -0
- package/dist/listing-toolbar.js +130 -0
- package/dist/listing-toolbar.js.map +1 -0
- package/dist/money.d.ts +7 -0
- package/dist/money.d.ts.map +1 -1
- package/dist/money.js +15 -0
- package/dist/money.js.map +1 -1
- package/dist/navigation.d.ts +10 -2
- package/dist/navigation.d.ts.map +1 -1
- package/dist/orders.d.ts +162 -0
- package/dist/orders.d.ts.map +1 -0
- package/dist/orders.js +302 -0
- package/dist/orders.js.map +1 -0
- package/dist/product-card.d.ts +4 -0
- package/dist/product-card.d.ts.map +1 -1
- package/dist/product-card.js +4 -0
- package/dist/product-card.js.map +1 -1
- package/dist/product-gallery.d.ts +3 -0
- package/dist/product-gallery.d.ts.map +1 -1
- package/dist/product-gallery.js +3 -0
- package/dist/product-gallery.js.map +1 -1
- package/dist/product-specs.d.ts +33 -2
- package/dist/product-specs.d.ts.map +1 -1
- package/dist/product-specs.js +51 -2
- package/dist/product-specs.js.map +1 -1
- package/dist/product-summary.d.ts +12 -1
- package/dist/product-summary.d.ts.map +1 -1
- package/dist/product-summary.js +29 -0
- package/dist/product-summary.js.map +1 -1
- package/dist/profile-header.d.ts +30 -0
- package/dist/profile-header.d.ts.map +1 -0
- package/dist/profile-header.js +36 -0
- package/dist/profile-header.js.map +1 -0
- package/dist/promo-banner.d.ts +11 -1
- package/dist/promo-banner.d.ts.map +1 -1
- package/dist/promo-banner.js +24 -0
- package/dist/promo-banner.js.map +1 -1
- package/dist/section-header.d.ts +5 -1
- package/dist/section-header.d.ts.map +1 -1
- package/dist/section-header.js +5 -1
- package/dist/section-header.js.map +1 -1
- package/dist/sign-in.d.ts +28 -0
- package/dist/sign-in.d.ts.map +1 -0
- package/dist/sign-in.js +27 -0
- package/dist/sign-in.js.map +1 -0
- package/dist/store-header.d.ts +49 -6
- package/dist/store-header.d.ts.map +1 -1
- package/dist/store-header.js +59 -5
- package/dist/store-header.js.map +1 -1
- package/dist/variant-choice.d.ts +14 -0
- package/dist/variant-choice.d.ts.map +1 -1
- package/dist/variant-choice.js +36 -0
- package/dist/variant-choice.js.map +1 -1
- package/dist/variant-rows.d.ts +33 -0
- package/dist/variant-rows.d.ts.map +1 -0
- package/dist/variant-rows.js +52 -0
- package/dist/variant-rows.js.map +1 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +2 -2
- package/dist/version.js.map +1 -1
- package/dist/words.d.ts +185 -0
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +530 -4
- package/dist/words.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,14 +9,17 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
9
9
|
screen in hand, the Shop's tokens and resolved theme style,
|
|
10
10
|
the buyer's language and text direction with the Shop's default language as
|
|
11
11
|
fallback, `navigate` (the document's action, and the implicit taps: a
|
|
12
|
-
product, a collection, search, the account
|
|
12
|
+
product, a collection, search, the account, and on a host that knows them an
|
|
13
|
+
order, its tracking, the page Shopify hosts for it and the Address Sheet on
|
|
14
|
+
one saved address), `cart` (how many items the
|
|
13
15
|
cart holds for a badge, and whether a change is on its way so every block
|
|
14
16
|
goes quiet together; never the cart itself, which a cart Binding resolves),
|
|
15
17
|
`account` (whether a shopper is signed in, the name to greet them by and its
|
|
16
18
|
own pending flag; never the Account Session), and a capability object holding
|
|
17
19
|
only the capabilities the Block Type declared. A Block Type may also declare
|
|
18
20
|
`rows` beside `render` and hand its items to the host instead of drawing them
|
|
19
|
-
itself
|
|
21
|
+
itself; a block of the shopper's own data names the item its rows draw, an
|
|
22
|
+
order or a line of one.
|
|
20
23
|
- **The registry.** `createBlockRegistry()` keyed by Block Type, one owner per
|
|
21
24
|
type. A second owner is refused; the same owner may register again. Packages
|
|
22
25
|
outside the app register through it. `defineBlock()` is the typed authoring
|
|
@@ -34,7 +37,8 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
34
37
|
notification decision as one host state: whether the invitation is still
|
|
35
38
|
offered, the tap that opens the phone's prompt and the tap that hides it
|
|
36
39
|
until the next completed checkout. Then the nine of the shopper's own
|
|
37
|
-
account: `signIn
|
|
40
|
+
account: `signIn` (with the email the shopper typed, where a block has one,
|
|
41
|
+
as the hint Shopify's hosted step opens with), `signOut`, `updateProfile` (the names, the email marketing
|
|
38
42
|
choice and the Profile Fields), `addAddress`, `updateAddress`,
|
|
39
43
|
`deleteAddress`, `setDefaultAddress` (each address by its id, the fields the
|
|
40
44
|
Address Sheet sends), `buyAgain` (an order's own lines back into the cart)
|
|
@@ -46,7 +50,10 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
46
50
|
stock is clamped by Shopify and not refused, and the host names what is
|
|
47
51
|
left; a shopper who holds no Account Session gets the refusal too, so a
|
|
48
52
|
block never has to ask whether a capability is reachable before it calls
|
|
49
|
-
one. `
|
|
53
|
+
one. `signOut` asks the shopper first, in the host's Log-out Sheet, which no
|
|
54
|
+
block can skip: it resolves once they chose to log out and the sign-out
|
|
55
|
+
landed, and rejects with the `refused` outcome when they stay signed in.
|
|
56
|
+
`isCapabilityRefusal` tells a refusal apart from any other rejection.
|
|
50
57
|
Nothing repaints before Shopify's answer, and the block decides how to show
|
|
51
58
|
a refusal.
|
|
52
59
|
- **The authoring shape of a Code Block.** `defineSettings()` and
|
|
@@ -73,13 +80,37 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
73
80
|
`moneyAmount` and `discountPercent`, the money presentation below, and
|
|
74
81
|
`productCardColors`, `collectionTileColors`, `heroBannerColors` beside
|
|
75
82
|
`heroBannerRadius`, `promoBannerColors` beside `promoBannerRadius`,
|
|
76
|
-
`sectionHeaderColors`, `featureStripColors`, `storeHeaderColors
|
|
83
|
+
`sectionHeaderColors`, `featureStripColors`, `storeHeaderColors` (its
|
|
84
|
+
`drawer_group` part paints the card an open menu parent stands on) beside
|
|
85
|
+
`storeMenuMetrics` and `STORE_MENU_DIM`,
|
|
77
86
|
`brandRailColors`, `buyBoxColors`, `announcementBarColors`, `shippingProgressColors`, `productGalleryColors`,
|
|
78
87
|
`productSummaryColors`, `productSpecsColors`, `reviewsSlotColors`,
|
|
79
88
|
`cartLinesColors`, `cartEmptyColors`, `cartDiscountCodeColors`,
|
|
80
|
-
`cartSummaryColors
|
|
89
|
+
`cartSummaryColors`, `checkoutButtonColors`, `signInColors`,
|
|
90
|
+
`profileHeaderColors` and `accountLinksColors`, the colour tables the
|
|
81
91
|
promoted blocks read on the phone and on the web alike: a theme role per part
|
|
82
|
-
of the block, with a component token at `<block>.<part>` over it.
|
|
92
|
+
of the block, with a component token at `<block>.<part>` over it. The
|
|
93
|
+
sign-in block is retired, so `signInColors` is deprecated and stays until the
|
|
94
|
+
next major; the profile header's table carries the title, the subtitle and
|
|
95
|
+
the button it draws while nobody is signed in.
|
|
96
|
+
The three sections of the product page read the specs' table:
|
|
97
|
+
`productSpecsColors` takes the surface a merchant chose for one of them over
|
|
98
|
+
its own, `productSectionTitle` writes a section's title, the merchant's or
|
|
99
|
+
the catalog's (`PRODUCT_SECTION_TITLES`), `productSpecRows` lists the
|
|
100
|
+
facts, the merchant's rows or the vendor and the type, and `shippingRowsOf`
|
|
101
|
+
the shipping rows the buyer can read. The plain look of the product page
|
|
102
|
+
reads `contentDirection` (a product's own words laid out the way they were
|
|
103
|
+
written), `descriptionParts` and `shownDescriptionParts` (the merchant's
|
|
104
|
+
description markup as paragraphs, lists and tables, with nothing of the
|
|
105
|
+
markup kept), `descriptionFacts` (the facts of those tables, which
|
|
106
|
+
`productSpecRows` leads with where a block asks), `chosenPrice` (the chosen
|
|
107
|
+
variant's price, never the cheapest's), `savingText` (the saving the
|
|
108
|
+
summary says, as an amount, a percent or nothing), `descriptionPartsOf` (what
|
|
109
|
+
a description block draws, the one rule the phone, the twin and the canvas
|
|
110
|
+
read), `variantRows` and `variantLabel` (one priced row per variant, a
|
|
111
|
+
variant in one line), and `valuesAfterEarlierChoices` and `choicesAfterPick`
|
|
112
|
+
(a later option offers only what the earlier choices leave, and a pick moves
|
|
113
|
+
the later choices to a variant for sale).
|
|
83
114
|
`readableInk` is the one rule for words on a colour the merchant chose, so a
|
|
84
115
|
bar cannot be white on the phone and dark on the canvas. `shippingProgress`
|
|
85
116
|
reads how far a held cart is from a free shipping threshold, `cartSavings`
|
|
@@ -88,7 +119,71 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
88
119
|
items it holds in the form the buyer's language counts that number in, and
|
|
89
120
|
`cartBadgeCount` what a cart badge writes over a glyph, capped at 99+, and
|
|
90
121
|
`BUY_QUANTITY_CEILING` the most of one variant a buy control offers to add in
|
|
91
|
-
one tap.
|
|
122
|
+
one tap. `customerInitials` is the letters an avatar draws for a shopper,
|
|
123
|
+
and `accountLinkRows` the rows of the account links as both renderers draw
|
|
124
|
+
them: named, the hidden ones left out, sign out and delete set apart. The
|
|
125
|
+
Sign in row reads the platform's `account.sign_in`.
|
|
126
|
+
`accountLinksLayout` lays those rows out for the shopper's state, the one
|
|
127
|
+
filter both renderers share: handed `signed_in` or `signed_out`, it keeps
|
|
128
|
+
only the rows the schema's `ACCOUNT_LINK_ROW_STATES` lets draw in it, then
|
|
129
|
+
puts consecutive rows of one section on one card under its title, the
|
|
130
|
+
destructive rows in the list, and the log-out as a pill or pinned at the
|
|
131
|
+
foot of the hub where the merchant says so; handed no state, it keeps every
|
|
132
|
+
row. `accountLinksCard` is the card they stand on and the circle behind a
|
|
133
|
+
glyph.
|
|
134
|
+
`orderColors` and `orderRadius` are the one table and the one corner the
|
|
135
|
+
eight order blocks share at `order.<part>`; `fulfillmentPillOf` and
|
|
136
|
+
`paymentPillOf` are the two pills of an order, a word and one of four tones,
|
|
137
|
+
and `orderPillColors` the ink and the surface of a tone, read from the pair
|
|
138
|
+
the theme names for the tone's state at `status.pending`, `status.delivered`
|
|
139
|
+
or `status.cancelled` (a `label` and a `surface`), which `orderStatusColors`
|
|
140
|
+
hands an editor whole. `orderListCards` is the card a row of the orders list
|
|
141
|
+
stands on and the card its first line stands on, `orderLineCard` the card a
|
|
142
|
+
line stands on in the list and on the order screen alike, `orderSummaryBox`
|
|
143
|
+
the box of the money rows, `orderItemsOf` the first line of an order, how
|
|
144
|
+
many lines follow it and how many items it holds, `orderItemCount` that
|
|
145
|
+
count in the buyer's language and `orderSubtotalLabel` the subtotal that
|
|
146
|
+
names it, and `orderHasShipments` whether Shopify holds a shipment to
|
|
147
|
+
track; `SHIPMENT_STEPS`
|
|
148
|
+
and `shipmentStepReached` are the progress rail of a shipment,
|
|
149
|
+
`fulfillmentEventWord` and `shipmentWord` its words, Delivered where its
|
|
150
|
+
newest event says it arrived, the one reading `fulfillmentPillOf` makes of
|
|
151
|
+
every live shipment, on a row of the list as on the opened order; `orderMoneyRows` lists
|
|
152
|
+
the money rows Shopify wrote, and `orderDay` and `orderTime` write a
|
|
153
|
+
timestamp as a shopper reads it. `addressListColors` and `addressListRadius`
|
|
154
|
+
are the table and the corner of the address list at `address_list.<part>`,
|
|
155
|
+
`addressCardOf` the title and the lines of one saved address, the lines the
|
|
156
|
+
Provider composed in the standard postal shape, and `addressControlsOf`
|
|
157
|
+
which of its three controls a card offers: the default address is never
|
|
158
|
+
offered Delete, because Shopify refuses that delete in English in every
|
|
159
|
+
language and refuses it for the only saved address too. The card draws no
|
|
160
|
+
note about it; `defaultLocked` and the `address.default_before_delete` word
|
|
161
|
+
stay in the contract, unused by the platform, until its next major. `heroPageLabel` says which page of how many a hero carousel rests
|
|
162
|
+
on, because its marks carry no words of their own. `promoSetLabel` says how
|
|
163
|
+
many promotions a promo banner stacks, and `promoCardLabel` which of them a
|
|
164
|
+
card is, beside the merchant's words or in place of them.
|
|
165
|
+
`categoryTileOf` is the tile of one collection a category grid's Binding
|
|
166
|
+
answered, with what the merchant changed on it over the collection's own:
|
|
167
|
+
the words, a picture or an icon, and where a tap goes, the collection where
|
|
168
|
+
they pointed it nowhere. `categoryGridRow` is how many tiles stand in a row
|
|
169
|
+
and the gap between them, `categoryTileWidth` the width a row hands a tile,
|
|
170
|
+
`categoryGridLook` every measure of a tile at that width, and
|
|
171
|
+
`categoryGridColors` its colours, the tile on the role the merchant chose
|
|
172
|
+
and the icon in whichever of ink and paper stands out on it.
|
|
173
|
+
`listingToolbarLook` and `listingToolbarColors` are the listing toolbar's
|
|
174
|
+
parts, measures and colours at `listing_toolbar.<part>`, the role the
|
|
175
|
+
merchant chose for the bar, its stroke, its words or the switch's track over
|
|
176
|
+
them; `listingCount` is the count of the products a listing has loaded,
|
|
177
|
+
"24+" while Shopify names more, with its word in the form the buyer's
|
|
178
|
+
language counts it in; `listingSortRows` and `listingSortLabel` are the
|
|
179
|
+
sorts the sheet offers in the merchant's order and words, the catalog's
|
|
180
|
+
`listing.sort.<key>` where they wrote none; `listingFilterRows` is the filter
|
|
181
|
+
sheet's rows out of the filters Shopify offers the collection, a switch, a
|
|
182
|
+
price range or a list, in the merchant's order and words; `activeFilterOf`
|
|
183
|
+
and `activePriceFilter` are a filter the shopper turned on, Shopify's own
|
|
184
|
+
input for a value unchanged or the price range they gave, with the words of
|
|
185
|
+
its chip; `listingFilterWords` the words of the button, the sheet and the
|
|
186
|
+
chips; and `PRODUCT_ROW_LOOK` is the row a product takes in a list.
|
|
92
187
|
`derivedPrice` writes a figure a block worked out for itself, in the style the
|
|
93
188
|
theme chose and at the currency's own places so it lines up in a column with
|
|
94
189
|
the ones Shopify sent; `derivedMoney` is the same figure with an empty
|
|
@@ -127,6 +222,14 @@ fallback is always a theme role, never a literal: a merchant who names nothing
|
|
|
127
222
|
still gets their own palette, and the token is the escape hatch over it. A
|
|
128
223
|
token of another type is not drawn, the fallback is.
|
|
129
224
|
|
|
225
|
+
One colour is the exception, by the owner's decision: the dim behind the store
|
|
226
|
+
header's open menu. A theme's `overlay` role may be a light wash, and the menu
|
|
227
|
+
must dim the screen dark on every theme, so `storeHeaderColors` falls back to
|
|
228
|
+
`STORE_MENU_DIM` (the Cart Drawer's dim) with `store_header.scrim` over it.
|
|
229
|
+
Sizes are not colours: `storeMenuMetrics` answers the menu's row height and
|
|
230
|
+
label size, 48 and 16 points, with `store_header.menu_row_height` and
|
|
231
|
+
`store_header.menu_text_size` over them.
|
|
232
|
+
|
|
130
233
|
## The words a renderer owns
|
|
131
234
|
|
|
132
235
|
A renderer never carries its own literal. Every functional word the platform
|
|
@@ -148,8 +251,11 @@ when they wrote a language the buyer reads and the catalog's word otherwise.
|
|
|
148
251
|
|
|
149
252
|
The name a screen reader reads is functional too, whatever the drawing shows.
|
|
150
253
|
A promotion the buyer can tap that carries no words of the merchant's own is
|
|
151
|
-
announced as `promo.promotion`
|
|
152
|
-
merchant's headline still wins
|
|
254
|
+
announced by which of how many it is, or as `promo.promotion` when it stands
|
|
255
|
+
alone, rather than as a button with no name; the merchant's headline still wins
|
|
256
|
+
wherever they wrote one, with its place in the set beside it. A horizontal rail
|
|
257
|
+
of more than one item is named by `rail.scroll_hint`, so a buyer who cannot see
|
|
258
|
+
it is told it scrolls sideways.
|
|
153
259
|
|
|
154
260
|
The catalog answers in English, Arabic and Turkish. A language it does not
|
|
155
261
|
carry falls back to English, written down here rather than left to whichever
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { type AccountLinkRow, type AccountLinksBlock, type AccountLinkState, type LocaleCode, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
/**
|
|
3
|
+
* The parts of the account links, each with the theme role it draws unless a
|
|
4
|
+
* component token names another. No theme role is a red, so the destructive
|
|
5
|
+
* rows draw the warning role until a design names its own.
|
|
6
|
+
*/
|
|
7
|
+
declare const ACCOUNT_LINKS_ROLES: {
|
|
8
|
+
readonly title: "subtle";
|
|
9
|
+
readonly group: "surface";
|
|
10
|
+
readonly rule: "border";
|
|
11
|
+
readonly icon_well: "sunken";
|
|
12
|
+
readonly icon: "text";
|
|
13
|
+
readonly label: "text";
|
|
14
|
+
readonly chevron: "muted";
|
|
15
|
+
readonly destructive: "warning";
|
|
16
|
+
readonly destructive_surface: "sunken";
|
|
17
|
+
};
|
|
18
|
+
export type AccountLinksPart = keyof typeof ACCOUNT_LINKS_ROLES;
|
|
19
|
+
export type AccountLinksColors = Readonly<Record<AccountLinksPart, string>>;
|
|
20
|
+
/** Every colour the account links draw, one per part, with `account_links.<part>` over each theme role. */
|
|
21
|
+
export declare function accountLinksColors(theme: ThemeStyle): AccountLinksColors;
|
|
22
|
+
/**
|
|
23
|
+
* The corner the group and a destructive row are cut with: the merchant's own,
|
|
24
|
+
* with `account_links.radius` over it for a design whose lists are softer than
|
|
25
|
+
* its buttons.
|
|
26
|
+
*/
|
|
27
|
+
export declare function accountLinksRadius(theme: ThemeStyle): number;
|
|
28
|
+
/** One row as it is drawn: the row of the document and the words a shopper reads on it. */
|
|
29
|
+
export interface NamedAccountLink {
|
|
30
|
+
readonly row: AccountLinkRow;
|
|
31
|
+
readonly label: string;
|
|
32
|
+
}
|
|
33
|
+
/** The rows a shopper is shown: the group, and the rows that take something from them, drawn apart. */
|
|
34
|
+
export interface AccountLinkRows {
|
|
35
|
+
readonly grouped: readonly NamedAccountLink[];
|
|
36
|
+
readonly destructive: readonly NamedAccountLink[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The rows of the account links as both renderers draw them, in the
|
|
40
|
+
* merchant's order. A row the merchant left unnamed reads the platform's word
|
|
41
|
+
* for where it leads; a custom screen and a web address have no such word, so
|
|
42
|
+
* one of those with no label in a language the buyer reads is left out rather
|
|
43
|
+
* than drawn blank. Sign out and delete are set apart from the group.
|
|
44
|
+
*/
|
|
45
|
+
export declare function accountLinkRows(rows: readonly AccountLinkRow[] | undefined, language: LocaleCode, defaultLanguage: LocaleCode): AccountLinkRows;
|
|
46
|
+
/** The card the rows stand on, and the circle behind each row's glyph, as both renderers draw them. */
|
|
47
|
+
export interface AccountLinksCard {
|
|
48
|
+
readonly surface: string;
|
|
49
|
+
/** The line around the card; none, and the card stands on its surface alone. */
|
|
50
|
+
readonly stroke: string | null;
|
|
51
|
+
readonly radius: number;
|
|
52
|
+
readonly shadow: boolean;
|
|
53
|
+
readonly iconCircle: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The card of the account links: what the merchant set, and the theme's own
|
|
57
|
+
* look for every part they left out, which is the look the links had before
|
|
58
|
+
* the card was a setting: the links' surface, no stroke, their own corner and
|
|
59
|
+
* the soft shadow. The corner is the block's one corner, so the destructive
|
|
60
|
+
* rows and the log-out pill are cut with it too.
|
|
61
|
+
*/
|
|
62
|
+
export declare function accountLinksCard(theme: ThemeStyle, settings: AccountLinksBlock['props']): AccountLinksCard;
|
|
63
|
+
/** One run of consecutive rows on one card, under the title of the section they name; none, and no title. */
|
|
64
|
+
export interface AccountLinkSection {
|
|
65
|
+
readonly title: string;
|
|
66
|
+
readonly rows: readonly NamedAccountLink[];
|
|
67
|
+
}
|
|
68
|
+
/** How a destructive row draws: a row like the others, or the design's centred pill. */
|
|
69
|
+
export type AccountLinkShape = 'row' | 'pill';
|
|
70
|
+
export interface DestructiveAccountLink extends NamedAccountLink {
|
|
71
|
+
readonly shape: AccountLinkShape;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The account links as both renderers lay them out: the sections on their
|
|
75
|
+
* cards, the destructive rows drawn in the list under them, and the log-out
|
|
76
|
+
* the merchant pinned below the hub's scrolling content.
|
|
77
|
+
*/
|
|
78
|
+
export interface AccountLinksLayout {
|
|
79
|
+
readonly sections: readonly AccountLinkSection[];
|
|
80
|
+
readonly destructive: readonly DestructiveAccountLink[];
|
|
81
|
+
readonly pinned: DestructiveAccountLink | null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The layout of the account links, in the merchant's order. Handed the
|
|
85
|
+
* shopper's state, it keeps only the rows `ACCOUNT_LINK_ROW_STATES` lets draw
|
|
86
|
+
* in it, before anything is laid out; handed none, it keeps every row.
|
|
87
|
+
* Consecutive rows that name the same section, as the buyer reads it, share
|
|
88
|
+
* one card under its title; a section named again further down starts a card
|
|
89
|
+
* of its own. The two log-out settings move the first log-out row alone: the
|
|
90
|
+
* pill style draws it as the centred pill, the bottom placement pins it below
|
|
91
|
+
* the hub's scrolling content. Delete is always a row in the list, so it is
|
|
92
|
+
* always reachable.
|
|
93
|
+
*/
|
|
94
|
+
export declare function accountLinksLayout(settings: AccountLinksBlock['props'], language: LocaleCode, defaultLanguage: LocaleCode, state?: AccountLinkState): AccountLinksLayout;
|
|
95
|
+
export {};
|
|
96
|
+
//# sourceMappingURL=account-links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-links.d.ts","sourceRoot":"","sources":["../src/account-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAErB,KAAK,UAAU,EACf,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAMjC;;;;GAIG;AACH,QAAA,MAAM,mBAAmB;;;;;;;;;;CAUsC,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5E,2GAA2G;AAC3G,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,kBAAkB,CAExE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE5D;AAWD,2FAA2F;AAC3F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,uGAAuG;AACvG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACnD;AAED;;;;;;G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AAE,UAAU,EAC3B,KAAK,CAAC,EAAE,gBAAgB,GACvB,kBAAkB,CAiBpB"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { accountLinkRowDraws, componentTokenValue, isDestructiveTarget, shownAccountLinkRows, } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import { colorChoiceOf } from './color-choice.js';
|
|
3
|
+
import { localize } from './locale.js';
|
|
4
|
+
import { partColors } from './part-colors.js';
|
|
5
|
+
import { platformWords } from './words.js';
|
|
6
|
+
/**
|
|
7
|
+
* The parts of the account links, each with the theme role it draws unless a
|
|
8
|
+
* component token names another. No theme role is a red, so the destructive
|
|
9
|
+
* rows draw the warning role until a design names its own.
|
|
10
|
+
*/
|
|
11
|
+
const ACCOUNT_LINKS_ROLES = {
|
|
12
|
+
title: 'subtle',
|
|
13
|
+
group: 'surface',
|
|
14
|
+
rule: 'border',
|
|
15
|
+
icon_well: 'sunken',
|
|
16
|
+
icon: 'text',
|
|
17
|
+
label: 'text',
|
|
18
|
+
chevron: 'muted',
|
|
19
|
+
destructive: 'warning',
|
|
20
|
+
destructive_surface: 'sunken',
|
|
21
|
+
};
|
|
22
|
+
/** Every colour the account links draw, one per part, with `account_links.<part>` over each theme role. */
|
|
23
|
+
export function accountLinksColors(theme) {
|
|
24
|
+
return partColors(theme, 'account_links', ACCOUNT_LINKS_ROLES);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The corner the group and a destructive row are cut with: the merchant's own,
|
|
28
|
+
* with `account_links.radius` over it for a design whose lists are softer than
|
|
29
|
+
* its buttons.
|
|
30
|
+
*/
|
|
31
|
+
export function accountLinksRadius(theme) {
|
|
32
|
+
return componentTokenValue(theme, 'account_links.radius', theme.radius);
|
|
33
|
+
}
|
|
34
|
+
const ROW_WORDS = {
|
|
35
|
+
open_orders: 'account.orders',
|
|
36
|
+
open_addresses: 'account.addresses',
|
|
37
|
+
open_profile: 'account.profile',
|
|
38
|
+
sign_in: 'account.sign_in',
|
|
39
|
+
sign_out: 'account.sign_out',
|
|
40
|
+
delete_account: 'account.delete_account',
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The rows of the account links as both renderers draw them, in the
|
|
44
|
+
* merchant's order. A row the merchant left unnamed reads the platform's word
|
|
45
|
+
* for where it leads; a custom screen and a web address have no such word, so
|
|
46
|
+
* one of those with no label in a language the buyer reads is left out rather
|
|
47
|
+
* than drawn blank. Sign out and delete are set apart from the group.
|
|
48
|
+
*/
|
|
49
|
+
export function accountLinkRows(rows, language, defaultLanguage) {
|
|
50
|
+
const words = platformWords(language, defaultLanguage);
|
|
51
|
+
const named = shownAccountLinkRows(rows)
|
|
52
|
+
.map((row) => {
|
|
53
|
+
const word = ROW_WORDS[row.target.type];
|
|
54
|
+
const written = row.label === undefined ? '' : localize(row.label, language, defaultLanguage);
|
|
55
|
+
return { row, label: word === undefined ? written : words.merchantOr(row.label, word) };
|
|
56
|
+
})
|
|
57
|
+
.filter(({ label }) => label !== '');
|
|
58
|
+
return {
|
|
59
|
+
grouped: named.filter(({ row }) => !isDestructiveTarget(row.target)),
|
|
60
|
+
destructive: named.filter(({ row }) => isDestructiveTarget(row.target)),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The card of the account links: what the merchant set, and the theme's own
|
|
65
|
+
* look for every part they left out, which is the look the links had before
|
|
66
|
+
* the card was a setting: the links' surface, no stroke, their own corner and
|
|
67
|
+
* the soft shadow. The corner is the block's one corner, so the destructive
|
|
68
|
+
* rows and the log-out pill are cut with it too.
|
|
69
|
+
*/
|
|
70
|
+
export function accountLinksCard(theme, settings) {
|
|
71
|
+
const colors = accountLinksColors(theme);
|
|
72
|
+
const card = settings.card ?? {};
|
|
73
|
+
return {
|
|
74
|
+
surface: colorChoiceOf(theme, card.surface) ?? colors.group,
|
|
75
|
+
stroke: colorChoiceOf(theme, card.stroke) ?? null,
|
|
76
|
+
radius: card.radius ?? accountLinksRadius(theme),
|
|
77
|
+
shadow: card.shadow ?? true,
|
|
78
|
+
iconCircle: colorChoiceOf(theme, settings.iconCircle) ?? colors.icon_well,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function sectionsOf(grouped, language, defaultLanguage) {
|
|
82
|
+
const sections = [];
|
|
83
|
+
for (const link of grouped) {
|
|
84
|
+
const section = link.row.section;
|
|
85
|
+
const title = section === undefined ? '' : localize(section, language, defaultLanguage);
|
|
86
|
+
const last = sections[sections.length - 1];
|
|
87
|
+
if (last !== undefined && last.title === title)
|
|
88
|
+
last.rows.push(link);
|
|
89
|
+
else
|
|
90
|
+
sections.push({ title, rows: [link] });
|
|
91
|
+
}
|
|
92
|
+
return sections;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The layout of the account links, in the merchant's order. Handed the
|
|
96
|
+
* shopper's state, it keeps only the rows `ACCOUNT_LINK_ROW_STATES` lets draw
|
|
97
|
+
* in it, before anything is laid out; handed none, it keeps every row.
|
|
98
|
+
* Consecutive rows that name the same section, as the buyer reads it, share
|
|
99
|
+
* one card under its title; a section named again further down starts a card
|
|
100
|
+
* of its own. The two log-out settings move the first log-out row alone: the
|
|
101
|
+
* pill style draws it as the centred pill, the bottom placement pins it below
|
|
102
|
+
* the hub's scrolling content. Delete is always a row in the list, so it is
|
|
103
|
+
* always reachable.
|
|
104
|
+
*/
|
|
105
|
+
export function accountLinksLayout(settings, language, defaultLanguage, state) {
|
|
106
|
+
const rows = state === undefined
|
|
107
|
+
? settings.rows
|
|
108
|
+
: settings.rows?.filter((row) => accountLinkRowDraws(row.target, state));
|
|
109
|
+
const { grouped, destructive } = accountLinkRows(rows, language, defaultLanguage);
|
|
110
|
+
const logOut = destructive.find(({ row }) => row.target.type === 'sign_out');
|
|
111
|
+
const shapeOf = (link) => link === logOut && settings.destructiveStyle === 'pill' ? 'pill' : 'row';
|
|
112
|
+
const pinned = settings.destructivePlacement === 'bottom' ? logOut : undefined;
|
|
113
|
+
return {
|
|
114
|
+
sections: sectionsOf(grouped, language, defaultLanguage),
|
|
115
|
+
destructive: destructive
|
|
116
|
+
.filter((link) => link !== pinned)
|
|
117
|
+
.map((link) => ({ ...link, shape: shapeOf(link) })),
|
|
118
|
+
pinned: pinned === undefined ? null : { ...pinned, shape: shapeOf(pinned) },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=account-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-links.js","sourceRoot":"","sources":["../src/account-links.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GAOrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAgB,MAAM,YAAY,CAAC;AAEzD;;;;GAIG;AACH,MAAM,mBAAmB,GAAG;IAC1B,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,SAAS;IACtB,mBAAmB,EAAE,QAAQ;CACgC,CAAC;AAMhE,2GAA2G;AAC3G,MAAM,UAAU,kBAAkB,CAAC,KAAiB;IAClD,OAAO,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,mBAAmB,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAiB;IAClD,OAAO,mBAAmB,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,SAAS,GAAwD;IACrE,WAAW,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AAE,CAAC,CAAC;QACrD,MAAM,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE;KAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type AddressDisplay, type AddressListBlock, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
/**
|
|
3
|
+
* The parts of the address list, each with the theme role it draws unless a
|
|
4
|
+
* component token names another. No theme role is a red, so the delete control
|
|
5
|
+
* draws the warning role until a design names its own.
|
|
6
|
+
*/
|
|
7
|
+
declare const ADDRESS_LIST_ROLES: {
|
|
8
|
+
readonly card: "sunken";
|
|
9
|
+
readonly strip: "elevated";
|
|
10
|
+
readonly well: "sunken";
|
|
11
|
+
readonly glyph: "text";
|
|
12
|
+
readonly title: "text";
|
|
13
|
+
readonly body: "text";
|
|
14
|
+
readonly link: "muted";
|
|
15
|
+
readonly mark: "success";
|
|
16
|
+
readonly mark_surface: "elevated";
|
|
17
|
+
readonly destructive: "warning";
|
|
18
|
+
readonly empty: "muted";
|
|
19
|
+
};
|
|
20
|
+
export type AddressListPart = keyof typeof ADDRESS_LIST_ROLES;
|
|
21
|
+
export type AddressListColors = Readonly<Record<AddressListPart, string>>;
|
|
22
|
+
/** Every colour the address list draws, one per part, with `address_list.<part>` over each theme role. */
|
|
23
|
+
export declare function addressListColors(theme: ThemeStyle): AddressListColors;
|
|
24
|
+
/** The corner an address card is cut with: the merchant's own, with `address_list.radius` over it. */
|
|
25
|
+
export declare function addressListRadius(theme: ThemeStyle): number;
|
|
26
|
+
/** One address as both renderers draw it: the line over the card, and the lines under it. */
|
|
27
|
+
export interface AddressCard {
|
|
28
|
+
readonly title: string;
|
|
29
|
+
readonly lines: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The lines of a card are the ones the Provider composed in the standard
|
|
33
|
+
* postal shape from the address's own fields: the first, the name, titles
|
|
34
|
+
* the card and the rest stand under it. Those lines carry no phone, so the one
|
|
35
|
+
* the shopper wrote is drawn last.
|
|
36
|
+
*/
|
|
37
|
+
export declare function addressCardOf(address: AddressDisplay): AddressCard;
|
|
38
|
+
/** Which of the three controls a card offers. */
|
|
39
|
+
export interface AddressControls {
|
|
40
|
+
readonly edit: boolean;
|
|
41
|
+
readonly remove: boolean;
|
|
42
|
+
readonly makeDefault: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The merchant left Delete on, and this card is the default. The platform's
|
|
45
|
+
* renderers draw nothing for it any more: the default card simply offers no
|
|
46
|
+
* Delete. It stays in the contract until its next major.
|
|
47
|
+
*/
|
|
48
|
+
readonly defaultLocked: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Each control is offered unless the merchant hid it. The default address is
|
|
52
|
+
* offered neither the control that would make it the default nor the one that
|
|
53
|
+
* would delete it: Shopify refuses to delete a default address, in English in
|
|
54
|
+
* every language, and refuses it for the only saved address too.
|
|
55
|
+
*/
|
|
56
|
+
export declare function addressControlsOf(address: AddressDisplay, settings: AddressListBlock['props']): AddressControls;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=address-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-list.d.ts","sourceRoot":"","sources":["../src/address-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAGjC;;;;GAIG;AACH,QAAA,MAAM,kBAAkB;;;;;;;;;;;;CAYuC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1E,0GAA0G;AAC1G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,CAEtE;AAED,sGAAsG;AACtG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE3D;AAED,6FAA6F;AAC7F,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAMlE;AAED,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAClC,eAAe,CAQjB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { componentTokenValue, } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import { partColors } from './part-colors.js';
|
|
3
|
+
/**
|
|
4
|
+
* The parts of the address list, each with the theme role it draws unless a
|
|
5
|
+
* component token names another. No theme role is a red, so the delete control
|
|
6
|
+
* draws the warning role until a design names its own.
|
|
7
|
+
*/
|
|
8
|
+
const ADDRESS_LIST_ROLES = {
|
|
9
|
+
card: 'sunken',
|
|
10
|
+
strip: 'elevated',
|
|
11
|
+
well: 'sunken',
|
|
12
|
+
glyph: 'text',
|
|
13
|
+
title: 'text',
|
|
14
|
+
body: 'text',
|
|
15
|
+
link: 'muted',
|
|
16
|
+
mark: 'success',
|
|
17
|
+
mark_surface: 'elevated',
|
|
18
|
+
destructive: 'warning',
|
|
19
|
+
empty: 'muted',
|
|
20
|
+
};
|
|
21
|
+
/** Every colour the address list draws, one per part, with `address_list.<part>` over each theme role. */
|
|
22
|
+
export function addressListColors(theme) {
|
|
23
|
+
return partColors(theme, 'address_list', ADDRESS_LIST_ROLES);
|
|
24
|
+
}
|
|
25
|
+
/** The corner an address card is cut with: the merchant's own, with `address_list.radius` over it. */
|
|
26
|
+
export function addressListRadius(theme) {
|
|
27
|
+
return componentTokenValue(theme, 'address_list.radius', theme.radius);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The lines of a card are the ones the Provider composed in the standard
|
|
31
|
+
* postal shape from the address's own fields: the first, the name, titles
|
|
32
|
+
* the card and the rest stand under it. Those lines carry no phone, so the one
|
|
33
|
+
* the shopper wrote is drawn last.
|
|
34
|
+
*/
|
|
35
|
+
export function addressCardOf(address) {
|
|
36
|
+
const [title = '', ...rest] = address.formatted;
|
|
37
|
+
return {
|
|
38
|
+
title,
|
|
39
|
+
lines: address.phoneNumber === undefined ? rest : [...rest, address.phoneNumber],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Each control is offered unless the merchant hid it. The default address is
|
|
44
|
+
* offered neither the control that would make it the default nor the one that
|
|
45
|
+
* would delete it: Shopify refuses to delete a default address, in English in
|
|
46
|
+
* every language, and refuses it for the only saved address too.
|
|
47
|
+
*/
|
|
48
|
+
export function addressControlsOf(address, settings) {
|
|
49
|
+
const deletable = settings.deleteControl !== false;
|
|
50
|
+
return {
|
|
51
|
+
edit: settings.editControl !== false,
|
|
52
|
+
remove: deletable && !address.isDefault,
|
|
53
|
+
makeDefault: settings.defaultControl !== false && !address.isDefault,
|
|
54
|
+
defaultLocked: deletable && address.isDefault,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=address-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-list.js","sourceRoot":"","sources":["../src/address-list.ts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K,KAAK;QACpC,MAAM,EAAE,SAAS,IAAI,CAAC,OAAO,CAAC,SAAS;QACvC,WAAW,EAAE,QAAQ,CAAC,cAAc,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,SAAS;QACpE,aAAa,EAAE,SAAS,IAAI,OAAO,CAAC,SAAS;KAC9C,CAAC;AACJ,CAAC"}
|
package/dist/buy-box.d.ts
CHANGED
|
@@ -24,6 +24,14 @@ declare const BUY_BOX_ROLES: {
|
|
|
24
24
|
readonly buy: "action";
|
|
25
25
|
readonly notify: "text";
|
|
26
26
|
readonly notify_done: "success";
|
|
27
|
+
readonly primary: "action";
|
|
28
|
+
readonly secondary: "text";
|
|
29
|
+
readonly secondary_hint: "muted";
|
|
30
|
+
readonly choice: "text";
|
|
31
|
+
readonly row_selected: "sunken";
|
|
32
|
+
readonly radio: "subtle";
|
|
33
|
+
readonly bar: "elevated";
|
|
34
|
+
readonly bar_border: "border";
|
|
27
35
|
};
|
|
28
36
|
export type BuyBoxPart = keyof typeof BUY_BOX_ROLES;
|
|
29
37
|
export type BuyBoxColors = Readonly<Record<BuyBoxPart, string>>;
|
package/dist/buy-box.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buy-box.d.ts","sourceRoot":"","sources":["../src/buy-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAGjC,mHAAmH;AACnH,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"buy-box.d.ts","sourceRoot":"","sources":["../src/buy-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAGjC,mHAAmH;AACnH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC4C,CAAC;AAEhE,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,aAAa,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAE5D;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAKvC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAI9F;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,EAC7C,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,IAAI,CAWf"}
|
package/dist/buy-box.js
CHANGED
|
@@ -25,6 +25,14 @@ const BUY_BOX_ROLES = {
|
|
|
25
25
|
buy: 'action',
|
|
26
26
|
notify: 'text',
|
|
27
27
|
notify_done: 'success',
|
|
28
|
+
primary: 'action',
|
|
29
|
+
secondary: 'text',
|
|
30
|
+
secondary_hint: 'muted',
|
|
31
|
+
choice: 'text',
|
|
32
|
+
row_selected: 'sunken',
|
|
33
|
+
radio: 'subtle',
|
|
34
|
+
bar: 'elevated',
|
|
35
|
+
bar_border: 'border',
|
|
28
36
|
};
|
|
29
37
|
/**
|
|
30
38
|
* Every colour the welded panel draws, one per part, with `buy_box.<part>` as
|
package/dist/buy-box.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buy-box.js","sourceRoot":"","sources":["../src/buy-box.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAIf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,mHAAmH;AACnH,MAAM,aAAa,GAAG;IACpB,KAAK,EAA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AI,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM,CACrE,CACF,CAAC;IACF,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC;IACpD,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClF,CAAC"}
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -40,6 +40,13 @@ export interface AddressUpdateInput {
|
|
|
40
40
|
readonly addressId: string;
|
|
41
41
|
readonly address: AddressInput;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* What a block may hand a sign-in: the email the shopper typed, which Shopify's
|
|
45
|
+
* hosted step opens with already in its field. None, and that step asks for it.
|
|
46
|
+
*/
|
|
47
|
+
export interface SignInInput {
|
|
48
|
+
readonly email?: string;
|
|
49
|
+
}
|
|
43
50
|
/**
|
|
44
51
|
* The Notification Invitation as a renderer sees it: whether there is still
|
|
45
52
|
* anything to ask, the tap that opens the phone's own prompt, and the tap
|
|
@@ -58,7 +65,10 @@ export interface NotificationInvitation {
|
|
|
58
65
|
* repaint only on Shopify's answer, never before. A sign-in resolves once the
|
|
59
66
|
* shopper holds an Account Session, and each account write once Shopify wrote
|
|
60
67
|
* it; a shopper who is not signed in gets the refusal, so a block never has to
|
|
61
|
-
* ask whether a capability is reachable before it calls one.
|
|
68
|
+
* ask whether a capability is reachable before it calls one. A sign-out asks
|
|
69
|
+
* the shopper first, in the host's own sheet that no block can skip: it
|
|
70
|
+
* resolves once they chose to log out and the sign-out landed, and rejects
|
|
71
|
+
* with the `refused` outcome when they stay signed in.
|
|
62
72
|
*/
|
|
63
73
|
export interface Capabilities {
|
|
64
74
|
readonly addToCart: (line: CartLineInput) => Promise<void>;
|
|
@@ -71,7 +81,7 @@ export interface Capabilities {
|
|
|
71
81
|
readonly setCartNote: (note: string) => Promise<void>;
|
|
72
82
|
readonly setLineAttributes: (input: CartLineAttributesInput) => Promise<void>;
|
|
73
83
|
readonly notificationInvitation: NotificationInvitation;
|
|
74
|
-
readonly signIn: () => Promise<void>;
|
|
84
|
+
readonly signIn: (input?: SignInInput) => Promise<void>;
|
|
75
85
|
readonly signOut: () => Promise<void>;
|
|
76
86
|
readonly updateProfile: (input: ProfileUpdateInput) => Promise<void>;
|
|
77
87
|
readonly addAddress: (input: AddressInput) => Promise<void>;
|