@wix/himalaya-cli 0.1572.0 → 0.1573.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 (65) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +2 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/checkout/src/index.d.ts +4 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +1 -1
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce-contract.d.ts +2 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +1 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/one-app-page.d.ts +61 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/social-feed/src/index.d.ts +34 -9
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/checkout.mjs +28 -3
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +2 -1
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +573 -73
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-social-feed.mjs +24 -1
  12. package/dist/cli.mjs +123 -43
  13. package/dist/preview-assets.generated.bin +0 -0
  14. package/guides/one-app-to-himi-app.md +54 -0
  15. package/guides/sdk-reference.json +28 -4
  16. package/guides/webview-page-sdk.md +68 -3
  17. package/package.json +2 -2
  18. package/templates/beauty-salon/tier5-src/_shared/iap-worker.ts +2 -0
  19. package/templates/beauty-salon/tier5-src/_shared/payment-setup.ts +6 -0
  20. package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +5 -2
  21. package/templates/beauty-salon/tier5-src/himi-branded-lite-cart/index.ts +5 -2
  22. package/templates/beauty-salon/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  23. package/templates/branded-lite/tier5-src/_shared/iap-worker.ts +2 -0
  24. package/templates/branded-lite/tier5-src/_shared/payment-setup.ts +6 -0
  25. package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +5 -2
  26. package/templates/branded-lite/tier5-src/himi-branded-lite-cart/index.ts +5 -2
  27. package/templates/branded-lite/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  28. package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +5 -2
  29. package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +9 -4
  30. package/templates/community-club/tier5-src/_shared/iap-worker.ts +2 -0
  31. package/templates/community-club/tier5-src/_shared/payment-setup.ts +6 -0
  32. package/templates/community-club/tier5-src/himi-events-detail/index.ts +9 -4
  33. package/templates/events-meetups/tier5-src/_shared/iap-worker.ts +2 -0
  34. package/templates/events-meetups/tier5-src/_shared/payment-setup.ts +6 -0
  35. package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +9 -4
  36. package/templates/gym-fitness/tier5-src/_shared/iap-worker.ts +2 -0
  37. package/templates/gym-fitness/tier5-src/_shared/payment-setup.ts +6 -0
  38. package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +5 -2
  39. package/templates/gym-fitness/tier5-src/himi-branded-lite-cart/index.ts +5 -2
  40. package/templates/gym-fitness/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  41. package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +9 -4
  42. package/templates/nonprofit-cause/tier5-src/_shared/iap-worker.ts +2 -0
  43. package/templates/nonprofit-cause/tier5-src/_shared/payment-setup.ts +6 -0
  44. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  45. package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +9 -4
  46. package/templates/podcast-creator/tier5-src/_shared/iap-worker.ts +2 -0
  47. package/templates/podcast-creator/tier5-src/_shared/payment-setup.ts +6 -0
  48. package/templates/podcast-creator/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  49. package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +9 -4
  50. package/templates/portfolio-creative/tier5-src/_shared/iap-worker.ts +2 -0
  51. package/templates/portfolio-creative/tier5-src/_shared/payment-setup.ts +6 -0
  52. package/templates/portfolio-creative/tier5-src/himi-branded-lite-cart/index.ts +5 -2
  53. package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +9 -4
  54. package/templates/restaurant/tier5-src/_shared/iap-worker.ts +2 -0
  55. package/templates/restaurant/tier5-src/_shared/payment-setup.ts +6 -0
  56. package/templates/restaurant/tier5-src/himi-events-detail/index.ts +9 -4
  57. package/templates/retail-store/tier5-src/_shared/iap-worker.ts +2 -0
  58. package/templates/retail-store/tier5-src/_shared/payment-setup.ts +6 -0
  59. package/templates/retail-store/tier5-src/himi-branded-lite-cart/index.ts +5 -2
  60. package/templates/yoga-studio/tier5-src/_shared/iap-worker.ts +2 -0
  61. package/templates/yoga-studio/tier5-src/_shared/payment-setup.ts +6 -0
  62. package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +5 -2
  63. package/templates/yoga-studio/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  64. package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +5 -2
  65. package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +9 -4
@@ -0,0 +1,6 @@
1
+ import { copyParam } from "./himi-copy.js";
2
+
3
+ /** No provider or country guess: Wix only established that online payment is unavailable. */
4
+ export function paymentSetupMessage(prefix: string): string {
5
+ return copyParam(`${prefix}.paymentSetupUnavailable`, "This site is not accepting online payments. Go back or contact the business for other payment options.");
6
+ }
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  // Tier-5 bundle: himi-events — event detail.
2
3
  import { calendarDay, formatClock, formatCurrency, formatWeekdayDateTime, formatWeekdayMonthDay, formatTimeZoneLabel } from "../_shared/engine-intl.js";
3
4
  import { defineService as registerService } from "@himalaya/state";
@@ -18,7 +19,7 @@ import {
18
19
  type WixEvent,
19
20
  } from "@himalaya/wix-events";
20
21
  import { session as wixPlatformSession } from "@himalaya/wix-platform";
21
- import { payCashierOrder } from "@himalaya/checkout";
22
+ import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
22
23
  import { get, upsert, type DbEntity } from "@himalaya/local-db";
