@shoplix-ai/block-kit 3.0.0 → 3.1.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 +60 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/locale.d.ts +13 -2
- package/dist/locale.d.ts.map +1 -1
- package/dist/locale.js +22 -9
- package/dist/locale.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/words.d.ts +97 -0
- package/dist/words.d.ts.map +1 -0
- package/dist/words.js +223 -0
- package/dist/words.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,7 +52,66 @@ written against this package and nothing else from the runtime. It holds:
|
|
|
52
52
|
currency, for display only: the total a buyer sees is always Shopify's),
|
|
53
53
|
`pickLocale` (the buyer's language from the Shop's languages with default
|
|
54
54
|
fallback), `localize` (one string out of a locale object), `textDirection`,
|
|
55
|
-
`imageSourceFor` (the rendition to paint at a given display width)
|
|
55
|
+
`imageSourceFor` (the rendition to paint at a given display width), and
|
|
56
|
+
`platformWords`, the word catalog below.
|
|
57
|
+
|
|
58
|
+
## The theme a renderer receives
|
|
59
|
+
|
|
60
|
+
`props.theme` is the Shop's tokens resolved once, by the schema package, for
|
|
61
|
+
every renderer alike: the phone's, the dashboard canvas twin and the CLI's dev
|
|
62
|
+
page. It carries thirteen colour roles, two type families, a corner radius and
|
|
63
|
+
a spacing rhythm, and never a leaf to follow.
|
|
64
|
+
|
|
65
|
+
The colour roles are `brand`, `accent`, `action`, `surface`, `elevated`,
|
|
66
|
+
`text`, `muted`, `border`, `sunken`, `subtle`, `overlay`, `success` and
|
|
67
|
+
`warning`. The last six answer on every theme, whether the merchant named them
|
|
68
|
+
or not: a theme that names none derives them from the palette it does carry, so
|
|
69
|
+
`border` is a hairline that shows on the merchant's own background, `sunken` a
|
|
70
|
+
well under it, `subtle` a dimmer ink than `muted`, `overlay` a scrim in their
|
|
71
|
+
own surface, and the two status colours step toward the merchant's text until
|
|
72
|
+
they are legible on the merchant's surface. A theme that names one wins over
|
|
73
|
+
the derivation. Draw a role rather than a hex: a merchant with a dark theme
|
|
74
|
+
gets an unreadable block otherwise.
|
|
75
|
+
|
|
76
|
+
A design decision too particular for a role goes in the per component tier,
|
|
77
|
+
which is free form and needs no contract change. Read one through
|
|
78
|
+
`componentTokenValue`, by its dotted path under that tier, with a theme role
|
|
79
|
+
behind it:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
const line = componentTokenValue(theme, 'divider.line', theme.colors.border);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Two rules hold the convention together. The path names the Block Type first
|
|
86
|
+
and the part it draws second, so one Block Type's tokens sit in one group. The
|
|
87
|
+
fallback is always a theme role, never a literal: a merchant who names nothing
|
|
88
|
+
still gets their own palette, and the token is the escape hatch over it. A
|
|
89
|
+
token of another type is not drawn, the fallback is.
|
|
90
|
+
|
|
91
|
+
## The words a renderer owns
|
|
92
|
+
|
|
93
|
+
A renderer never carries its own literal. Every functional word the platform
|
|
94
|
+
puts on screen lives in one catalog, and a renderer reads it through
|
|
95
|
+
`platformWords(language, defaultLanguage)`:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
const words = platformWords(language, defaultLanguage);
|
|
99
|
+
words.own('cart.checkout');
|
|
100
|
+
words.merchantOr(settings.label, 'cart.subtotal');
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
A functional word is one the platform owns and the merchant never types:
|
|
104
|
+
Checkout, Sold out, Subtotal, Added, Could not add. Marketing copy, a trust
|
|
105
|
+
strip's promise or a promo card's headline, is merchant set localized text and
|
|
106
|
+
stays out of the catalog, because no catalog can guess it. Where a Block Type
|
|
107
|
+
lets the merchant overwrite a functional word, `merchantOr` takes their text
|
|
108
|
+
when they wrote a language the buyer reads and the catalog's word otherwise.
|
|
109
|
+
|
|
110
|
+
The catalog answers in English, Arabic and Turkish. A language it does not
|
|
111
|
+
carry falls back to English, written down here rather than left to whichever
|
|
112
|
+
string sits first in an object. Every language answers every key of
|
|
113
|
+
`WORD_KEYS`, which the type system and a test both hold; a word added in
|
|
114
|
+
English and nowhere else does not compile.
|
|
56
115
|
|
|
57
116
|
## Rows: what the host lays out
|
|
58
117
|
|
package/dist/index.d.ts
CHANGED
|
@@ -16,4 +16,6 @@ export { imageSourceFor } from './renditions.js';
|
|
|
16
16
|
export type { ImageSource } from './renditions.js';
|
|
17
17
|
export { localize, pickLocale, textDirection } from './locale.js';
|
|
18
18
|
export type { ShopLanguages } from './locale.js';
|
|
19
|
+
export { CATALOG_LANGUAGES, WORD_KEYS, platformWords } from './words.js';
|
|
20
|
+
export type { PlatformWords, WordKey } from './words.js';
|
|
19
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,YAAY,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACb,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,aAAa,EACb,WAAW,EACX,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;A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B,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9D,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACzE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,4 +8,5 @@ export { resolveToken } from './tokens.js';
|
|
|
8
8
|
export { formatMoney } from './money.js';
|
|
9
9
|
export { imageSourceFor } from './renditions.js';
|
|
10
10
|
export { localize, pickLocale, textDirection } from './locale.js';
|
|
11
|
+
export { CATALOG_LANGUAGES, WORD_KEYS, platformWords } from './words.js';
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":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U,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/locale.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export interface ShopLanguages {
|
|
|
4
4
|
readonly default: LocaleCode;
|
|
5
5
|
readonly supported: readonly LocaleCode[];
|
|
6
6
|
}
|
|
7
|
+
export declare const ENGLISH: LocaleCode;
|
|
8
|
+
export declare function baseOf(locale: string): string;
|
|
7
9
|
/**
|
|
8
10
|
* The buyer's language: the first preferred locale the Shop supports, by
|
|
9
11
|
* exact code, then by base language either way round; the Shop's default
|
|
@@ -11,8 +13,17 @@ export interface ShopLanguages {
|
|
|
11
13
|
*/
|
|
12
14
|
export declare function pickLocale(languages: ShopLanguages, preferred: readonly string[]): LocaleCode;
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
15
|
-
* language,
|
|
16
|
+
* The one string of a locale object the buyer can actually read: their own
|
|
17
|
+
* language, its base language, the Shop's default language, its base.
|
|
18
|
+
* Undefined when the text carries none of them, which is a caller's decision
|
|
19
|
+
* to make rather than a string to guess at.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readable(text: LocalizedText, language: LocaleCode, fallback: LocaleCode): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* One string out of a full locale object: the language the buyer reads, then
|
|
24
|
+
* English, then whatever the text carries. The last step is for merchant
|
|
25
|
+
* written text only, where one language the merchant typed beats nothing at
|
|
26
|
+
* all; a word the platform owns comes from the catalog instead.
|
|
16
27
|
*/
|
|
17
28
|
export declare function localize(text: LocalizedText, language: LocaleCode, fallback: LocaleCode): string;
|
|
18
29
|
export declare function textDirection(language: LocaleCode): TextDirection;
|
package/dist/locale.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../src/locale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU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|
|
2
|
+
export const ENGLISH = 'en';
|
|
3
|
+
export function baseOf(locale) {
|
|
3
4
|
return locale.split('-')[0].toLowerCase();
|
|
4
5
|
}
|
|
5
6
|
/**
|
|
@@ -19,16 +20,28 @@ export function pickLocale(languages, preferred) {
|
|
|
19
20
|
return languages.default;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
-
* language,
|
|
23
|
+
* The one string of a locale object the buyer can actually read: their own
|
|
24
|
+
* language, its base language, the Shop's default language, its base.
|
|
25
|
+
* Undefined when the text carries none of them, which is a caller's decision
|
|
26
|
+
* to make rather than a string to guess at.
|
|
27
|
+
*/
|
|
28
|
+
export function readable(text, language, fallback) {
|
|
29
|
+
const candidates = [
|
|
30
|
+
text[language],
|
|
31
|
+
text[baseOf(language)],
|
|
32
|
+
text[fallback],
|
|
33
|
+
text[baseOf(fallback)],
|
|
34
|
+
];
|
|
35
|
+
return candidates.find((candidate) => candidate !== undefined && candidate.length > 0);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One string out of a full locale object: the language the buyer reads, then
|
|
39
|
+
* English, then whatever the text carries. The last step is for merchant
|
|
40
|
+
* written text only, where one language the merchant typed beats nothing at
|
|
41
|
+
* all; a word the platform owns comes from the catalog instead.
|
|
24
42
|
*/
|
|
25
43
|
export function localize(text, language, fallback) {
|
|
26
|
-
return (text[
|
|
27
|
-
text[baseOf(language)] ??
|
|
28
|
-
text[fallback] ??
|
|
29
|
-
text[baseOf(fallback)] ??
|
|
30
|
-
Object.values(text)[0] ??
|
|
31
|
-
'');
|
|
44
|
+
return readable(text, language, fallback) ?? text[ENGLISH] ?? Object.values(text)[0] ?? '';
|
|
32
45
|
}
|
|
33
46
|
export function textDirection(language) {
|
|
34
47
|
return RTL_LANGUAGES.has(baseOf(language)) ? 'rtl' : 'ltr';
|
package/dist/locale.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.js","sourceRoot":"","sources":["../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d,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;KACvB,CAAC;IACF,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACzF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAmB,EAAE,QAAoB,EAAE,QAAoB;IACtF,OAAO,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAoB;IAChD,OAAO,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* The major is the compatibility line: a Shop package built against another
|
|
5
5
|
* major never meets this runtime, and a major bump is an announced event.
|
|
6
6
|
*/
|
|
7
|
-
export declare const CONTRACT_VERSION = "3.
|
|
7
|
+
export declare const CONTRACT_VERSION = "3.1.0";
|
|
8
8
|
export declare const CONTRACT_MAJOR = 3;
|
|
9
9
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* The major is the compatibility line: a Shop package built against another
|
|
5
5
|
* major never meets this runtime, and a major bump is an announced event.
|
|
6
6
|
*/
|
|
7
|
-
export const CONTRACT_VERSION = '3.
|
|
7
|
+
export const CONTRACT_VERSION = '3.1.0';
|
|
8
8
|
export const CONTRACT_MAJOR = 3;
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
package/dist/words.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { LocaleCode, LocalizedText } from '@shoplix-ai/sdui-schema';
|
|
2
|
+
/**
|
|
3
|
+
* Every functional word a platform renderer owns, in English. A functional
|
|
4
|
+
* word is one the platform puts on screen and the merchant never types:
|
|
5
|
+
* Checkout, Sold out, Subtotal, Added, Could not add. Marketing copy, a trust
|
|
6
|
+
* strip's promise or a promo card's headline, is merchant set localized text
|
|
7
|
+
* and has no place here, because no catalog can guess it.
|
|
8
|
+
*
|
|
9
|
+
* The key list is this table. A language that answers fewer keys does not
|
|
10
|
+
* compile, and a language the catalog does not carry falls back to English
|
|
11
|
+
* here, deliberately, rather than to whichever string happens to sit first in
|
|
12
|
+
* an object.
|
|
13
|
+
*/
|
|
14
|
+
declare const ENGLISH_WORDS: {
|
|
15
|
+
readonly 'cart.title': "Cart";
|
|
16
|
+
readonly 'cart.close': "Close";
|
|
17
|
+
readonly 'cart.empty': "Your cart is empty";
|
|
18
|
+
readonly 'cart.continue_shopping': "Continue shopping";
|
|
19
|
+
readonly 'cart.items_in_cart': "items in the cart";
|
|
20
|
+
readonly 'cart.subtotal': "Subtotal";
|
|
21
|
+
readonly 'cart.discount': "Discount";
|
|
22
|
+
readonly 'cart.line_discount': "Discount";
|
|
23
|
+
readonly 'cart.total': "Total";
|
|
24
|
+
readonly 'cart.estimated': "estimated";
|
|
25
|
+
readonly 'cart.checkout': "Checkout";
|
|
26
|
+
readonly 'cart.checkout_unavailable': "Checkout is unavailable right now. Please try again.";
|
|
27
|
+
readonly 'cart.remove': "Remove";
|
|
28
|
+
readonly 'cart.decrease': "Decrease quantity";
|
|
29
|
+
readonly 'cart.increase': "Increase quantity";
|
|
30
|
+
readonly 'cart.discount_code': "Discount code";
|
|
31
|
+
readonly 'cart.code_placeholder': "Enter a code";
|
|
32
|
+
readonly 'cart.apply': "Apply";
|
|
33
|
+
readonly 'cart.code_not_applicable': "This code is not valid for this cart";
|
|
34
|
+
readonly 'cart.note_label': "Order note";
|
|
35
|
+
readonly 'cart.note_placeholder': "Anything we should know?";
|
|
36
|
+
readonly 'cart.update_failed': "Could not update the cart";
|
|
37
|
+
readonly 'product.add_to_cart': "Add to cart";
|
|
38
|
+
readonly 'product.added': "Added to cart";
|
|
39
|
+
readonly 'product.add_failed': "Could not add";
|
|
40
|
+
readonly 'product.sold_out': "Sold out";
|
|
41
|
+
readonly 'product.in_stock': "In stock";
|
|
42
|
+
readonly 'product.out_of_stock': "Out of stock";
|
|
43
|
+
readonly 'product.only_left': "Only {count} left";
|
|
44
|
+
readonly 'product.brand': "Brand";
|
|
45
|
+
readonly 'product.type': "Type";
|
|
46
|
+
readonly 'search.title': "Search";
|
|
47
|
+
readonly 'search.placeholder': "Search";
|
|
48
|
+
readonly 'search.prompt': "Search the shop for a product";
|
|
49
|
+
readonly 'search.no_results': "Nothing matched your search";
|
|
50
|
+
readonly 'countdown.days': "Days";
|
|
51
|
+
readonly 'countdown.hours': "Hours";
|
|
52
|
+
readonly 'countdown.minutes': "Minutes";
|
|
53
|
+
readonly 'countdown.seconds': "Seconds";
|
|
54
|
+
readonly 'notifications.ask': "Want to know when your order ships?";
|
|
55
|
+
readonly 'notifications.turn_on': "Turn on";
|
|
56
|
+
readonly 'notifications.hide': "Hide this";
|
|
57
|
+
readonly 'notifications.order_updates': "Order updates";
|
|
58
|
+
readonly 'notifications.on': "On";
|
|
59
|
+
readonly 'notifications.off': "Off";
|
|
60
|
+
readonly 'screen.back': "Back";
|
|
61
|
+
readonly 'screen.unavailable': "Not available";
|
|
62
|
+
readonly 'screen.unavailable_body': "This page is not part of the shop any more.";
|
|
63
|
+
readonly 'screen.unreachable': "The shop could not be reached.";
|
|
64
|
+
readonly 'screen.retry': "Try again";
|
|
65
|
+
readonly 'account.title': "Account";
|
|
66
|
+
readonly 'account.language': "Language";
|
|
67
|
+
readonly 'account.country': "Country";
|
|
68
|
+
readonly 'account.about': "About";
|
|
69
|
+
readonly 'account.version': "Version";
|
|
70
|
+
readonly 'account.shop': "Shop";
|
|
71
|
+
readonly 'account.loading': "Loading the shop settings";
|
|
72
|
+
readonly 'account.no_markets': "No markets to choose from";
|
|
73
|
+
readonly 'account.notifications': "Notifications";
|
|
74
|
+
readonly 'account.privacy': "Privacy";
|
|
75
|
+
readonly 'account.share_diagnostics': "Share app diagnostics";
|
|
76
|
+
};
|
|
77
|
+
export type WordKey = keyof typeof ENGLISH_WORDS;
|
|
78
|
+
/** Every functional word key, for a caller that walks the catalog. */
|
|
79
|
+
export declare const WORD_KEYS: readonly WordKey[];
|
|
80
|
+
/** The languages the catalog answers in its own right. */
|
|
81
|
+
export declare const CATALOG_LANGUAGES: readonly LocaleCode[];
|
|
82
|
+
export interface PlatformWords {
|
|
83
|
+
/** The platform's own word for this key, in the buyer's language. */
|
|
84
|
+
own(key: WordKey): string;
|
|
85
|
+
/**
|
|
86
|
+
* The merchant's own text where they set one in a language the buyer reads,
|
|
87
|
+
* the platform's own word otherwise.
|
|
88
|
+
*/
|
|
89
|
+
merchantOr(text: LocalizedText | undefined, key: WordKey): string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The catalog bound to one buyer: their language for the platform's own words,
|
|
93
|
+
* their language and the Shop's default for a merchant's override of one.
|
|
94
|
+
*/
|
|
95
|
+
export declare function platformWords(language: LocaleCode, defaultLanguage: LocaleCode): PlatformWords;
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=words.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"words.d.ts","sourceRoot":"","sources":["../src/words.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGzE;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DT,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,aAAa,CAAC;AA0IjD,sEAAsE;AACtE,eAAO,MAAM,SAAS,EAAE,SAAS,OAAO,EAA4C,CAAC;AAErF,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,EAAE,SAAS,UAAU,EAAyB,CAAC;AAE7E,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC;CACnE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,GAAG,aAAa,CAO9F"}
|
package/dist/words.js
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { ENGLISH, baseOf, readable } from './locale.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every functional word a platform renderer owns, in English. A functional
|
|
4
|
+
* word is one the platform puts on screen and the merchant never types:
|
|
5
|
+
* Checkout, Sold out, Subtotal, Added, Could not add. Marketing copy, a trust
|
|
6
|
+
* strip's promise or a promo card's headline, is merchant set localized text
|
|
7
|
+
* and has no place here, because no catalog can guess it.
|
|
8
|
+
*
|
|
9
|
+
* The key list is this table. A language that answers fewer keys does not
|
|
10
|
+
* compile, and a language the catalog does not carry falls back to English
|
|
11
|
+
* here, deliberately, rather than to whichever string happens to sit first in
|
|
12
|
+
* an object.
|
|
13
|
+
*/
|
|
14
|
+
const ENGLISH_WORDS = {
|
|
15
|
+
'cart.title': 'Cart',
|
|
16
|
+
'cart.close': 'Close',
|
|
17
|
+
'cart.empty': 'Your cart is empty',
|
|
18
|
+
'cart.continue_shopping': 'Continue shopping',
|
|
19
|
+
'cart.items_in_cart': 'items in the cart',
|
|
20
|
+
'cart.subtotal': 'Subtotal',
|
|
21
|
+
'cart.discount': 'Discount',
|
|
22
|
+
'cart.line_discount': 'Discount',
|
|
23
|
+
'cart.total': 'Total',
|
|
24
|
+
'cart.estimated': 'estimated',
|
|
25
|
+
'cart.checkout': 'Checkout',
|
|
26
|
+
'cart.checkout_unavailable': 'Checkout is unavailable right now. Please try again.',
|
|
27
|
+
'cart.remove': 'Remove',
|
|
28
|
+
'cart.decrease': 'Decrease quantity',
|
|
29
|
+
'cart.increase': 'Increase quantity',
|
|
30
|
+
'cart.discount_code': 'Discount code',
|
|
31
|
+
'cart.code_placeholder': 'Enter a code',
|
|
32
|
+
'cart.apply': 'Apply',
|
|
33
|
+
'cart.code_not_applicable': 'This code is not valid for this cart',
|
|
34
|
+
'cart.note_label': 'Order note',
|
|
35
|
+
'cart.note_placeholder': 'Anything we should know?',
|
|
36
|
+
'cart.update_failed': 'Could not update the cart',
|
|
37
|
+
'product.add_to_cart': 'Add to cart',
|
|
38
|
+
'product.added': 'Added to cart',
|
|
39
|
+
'product.add_failed': 'Could not add',
|
|
40
|
+
'product.sold_out': 'Sold out',
|
|
41
|
+
'product.in_stock': 'In stock',
|
|
42
|
+
'product.out_of_stock': 'Out of stock',
|
|
43
|
+
'product.only_left': 'Only {count} left',
|
|
44
|
+
'product.brand': 'Brand',
|
|
45
|
+
'product.type': 'Type',
|
|
46
|
+
'search.title': 'Search',
|
|
47
|
+
'search.placeholder': 'Search',
|
|
48
|
+
'search.prompt': 'Search the shop for a product',
|
|
49
|
+
'search.no_results': 'Nothing matched your search',
|
|
50
|
+
'countdown.days': 'Days',
|
|
51
|
+
'countdown.hours': 'Hours',
|
|
52
|
+
'countdown.minutes': 'Minutes',
|
|
53
|
+
'countdown.seconds': 'Seconds',
|
|
54
|
+
'notifications.ask': 'Want to know when your order ships?',
|
|
55
|
+
'notifications.turn_on': 'Turn on',
|
|
56
|
+
'notifications.hide': 'Hide this',
|
|
57
|
+
'notifications.order_updates': 'Order updates',
|
|
58
|
+
'notifications.on': 'On',
|
|
59
|
+
'notifications.off': 'Off',
|
|
60
|
+
'screen.back': 'Back',
|
|
61
|
+
'screen.unavailable': 'Not available',
|
|
62
|
+
'screen.unavailable_body': 'This page is not part of the shop any more.',
|
|
63
|
+
'screen.unreachable': 'The shop could not be reached.',
|
|
64
|
+
'screen.retry': 'Try again',
|
|
65
|
+
'account.title': 'Account',
|
|
66
|
+
'account.language': 'Language',
|
|
67
|
+
'account.country': 'Country',
|
|
68
|
+
'account.about': 'About',
|
|
69
|
+
'account.version': 'Version',
|
|
70
|
+
'account.shop': 'Shop',
|
|
71
|
+
'account.loading': 'Loading the shop settings',
|
|
72
|
+
'account.no_markets': 'No markets to choose from',
|
|
73
|
+
'account.notifications': 'Notifications',
|
|
74
|
+
'account.privacy': 'Privacy',
|
|
75
|
+
'account.share_diagnostics': 'Share app diagnostics',
|
|
76
|
+
};
|
|
77
|
+
const ARABIC_WORDS = {
|
|
78
|
+
'cart.title': 'السلة',
|
|
79
|
+
'cart.close': 'إغلاق',
|
|
80
|
+
'cart.empty': 'سلتك فارغة',
|
|
81
|
+
'cart.continue_shopping': 'تابع التسوق',
|
|
82
|
+
'cart.items_in_cart': 'عناصر في السلة',
|
|
83
|
+
'cart.subtotal': 'المجموع الفرعي',
|
|
84
|
+
'cart.discount': 'الخصم',
|
|
85
|
+
'cart.line_discount': 'خصم',
|
|
86
|
+
'cart.total': 'الإجمالي',
|
|
87
|
+
'cart.estimated': 'تقديري',
|
|
88
|
+
'cart.checkout': 'الدفع',
|
|
89
|
+
'cart.checkout_unavailable': 'الدفع غير متاح حاليًا. حاول مرة أخرى.',
|
|
90
|
+
'cart.remove': 'إزالة',
|
|
91
|
+
'cart.decrease': 'تقليل الكمية',
|
|
92
|
+
'cart.increase': 'زيادة الكمية',
|
|
93
|
+
'cart.discount_code': 'رمز الخصم',
|
|
94
|
+
'cart.code_placeholder': 'أدخل الرمز',
|
|
95
|
+
'cart.apply': 'تطبيق',
|
|
96
|
+
'cart.code_not_applicable': 'هذا الرمز غير صالح لهذه السلة',
|
|
97
|
+
'cart.note_label': 'ملاحظة الطلب',
|
|
98
|
+
'cart.note_placeholder': 'هل من شيء يجب أن نعرفه؟',
|
|
99
|
+
'cart.update_failed': 'تعذّر تحديث السلة',
|
|
100
|
+
'product.add_to_cart': 'أضف إلى السلة',
|
|
101
|
+
'product.added': 'أُضيف إلى السلة',
|
|
102
|
+
'product.add_failed': 'تعذّرت الإضافة',
|
|
103
|
+
'product.sold_out': 'نفذت الكمية',
|
|
104
|
+
'product.in_stock': 'متوفر',
|
|
105
|
+
'product.out_of_stock': 'نفدت الكمية',
|
|
106
|
+
'product.only_left': 'المتبقي {count} فقط',
|
|
107
|
+
'product.brand': 'العلامة',
|
|
108
|
+
'product.type': 'النوع',
|
|
109
|
+
'search.title': 'بحث',
|
|
110
|
+
'search.placeholder': 'بحث',
|
|
111
|
+
'search.prompt': 'ابحث عن منتج في المتجر',
|
|
112
|
+
'search.no_results': 'لا نتائج لبحثك',
|
|
113
|
+
'countdown.days': 'أيام',
|
|
114
|
+
'countdown.hours': 'ساعات',
|
|
115
|
+
'countdown.minutes': 'دقائق',
|
|
116
|
+
'countdown.seconds': 'ثوان',
|
|
117
|
+
'notifications.ask': 'هل تريد معرفة موعد شحن طلبك؟',
|
|
118
|
+
'notifications.turn_on': 'تفعيل',
|
|
119
|
+
'notifications.hide': 'إخفاء',
|
|
120
|
+
'notifications.order_updates': 'تحديثات الطلب',
|
|
121
|
+
'notifications.on': 'مفعّلة',
|
|
122
|
+
'notifications.off': 'متوقفة',
|
|
123
|
+
'screen.back': 'رجوع',
|
|
124
|
+
'screen.unavailable': 'غير متاح',
|
|
125
|
+
'screen.unavailable_body': 'هذه الصفحة لم تعد جزءًا من المتجر.',
|
|
126
|
+
'screen.unreachable': 'تعذر الوصول إلى المتجر.',
|
|
127
|
+
'screen.retry': 'حاول مرة أخرى',
|
|
128
|
+
'account.title': 'الحساب',
|
|
129
|
+
'account.language': 'اللغة',
|
|
130
|
+
'account.country': 'الدولة',
|
|
131
|
+
'account.about': 'عن التطبيق',
|
|
132
|
+
'account.version': 'الإصدار',
|
|
133
|
+
'account.shop': 'المتجر',
|
|
134
|
+
'account.loading': 'جارٍ تحميل إعدادات المتجر',
|
|
135
|
+
'account.no_markets': 'لا أسواق للاختيار منها',
|
|
136
|
+
'account.notifications': 'الإشعارات',
|
|
137
|
+
'account.privacy': 'الخصوصية',
|
|
138
|
+
'account.share_diagnostics': 'مشاركة بيانات تشخيص التطبيق',
|
|
139
|
+
};
|
|
140
|
+
const TURKISH_WORDS = {
|
|
141
|
+
'cart.title': 'Sepet',
|
|
142
|
+
'cart.close': 'Kapat',
|
|
143
|
+
'cart.empty': 'Sepetiniz boş',
|
|
144
|
+
'cart.continue_shopping': 'Alışverişe devam et',
|
|
145
|
+
'cart.items_in_cart': 'sepetteki ürün',
|
|
146
|
+
'cart.subtotal': 'Ara toplam',
|
|
147
|
+
'cart.discount': 'İndirim',
|
|
148
|
+
'cart.line_discount': 'İndirim',
|
|
149
|
+
'cart.total': 'Toplam',
|
|
150
|
+
'cart.estimated': 'tahmini',
|
|
151
|
+
'cart.checkout': 'Ödeme',
|
|
152
|
+
'cart.checkout_unavailable': 'Ödeme şu anda kullanılamıyor. Lütfen tekrar deneyin.',
|
|
153
|
+
'cart.remove': 'Kaldır',
|
|
154
|
+
'cart.decrease': 'Adedi azalt',
|
|
155
|
+
'cart.increase': 'Adedi artır',
|
|
156
|
+
'cart.discount_code': 'İndirim kodu',
|
|
157
|
+
'cart.code_placeholder': 'Bir kod girin',
|
|
158
|
+
'cart.apply': 'Uygula',
|
|
159
|
+
'cart.code_not_applicable': 'Bu kod bu sepet için geçerli değil',
|
|
160
|
+
'cart.note_label': 'Sipariş notu',
|
|
161
|
+
'cart.note_placeholder': 'Bilmemiz gereken bir şey var mı?',
|
|
162
|
+
'cart.update_failed': 'Sepet güncellenemedi',
|
|
163
|
+
'product.add_to_cart': 'Sepete ekle',
|
|
164
|
+
'product.added': 'Sepete eklendi',
|
|
165
|
+
'product.add_failed': 'Eklenemedi',
|
|
166
|
+
'product.sold_out': 'Tükendi',
|
|
167
|
+
'product.in_stock': 'Stokta var',
|
|
168
|
+
'product.out_of_stock': 'Stokta yok',
|
|
169
|
+
'product.only_left': 'Yalnızca {count} adet kaldı',
|
|
170
|
+
'product.brand': 'Marka',
|
|
171
|
+
'product.type': 'Tür',
|
|
172
|
+
'search.title': 'Ara',
|
|
173
|
+
'search.placeholder': 'Ara',
|
|
174
|
+
'search.prompt': 'Mağazada bir ürün arayın',
|
|
175
|
+
'search.no_results': 'Aramanızla eşleşen bir sonuç yok',
|
|
176
|
+
'countdown.days': 'Gün',
|
|
177
|
+
'countdown.hours': 'Saat',
|
|
178
|
+
'countdown.minutes': 'Dakika',
|
|
179
|
+
'countdown.seconds': 'Saniye',
|
|
180
|
+
'notifications.ask': 'Siparişinizin ne zaman kargolandığını öğrenmek ister misiniz?',
|
|
181
|
+
'notifications.turn_on': 'Aç',
|
|
182
|
+
'notifications.hide': 'Bunu gizle',
|
|
183
|
+
'notifications.order_updates': 'Sipariş bildirimleri',
|
|
184
|
+
'notifications.on': 'Açık',
|
|
185
|
+
'notifications.off': 'Kapalı',
|
|
186
|
+
'screen.back': 'Geri',
|
|
187
|
+
'screen.unavailable': 'Kullanılamıyor',
|
|
188
|
+
'screen.unavailable_body': 'Bu sayfa artık mağazanın bir parçası değil.',
|
|
189
|
+
'screen.unreachable': 'Mağazaya ulaşılamadı.',
|
|
190
|
+
'screen.retry': 'Tekrar dene',
|
|
191
|
+
'account.title': 'Hesap',
|
|
192
|
+
'account.language': 'Dil',
|
|
193
|
+
'account.country': 'Ülke',
|
|
194
|
+
'account.about': 'Hakkında',
|
|
195
|
+
'account.version': 'Sürüm',
|
|
196
|
+
'account.shop': 'Mağaza',
|
|
197
|
+
'account.loading': 'Mağaza ayarları yükleniyor',
|
|
198
|
+
'account.no_markets': 'Seçilecek pazar yok',
|
|
199
|
+
'account.notifications': 'Bildirimler',
|
|
200
|
+
'account.privacy': 'Gizlilik',
|
|
201
|
+
'account.share_diagnostics': 'Uygulama tanılama verilerini paylaş',
|
|
202
|
+
};
|
|
203
|
+
const CATALOG = {
|
|
204
|
+
en: ENGLISH_WORDS,
|
|
205
|
+
ar: ARABIC_WORDS,
|
|
206
|
+
tr: TURKISH_WORDS,
|
|
207
|
+
};
|
|
208
|
+
/** Every functional word key, for a caller that walks the catalog. */
|
|
209
|
+
export const WORD_KEYS = Object.keys(ENGLISH_WORDS);
|
|
210
|
+
/** The languages the catalog answers in its own right. */
|
|
211
|
+
export const CATALOG_LANGUAGES = Object.keys(CATALOG);
|
|
212
|
+
/**
|
|
213
|
+
* The catalog bound to one buyer: their language for the platform's own words,
|
|
214
|
+
* their language and the Shop's default for a merchant's override of one.
|
|
215
|
+
*/
|
|
216
|
+
export function platformWords(language, defaultLanguage) {
|
|
217
|
+
const table = CATALOG[language] ?? CATALOG[baseOf(language)] ?? CATALOG[ENGLISH];
|
|
218
|
+
return {
|
|
219
|
+
own: (key) => table[key],
|
|
220
|
+
merchantOr: (text, key) => (text === undefined ? undefined : readable(text, language, defaultLanguage)) ?? table[key],
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=words.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"words.js","sourceRoot":"","sources":["../src/words.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,aAAa,GAAG;IACpB,YAAY,EAAE,MAAM;IACpB,YAAY,EAAE,OAAO;IACrB,YAAY,EAAE,oBAAoB;IAClC,wBAAwB,EAAE,mBAAmB;IAC7C,oBAAoB,EAAE,mBAAmB;IACzC,eAAe,EAAE,UAAU;IAC3B,eAAe,EAAE,UAAU;IAC3B,oBAAoB,EAAE,UAAU;IAChC,YAAY,EAAE,OAAO;IACrB,gBAAgB,EAAE,WAAW;IAC7B,eAAe,EAAE,UAAU;IAC3B,2BAA2B,EAAE,sDAAsD;IACnF,aAAa,EA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,iBAAiB,GAA0B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAY7E;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,QAAoB,EAAE,eAA2B;IAC7E,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,CAAE,CAAC;IAClF,OAAO;QACL,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;QACxB,UAAU,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CACxB,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC;KAC7F,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shoplix-ai/block-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "The renderer contract every Block Type renderer is written against: what a renderer receives, how a Block Type is registered with its owner, the closed capability set, and the small helpers renderers share. Contract only, no renderers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|