@wix/himalaya-cli 0.1593.0 → 0.1594.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 (24) hide show
  1. package/dist/cli.mjs +1 -0
  2. package/guides/one-app-to-himi-app.md +12 -0
  3. package/package.json +2 -2
  4. package/templates/beauty-salon/dev/index.ts +216 -8
  5. package/templates/beauty-salon/tier5-src/_shared/himi-store-facets.ts +26 -2
  6. package/templates/beauty-salon/tier5-src/himi-branded-lite-category/index.ts +3 -3
  7. package/templates/beauty-salon/tier5-src/himi-branded-lite-shop/index.ts +4 -4
  8. package/templates/branded-lite/dev/index.ts +216 -8
  9. package/templates/branded-lite/tier5-src/_shared/business-chat-transport.ts +9 -0
  10. package/templates/branded-lite/tier5-src/_shared/himi-store-facets.ts +26 -2
  11. package/templates/branded-lite/tier5-src/himi-branded-lite-category/index.ts +3 -3
  12. package/templates/branded-lite/tier5-src/himi-branded-lite-shop/index.ts +3 -3
  13. package/templates/gym-fitness/dev/index.ts +216 -8
  14. package/templates/gym-fitness/tier5-src/_shared/himi-store-facets.ts +26 -2
  15. package/templates/gym-fitness/tier5-src/himi-branded-lite-category/index.ts +3 -3
  16. package/templates/gym-fitness/tier5-src/himi-branded-lite-shop/index.ts +4 -4
  17. package/templates/portfolio-creative/dev/index.ts +216 -8
  18. package/templates/portfolio-creative/tier5-src/_shared/himi-store-facets.ts +26 -2
  19. package/templates/portfolio-creative/tier5-src/himi-branded-lite-category/index.ts +3 -3
  20. package/templates/portfolio-creative/tier5-src/himi-branded-lite-shop/index.ts +4 -4
  21. package/templates/retail-store/dev/index.ts +216 -8
  22. package/templates/retail-store/tier5-src/_shared/himi-store-facets.ts +26 -2
  23. package/templates/retail-store/tier5-src/himi-branded-lite-category/index.ts +3 -3
  24. package/templates/retail-store/tier5-src/himi-branded-lite-shop/index.ts +3 -3
@@ -9161,7 +9161,33 @@ const SCREENS = runtimeSetting({
9161
9161
  "top": 2,
9162
9162
  "bottom": 2
9163
9163
  },
9164
- "hiddenPath": "$item.notOnSale"
9164
+ "hiddenPath": "$item.saleTagHidden"
9165
+ }
9166
+ },
9167
+ {
9168
+ "id": "",
9169
+ "body": {
9170
+ "package": "himalaya",
9171
+ "type": "Text",
9172
+ "props": {
9173
+ "text": "$item.ribbon",
9174
+ "style": "caption",
9175
+ "color": "accentPrimary",
9176
+ "maxLines": 1
9177
+ }
9178
+ },
9179
+ "modifiers": {
9180
+ "background": {
9181
+ "token": "accentSurface"
9182
+ },
9183
+ "cornerRadius": 6,
9184
+ "padding": {
9185
+ "leading": 6,
9186
+ "trailing": 6,
9187
+ "top": 2,
9188
+ "bottom": 2
9189
+ },
9190
+ "hiddenPath": "$item.noRibbon"
9165
9191
  }
9166
9192
  },
