@wix/himalaya-cli 0.1829.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.
Files changed (92) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +6 -2
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +6 -2
  3. package/dist/browser-plane/assets.json +5 -5
  4. package/dist/browser-plane/preview-deferred/{4342c013d2d1938e1fd0eb5ad8808d0a7425d67ea080f4ce615db01a7671e842.bin → 70836790496f742deee3b0e0c83394af3b9fc275d091c6497786d90201392cf4.bin} +1 -1
  5. package/dist/browser-plane/sw.js +9 -9
  6. package/dist/cli.mjs +1247 -1083
  7. package/dist/preview-assets.generated.bin +0 -0
  8. package/guides/designing-himi-screens.md +46 -18
  9. package/guides/getting-started.md +1 -1
  10. package/guides/himi-skill.md +1 -1
  11. package/guides/index.json +6 -0
  12. package/guides/push-cli-onboarding.md +5 -0
  13. package/guides/skill.md +1 -0
  14. package/guides/web-ux.md +134 -0
  15. package/package.json +2 -2
  16. package/templates/beauty-salon/dev/index.ts +29 -2
  17. package/templates/beauty-salon/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  18. package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +1 -1
  19. package/templates/beauty-salon/tier5-src/himi-branded-lite-plans/index.ts +4 -1
  20. package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +49 -10
  21. package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +5 -2
  22. package/templates/branded-lite/dev/index.ts +32 -2
  23. package/templates/branded-lite/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  24. package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +1 -1
  25. package/templates/branded-lite/tier5-src/himi-branded-lite-plans/index.ts +4 -1
  26. package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +5 -2
  27. package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +4 -4
  28. package/templates/branded-lite/tier5-src/himi-store-account/index.ts +49 -10
  29. package/templates/branded-lite/tier5-src/himi-store-product/index.ts +5 -2
  30. package/templates/brandy/tier5-src/himi-store-account/index.ts +49 -10
  31. package/templates/community-club/dev/index.ts +26 -2
  32. package/templates/community-club/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  33. package/templates/community-club/tier5-src/himi-store-account/index.ts +49 -10
  34. package/templates/conference/dev/index.ts +2 -0
  35. package/templates/conference/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  36. package/templates/conference/tier5-src/himi-store-account/index.ts +49 -10
  37. package/templates/events-meetups/dev/index.ts +26 -2
  38. package/templates/events-meetups/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  39. package/templates/events-meetups/tier5-src/himi-store-account/index.ts +49 -10
  40. package/templates/fitness-gym/dev/index.ts +2 -0
  41. package/templates/fitness-gym/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  42. package/templates/fitness-gym/tier5-src/himi-booking-time/index.ts +1 -1
  43. package/templates/fitness-gym/tier5-src/himi-branded-lite-plans/index.ts +4 -1
  44. package/templates/fitness-gym/tier5-src/himi-branded-lite-program/index.ts +5 -2
  45. package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +49 -10
  46. package/templates/gym-fitness/dev/index.ts +30 -2
  47. package/templates/gym-fitness/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  48. package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +1 -1
  49. package/templates/gym-fitness/tier5-src/himi-branded-lite-plans/index.ts +4 -1
  50. package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +49 -10
  51. package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +5 -2
  52. package/templates/medical-services/dev/index.ts +2 -0
  53. package/templates/medical-services/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  54. package/templates/medical-services/tier5-src/himi-booking-time/index.ts +1 -1
  55. package/templates/medical-services/tier5-src/himi-store-account/index.ts +49 -10
  56. package/templates/nonprofit-cause/dev/index.ts +27 -2
  57. package/templates/nonprofit-cause/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  58. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-plans/index.ts +4 -1
  59. package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +49 -10
  60. package/templates/personal-fitness-trainer/dev/index.ts +27 -1
  61. package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  62. package/templates/personal-fitness-trainer/tier5-src/himi-booking-time/index.ts +1 -1
  63. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-plans/index.ts +4 -1
  64. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-video/index.ts +4 -4
  65. package/templates/personal-fitness-trainer/tier5-src/himi-store-account/index.ts +49 -10
  66. package/templates/podcast-creator/dev/index.ts +27 -2
  67. package/templates/podcast-creator/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  68. package/templates/podcast-creator/tier5-src/himi-branded-lite-plans/index.ts +4 -1
  69. package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +49 -10
  70. package/templates/portfolio-creative/dev/index.ts +27 -2
  71. package/templates/portfolio-creative/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  72. package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +49 -10
  73. package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +5 -2
  74. package/templates/restaurant/dev/index.ts +26 -2
  75. package/templates/restaurant/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  76. package/templates/restaurant/tier5-src/himi-store-account/index.ts +49 -10
  77. package/templates/retail-store/dev/index.ts +26 -2
  78. package/templates/retail-store/tier5-src/himi-store-account/index.ts +49 -10
  79. package/templates/retail-store/tier5-src/himi-store-product/index.ts +5 -2
  80. package/templates/salon-spa/dev/index.ts +2 -0
  81. package/templates/salon-spa/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  82. package/templates/salon-spa/tier5-src/himi-booking-time/index.ts +1 -1
  83. package/templates/salon-spa/tier5-src/himi-store-account/index.ts +49 -10
  84. package/templates/wholesale-store/dev/index.ts +1 -0
  85. package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +49 -10
  86. package/templates/wholesale-store/tier5-src/himi-store-product/index.ts +5 -2
  87. package/templates/yoga-studio/dev/index.ts +30 -2
  88. package/templates/yoga-studio/tier5-src/_shared/iap-attendance-purchase.ts +21 -2
  89. package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +1 -1
  90. package/templates/yoga-studio/tier5-src/himi-branded-lite-plans/index.ts +4 -1
  91. package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +5 -2
  92. package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +49 -10
