@shoplix-ai/block-kit 5.0.0 → 5.17.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.
Files changed (99) hide show
  1. package/README.md +116 -13
  2. package/dist/account-links.d.ts +50 -1
  3. package/dist/account-links.d.ts.map +1 -1
  4. package/dist/account-links.js +61 -1
  5. package/dist/account-links.js.map +1 -1
  6. package/dist/address-list.d.ts +9 -8
  7. package/dist/address-list.d.ts.map +1 -1
  8. package/dist/address-list.js +5 -5
  9. package/dist/address-list.js.map +1 -1
  10. package/dist/buy-box.d.ts +8 -0
  11. package/dist/buy-box.d.ts.map +1 -1
  12. package/dist/buy-box.js +8 -0
  13. package/dist/buy-box.js.map +1 -1
  14. package/dist/capabilities.d.ts +4 -1
  15. package/dist/capabilities.d.ts.map +1 -1
  16. package/dist/capabilities.js.map +1 -1
  17. package/dist/category-grid.d.ts +92 -0
  18. package/dist/category-grid.d.ts.map +1 -0
  19. package/dist/category-grid.js +123 -0
  20. package/dist/category-grid.js.map +1 -0
  21. package/dist/color-choice.d.ts +4 -0
  22. package/dist/color-choice.d.ts.map +1 -0
  23. package/dist/color-choice.js +11 -0
  24. package/dist/color-choice.js.map +1 -0
  25. package/dist/content-direction.d.ts +10 -0
  26. package/dist/content-direction.d.ts.map +1 -0
  27. package/dist/content-direction.js +20 -0
  28. package/dist/content-direction.js.map +1 -0
  29. package/dist/description.d.ts +60 -0
  30. package/dist/description.d.ts.map +1 -0
  31. package/dist/description.js +332 -0
  32. package/dist/description.js.map +1 -0
  33. package/dist/index.d.ts +23 -12
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +14 -8
  36. package/dist/index.js.map +1 -1
  37. package/dist/listing-filters.d.ts +114 -0
  38. package/dist/listing-filters.d.ts.map +1 -0
  39. package/dist/listing-filters.js +195 -0
  40. package/dist/listing-filters.js.map +1 -0
  41. package/dist/listing-toolbar.d.ts +117 -0
  42. package/dist/listing-toolbar.d.ts.map +1 -0
  43. package/dist/listing-toolbar.js +130 -0
  44. package/dist/listing-toolbar.js.map +1 -0
  45. package/dist/money.d.ts +7 -0
  46. package/dist/money.d.ts.map +1 -1
  47. package/dist/money.js +15 -0
  48. package/dist/money.js.map +1 -1
  49. package/dist/navigation.d.ts +7 -5
  50. package/dist/navigation.d.ts.map +1 -1
  51. package/dist/orders.d.ts +87 -9
  52. package/dist/orders.d.ts.map +1 -1
  53. package/dist/orders.js +127 -13
  54. package/dist/orders.js.map +1 -1
  55. package/dist/product-card.d.ts +4 -0
  56. package/dist/product-card.d.ts.map +1 -1
  57. package/dist/product-card.js +4 -0
  58. package/dist/product-card.js.map +1 -1
  59. package/dist/product-gallery.d.ts +3 -0
  60. package/dist/product-gallery.d.ts.map +1 -1
  61. package/dist/product-gallery.js +3 -0
  62. package/dist/product-gallery.js.map +1 -1
  63. package/dist/product-specs.d.ts +33 -2
  64. package/dist/product-specs.d.ts.map +1 -1
  65. package/dist/product-specs.js +51 -2
  66. package/dist/product-specs.js.map +1 -1
  67. package/dist/product-summary.d.ts +12 -1
  68. package/dist/product-summary.d.ts.map +1 -1
  69. package/dist/product-summary.js +29 -0
  70. package/dist/product-summary.js.map +1 -1
  71. package/dist/profile-header.d.ts +8 -1
  72. package/dist/profile-header.d.ts.map +1 -1
  73. package/dist/profile-header.js +8 -1
  74. package/dist/profile-header.js.map +1 -1
  75. package/dist/sign-in.d.ts +3 -0
  76. package/dist/sign-in.d.ts.map +1 -1
  77. package/dist/sign-in.js +3 -0
  78. package/dist/sign-in.js.map +1 -1
  79. package/dist/store-header.d.ts +49 -6
  80. package/dist/store-header.d.ts.map +1 -1
  81. package/dist/store-header.js +59 -5
  82. package/dist/store-header.js.map +1 -1
  83. package/dist/variant-choice.d.ts +14 -0
  84. package/dist/variant-choice.d.ts.map +1 -1
  85. package/dist/variant-choice.js +36 -0
  86. package/dist/variant-choice.js.map +1 -1
  87. package/dist/variant-rows.d.ts +33 -0
  88. package/dist/variant-rows.d.ts.map +1 -0
  89. package/dist/variant-rows.js +52 -0
  90. package/dist/variant-rows.js.map +1 -0
  91. package/dist/version.d.ts +1 -1
  92. package/dist/version.d.ts.map +1 -1
  93. package/dist/version.js +1 -1
  94. package/dist/version.js.map +1 -1
  95. package/dist/words.d.ts +67 -2
  96. package/dist/words.d.ts.map +1 -1
  97. package/dist/words.js +180 -1
  98. package/dist/words.js.map +1 -1
  99. package/package.json +11 -2
