@wix/himalaya-cli 0.1643.0 → 0.1644.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 (33) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +6 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +3 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +3 -1
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +3 -1
  5. package/dist/browser-plane/assets.json +5 -5
  6. package/dist/browser-plane/preview-deferred/{3361f61ce6b490c8b7b252658ea67f733d88c6e9f95906d0e31eea4827141df3.bin → 155f61519885c85d61a39fa595197071a3ca07680da56055ccb1dcff2e709cd1.bin} +1 -1
  7. package/dist/browser-plane/sw.js +6 -6
  8. package/dist/cli.mjs +358 -144
  9. package/dist/preview-assets.generated.bin +0 -0
  10. package/guides/component-reference.json +1 -1
  11. package/guides/component-reference.md +6 -0
  12. package/guides/designing-himi-screens.md +18 -0
  13. package/guides/offline-reading.md +1 -1
  14. package/guides/recipe-four-state.md +17 -0
  15. package/guides/release-notes.md +21 -0
  16. package/guides/sdk-reference.json +1 -1
  17. package/package.json +2 -2
  18. package/templates/beauty-salon/tier5-src/_shared/iap-presentation.ts +5 -2
  19. package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +6 -3
  20. package/templates/branded-lite/tier5-src/_shared/iap-presentation.ts +5 -2
  21. package/templates/branded-lite/tier5-src/himi-store-product/index.ts +7 -3
  22. package/templates/community-club/tier5-src/_shared/iap-presentation.ts +5 -2
  23. package/templates/events-meetups/tier5-src/_shared/iap-presentation.ts +5 -2
  24. package/templates/gym-fitness/tier5-src/_shared/iap-presentation.ts +5 -2
  25. package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +6 -3
  26. package/templates/nonprofit-cause/tier5-src/_shared/iap-presentation.ts +5 -2
  27. package/templates/podcast-creator/tier5-src/_shared/iap-presentation.ts +5 -2
  28. package/templates/portfolio-creative/tier5-src/_shared/iap-presentation.ts +5 -2
  29. package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +6 -3
  30. package/templates/restaurant/tier5-src/_shared/iap-presentation.ts +5 -2
  31. package/templates/retail-store/tier5-src/_shared/iap-presentation.ts +5 -2
  32. package/templates/retail-store/tier5-src/himi-store-product/index.ts +7 -3
  33. package/templates/yoga-studio/tier5-src/_shared/iap-presentation.ts +5 -2
@@ -453,16 +453,20 @@ const registerProduct = withIapPresentation<S>({
453
453
  onCreate: commerce => { productPricing = commerce; }, prefix: "product",
454
454
  transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "readChanged"], concurrentPublishActions: ["buy"],
455
455
  items: state => inputId() ? [{ reference: { kind: "storesProduct", id: inputId() }, commerceDisplayPrice: state.price }] : [],
456
- present: (state, price, allowed) => {
456
+ present: (state, price, allowed, _appleIapOrResolving, resolving) => {
457
457
  const purchase = applePurchase(state);
458
458
  const unavailable = iapPriceCopy("product").purchaseUnavailable;
459
- const blocked = lastProduct?.productType?.toLowerCase() === "digital" || (!state.optionsUnknown && !allowed(inputId()));
459
+ // A guard still resolving (prices load after the product) is loading, not a refusal: no
460
+ // "Purchasing is not available yet." until a final route blocks the purchase. Add to cart
461
+ // stays disabled meanwhile (`addDisabled`), with no message.
462
+ const pending = !state.optionsUnknown && resolving(inputId());
463
+ const blocked = lastProduct?.productType?.toLowerCase() === "digital" || (!state.optionsUnknown && !pending && !allowed(inputId()));
460
464
  const cartHint = state.cartHint === offlineWriteMessage ? state.cartHint
461
465
  : !purchase.appleRoute && blocked ? unavailable : state.cartHint === unavailable ? "" : state.cartHint;
462
466
  const productState = derive(state);
463
467
  return {
464
468
  ...state, price: price(inputId()), ...(purchase.appleRoute ? { wasPrice: "", wasPriceEmpty: false, notOnSale: true } : {}), optionsIncomplete: productState.optionsIncomplete || !allowed(inputId()) || lastProduct?.productType?.toLowerCase() === "digital",
465
- cartHint, noCartHint: !cartHint || state.added, addDisabled: productState.addDisabled || blocked,
469
+ cartHint, noCartHint: !cartHint || state.added, addDisabled: productState.addDisabled || blocked || pending,
466
470
  cartHidden: state.status !== "ready" || !state.name || purchase.appleRoute,
467
471
  buyHidden: state.status !== "ready" || !state.name || !purchase.appleRoute || purchase.accessReady, buyLabel: purchase.buyLabel, buyDisabled: purchase.buyDisabled,
468
472
  buyNote: state.buyNote === offlineWriteMessage ? state.buyNote : purchase.buyNote,
@@ -11,7 +11,9 @@ export function withIapPresentation<S extends object>(options: {
11
11
  onCreate?(commerce: IapCommerce): void;
12
12
  onContent?(state: S): void;
13
13
  items(state: S): IapCatalogItem[];
14
- present(state: S, price: (id: string, commercePrice?: string) => string, allowed: (id: string) => boolean, appleIapOrResolving: (id: string) => boolean): S;
14
+ /** `resolving` is true while the checkout guard has no answer yet (a cold boot, a refresh): a
15
+ * screen reads it as loading, never as "not allowed". */
16
+ present(state: S, price: (id: string, commercePrice?: string) => string, allowed: (id: string) => boolean, appleIapOrResolving: (id: string) => boolean, resolving: (id: string) => boolean): S;
15
17
  contentActions: string[];
16
18
  /** Defaults to load/refresh/retry; mutations can explicitly request fresh mapping. */
17
19
  forcePriceRefreshActions?: string[];
@@ -74,11 +76,12 @@ export function withIapPresentation<S extends object>(options: {
74
76
  return view.route === "disabled" || view.route === "regular" ? commercePrice ?? item.commerceDisplayPrice ?? "" : iapPriceFields(view, iapPriceCopy(options.prefix)).priceText;
75
77
  };
76
78
  const allowed = (id: string) => commerce.pricing.checkoutGuard({ kind: "storesProduct", id }).allowed;
79
+ const resolving = (id: string) => commerce.pricing.checkoutGuard({ kind: "storesProduct", id }).route === "resolving";
77
80
  const appleIapOrResolving = (id: string) => ["appleIap", "resolving", "unavailable"].includes(presentationView(id).route);
78
81
  // Re-evaluate the cadence first. A checkout can enter/leave due work while a prior
79
82
  // projection is waiting to retry; a fresh directive supersedes the retained one.
80
83
  const poll = commerce.pollDirective(`${name}.iapPoll`) ?? retainedPoll;
81
- return { ...options.present(state, price, allowed, appleIapOrResolving), ...(poll ? { _poll: poll } : {}) };
84
+ return { ...options.present(state, price, allowed, appleIapOrResolving, resolving), ...(poll ? { _poll: poll } : {}) };
82
85
  };
83
86
  const mergeConcurrent = (before: S, next: S, current: S): S => {
84
87
  if (current === before) return next;