@wix/himalaya-cli 0.1828.0 → 0.1830.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 (37) hide show
  1. package/dist/browser-plane/assets.json +5 -5
  2. package/dist/browser-plane/preview-deferred/{4342c013d2d1938e1fd0eb5ad8808d0a7425d67ea080f4ce615db01a7671e842.bin → 990204a4cb9e61e96206131bbaeb9401543753fd5301735b5029eb6906921329.bin} +1 -1
  3. package/dist/browser-plane/sw.js +9 -9
  4. package/dist/cli.mjs +67 -51
  5. package/dist/preview-assets.generated.bin +0 -0
  6. package/guides/push-cli-onboarding.md +5 -0
  7. package/package.json +2 -2
  8. package/templates/beauty-salon/dev/index.ts +25 -2
  9. package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +49 -10
  10. package/templates/branded-lite/dev/index.ts +25 -2
  11. package/templates/branded-lite/tier5-src/himi-store-account/index.ts +49 -10
  12. package/templates/brandy/tier5-src/himi-store-account/index.ts +49 -10
  13. package/templates/community-club/dev/index.ts +25 -2
  14. package/templates/community-club/tier5-src/himi-store-account/index.ts +49 -10
  15. package/templates/conference/tier5-src/himi-store-account/index.ts +49 -10
  16. package/templates/events-meetups/dev/index.ts +25 -2
  17. package/templates/events-meetups/tier5-src/himi-store-account/index.ts +49 -10
  18. package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +49 -10
  19. package/templates/gym-fitness/dev/index.ts +25 -2
  20. package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +49 -10
  21. package/templates/medical-services/tier5-src/himi-store-account/index.ts +49 -10
  22. package/templates/nonprofit-cause/dev/index.ts +25 -2
  23. package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +49 -10
  24. package/templates/personal-fitness-trainer/dev/index.ts +23 -1
  25. package/templates/personal-fitness-trainer/tier5-src/himi-store-account/index.ts +49 -10
  26. package/templates/podcast-creator/dev/index.ts +25 -2
  27. package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +49 -10
  28. package/templates/portfolio-creative/dev/index.ts +25 -2
  29. package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +49 -10
  30. package/templates/restaurant/dev/index.ts +25 -2
  31. package/templates/restaurant/tier5-src/himi-store-account/index.ts +49 -10
  32. package/templates/retail-store/dev/index.ts +25 -2
  33. package/templates/retail-store/tier5-src/himi-store-account/index.ts +49 -10
  34. package/templates/salon-spa/tier5-src/himi-store-account/index.ts +49 -10
  35. package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +49 -10
  36. package/templates/yoga-studio/dev/index.ts +25 -2
  37. package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +49 -10