@@ -21,4 +21,40 @@ export function valueAvailable(product, selections, optionName, value) {
21
21
  const asked = { ...selections, [optionName]: value };
22
22
  return (product.variants ?? []).some((variant) => variant.available && matches(variant, asked));
23
23
  }
24
+ /**
25
+ * The values of one option that any variant offers together with the choices
26
+ * made in the options before it: a later option shows only what the earlier
27
+ * ones leave possible, so a weight the chosen box never comes in is not drawn.
28
+ * The first option shows all its values.
29
+ */
30
+ export function valuesAfterEarlierChoices(product, selections, optionName) {
31
+ const options = product.options ?? [];
32
+ const at = options.findIndex((option) => option.name === optionName);
33
+ const values = options[at]?.values ?? [];
34
+ const variants = product.variants ?? [];
35
+ if (at <= 0 || variants.length === 0)
36
+ return [...values];
37
+ const earlier = options.slice(0, at).map((option) => option.name);
38
+ return values.filter((value) => variants.some((variant) => variant.selectedOptions.some((pair) => pair.name === optionName && pair.value === value) &&
39
+ earlier.every((name) => variant.selectedOptions.some((pair) => pair.name === name && pair.value === selections[name]))));
40
+ }
41
+ /**
42
+ * The choices after the shopper picks one value: theirs where they name a
43
+ * variant for sale, else those of the first variant for sale that keeps the
44
+ * pick and every choice before it, so a pick never leaves the box without a
45
+ * variant while one can be bought.
46
+ */
47
+ export function choicesAfterPick(product, selections, optionName, value) {
48
+ const asked = { ...selections, [optionName]: value };
49
+ const exact = selectedVariant(product, asked);
50
+ if (exact?.available === true)
51
+ return asked;
52
+ const names = (product.options ?? []).map((option) => option.name);
53
+ const kept = names.slice(0, names.indexOf(optionName) + 1);
54
+ const fits = (product.variants ?? []).filter((variant) => kept.every((name) => variant.selectedOptions.some((pair) => pair.name === name && pair.value === asked[name])));
55
+ const variant = fits.find((candidate) => candidate.available) ?? exact ?? fits[0];
56
+ return variant === undefined
57
+ ? asked
58
+ : Object.fromEntries(variant.selectedOptions.map((pair) => [pair.name, pair.value]));
59
+ }
24
60
  //# sourceMappingURL=variant-choice.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"variant-choice.js","sourceRoot":"","sources":["../src/variant-choice.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,iBAAiB,CAAC,OAAuB;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC3E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,MAAM,CAAC,WAAW,CACvB,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,CAC1E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,OAAuB,EACvB,MAAwB;IAExB,OAAO,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;AACtD,CAAC;AAED,SAAS,OAAO,CAAC,OAA8B,EAAE,UAA4B;IAC3E,OAAO,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CA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F,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { DisplayMoney, ProductDisplay, ProductVariantDisplay } from '@shoplix-ai/sdui-schema';