9167
9193
  {
@@ -9604,7 +9630,33 @@ const SCREENS = runtimeSetting({
9604
9630
  "top": 2,
9605
9631
  "bottom": 2
9606
9632
  },
9607
- "hiddenPath": "$item.notOnSale"
9633
+ "hiddenPath": "$item.saleTagHidden"
9634
+ }
9635
+ },
9636
+ {
9637
+ "id": "",
9638
+ "body": {
9639
+ "package": "himalaya",
9640
+ "type": "Text",
9641
+ "props": {
9642
+ "text": "$item.ribbon",
9643
+ "style": "caption",
9644
+ "color": "accentPrimary",
9645
+ "maxLines": 1
9646
+ }
9647
+ },
9648
+ "modifiers": {
9649
+ "background": {
9650
+ "token": "accentSurface"
9651
+ },
9652
+ "cornerRadius": 6,
9653
+ "padding": {
9654
+ "leading": 6,
9655
+ "trailing": 6,
9656
+ "top": 2,
9657
+ "bottom": 2
9658
+ },
9659
+ "hiddenPath": "$item.noRibbon"
9608
9660
  }
9609
9661
  },
9610
9662
  {
@@ -10079,7 +10131,33 @@ const SCREENS = runtimeSetting({
10079
10131
  "top": 2,
10080
10132
  "bottom": 2
10081
10133
  },
10082
- "hiddenPath": "$item.notOnSale"
10134
+ "hiddenPath": "$item.saleTagHidden"
10135
+ }
10136
+ },
10137
+ {
10138
+ "id": "",
10139
+ "body": {
10140
+ "package": "himalaya",
10141
+ "type": "Text",
10142
+ "props": {
10143
+ "text": "$item.ribbon",
10144
+ "style": "caption",
10145
+ "color": "accentPrimary",
10146
+ "maxLines": 1
10147
+ }
10148
+ },
10149
+ "modifiers": {
10150
+ "background": {
10151
+ "token": "accentSurface"
10152
+ },
10153
+ "cornerRadius": 6,
10154
+ "padding": {
10155
+ "leading": 6,
10156
+ "trailing": 6,
10157
+ "top": 2,
10158
+ "bottom": 2
10159
+ },
10160
+ "hiddenPath": "$item.noRibbon"
10083
10161
  }
10084
10162
  },
10085
10163
  {
@@ -10530,7 +10608,33 @@ const SCREENS = runtimeSetting({
10530
10608
  "top": 2,
10531
10609
  "bottom": 2
10532
10610
  },
10533
- "hiddenPath": "$item.notOnSale"
10611
+ "hiddenPath": "$item.saleTagHidden"
10612
+ }
10613
+ },
10614
+ {
10615
+ "id": "",
10616
+ "body": {
10617
+ "package": "himalaya",
10618
+ "type": "Text",
10619
+ "props": {
10620
+ "text": "$item.ribbon",
10621
+ "style": "caption",
10622
+ "color": "accentPrimary",
10623
+ "maxLines": 1
10624
+ }
10625
+ },
10626
+ "modifiers": {
10627
+ "background": {
10628
+ "token": "accentSurface"
10629
+ },
10630
+ "cornerRadius": 6,
10631
+ "padding": {
10632
+ "leading": 6,
10633
+ "trailing": 6,
10634
+ "top": 2,
10635
+ "bottom": 2
10636
+ },
10637
+ "hiddenPath": "$item.noRibbon"
10534
10638
  }
10535
10639
  },
10536
10640
  {
@@ -13160,7 +13264,33 @@ const SCREENS = runtimeSetting({
13160
13264
  "top": 2,
13161
13265
  "bottom": 2
13162
13266
  },
13163
- "hiddenPath": "$item.notOnSale"
13267
+ "hiddenPath": "$item.saleTagHidden"
13268
+ }
13269
+ },
13270
+ {
13271
+ "id": "",
13272
+ "body": {
13273
+ "package": "himalaya",
13274
+ "type": "Text",
13275
+ "props": {
13276
+ "text": "$item.ribbon",
13277
+ "style": "caption",
13278
+ "color": "accentPrimary",
13279
+ "maxLines": 1
13280
+ }
13281
+ },
13282
+ "modifiers": {
13283
+ "background": {
13284
+ "token": "accentSurface"
13285
+ },
13286
+ "cornerRadius": 6,
13287
+ "padding": {
13288
+ "leading": 6,
13289
+ "trailing": 6,
13290
+ "top": 2,
13291
+ "bottom": 2
13292
+ },
13293
+ "hiddenPath": "$item.noRibbon"
13164
13294
  }
13165
13295
  },
