@wix/himalaya-cli 0.1951.0 → 0.1953.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1953.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"artifactId": "himalaya-cli"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
"falconPackageHash": "
|
|
85
|
+
"falconPackageHash": "e094af83d4a9be249de286a7611ce03f74efd7124dd0646eb65ebd91"
|
|
86
86
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_recipe": "Plan cards (name, pitch, price, validity, details button, the whole benefits list). Service: registerPlansSection(svc,{planIds,showBenefits}).",
|
|
2
|
+
"_recipe": "Plan cards (name, pitch, price, cadence, validity, details button, the whole benefits list). Service: registerPlansSection(svc,{planIds,showBenefits}).",
|
|
3
3
|
"_placeholders": {
|
|
4
4
|
"svc": "service name the page worker registered with registerPlansSection",
|
|
5
5
|
"id": "unique node id prefix (e.g. the screen id)",
|
|
@@ -120,6 +120,23 @@
|
|
|
120
120
|
"modifiers": {
|
|
121
121
|
"hiddenPath": "$item.noPeriod"
|
|
122
122
|
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "",
|
|
126
|
+
"body": {
|
|
127
|
+
"package": "himalaya",
|
|
128
|
+
"type": "Text",
|
|
129
|
+
"props": {
|
|
130
|
+
"text": "$item.validityLine",
|
|
131
|
+
"style": "footnote",
|
|
132
|
+
"color": "textSecondary",
|
|
133
|
+
"maxLines": 2,
|
|
134
|
+
"collapseWhenEmpty": true
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"modifiers": {
|
|
138
|
+
"hiddenPath": "$item.noValidity"
|
|
139
|
+
}
|
|
123
140
|
}
|
|
124
141
|
]
|
|
125
142
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
// What a pricing plan says about itself, in the viewer's language: the
|
|
2
|
-
// plan-detail facts (terms, cancellation, purchase limit, start date).
|
|
3
|
-
//
|
|
1
|
+
// What a pricing plan says about itself, in the viewer's language: the billing cadence line, the validity line and the
|
|
2
|
+
// plan-detail facts (terms, cancellation, purchase limit, start date). The inline plans section (plans-section.ts) reads
|
|
3
|
+
// it; the plans list and detail worker (himi-branded-lite-plans) still has its own period() and planDuration wording.
|
|
4
4
|
//
|
|
5
5
|
// Each duration phrase is ONE plural key per unit, so a translation fits the whole phrase ("por 10 años") instead of
|
|
6
|
-
// gluing translated words around English ones. Its English fallback is the wording the workers always had.
|
|
6
|
+
// gluing translated words around English ones. Its English fallback is the wording the workers always had. The cadence
|
|
7
|
+
// ("one-time", "per month") and the validity ("for 10 years", "Unlimited duration") are separate lines: "one-time" says
|
|
8
|
+
// how the plan is paid, never how long it lasts.
|
|
7
9
|
import type { WixPlan } from "@himalaya/wix-pricing-plans";
|
|
8
10
|
import { copyParam, copyPlural, copyTemplate } from "./himi-copy.js";
|
|
9
11
|
|
|
@@ -31,7 +33,7 @@ function singularUnit(unit?: string): string {
|
|
|
31
33
|
return (unit || "").toLowerCase().replace(/s$/, "");
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
/** "for 10 years" — a
|
|
36
|
+
/** "for 10 years" — how long a plan with a fixed span lasts. */
|
|
35
37
|
function validFor(count: number, unit: string): string {
|
|
36
38
|
const known = UNITS.find((candidate) => candidate === unit);
|
|
37
39
|
if (!known) return `for ${count} ${unit}${count === 1 ? "" : "s"}`;
|
|
@@ -45,23 +47,37 @@ export function every(count: number, unit: string): string {
|
|
|
45
47
|
return copyPlural(`plans.every${unitKey(known)}`, EVERY[known], count);
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
/**
|
|
50
|
+
/** How the plan is paid, under its price: "per month" / "every 3 months" for a subscription, "one-time" for a single
|
|
51
|
+
* payment; "" when the plan names neither. How long access lasts is `planValidityLine`, never this line. */
|
|
49
52
|
export function planPeriodLine(plan: WixPlan): string {
|
|
50
53
|
const pricing = plan.pricing;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
// A single payment wins over a stray `subscription` stub: the pricing kinds are exclusive, and "recurring" beside
|
|
55
|
+
// "Unlimited duration" would contradict itself.
|
|
56
|
+
if (pricing?.singlePaymentForDuration || pricing?.singlePaymentUnlimited) return copyParam("plans.oneTimeFact", "one-time");
|
|
57
|
+
if (pricing?.subscription) {
|
|
58
|
+
const count = pricing.subscription.cycleDuration?.count ?? 0;
|
|
59
|
+
const unit = singularUnit(pricing.subscription.cycleDuration?.unit);
|
|
54
60
|
return count && unit ? every(count, unit) : copyParam("plans.periodRecurring", "recurring");
|
|
55
61
|
}
|
|
56
|
-
if (pricing?.singlePaymentForDuration) {
|
|
57
|
-
const count = pricing.singlePaymentForDuration.count ?? 0;
|
|
58
|
-
const unit = singularUnit(pricing.singlePaymentForDuration.unit);
|
|
59
|
-
return count && unit ? validFor(count, unit) : copyParam("plans.oneTimeFact", "one-time");
|
|
60
|
-
}
|
|
61
|
-
if (pricing?.singlePaymentUnlimited) return copyParam("plans.oneTimeFact", "one-time");
|
|
62
62
|
return "";
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/** How long the plan's access lasts: "Unlimited duration" (paid once, never ends), "Until canceled" (renews with no end),
|
|
66
|
+
* "for 10 years" (a fixed span, or a subscription's cycles × cycle length); "" when the plan does not say. The open-ended
|
|
67
|
+
* wording is the plans screen's (`planDuration`); a fixed span keeps the per-unit plural keys. */
|
|
68
|
+
export function planValidityLine(plan: WixPlan): string {
|
|
69
|
+
const pricing = plan.pricing;
|
|
70
|
+
if (pricing?.singlePaymentUnlimited) return copyParam("plans.unlimited", "Unlimited duration");
|
|
71
|
+
const single = pricing?.singlePaymentForDuration;
|
|
72
|
+
const cycle = single ? undefined : pricing?.subscription;
|
|
73
|
+
if (cycle && !cycle.cycleCount) return copyParam("plans.untilCanceled", "Until canceled");
|
|
74
|
+
const span = cycle ? cycle.cycleDuration : single;
|
|
75
|
+
const count = (span?.count ?? 0) * (cycle ? cycle.cycleCount ?? 0 : 1);
|
|
76
|
+
// Only a unit the plural keys know: an unknown one ("UNDEFINED", a future enum value) is never spelled out in English.
|
|
77
|
+
const unit = UNITS.find((known) => known === singularUnit(span?.unit));
|
|
78
|
+
return count && unit ? validFor(count, unit) : "";
|
|
79
|
+
}
|
|
80
|
+
|
|
65
81
|
export interface PlanFacts {
|
|
66
82
|
/** The owner's terms and conditions; collapses when the plan has none. */
|
|
67
83
|
terms: string; noTerms: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The INLINE plans section: the site's pricing plans as cards (name, pitch, price, validity, the whole benefits list), hosted by
|
|
1
|
+
// The INLINE plans section: the site's pricing plans as cards (name, pitch, price, cadence, validity, the whole benefits list), hosted by
|
|
2
2
|
// any worker that wants them next to other sections. It is data only and read-only: a card opens the plan's own screen
|
|
3
3
|
// (`himi_plan`), which is where joining and paying live. The `plans-card` recipe is the card that reads it,
|
|
4
4
|
// bound as `$service:<serviceName>.*`.
|
|
@@ -7,7 +7,7 @@ import { listPublicPlans, type WixPlan } from "@himalaya/wix-pricing-plans";
|
|
|
7
7
|
import { descriptionBody } from "./rich-body.js";
|
|
8
8
|
import { formatCurrency } from "./engine-intl.js";
|
|
9
9
|
import { copyParam, stashCopy } from "./himi-copy.js";
|
|
10
|
-
import { planPeriodLine } from "./plan-facts.js";
|
|
10
|
+
import { planPeriodLine, planValidityLine } from "./plan-facts.js";
|
|
11
11
|
|
|
12
12
|
/** The recipe binds `perk1…perkN`, so the list has a fixed ceiling. */
|
|
13
13
|
export const PLANS_SECTION_MAX_PERKS = 12;
|
|
@@ -26,7 +26,10 @@ export interface PlansSectionRow {
|
|
|
26
26
|
name: string;
|
|
27
27
|
description: string; noDescription: boolean;
|
|
28
28
|
priceLine: string; noPrice: boolean;
|
|
29
|
+
/** How the plan is paid ("per month", "one-time"). */
|
|
29
30
|
periodLine: string; noPeriod: boolean;
|
|
31
|
+
/** How long access lasts ("Unlimited duration", "for 10 years"), apart from the cadence. */
|
|
32
|
+
validityLine: string; noValidity: boolean;
|
|
30
33
|
badge: string; noBadge: boolean;
|
|
31
34
|
perks: string[];
|
|
32
35
|
[perk: `perk${number}`]: string;
|
|
@@ -55,10 +58,11 @@ export function plansSectionRow(plan: WixPlan, showBenefits = true): PlansSectio
|
|
|
55
58
|
const description = descriptionBody(plan.description).bodyText;
|
|
56
59
|
const priceLine = money(plan);
|
|
57
60
|
const periodLine = planPeriodLine(plan);
|
|
61
|
+
const validityLine = planValidityLine(plan);
|
|
58
62
|
const badge = plan.primary ? copyParam("plans.popularBadge", "Popular") : "";
|
|
59
63
|
return {
|
|
60
64
|
id: plan.id || "", name: (plan.name || copyParam("plans.planFallbackName", "Plan")).trim(),
|
|
61
|
-
description, noDescription: !description, priceLine, noPrice: !priceLine, periodLine, noPeriod: !periodLine, badge, noBadge: !badge, perks,
|
|
65
|
+
description, noDescription: !description, priceLine, noPrice: !priceLine, periodLine, noPeriod: !periodLine, validityLine, noValidity: !validityLine, badge, noBadge: !badge, perks,
|
|
62
66
|
...planPerkFields(perks),
|
|
63
67
|
};
|
|
64
68
|
}
|