2
+ export interface ChosenPrice {
3
+ readonly price: DisplayMoney;
4
+ readonly compareAt?: DisplayMoney;
5
+ }
6
+ /**
7
+ * What the chosen variant costs, and what it cost before, where that saves
8
+ * anything or where the two cannot be told apart: the variant's own price
9
+ * where the Provider answered one, the product's while it answered none. The
10
+ * product's own price is the cheapest variant's, so a summary that read it
11
+ * quoted a box the shopper had not chosen.
12
+ */
13
+ export declare function chosenPrice(product: ProductDisplay, variant: ProductVariantDisplay | null): ChosenPrice;
14
+ export interface VariantRow {
15
+ readonly variant: ProductVariantDisplay;
16
+ readonly name: string;
17
+ readonly detail: string;
18
+ readonly price: DisplayMoney;
19
+ readonly compareAtPrice?: DisplayMoney;
20
+ readonly available: boolean;
21
+ }
22
+ /**
23
+ * One row per variant, for a buy box that offers the variants as a priced
24
+ * list: the first option's value names it, the others follow it, and each
25
+ * carries its own price. A product the merchant gave no choice offers none.
26
+ */
27
+ export declare function variantRows(product: ProductDisplay): VariantRow[];
28
+ /**
29
+ * A variant in one line, its last option's value first: the size or the weight
30
+ * that tells it from its siblings stays in view where the line is cut short.
31
+ */
32
+ export declare function variantLabel(product: ProductDisplay, variant: ProductVariantDisplay): string;
33
+ //# sourceMappingURL=variant-rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variant-rows.d.ts","sourceRoot":"","sources":["../src/variant-rows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAInG,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,qBAAqB,GAAG,IAAI,GACpC,WAAW,CAOb;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAQD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,UAAU,EAAE,CAcjE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAE5F"}
@@ -0,0 +1,52 @@
1
+ import { productChoices } from './buy-box.js';
2
+ import { moneyAmount } from './money.js';
3
+ /**
4
+ * What the chosen variant costs, and what it cost before, where that saves
5
+ * anything or where the two cannot be told apart: the variant's own price
6
+ * where the Provider answered one, the product's while it answered none. The
7
+ * product's own price is the cheapest variant's, so a summary that read it
8
+ * quoted a box the shopper had not chosen.
9
+ */
10
+ export function chosenPrice(product, variant) {
11
+ const price = variant?.price ?? product.price;
12
+ const compare = variant?.price === undefined ? product.compareAtPrice : variant.compareAtPrice;
13
+ if (compare === undefined || compare.currencyCode !== price.currencyCode)
14
+ return { price };
15
+ const now = moneyAmount(price);
16
+ const then = moneyAmount(compare);
17
+ return now !== null && then !== null && then <= now ? { price } : { price, compareAt: compare };
18
+ }
19
+ function valuesOf(product, variant) {
20
+ return productChoices(product)
21
+ .map((group) => variant.selectedOptions.find((pair) => pair.name === group.name)?.value)
22
+ .filter((value) => value !== undefined && value !== '');
23
+ }
24
+ /**
25
+ * One row per variant, for a buy box that offers the variants as a priced
26
+ * list: the first option's value names it, the others follow it, and each
27
+ * carries its own price. A product the merchant gave no choice offers none.
28
+ */
29
+ export function variantRows(product) {
30
+ if (productChoices(product).length === 0)
31
+ return [];
32
+ return (product.variants ?? []).map((variant) => {
33
+ const values = valuesOf(product, variant);
34
+ const { price, compareAt } = chosenPrice(product, variant);
35
+ return {
36
+ variant,
37
+ name: values[0] ?? variant.title,
38
+ detail: values.slice(1).join(' · '),
39
+ price,
40
+ ...(compareAt === undefined ? {} : { compareAtPrice: compareAt }),
41
+ available: variant.available,
42
+ };
43
+ });
44
+ }
45
+ /**
46
+ * A variant in one line, its last option's value first: the size or the weight
47
+ * that tells it from its siblings stays in view where the line is cut short.
48
+ */
49
+ export function variantLabel(product, variant) {
50
+ return valuesOf(product, variant).reverse().join(' · ');
51
+ }
52
+ //# sourceMappingURL=variant-rows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variant-rows.js","sourceRoot":"","sources":["../src/variant-rows.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAOzC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,OAAuB,EACvB,OAAqC;IAErC,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;IAC9C,MAAM,OAAO,GAAG,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;IAC/F,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY;QAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC3F,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,GAAG,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,GAAG,CAAC,C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,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAAuB,EAAE,OAA8B;IAClF,OAAO,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1D,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 = "5.0.0";
7
+ export declare const CONTRACT_VERSION = "5.17.0";
8
8
  export declare const CONTRACT_MAJOR = 5;
9
9
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,eAAO,MAAM,cAAc,IAAI,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAEzC,eAAO,MAAM,cAAc,IAAI,CAAC"}
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 = '5.0.0';
7
+ export const CONTRACT_VERSION = '5.17.0';
8
8
  export const CONTRACT_MAJOR = 5;