13166
13296
  {
@@ -13616,7 +13746,33 @@ const SCREENS = runtimeSetting({
13616
13746
  "top": 2,
13617
13747
  "bottom": 2
13618
13748
  },
13619
- "hiddenPath": "$item.notOnSale"
13749
+ "hiddenPath": "$item.saleTagHidden"
13750
+ }
13751
+ },
13752
+ {
13753
+ "id": "",
13754
+ "body": {
13755
+ "package": "himalaya",
13756
+ "type": "Text",
13757
+ "props": {
13758
+ "text": "$item.ribbon",
13759
+ "style": "caption",
13760
+ "color": "accentPrimary",
13761
+ "maxLines": 1
13762
+ }
13763
+ },
13764
+ "modifiers": {
13765
+ "background": {
13766
+ "token": "accentSurface"
13767
+ },
13768
+ "cornerRadius": 6,
13769
+ "padding": {
13770
+ "leading": 6,
13771
+ "trailing": 6,
13772
+ "top": 2,
13773
+ "bottom": 2
13774
+ },
13775
+ "hiddenPath": "$item.noRibbon"
13620
13776
  }
13621
13777
  },
13622
13778
  {
@@ -14104,7 +14260,33 @@ const SCREENS = runtimeSetting({
14104
14260
  "top": 2,
14105
14261
  "bottom": 2
14106
14262
  },
14107
- "hiddenPath": "$item.notOnSale"
14263
+ "hiddenPath": "$item.saleTagHidden"
14264
+ }
14265
+ },
14266
+ {
14267
+ "id": "",
14268
+ "body": {
14269
+ "package": "himalaya",
14270
+ "type": "Text",
14271
+ "props": {
14272
+ "text": "$item.ribbon",
14273
+ "style": "caption",
14274
+ "color": "accentPrimary",
14275
+ "maxLines": 1
14276
+ }
14277
+ },
14278
+ "modifiers": {
14279
+ "background": {
14280
+ "token": "accentSurface"
14281
+ },
14282
+ "cornerRadius": 6,
14283
+ "padding": {
14284
+ "leading": 6,
14285
+ "trailing": 6,
14286
+ "top": 2,
14287
+ "bottom": 2
14288
+ },
14289
+ "hiddenPath": "$item.noRibbon"
14108
14290
  }
14109
14291
  },
14110
14292
  {
@@ -14568,7 +14750,33 @@ const SCREENS = runtimeSetting({
14568
14750
  "top": 2,
14569
14751
  "bottom": 2
14570
14752
  },
14571
- "hiddenPath": "$item.notOnSale"
14753
+ "hiddenPath": "$item.saleTagHidden"
14754
+ }
14755
+ },
14756
+ {
14757
+ "id": "",
14758
+ "body": {
14759
+ "package": "himalaya",
14760
+ "type": "Text",
14761
+ "props": {
14762
+ "text": "$item.ribbon",
14763
+ "style": "caption",
14764
+ "color": "accentPrimary",
14765
+ "maxLines": 1
14766
+ }
14767
+ },
14768
+ "modifiers": {
14769
+ "background": {
14770
+ "token": "accentSurface"
14771
+ },
14772
+ "cornerRadius": 6,
14773
+ "padding": {
14774
+ "leading": 6,
14775
+ "trailing": 6,
14776
+ "top": 2,
14777
+ "bottom": 2
14778
+ },
14779
+ "hiddenPath": "$item.noRibbon"
14572
14780
  }
14573
14781
  },