23
24
  import {
24
25
  currentInputId,
@@ -986,16 +987,18 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
986
987
  if (pay.kind === "paid") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.ticketIssued", "You're in — your ticket is confirmed.") };
987
988
  else if (pay.kind === "handoff") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") };
988
989
  else if (pay.kind === "cancelled") result = { ...s, snackbarMessage: detailCopy("event.ticketCancelled", "Payment cancelled — no ticket was issued.") };
990
+ else if (isPaymentSetupFailure(pay)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
989
991
  else throw new Error("Payment could not be completed");
990
992
  }
991
993
  }
992
994
  }
993
- } catch {
995
+ } catch (error) {
996
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
994
997
  try {
995
998
  // A public event page is not pinned to this selection or price. Only
996
999
  // continue in hosted checkout when a reservation already holds it.
997
1000
  const params = reservationId ? { reservationId } : undefined;
998
- if (params) {
1001
+ if (params && !result) {
999
1002
  const redirect = await createRedirectSession({ eventsCheckout: params });
1000
1003
  const url = redirect.redirectSession?.fullUrl;
1001
1004
  if (url) {
@@ -1003,7 +1006,9 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
1003
1006
  result = { ...s, ticketSheetOpen: false, snackbarMessage: opened.opened ? detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") : detailCopy("event.registrationOpenFailed", "Could not open the registration page.") };
1004
1007
  }
1005
1008
  }
1006
- } catch { /* report below */ }
1009
+ } catch (error) {
1010
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
1011
+ }
1007
1012
  if (!result) result = { ...s, snackbarMessage: detailCopy("event.purchaseUnavailable", "Purchasing is temporarily unavailable.") };
1008
1013
  } finally { ticketCheckoutInFlight = false; }
1009
1014
  return derive(result!);
@@ -4,6 +4,7 @@
4
4
  // SDK; this only supplies the copy and the hydration reset.
5
5
  import { hostSessionFromGlobal, type IapPriceCopy } from "@himalaya/iap";
6
6
  import type { IapCommerce, IapPurchaseCopy, IapRestoreResult } from "@himalaya/iap-checkout";
7
+ import { paymentSetupMessage } from "./payment-setup.js";
7
8
  import { copyParam, copyTemplate } from "./himi-copy.js";
8
9
 
9
10
  /** Price labels from the screen's copy pack (`<prefix>.priceLoadingText`, …). */
@@ -25,6 +26,7 @@ export function iapPurchaseCopy(prefix: string): IapPurchaseCopy {
25
26
  awaitingApproval: copyParam(`${prefix}.purchaseAwaitingApprovalText`, "Waiting for approval"),
26
27
  unavailable: copyParam(`${prefix}.purchaseTemporarilyUnavailableText`, "Purchasing is temporarily unavailable."),
27
28
  signInRequired: copyParam(`${prefix}.purchaseSignInText`, "Sign in to buy."),
29
+ sitePaymentUnavailable: paymentSetupMessage(prefix),
28
30
  retry: copyParam(`${prefix}.purchaseRetryText`, "Something went wrong. Try again."),
29
31
  priceChanged: copyParam(`${prefix}.purchasePriceChangedText`, "The price changed. Check it and try again."),
30
32
  support: copyParam(`${prefix}.purchaseSupportText`, "We couldn't finish this purchase. Contact support."),
@@ -0,0 +1,6 @@
1
+ import { copyParam } from "./himi-copy.js";
2
+
3
+ /** No provider or country guess: Wix only established that online payment is unavailable. */
4
+ export function paymentSetupMessage(prefix: string): string {
5
+ return copyParam(`${prefix}.paymentSetupUnavailable`, "This site is not accepting online payments. Go back or contact the business for other payment options.");
6
+ }
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  import { withOnlineWrites, offlineWritesEnabled } from "../_shared/online-actions.js";
2
3
  // Tier-5 bundle: himi-booking — availability and member booking.
3
4
  import { defineService as registerService, navigate } from "@himalaya/state";
@@ -9,7 +10,7 @@ import { dispatch } from "@himalaya/dispatch";
9
10
  import { bookSchedule, bookSlot, getService, queryServiceAvailability, registerToWaitlist, type WixBookingSlotFull, type WixSelectedPaymentOption, type WixService } from "@himalaya/wix-bookings";
10
11
  import { createCheckout, createOrder } from "@himalaya/wix-ecom";
11
12
  import { createRedirectSession, type WixSlot } from "@himalaya/wix-redirects";
12
- import { payCashierOrder } from "@himalaya/checkout";
13
+ import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
13
14
  import { hostedCheckoutOpener, isHostedWorker } from "../_shared/hosted-checkout.js";
14
15
  import { session as wixPlatformSession } from "@himalaya/wix-platform";
15
16
  import { displayName, getMyData, type WixMyData } from "@himalaya/wix-users";
@@ -1587,10 +1588,12 @@ async function bookSelectedIn(s: S): Promise<S> {
1587
1588
  ? copyParam("time.coursePaymentCancelled", "Payment cancelled — your course booking wasn't confirmed. Try again.")
1588
1589
  : copyParam("time.paymentCancelled", "Payment cancelled — your booking wasn't confirmed. Pick a time to try again.") });
1589
1590
  }
1591
+ if (isPaymentSetupFailure(pay)) return derive({ ...s, bookingInFlight: false, message: paymentSetupMessage("time") });
1590
1592
  return derive({ ...s, bookingInFlight: false, message: s.isCourse
1591
1593
  ? copyParam("time.coursePaymentFailed", "Payment couldn't be completed. Try again.")
1592
1594
  : copyParam("time.paymentFailed", "Payment couldn't be completed. Pick another time or try again.") });