9
9
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAEzC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC"}
package/dist/words.d.ts CHANGED
@@ -51,6 +51,7 @@ declare const ENGLISH_WORDS: {
51
51
  readonly 'product.add_failed': "Could not add";
52
52
  readonly 'product.add_to_cart_compact': "Add to cart";
53
53
  readonly 'product.added_compact': "Added ✓";
54
+ readonly 'product.adding': "Adding";
54
55
  readonly 'product.notify_me': "Notify me";
55
56
  readonly 'product.notify_me_done': "We will tell you ✓";
56
57
  readonly 'product.quantity': "Quantity";
@@ -68,11 +69,14 @@ declare const ENGLISH_WORDS: {
68
69
  readonly 'reviews.count': "{count} reviews";
69
70
  readonly 'product.brand': "Brand";
70
71
  readonly 'product.type': "Type";
72
+ readonly 'product.choose_option': "Choose an option";
71
73
  readonly 'section.show_all': "Show all";
72
74
  readonly 'header.menu': "Menu";
73
75
  readonly 'header.close': "Close";
74
76
  readonly 'header.categories': "Categories";
75
77
  readonly 'header.language_country': "Language & country";
78
+ readonly 'announcement.copy_code': "Copy code";
79
+ readonly 'announcement.copied': "Copied";
76
80
  readonly 'promo.promotion': "Promotion";
77
81
  readonly 'promo.card_of': "Promotion {position} of {count}";
78
82
  readonly 'promo.card_named': "{label}, {position} of {count}";
@@ -103,6 +107,7 @@ declare const ENGLISH_WORDS: {
103
107
  readonly 'notifications.on': "On";
104
108
  readonly 'notifications.off': "Off";
105
109
  readonly 'screen.back': "Back";
110
+ readonly 'screen.share': "Share";
106
111
  readonly 'screen.unavailable': "Not available";
107
112
  readonly 'screen.unavailable_body': "This page is not part of the shop any more.";
108
113
  readonly 'screen.unreachable': "The shop could not be reached.";
@@ -119,7 +124,9 @@ declare const ENGLISH_WORDS: {
119
124
  readonly 'account.privacy': "Privacy";
120
125
  readonly 'account.share_diagnostics': "Share app diagnostics";
121
126
  readonly 'account.sign_in': "Sign in";
122
- readonly 'account.sign_out': "Sign out";
127
+ readonly 'account.signed_out_title': "Welcome";
128
+ readonly 'account.signed_out_subtitle': "Sign in to see your orders, addresses and profile.";
129
+ readonly 'account.sign_out': "Log out";
123
130
  readonly 'account.email': "Email";
124
131
  readonly 'account.continue': "Continue";
125
132
  readonly 'account.code_note': "Shopify will email you a code on the next step.";
@@ -142,6 +149,8 @@ declare const ENGLISH_WORDS: {
142
149
  readonly 'account.profile_marketing': "Email me offers and news";
143
150
  readonly 'account.manage_contact': "Manage email and phone";
144
151
  readonly 'account.profile_choose': "Choose";
152
+ readonly 'account.profile_title': "Profile";
153
+ readonly 'account.date_clear': "Clear";
145
154
  readonly 'account.deletion_title': "Delete your account";
146
155
  readonly 'account.deletion_erased': "Your profile, your name and your saved addresses are erased.";
147
156
  readonly 'account.deletion_orders_kept': "Your orders stay with the store, because the law requires it to keep them.";
@@ -149,6 +158,10 @@ declare const ENGLISH_WORDS: {
149
158
  readonly 'account.deletion_confirm': "Delete my account";
150
159
  readonly 'account.deletion_keep': "Keep my account";
151
160
  readonly 'account.deletion_failed': "Could not delete your account. Please try again.";
161
+ readonly 'account.log_out_title': "Log out?";
162
+ readonly 'account.log_out_body': "You will need to sign in again to see your orders and addresses.";
163
+ readonly 'account.log_out_confirm': "Log out";
164
+ readonly 'account.log_out_stay': "Stay signed in";
152
165
  readonly 'order.empty': "No orders yet";
153
166
  readonly 'order.open': "Open order";
154
167
  readonly 'order.items': "Items";
@@ -163,6 +176,17 @@ declare const ENGLISH_WORDS: {
163
176
  readonly 'order.buy_again': "Buy again";
164
177
  readonly 'order.nothing_to_buy': "These items are no longer available";
165
178
  readonly 'order.more': "More about this order";
179
+ readonly 'order.details': "Order details";
180
+ readonly 'order.track_order': "Track order";
181
+ readonly 'order.item_count_zero': "No items";
182
+ readonly 'order.item_count_one': "1 item";
183
+ readonly 'order.item_count_two': "{count} items";
184
+ readonly 'order.item_count_few': "{count} items";
185
+ readonly 'order.item_count_many': "{count} items";
186
+ readonly 'order.item_count_other': "{count} items";
187
+ readonly 'order.more_lines': "{count} more";
188
+ readonly 'order.subtotal_items': "Subtotal ({items})";
189
+ readonly 'order.not_shipped': "This order has not shipped yet";
166
190
  readonly 'order.cancelled': "Cancelled";
167
191
  readonly 'order.delivered': "Delivered";
168
192
  readonly 'order.fulfillment.unfulfilled': "Processing";
@@ -218,6 +242,36 @@ declare const ENGLISH_WORDS: {
218
242
  readonly 'address.zone': "Region";
219
243
  readonly 'address.zip': "Postal code";
220
244
  readonly 'address.phone': "Phone (optional)";
245
+ readonly 'listing.products_zero': "products";
246
+ readonly 'listing.products_one': "product";
247
+ readonly 'listing.products_two': "products";
248
+ readonly 'listing.products_few': "products";
249
+ readonly 'listing.products_many': "products";
250
+ readonly 'listing.products_other': "products";
251
+ readonly 'listing.grid': "Grid view";
252
+ readonly 'listing.list': "List view";
253
+ readonly 'listing.sort_by': "Sort by";
254
+ readonly 'listing.close': "Close";
255
+ readonly 'listing.sort.collection_default': "Featured";
256
+ readonly 'listing.sort.best_selling': "Best selling";
257
+ readonly 'listing.sort.newest': "Newest";
258
+ readonly 'listing.sort.oldest': "Oldest";
259
+ readonly 'listing.sort.price_asc': "Price: low to high";
260
+ readonly 'listing.sort.price_desc': "Price: high to low";
261
+ readonly 'listing.sort.title': "Name: A to Z";
262
+ readonly 'listing.sort.title_desc': "Name: Z to A";
263
+ readonly 'listing.filter': "Filter";
264
+ readonly 'listing.filter_title': "Filter results";
265
+ readonly 'listing.filter_apply': "Show results";
266
+ readonly 'listing.filter_clear': "Clear";
267
+ readonly 'listing.filter_clear_all': "Clear all";
268
+ readonly 'listing.filter_remove': "Remove";
269
+ readonly 'listing.filter_on': "{count} on";
270
+ readonly 'listing.filter_none': "No products match these filters.";
271
+ readonly 'listing.filter_min': "Min";
272
+ readonly 'listing.filter_max': "Max";
273
+ readonly 'listing.filter_in_stock': "In stock only";
274
+ readonly 'listing.filter_in_stock_hint': "Hide products that are sold out";
221
275
  };
222
276
  export type WordKey = keyof typeof ENGLISH_WORDS;
223
277
  /** Every functional word key, for a caller that walks the catalog. */
@@ -241,13 +295,24 @@ export interface PlatformWords {
241
295
  merchantOr(text: LocalizedText | undefined, key: WordKey): string;
242
296
  }
243
297
  /** A number written in the form the buyer's language counts it in, over the six forms a counted word carries. */
244
- export declare function countedWord(stem: 'cart.items' | 'promo.cards', count: number, language: LocaleCode, defaultLanguage: LocaleCode): string;
298
+ export declare function countedWord(stem: 'cart.items' | 'promo.cards' | 'order.item_count' | 'listing.products', count: number, language: LocaleCode, defaultLanguage: LocaleCode): string;
245
299
  /**
246
300
  * How many items a cart holds, written in the form the buyer's language counts
247
301
  * that number in. English and Turkish read no item count for an empty cart as
248
302
  * a plural of nothing, which is why the zero form is in the catalog too.
249
303
  */
250
304
  export declare function cartItemCount(count: number, language: LocaleCode, defaultLanguage: LocaleCode): string;
305
+ /**
306
+ * How many items an order holds, written in the form the buyer's language
307
+ * counts that number in. A cart and an order count their items apart, so the
308
+ * order's word is the catalog's own and never the cart's.
309
+ */
310
+ export declare function orderItemCount(count: number, language: LocaleCode, defaultLanguage: LocaleCode): string;
311
+ /**
312
+ * The subtotal row of an order that says how many items the order holds,
313
+ * "Subtotal (2 items)", the count in the form the buyer's language counts it in.
314
+ */
315
+ export declare function orderSubtotalLabel(count: number, language: LocaleCode, defaultLanguage: LocaleCode): string;
251
316
  /**
252
317
  * The catalog bound to one buyer: their language for the platform's own words,
253
318
  * their language and the Shop's default for a merchant's override of one.
@@ -1 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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