14574
14782
  {
@@ -58,8 +58,14 @@ export interface ProductCard {
58
58
  swatch1: string; swatch2: string; swatch3: string; swatch4: string; swatch5: string;
59
59
  swatch1Hidden: boolean; swatch2Hidden: boolean; swatch3Hidden: boolean; swatch4Hidden: boolean; swatch5Hidden: boolean;
60
60
  noSwatches: boolean;
61
- /** Hides the Sale tag / swatch row when it has nothing to show. */
61
+ /** Hides the tag row (Sale tag, ribbon, swatches) when it has nothing to show. */
62
62
  noTagRow: boolean;
63
+ /** The merchant's ribbon text ("New", "Best Seller"…), "" when the product has none. The ribbon replaces
64
+ * the price-derived Sale tag, so a product never carries two tags. */
65
+ ribbon: string;
66
+ noRibbon: boolean;
67
+ /** Hides the price-derived Sale tag: the product is not on sale, or its ribbon takes the tag's place. */
68
+ saleTagHidden: boolean;
63
69
  /** The Wix price before any App Store presentation rewrites `price`. */
64
70
  commercePrice: string;
65
71
  /** Original Wix sale metadata retained when App Store presentation hides it. */
@@ -179,6 +185,21 @@ function swatchFields(hexes: string[], onSale: boolean) {
179
185
  };
180
186
  }
181
187
 
188
+ /** The ribbon the merchant set, whichever catalog answered: V3 `{ id, name }`, V1 a plain string. Read through a
189
+ * local type, not a `StoreProduct` member: other workers already extend that type with their own `ribbon`. */
190
+ export function ribbonText(p: StoreProduct): string {
191
+ const ribbon = (p as { ribbon?: unknown }).ribbon;
192
+ const name = typeof ribbon === "string" ? ribbon : typeof (ribbon as { name?: unknown } | null | undefined)?.name === "string" ? (ribbon as { name: string }).name : "";
193
+ return name.trim();
194
+ }
195
+
196
+ /** What the tag row (Sale tag, ribbon, swatches) shows. One rule for every screen that rebuilds it, including
197
+ * after the App Store presentation changes `onSale`: the ribbon wins over the Sale tag, so a product never
198
+ * carries two, and the row hides when it has nothing to show. */
199
+ export function tagFields(onSale: boolean, noSwatches: boolean, ribbon: string | undefined) {
200
+ return { ribbon: ribbon ?? "", noRibbon: !ribbon, saleTagHidden: !onSale || !!ribbon, noTagRow: !onSale && noSwatches && !ribbon };
201
+ }
202
+
182
203
  export function productCard(p: StoreProduct, saved: Set<string> = savedIds()): ProductCard {
183
204
  const { now, was } = prices(p);
184
205
  const groups = productOptions(p);
@@ -187,11 +208,14 @@ export function productCard(p: StoreProduct, saved: Set<string> = savedIds()): P
187
208
  const image = productImage(p);
188
209
  const id = p.id ?? "";
189
210
  const onSale = !!was;
211
+ const ribbon = ribbonText(p);
212
+ const swatches = swatchFields((color?.choices ?? []).map((c) => c.colorCode ?? ""), onSale);
190
213
  return {
191
214
  id, name, image, hasImage: !!image, noImage: !image, initial: initials(name),
192
215
  price: now, wasPrice: was, onSale, notOnSale: !onSale,
193
216
  saved: saved.has(id), notSaved: !saved.has(id),
194
- ...swatchFields((color?.choices ?? []).map((c) => c.colorCode ?? ""), onSale),
217
+ ...swatches,
218
+ ...tagFields(onSale, swatches.noSwatches, ribbon),
195
219
  commercePrice: now,
196
220
  detailScreenId: "himi_product",
197
221
  };
@@ -7,7 +7,7 @@ import { searchStoreProducts, type StoreProduct } from "../_shared/himi-store.js
7
7
  import { createCollectionQuery } from "../_shared/collection-query.js";
8
8
  import { detailInputId, presence, presenceAfterError, type PresenceFlags } from "../_shared/detail-presence.js";
9
9
  import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
10
- import { FACETS_BOOT, PAGE_SIZE, applyFacets, currencyOf, facetActions, idOf, readViewPrefs, toRows, toggleSaved, type FacetState } from "../_shared/himi-store-facets.js";
10
+ import { FACETS_BOOT, PAGE_SIZE, applyFacets, currencyOf, facetActions, idOf, readViewPrefs, tagFields, toRows, toggleSaved, type FacetState } from "../_shared/himi-store-facets.js";
11
11
  import { withIapPresentation } from "../_shared/iap-presentation.js";
12
12
 
13
13
  interface State extends FacetState, PresenceFlags {
@@ -187,8 +187,8 @@ const register = withIapPresentation<State>({
187
187
  const onSale = stored.commerceOnSale ?? row.onSale;
188
188
  return { ...row, price: price(row.id, row.commercePrice) || row.price,
189
189
  commerceWasPrice: wasPrice, commerceOnSale: onSale,
190
- ...(apple(row.id) ? { wasPrice: "", onSale: false, notOnSale: true, noTagRow: row.noSwatches }
191
- : { wasPrice, onSale, notOnSale: !onSale, noTagRow: !onSale && row.noSwatches }),
190
+ ...(apple(row.id) ? { wasPrice: "", onSale: false, notOnSale: true, ...tagFields(false, row.noSwatches, row.ribbon) }
191
+ : { wasPrice, onSale, notOnSale: !onSale, ...tagFields(onSale, row.noSwatches, row.ribbon) }),
192
192
  };
193
193
  }) }),
194
194
  });