@@ -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" });
@@ -7756,6 +7756,28 @@ const SCREENS = runtimeSetting({
7756
7756
  "children": [
7757
7757
  {
7758
7758
  "id": "himi_sign_in.social_apple",
7759
+ "body": {
7760
+ "package": "himalaya",
7761
+ "type": "Button",
7762
+ "props": {
7763
+ "title": "Continue with Apple",
7764
+ "style": "appleSignIn",
7765
+ "fullWidth": true,
7766
+ "disabledPath": "$service:himiStoreAccount.authBusy",
7767
+ "action": {
7768
+ "actionId": "tier5.himiStoreAccount.signInWithSocial",
7769
+ "params": {
7770
+ "provider": "apple"
7771
+ }
7772
+ }
7773
+ }
7774
+ },
7775
+ "modifiers": {
7776
+ "hiddenPath": "$service:himiStoreAccount.hideAppleSystemButton"
7777
+ }
7778
+ },
7779
+ {
7780
+ "id": "himi_sign_in.social_apple_legacy",
7759
7781
  "body": {
7760
7782
  "package": "himalaya",
7761
7783
  "type": "Button",
@@ -7773,7 +7795,7 @@ const SCREENS = runtimeSetting({
7773
7795
  }
7774
7796
  },
7775
7797
  "modifiers": {
7776
- "hiddenPath": "$service:himiStoreAccount.hideAppleSignIn"
7798
+ "hiddenPath": "$service:himiStoreAccount.hideAppleLegacyButton"
7777
7799
  }
7778
7800
  },
7779
7801
  {
@@ -8216,7 +8238,8 @@ const SCREENS = runtimeSetting({
8216
8238
  "integrity": "",
8217
8239
  "contentType": "application/javascript+ts-bundle",
8218
8240
  "declaredCapabilities": [
8219
- "wix_api"
8241
+ "wix_api",
8242
+ "app_info"
8220
8243
  ],
8221
8244
  "minBinaryVersion": "1.7.0",
8222
8245
  "bundleVersion": "0.0.1"
@@ -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" });
@@ -10269,6 +10269,28 @@ const SCREENS = runtimeSetting({
10269
10269
  "children": [
10270
10270
  {
10271
10271
  "id": "himi_sign_in.social_apple",
10272
+ "body": {
10273
+ "package": "himalaya",
10274
+ "type": "Button",
10275
+ "props": {
10276
+ "title": "Continue with Apple",
10277
+ "style": "appleSignIn",
10278
+ "fullWidth": true,
10279
+ "disabledPath": "$service:himiStoreAccount.authBusy",
10280
+ "action": {
10281
+ "actionId": "tier5.himiStoreAccount.signInWithSocial",
10282
+ "params": {
10283
+ "provider": "apple"
10284
+ }
10285
+ }
10286
+ }
10287
+ },
10288
+ "modifiers": {
10289
+ "hiddenPath": "$service:himiStoreAccount.hideAppleSystemButton"
10290
+ }
10291
+ },
10292
+ {
10293
+ "id": "himi_sign_in.social_apple_legacy",
10272
10294
  "body": {
10273
10295
  "package": "himalaya",
10274
10296
  "type": "Button",
@@ -10286,7 +10308,7 @@ const SCREENS = runtimeSetting({
10286
10308
  }
10287
10309
  },
10288
10310
  "modifiers": {
10289
- "hiddenPath": "$service:himiStoreAccount.hideAppleSignIn"
10311
+ "hiddenPath": "$service:himiStoreAccount.hideAppleLegacyButton"
10290
10312
  }
10291
10313
  },
10292
10314
  {
@@ -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" });
@@ -7694,6 +7694,28 @@ const SCREENS = runtimeSetting({
7694
7694
  "children": [
7695
7695
  {
7696
7696
  "id": "himi_sign_in.social_apple",
7697
+ "body": {
7698
+ "package": "himalaya",
7699
+ "type": "Button",
7700
+ "props": {
7701
+ "title": "Continue with Apple",
7702
+ "style": "appleSignIn",
7703
+ "fullWidth": true,
7704
+ "disabledPath": "$service:himiStoreAccount.authBusy",
7705
+ "action": {
7706
+ "actionId": "tier5.himiStoreAccount.signInWithSocial",
7707
+ "params": {
7708
+ "provider": "apple"
7709
+ }
7710
+ }
7711
+ }
7712
+ },
7713
+ "modifiers": {
7714
+ "hiddenPath": "$service:himiStoreAccount.hideAppleSystemButton"
7715
+ }
7716
+ },
7717
+ {
7718
+ "id": "himi_sign_in.social_apple_legacy",
7697
7719
  "body": {
7698
7720
  "package": "himalaya",
7699
7721
  "type": "Button",
@@ -7711,7 +7733,7 @@ const SCREENS = runtimeSetting({
7711
7733
  }
7712
7734
  },
7713
7735
  "modifiers": {
7714
- "hiddenPath": "$service:himiStoreAccount.hideAppleSignIn"
7736
+ "hiddenPath": "$service:himiStoreAccount.hideAppleLegacyButton"
7715
7737
  }
7716
7738
  },
7717
7739
  {
@@ -8154,7 +8176,8 @@ const SCREENS = runtimeSetting({
8154
8176
  "integrity": "",
8155
8177
  "contentType": "application/javascript+ts-bundle",
8156
8178
  "declaredCapabilities": [
8157
- "wix_api"
8179
+ "wix_api",
8180
+ "app_info"
8158
8181
  ],
8159
8182
  "minBinaryVersion": "1.7.0",
8160
8183
  "bundleVersion": "0.0.1"