@wix/himalaya-cli 0.1820.0 → 0.1822.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.
@@ -88,9 +88,20 @@ export declare function addDays(when: DateLike, days: number): Date | null;
88
88
  export declare function daysBetween(from: DateLike, to: DateLike): number;
89
89
  /** True when both instants land on the same LOCAL calendar day. */
90
90
  export declare function isSameDay(a: DateLike, b: DateLike): boolean;
91
+ /** Words this module writes itself. Each is optional; an override wins over the engine's own. */
92
+ export interface TimeLabels {
93
+ /** Heading for undated items in {@link groupByDay} (`dropUndated: false`). Default "Later". */
94
+ later?: string;
95
+ /** Minutes unit in {@link durationLabel}. Default "min" (English) or `Intl` unit style. */
96
+ minutes?: string;
97
+ /** Hours unit in {@link durationLabel}. Default "h" (English) or `Intl` unit style. */
98
+ hours?: string;
99
+ }
91
100
  export interface LabelOptions {
92
- /** BCP-47 locale. Defaults to the host's. */
101
+ /** BCP-47 locale. Defaults to the app's `@himalaya/l10n` locale, else the host's. */
93
102
  locale?: string;
103
+ /** Override the words this module writes ("Later", "min", "h"). */
104
+ labels?: TimeLabels;
94
105
  /** Anchor for the relative "Today"/"Tomorrow" window. Defaults to now. */
95
106
  now?: DateLike;
96
107
  /** Suppress the relative window and always format the date. */
@@ -137,10 +148,17 @@ export declare function timeLabel(when: DateLike, locale?: string): string;
137
148
  * "09:00 – 09:45", collapsing to just the start when there is no end (or the
138
149
  * end is not after the start). The separator is a space-padded en dash (U+2013),
139
150
  * matching how the booking screens already render ranges.
151
+ *
152
+ * Follows the locale's hour cycle: an English (or unknown) locale keeps the 24-hour
153
+ * "09:00" this helper has always written, any other locale writes its own clock
154
+ * ("9:00 AM" where it is 12-hour, "09:00" where it is 24-hour).
140
155
  */
141
- export declare function timeRange(start: DateLike, end: DateLike): string;
142
- /** "45 min" / "1 h" / "1 h 30 min". Empty when the span is absent or non-positive. */
143
- export declare function durationLabel(start: DateLike, end: DateLike): string;
156
+ export declare function timeRange(start: DateLike, end: DateLike, opts?: {
157
+ locale?: string;
158
+ }): string;
159
+ /** "45 min" / "1 h" / "1 h 30 min". Empty when the span is absent or non-positive. Under a
160
+ * non-English locale the units come from `Intl.NumberFormat` (unit style) when available. */
161
+ export declare function durationLabel(start: DateLike, end: DateLike, opts?: LabelOptions): string;
144
162
  export interface GroupOptions extends LabelOptions {
145
163
  /** Drop items whose start does not parse. Default true. */
146
164
  dropUndated?: boolean;
@@ -186,8 +186,35 @@ export interface PlanRow {
186
186
  joinDisabled: boolean;
187
187
  joinNote: string;
188
188
  }
189
+ /** App Store price and purchase labels on the paywall. */
190
+ export interface CheckoutIapCopy {
191
+ priceLoadingText?: string;
192
+ priceUnavailableText?: string;
193
+ oneTimePurchaseLabel?: string;
194
+ buyAnotherText?: string;
195
+ awaitingApprovalText?: string;
196
+ purchaseUnavailableText?: string;
197
+ retryText?: string;
198
+ sitePaymentUnavailableText?: string;
199
+ memberDetailsRequiredText?: string;
200
+ alreadySubscribedText?: string;
201
+ priceChangedText?: string;
202
+ supportText?: string;
203
+ }
204
+ /** Period lines: MessageFormat plural patterns over `{count}`. */
205
+ export interface CheckoutPeriodCopy {
206
+ periodDay?: string;
207
+ periodWeek?: string;
208
+ periodMonth?: string;
209
+ periodYear?: string;
210
+ validDay?: string;
211
+ validWeek?: string;
212
+ validMonth?: string;
213
+ validYear?: string;
214
+ oneTimeNoExpiry?: string;
215
+ }
189
216
  /** Every user-facing string on the paywall. Override any subset. */
190
- export interface CheckoutCopy {
217
+ export interface CheckoutCopy extends CheckoutIapCopy, CheckoutPeriodCopy {
191
218
  headline?: string;
192
219
  subhead?: string;
193
220
  joinCta?: string;
@@ -205,11 +232,27 @@ export interface CheckoutCopy {
205
232
  cancelledNotice?: string;
206
233
  failedNotice?: string;
207
234
  goneNotice?: string;
235
+ /** "Sign in to continue" button on the screen (needs `signInScreenId`). */
236
+ signInCta?: string;
237
+ /** Navigation title of the screen (`title` on `checkoutScreen` wins). */
238
+ screenTitle?: string;
239
+ /** Name shown for a plan that has none. */
240
+ untitledPlan?: string;
241
+ /** Notice when the member taps a plan they already hold. `{name}` is the plan name. */
242
+ alreadyJoinedNotice?: string;
208
243
  }
209
244
  export interface CheckoutServiceOptions {
210
245
  /** Must match `checkoutScreen({ service })`. */
211
246
  service?: string;
212
247
  copy?: CheckoutCopy;
248
+ /** Resolve copy from the app's catalog at action time: `text("checkout.<field>", fallback)`.
249
+ * Return the RAW catalog pattern, or the fallback when there is no entry (an answer equal to
250
+ * the key counts as no entry). Period and notice values are MessageFormat patterns that this
251
+ * service formats itself with `{count}` / `{name}`, so do not pass them through a function that
252
+ * already formats (`t` from `@himalaya/l10n` fills no `count`): read the raw pattern instead. */
253
+ text?: (key: string, fallback: string) => string;
254
+ /** The app's locale tag for money and plural rules. Default "en". */
255
+ locale?: () => string;
213
256
  /** Deep link the cashier returns to, e.g. "myapp://screen/library". Without it
214
257
  * the member completes payment and lands nowhere. */
215
258
  returnTo?: string;
@@ -243,6 +286,11 @@ export interface CheckoutScreenOptions {
243
286
  service?: string;
244
287
  title?: string;
245
288
  copy?: CheckoutCopy;
289
+ /** Extra capabilities the worker needs beyond the paywall's own, e.g. `["l10n"]` when its
290
+ * `text` / `locale` hooks read `@himalaya/l10n`. */
291
+ capabilities?: string[];
292
+ /** Resolve descriptor copy from the app's catalog when the screen is built: `text("checkout.<field>", fallback)`. */
293
+ text?: (key: string, fallback: string) => string;
246
294
  /** Screen the "Sign in to continue" button opens. Omit to drop the button —
247
295
  * but only if the app genuinely has no sign-in, because the notice it pairs
248
296
  * with is usually "sign in to join a plan" and would otherwise dead-end. */
@@ -18,6 +18,21 @@ export interface EventRow {
18
18
  noImage: boolean;
19
19
  detailScreenId: string;
20
20
  }
21
+ /** The display copy a card shows. Keys are the runtime copy-catalog keys (`$t:` / `@himalaya/l10n`). */
22
+ export interface EventLabels {
23
+ "events.past": string;
24
+ "events.dateTba": string;
25
+ "events.locationTba": string;
26
+ "events.untitled": string;
27
+ }
28
+ /** Generated English defaults — the last stop before the key itself. */
29
+ export declare const EVENT_LABEL_DEFAULTS: Readonly<EventLabels>;
30
+ export interface EventDisplayOptions {
31
+ /** BCP-47 tag. Defaults to the app's `@himalaya/l10n` `locale()`, else "en". */
32
+ locale?: string;
33
+ /** Per-key copy overrides; beat the served catalog and the English default. */
34
+ labels?: Partial<EventLabels>;
35
+ }
21
36
  export declare function titleCase(value?: string): string;
22
37
  export declare function startDateOf(e: WixEvent): string | undefined;
23
38
  export declare function endDateOf(e: WixEvent): string | undefined;
@@ -30,15 +45,16 @@ export declare function endDateOf(e: WixEvent): string | undefined;
30
45
  * `WIX_DETAIL_IMAGE` for a full-bleed hero.
31
46
  */
32
47
  export declare function eventImage(e: WixEvent, size?: WixImageSize | null): string;
33
- export declare function eventLocation(e: WixEvent): string;
48
+ export declare function eventLocation(e: WixEvent, options?: EventDisplayOptions): string;
34
49
  export declare function eventAddress(e: WixEvent): string;
35
50
  export declare function eventMapUrl(e: WixEvent): string;
36
51
  export declare function eventStartMillis(e: WixEvent): number | undefined;
37
52
  export declare function eventEndMillis(e: WixEvent): number | undefined;
38
53
  /** The event's date line. The year is written only when it is not the current year, so a
39
54
  * past-year event can no longer pass for an upcoming one ("Sat, Jul 18"). `now` is injectable
40
- * for tests; it defaults to the wall clock. */
41
- export declare function eventWhen(e: WixEvent, now?: number): string;
55
+ * for tests; it defaults to the wall clock. Under a non-English locale with ECMA-402 the date and
56
+ * time come from one locale-ordered formatter, so the English " at " never leaks in. */
57
+ export declare function eventWhen(e: WixEvent, now?: number, options?: EventDisplayOptions): string;
42
58
  /** Has the event finished? Its end when it has one, else its start. */
43
59
  export declare function eventIsPast(e: WixEvent, now?: number): boolean;
44
60
  /** One-argument on purpose: callers write `.map(normalizeEvent)`, which would pass the array
@@ -46,5 +62,5 @@ export declare function eventIsPast(e: WixEvent, now?: number): boolean;
46
62
  export declare function normalizeEvent(e: WixEvent): EventRow;
47
63
  /** {@link normalizeEvent} against an explicit clock (epoch ms): `now` decides whether the date
48
64
  * line carries the year and whether `statusLabel` reads "Past". Pure — no API call, any scope. */
49
- export declare function normalizeEventAt(e: WixEvent, now: number): EventRow;
65
+ export declare function normalizeEventAt(e: WixEvent, now: number, options?: EventDisplayOptions): EventRow;
50
66
  export declare function eventDescription(e: WixEvent): string;
@@ -195,9 +195,18 @@ export declare function productImage(p: StoreProduct, size?: WixImageSize | null
195
195
  * `WIX_DETAIL_IMAGE` for a full-bleed pager, or `null` for the stored originals.
196
196
  */
197
197
  export declare function productGallery(p: StoreProduct, size?: WixImageSize | null): string[];
198
+ /** Display options for the price helpers. Prices carry no copy, so there are no labels to override. */
199
+ export interface StoreDisplayOptions {
200
+ /** BCP-47 tag; callers pass their app locale. Defaults to "en". */
201
+ locale?: string;
202
+ }
203
+ /** Format a raw amount with a currency when one is known. Prefers a real symbol via
204
+ * Intl; falls back to the bare amount when the catalog exposes no currency (e.g. a
205
+ * visitor querying a store that only returns `amount`). */
206
+ export declare function formatMoney(amount: string | number, currency: string, options?: StoreDisplayOptions): string;
198
207
  /** Formats Wix-provided price text consistently for display. A recognized symbol after an
199
208
  * English-style number moves before the amount; locale-specific decimal and grouping formats
200
209
  * remain unchanged. */
201
210
  export declare function normalizeFormattedPrice(formatted: string): string;
202
- export declare function productPrice(p: StoreProduct): string;
211
+ export declare function productPrice(p: StoreProduct, options?: StoreDisplayOptions): string;
203
212
  export declare function plainText(value?: string): string;