@@ -16,7 +16,7 @@ import { withIapPresentation } from "../_shared/iap-presentation.js";
16
16
  import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
17
17
  import { loadStoreCategories, type StoreCategoryCard } from "../_shared/himi-store-categories.js";
18
18
  import {
19
- FACETS_BOOT, PAGE_SIZE, applyFacets, countText, currencyOf, facetActions, idOf, option, readViewPrefs, selected, toRows, toggleSaved,
19
+ FACETS_BOOT, PAGE_SIZE, applyFacets, countText, currencyOf, facetActions, idOf, option, readViewPrefs, selected, tagFields, toRows, toggleSaved,
20
20
  type FacetState, type Option, type ProductCard, type Row,
21
21
  } from "../_shared/himi-store-facets.js";
22
22
 
@@ -187,7 +187,7 @@ function cachedCard(value: unknown): CachedCard | undefined {
187
187
  price, wasPrice: "", onSale: false, notOnSale: true, saved: false, notSaved: true,
188
188
  swatch1: "", swatch2: "", swatch3: "", swatch4: "", swatch5: "",
189
189
  swatch1Hidden: true, swatch2Hidden: true, swatch3Hidden: true, swatch4Hidden: true, swatch5Hidden: true,
190
- noSwatches: true, noTagRow: true, commercePrice: raw.commercePrice ?? price,
190
+ noSwatches: true, ...tagFields(false, true, ""), commercePrice: raw.commercePrice ?? price,
191
191
  detailScreenId: raw.detailScreenId || "himi_product", legacyCache: true,
192
192
  };
193
193
  }
@@ -616,7 +616,7 @@ const register = withIapPresentation<S>({
616
616
  wasPrice: "",
617
617
  onSale: false,
618
618
  notOnSale: true,
619
- noTagRow: row.noSwatches,
619
+ ...tagFields(false, row.noSwatches, row.ribbon),
620
620
  };
621
621
  return {
622
622
  ...row,
@@ -624,7 +624,7 @@ const register = withIapPresentation<S>({
624
624
  wasPrice,
625
625
  onSale,
626
626
  notOnSale: !onSale,
627
- noTagRow: !onSale && row.noSwatches,
627
+ ...tagFields(onSale, row.noSwatches, row.ribbon),
628
628
  };
629
629
  }) }),
630
630
  });