1593
- } catch {
1595
+ } catch (error) {
1596
+ if (isPaymentSetupFailure(error)) return derive({ ...s, bookingInFlight: false, message: paymentSetupMessage("time") });
1594
1597
  return derive({ ...s, bookingInFlight: false, message: s.isCourse
1595
1598
  ? copyParam("time.courseCheckoutFailed", "Checkout could not start. Try again.")
1596
1599
  : copyParam("time.checkoutFailed", "Checkout could not start. Pick another time or try again.") });
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  import { withOnlineWrites } from "../_shared/online-actions.js";
2
3
  import { defineService as registerState } from "@himalaya/state";
3
4
  import { getStoreProduct } from "../_shared/himi-store.js";
@@ -7,7 +8,7 @@ import { withIapPresentation } from "../_shared/iap-presentation.js";
7
8
  import { type IapCommerce, classifyCart } from "@himalaya/iap-checkout";
8
9
  import { addCouponToCurrentCart, calculateCurrentCart, createCheckoutFromCurrentCart, getCurrentCart, removeCouponFromCurrentCart, removeLineItemsFromCurrentCart, updateLineItemsQuantity, type WixCartDetail, type WixCartLineItemDetail } from "@himalaya/wix-ecom";
9
10
  import { createRedirectSession } from "@himalaya/wix-redirects";
10
- import { payCashierOrder } from "@himalaya/checkout";
11
+ import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
11
12
  import { hostedCheckoutOpener, isHostedWorker } from "../_shared/hosted-checkout.js";
12
13
  import { formatCurrency } from "../_shared/engine-intl.js";
13
14
 
@@ -574,8 +575,10 @@ const svc = defineService<State, {
574
575
  // only confirmed once it lands, so the cart must survive a bail-out.
575
576
  return derive({ ...state, checkoutHint: copyParam("cart.checkoutOpenedMessage", "Checkout opened.") });
576
577
  }
578
+ if (isPaymentSetupFailure(pay)) return derive({ ...state, checkoutHint: paymentSetupMessage("cart") });
577
579
  return derive({ ...state, checkoutHint: copyParam("cart.checkoutFailedMessage", "Checkout could not start.") });
578
- } catch {
580
+ } catch (error) {
581
+ if (isPaymentSetupFailure(error)) return derive({ ...state, checkoutHint: paymentSetupMessage("cart") });
579
582
  return derive({ ...state, checkoutHint: copyParam("cart.checkoutFailedMessage", "Checkout could not start.") });
580
583
  }
581
584
  },
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  import { offlineWriteMessage, offlineWritesEnabled, withOnlineWrites } from "../_shared/online-actions.js";
2
3
  import { connectivity } from "@himalaya/state";
3
4
  import { defineService as registerService } from "../_shared/collection-service.js";
@@ -6,7 +7,7 @@ import { createRedirectSession } from "@himalaya/wix-redirects";
6
7
  import { open as openUrl } from "@himalaya/open-url";
7
8
  import { session as wixPlatformSession } from "@himalaya/wix-platform";
8
9
  import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
9
- import { activePlanIds, entitlement, payCashierOrder } from "@himalaya/checkout";
10
+ import { activePlanIds, entitlement, isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
10
11
  import { hostSessionFromGlobal, iapPriceFields, type IapCatalogItem } from "@himalaya/iap";
11
12
  import { createIapCommerce, pricingPlanOrders } from "@himalaya/iap-checkout";
12
13
  import { iapPriceCopy, iapPurchaseCopy, resetUnhydratedKeysOnOlderRuntime } from "../_shared/iap-worker.js";
@@ -290,7 +291,9 @@ async function regularJoinMessage(row: PlanRow, reference: { kind: string; id: s
290
291
  if (pay.kind === "cancelled") {
291
292
  return copyParam("plans.joinCancelledMessage", "Payment cancelled — you haven't joined.");
292
293
  }
293
- } catch {
294
+ if (isPaymentSetupFailure(pay)) return paymentSetupMessage("plans");
295
+ } catch (error) {
296
+ if (isPaymentSetupFailure(error)) return paymentSetupMessage("plans");
294
297
  }
295
298
  return copyTemplate("plans.joinOnSiteMessage", "Memberships are purchased on the website — visit the site to join {name}.", { name: row.name });
296
299
  }
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  // Tier-5 bundle: himi-events — event detail.
2
3
  import { calendarDay, formatClock, formatCurrency, formatWeekdayDateTime, formatWeekdayMonthDay, formatTimeZoneLabel } from "../_shared/engine-intl.js";
3
4
  import { defineService as registerService } from "@himalaya/state";
@@ -18,7 +19,7 @@ import {
18
19
  type WixEvent,
19
20
  } from "@himalaya/wix-events";
20
21
  import { session as wixPlatformSession } from "@himalaya/wix-platform";
21
- import { payCashierOrder } from "@himalaya/checkout";
22
+ import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
22
23
  import { get, upsert, type DbEntity } from "@himalaya/local-db";
23
24
  import {
24
25
  currentInputId,
@@ -986,16 +987,18 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
986
987
  if (pay.kind === "paid") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.ticketIssued", "You're in — your ticket is confirmed.") };
987
988
  else if (pay.kind === "handoff") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") };
988
989
  else if (pay.kind === "cancelled") result = { ...s, snackbarMessage: detailCopy("event.ticketCancelled", "Payment cancelled — no ticket was issued.") };
990
+ else if (isPaymentSetupFailure(pay)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
989
991
  else throw new Error("Payment could not be completed");
990
992
  }
991
993
  }
992
994
  }