@@ -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
  }),
@@ -9836,6 +9836,28 @@ const SCREENS = runtimeSetting({
9836
9836
  "children": [
9837
9837
  {
9838
9838
  "id": "himi_sign_in.social_apple",
9839
+ "body": {
9840
+ "package": "himalaya",
9841
+ "type": "Button",
9842
+ "props": {
9843
+ "title": "Continue with Apple",
9844
+ "style": "appleSignIn",
9845
+ "fullWidth": true,
9846
+ "disabledPath": "$service:himiStoreAccount.authBusy",
9847
+ "action": {
9848
+ "actionId": "tier5.himiStoreAccount.signInWithSocial",
9849
+ "params": {
9850
+ "provider": "apple"
9851
+ }
9852
+ }
9853
+ }
9854
+ },
9855
+ "modifiers": {
9856
+ "hiddenPath": "$service:himiStoreAccount.hideAppleSystemButton"
9857
+ }
9858
+ },
9859
+ {
9860
+ "id": "himi_sign_in.social_apple_legacy",
9839
9861
  "body": {
9840
9862
  "package": "himalaya",
9841
9863
  "type": "Button",
@@ -9853,7 +9875,7 @@ const SCREENS = runtimeSetting({
9853
9875
  }
9854
9876
  },
9855
9877
  "modifiers": {
9856
- "hiddenPath": "$service:himiStoreAccount.hideAppleSignIn"
9878
+ "hiddenPath": "$service:himiStoreAccount.hideAppleLegacyButton"
9857
9879
  }
9858
9880
  },
9859
9881
  {
@@ -10295,7 +10317,8 @@ const SCREENS = runtimeSetting({
10295
10317
  "integrity": "",
10296
10318
  "contentType": "application/javascript+ts-bundle",
10297
10319
  "declaredCapabilities": [
10298
- "wix_api"
10320
+ "wix_api",
10321
+ "app_info"
10299
10322
  ],
10300
10323
  "minBinaryVersion": "1.7.0",
10301
10324
  "bundleVersion": "0.0.1"
@@ -40876,6 +40899,7 @@ const SCREENS = runtimeSetting({
40876
40899
  "title": "$service:himiBrandedPlans.detail.joinLabel",
40877
40900
  "style": "primary",
40878
40901
  "disabledPath": "$service:himiBrandedPlans.detail.joinDisabled",
40902
+ "loadingPath": "$service:himiBrandedPlans.detail.joinBusy",
40879
40903
  "action": {
40880
40904
  "actionId": "tier5.himiBrandedPlans.join"
40881
40905
  }
@@ -87341,6 +87365,7 @@ const SCREENS = runtimeSetting({
87341
87365
  "style": "primary",
87342
87366
  "fullWidth": true,
87343
87367
  "disabledPath": "$service:himiBrandedVideo.buyDisabled",
87368
+ "loadingPath": "$service:himiBrandedVideo.buyBusy",
87344
87369
  "action": {
87345
87370
  "actionId": "tier5.himiBrandedVideo.buy"
87346
87371
  }
@@ -104821,6 +104846,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
104821
104846
  "style": "primary",
104822
104847
  "fullWidth": true,
104823
104848
  "disabledPath": "$service:himiStoreProduct.buyDisabled",
104849
+ "loadingPath": "$service:himiStoreProduct.buyBusy",
104824
104850
  "action": {
104825
104851
  "actionId": "tier5.himiStoreProduct.buy"
104826
104852
  }
@@ -109367,6 +109393,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
109367
109393
  "props": {
109368
109394
  "title": "$service:himiBookingTime.iapBuyLabel",
109369
109395
  "disabledPath": "$service:himiBookingTime.iapBuyDisabled",
109396
+ "loadingPath": "$service:himiBookingTime.iapBusy",
109370
109397
  "style": "primary",
109371
109398
  "fullWidth": true,
109372
109399
  "action": {
@@ -110398,6 +110425,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
110398
110425
  "props": {
110399
110426
  "title": "$service:himiBookingTime.iapBuyLabel",
110400
110427
  "disabledPath": "$service:himiBookingTime.iapBuyDisabled",
110428
+ "loadingPath": "$service:himiBookingTime.iapBusy",
110401
110429
  "style": "primary",
110402
110430
  "fullWidth": true,
110403
110431
  "action": {
@@ -111867,6 +111895,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
111867
111895
  "style": "primary",
111868
111896
  "fullWidth": true,
111869
111897
  "disabledPath": "$service:himiBrandedProgram.buyDisabled",
111898
+ "loadingPath": "$service:himiBrandedProgram.buyBusy",
111870
111899
  "action": {
111871
111900
  "actionId": "tier5.himiBrandedProgram.buy"
111872
111901
  }
@@ -114320,6 +114349,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
114320
114349
  "props": {
114321
114350
  "title": "$service:himiEventDetail.iapBuyLabel",
114322
114351
  "disabledPath": "$service:himiEventDetail.iapBuyDisabled",
114352
+ "loadingPath": "$service:himiEventDetail.iapBusy",
114323
114353
  "style": "primary",
114324
114354
  "fullWidth": true,
114325
114355
  "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
- function fields(selected = true, publishPoll = true): AttendancePurchaseFields {
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 || inFlight,
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
 
@@ -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. */
@@ -11,11 +11,12 @@ import { authFailure, authMessage, identityErrors, type AuthOperation } from "@h
11
11
  // real Sites List, and per-call site scope via `site.forSite`).
12
12
  import { defineService, navigate } from "@himalaya/state";
13
13
  import { dispatch } from "@himalaya/dispatch";
14
+ import { get as getAppInfo } from "@himalaya/app-info";
14
15
  import { getCurrentCart, searchOrders, type WixOrder } from "@himalaya/wix-ecom";
15
16
  import { guestProfile, loadMemberProfile, signedInEmail, strOf, fmtDate, titleCase, type AccountActivityRow } from "../_shared/himi-account";
16
17
  import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
17
18
  import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
18
- import { memberAccountRoutes } from "../_shared/member-account-routes.js";
19
+ import { atLeast, memberAccountRoutes } from "../_shared/member-account-routes.js";
19
20
  import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
20
21
  import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
21
22
  import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
@@ -413,15 +414,44 @@ const translated = (key: string) => copyParam(key, authMessage(key));
413
414
  const SOCIAL_PROVIDERS = ["apple", "google"] as const;
414
415
  type SocialProvider = typeof SOCIAL_PROVIDERS[number];
415
416
  let socialProviders: SocialProvider[] = [];
417
+ /** The first runtime that draws the Button style `appleSignIn`. Below it an Apple-platform host draws an
418
+ * unknown style as bare text, so the screen shows its older outlined Apple button there. */
419
+ export const APPLE_SIGN_IN_STYLE_MIN_BINARY = "1.10.0";
420
+ let appleButtonLegacy = false;
421
+ let hostInfo: Awaited<ReturnType<typeof getAppInfo>> | undefined;
416
422
 
417
- type SocialProvidersRead = { ok: true; providers: SocialProvider[] } | { ok: false };
423
+ /** `answered`: the host listed a provider, even one this screen then hides; only a host that listed
424
+ * none may still be booting its auth, so only that one is polled again. */
425
+ type SocialProvidersRead = { ok: true; providers: SocialProvider[]; appleButtonLegacy: boolean; answered: boolean } | { ok: false };
418
426
 
419
427
  /** The providers the host offers: site enables it, binary configured, platform supports it. */
420
428
  async function readSocialProviders(): Promise<SocialProvidersRead> {
421
429
  try {
422
- const raw = await dispatch("himi.wix.socialProviders") as { payload?: { providers?: unknown }; providers?: unknown } | null;
430
+ const raw = await dispatch("himi.wix.socialProviders") as { payload?: { providers?: unknown; answered?: unknown }; providers?: unknown; answered?: unknown } | null;
423
431
  const listed = raw?.payload?.providers ?? raw?.providers;
424
- return { ok: true, providers: Array.isArray(listed) ? SOCIAL_PROVIDERS.filter((p) => listed.includes(p)) : [] };
432
+ // iOS says the site answered even when its App Review rule left nothing to show; such a [] is final.
433
+ const hostAnswered = (raw?.payload?.answered ?? raw?.answered) === true;
434
+ const providers = Array.isArray(listed) ? SOCIAL_PROVIDERS.filter((p) => listed.includes(p)) : [];
435
+ const read = providers.length ? await getAppInfo().catch(() => undefined) : undefined;
436
+ // A host's platform and runtime do not change: once named, a later failed lookup keeps them.
437
+ if (read && read.platform !== "unknown") hostInfo = read;
438
+ const info = read && read.platform !== "unknown" ? read : hostInfo ?? read;
439
+ const platform = info?.platform;
440
+ // App Review 4.8: on iOS, Google only beside Apple. A current iOS host already answers so; an installed
441
+ // older one still gets this screen over the air and can answer Google alone. Fails closed: only a
442
+ // host that says it is Android or web (neither reviewed by Apple) keeps Google alone, since one that
443
+ // refuses app_info could be iOS. macOS stays covered: App Review applies to Mac apps too.
444
+ if (providers.includes("google") && !providers.includes("apple") && platform !== "android" && platform !== "web") {
445
+ // A lookup that failed outright may be transient: hide Google now, and ask again on the poll.
446
+ return { ok: true, providers: [], appleButtonLegacy: false, answered: info !== undefined };
447
+ }
448
+ // Apple's button only where the host is known to draw it: Android and web always do, an Apple
449
+ // platform from APPLE_SIGN_IN_STYLE_MIN_BINARY; a host that does not say gets the older button.
450
+ const drawsAppleStyle = platform === "android" || platform === "web"
451
+ || ((platform === "ios" || platform === "macos") && atLeast(info?.binaryVersion ?? "", APPLE_SIGN_IN_STYLE_MIN_BINARY));
452
+ const legacy = !drawsAppleStyle;
453
+ // Listed providers whose platform lookup failed are polled again, so a current host is not left on the older button.
454
+ return { ok: true, providers, appleButtonLegacy: legacy, answered: providers.length > 0 ? info !== undefined : hostAnswered };
425
455
  } catch {
426
456
  return { ok: false };
427
457
  }
@@ -430,7 +460,7 @@ async function readSocialProviders(): Promise<SocialProvidersRead> {
430
460
  /** A failed read keeps what the last read showed: a blip must not take the buttons away. A host
431
461
  * without the action (web, an older binary) never answers, so it never shows any. */
432
462
  function applySocialProviders(read: SocialProvidersRead): void {
433
- if (read.ok) socialProviders = read.providers;
463
+ if (read.ok) { socialProviders = read.providers; appleButtonLegacy = read.appleButtonLegacy; }
434
464
  }
435
465
 
436
466
  // Which member flows this binding can run (the host's `himi.wix.memberFlows`). A One App binding with no Headless OAuth client
@@ -475,14 +505,15 @@ function armFlowsRetry(read: MemberFlowsRead): void {
475
505
  }
476
506
 
477
507
  function armSocialRetry(read: SocialProvidersRead): void {
478
- if (read.ok) socialRetriesLeft = read.providers.length ? 0 : SOCIAL_RETRIES;
508
+ if (read.ok) socialRetriesLeft = read.answered ? 0 : SOCIAL_RETRIES;
479
509
  }
480
510
 
481
511
  async function refreshSocial(): Promise<S> {
482
512
  if (socialRetriesLeft > 0) {
483
513
  socialRetriesLeft -= 1;
484
- applySocialProviders(await readSocialProviders());
485
- if (socialProviders.length) socialRetriesLeft = 0;
514
+ const read = await readSocialProviders();
515
+ applySocialProviders(read);
516
+ if (read.ok && read.answered) socialRetriesLeft = 0;
486
517
  }
487
518
  if (flowsRetriesLeft > 0) {
488
519
  flowsRetriesLeft -= 1;
@@ -709,6 +740,10 @@ interface S extends IapRestoreFields {
709
740
  hideShowRegister: boolean;
710
741
  hideShowRecovery: boolean;
711
742
  hideAppleSignIn: boolean;
743
+ /** Apple's appleSignIn button: hidden without Apple, or on a runtime that cannot draw it. */
744
+ hideAppleSystemButton: boolean;
745
+ /** The older outlined Apple button, shown only on such a runtime. */
746
+ hideAppleLegacyButton: boolean;
712
747
  hideGoogleSignIn: boolean;
713
748
  /** The social block and its "or" divider: no provider to show, or resetting a password. */
714
749
  hideSocialSignIn: boolean;
@@ -802,6 +837,8 @@ function derive(s: S): S {
802
837
  hideShowRegister: isRegistering || isRecovering || !signUpAvailable,
803
838
  hideShowRecovery: isRegistering || isRecovering || !passwordResetAvailable,
804
839
  hideAppleSignIn: !socialProviders.includes("apple"),
840
+ hideAppleSystemButton: !socialProviders.includes("apple") || appleButtonLegacy,
841
+ hideAppleLegacyButton: !socialProviders.includes("apple") || !appleButtonLegacy,
805
842
  hideGoogleSignIn: !socialProviders.includes("google"),
806
843
  hideSocialSignIn: isRecovering || socialProviders.length === 0,
807
844
  hasActivity,
@@ -973,7 +1010,7 @@ const svc = defineService<S, {
973
1010
  restorePublish: (s: S) => S;
974
1011
  iapRestore: (s: S) => Promise<undefined>;
975
1012
  }>("himiStoreAccount", {
976
- notHydrated: ["message", "hideMessage", "messageKind", "resetSent", "password", "authBusy", "hideAppleSignIn", "hideGoogleSignIn", "hideSocialSignIn", "emailError", "passwordError", "passwordFocus", "lastNameFocus", "emailFocus", ...VISIT_KEYS, ...VISIT_DERIVED_KEYS, ...IAP_RESTORE_KEYS],
1013
+ notHydrated: ["message", "hideMessage", "messageKind", "resetSent", "password", "authBusy", "hideAppleSignIn", "hideAppleSystemButton", "hideAppleLegacyButton", "hideGoogleSignIn", "hideSocialSignIn", "emailError", "passwordError", "passwordFocus", "lastNameFocus", "emailFocus", ...VISIT_KEYS, ...VISIT_DERIVED_KEYS, ...IAP_RESTORE_KEYS],
977
1014
  state: derive({
978
1015
  status: "loading",
979
1016
  isMember: false,
@@ -1018,6 +1055,8 @@ const svc = defineService<S, {
1018
1055
  hideShowRegister: false,
1019
1056
  hideShowRecovery: false,
1020
1057
  hideAppleSignIn: true,
1058
+ hideAppleSystemButton: true,
1059
+ hideAppleLegacyButton: true,
1021
1060
  hideGoogleSignIn: true,
1022
1061
  hideSocialSignIn: true,
1023
1062
  activityTitle: "Previous orders",
@@ -1159,7 +1198,7 @@ const svc = defineService<S, {
1159
1198
  },
1160
1199
  });
1161
1200
 
1162
- resetUnhydratedKeysOnOlderRuntime(svc, derive({ ...svc.getState(), ...NO_IAP_RESTORE, ...NO_VISIT, ...NO_FOCUS_ALL, message: "", resetSent: false, passwordFocus: "", isRegistering: ROUTE_ASKS_REGISTER }), ["message", "hideMessage", "messageKind", "resetSent", "hideAppleSignIn", "hideGoogleSignIn", "hideSocialSignIn", ...IAP_RESTORE_KEYS, ...VISIT_KEYS, ...VISIT_DERIVED_KEYS, "lastNameFocus", "emailFocus", "passwordFocus"]);
1201
+ resetUnhydratedKeysOnOlderRuntime(svc, derive({ ...svc.getState(), ...NO_IAP_RESTORE, ...NO_VISIT, ...NO_FOCUS_ALL, message: "", resetSent: false, passwordFocus: "", isRegistering: ROUTE_ASKS_REGISTER }), ["message", "hideMessage", "messageKind", "resetSent", "hideAppleSignIn", "hideAppleSystemButton", "hideAppleLegacyButton", "hideGoogleSignIn", "hideSocialSignIn", ...IAP_RESTORE_KEYS, ...VISIT_KEYS, ...VISIT_DERIVED_KEYS, "lastNameFocus", "emailFocus", "passwordFocus"]);
1163
1202
  // `boot` tells settle this is not a visit: the host drops this call's navigation, and the
1164
1203
  // appear refresh does the visit's moves.
1165
1204
  svc.load({ boot: "1" });
@@ -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
  }),
@@ -11,11 +11,12 @@ import { authFailure, authMessage, identityErrors, type AuthOperation } from "@h
11
11
  // real Sites List, and per-call site scope via `site.forSite`).
12
12
  import { defineService, navigate } from "@himalaya/state";
13
13
  import { dispatch } from "@himalaya/dispatch";
14
+ import { get as getAppInfo } from "@himalaya/app-info";
14
15
  import { getCurrentCart, searchOrders, type WixOrder } from "@himalaya/wix-ecom";
15
16
  import { guestProfile, loadMemberProfile, signedInEmail, strOf, fmtDate, titleCase, type AccountActivityRow } from "../_shared/himi-account";
16
17
  import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
17
18
  import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
18
- import { memberAccountRoutes } from "../_shared/member-account-routes.js";
19
+ import { atLeast, memberAccountRoutes } from "../_shared/member-account-routes.js";
19
20
  import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
20
21
  import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
21
22
  import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
@@ -413,15 +414,44 @@ const translated = (key: string) => copyParam(key, authMessage(key));
413
414
  const SOCIAL_PROVIDERS = ["apple", "google"] as const;
414
415
  type SocialProvider = typeof SOCIAL_PROVIDERS[number];
415
416
  let socialProviders: SocialProvider[] = [];
417
+ /** The first runtime that draws the Button style `appleSignIn`. Below it an Apple-platform host draws an
418
+ * unknown style as bare text, so the screen shows its older outlined Apple button there. */
419
+ export const APPLE_SIGN_IN_STYLE_MIN_BINARY = "1.10.0";
420
+ let appleButtonLegacy = false;
421
+ let hostInfo: Awaited<ReturnType<typeof getAppInfo>> | undefined;
416
422
 
417
- type SocialProvidersRead = { ok: true; providers: SocialProvider[] } | { ok: false };
423
+ /** `answered`: the host listed a provider, even one this screen then hides; only a host that listed
424
+ * none may still be booting its auth, so only that one is polled again. */
425
+ type SocialProvidersRead = { ok: true; providers: SocialProvider[]; appleButtonLegacy: boolean; answered: boolean } | { ok: false };
418
426
 
419
427
  /** The providers the host offers: site enables it, binary configured, platform supports it. */
420
428
  async function readSocialProviders(): Promise<SocialProvidersRead> {
421
429
  try {
422
- const raw = await dispatch("himi.wix.socialProviders") as { payload?: { providers?: unknown }; providers?: unknown } | null;
430
+ const raw = await dispatch("himi.wix.socialProviders") as { payload?: { providers?: unknown; answered?: unknown }; providers?: unknown; answered?: unknown } | null;
423
431
  const listed = raw?.payload?.providers ?? raw?.providers;
424
- return { ok: true, providers: Array.isArray(listed) ? SOCIAL_PROVIDERS.filter((p) => listed.includes(p)) : [] };
432
+ // iOS says the site answered even when its App Review rule left nothing to show; such a [] is final.
433
+ const hostAnswered = (raw?.payload?.answered ?? raw?.answered) === true;
434
+ const providers = Array.isArray(listed) ? SOCIAL_PROVIDERS.filter((p) => listed.includes(p)) : [];
435
+ const read = providers.length ? await getAppInfo().catch(() => undefined) : undefined;
436
+ // A host's platform and runtime do not change: once named, a later failed lookup keeps them.
437
+ if (read && read.platform !== "unknown") hostInfo = read;
438
+ const info = read && read.platform !== "unknown" ? read : hostInfo ?? read;
439
+ const platform = info?.platform;
440
+ // App Review 4.8: on iOS, Google only beside Apple. A current iOS host already answers so; an installed
441
+ // older one still gets this screen over the air and can answer Google alone. Fails closed: only a
442
+ // host that says it is Android or web (neither reviewed by Apple) keeps Google alone, since one that
443
+ // refuses app_info could be iOS. macOS stays covered: App Review applies to Mac apps too.
444
+ if (providers.includes("google") && !providers.includes("apple") && platform !== "android" && platform !== "web") {
445
+ // A lookup that failed outright may be transient: hide Google now, and ask again on the poll.
446
+ return { ok: true, providers: [], appleButtonLegacy: false, answered: info !== undefined };
447
+ }
448
+ // Apple's button only where the host is known to draw it: Android and web always do, an Apple
449
+ // platform from APPLE_SIGN_IN_STYLE_MIN_BINARY; a host that does not say gets the older button.
450
+ const drawsAppleStyle = platform === "android" || platform === "web"
451
+ || ((platform === "ios" || platform === "macos") && atLeast(info?.binaryVersion ?? "", APPLE_SIGN_IN_STYLE_MIN_BINARY));
452
+ const legacy = !drawsAppleStyle;
453
+ // Listed providers whose platform lookup failed are polled again, so a current host is not left on the older button.
454
+ return { ok: true, providers, appleButtonLegacy: legacy, answered: providers.length > 0 ? info !== undefined : hostAnswered };
425
455
  } catch {
426
456
  return { ok: false };
427
457
  }
@@ -430,7 +460,7 @@ async function readSocialProviders(): Promise<SocialProvidersRead> {
430
460
  /** A failed read keeps what the last read showed: a blip must not take the buttons away. A host
431
461
  * without the action (web, an older binary) never answers, so it never shows any. */
432
462
  function applySocialProviders(read: SocialProvidersRead): void {
433
- if (read.ok) socialProviders = read.providers;
463
+ if (read.ok) { socialProviders = read.providers; appleButtonLegacy = read.appleButtonLegacy; }
434
464
  }
435
465
 
436
466
  // Which member flows this binding can run (the host's `himi.wix.memberFlows`). A One App binding with no Headless OAuth client
@@ -475,14 +505,15 @@ function armFlowsRetry(read: MemberFlowsRead): void {
475
505
  }
476
506
 
477
507
  function armSocialRetry(read: SocialProvidersRead): void {
478
- if (read.ok) socialRetriesLeft = read.providers.length ? 0 : SOCIAL_RETRIES;
508
+ if (read.ok) socialRetriesLeft = read.answered ? 0 : SOCIAL_RETRIES;
479
509
  }
480
510
 
481
511
  async function refreshSocial(): Promise<S> {
482
512
  if (socialRetriesLeft > 0) {
483
513
  socialRetriesLeft -= 1;
484
- applySocialProviders(await readSocialProviders());
485
- if (socialProviders.length) socialRetriesLeft = 0;
514
+ const read = await readSocialProviders();
515
+ applySocialProviders(read);
516
+ if (read.ok && read.answered) socialRetriesLeft = 0;
486
517
  }
487
518
  if (flowsRetriesLeft > 0) {
488
519
  flowsRetriesLeft -= 1;
@@ -709,6 +740,10 @@ interface S extends IapRestoreFields {
709
740
  hideShowRegister: boolean;
710
741
  hideShowRecovery: boolean;
711
742
  hideAppleSignIn: boolean;
743
+ /** Apple's appleSignIn button: hidden without Apple, or on a runtime that cannot draw it. */
744
+ hideAppleSystemButton: boolean;
745
+ /** The older outlined Apple button, shown only on such a runtime. */
746
+ hideAppleLegacyButton: boolean;
712
747
  hideGoogleSignIn: boolean;
713
748
  /** The social block and its "or" divider: no provider to show, or resetting a password. */
714
749
  hideSocialSignIn: boolean;
@@ -802,6 +837,8 @@ function derive(s: S): S {
802
837
  hideShowRegister: isRegistering || isRecovering || !signUpAvailable,
803
838
  hideShowRecovery: isRegistering || isRecovering || !passwordResetAvailable,
804
839
  hideAppleSignIn: !socialProviders.includes("apple"),
840
+ hideAppleSystemButton: !socialProviders.includes("apple") || appleButtonLegacy,
841
+ hideAppleLegacyButton: !socialProviders.includes("apple") || !appleButtonLegacy,
805
842
  hideGoogleSignIn: !socialProviders.includes("google"),
806
843
  hideSocialSignIn: isRecovering || socialProviders.length === 0,
807
844
  hasActivity,
@@ -973,7 +1010,7 @@ const svc = defineService<S, {
973
1010
  restorePublish: (s: S) => S;
974
1011
  iapRestore: (s: S) => Promise<undefined>;
975
1012
  }>("himiStoreAccount", {
976
- notHydrated: ["message", "hideMessage", "messageKind", "resetSent", "password", "authBusy", "hideAppleSignIn", "hideGoogleSignIn", "hideSocialSignIn", "emailError", "passwordError", "passwordFocus", "lastNameFocus", "emailFocus", ...VISIT_KEYS, ...VISIT_DERIVED_KEYS, ...IAP_RESTORE_KEYS],
1013
+ notHydrated: ["message", "hideMessage", "messageKind", "resetSent", "password", "authBusy", "hideAppleSignIn", "hideAppleSystemButton", "hideAppleLegacyButton", "hideGoogleSignIn", "hideSocialSignIn", "emailError", "passwordError", "passwordFocus", "lastNameFocus", "emailFocus", ...VISIT_KEYS, ...VISIT_DERIVED_KEYS, ...IAP_RESTORE_KEYS],
977
1014
  state: derive({
978
1015
  status: "loading",
979
1016
  isMember: false,
@@ -1018,6 +1055,8 @@ const svc = defineService<S, {
1018
1055
  hideShowRegister: false,
1019
1056
  hideShowRecovery: false,
1020
1057
  hideAppleSignIn: true,
1058
+ hideAppleSystemButton: true,
1059
+ hideAppleLegacyButton: true,
1021
1060
  hideGoogleSignIn: true,
1022
1061
  hideSocialSignIn: true,
1023
1062
  activityTitle: "Previous orders",
@@ -1159,7 +1198,7 @@ const svc = defineService<S, {
1159
1198
  },
1160
1199
  });
1161
1200
 
1162
- resetUnhydratedKeysOnOlderRuntime(svc, derive({ ...svc.getState(), ...NO_IAP_RESTORE, ...NO_VISIT, ...NO_FOCUS_ALL, message: "", resetSent: false, passwordFocus: "", isRegistering: ROUTE_ASKS_REGISTER }), ["message", "hideMessage", "messageKind", "resetSent", "hideAppleSignIn", "hideGoogleSignIn", "hideSocialSignIn", ...IAP_RESTORE_KEYS, ...VISIT_KEYS, ...VISIT_DERIVED_KEYS, "lastNameFocus", "emailFocus", "passwordFocus"]);
1201
+ resetUnhydratedKeysOnOlderRuntime(svc, derive({ ...svc.getState(), ...NO_IAP_RESTORE, ...NO_VISIT, ...NO_FOCUS_ALL, message: "", resetSent: false, passwordFocus: "", isRegistering: ROUTE_ASKS_REGISTER }), ["message", "hideMessage", "messageKind", "resetSent", "hideAppleSignIn", "hideAppleSystemButton", "hideAppleLegacyButton", "hideGoogleSignIn", "hideSocialSignIn", ...IAP_RESTORE_KEYS, ...VISIT_KEYS, ...VISIT_DERIVED_KEYS, "lastNameFocus", "emailFocus", "passwordFocus"]);
1163
1202
  // `boot` tells settle this is not a visit: the host drops this call's navigation, and the
1164
1203
  // appear refresh does the visit's moves.
1165
1204
  svc.load({ boot: "1" });