@wix/himalaya-cli 0.1830.0 → 0.1832.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/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +6 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +6 -2
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{990204a4cb9e61e96206131bbaeb9401543753fd5301735b5029eb6906921329.bin → 70836790496f742deee3b0e0c83394af3b9fc275d091c6497786d90201392cf4.bin} +1 -1
- package/dist/browser-plane/sw.js +8 -8
- package/dist/cli.mjs +1251 -1074
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/designing-himi-screens.md +46 -18
- package/guides/getting-started.md +1 -1
- package/guides/himi-skill.md +1 -1
- package/guides/index.json +6 -0
- package/guides/skill.md +1 -0
- package/guides/web-ux.md +134 -0
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +4 -0
- package/templates/beauty-salon/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +1 -1
- package/templates/beauty-salon/tier5-src/himi-branded-lite-plans/index.ts +4 -1
- package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +5 -2
- package/templates/branded-lite/dev/index.ts +7 -0
- package/templates/branded-lite/tier5-src/_shared/blog-list.ts +3 -0
- package/templates/branded-lite/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +1 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-plans/index.ts +4 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +5 -2
- package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +4 -4
- package/templates/branded-lite/tier5-src/himi-store-product/index.ts +5 -2
- package/templates/community-club/dev/index.ts +1 -0
- package/templates/community-club/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/conference/dev/index.ts +2 -0
- package/templates/conference/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/events-meetups/dev/index.ts +1 -0
- package/templates/events-meetups/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/fitness-gym/dev/index.ts +2 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/fitness-gym/tier5-src/himi-booking-time/index.ts +1 -1
- package/templates/fitness-gym/tier5-src/himi-branded-lite-plans/index.ts +4 -1
- package/templates/fitness-gym/tier5-src/himi-branded-lite-program/index.ts +5 -2
- package/templates/gym-fitness/dev/index.ts +5 -0
- package/templates/gym-fitness/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +1 -1
- package/templates/gym-fitness/tier5-src/himi-branded-lite-plans/index.ts +4 -1
- package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +5 -2
- package/templates/medical-services/dev/index.ts +2 -0
- package/templates/medical-services/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/medical-services/tier5-src/himi-booking-time/index.ts +1 -1
- package/templates/nonprofit-cause/dev/index.ts +2 -0
- package/templates/nonprofit-cause/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-plans/index.ts +4 -1
- package/templates/personal-fitness-trainer/dev/index.ts +4 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-time/index.ts +1 -1
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-plans/index.ts +4 -1
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-video/index.ts +4 -4
- package/templates/podcast-creator/dev/index.ts +2 -0
- package/templates/podcast-creator/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/podcast-creator/tier5-src/himi-branded-lite-plans/index.ts +4 -1
- package/templates/portfolio-creative/dev/index.ts +2 -0
- package/templates/portfolio-creative/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +5 -2
- package/templates/restaurant/dev/index.ts +1 -0
- package/templates/restaurant/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/retail-store/dev/index.ts +1 -0
- package/templates/retail-store/tier5-src/himi-store-product/index.ts +5 -2
- package/templates/salon-spa/dev/index.ts +2 -0
- package/templates/salon-spa/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/salon-spa/tier5-src/himi-booking-time/index.ts +1 -1
- package/templates/wholesale-store/dev/index.ts +1 -0
- package/templates/wholesale-store/tier5-src/himi-store-product/index.ts +5 -2
- package/templates/yoga-studio/dev/index.ts +5 -0
- package/templates/yoga-studio/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
- package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +1 -1
- package/templates/yoga-studio/tier5-src/himi-branded-lite-plans/index.ts +4 -1
- package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +5 -2
|
@@ -40,6 +40,8 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
40
40
|
let platform = "unknown";
|
|
41
41
|
let started = false;
|
|
42
42
|
let inFlight = false;
|
|
43
|
+
/** The ticket or time `buy` is selling, so a different selection never shows its spinner. */
|
|
44
|
+
let inFlightTarget = "";
|
|
43
45
|
let formError = "";
|
|
44
46
|
let sequence = 0;
|
|
45
47
|
let formRevision = 0;
|
|
@@ -106,7 +108,23 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
106
108
|
if (!retained) initialize(form);
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
/** Whether the Buy for `target` (the selected ticket or time) shows the spinner: while this worker's
|
|
112
|
+
* `buy` runs, only for its target; otherwise whenever the shared checkout is busy, unless the sale is
|
|
113
|
+
* known to be another target's. A restarted worker knows none, so it follows the checkout. */
|
|
114
|
+
function busyFor(target: string | undefined, purchaseBusy: boolean, state: ReturnType<typeof commerce.state>): boolean {
|
|
115
|
+
if (target === undefined) return purchaseBusy || inFlight;
|
|
116
|
+
if (inFlight) return inFlightTarget === target;
|
|
117
|
+
if (!purchaseBusy || !reference) return purchaseBusy;
|
|
118
|
+
const anotherTarget = (item: string) => [...attempts].some(([known, attempt]) => known !== target && item.endsWith(`#${encodeURIComponent(attempt)}`));
|
|
119
|
+
const prefix = `${reference.kind}:${reference.id}#`;
|
|
120
|
+
const processing = state.payments.filter((p) => p.access === "processing");
|
|
121
|
+
if (processing.some((p) => p.item.startsWith(prefix) && !anotherTarget(p.item))) return true;
|
|
122
|
+
if (state.item !== null) return !anotherTarget(state.item);
|
|
123
|
+
// No item: a recovered sale. It may be this one unless its payments all name other tickets or times.
|
|
124
|
+
return processing.length === 0 || processing.some((p) => p.item === "payment");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function fields(selected = true, publishPoll = true, selectionKey?: string): AttendancePurchaseFields {
|
|
110
128
|
syncSession();
|
|
111
129
|
if (!reference || !metadata) return ATTENDANCE_INITIAL;
|
|
112
130
|
const currency = metadata.currency ?? "";
|
|
@@ -137,7 +155,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
137
155
|
else if (apple && own && state.phase === "cancelled") note = copyParam(`${prefix}.purchaseCancelledText`, "Purchase cancelled. Your place is not confirmed.");
|
|
138
156
|
return {
|
|
139
157
|
iapBuyHidden: !apple, iapBuyDisabled: !enabled || !selected || !member || !form.supported() || purchase.buyDisabled || inFlight,
|
|
140
|
-
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: purchase.buyBusy
|
|
158
|
+
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: busyFor(selectionKey !== undefined ? `${reference.kind}:${reference.id}:${selectionKey}` : options.kind === "eventsTicket" ? `${reference.kind}:${reference.id}:${reference.id}` : undefined, purchase.buyBusy, state),
|
|
141
159
|
iapPrice: apple ? price.priceText : "", iapRetryHidden: !apple || (price.hidePriceRetry && commerce.scopeComplete()),
|
|
142
160
|
iapNote: note,
|
|
143
161
|
iapFormHidden: !apple || !selected || !form.supported(), iapFormError: formError,
|
|
@@ -173,6 +191,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
173
191
|
...(options.kind === "bookingsService" ? { booking: { slot: selection.slot ?? {}, contactDetails: form.buyer() } } : { ticket: { eventId: selection.eventId ?? "", ...form.ticket(ref.id) } }),
|
|
174
192
|
} };
|
|
175
193
|
inFlight = true;
|
|
194
|
+
inFlightTarget = target;
|
|
176
195
|
formError = "";
|
|
177
196
|
options.onChange();
|
|
178
197
|
try {
|
|
@@ -733,7 +733,7 @@ function derive(input: S): S {
|
|
|
733
733
|
message: regular && !regularCheckoutAllowed && s.message === copyParam("time.purchaseUnavailable", "Purchasing is temporarily unavailable.") ? "" : s.message,
|
|
734
734
|
hasSlots,
|
|
735
735
|
// A waitlist pick or a course is not an in-app purchase: neither enables the Apple button.
|
|
736
|
-
...applePurchase.fields(hasSelected && !selectedWaitlist && !s.isCourse),
|
|
736
|
+
...applePurchase.fields(hasSelected && !selectedWaitlist && !s.isCourse, true, s.selectedSlotId),
|
|
737
737
|
hasSelected,
|
|
738
738
|
noSelected: !hasSelected,
|
|
739
739
|
// The shared sign-in card: no sign-in for a course this screen cannot sell (as below).
|
|
@@ -12427,6 +12427,7 @@ const SCREENS = runtimeSetting({
|
|
|
12427
12427
|
"title": "$service:himiBrandedPlans.detail.joinLabel",
|
|
12428
12428
|
"style": "primary",
|
|
12429
12429
|
"disabledPath": "$service:himiBrandedPlans.detail.joinDisabled",
|
|
12430
|
+
"loadingPath": "$service:himiBrandedPlans.detail.joinBusy",
|
|
12430
12431
|
"action": {
|
|
12431
12432
|
"actionId": "tier5.himiBrandedPlans.join"
|
|
12432
12433
|
}
|
|
@@ -26701,6 +26702,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
26701
26702
|
"props": {
|
|
26702
26703
|
"title": "$service:himiEventDetail.iapBuyLabel",
|
|
26703
26704
|
"disabledPath": "$service:himiEventDetail.iapBuyDisabled",
|
|
26705
|
+
"loadingPath": "$service:himiEventDetail.iapBusy",
|
|
26704
26706
|
"style": "primary",
|
|
26705
26707
|
"fullWidth": true,
|
|
26706
26708
|
"action": {
|
|
@@ -40,6 +40,8 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
40
40
|
let platform = "unknown";
|
|
41
41
|
let started = false;
|
|
42
42
|
let inFlight = false;
|
|
43
|
+
/** The ticket or time `buy` is selling, so a different selection never shows its spinner. */
|
|
44
|
+
let inFlightTarget = "";
|
|
43
45
|
let formError = "";
|
|
44
46
|
let sequence = 0;
|
|
45
47
|
let formRevision = 0;
|
|
@@ -106,7 +108,23 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
106
108
|
if (!retained) initialize(form);
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
/** Whether the Buy for `target` (the selected ticket or time) shows the spinner: while this worker's
|
|
112
|
+
* `buy` runs, only for its target; otherwise whenever the shared checkout is busy, unless the sale is
|
|
113
|
+
* known to be another target's. A restarted worker knows none, so it follows the checkout. */
|
|
114
|
+
function busyFor(target: string | undefined, purchaseBusy: boolean, state: ReturnType<typeof commerce.state>): boolean {
|
|
115
|
+
if (target === undefined) return purchaseBusy || inFlight;
|
|
116
|
+
if (inFlight) return inFlightTarget === target;
|
|
117
|
+
if (!purchaseBusy || !reference) return purchaseBusy;
|
|
118
|
+
const anotherTarget = (item: string) => [...attempts].some(([known, attempt]) => known !== target && item.endsWith(`#${encodeURIComponent(attempt)}`));
|
|
119
|
+
const prefix = `${reference.kind}:${reference.id}#`;
|
|
120
|
+
const processing = state.payments.filter((p) => p.access === "processing");
|
|
121
|
+
if (processing.some((p) => p.item.startsWith(prefix) && !anotherTarget(p.item))) return true;
|
|
122
|
+
if (state.item !== null) return !anotherTarget(state.item);
|
|
123
|
+
// No item: a recovered sale. It may be this one unless its payments all name other tickets or times.
|
|
124
|
+
return processing.length === 0 || processing.some((p) => p.item === "payment");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function fields(selected = true, publishPoll = true, selectionKey?: string): AttendancePurchaseFields {
|
|
110
128
|
syncSession();
|
|
111
129
|
if (!reference || !metadata) return ATTENDANCE_INITIAL;
|
|
112
130
|
const currency = metadata.currency ?? "";
|
|
@@ -137,7 +155,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
137
155
|
else if (apple && own && state.phase === "cancelled") note = copyParam(`${prefix}.purchaseCancelledText`, "Purchase cancelled. Your place is not confirmed.");
|
|
138
156
|
return {
|
|
139
157
|
iapBuyHidden: !apple, iapBuyDisabled: !enabled || !selected || !member || !form.supported() || purchase.buyDisabled || inFlight,
|
|
140
|
-
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: purchase.buyBusy
|
|
158
|
+
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: busyFor(selectionKey !== undefined ? `${reference.kind}:${reference.id}:${selectionKey}` : options.kind === "eventsTicket" ? `${reference.kind}:${reference.id}:${reference.id}` : undefined, purchase.buyBusy, state),
|
|
141
159
|
iapPrice: apple ? price.priceText : "", iapRetryHidden: !apple || (price.hidePriceRetry && commerce.scopeComplete()),
|
|
142
160
|
iapNote: note,
|
|
143
161
|
iapFormHidden: !apple || !selected || !form.supported(), iapFormError: formError,
|
|
@@ -173,6 +191,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
173
191
|
...(options.kind === "bookingsService" ? { booking: { slot: selection.slot ?? {}, contactDetails: form.buyer() } } : { ticket: { eventId: selection.eventId ?? "", ...form.ticket(ref.id) } }),
|
|
174
192
|
} };
|
|
175
193
|
inFlight = true;
|
|
194
|
+
inFlightTarget = target;
|
|
176
195
|
formError = "";
|
|
177
196
|
options.onChange();
|
|
178
197
|
try {
|
|
@@ -71,6 +71,8 @@ interface PlanRow {
|
|
|
71
71
|
applePeriod: string;
|
|
72
72
|
joinLabel: string;
|
|
73
73
|
joinDisabled: boolean;
|
|
74
|
+
/** An App Store sale of this plan is under way: Join shows its spinner. */
|
|
75
|
+
joinBusy: boolean;
|
|
74
76
|
joinNote: string;
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -183,7 +185,7 @@ function planRow(plan: WixPlan): PlanRow {
|
|
|
183
185
|
free: isFreePlan(plan),
|
|
184
186
|
appleSupported: isAppleSellablePlan(plan.pricing),
|
|
185
187
|
applePeriod: applePlanPeriod(plan.pricing),
|
|
186
|
-
joined: false, joinLabel: copyParam("plans.joinCta", "Continue"), joinDisabled: true, joinNote: "",
|
|
188
|
+
joined: false, joinLabel: copyParam("plans.joinCta", "Continue"), joinDisabled: true, joinBusy: false, joinNote: "",
|
|
187
189
|
};
|
|
188
190
|
}
|
|
189
191
|
|
|
@@ -258,6 +260,7 @@ function pricedState(state: State): State {
|
|
|
258
260
|
joined,
|
|
259
261
|
joinLabel: joined ? copyParam("plans.joinedLabel", "Current plan") : apple ? purchase.buyLabel : row.joinLabel,
|
|
260
262
|
joinDisabled: joined || (apple ? purchase.buyDisabled || !appleOffered(row, view) : price.actionDisabled || !regularReady) || joining.has(row.id),
|
|
263
|
+
joinBusy: apple && purchase.buyBusy,
|
|
261
264
|
joinNote: apple ? appleOffered(row, view) ? purchase.buyNote : iapPriceCopy("plans").purchaseUnavailable : price.actionNote };
|
|
262
265
|
});
|
|
263
266
|
const detail = priced.find(row => row.id === detailInputId()) ?? null;
|
|
@@ -7895,6 +7895,7 @@ const SCREENS = runtimeSetting({
|
|
|
7895
7895
|
"title": "$service:himiBrandedPlans.detail.joinLabel",
|
|
7896
7896
|
"style": "primary",
|
|
7897
7897
|
"disabledPath": "$service:himiBrandedPlans.detail.joinDisabled",
|
|
7898
|
+
"loadingPath": "$service:himiBrandedPlans.detail.joinBusy",
|
|
7898
7899
|
"action": {
|
|
7899
7900
|
"actionId": "tier5.himiBrandedPlans.join"
|
|
7900
7901
|
}
|
|
@@ -19589,6 +19590,7 @@ const SCREENS = runtimeSetting({
|
|
|
19589
19590
|
"style": "primary",
|
|
19590
19591
|
"fullWidth": true,
|
|
19591
19592
|
"disabledPath": "$service:himiBrandedVideo.buyDisabled",
|
|
19593
|
+
"loadingPath": "$service:himiBrandedVideo.buyBusy",
|
|
19592
19594
|
"action": {
|
|
19593
19595
|
"actionId": "tier5.himiBrandedVideo.buy"
|
|
19594
19596
|
}
|
|
@@ -25964,6 +25966,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
25964
25966
|
"props": {
|
|
25965
25967
|
"title": "$service:himiBookingTime.iapBuyLabel",
|
|
25966
25968
|
"disabledPath": "$service:himiBookingTime.iapBuyDisabled",
|
|
25969
|
+
"loadingPath": "$service:himiBookingTime.iapBusy",
|
|
25967
25970
|
"style": "primary",
|
|
25968
25971
|
"fullWidth": true,
|
|
25969
25972
|
"action": {
|
|
@@ -26885,6 +26888,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
26885
26888
|
"props": {
|
|
26886
26889
|
"title": "$service:himiBookingTime.iapBuyLabel",
|
|
26887
26890
|
"disabledPath": "$service:himiBookingTime.iapBuyDisabled",
|
|
26891
|
+
"loadingPath": "$service:himiBookingTime.iapBusy",
|
|
26888
26892
|
"style": "primary",
|
|
26889
26893
|
"fullWidth": true,
|
|
26890
26894
|
"action": {
|
|
@@ -40,6 +40,8 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
40
40
|
let platform = "unknown";
|
|
41
41
|
let started = false;
|
|
42
42
|
let inFlight = false;
|
|
43
|
+
/** The ticket or time `buy` is selling, so a different selection never shows its spinner. */
|
|
44
|
+
let inFlightTarget = "";
|
|
43
45
|
let formError = "";
|
|
44
46
|
let sequence = 0;
|
|
45
47
|
let formRevision = 0;
|
|
@@ -106,7 +108,23 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
106
108
|
if (!retained) initialize(form);
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
/** Whether the Buy for `target` (the selected ticket or time) shows the spinner: while this worker's
|
|
112
|
+
* `buy` runs, only for its target; otherwise whenever the shared checkout is busy, unless the sale is
|
|
113
|
+
* known to be another target's. A restarted worker knows none, so it follows the checkout. */
|
|
114
|
+
function busyFor(target: string | undefined, purchaseBusy: boolean, state: ReturnType<typeof commerce.state>): boolean {
|
|
115
|
+
if (target === undefined) return purchaseBusy || inFlight;
|
|
116
|
+
if (inFlight) return inFlightTarget === target;
|
|
117
|
+
if (!purchaseBusy || !reference) return purchaseBusy;
|
|
118
|
+
const anotherTarget = (item: string) => [...attempts].some(([known, attempt]) => known !== target && item.endsWith(`#${encodeURIComponent(attempt)}`));
|
|
119
|
+
const prefix = `${reference.kind}:${reference.id}#`;
|
|
120
|
+
const processing = state.payments.filter((p) => p.access === "processing");
|
|
121
|
+
if (processing.some((p) => p.item.startsWith(prefix) && !anotherTarget(p.item))) return true;
|
|
122
|
+
if (state.item !== null) return !anotherTarget(state.item);
|
|
123
|
+
// No item: a recovered sale. It may be this one unless its payments all name other tickets or times.
|
|
124
|
+
return processing.length === 0 || processing.some((p) => p.item === "payment");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function fields(selected = true, publishPoll = true, selectionKey?: string): AttendancePurchaseFields {
|
|
110
128
|
syncSession();
|
|
111
129
|
if (!reference || !metadata) return ATTENDANCE_INITIAL;
|
|
112
130
|
const currency = metadata.currency ?? "";
|
|
@@ -137,7 +155,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
137
155
|
else if (apple && own && state.phase === "cancelled") note = copyParam(`${prefix}.purchaseCancelledText`, "Purchase cancelled. Your place is not confirmed.");
|
|
138
156
|
return {
|
|
139
157
|
iapBuyHidden: !apple, iapBuyDisabled: !enabled || !selected || !member || !form.supported() || purchase.buyDisabled || inFlight,
|
|
140
|
-
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: purchase.buyBusy
|
|
158
|
+
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: busyFor(selectionKey !== undefined ? `${reference.kind}:${reference.id}:${selectionKey}` : options.kind === "eventsTicket" ? `${reference.kind}:${reference.id}:${reference.id}` : undefined, purchase.buyBusy, state),
|
|
141
159
|
iapPrice: apple ? price.priceText : "", iapRetryHidden: !apple || (price.hidePriceRetry && commerce.scopeComplete()),
|
|
142
160
|
iapNote: note,
|
|
143
161
|
iapFormHidden: !apple || !selected || !form.supported(), iapFormError: formError,
|
|
@@ -173,6 +191,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
173
191
|
...(options.kind === "bookingsService" ? { booking: { slot: selection.slot ?? {}, contactDetails: form.buyer() } } : { ticket: { eventId: selection.eventId ?? "", ...form.ticket(ref.id) } }),
|
|
174
192
|
} };
|
|
175
193
|
inFlight = true;
|
|
194
|
+
inFlightTarget = target;
|
|
176
195
|
formError = "";
|
|
177
196
|
options.onChange();
|
|
178
197
|
try {
|
|
@@ -733,7 +733,7 @@ function derive(input: S): S {
|
|
|
733
733
|
message: regular && !regularCheckoutAllowed && s.message === copyParam("time.purchaseUnavailable", "Purchasing is temporarily unavailable.") ? "" : s.message,
|
|
734
734
|
hasSlots,
|
|
735
735
|
// A waitlist pick or a course is not an in-app purchase: neither enables the Apple button.
|
|
736
|
-
...applePurchase.fields(hasSelected && !selectedWaitlist && !s.isCourse),
|
|
736
|
+
...applePurchase.fields(hasSelected && !selectedWaitlist && !s.isCourse, true, s.selectedSlotId),
|
|
737
737
|
hasSelected,
|
|
738
738
|
noSelected: !hasSelected,
|
|
739
739
|
// The shared sign-in card: no sign-in for a course this screen cannot sell (as below).
|
|
@@ -71,6 +71,8 @@ interface PlanRow {
|
|
|
71
71
|
applePeriod: string;
|
|
72
72
|
joinLabel: string;
|
|
73
73
|
joinDisabled: boolean;
|
|
74
|
+
/** An App Store sale of this plan is under way: Join shows its spinner. */
|
|
75
|
+
joinBusy: boolean;
|
|
74
76
|
joinNote: string;
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -183,7 +185,7 @@ function planRow(plan: WixPlan): PlanRow {
|
|
|
183
185
|
free: isFreePlan(plan),
|
|
184
186
|
appleSupported: isAppleSellablePlan(plan.pricing),
|
|
185
187
|
applePeriod: applePlanPeriod(plan.pricing),
|
|
186
|
-
joined: false, joinLabel: copyParam("plans.joinCta", "Continue"), joinDisabled: true, joinNote: "",
|
|
188
|
+
joined: false, joinLabel: copyParam("plans.joinCta", "Continue"), joinDisabled: true, joinBusy: false, joinNote: "",
|
|
187
189
|
};
|
|
188
190
|
}
|
|
189
191
|
|
|
@@ -258,6 +260,7 @@ function pricedState(state: State): State {
|
|
|
258
260
|
joined,
|
|
259
261
|
joinLabel: joined ? copyParam("plans.joinedLabel", "Current plan") : apple ? purchase.buyLabel : row.joinLabel,
|
|
260
262
|
joinDisabled: joined || (apple ? purchase.buyDisabled || !appleOffered(row, view) : price.actionDisabled || !regularReady) || joining.has(row.id),
|
|
263
|
+
joinBusy: apple && purchase.buyBusy,
|
|
261
264
|
joinNote: apple ? appleOffered(row, view) ? purchase.buyNote : iapPriceCopy("plans").purchaseUnavailable : price.actionNote };
|
|
262
265
|
});
|
|
263
266
|
const detail = priced.find(row => row.id === detailInputId()) ?? null;
|
|
@@ -24,7 +24,7 @@ interface S extends LoadFlags {
|
|
|
24
24
|
/** This run's App Store price of the video, its loading/unavailable label, or "". */
|
|
25
25
|
priceText: string; priceNote: string; purchaseNote: string; hidePriceRetry: boolean;
|
|
26
26
|
/** The shared checkout's Buy (`commerce.purchaseFields`): shown only on the App Store route. */
|
|
27
|
-
buyHidden: boolean; buyLabel: string; buyDisabled: boolean; buyNote: string;
|
|
27
|
+
buyHidden: boolean; buyLabel: string; buyDisabled: boolean; buyBusy: boolean; buyNote: string;
|
|
28
28
|
}
|
|
29
29
|
const COPY = { prefix: "video", empty: "No videos in this channel yet.", error: "Videos couldn't be loaded.", signIn: "Sign in to watch videos.", sample: () => [] };
|
|
30
30
|
function input(key: string): string {
|
|
@@ -33,7 +33,7 @@ function input(key: string): string {
|
|
|
33
33
|
}
|
|
34
34
|
let generation = 0;
|
|
35
35
|
const initial: S = { ...LOADING, id: "", channelId: "", title: "", description: "", videos: [], items: [], hidePlayer: true, hideNotFound: true, noEntity: false, hideRefresh: false, emptyText: "", message: "", playbackState: "loading",
|
|
36
|
-
priceText: "", priceNote: "", purchaseNote: "", hidePriceRetry: true, buyHidden: true, buyLabel: "", buyDisabled: true, buyNote: "" };
|
|
36
|
+
priceText: "", priceNote: "", purchaseNote: "", hidePriceRetry: true, buyHidden: true, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
37
37
|
|
|
38
38
|
// ── App Store prices ─────
|
|
39
39
|
// One writer: `load` keeps what it read in `shown` and the priced items here; every repaint goes
|
|
@@ -54,7 +54,7 @@ let accessReload = { id: "", at: 0, attempts: 0, settled: false };
|
|
|
54
54
|
const ACCESS_RELOAD_RETRY_MS = 10_000;
|
|
55
55
|
const ACCESS_RELOAD_ATTEMPTS = 5;
|
|
56
56
|
const NOT_APPLE: IapPurchaseFields = { appleRoute: false, accessReady: false, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
57
|
-
const NO_BUY = { buyHidden: true, buyLabel: "", buyDisabled: true, buyNote: "" };
|
|
57
|
+
const NO_BUY = { buyHidden: true, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
58
58
|
|
|
59
59
|
async function priceContent(): Promise<void> {
|
|
60
60
|
const items = [...(detailItem ? [detailItem] : []), ...rowItems.flatMap((item) => item ?? [])];
|
|
@@ -85,7 +85,7 @@ function projected(state: S): S {
|
|
|
85
85
|
purchaseNote: purchase.appleRoute ? "" : fields.actionNote,
|
|
86
86
|
// An incomplete host scope (a failed app-identity read) reads as non-retryable; Retry re-reads it.
|
|
87
87
|
hidePriceRetry: fields.hidePriceRetry && commerce.scopeComplete(),
|
|
88
|
-
buyHidden: !purchase.appleRoute || purchase.accessReady, buyLabel: purchase.buyLabel, buyDisabled: purchase.buyDisabled, buyNote: purchase.buyNote };
|
|
88
|
+
buyHidden: !purchase.appleRoute || purchase.accessReady, buyLabel: purchase.buyLabel, buyDisabled: purchase.buyDisabled, buyBusy: purchase.buyBusy, buyNote: purchase.buyNote };
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/** A purchase being tracked polls faster; the directive is re-armed only when its interval changes. */
|
|
@@ -12365,6 +12365,7 @@ const SCREENS = runtimeSetting({
|
|
|
12365
12365
|
"title": "$service:himiBrandedPlans.detail.joinLabel",
|
|
12366
12366
|
"style": "primary",
|
|
12367
12367
|
"disabledPath": "$service:himiBrandedPlans.detail.joinDisabled",
|
|
12368
|
+
"loadingPath": "$service:himiBrandedPlans.detail.joinBusy",
|
|
12368
12369
|
"action": {
|
|
12369
12370
|
"actionId": "tier5.himiBrandedPlans.join"
|
|
12370
12371
|
}
|
|
@@ -26171,6 +26172,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
26171
26172
|
"props": {
|
|
26172
26173
|
"title": "$service:himiEventDetail.iapBuyLabel",
|
|
26173
26174
|
"disabledPath": "$service:himiEventDetail.iapBuyDisabled",
|
|
26175
|
+
"loadingPath": "$service:himiEventDetail.iapBusy",
|
|
26174
26176
|
"style": "primary",
|
|
26175
26177
|
"fullWidth": true,
|
|
26176
26178
|
"action": {
|
|
@@ -40,6 +40,8 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
40
40
|
let platform = "unknown";
|
|
41
41
|
let started = false;
|
|
42
42
|
let inFlight = false;
|
|
43
|
+
/** The ticket or time `buy` is selling, so a different selection never shows its spinner. */
|
|
44
|
+
let inFlightTarget = "";
|
|
43
45
|
let formError = "";
|
|
44
46
|
let sequence = 0;
|
|
45
47
|
let formRevision = 0;
|
|
@@ -106,7 +108,23 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
106
108
|
if (!retained) initialize(form);
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
/** Whether the Buy for `target` (the selected ticket or time) shows the spinner: while this worker's
|
|
112
|
+
* `buy` runs, only for its target; otherwise whenever the shared checkout is busy, unless the sale is
|
|
113
|
+
* known to be another target's. A restarted worker knows none, so it follows the checkout. */
|
|
114
|
+
function busyFor(target: string | undefined, purchaseBusy: boolean, state: ReturnType<typeof commerce.state>): boolean {
|
|
115
|
+
if (target === undefined) return purchaseBusy || inFlight;
|
|
116
|
+
if (inFlight) return inFlightTarget === target;
|
|
117
|
+
if (!purchaseBusy || !reference) return purchaseBusy;
|
|
118
|
+
const anotherTarget = (item: string) => [...attempts].some(([known, attempt]) => known !== target && item.endsWith(`#${encodeURIComponent(attempt)}`));
|
|
119
|
+
const prefix = `${reference.kind}:${reference.id}#`;
|
|
120
|
+
const processing = state.payments.filter((p) => p.access === "processing");
|
|
121
|
+
if (processing.some((p) => p.item.startsWith(prefix) && !anotherTarget(p.item))) return true;
|
|
122
|
+
if (state.item !== null) return !anotherTarget(state.item);
|
|
123
|
+
// No item: a recovered sale. It may be this one unless its payments all name other tickets or times.
|
|
124
|
+
return processing.length === 0 || processing.some((p) => p.item === "payment");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function fields(selected = true, publishPoll = true, selectionKey?: string): AttendancePurchaseFields {
|
|
110
128
|
syncSession();
|
|
111
129
|
if (!reference || !metadata) return ATTENDANCE_INITIAL;
|
|
112
130
|
const currency = metadata.currency ?? "";
|
|
@@ -137,7 +155,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
137
155
|
else if (apple && own && state.phase === "cancelled") note = copyParam(`${prefix}.purchaseCancelledText`, "Purchase cancelled. Your place is not confirmed.");
|
|
138
156
|
return {
|
|
139
157
|
iapBuyHidden: !apple, iapBuyDisabled: !enabled || !selected || !member || !form.supported() || purchase.buyDisabled || inFlight,
|
|
140
|
-
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: purchase.buyBusy
|
|
158
|
+
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: busyFor(selectionKey !== undefined ? `${reference.kind}:${reference.id}:${selectionKey}` : options.kind === "eventsTicket" ? `${reference.kind}:${reference.id}:${reference.id}` : undefined, purchase.buyBusy, state),
|
|
141
159
|
iapPrice: apple ? price.priceText : "", iapRetryHidden: !apple || (price.hidePriceRetry && commerce.scopeComplete()),
|
|
142
160
|
iapNote: note,
|
|
143
161
|
iapFormHidden: !apple || !selected || !form.supported(), iapFormError: formError,
|
|
@@ -173,6 +191,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
173
191
|
...(options.kind === "bookingsService" ? { booking: { slot: selection.slot ?? {}, contactDetails: form.buyer() } } : { ticket: { eventId: selection.eventId ?? "", ...form.ticket(ref.id) } }),
|
|
174
192
|
} };
|
|
175
193
|
inFlight = true;
|
|
194
|
+
inFlightTarget = target;
|
|
176
195
|
formError = "";
|
|
177
196
|
options.onChange();
|
|
178
197
|
try {
|
|
@@ -71,6 +71,8 @@ interface PlanRow {
|
|
|
71
71
|
applePeriod: string;
|
|
72
72
|
joinLabel: string;
|
|
73
73
|
joinDisabled: boolean;
|
|
74
|
+
/** An App Store sale of this plan is under way: Join shows its spinner. */
|
|
75
|
+
joinBusy: boolean;
|
|
74
76
|
joinNote: string;
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -183,7 +185,7 @@ function planRow(plan: WixPlan): PlanRow {
|
|
|
183
185
|
free: isFreePlan(plan),
|
|
184
186
|
appleSupported: isAppleSellablePlan(plan.pricing),
|
|
185
187
|
applePeriod: applePlanPeriod(plan.pricing),
|
|
186
|
-
joined: false, joinLabel: copyParam("plans.joinCta", "Continue"), joinDisabled: true, joinNote: "",
|
|
188
|
+
joined: false, joinLabel: copyParam("plans.joinCta", "Continue"), joinDisabled: true, joinBusy: false, joinNote: "",
|
|
187
189
|
};
|
|
188
190
|
}
|
|
189
191
|
|
|
@@ -258,6 +260,7 @@ function pricedState(state: State): State {
|
|
|
258
260
|
joined,
|
|
259
261
|
joinLabel: joined ? copyParam("plans.joinedLabel", "Current plan") : apple ? purchase.buyLabel : row.joinLabel,
|
|
260
262
|
joinDisabled: joined || (apple ? purchase.buyDisabled || !appleOffered(row, view) : price.actionDisabled || !regularReady) || joining.has(row.id),
|
|
263
|
+
joinBusy: apple && purchase.buyBusy,
|
|
261
264
|
joinNote: apple ? appleOffered(row, view) ? purchase.buyNote : iapPriceCopy("plans").purchaseUnavailable : price.actionNote };
|
|
262
265
|
});
|
|
263
266
|
const detail = priced.find(row => row.id === detailInputId()) ?? null;
|
|
@@ -33551,6 +33551,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
33551
33551
|
"style": "primary",
|
|
33552
33552
|
"fullWidth": true,
|
|
33553
33553
|
"disabledPath": "$service:himiStoreProduct.buyDisabled",
|
|
33554
|
+
"loadingPath": "$service:himiStoreProduct.buyBusy",
|
|
33554
33555
|
"action": {
|
|
33555
33556
|
"actionId": "tier5.himiStoreProduct.buy"
|
|
33556
33557
|
}
|
|
@@ -35913,6 +35914,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
35913
35914
|
"props": {
|
|
35914
35915
|
"title": "$service:himiEventDetail.iapBuyLabel",
|
|
35915
35916
|
"disabledPath": "$service:himiEventDetail.iapBuyDisabled",
|
|
35917
|
+
"loadingPath": "$service:himiEventDetail.iapBusy",
|
|
35916
35918
|
"style": "primary",
|
|
35917
35919
|
"fullWidth": true,
|
|
35918
35920
|
"action": {
|
|
@@ -40,6 +40,8 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
40
40
|
let platform = "unknown";
|
|
41
41
|
let started = false;
|
|
42
42
|
let inFlight = false;
|
|
43
|
+
/** The ticket or time `buy` is selling, so a different selection never shows its spinner. */
|
|
44
|
+
let inFlightTarget = "";
|
|
43
45
|
let formError = "";
|
|
44
46
|
let sequence = 0;
|
|
45
47
|
let formRevision = 0;
|
|
@@ -106,7 +108,23 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
106
108
|
if (!retained) initialize(form);
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
/** Whether the Buy for `target` (the selected ticket or time) shows the spinner: while this worker's
|
|
112
|
+
* `buy` runs, only for its target; otherwise whenever the shared checkout is busy, unless the sale is
|
|
113
|
+
* known to be another target's. A restarted worker knows none, so it follows the checkout. */
|
|
114
|
+
function busyFor(target: string | undefined, purchaseBusy: boolean, state: ReturnType<typeof commerce.state>): boolean {
|
|
115
|
+
if (target === undefined) return purchaseBusy || inFlight;
|
|
116
|
+
if (inFlight) return inFlightTarget === target;
|
|
117
|
+
if (!purchaseBusy || !reference) return purchaseBusy;
|
|
118
|
+
const anotherTarget = (item: string) => [...attempts].some(([known, attempt]) => known !== target && item.endsWith(`#${encodeURIComponent(attempt)}`));
|
|
119
|
+
const prefix = `${reference.kind}:${reference.id}#`;
|
|
120
|
+
const processing = state.payments.filter((p) => p.access === "processing");
|
|
121
|
+
if (processing.some((p) => p.item.startsWith(prefix) && !anotherTarget(p.item))) return true;
|
|
122
|
+
if (state.item !== null) return !anotherTarget(state.item);
|
|
123
|
+
// No item: a recovered sale. It may be this one unless its payments all name other tickets or times.
|
|
124
|
+
return processing.length === 0 || processing.some((p) => p.item === "payment");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function fields(selected = true, publishPoll = true, selectionKey?: string): AttendancePurchaseFields {
|
|
110
128
|
syncSession();
|
|
111
129
|
if (!reference || !metadata) return ATTENDANCE_INITIAL;
|
|
112
130
|
const currency = metadata.currency ?? "";
|
|
@@ -137,7 +155,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
137
155
|
else if (apple && own && state.phase === "cancelled") note = copyParam(`${prefix}.purchaseCancelledText`, "Purchase cancelled. Your place is not confirmed.");
|
|
138
156
|
return {
|
|
139
157
|
iapBuyHidden: !apple, iapBuyDisabled: !enabled || !selected || !member || !form.supported() || purchase.buyDisabled || inFlight,
|
|
140
|
-
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: purchase.buyBusy
|
|
158
|
+
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: busyFor(selectionKey !== undefined ? `${reference.kind}:${reference.id}:${selectionKey}` : options.kind === "eventsTicket" ? `${reference.kind}:${reference.id}:${reference.id}` : undefined, purchase.buyBusy, state),
|
|
141
159
|
iapPrice: apple ? price.priceText : "", iapRetryHidden: !apple || (price.hidePriceRetry && commerce.scopeComplete()),
|
|
142
160
|
iapNote: note,
|
|
143
161
|
iapFormHidden: !apple || !selected || !form.supported(), iapFormError: formError,
|
|
@@ -173,6 +191,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
173
191
|
...(options.kind === "bookingsService" ? { booking: { slot: selection.slot ?? {}, contactDetails: form.buyer() } } : { ticket: { eventId: selection.eventId ?? "", ...form.ticket(ref.id) } }),
|
|
174
192
|
} };
|
|
175
193
|
inFlight = true;
|
|
194
|
+
inFlightTarget = target;
|
|
176
195
|
formError = "";
|
|
177
196
|
options.onChange();
|
|
178
197
|
try {
|
|
@@ -331,6 +331,8 @@ interface S {
|
|
|
331
331
|
buyHidden: boolean;
|
|
332
332
|
buyLabel: string;
|
|
333
333
|
buyDisabled: boolean;
|
|
334
|
+
/** A sale is under way: the Buy button shows its spinner. */
|
|
335
|
+
buyBusy: boolean;
|
|
334
336
|
buyNote: string;
|
|
335
337
|
/** Shown once the eCom order reads paid, never on the payment's approval alone. */
|
|
336
338
|
purchasedNote: string;
|
|
@@ -477,7 +479,7 @@ const defineService = withIapPresentation<S>({
|
|
|
477
479
|
register: withOnlineWrites(registerState, ["beginAdd", "addToCart", "buy"], { derive, messageFields: action => action === "buy" ? ["buyNote"] : ["cartHint"] }),
|
|
478
480
|
adapters: [storesProductOrders],
|
|
479
481
|
onCreate: commerce => { productPricing = commerce; }, prefix: "product",
|
|
480
|
-
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "paintCached"], concurrentPublishActions: ["buy"],
|
|
482
|
+
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyBusy", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "paintCached"], concurrentPublishActions: ["buy"],
|
|
481
483
|
items: state => inputId() ? [{ reference: { kind: "storesProduct", id: inputId() }, commerceDisplayPrice: state.price }] : [],
|
|
482
484
|
present: (state, price, allowed, _appleIapOrResolving, resolving) => {
|
|
483
485
|
const purchase = applePurchase(state);
|
|
@@ -493,7 +495,7 @@ const defineService = withIapPresentation<S>({
|
|
|
493
495
|
...state, price: price(inputId()), ...(purchase.appleRoute ? { wasPrice: "", wasPriceEmpty: false, notOnSale: true } : {}), optionsIncomplete: productState.optionsIncomplete || !allowed(inputId()) || lastProduct?.productType?.toLowerCase() === "digital",
|
|
494
496
|
cartHint, noCartHint: !cartHint || state.added, addDisabled: productState.addDisabled || blocked || pending,
|
|
495
497
|
cartHidden: purchase.appleRoute,
|
|
496
|
-
buyHidden: !purchase.appleRoute || purchase.accessReady, buyLabel: purchase.buyLabel, buyDisabled: purchase.buyDisabled,
|
|
498
|
+
buyHidden: !purchase.appleRoute || purchase.accessReady, buyLabel: purchase.buyLabel, buyDisabled: purchase.buyDisabled, buyBusy: purchase.buyBusy,
|
|
497
499
|
buyNote: state.buyNote === offlineWriteMessage ? state.buyNote : purchase.buyNote,
|
|
498
500
|
purchasedNote: purchase.accessReady ? copyParam("product.purchasedText", "Purchased") : "",
|
|
499
501
|
};
|
|
@@ -620,6 +622,7 @@ const svc = defineService<S, {
|
|
|
620
622
|
buyHidden: true,
|
|
621
623
|
buyLabel: "",
|
|
622
624
|
buyDisabled: true,
|
|
625
|
+
buyBusy: false,
|
|
623
626
|
buyNote: "",
|
|
624
627
|
purchasedNote: "",
|
|
625
628
|
}),
|
|
@@ -26519,6 +26519,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
26519
26519
|
"props": {
|
|
26520
26520
|
"title": "$service:himiEventDetail.iapBuyLabel",
|
|
26521
26521
|
"disabledPath": "$service:himiEventDetail.iapBuyDisabled",
|
|
26522
|
+
"loadingPath": "$service:himiEventDetail.iapBusy",
|
|
26522
26523
|
"style": "primary",
|
|
26523
26524
|
"fullWidth": true,
|
|
26524
26525
|
"action": {
|
|
@@ -40,6 +40,8 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
40
40
|
let platform = "unknown";
|
|
41
41
|
let started = false;
|
|
42
42
|
let inFlight = false;
|
|
43
|
+
/** The ticket or time `buy` is selling, so a different selection never shows its spinner. */
|
|
44
|
+
let inFlightTarget = "";
|
|
43
45
|
let formError = "";
|
|
44
46
|
let sequence = 0;
|
|
45
47
|
let formRevision = 0;
|
|
@@ -106,7 +108,23 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
106
108
|
if (!retained) initialize(form);
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
/** Whether the Buy for `target` (the selected ticket or time) shows the spinner: while this worker's
|
|
112
|
+
* `buy` runs, only for its target; otherwise whenever the shared checkout is busy, unless the sale is
|
|
113
|
+
* known to be another target's. A restarted worker knows none, so it follows the checkout. */
|
|
114
|
+
function busyFor(target: string | undefined, purchaseBusy: boolean, state: ReturnType<typeof commerce.state>): boolean {
|
|
115
|
+
if (target === undefined) return purchaseBusy || inFlight;
|
|
116
|
+
if (inFlight) return inFlightTarget === target;
|
|
117
|
+
if (!purchaseBusy || !reference) return purchaseBusy;
|
|
118
|
+
const anotherTarget = (item: string) => [...attempts].some(([known, attempt]) => known !== target && item.endsWith(`#${encodeURIComponent(attempt)}`));
|
|
119
|
+
const prefix = `${reference.kind}:${reference.id}#`;
|
|
120
|
+
const processing = state.payments.filter((p) => p.access === "processing");
|
|
121
|
+
if (processing.some((p) => p.item.startsWith(prefix) && !anotherTarget(p.item))) return true;
|
|
122
|
+
if (state.item !== null) return !anotherTarget(state.item);
|
|
123
|
+
// No item: a recovered sale. It may be this one unless its payments all name other tickets or times.
|
|
124
|
+
return processing.length === 0 || processing.some((p) => p.item === "payment");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function fields(selected = true, publishPoll = true, selectionKey?: string): AttendancePurchaseFields {
|
|
110
128
|
syncSession();
|
|
111
129
|
if (!reference || !metadata) return ATTENDANCE_INITIAL;
|
|
112
130
|
const currency = metadata.currency ?? "";
|
|
@@ -137,7 +155,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
137
155
|
else if (apple && own && state.phase === "cancelled") note = copyParam(`${prefix}.purchaseCancelledText`, "Purchase cancelled. Your place is not confirmed.");
|
|
138
156
|
return {
|
|
139
157
|
iapBuyHidden: !apple, iapBuyDisabled: !enabled || !selected || !member || !form.supported() || purchase.buyDisabled || inFlight,
|
|
140
|
-
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: purchase.buyBusy
|
|
158
|
+
iapBuyLabel: purchase.buyLabel || copy.buy, iapBusy: busyFor(selectionKey !== undefined ? `${reference.kind}:${reference.id}:${selectionKey}` : options.kind === "eventsTicket" ? `${reference.kind}:${reference.id}:${reference.id}` : undefined, purchase.buyBusy, state),
|
|
141
159
|
iapPrice: apple ? price.priceText : "", iapRetryHidden: !apple || (price.hidePriceRetry && commerce.scopeComplete()),
|
|
142
160
|
iapNote: note,
|
|
143
161
|
iapFormHidden: !apple || !selected || !form.supported(), iapFormError: formError,
|
|
@@ -173,6 +191,7 @@ export function createAttendancePurchase(options: { kind: "bookingsService" | "e
|
|
|
173
191
|
...(options.kind === "bookingsService" ? { booking: { slot: selection.slot ?? {}, contactDetails: form.buyer() } } : { ticket: { eventId: selection.eventId ?? "", ...form.ticket(ref.id) } }),
|
|
174
192
|
} };
|
|
175
193
|
inFlight = true;
|
|
194
|
+
inFlightTarget = target;
|
|
176
195
|
formError = "";
|
|
177
196
|
options.onChange();
|
|
178
197
|
try {
|
|
@@ -26023,6 +26023,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
26023
26023
|
"style": "primary",
|
|
26024
26024
|
"fullWidth": true,
|
|
26025
26025
|
"disabledPath": "$service:himiStoreProduct.buyDisabled",
|
|
26026
|
+
"loadingPath": "$service:himiStoreProduct.buyBusy",
|
|
26026
26027
|
"action": {
|
|
26027
26028
|
"actionId": "tier5.himiStoreProduct.buy"
|
|
26028
26029
|
}
|
|
@@ -315,6 +315,8 @@ interface S {
|
|
|
315
315
|
buyHidden: boolean;
|
|
316
316
|
buyLabel: string;
|
|
317
317
|
buyDisabled: boolean;
|
|
318
|
+
/** A sale is under way: the Buy button shows its spinner. */
|
|
319
|
+
buyBusy: boolean;
|
|
318
320
|
buyNote: string;
|
|
319
321
|
/** Shown once the eCom order reads paid, never on the payment's approval alone. */
|
|
320
322
|
purchasedNote: string;
|
|
@@ -462,7 +464,7 @@ const registerProduct = withIapPresentation<S>({
|
|
|
462
464
|
register: withOnlineWrites(registerState, ["beginAdd", "addToCart", "buy"], { derive, messageFields: action => action === "buy" ? ["buyNote"] : ["cartHint"] }),
|
|
463
465
|
adapters: [storesProductOrders],
|
|
464
466
|
onCreate: commerce => { productPricing = commerce; }, prefix: "product",
|
|
465
|
-
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "readChanged"], concurrentPublishActions: ["buy"],
|
|
467
|
+
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyBusy", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "readChanged"], concurrentPublishActions: ["buy"],
|
|
466
468
|
items: state => inputId() ? [{ reference: { kind: "storesProduct", id: inputId() }, commerceDisplayPrice: state.price }] : [],
|
|
467
469
|
present: (state, price, allowed, _appleIapOrResolving, resolving) => {
|
|
468
470
|
const purchase = applePurchase(state);
|
|
@@ -479,7 +481,7 @@ const registerProduct = withIapPresentation<S>({
|
|
|
479
481
|
...state, price: price(inputId()), ...(purchase.appleRoute ? { wasPrice: "", wasPriceEmpty: false, notOnSale: true } : {}), optionsIncomplete: productState.optionsIncomplete || !allowed(inputId()) || lastProduct?.productType?.toLowerCase() === "digital",
|
|
480
482
|
cartHint, noCartHint: !cartHint || state.added, addDisabled: productState.addDisabled || blocked || pending,
|
|
481
483
|
cartHidden: state.status !== "ready" || !state.name || purchase.appleRoute,
|
|
482
|
-
buyHidden: state.status !== "ready" || !state.name || !purchase.appleRoute || purchase.accessReady, buyLabel: purchase.buyLabel, buyDisabled: purchase.buyDisabled,
|
|
484
|
+
buyHidden: state.status !== "ready" || !state.name || !purchase.appleRoute || purchase.accessReady, buyLabel: purchase.buyLabel, buyDisabled: purchase.buyDisabled, buyBusy: purchase.buyBusy,
|
|
483
485
|
buyNote: state.buyNote === offlineWriteMessage ? state.buyNote : purchase.buyNote,
|
|
484
486
|
purchasedNote: purchase.accessReady ? copyParam("product.purchasedText", "Purchased") : "",
|
|
485
487
|
};
|
|
@@ -625,6 +627,7 @@ const svc = onlineService<S, {
|
|
|
625
627
|
buyHidden: true,
|
|
626
628
|
buyLabel: "",
|
|
627
629
|
buyDisabled: true,
|
|
630
|
+
buyBusy: false,
|
|
628
631
|
buyNote: "",
|
|
629
632
|
purchasedNote: "",
|
|
630
633
|
}),
|