993
- } catch {
995
+ } catch (error) {
996
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
994
997
  try {
995
998
  // A public event page is not pinned to this selection or price. Only
996
999
  // continue in hosted checkout when a reservation already holds it.
997
1000
  const params = reservationId ? { reservationId } : undefined;
998
- if (params) {
1001
+ if (params && !result) {
999
1002
  const redirect = await createRedirectSession({ eventsCheckout: params });
1000
1003
  const url = redirect.redirectSession?.fullUrl;
1001
1004
  if (url) {
@@ -1003,7 +1006,9 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
1003
1006
  result = { ...s, ticketSheetOpen: false, snackbarMessage: opened.opened ? detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") : detailCopy("event.registrationOpenFailed", "Could not open the registration page.") };
1004
1007
  }
1005
1008
  }
1006
- } catch { /* report below */ }
1009
+ } catch (error) {
1010
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
1011
+ }
1007
1012
  if (!result) result = { ...s, snackbarMessage: detailCopy("event.purchaseUnavailable", "Purchasing is temporarily unavailable.") };
1008
1013
  } finally { ticketCheckoutInFlight = false; }
1009
1014
  return derive(result!);
@@ -4,6 +4,7 @@
4
4
  // SDK; this only supplies the copy and the hydration reset.
5
5
  import { hostSessionFromGlobal, type IapPriceCopy } from "@himalaya/iap";
6
6
  import type { IapCommerce, IapPurchaseCopy, IapRestoreResult } from "@himalaya/iap-checkout";
7
+ import { paymentSetupMessage } from "./payment-setup.js";
7
8
  import { copyParam, copyTemplate } from "./himi-copy.js";
8
9
 
9
10
  /** Price labels from the screen's copy pack (`<prefix>.priceLoadingText`, …). */
@@ -25,6 +26,7 @@ export function iapPurchaseCopy(prefix: string): IapPurchaseCopy {
25
26
  awaitingApproval: copyParam(`${prefix}.purchaseAwaitingApprovalText`, "Waiting for approval"),
26
27
  unavailable: copyParam(`${prefix}.purchaseTemporarilyUnavailableText`, "Purchasing is temporarily unavailable."),
27
28
  signInRequired: copyParam(`${prefix}.purchaseSignInText`, "Sign in to buy."),
29
+ sitePaymentUnavailable: paymentSetupMessage(prefix),
28
30
  retry: copyParam(`${prefix}.purchaseRetryText`, "Something went wrong. Try again."),
29
31
  priceChanged: copyParam(`${prefix}.purchasePriceChangedText`, "The price changed. Check it and try again."),
30
32
  support: copyParam(`${prefix}.purchaseSupportText`, "We couldn't finish this purchase. Contact support."),
@@ -0,0 +1,6 @@
1
+ import { copyParam } from "./himi-copy.js";
2
+
3
+ /** No provider or country guess: Wix only established that online payment is unavailable. */
4
+ export function paymentSetupMessage(prefix: string): string {
5
+ return copyParam(`${prefix}.paymentSetupUnavailable`, "This site is not accepting online payments. Go back or contact the business for other payment options.");
6
+ }
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  import { offlineWriteMessage, offlineWritesEnabled, withOnlineWrites } from "../_shared/online-actions.js";
2
3
  import { connectivity } from "@himalaya/state";
3
4
  import { defineService as registerService } from "../_shared/collection-service.js";
@@ -6,7 +7,7 @@ import { createRedirectSession } from "@himalaya/wix-redirects";
6
7
  import { open as openUrl } from "@himalaya/open-url";
7
8
  import { session as wixPlatformSession } from "@himalaya/wix-platform";
8
9
  import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
9
- import { activePlanIds, entitlement, payCashierOrder } from "@himalaya/checkout";
10
+ import { activePlanIds, entitlement, isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
10
11
  import { hostSessionFromGlobal, iapPriceFields, type IapCatalogItem } from "@himalaya/iap";
11
12
  import { createIapCommerce, pricingPlanOrders } from "@himalaya/iap-checkout";
12
13
  import { iapPriceCopy, iapPurchaseCopy, resetUnhydratedKeysOnOlderRuntime } from "../_shared/iap-worker.js";
@@ -290,7 +291,9 @@ async function regularJoinMessage(row: PlanRow, reference: { kind: string; id: s
290
291
  if (pay.kind === "cancelled") {
291
292
  return copyParam("plans.joinCancelledMessage", "Payment cancelled — you haven't joined.");
292
293
  }
293
- } catch {
294
+ if (isPaymentSetupFailure(pay)) return paymentSetupMessage("plans");
295
+ } catch (error) {
296
+ if (isPaymentSetupFailure(error)) return paymentSetupMessage("plans");
294
297
  }
295
298
  return copyTemplate("plans.joinOnSiteMessage", "Memberships are purchased on the website — visit the site to join {name}.", { name: row.name });
296
299
  }
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  // Tier-5 bundle: himi-events — event detail.
2
3
  import { calendarDay, formatClock, formatCurrency, formatWeekdayDateTime, formatWeekdayMonthDay, formatTimeZoneLabel } from "../_shared/engine-intl.js";
3
4
  import { defineService as registerService } from "@himalaya/state";
@@ -18,7 +19,7 @@ import {
18
19
  type WixEvent,
19
20
  } from "@himalaya/wix-events";
20
21
  import { session as wixPlatformSession } from "@himalaya/wix-platform";
21
- import { payCashierOrder } from "@himalaya/checkout";
22
+ import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
22
23
  import { get, upsert, type DbEntity } from "@himalaya/local-db";
23
24
  import {
24
25
  currentInputId,
@@ -986,16 +987,18 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
986
987
  if (pay.kind === "paid") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.ticketIssued", "You're in — your ticket is confirmed.") };
987
988
  else if (pay.kind === "handoff") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") };
988
989
  else if (pay.kind === "cancelled") result = { ...s, snackbarMessage: detailCopy("event.ticketCancelled", "Payment cancelled — no ticket was issued.") };
990
+ else if (isPaymentSetupFailure(pay)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
989
991
  else throw new Error("Payment could not be completed");
990
992
  }
991
993
  }
992
994
  }
993
- } catch {
995
+ } catch (error) {
996
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
994
997
  try {
995
998
  // A public event page is not pinned to this selection or price. Only
996
999
  // continue in hosted checkout when a reservation already holds it.
997
1000
  const params = reservationId ? { reservationId } : undefined;
998
- if (params) {
1001
+ if (params && !result) {
999
1002
  const redirect = await createRedirectSession({ eventsCheckout: params });
1000
1003
  const url = redirect.redirectSession?.fullUrl;
1001
1004
  if (url) {
@@ -1003,7 +1006,9 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
1003
1006
  result = { ...s, ticketSheetOpen: false, snackbarMessage: opened.opened ? detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") : detailCopy("event.registrationOpenFailed", "Could not open the registration page.") };
1004
1007
  }
1005
1008
  }
1006
- } catch { /* report below */ }
1009
+ } catch (error) {
1010
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
1011
+ }
1007
1012
  if (!result) result = { ...s, snackbarMessage: detailCopy("event.purchaseUnavailable", "Purchasing is temporarily unavailable.") };
1008
1013
  } finally { ticketCheckoutInFlight = false; }
1009
1014
  return derive(result!);
@@ -4,6 +4,7 @@
4
4
  // SDK; this only supplies the copy and the hydration reset.
5
5
  import { hostSessionFromGlobal, type IapPriceCopy } from "@himalaya/iap";
6
6
  import type { IapCommerce, IapPurchaseCopy, IapRestoreResult } from "@himalaya/iap-checkout";
7
+ import { paymentSetupMessage } from "./payment-setup.js";
7
8
  import { copyParam, copyTemplate } from "./himi-copy.js";
8
9
 
9
10
  /** Price labels from the screen's copy pack (`<prefix>.priceLoadingText`, …). */
@@ -25,6 +26,7 @@ export function iapPurchaseCopy(prefix: string): IapPurchaseCopy {
25
26
  awaitingApproval: copyParam(`${prefix}.purchaseAwaitingApprovalText`, "Waiting for approval"),
26
27
  unavailable: copyParam(`${prefix}.purchaseTemporarilyUnavailableText`, "Purchasing is temporarily unavailable."),
27
28
  signInRequired: copyParam(`${prefix}.purchaseSignInText`, "Sign in to buy."),
29
+ sitePaymentUnavailable: paymentSetupMessage(prefix),
28
30
  retry: copyParam(`${prefix}.purchaseRetryText`, "Something went wrong. Try again."),
29
31
  priceChanged: copyParam(`${prefix}.purchasePriceChangedText`, "The price changed. Check it and try again."),
30
32
  support: copyParam(`${prefix}.purchaseSupportText`, "We couldn't finish this purchase. Contact support."),
@@ -0,0 +1,6 @@
1
+ import { copyParam } from "./himi-copy.js";
2
+
3
+ /** No provider or country guess: Wix only established that online payment is unavailable. */
4
+ export function paymentSetupMessage(prefix: string): string {
5
+ return copyParam(`${prefix}.paymentSetupUnavailable`, "This site is not accepting online payments. Go back or contact the business for other payment options.");
6
+ }
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  import { offlineWriteMessage, offlineWritesEnabled, withOnlineWrites } from "../_shared/online-actions.js";
2
3
  import { connectivity } from "@himalaya/state";
3
4
  import { defineService as registerService } from "../_shared/collection-service.js";
@@ -6,7 +7,7 @@ import { createRedirectSession } from "@himalaya/wix-redirects";
6
7
  import { open as openUrl } from "@himalaya/open-url";
7
8
  import { session as wixPlatformSession } from "@himalaya/wix-platform";
8
9
  import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
9
- import { activePlanIds, entitlement, payCashierOrder } from "@himalaya/checkout";
10
+ import { activePlanIds, entitlement, isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
10
11
  import { hostSessionFromGlobal, iapPriceFields, type IapCatalogItem } from "@himalaya/iap";
11
12
  import { createIapCommerce, pricingPlanOrders } from "@himalaya/iap-checkout";
12
13
  import { iapPriceCopy, iapPurchaseCopy, resetUnhydratedKeysOnOlderRuntime } from "../_shared/iap-worker.js";
@@ -290,7 +291,9 @@ async function regularJoinMessage(row: PlanRow, reference: { kind: string; id: s
290
291
  if (pay.kind === "cancelled") {
291
292
  return copyParam("plans.joinCancelledMessage", "Payment cancelled — you haven't joined.");
292
293
  }
293
- } catch {
294
+ if (isPaymentSetupFailure(pay)) return paymentSetupMessage("plans");
295
+ } catch (error) {
296
+ if (isPaymentSetupFailure(error)) return paymentSetupMessage("plans");
294
297
  }
295
298
  return copyTemplate("plans.joinOnSiteMessage", "Memberships are purchased on the website — visit the site to join {name}.", { name: row.name });
296
299
  }
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  // Tier-5 bundle: himi-events — event detail.
2
3
  import { calendarDay, formatClock, formatCurrency, formatWeekdayDateTime, formatWeekdayMonthDay, formatTimeZoneLabel } from "../_shared/engine-intl.js";
3
4
  import { defineService as registerService } from "@himalaya/state";
@@ -18,7 +19,7 @@ import {
18
19
  type WixEvent,
19
20
  } from "@himalaya/wix-events";
20
21
  import { session as wixPlatformSession } from "@himalaya/wix-platform";
21
- import { payCashierOrder } from "@himalaya/checkout";
22
+ import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
22
23
  import { get, upsert, type DbEntity } from "@himalaya/local-db";
23
24
  import {
24
25
  currentInputId,
@@ -986,16 +987,18 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
986
987
  if (pay.kind === "paid") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.ticketIssued", "You're in — your ticket is confirmed.") };
987
988
  else if (pay.kind === "handoff") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") };
988
989
  else if (pay.kind === "cancelled") result = { ...s, snackbarMessage: detailCopy("event.ticketCancelled", "Payment cancelled — no ticket was issued.") };
990
+ else if (isPaymentSetupFailure(pay)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
989
991
  else throw new Error("Payment could not be completed");
990
992
  }
991
993
  }
992
994
  }
993
- } catch {
995
+ } catch (error) {
996
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
994
997
  try {
995
998
  // A public event page is not pinned to this selection or price. Only
996
999
  // continue in hosted checkout when a reservation already holds it.
997
1000
  const params = reservationId ? { reservationId } : undefined;
998
- if (params) {
1001
+ if (params && !result) {
999
1002
  const redirect = await createRedirectSession({ eventsCheckout: params });
1000
1003
  const url = redirect.redirectSession?.fullUrl;
1001
1004
  if (url) {
@@ -1003,7 +1006,9 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
1003
1006
  result = { ...s, ticketSheetOpen: false, snackbarMessage: opened.opened ? detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") : detailCopy("event.registrationOpenFailed", "Could not open the registration page.") };
1004
1007
  }
1005
1008
  }
1006
- } catch { /* report below */ }
1009
+ } catch (error) {
1010
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
1011
+ }
1007
1012
  if (!result) result = { ...s, snackbarMessage: detailCopy("event.purchaseUnavailable", "Purchasing is temporarily unavailable.") };
1008
1013
  } finally { ticketCheckoutInFlight = false; }
1009
1014
  return derive(result!);
@@ -4,6 +4,7 @@
4
4
  // SDK; this only supplies the copy and the hydration reset.
5
5
  import { hostSessionFromGlobal, type IapPriceCopy } from "@himalaya/iap";
6
6
  import type { IapCommerce, IapPurchaseCopy, IapRestoreResult } from "@himalaya/iap-checkout";
7
+ import { paymentSetupMessage } from "./payment-setup.js";
7
8
  import { copyParam, copyTemplate } from "./himi-copy.js";
8
9
 
9
10
  /** Price labels from the screen's copy pack (`<prefix>.priceLoadingText`, …). */
@@ -25,6 +26,7 @@ export function iapPurchaseCopy(prefix: string): IapPurchaseCopy {
25
26
  awaitingApproval: copyParam(`${prefix}.purchaseAwaitingApprovalText`, "Waiting for approval"),
26
27
  unavailable: copyParam(`${prefix}.purchaseTemporarilyUnavailableText`, "Purchasing is temporarily unavailable."),
27
28
  signInRequired: copyParam(`${prefix}.purchaseSignInText`, "Sign in to buy."),
29
+ sitePaymentUnavailable: paymentSetupMessage(prefix),
28
30
  retry: copyParam(`${prefix}.purchaseRetryText`, "Something went wrong. Try again."),
29
31
  priceChanged: copyParam(`${prefix}.purchasePriceChangedText`, "The price changed. Check it and try again."),
30
32
  support: copyParam(`${prefix}.purchaseSupportText`, "We couldn't finish this purchase. Contact support."),
@@ -0,0 +1,6 @@
1
+ import { copyParam } from "./himi-copy.js";
2
+
3
+ /** No provider or country guess: Wix only established that online payment is unavailable. */
4
+ export function paymentSetupMessage(prefix: string): string {
5
+ return copyParam(`${prefix}.paymentSetupUnavailable`, "This site is not accepting online payments. Go back or contact the business for other payment options.");
6
+ }
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  import { withOnlineWrites } from "../_shared/online-actions.js";
2
3
  import { defineService as registerState } from "@himalaya/state";
3
4
  import { getStoreProduct } from "../_shared/himi-store.js";
@@ -7,7 +8,7 @@ import { withIapPresentation } from "../_shared/iap-presentation.js";
7
8
  import { type IapCommerce, classifyCart } from "@himalaya/iap-checkout";
8
9
  import { addCouponToCurrentCart, calculateCurrentCart, createCheckoutFromCurrentCart, getCurrentCart, removeCouponFromCurrentCart, removeLineItemsFromCurrentCart, updateLineItemsQuantity, type WixCartDetail, type WixCartLineItemDetail } from "@himalaya/wix-ecom";
9
10
  import { createRedirectSession } from "@himalaya/wix-redirects";
10
- import { payCashierOrder } from "@himalaya/checkout";
11
+ import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
11
12
  import { hostedCheckoutOpener, isHostedWorker } from "../_shared/hosted-checkout.js";
12
13
  import { formatCurrency } from "../_shared/engine-intl.js";
13
14
 
@@ -574,8 +575,10 @@ const svc = defineService<State, {
574
575
  // only confirmed once it lands, so the cart must survive a bail-out.
575
576
  return derive({ ...state, checkoutHint: copyParam("cart.checkoutOpenedMessage", "Checkout opened.") });
576
577
  }
578
+ if (isPaymentSetupFailure(pay)) return derive({ ...state, checkoutHint: paymentSetupMessage("cart") });
577
579
  return derive({ ...state, checkoutHint: copyParam("cart.checkoutFailedMessage", "Checkout could not start.") });
578
- } catch {
580
+ } catch (error) {
581
+ if (isPaymentSetupFailure(error)) return derive({ ...state, checkoutHint: paymentSetupMessage("cart") });
579
582
  return derive({ ...state, checkoutHint: copyParam("cart.checkoutFailedMessage", "Checkout could not start.") });
580
583
  }
581
584
  },
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  // Tier-5 bundle: himi-events — event detail.
2
3
  import { calendarDay, formatClock, formatCurrency, formatWeekdayDateTime, formatWeekdayMonthDay, formatTimeZoneLabel } from "../_shared/engine-intl.js";
3
4
  import { defineService as registerService } from "@himalaya/state";
@@ -18,7 +19,7 @@ import {
18
19
  type WixEvent,
19
20
  } from "@himalaya/wix-events";
20
21
  import { session as wixPlatformSession } from "@himalaya/wix-platform";
21
- import { payCashierOrder } from "@himalaya/checkout";
22
+ import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
22
23
  import { get, upsert, type DbEntity } from "@himalaya/local-db";
23
24
  import {
24
25
  currentInputId,
@@ -986,16 +987,18 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
986
987
  if (pay.kind === "paid") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.ticketIssued", "You're in — your ticket is confirmed.") };
987
988
  else if (pay.kind === "handoff") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") };
988
989
  else if (pay.kind === "cancelled") result = { ...s, snackbarMessage: detailCopy("event.ticketCancelled", "Payment cancelled — no ticket was issued.") };
990
+ else if (isPaymentSetupFailure(pay)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
989
991
  else throw new Error("Payment could not be completed");
990
992
  }
991
993
  }
992
994
  }
993
- } catch {
995
+ } catch (error) {
996
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
994
997
  try {
995
998
  // A public event page is not pinned to this selection or price. Only
996
999
  // continue in hosted checkout when a reservation already holds it.
997
1000
  const params = reservationId ? { reservationId } : undefined;
998
- if (params) {
1001
+ if (params && !result) {
999
1002
  const redirect = await createRedirectSession({ eventsCheckout: params });
1000
1003
  const url = redirect.redirectSession?.fullUrl;
1001
1004
  if (url) {
@@ -1003,7 +1006,9 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
1003
1006
  result = { ...s, ticketSheetOpen: false, snackbarMessage: opened.opened ? detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") : detailCopy("event.registrationOpenFailed", "Could not open the registration page.") };
1004
1007
  }
1005
1008
  }
1006
- } catch { /* report below */ }
1009
+ } catch (error) {
1010
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
1011
+ }
1007
1012
  if (!result) result = { ...s, snackbarMessage: detailCopy("event.purchaseUnavailable", "Purchasing is temporarily unavailable.") };
1008
1013
  } finally { ticketCheckoutInFlight = false; }
1009
1014
  return derive(result!);
@@ -4,6 +4,7 @@
4
4
  // SDK; this only supplies the copy and the hydration reset.
5
5
  import { hostSessionFromGlobal, type IapPriceCopy } from "@himalaya/iap";
6
6
  import type { IapCommerce, IapPurchaseCopy, IapRestoreResult } from "@himalaya/iap-checkout";
7
+ import { paymentSetupMessage } from "./payment-setup.js";
7
8
  import { copyParam, copyTemplate } from "./himi-copy.js";
8
9
 
9
10
  /** Price labels from the screen's copy pack (`<prefix>.priceLoadingText`, …). */
@@ -25,6 +26,7 @@ export function iapPurchaseCopy(prefix: string): IapPurchaseCopy {
25
26
  awaitingApproval: copyParam(`${prefix}.purchaseAwaitingApprovalText`, "Waiting for approval"),
26
27
  unavailable: copyParam(`${prefix}.purchaseTemporarilyUnavailableText`, "Purchasing is temporarily unavailable."),
27
28
  signInRequired: copyParam(`${prefix}.purchaseSignInText`, "Sign in to buy."),
29
+ sitePaymentUnavailable: paymentSetupMessage(prefix),
28
30
  retry: copyParam(`${prefix}.purchaseRetryText`, "Something went wrong. Try again."),
29
31
  priceChanged: copyParam(`${prefix}.purchasePriceChangedText`, "The price changed. Check it and try again."),
30
32
  support: copyParam(`${prefix}.purchaseSupportText`, "We couldn't finish this purchase. Contact support."),
@@ -0,0 +1,6 @@
1
+ import { copyParam } from "./himi-copy.js";
2
+
3
+ /** No provider or country guess: Wix only established that online payment is unavailable. */
4
+ export function paymentSetupMessage(prefix: string): string {
5
+ return copyParam(`${prefix}.paymentSetupUnavailable`, "This site is not accepting online payments. Go back or contact the business for other payment options.");
6
+ }
@@ -1,3 +1,4 @@
1
+ import { paymentSetupMessage } from "../_shared/payment-setup.js";
1
2
  // Tier-5 bundle: himi-events — event detail.
2
3
  import { calendarDay, formatClock, formatCurrency, formatWeekdayDateTime, formatWeekdayMonthDay, formatTimeZoneLabel } from "../_shared/engine-intl.js";
3
4
  import { defineService as registerService } from "@himalaya/state";
@@ -18,7 +19,7 @@ import {
18
19
  type WixEvent,
19
20
  } from "@himalaya/wix-events";
20
21
  import { session as wixPlatformSession } from "@himalaya/wix-platform";
21
- import { payCashierOrder } from "@himalaya/checkout";
22
+ import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
22
23
  import { get, upsert, type DbEntity } from "@himalaya/local-db";
23
24
  import {
24
25
  currentInputId,
@@ -986,16 +987,18 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
986
987
  if (pay.kind === "paid") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.ticketIssued", "You're in — your ticket is confirmed.") };
987
988
  else if (pay.kind === "handoff") result = { ...s, ticketSheetOpen: false, snackbarMessage: detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") };
988
989
  else if (pay.kind === "cancelled") result = { ...s, snackbarMessage: detailCopy("event.ticketCancelled", "Payment cancelled — no ticket was issued.") };
990
+ else if (isPaymentSetupFailure(pay)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
989
991
  else throw new Error("Payment could not be completed");
990
992
  }
991
993
  }
992
994
  }
993
- } catch {
995
+ } catch (error) {
996
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
994
997
  try {
995
998
  // A public event page is not pinned to this selection or price. Only
996
999
  // continue in hosted checkout when a reservation already holds it.
997
1000
  const params = reservationId ? { reservationId } : undefined;
998
- if (params) {
1001
+ if (params && !result) {
999
1002
  const redirect = await createRedirectSession({ eventsCheckout: params });
1000
1003
  const url = redirect.redirectSession?.fullUrl;
1001
1004
  if (url) {
@@ -1003,7 +1006,9 @@ const svc: ReturnType<typeof defineService<S, DetailActions>> = defineService<S,
1003
1006
  result = { ...s, ticketSheetOpen: false, snackbarMessage: opened.opened ? detailCopy("event.checkoutOpened", "Complete checkout in the browser to get your tickets.") : detailCopy("event.registrationOpenFailed", "Could not open the registration page.") };
1004
1007
  }
1005
1008
  }
1006
- } catch { /* report below */ }
1009
+ } catch (error) {
1010
+ if (isPaymentSetupFailure(error)) result = { ...s, snackbarMessage: paymentSetupMessage("event") };
1011
+ }
1007
1012
  if (!result) result = { ...s, snackbarMessage: detailCopy("event.purchaseUnavailable", "Purchasing is temporarily unavailable.") };
1008
1013
  } finally { ticketCheckoutInFlight = false; }
1009
1014
  return derive(result!);
@@ -4,6 +4,7 @@
4
4
  // SDK; this only supplies the copy and the hydration reset.
5
5
  import { hostSessionFromGlobal, type IapPriceCopy } from "@himalaya/iap";
6
6
  import type { IapCommerce, IapPurchaseCopy, IapRestoreResult } from "@himalaya/iap-checkout";
7
+ import { paymentSetupMessage } from "./payment-setup.js";
7
8
  import { copyParam, copyTemplate } from "./himi-copy.js";
8
9
 
9
10
  /** Price labels from the screen's copy pack (`<prefix>.priceLoadingText`, …). */
@@ -25,6 +26,7 @@ export function iapPurchaseCopy(prefix: string): IapPurchaseCopy {
25
26
  awaitingApproval: copyParam(`${prefix}.purchaseAwaitingApprovalText`, "Waiting for approval"),
26
27
  unavailable: copyParam(`${prefix}.purchaseTemporarilyUnavailableText`, "Purchasing is temporarily unavailable."),
27
28
  signInRequired: copyParam(`${prefix}.purchaseSignInText`, "Sign in to buy."),
29
+ sitePaymentUnavailable: paymentSetupMessage(prefix),
28
30
  retry: copyParam(`${prefix}.purchaseRetryText`, "Something went wrong. Try again."),
29
31
  priceChanged: copyParam(`${prefix}.purchasePriceChangedText`, "The price changed. Check it and try again."),
30
32
  support: copyParam(`${prefix}.purchaseSupportText`, "We couldn't finish this purchase. Contact support."),
@@ -0,0 +1,6 @@
1
+ import { copyParam } from "./himi-copy.js";
2
+
3
+ /** No provider or country guess: Wix only established that online payment is unavailable. */
4
+ export function paymentSetupMessage(prefix: string): string {
5
+ return copyParam(`${prefix}.paymentSetupUnavailable`, "This site is not accepting online payments. Go back or contact the business for other payment options.");
6
+ }