@wix/himalaya-cli 0.1830.0 → 0.1831.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 +1219 -1072
- 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/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
|
@@ -117,6 +117,8 @@ interface State {
|
|
|
117
117
|
buyHidden: boolean;
|
|
118
118
|
buyLabel: string;
|
|
119
119
|
buyDisabled: boolean;
|
|
120
|
+
/** A sale is under way: the Buy button shows its spinner. */
|
|
121
|
+
buyBusy: boolean;
|
|
120
122
|
buyNote: string;
|
|
121
123
|
_poll?: IapPollDirective;
|
|
122
124
|
}
|
|
@@ -303,7 +305,7 @@ async function enrollmentMessage(id: string, name: string, guards: CommerceGuard
|
|
|
303
305
|
const commerce = createIapCommerce({ adapters: [onlineProgramOrders], onChange: () => { void svc.pricingPublish(); } });
|
|
304
306
|
const pricing = commerce.pricing;
|
|
305
307
|
const PRICING_NOT_HYDRATED = [
|
|
306
|
-
"priceLine", "priceNote", "hidePriceRetry", "enrollDisabled", "enrollNote", "enrollHidden", "enrollLabel", "standingLine", "participantHidden", "cancelHidden", "cancelDisabled", "cancelLabel", "buyHidden", "buyLabel", "buyDisabled", "buyNote",
|
|
308
|
+
"priceLine", "priceNote", "hidePriceRetry", "enrollDisabled", "enrollNote", "enrollHidden", "enrollLabel", "standingLine", "participantHidden", "cancelHidden", "cancelDisabled", "cancelLabel", "buyHidden", "buyLabel", "buyDisabled", "buyBusy", "buyNote",
|
|
307
309
|
] as const;
|
|
308
310
|
const CONTENT_KEYS = ["status", "name", "description", "descriptionJson", "meta", "facts", "image", "initial", "emptyText"] as const;
|
|
309
311
|
type Content = Pick<State, (typeof CONTENT_KEYS)[number]>;
|
|
@@ -773,7 +775,7 @@ function pricedState(state: State): State {
|
|
|
773
775
|
cancelDisabled: cancelInFlight || enrollmentInFlight,
|
|
774
776
|
confirmedCancellation: cancelledApplication ?? null,
|
|
775
777
|
cancellationFeedback,
|
|
776
|
-
buyHidden: !purchase.appleRoute || purchase.accessReady || !canEnrol(standing), buyLabel: purchase.buyLabel, buyDisabled: !standingForInput() || purchase.buyDisabled, buyNote: purchase.buyNote,
|
|
778
|
+
buyHidden: !purchase.appleRoute || purchase.accessReady || !canEnrol(standing), buyLabel: purchase.buyLabel, buyDisabled: !standingForInput() || purchase.buyDisabled, buyBusy: purchase.buyBusy, buyNote: purchase.buyNote,
|
|
777
779
|
...(poll ? { _poll: poll } : {}),
|
|
778
780
|
});
|
|
779
781
|
}
|
|
@@ -817,6 +819,7 @@ const INITIAL_STATE: State = derive({
|
|
|
817
819
|
buyHidden: true,
|
|
818
820
|
buyLabel: "",
|
|
819
821
|
buyDisabled: true,
|
|
822
|
+
buyBusy: false,
|
|
820
823
|
buyNote: "",
|
|
821
824
|
});
|
|
822
825
|
|
|
@@ -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. */
|
|
@@ -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
|
}),
|
|
@@ -22955,6 +22955,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
22955
22955
|
"props": {
|
|
22956
22956
|
"title": "$service:himiEventDetail.iapBuyLabel",
|
|
22957
22957
|
"disabledPath": "$service:himiEventDetail.iapBuyDisabled",
|
|
22958
|
+
"loadingPath": "$service:himiEventDetail.iapBusy",
|
|
22958
22959
|
"style": "primary",
|
|
22959
22960
|
"fullWidth": true,
|
|
22960
22961
|
"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 {
|
|
@@ -3500,6 +3500,7 @@ const SCREENS = runtimeSetting({
|
|
|
3500
3500
|
"props": {
|
|
3501
3501
|
"title": "$service:himiEventDetail.iapBuyLabel",
|
|
3502
3502
|
"disabledPath": "$service:himiEventDetail.iapBuyDisabled",
|
|
3503
|
+
"loadingPath": "$service:himiEventDetail.iapBusy",
|
|
3503
3504
|
"style": "primary",
|
|
3504
3505
|
"fullWidth": true,
|
|
3505
3506
|
"action": {
|
|
@@ -15977,6 +15978,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
15977
15978
|
"props": {
|
|
15978
15979
|
"title": "$service:himiEventDetail.iapBuyLabel",
|
|
15979
15980
|
"disabledPath": "$service:himiEventDetail.iapBuyDisabled",
|
|
15981
|
+
"loadingPath": "$service:himiEventDetail.iapBusy",
|
|
15980
15982
|
"style": "primary",
|
|
15981
15983
|
"fullWidth": true,
|
|
15982
15984
|
"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 {
|
|
@@ -22748,6 +22748,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
22748
22748
|
"props": {
|
|
22749
22749
|
"title": "$service:himiEventDetail.iapBuyLabel",
|
|
22750
22750
|
"disabledPath": "$service:himiEventDetail.iapBuyDisabled",
|
|
22751
|
+
"loadingPath": "$service:himiEventDetail.iapBusy",
|
|
22751
22752
|
"style": "primary",
|
|
22752
22753
|
"fullWidth": true,
|
|
22753
22754
|
"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 {
|
|
@@ -24438,6 +24438,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
24438
24438
|
"props": {
|
|
24439
24439
|
"title": "$service:himiBookingTime.iapBuyLabel",
|
|
24440
24440
|
"disabledPath": "$service:himiBookingTime.iapBuyDisabled",
|
|
24441
|
+
"loadingPath": "$service:himiBookingTime.iapBusy",
|
|
24441
24442
|
"style": "primary",
|
|
24442
24443
|
"fullWidth": true,
|
|
24443
24444
|
"action": {
|
|
@@ -25474,6 +25475,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
25474
25475
|
"props": {
|
|
25475
25476
|
"title": "$service:himiBookingTime.iapBuyLabel",
|
|
25476
25477
|
"disabledPath": "$service:himiBookingTime.iapBuyDisabled",
|
|
25478
|
+
"loadingPath": "$service:himiBookingTime.iapBusy",
|
|
25477
25479
|
"style": "primary",
|
|
25478
25480
|
"fullWidth": true,
|
|
25479
25481
|
"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;
|
|
@@ -117,6 +117,8 @@ interface State {
|
|
|
117
117
|
buyHidden: boolean;
|
|
118
118
|
buyLabel: string;
|
|
119
119
|
buyDisabled: boolean;
|
|
120
|
+
/** A sale is under way: the Buy button shows its spinner. */
|
|
121
|
+
buyBusy: boolean;
|
|
120
122
|
buyNote: string;
|
|
121
123
|
_poll?: IapPollDirective;
|
|
122
124
|
}
|
|
@@ -303,7 +305,7 @@ async function enrollmentMessage(id: string, name: string, guards: CommerceGuard
|
|
|
303
305
|
const commerce = createIapCommerce({ adapters: [onlineProgramOrders], onChange: () => { void svc.pricingPublish(); } });
|
|
304
306
|
const pricing = commerce.pricing;
|
|
305
307
|
const PRICING_NOT_HYDRATED = [
|
|
306
|
-
"priceLine", "priceNote", "hidePriceRetry", "enrollDisabled", "enrollNote", "enrollHidden", "enrollLabel", "standingLine", "participantHidden", "cancelHidden", "cancelDisabled", "cancelLabel", "buyHidden", "buyLabel", "buyDisabled", "buyNote",
|
|
308
|
+
"priceLine", "priceNote", "hidePriceRetry", "enrollDisabled", "enrollNote", "enrollHidden", "enrollLabel", "standingLine", "participantHidden", "cancelHidden", "cancelDisabled", "cancelLabel", "buyHidden", "buyLabel", "buyDisabled", "buyBusy", "buyNote",
|
|
307
309
|
] as const;
|
|
308
310
|
const CONTENT_KEYS = ["status", "name", "description", "descriptionJson", "meta", "facts", "image", "initial", "emptyText"] as const;
|
|
309
311
|
type Content = Pick<State, (typeof CONTENT_KEYS)[number]>;
|
|
@@ -773,7 +775,7 @@ function pricedState(state: State): State {
|
|
|
773
775
|
cancelDisabled: cancelInFlight || enrollmentInFlight,
|
|
774
776
|
confirmedCancellation: cancelledApplication ?? null,
|
|
775
777
|
cancellationFeedback,
|
|
776
|
-
buyHidden: !purchase.appleRoute || purchase.accessReady || !canEnrol(standing), buyLabel: purchase.buyLabel, buyDisabled: !standingForInput() || purchase.buyDisabled, buyNote: purchase.buyNote,
|
|
778
|
+
buyHidden: !purchase.appleRoute || purchase.accessReady || !canEnrol(standing), buyLabel: purchase.buyLabel, buyDisabled: !standingForInput() || purchase.buyDisabled, buyBusy: purchase.buyBusy, buyNote: purchase.buyNote,
|
|
777
779
|
...(poll ? { _poll: poll } : {}),
|
|
778
780
|
});
|
|
779
781
|
}
|
|
@@ -817,6 +819,7 @@ const INITIAL_STATE: State = derive({
|
|
|
817
819
|
buyHidden: true,
|
|
818
820
|
buyLabel: "",
|
|
819
821
|
buyDisabled: true,
|
|
822
|
+
buyBusy: false,
|
|
820
823
|
buyNote: "",
|
|
821
824
|
});
|
|
822
825
|
|
|
@@ -30356,6 +30356,7 @@ const SCREENS = runtimeSetting({
|
|
|
30356
30356
|
"title": "$service:himiBrandedPlans.detail.joinLabel",
|
|
30357
30357
|
"style": "primary",
|
|
30358
30358
|
"disabledPath": "$service:himiBrandedPlans.detail.joinDisabled",
|
|
30359
|
+
"loadingPath": "$service:himiBrandedPlans.detail.joinBusy",
|
|
30359
30360
|
"action": {
|
|
30360
30361
|
"actionId": "tier5.himiBrandedPlans.join"
|
|
30361
30362
|
}
|
|
@@ -41498,6 +41499,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
41498
41499
|
"style": "primary",
|
|
41499
41500
|
"fullWidth": true,
|
|
41500
41501
|
"disabledPath": "$service:himiStoreProduct.buyDisabled",
|
|
41502
|
+
"loadingPath": "$service:himiStoreProduct.buyBusy",
|
|
41501
41503
|
"action": {
|
|
41502
41504
|
"actionId": "tier5.himiStoreProduct.buy"
|
|
41503
41505
|
}
|
|
@@ -46037,6 +46039,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
46037
46039
|
"props": {
|
|
46038
46040
|
"title": "$service:himiBookingTime.iapBuyLabel",
|
|
46039
46041
|
"disabledPath": "$service:himiBookingTime.iapBuyDisabled",
|
|
46042
|
+
"loadingPath": "$service:himiBookingTime.iapBusy",
|
|
46040
46043
|
"style": "primary",
|
|
46041
46044
|
"fullWidth": true,
|
|
46042
46045
|
"action": {
|
|
@@ -47068,6 +47071,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
47068
47071
|
"props": {
|
|
47069
47072
|
"title": "$service:himiBookingTime.iapBuyLabel",
|
|
47070
47073
|
"disabledPath": "$service:himiBookingTime.iapBuyDisabled",
|
|
47074
|
+
"loadingPath": "$service:himiBookingTime.iapBusy",
|
|
47071
47075
|
"style": "primary",
|
|
47072
47076
|
"fullWidth": true,
|
|
47073
47077
|
"action": {
|
|
@@ -49569,6 +49573,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
49569
49573
|
"props": {
|
|
49570
49574
|
"title": "$service:himiEventDetail.iapBuyLabel",
|
|
49571
49575
|
"disabledPath": "$service:himiEventDetail.iapBuyDisabled",
|
|
49576
|
+
"loadingPath": "$service:himiEventDetail.iapBusy",
|
|
49572
49577
|
"style": "primary",
|
|
49573
49578
|
"fullWidth": true,
|
|
49574
49579
|
"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;
|
|
@@ -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
|
}),
|
|
@@ -16453,6 +16453,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
16453
16453
|
"props": {
|
|
16454
16454
|
"title": "$service:himiBookingTime.iapBuyLabel",
|
|
16455
16455
|
"disabledPath": "$service:himiBookingTime.iapBuyDisabled",
|
|
16456
|
+
"loadingPath": "$service:himiBookingTime.iapBusy",
|
|
16456
16457
|
"style": "primary",
|
|
16457
16458
|
"fullWidth": true,
|
|
16458
16459
|
"action": {
|
|
@@ -17489,6 +17490,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
17489
17490
|
"props": {
|
|
17490
17491
|
"title": "$service:himiBookingTime.iapBuyLabel",
|
|
17491
17492
|
"disabledPath": "$service:himiBookingTime.iapBuyDisabled",
|
|
17493
|
+
"loadingPath": "$service:himiBookingTime.iapBusy",
|
|
17492
17494
|
"style": "primary",
|
|
17493
17495
|
"fullWidth": true,
|
|
17494
17496
|
"action": {
|