@shoplix-ai/block-kit 4.6.0 → 5.0.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 +34 -7
- package/dist/account-links.d.ts +47 -0
- package/dist/account-links.d.ts.map +1 -0
- package/dist/account-links.js +61 -0
- package/dist/account-links.js.map +1 -0
- package/dist/address-list.d.ts +57 -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/capabilities.d.ts +8 -1
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js.map +1 -1
- 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/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 +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/navigation.d.ts +8 -2
- package/dist/navigation.d.ts.map +1 -1
- package/dist/orders.d.ts +84 -0
- package/dist/orders.d.ts.map +1 -0
- package/dist/orders.js +188 -0
- package/dist/orders.js.map +1 -0
- package/dist/profile-header.d.ts +23 -0
- package/dist/profile-header.d.ts.map +1 -0
- package/dist/profile-header.js +29 -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 +25 -0
- package/dist/sign-in.d.ts.map +1 -0
- package/dist/sign-in.js +24 -0
- package/dist/sign-in.js.map +1 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/dist/words.d.ts +120 -0
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +351 -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, the page Shopify hosts for it and the Address Sheet on one saved
|
|
14
|
+
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)
|
|
@@ -77,7 +81,8 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
77
81
|
`brandRailColors`, `buyBoxColors`, `announcementBarColors`, `shippingProgressColors`, `productGalleryColors`,
|
|
78
82
|
`productSummaryColors`, `productSpecsColors`, `reviewsSlotColors`,
|
|
79
83
|
`cartLinesColors`, `cartEmptyColors`, `cartDiscountCodeColors`,
|
|
80
|
-
`cartSummaryColors
|
|
84
|
+
`cartSummaryColors`, `checkoutButtonColors`, `signInColors`,
|
|
85
|
+
`profileHeaderColors` and `accountLinksColors`, the colour tables the
|
|
81
86
|
promoted blocks read on the phone and on the web alike: a theme role per part
|
|
82
87
|
of the block, with a component token at `<block>.<part>` over it.
|
|
83
88
|
`readableInk` is the one rule for words on a colour the merchant chose, so a
|
|
@@ -88,7 +93,26 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
88
93
|
items it holds in the form the buyer's language counts that number in, and
|
|
89
94
|
`cartBadgeCount` what a cart badge writes over a glyph, capped at 99+, and
|
|
90
95
|
`BUY_QUANTITY_CEILING` the most of one variant a buy control offers to add in
|
|
91
|
-
one tap.
|
|
96
|
+
one tap. `customerInitials` is the letters an avatar draws for a shopper,
|
|
97
|
+
and `accountLinkRows` the rows of the account links as both renderers draw
|
|
98
|
+
them: named, the hidden ones left out, sign out and delete set apart.
|
|
99
|
+
`orderColors` and `orderRadius` are the one table and the one corner the
|
|
100
|
+
eight order blocks share at `order.<part>`; `fulfillmentPillOf` and
|
|
101
|
+
`paymentPillOf` are the two pills of an order, a word and one of four tones,
|
|
102
|
+
and `orderPillColors` the ink and the surface of a tone; `SHIPMENT_STEPS`
|
|
103
|
+
and `shipmentStepReached` are the progress rail of a shipment,
|
|
104
|
+
`fulfillmentEventWord` and `shipmentWord` its words; `orderMoneyRows` lists
|
|
105
|
+
the money rows Shopify wrote, and `orderDay` and `orderTime` write a
|
|
106
|
+
timestamp as a shopper reads it. `addressListColors` and `addressListRadius`
|
|
107
|
+
are the table and the corner of the address list at `address_list.<part>`,
|
|
108
|
+
`addressCardOf` the title and the lines of one saved address, and
|
|
109
|
+
`addressControlsOf` which of its three controls a card offers, and whether
|
|
110
|
+
the card says why it offers no Delete: the default address is never offered
|
|
111
|
+
Delete, because Shopify refuses that delete in English in every language and
|
|
112
|
+
refuses it for the only saved address too. `heroPageLabel` says which page of how many a hero carousel rests
|
|
113
|
+
on, because its marks carry no words of their own. `promoSetLabel` says how
|
|
114
|
+
many promotions a promo banner stacks, and `promoCardLabel` which of them a
|
|
115
|
+
card is, beside the merchant's words or in place of them.
|
|
92
116
|
`derivedPrice` writes a figure a block worked out for itself, in the style the
|
|
93
117
|
theme chose and at the currency's own places so it lines up in a column with
|
|
94
118
|
the ones Shopify sent; `derivedMoney` is the same figure with an empty
|
|
@@ -148,8 +172,11 @@ when they wrote a language the buyer reads and the catalog's word otherwise.
|
|
|
148
172
|
|
|
149
173
|
The name a screen reader reads is functional too, whatever the drawing shows.
|
|
150
174
|
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
|
|
175
|
+
announced by which of how many it is, or as `promo.promotion` when it stands
|
|
176
|
+
alone, rather than as a button with no name; the merchant's headline still wins
|
|
177
|
+
wherever they wrote one, with its place in the set beside it. A horizontal rail
|
|
178
|
+
of more than one item is named by `rail.scroll_hint`, so a buyer who cannot see
|
|
179
|
+
it is told it scrolls sideways.
|
|
153
180
|
|
|
154
181
|
The catalog answers in English, Arabic and Turkish. A language it does not
|
|
155
182
|
carry falls back to English, written down here rather than left to whichever
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type AccountLinkRow, 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
|
+
export {};
|
|
47
|
+
//# 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,EAIL,KAAK,cAAc,EAEnB,KAAK,UAAU,EACf,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAKjC;;;;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;AAUD,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;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,cAAc,EAAE,GAAG,SAAS,EAC3C,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,UAAU,GAC1B,eAAe,CAajB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { componentTokenValue, isDestructiveTarget, shownAccountLinkRows, } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import { localize } from './locale.js';
|
|
3
|
+
import { partColors } from './part-colors.js';
|
|
4
|
+
import { platformWords } from './words.js';
|
|
5
|
+
/**
|
|
6
|
+
* The parts of the account links, each with the theme role it draws unless a
|
|
7
|
+
* component token names another. No theme role is a red, so the destructive
|
|
8
|
+
* rows draw the warning role until a design names its own.
|
|
9
|
+
*/
|
|
10
|
+
const ACCOUNT_LINKS_ROLES = {
|
|
11
|
+
title: 'subtle',
|
|
12
|
+
group: 'surface',
|
|
13
|
+
rule: 'border',
|
|
14
|
+
icon_well: 'sunken',
|
|
15
|
+
icon: 'text',
|
|
16
|
+
label: 'text',
|
|
17
|
+
chevron: 'muted',
|
|
18
|
+
destructive: 'warning',
|
|
19
|
+
destructive_surface: 'sunken',
|
|
20
|
+
};
|
|
21
|
+
/** Every colour the account links draw, one per part, with `account_links.<part>` over each theme role. */
|
|
22
|
+
export function accountLinksColors(theme) {
|
|
23
|
+
return partColors(theme, 'account_links', ACCOUNT_LINKS_ROLES);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The corner the group and a destructive row are cut with: the merchant's own,
|
|
27
|
+
* with `account_links.radius` over it for a design whose lists are softer than
|
|
28
|
+
* its buttons.
|
|
29
|
+
*/
|
|
30
|
+
export function accountLinksRadius(theme) {
|
|
31
|
+
return componentTokenValue(theme, 'account_links.radius', theme.radius);
|
|
32
|
+
}
|
|
33
|
+
const ROW_WORDS = {
|
|
34
|
+
open_orders: 'account.orders',
|
|
35
|
+
open_addresses: 'account.addresses',
|
|
36
|
+
open_profile: 'account.profile',
|
|
37
|
+
sign_out: 'account.sign_out',
|
|
38
|
+
delete_account: 'account.delete_account',
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The rows of the account links as both renderers draw them, in the
|
|
42
|
+
* merchant's order. A row the merchant left unnamed reads the platform's word
|
|
43
|
+
* for where it leads; a custom screen and a web address have no such word, so
|
|
44
|
+
* one of those with no label in a language the buyer reads is left out rather
|
|
45
|
+
* than drawn blank. Sign out and delete are set apart from the group.
|
|
46
|
+
*/
|
|
47
|
+
export function accountLinkRows(rows, language, defaultLanguage) {
|
|
48
|
+
const words = platformWords(language, defaultLanguage);
|
|
49
|
+
const named = shownAccountLinkRows(rows)
|
|
50
|
+
.map((row) => {
|
|
51
|
+
const word = ROW_WORDS[row.target.type];
|
|
52
|
+
const written = row.label === undefined ? '' : localize(row.label, language, defaultLanguage);
|
|
53
|
+
return { row, label: word === undefined ? written : words.merchantOr(row.label, word) };
|
|
54
|
+
})
|
|
55
|
+
.filter(({ label }) => label !== '');
|
|
56
|
+
return {
|
|
57
|
+
grouped: named.filter(({ row }) => !isDestructiveTarget(row.target)),
|
|
58
|
+
destructive: named.filter(({ row }) => isDestructiveTarget(row.target)),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# 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,oBAAoB,GAKrB,MAAM,yBAAyB,CAAC;AACjC,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;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vC,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpE,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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 Shopify's own, formatted for the country of the
|
|
33
|
+
* address: the first titles the card and the rest stand under it. Shopify's
|
|
34
|
+
* lines carry no phone, so the one the shopper wrote is drawn last.
|
|
35
|
+
*/
|
|
36
|
+
export declare function addressCardOf(address: AddressDisplay): AddressCard;
|
|
37
|
+
/** Which of the three controls a card offers, and whether it says why Delete is missing. */
|
|
38
|
+
export interface AddressControls {
|
|
39
|
+
readonly edit: boolean;
|
|
40
|
+
readonly remove: boolean;
|
|
41
|
+
readonly makeDefault: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The merchant left Delete on, and this card is the default, so the card
|
|
44
|
+
* says another address must be the default first in place of the control.
|
|
45
|
+
*/
|
|
46
|
+
readonly defaultLocked: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Each control is offered unless the merchant hid it. The default address is
|
|
50
|
+
* offered neither the control that would make it the default nor the one that
|
|
51
|
+
* would delete it: Shopify refuses to delete a default address, in English in
|
|
52
|
+
* every language, and refuses it for the only saved address too. The card says
|
|
53
|
+
* so in the shopper's own words before the tap instead of after it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function addressControlsOf(address: AddressDisplay, settings: AddressListBlock['props']): AddressControls;
|
|
56
|
+
export {};
|
|
57
|
+
//# 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;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAMlE;AAED,4FAA4F;AAC5F,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;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;GAMG;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 Shopify's own, formatted for the country of the
|
|
31
|
+
* address: the first titles the card and the rest stand under it. Shopify's
|
|
32
|
+
* lines carry no phone, so the one the shopper wrote is drawn last.
|
|
33
|
+
*/
|
|
34
|
+
export function addressCardOf(address) {
|
|
35
|
+
const [title = '', ...rest] = address.formatted;
|
|
36
|
+
return {
|
|
37
|
+
title,
|
|
38
|
+
lines: address.phoneNumber === undefined ? rest : [...rest, address.phoneNumber],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Each control is offered unless the merchant hid it. The default address is
|
|
43
|
+
* offered neither the control that would make it the default nor the one that
|
|
44
|
+
* would delete it: Shopify refuses to delete a default address, in English in
|
|
45
|
+
* every language, and refuses it for the only saved address too. The card says
|
|
46
|
+
* so in the shopper's own words before the tap instead of after it.
|
|
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"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAIpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,UAAU;IACxB,WAAW,EAAE,SAAS;IACtB,KAAK,EAAE,OAAO;CAC+C,CAAC;AAMhE,0GAA0G;AAC1G,MAAM,UAAU,iBAAiB,CAAC,KAAiB;IACjD,OAAO,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,kBAAkB,CAAC,CAAC;AAC/D,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,iBAAiB,CAAC,KAAiB;IACjD,OAAO,mBAAmB,CAAC,KAAK,EAAE,qBAAqB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AACzE,CAAC;AAQD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAuB;IACnD,MAAM,CAAC,KAAK,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAChD,OAAO;QACL,KAAK;QACL,KAAK,EAAE,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC;KACjF,CAAC;AACJ,CAAC;AAcD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAuB,EACvB,QAAmC;IAEnC,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,KAAK,KAAK,CAAC;IACnD,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,WAAW,KAAK,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/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
|
|
@@ -71,7 +78,7 @@ export interface Capabilities {
|
|
|
71
78
|
readonly setCartNote: (note: string) => Promise<void>;
|
|
72
79
|
readonly setLineAttributes: (input: CartLineAttributesInput) => Promise<void>;
|
|
73
80
|
readonly notificationInvitation: NotificationInvitation;
|
|
74
|
-
readonly signIn: () => Promise<void>;
|
|
81
|
+
readonly signIn: (input?: SignInInput) => Promise<void>;
|
|
75
82
|
readonly signOut: () => Promise<void>;
|
|
76
83
|
readonly updateProfile: (input: ProfileUpdateInput) => Promise<void>;
|
|
77
84
|
readonly addAddress: (input: AddressInput) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EA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AAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,QAAQ,CAAC,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,QAAQ,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,8EAA8E;AAC9E,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;AAEvF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAQnE;;;;;;GAMG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAIxC,QAAQ,CAAC,OAAO,EAAE,iBAAiB;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE;IAJtC,SAAkB,IAAI,uBAAuB;gBAGlC,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,SAAS,MAAM,EAAE;CAIvC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAU9E"}
|
package/dist/capabilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,GAKvB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,GAKvB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAuGvD,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAoB;IAC/D,SAAS;IACT,WAAW;IACX,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAI/B;IACA;IAJO,IAAI,GAAG,mBAAmB,CAAC;IAE7C,YACW,OAA0B,EAC1B,QAA2B;QAEpC,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAHjD,YAAO,GAAP,OAAO,CAAmB;QAC1B,aAAQ,GAAR,QAAQ,CAAmB;IAGtC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,GAAG,GAAG,KAAkE,CAAC;IAC/E,OAAO,CACL,GAAG,CAAC,IAAI,KAAK,mBAAmB;QAChC,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;QAC/B,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QACzB,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC3B,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAC7D,CAAC;AACJ,CAAC"}
|
package/dist/contract.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
-
import type { BindingData, BoundItem, EnvelopeAssets, LocaleCode, ThemeStyle, ThemeTokens } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
import type { BindingData, BoundItem, EnvelopeAssets, LocaleCode, RowItem, ThemeStyle, ThemeTokens } from '@shoplix-ai/sdui-schema';
|
|
3
3
|
import type { CapabilityName, CapabilityObject } from './capabilities.js';
|
|
4
4
|
import type { BlockNavigation } from './navigation.js';
|
|
5
5
|
export type TextDirection = 'ltr' | 'rtl';
|
|
@@ -58,11 +58,13 @@ export interface BlockRenderProps<TSettings extends BlockSettings = BlockSetting
|
|
|
58
58
|
export type BlockRenderer<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> = ComponentType<BlockRenderProps<TSettings, K>>;
|
|
59
59
|
/**
|
|
60
60
|
* What the item renderer of a row receives: everything the block receives,
|
|
61
|
-
* plus the one
|
|
62
|
-
*
|
|
61
|
+
* plus the one item this cell draws, its place in the Binding's items and the
|
|
62
|
+
* width the host gives the cell. The item is a bound item unless the block
|
|
63
|
+
* names another: a block of the shopper's own data draws an order, or a line
|
|
64
|
+
* of one.
|
|
63
65
|
*/
|
|
64
|
-
export interface BlockItemRenderProps<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> extends BlockRenderProps<TSettings, K> {
|
|
65
|
-
readonly item:
|
|
66
|
+
export interface BlockItemRenderProps<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never, TItem extends RowItem = BoundItem> extends BlockRenderProps<TSettings, K> {
|
|
67
|
+
readonly item: TItem;
|
|
66
68
|
readonly index: number;
|
|
67
69
|
readonly width: number;
|
|
68
70
|
}
|
|
@@ -70,15 +72,18 @@ export interface BlockItemRenderProps<TSettings extends BlockSettings = BlockSet
|
|
|
70
72
|
* How a bound block hands its items to the host instead of drawing them
|
|
71
73
|
* itself: an optional header, one item renderer, an optional footer, and how
|
|
72
74
|
* many items stand side by side with how much space between them. `columns`
|
|
73
|
-
* defaults to 1 and `gap` to 0 where the host lays rows out.
|
|
74
|
-
* the
|
|
75
|
+
* defaults to 1 and `gap` to 0 where the host lays rows out. `empty` stands in
|
|
76
|
+
* the place of all of it when the Binding answered no item; without one an
|
|
77
|
+
* empty block draws nothing. A host without the row layout ignores all of it
|
|
78
|
+
* and calls `render`.
|
|
75
79
|
*/
|
|
76
|
-
export interface BlockRows<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> {
|
|
80
|
+
export interface BlockRows<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never, TItem extends RowItem = BoundItem> {
|
|
77
81
|
readonly columns?: (props: BlockRenderProps<TSettings, K>) => number;
|
|
78
82
|
readonly gap?: (props: BlockRenderProps<TSettings, K>) => number;
|
|
79
83
|
readonly header?: BlockRenderer<TSettings, K>;
|
|
80
|
-
readonly item: ComponentType<BlockItemRenderProps<TSettings, K>>;
|
|
84
|
+
readonly item: ComponentType<BlockItemRenderProps<TSettings, K, TItem>>;
|
|
81
85
|
readonly footer?: BlockRenderer<TSettings, K>;
|
|
86
|
+
readonly empty?: BlockRenderer<TSettings, K>;
|
|
82
87
|
}
|
|
83
88
|
/** Who answers for a Block Type: the platform, or the Shop whose package registered it. */
|
|
84
89
|
export type BlockOwner = string;
|
|
@@ -91,13 +96,13 @@ export type BlockOwner = string;
|
|
|
91
96
|
*/
|
|
92
97
|
export type BlockChrome = 'header';
|
|
93
98
|
/** The typed authoring shape: settings and capabilities are inferred from the definition. */
|
|
94
|
-
export interface BlockDefinition<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> {
|
|
99
|
+
export interface BlockDefinition<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never, TItem extends RowItem = BoundItem> {
|
|
95
100
|
readonly type: string;
|
|
96
101
|
readonly owner: BlockOwner;
|
|
97
102
|
readonly capabilities?: readonly K[];
|
|
98
103
|
readonly chrome?: BlockChrome;
|
|
99
104
|
readonly render: BlockRenderer<TSettings, K>;
|
|
100
|
-
readonly rows?: BlockRows<TSettings, K> | undefined;
|
|
105
|
+
readonly rows?: BlockRows<TSettings, K, TItem> | undefined;
|
|
101
106
|
}
|
|
102
107
|
/**
|
|
103
108
|
* The shape a registry stores and a host renders: one entry per Block Type.
|
|
@@ -119,8 +124,9 @@ export interface BlockRegistration {
|
|
|
119
124
|
}
|
|
120
125
|
/**
|
|
121
126
|
* Turns a typed definition into a registration. The settings a renderer
|
|
122
|
-
* receives come from a document parsed against the schema for its type,
|
|
123
|
-
* the
|
|
127
|
+
* receives come from a document parsed against the schema for its type, and
|
|
128
|
+
* the items its rows draw from the Binding its type is welded to, so the
|
|
129
|
+
* widening to the stored shape happens here, once, and nowhere else.
|
|
124
130
|
*/
|
|
125
|
-
export declare function defineBlock<TSettings extends BlockSettings = BlockSettings, const K extends CapabilityName = never>(definition: BlockDefinition<TSettings, K>): BlockRegistration;
|
|
131
|
+
export declare function defineBlock<TSettings extends BlockSettings = BlockSettings, const K extends CapabilityName = never, TItem extends RowItem = BoundItem>(definition: BlockDefinition<TSettings, K, TItem>): BlockRegistration;
|
|
126
132
|
//# sourceMappingURL=contract.d.ts.map
|
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,C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WAAW,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,oGAAoG;IACpG,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,SAAS,SAAS,aAAa,GAAG,aAAa,EAC/C,KAAK,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,EACtC,KAAK,SAAS,OAAO,GAAG,SAAS,EACjC,UAAU,EAAE,eAAe,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,iBAAiB,CASrE"}
|
package/dist/contract.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Turns a typed definition into a registration. The settings a renderer
|
|
3
|
-
* receives come from a document parsed against the schema for its type,
|
|
4
|
-
* the
|
|
3
|
+
* receives come from a document parsed against the schema for its type, and
|
|
4
|
+
* the items its rows draw from the Binding its type is welded to, so the
|
|
5
|
+
* widening to the stored shape happens here, once, and nowhere else.
|
|
5
6
|
*/
|
|
6
7
|
export function defineBlock(definition) {
|
|
7
8
|
return {
|
package/dist/contract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAmKA;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAIzB,UAAgD;IAChD,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,EAAE;QAC3C,GAAG,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC;QACzE,MAAM,EAAE,UAAU,CAAC,MAAkC;QACrD,IAAI,EAAE,UAAU,CAAC,IAAwC;KAC1D,CAAC;AACJ,CAAC"}
|
package/dist/hero-banner.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
1
|
+
import { type LocaleCode, type ThemeStyle } from '@shoplix-ai/sdui-schema';
|
|
2
2
|
/** The parts of the hero banner, each with the theme role it draws unless a component token names another. */
|
|
3
3
|
declare const HERO_BANNER_ROLES: {
|
|
4
4
|
readonly artwork: "sunken";
|
|
@@ -23,5 +23,14 @@ export declare function heroBannerColors(theme: ThemeStyle): HeroBannerColors;
|
|
|
23
23
|
* than its cards.
|
|
24
24
|
*/
|
|
25
25
|
export declare function heroBannerRadius(theme: ThemeStyle): number;
|
|
26
|
+
/**
|
|
27
|
+
* What the page indicator says out loud: which page of how many the carousel
|
|
28
|
+
* rests on, in the buyer's language. The page is the one the carousel holds,
|
|
29
|
+
* by its own index, and the word writes it from one because a buyer counts the
|
|
30
|
+
* first page as one. The marks themselves carry no words, so without this a
|
|
31
|
+
* buyer who cannot see them is never told the hero has more pages, nor which
|
|
32
|
+
* one is on screen.
|
|
33
|
+
*/
|
|
34
|
+
export declare function heroPageLabel(pageIndex: number, pages: number, language: LocaleCode, defaultLanguage: LocaleCode): string;
|
|
26
35
|
export {};
|
|
27
36
|
//# sourceMappingURL=hero-banner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hero-banner.d.ts","sourceRoot":"","sources":["../src/hero-banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"hero-banner.d.ts","sourceRoot":"","sources":["../src/hero-banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIhG,8GAA8G;AAC9G,QAAA,MAAM,iBAAiB;;;;;;;CAOwC,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAE5D,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,gBAAgB,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE1D;AAKD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,UAAU,GAC1B,MAAM,CAKR"}
|
package/dist/hero-banner.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { componentTokenValue } from '@shoplix-ai/sdui-schema';
|
|
2
2
|
import { partColors } from './part-colors.js';
|
|
3
|
+
import { platformWords } from './words.js';
|
|
3
4
|
/** The parts of the hero banner, each with the theme role it draws unless a component token names another. */
|
|
4
5
|
const HERO_BANNER_ROLES = {
|
|
5
6
|
artwork: 'sunken',
|
|
@@ -26,4 +27,20 @@ export function heroBannerColors(theme) {
|
|
|
26
27
|
export function heroBannerRadius(theme) {
|
|
27
28
|
return componentTokenValue(theme, 'hero_banner.radius', theme.radius);
|
|
28
29
|
}
|
|
30
|
+
const PAGE_SLOT = '{page}';
|
|
31
|
+
const PAGES_SLOT = '{pages}';
|
|
32
|
+
/**
|
|
33
|
+
* What the page indicator says out loud: which page of how many the carousel
|
|
34
|
+
* rests on, in the buyer's language. The page is the one the carousel holds,
|
|
35
|
+
* by its own index, and the word writes it from one because a buyer counts the
|
|
36
|
+
* first page as one. The marks themselves carry no words, so without this a
|
|
37
|
+
* buyer who cannot see them is never told the hero has more pages, nor which
|
|
38
|
+
* one is on screen.
|
|
39
|
+
*/
|
|
40
|
+
export function heroPageLabel(pageIndex, pages, language, defaultLanguage) {
|
|
41
|
+
return platformWords(language, defaultLanguage)
|
|
42
|
+
.own('hero.page_of')
|
|
43
|
+
.replaceAll(PAGE_SLOT, String(pageIndex + 1))
|
|
44
|
+
.replaceAll(PAGES_SLOT, String(pages));
|
|
45
|
+
}
|
|
29
46
|
//# sourceMappingURL=hero-banner.js.map
|
package/dist/hero-banner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hero-banner.js","sourceRoot":"","sources":["../src/hero-banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"hero-banner.js","sourceRoot":"","sources":["../src/hero-banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAoC,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,8GAA8G;AAC9G,MAAM,iBAAiB,GAAG;IACxB,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,QAAQ;CAC0C,CAAC;AAMhE;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAiB;IAChD,OAAO,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAiB;IAChD,OAAO,mBAAmB,CAAC,KAAK,EAAE,oBAAoB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,SAAS,GAAG,QAAQ,CAAC;AAC3B,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,SAAiB,EACjB,KAAa,EACb,QAAoB,EACpB,eAA2B;IAE3B,OAAO,aAAa,CAAC,QAAQ,EAAE,eAAe,CAAC;SAC5C,GAAG,CAAC,cAAc,CAAC;SACnB,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;SAC5C,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CAPABILITY_NAMES, CapabilityRefusal, isCapabilityRefusal } from './capabilities.js';
|
|
2
|
-
export type { AddressInput, AddressUpdateInput, Capabilities, CapabilityName, CapabilityObject, CapabilityOutcome, CartLineAttributesInput, CartLineInput, CartLineQuantityInput, NotificationInvitation, ProfileUpdateInput, } from './capabilities.js';
|
|
2
|
+
export type { AddressInput, AddressUpdateInput, Capabilities, CapabilityName, CapabilityObject, CapabilityOutcome, CartLineAttributesInput, CartLineInput, CartLineQuantityInput, NotificationInvitation, ProfileUpdateInput, SignInInput, } from './capabilities.js';
|
|
3
3
|
export { defineBlock } from './contract.js';
|
|
4
4
|
export type { AccountSummary, BlockChrome, BlockDefinition, BlockItemRenderProps, BlockOwner, BlockRegistration, BlockRenderProps, BlockRenderer, BlockRows, BlockSettings, CartSummary, TextDirection, } from './contract.js';
|
|
5
5
|
export type { BlockNavigation } from './navigation.js';
|
|
@@ -35,9 +35,9 @@ export { cartSavings, cartSummaryColors } from './cart-summary.js';
|
|
|
35
35
|
export type { CartSummaryColors, CartSummaryPart } from './cart-summary.js';
|
|
36
36
|
export { checkoutButtonColors } from './checkout-button.js';
|
|
37
37
|
export type { CheckoutButtonColors, CheckoutButtonPart } from './checkout-button.js';
|
|
38
|
-
export { heroBannerColors, heroBannerRadius } from './hero-banner.js';
|
|
38
|
+
export { heroBannerColors, heroBannerRadius, heroPageLabel } from './hero-banner.js';
|
|
39
39
|
export type { HeroBannerColors, HeroBannerPart } from './hero-banner.js';
|
|
40
|
-
export { promoBannerColors, promoBannerRadius } from './promo-banner.js';
|
|
40
|
+
export { promoBannerColors, promoBannerRadius, promoCardLabel, promoSetLabel, } from './promo-banner.js';
|
|
41
41
|
export type { PromoBannerColors, PromoBannerPart } from './promo-banner.js';
|
|
42
42
|
export { sectionHeaderColors } from './section-header.js';
|
|
43
43
|
export { featureStripColors } from './feature-strip.js';
|
|
@@ -49,6 +49,16 @@ export { announcementBarColors } from './announcement-bar.js';
|
|
|
49
49
|
export { aroundAmount, shippingProgress, shippingProgressColors } from './shipping-progress.js';
|
|
50
50
|
export { cartBadgeCount, storeHeaderColors } from './store-header.js';
|
|
51
51
|
export type { StoreHeaderColors, StoreHeaderPart } from './store-header.js';
|
|
52
|
+
export { signInColors } from './sign-in.js';
|
|
53
|
+
export type { SignInColors, SignInPart } from './sign-in.js';
|
|
54
|
+
export { customerInitials, profileHeaderColors } from './profile-header.js';
|
|
55
|
+
export type { ProfileHeaderColors, ProfileHeaderPart } from './profile-header.js';
|
|
56
|
+
export { accountLinkRows, accountLinksColors, accountLinksRadius } from './account-links.js';
|
|
57
|
+
export type { AccountLinkRows, AccountLinksColors, AccountLinksPart, NamedAccountLink, } from './account-links.js';
|
|
58
|
+
export { addressCardOf, addressControlsOf, addressListColors, addressListRadius, } from './address-list.js';
|
|
59
|
+
export type { AddressCard, AddressControls, AddressListColors, AddressListPart, } from './address-list.js';
|
|
60
|
+
export { SHIPMENT_STEPS, fulfillmentEventWord, fulfillmentPillOf, orderColors, orderDay, orderMoneyRows, orderPillColors, orderRadius, orderTime, paymentPillOf, shipmentStepReached, shipmentWord, } from './orders.js';
|
|
61
|
+
export type { OrderColors, OrderMoneyRow, OrderPart, OrderPill, OrderPillColors, OrderPillTone, ShipmentStep, } from './orders.js';
|
|
52
62
|
export { readableInk } from './readable.js';
|
|
53
63
|
export type { SectionHeaderColors, SectionHeaderPart } from './section-header.js';
|
|
54
64
|
export type { FeatureStripColors, FeatureStripPart } from './feature-strip.js';
|
|
@@ -62,6 +72,6 @@ export { imageSourceFor } from './renditions.js';
|
|
|
62
72
|
export type { ImageSource } from './renditions.js';
|
|
63
73
|
export { localize, pickLocale, textDirection } from './locale.js';
|
|
64
74
|
export type { ShopLanguages } from './locale.js';
|
|
65
|
-
export { CATALOG_LANGUAGES, WORD_KEYS, cartItemCount, platformWords } from './words.js';
|
|
75
|
+
export { CATALOG_LANGUAGES, DELETION_FACTS, WORD_KEYS, cartItemCount, platformWords, } from './words.js';
|
|
66
76
|
export type { PlatformWords, WordKey } from './words.js';
|
|
67
77
|
//# sourceMappingURL=index.d.ts.map
|