@wix/himalaya-cli 0.1776.0 → 0.1777.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 (34) hide show
  1. package/dist/cli.mjs +62 -8
  2. package/guides/himi-json-output.md +4 -1
  3. package/guides/one-app-to-himi-app.md +8 -3
  4. package/package.json +2 -2
  5. package/templates/beauty-salon/dev/index.ts +2 -2
  6. package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +55 -3
  7. package/templates/branded-lite/dev/index.ts +2 -2
  8. package/templates/branded-lite/tier5-src/himi-store-account/index.ts +55 -3
  9. package/templates/brandy/tier5-src/himi-store-account/index.ts +55 -3
  10. package/templates/community-club/dev/index.ts +2 -2
  11. package/templates/community-club/tier5-src/himi-store-account/index.ts +55 -3
  12. package/templates/conference/tier5-src/himi-store-account/index.ts +55 -3
  13. package/templates/events-meetups/dev/index.ts +2 -2
  14. package/templates/events-meetups/tier5-src/himi-store-account/index.ts +55 -3
  15. package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +55 -3
  16. package/templates/gym-fitness/dev/index.ts +2 -2
  17. package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +55 -3
  18. package/templates/medical-services/tier5-src/himi-store-account/index.ts +55 -3
  19. package/templates/nonprofit-cause/dev/index.ts +2 -2
  20. package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +55 -3
  21. package/templates/personal-fitness-trainer/dev/index.ts +2 -2
  22. package/templates/personal-fitness-trainer/tier5-src/himi-store-account/index.ts +55 -3
  23. package/templates/podcast-creator/dev/index.ts +2 -2
  24. package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +55 -3
  25. package/templates/portfolio-creative/dev/index.ts +2 -2
  26. package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +55 -3
  27. package/templates/restaurant/dev/index.ts +2 -2
  28. package/templates/restaurant/tier5-src/himi-store-account/index.ts +55 -3
  29. package/templates/retail-store/dev/index.ts +2 -2
  30. package/templates/retail-store/tier5-src/himi-store-account/index.ts +55 -3
  31. package/templates/salon-spa/tier5-src/himi-store-account/index.ts +55 -3
  32. package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +55 -3
  33. package/templates/yoga-studio/dev/index.ts +2 -2
  34. package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +55 -3
package/dist/cli.mjs CHANGED
@@ -40188,6 +40188,7 @@ function resolveIdiom(tokens2, ctx = {}) {
40188
40188
  var IDIOM_CONTEXTS, UNSAFE_KEYS;
40189
40189
  var init_idiom = __esm({
40190
40190
  "../../core/ts/src/idiom.ts"() {
40191
+ "use strict";
40191
40192
  init_define_HHP_CATALOG();
40192
40193
  IDIOM_CONTEXTS = {
40193
40194
  ios: { native: ["ios"] },
@@ -41923,6 +41924,7 @@ function shouldRevealError(args) {
41923
41924
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
41924
41925
  var init_validation = __esm({
41925
41926
  "../../core/ts/src/validation.ts"() {
41927
+ "use strict";
41926
41928
  init_define_HHP_CATALOG();
41927
41929
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
41928
41930
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
@@ -272966,6 +272968,47 @@ ${indent}` });
272966
272968
  const text32 = applyEdits(configText, edits);
272967
272969
  return { status: text32 === configText ? "unchanged" : "written", text: text32, bound: bound2, unlisted, home: home2 };
272968
272970
  }
272971
+ function loginWallGateScreen(configText, gateScreenId) {
272972
+ const file2 = parse10("config.ts", configText);
272973
+ const app2 = file2 && appObject(file2);
272974
+ const authProperty = app2 && findProperty(app2, "auth");
272975
+ const init = authProperty?.initializer;
272976
+ const wrapped = init && ts30.isCallExpression(init) && ts30.isIdentifier(init.expression) && init.expression.text === LOGIN_HELPER && init.arguments.length === 1;
272977
+ if (!file2 || !wrapped) return void 0;
272978
+ let own6;
272979
+ const visit = (node3) => {
272980
+ if (own6 !== void 0) return;
272981
+ if (ts30.isPropertyAssignment(node3) && propName6(node3.name) === "gateScreenId") {
272982
+ own6 = ts30.isStringLiteralLike(node3.initializer) ? node3.initializer.text : "author";
272983
+ return;
272984
+ }
272985
+ if (ts30.isShorthandPropertyAssignment(node3) && node3.name.text === "gateScreenId") {
272986
+ own6 = "author";
272987
+ return;
272988
+ }
272989
+ if (ts30.isSpreadAssignment(node3)) {
272990
+ own6 = "author";
272991
+ return;
272992
+ }
272993
+ const opaque2 = (expr) => ts30.isIdentifier(expr) || ts30.isPropertyAccessExpression(expr) || ts30.isElementAccessExpression(expr);
272994
+ if (ts30.isCallExpression(node3) && node3.arguments.some(opaque2)) {
272995
+ own6 = "author";
272996
+ return;
272997
+ }
272998
+ if (ts30.isPropertyAssignment(node3) && propName6(node3.name) === "config" && opaque2(node3.initializer)) {
272999
+ own6 = "author";
273000
+ return;
273001
+ }
273002
+ ts30.forEachChild(node3, visit);
273003
+ };
273004
+ visit(init);
273005
+ if (own6 !== void 0) return own6;
273006
+ const helper = file2.statements.find((statement) => ts30.isVariableStatement(statement) && statement.declarationList.declarations.some((declaration2) => ts30.isIdentifier(declaration2.name) && declaration2.name.text === LOGIN_HELPER));
273007
+ const text32 = helper?.getText(file2);
273008
+ if (text32 !== void 0 && gateScreenId && sameStatement(text32, loginHelperSource(gateScreenId))) return gateScreenId;
273009
+ if (text32 !== void 0 && sameStatement(text32, loginHelperSource())) return "stock";
273010
+ return "author";
273011
+ }
272969
273012
  function applyLoginWall(configText, wall, options2 = {}) {
272970
273013
  const refuse10 = (reason) => ({ status: "manual", text: configText, reason });
272971
273014
  const file2 = parse10("config.ts", configText);
@@ -272979,20 +273022,23 @@ function applyLoginWall(configText, wall, options2 = {}) {
272979
273022
  if (wrapped && options2.keepExisting) return { status: "unchanged", text: configText, kept: true };
272980
273023
  return wrapped ? refuse10("the app requires login (`requireLogin` in config.ts) but the source no longer does: remove it by hand, a login requirement is not taken out automatically") : { status: "unchanged", text: configText };
272981
273024
  }
272982
- if (wrapped) return { status: "unchanged", text: configText };
272983
- const declared = file2.statements.some((statement) => ts30.isVariableStatement(statement) && statement.declarationList.declarations.some((declaration2) => ts30.isIdentifier(declaration2.name) && declaration2.name.text === LOGIN_HELPER));
272984
- const edits = [{ start: init.getStart(), end: init.getEnd(), replacement: `${LOGIN_HELPER}(${init.getText(file2)})` }];
272985
- if (!declared) {
273025
+ const helper = file2.statements.find((statement) => ts30.isVariableStatement(statement) && statement.declarationList.declarations.some((declaration2) => ts30.isIdentifier(declaration2.name) && declaration2.name.text === LOGIN_HELPER));
273026
+ const edits = [];
273027
+ if (!wrapped) edits.push({ start: init.getStart(), end: init.getEnd(), replacement: `${LOGIN_HELPER}(${init.getText(file2)})` });
273028
+ if (!helper && wrapped) return { status: "unchanged", text: configText };
273029
+ if (!helper) {
272986
273030
  const imports = file2.statements.filter(ts30.isImportDeclaration);
272987
273031
  const at2 = imports.length ? imports[imports.length - 1].getEnd() : 0;
272988
273032
  edits.push({ start: at2, end: at2, replacement: `
272989
273033
 
272990
273034
  // The source asks for a login before any content (visitorModeEnabled = false), written by \`himi one-app access\`:
272991
273035
  // the runtime's login wall shows first, and a Visitor session does not pass it.
272992
- const ${LOGIN_HELPER} = <T extends { config?: Record<string, unknown> }>(auth: T): T => ({ ...auth, config: { ...auth.config, required: true } });
273036
+ ${loginHelperSource(options2.gateScreenId)}
272993
273037
  ` });
273038
+ } else if (options2.gateScreenId && sameStatement(helper.getText(file2), loginHelperSource())) {
273039
+ edits.push({ start: helper.getStart(file2), end: helper.getEnd(), replacement: loginHelperSource(options2.gateScreenId) });
272994
273040
  }
272995
- return { status: "written", text: applyEdits(configText, edits) };
273041
+ return edits.length ? { status: "written", text: applyEdits(configText, edits) } : { status: "unchanged", text: configText };
272996
273042
  }
272997
273043
  function tableGates(tableText) {
272998
273044
  const file2 = parse10("access-gates-table.ts", tableText);
@@ -273029,7 +273075,7 @@ function renderGateTable(gates) {
273029
273075
  ""
273030
273076
  ].join("\n");
273031
273077
  }
273032
- var obj14, text29, strings2, mayHide, STOCK_COPY, node2, SIGN_IN_SCREEN, CHAT_SCREEN, PLANS_SCREEN, slotPrefix, accessStatePath, accessRowHiddenPath, accessHiddenPath, slice, stringValue3, objectValue, PAYLOAD_KEYS, indented, LOGIN_HELPER, NEW_APP_REASON;
273078
+ var obj14, text29, strings2, mayHide, STOCK_COPY, node2, SIGN_IN_SCREEN, CHAT_SCREEN, PLANS_SCREEN, slotPrefix, accessStatePath, accessRowHiddenPath, accessHiddenPath, slice, stringValue3, objectValue, PAYLOAD_KEYS, indented, LOGIN_HELPER, LOGIN_GATE_SCREEN, sameStatement, loginHelperSource, NEW_APP_REASON;
273033
273079
  var init_access = __esm({
273034
273080
  "src/one-app/access.ts"() {
273035
273081
  init_define_HHP_CATALOG();
@@ -273065,6 +273111,9 @@ var init_access = __esm({
273065
273111
  indented = (value2, indent) => JSON.stringify(value2, null, 2).replaceAll("\n", `
273066
273112
  ${indent}`);
273067
273113
  LOGIN_HELPER = "requireLogin";
273114
+ LOGIN_GATE_SCREEN = "himi_sign_in";
273115
+ sameStatement = (a3, b3) => a3.replace(/\s+/g, " ").trim() === b3.replace(/\s+/g, " ").trim();
273116
+ loginHelperSource = (gateScreenId) => `const ${LOGIN_HELPER} = <T extends { config?: Record<string, unknown> }>(auth: T): T => ({ ...auth, config: { ${gateScreenId ? `gateScreenId: ${JSON.stringify(gateScreenId)}, ` : ""}...auth.config, required: true } });`;
273068
273117
  NEW_APP_REASON = "Page locks read app-level state through app services (`$app:`), which an app may use only when it has never shipped a binary older than the first one with app services (1.9.0). If this migrated app is new, pass --new-app and it declares `app: { newApp: true }`. If it has already shipped, locks must wait for the enforced runtime floor.";
273069
273118
  }
273070
273119
  });
@@ -273317,7 +273366,8 @@ async function runOneAppAccess(args, io2) {
273317
273366
  configEdit = applyConfig(configText, plan.gates, { newApp: options2.newApp, screensText });
273318
273367
  nextConfig = configEdit.text;
273319
273368
  }
273320
- const wallEdit = decision.wall ? applyLoginWall(nextConfig, decision.wall, { keepExisting: decision.basis === "evidence" }) : void 0;
273369
+ const gateScreenId = declaredScreens(screensText)?.has(LOGIN_GATE_SCREEN) ? LOGIN_GATE_SCREEN : void 0;
273370
+ const wallEdit = decision.wall ? applyLoginWall(nextConfig, decision.wall, { keepExisting: decision.basis === "evidence", ...gateScreenId ? { gateScreenId } : {} }) : void 0;
273321
273371
  const manual = [screensEdit, configEdit, wallEdit].find((edit) => edit?.status === "manual");
273322
273372
  if (manual) {
273323
273373
  const code2 = manual === configEdit && configEdit?.needsNewApp ? "app_services_unavailable" : "needs_manual_merge";
@@ -273331,6 +273381,10 @@ async function runOneAppAccess(args, io2) {
273331
273381
  // Not a guess: the web host gates only account-mode wix-native apps (core/web-host account-gate), so a web preview of a
273332
273382
  // consumer app opens as a Visitor. iOS and Android shells both enforce it (AuthGateRoot).
273333
273383
  ...decision.wall === "required" ? { enforcedOn: ["ios", "android"], notEnforcedOn: ["web"] } : {},
273384
+ // `gateScreen`: what the runtime shows first, read from the config the app now holds. `himi_sign_in` is the app's own
273385
+ // email and password screen; `stock` is the runtime's login, whose Sign In starts the hosted OAuth flow that a One App
273386
+ // binding with no client cannot run (the app then has no way in); `author` is a wall helper this command did not write.
273387
+ ...decision.wall === "required" ? { gateScreen: loginWallGateScreen(nextConfig, gateScreenId) ?? "stock" } : {},
273334
273388
  ...wallEdit?.kept ? { kept: true, keptNote: "The source does not require login, but the app already has a login wall (maybe chosen with --login-wall): it stays. Remove requireLogin by hand to drop it." } : {}
273335
273389
  };
273336
273390
  if (!hasGates && !loginWall.written) {
@@ -731,7 +731,10 @@ migrated app. Success prints `ok: true` and a `status`: `written`, `unchanged`,
731
731
  (`--check`) or `no_gates`; `unmapped` lists locked pages with no Himi screen, which are never guessed, and `loginWall`
732
732
  says `required`, `not_required` or `unknown` with its `basis` (`evidence`, `flag` or `none`); when it is `required` it also
733
733
  lists `enforcedOn` (`ios`, `android`) and `notEnforcedOn` (`web`: the web host enforces a wall only for its own account
734
- mode). `loginWall.kept` is true when the source does not require login but the app already has a wall (for example one chosen with `--login-wall required`): it stays, and only an explicit `--login-wall none` is refused. `homeEntries` lists the locked pages whose entry is the app's home destination: it stays on the bar behind its lock screen and is never hidden. `himi one-app migrate` adds
734
+ mode), and `gateScreen`, read from the config the app now holds: `himi_sign_in` when the wall names the app's own email and password
735
+ screen as its gate (`auth.config.gateScreenId`), `stock` when it names none and the runtime's stock gate shows (its Sign In starts
736
+ the hosted OAuth flow, which a One App binding with no client cannot run), or `author` when the wall's `requireLogin` helper is not
737
+ the one this command writes, so only its author can say. `loginWall.kept` is true when the source does not require login but the app already has a wall (for example one chosen with `--login-wall required`): it stays, and only an explicit `--login-wall none` is refused. `homeEntries` lists the locked pages whose entry is the app's home destination: it stays on the bar behind its lock screen and is never hidden. `himi one-app migrate` adds
735
738
  the warning `access_policy_unavailable` to the manifest when the source did not report the login setting. Failures print `ok: false` and a top-level `code`
736
739
  on stderr.
737
740
 
@@ -1715,8 +1715,11 @@ as the site's Visitor (no owner login) and saves it as `access-policy.json`, bou
1715
1715
  supporting context: when the source does not report it, the value is `null` and the manifest warns
1716
1716
  (`access_policy_unavailable`); unknown is never read as either answer. `himi one-app access` then turns the app's own
1717
1717
  login wall on when the source requires login: `auth` in `config.ts` becomes `requireLogin(...)`, a one-line helper
1718
- written beside the imports that sets `required: true` on the provider block. With the wall on, the app shows the sign-in
1719
- (the stock one, or your own gate screen) before any content, and a Visitor session does not pass it. The command never
1718
+ written beside the imports that sets `required: true` on the provider block. With the wall on, the app shows a sign-in before any content, and a Visitor session does not pass it. When the app has its own
1719
+ `himi_sign_in` screen (the template ships it: email and password, in the app's language) the wall also names it as the gate screen
1720
+ (`auth.config.gateScreenId`), so a member signs in there. The output's `loginWall.gateScreen` reports what the config now carries: `himi_sign_in`, `stock`, or `author` when the `requireLogin` helper is not the one this command writes (imported, a function, or edited by hand: check that it names the gate screen). Without it the stock gate shows,
1721
+ in English, and its Sign In starts the hosted OAuth flow, which a One App binding with no client cannot run: the app would have
1722
+ no way in. A `requireLogin` an earlier run wrote, exactly as written, is upgraded in place; a helper you edited or wrote is never rewritten, and a `gateScreenId` you set yourself is kept. The command never
1720
1723
  takes a wall out (`needs_manual_merge`): dropping a login requirement is yours to decide. For evidence collected before
1721
1724
  the setting was recorded, or when the owner tells you, decide it explicitly with `--login-wall required|none`; the
1722
1725
  explicit choice wins over the evidence. The wall works with or without locked pages.
@@ -1789,7 +1792,9 @@ Every surface reads the site with it: the native apps, the hosted draft preview,
1789
1792
  `himi run`, `himi render --live` and `himi test --record`. On iOS and Android the same
1790
1793
  binding also signs a site member in with email and password (the Branded app's own
1791
1794
  member flow), still without a client. Google sign-in, registration, password reset and change, and member
1792
- sign-in on the web still need a Headless OAuth client.
1795
+ sign-in on the web still need a Headless OAuth client; the app's sign-in screen hides Create account and Forgot password for a binding
1796
+ with no client (the native host answers `himi.wix.memberFlows`), so no link leads to a flow that would fail. Write that gap in the migration report (what members cannot do until the owner agrees to a client: sign up,
1797
+ Google sign-in, password reset), and do not create a client unasked.
1793
1798
 
1794
1799
  **Only when the site owner wants those (Google, registration, web member sign-in)**, and with their agreement,
1795
1800
  resolve the site's mobile OAuth client with the existing idempotent command (it is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1776.0",
3
+ "version": "0.1777.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -82,5 +82,5 @@
82
82
  "artifactId": "himalaya-cli"
83
83
  }
84
84
  },
85
- "falconPackageHash": "5470b6ff7d0c975413b8e584a989523ac84b4e8834595d0aa2f86c13"
85
+ "falconPackageHash": "526276f3d51152c07a86bd04e34b132d64023f2f15ecd57f07110b6e"
86
86
  }
@@ -6464,7 +6464,7 @@ const SCREENS = runtimeSetting({
6464
6464
  }
6465
6465
  },
6466
6466
  "modifiers": {
6467
- "hiddenPath": "$service:himiStoreAccount.hideSignInChoices"
6467
+ "hiddenPath": "$service:himiStoreAccount.hideShowRegister"
6468
6468
  }
6469
6469
  },
6470
6470
  {
@@ -6521,7 +6521,7 @@ const SCREENS = runtimeSetting({
6521
6521
  }
6522
6522
  },
6523
6523
  "modifiers": {
6524
- "hiddenPath": "$service:himiStoreAccount.hideSignInChoices"
6524
+ "hiddenPath": "$service:himiStoreAccount.hideShowRecovery"
6525
6525
  }
6526
6526
  }
6527
6527
  ]
@@ -278,7 +278,7 @@ const NO_VISIT = {
278
278
  const VISIT_KEYS = Object.keys(NO_VISIT) as (keyof typeof NO_VISIT)[];
279
279
  /** What derive() computes from the visit keys. Hydration copies keys without re-deriving,
280
280
  * so these stay out of the snapshot with them, or the first paint mixes two visits. */
281
- const VISIT_DERIVED_KEYS = ["notRegistering", "notRecovering", "hideSignInChoices", "authTitle", "authBody",
281
+ const VISIT_DERIVED_KEYS = ["notRegistering", "notRecovering", "hideSignInChoices", "hideShowRegister", "hideShowRecovery", "authTitle", "authBody",
282
282
  "hasReturnPath", "noReturnPath", "returnCta"] as const;
283
283
 
284
284
  // Actions are not serialized: two quick Sign in taps both run against the pre-tap
@@ -321,7 +321,7 @@ function appearBase(): Partial<S> {
321
321
  pollIdentity: pollIdentityRequested,
322
322
  restorePurchases: restorePurchasesRequested,
323
323
  // One `_poll` per state: Account polls identity and never shows the social block.
324
- ...(pollIdentityRequested ? { _poll: { ...IDENTITY_POLL } } : socialRetriesLeft > 0 ? { _poll: { ...SOCIAL_POLL } } : {}),
324
+ ...(pollIdentityRequested ? { _poll: { ...IDENTITY_POLL } } : socialRetriesLeft > 0 || flowsRetriesLeft > 0 ? { _poll: { ...SOCIAL_POLL } } : {}),
325
325
  };
326
326
  }
327
327
 
@@ -433,12 +433,46 @@ function applySocialProviders(read: SocialProvidersRead): void {
433
433
  if (read.ok) socialProviders = read.providers;
434
434
  }
435
435
 
436
+ // Which member flows this binding can run (the host's `himi.wix.memberFlows`). A One App binding with no Headless OAuth client
437
+ // signs members in with email and password only, so Create account and Forgot password would fail: the form hides them. Module
438
+ // state like the providers above. A host without the action (web, an older binary) never answers, and the form keeps both,
439
+ // exactly what it showed before.
440
+ let signUpAvailable = true;
441
+ let passwordResetAvailable = true;
442
+
443
+ /** `notReady`: the host said `unavailable` (its auth boot has not wired the provider yet), so the answer is worth asking for again. */
444
+ type MemberFlowsRead = { ok: true; signUp: boolean; passwordReset: boolean } | { ok: false; notReady: boolean };
445
+
446
+ async function readMemberFlows(): Promise<MemberFlowsRead> {
447
+ try {
448
+ const raw = await dispatch("himi.wix.memberFlows") as { status?: unknown; payload?: Record<string, unknown>; signUp?: unknown; passwordReset?: unknown } | null;
449
+ const answer = raw?.payload ?? raw;
450
+ return typeof answer?.signUp === "boolean" && typeof answer?.passwordReset === "boolean"
451
+ ? { ok: true, signUp: answer.signUp, passwordReset: answer.passwordReset }
452
+ : { ok: false, notReady: raw?.status === "unavailable" };
453
+ } catch {
454
+ return { ok: false, notReady: false };
455
+ }
456
+ }
457
+
458
+ /** A failed or missing read keeps what the last read showed (both flows until a host says otherwise). */
459
+ function applyMemberFlows(read: MemberFlowsRead): void {
460
+ if (read.ok) { signUpAvailable = read.signUp; passwordResetAvailable = read.passwordReset; }
461
+ }
462
+
436
463
  // An empty list is also what the host answers before its auth boot has wired the provider (a
437
464
  // cold launch straight onto the form), so it is re-read on a short poll; a site with no social
438
465
  // login stops after a few reads.
439
466
  const SOCIAL_POLL = { id: "himi-account-social", intervalMs: 1500, action: "himiStoreAccount.refreshSocial" };
440
467
  const SOCIAL_RETRIES = 4;
441
468
  let socialRetriesLeft = 0;
469
+ // The member flows are read on the same short poll: before the host's auth boot has wired the provider (a cold launch straight
470
+ // onto the gate screen) it answers `unavailable` and is asked again; a host that does not know the verb (web, an older binary) is not.
471
+ let flowsRetriesLeft = 0;
472
+
473
+ function armFlowsRetry(read: MemberFlowsRead): void {
474
+ flowsRetriesLeft = !read.ok && read.notReady ? SOCIAL_RETRIES : 0;
475
+ }
442
476
 
443
477
  function armSocialRetry(read: SocialProvidersRead): void {
444
478
  if (read.ok) socialRetriesLeft = read.providers.length ? 0 : SOCIAL_RETRIES;
@@ -450,8 +484,14 @@ async function refreshSocial(): Promise<S> {
450
484
  applySocialProviders(await readSocialProviders());
451
485
  if (socialProviders.length) socialRetriesLeft = 0;
452
486
  }
487
+ if (flowsRetriesLeft > 0) {
488
+ flowsRetriesLeft -= 1;
489
+ const flows = await readMemberFlows();
490
+ applyMemberFlows(flows);
491
+ if (flows.ok || !flows.notReady) flowsRetriesLeft = 0;
492
+ }
453
493
  const current = svc.getState();
454
- return derive({ ...current, ...(socialRetriesLeft > 0 ? {} : { _poll: { id: SOCIAL_POLL.id, stop: true } }) });
494
+ return derive({ ...current, ...(socialRetriesLeft > 0 || flowsRetriesLeft > 0 ? {} : { _poll: { id: SOCIAL_POLL.id, stop: true } }) });
455
495
  }
456
496
 
457
497
  function socialCancelled(raw: unknown): boolean {
@@ -664,6 +704,10 @@ interface S extends IapRestoreFields {
664
704
  isRecovering: boolean;
665
705
  notRecovering: boolean;
666
706
  hideSignInChoices: boolean;
707
+ /** The form's Create account / Forgot password links: hidden while registering or recovering, and when the binding
708
+ * cannot run the flow (`himi.wix.memberFlows`). */
709
+ hideShowRegister: boolean;
710
+ hideShowRecovery: boolean;
667
711
  hideAppleSignIn: boolean;
668
712
  hideGoogleSignIn: boolean;
669
713
  /** The social block and its "or" divider: no provider to show, or resetting a password. */
@@ -755,6 +799,8 @@ function derive(s: S): S {
755
799
  isRecovering,
756
800
  notRecovering: !isRecovering,
757
801
  hideSignInChoices: isRegistering || isRecovering,
802
+ hideShowRegister: isRegistering || isRecovering || !signUpAvailable,
803
+ hideShowRecovery: isRegistering || isRecovering || !passwordResetAvailable,
758
804
  hideAppleSignIn: !socialProviders.includes("apple"),
759
805
  hideGoogleSignIn: !socialProviders.includes("google"),
760
806
  hideSocialSignIn: isRecovering || socialProviders.length === 0,
@@ -833,9 +879,13 @@ async function probe(s: S, arg?: unknown, config: AppearConfig = appearConfig(s,
833
879
  // snapshot restored, not a 0 that would empty the badge until the appear refresh lands.
834
880
  const cartCountRead = cartCountRequested ? cartItemCount(s.cartCount ?? 0) : Promise.resolve(s.cartCount ?? 0);
835
881
  const socialRead: Promise<SocialProvidersRead> = standaloneRequested ? readSocialProviders() : Promise.resolve({ ok: false });
882
+ const flowsRead: Promise<MemberFlowsRead> = standaloneRequested ? readMemberFlows() : Promise.resolve({ ok: false, notReady: false });
836
883
  const profile = await loadMemberProfile(copyParam("storeAccount.guestDetail", "Sign in to keep your cart and orders connected."));
837
884
  const social = await socialRead;
838
885
  applySocialProviders(social);
886
+ const flows = await flowsRead;
887
+ applyMemberFlows(flows);
888
+ armFlowsRetry(flows);
839
889
  armSocialRetry(social);
840
890
  // Not the boot load: it never carries the copy, and the appear refresh that does is coming.
841
891
  if (strField(arg, "boot") !== "1") headingReady = true;
@@ -965,6 +1015,8 @@ const svc = defineService<S, {
965
1015
  isRecovering: false,
966
1016
  notRecovering: true,
967
1017
  hideSignInChoices: false,
1018
+ hideShowRegister: false,
1019
+ hideShowRecovery: false,
968
1020
  hideAppleSignIn: true,
969
1021
  hideGoogleSignIn: true,
970
1022
  hideSocialSignIn: true,
@@ -7962,7 +7962,7 @@ const SCREENS = runtimeSetting({
7962
7962
  }
7963
7963
  },
7964
7964
  "modifiers": {
7965
- "hiddenPath": "$service:himiStoreAccount.hideSignInChoices"
7965
+ "hiddenPath": "$service:himiStoreAccount.hideShowRegister"
7966
7966
  }
7967
7967
  },
7968
7968
  {
@@ -8019,7 +8019,7 @@ const SCREENS = runtimeSetting({
8019
8019
  }
8020
8020
  },
8021
8021
  "modifiers": {
8022
- "hiddenPath": "$service:himiStoreAccount.hideSignInChoices"
8022
+ "hiddenPath": "$service:himiStoreAccount.hideShowRecovery"
8023
8023
  }
8024
8024
  }
8025
8025
  ]
@@ -278,7 +278,7 @@ const NO_VISIT = {
278
278
  const VISIT_KEYS = Object.keys(NO_VISIT) as (keyof typeof NO_VISIT)[];
279
279
  /** What derive() computes from the visit keys. Hydration copies keys without re-deriving,
280
280
  * so these stay out of the snapshot with them, or the first paint mixes two visits. */
281
- const VISIT_DERIVED_KEYS = ["notRegistering", "notRecovering", "hideSignInChoices", "authTitle", "authBody",
281
+ const VISIT_DERIVED_KEYS = ["notRegistering", "notRecovering", "hideSignInChoices", "hideShowRegister", "hideShowRecovery", "authTitle", "authBody",
282
282
  "hasReturnPath", "noReturnPath", "returnCta"] as const;
283
283
 
284
284
  // Actions are not serialized: two quick Sign in taps both run against the pre-tap
@@ -321,7 +321,7 @@ function appearBase(): Partial<S> {
321
321
  pollIdentity: pollIdentityRequested,
322
322
  restorePurchases: restorePurchasesRequested,
323
323
  // One `_poll` per state: Account polls identity and never shows the social block.
324
- ...(pollIdentityRequested ? { _poll: { ...IDENTITY_POLL } } : socialRetriesLeft > 0 ? { _poll: { ...SOCIAL_POLL } } : {}),
324
+ ...(pollIdentityRequested ? { _poll: { ...IDENTITY_POLL } } : socialRetriesLeft > 0 || flowsRetriesLeft > 0 ? { _poll: { ...SOCIAL_POLL } } : {}),
325
325
  };
326
326
  }
327
327
 
@@ -433,12 +433,46 @@ function applySocialProviders(read: SocialProvidersRead): void {
433
433
  if (read.ok) socialProviders = read.providers;
434
434
  }
435
435
 
436
+ // Which member flows this binding can run (the host's `himi.wix.memberFlows`). A One App binding with no Headless OAuth client
437
+ // signs members in with email and password only, so Create account and Forgot password would fail: the form hides them. Module
438
+ // state like the providers above. A host without the action (web, an older binary) never answers, and the form keeps both,
439
+ // exactly what it showed before.
440
+ let signUpAvailable = true;
441
+ let passwordResetAvailable = true;
442
+
443
+ /** `notReady`: the host said `unavailable` (its auth boot has not wired the provider yet), so the answer is worth asking for again. */
444
+ type MemberFlowsRead = { ok: true; signUp: boolean; passwordReset: boolean } | { ok: false; notReady: boolean };
445
+
446
+ async function readMemberFlows(): Promise<MemberFlowsRead> {
447
+ try {
448
+ const raw = await dispatch("himi.wix.memberFlows") as { status?: unknown; payload?: Record<string, unknown>; signUp?: unknown; passwordReset?: unknown } | null;
449
+ const answer = raw?.payload ?? raw;
450
+ return typeof answer?.signUp === "boolean" && typeof answer?.passwordReset === "boolean"
451
+ ? { ok: true, signUp: answer.signUp, passwordReset: answer.passwordReset }
452
+ : { ok: false, notReady: raw?.status === "unavailable" };
453
+ } catch {
454
+ return { ok: false, notReady: false };
455
+ }
456
+ }
457
+
458
+ /** A failed or missing read keeps what the last read showed (both flows until a host says otherwise). */
459
+ function applyMemberFlows(read: MemberFlowsRead): void {
460
+ if (read.ok) { signUpAvailable = read.signUp; passwordResetAvailable = read.passwordReset; }
461
+ }
462
+
436
463
  // An empty list is also what the host answers before its auth boot has wired the provider (a
437
464
  // cold launch straight onto the form), so it is re-read on a short poll; a site with no social
438
465
  // login stops after a few reads.
439
466
  const SOCIAL_POLL = { id: "himi-account-social", intervalMs: 1500, action: "himiStoreAccount.refreshSocial" };
440
467
  const SOCIAL_RETRIES = 4;
441
468
  let socialRetriesLeft = 0;
469
+ // The member flows are read on the same short poll: before the host's auth boot has wired the provider (a cold launch straight
470
+ // onto the gate screen) it answers `unavailable` and is asked again; a host that does not know the verb (web, an older binary) is not.
471
+ let flowsRetriesLeft = 0;
472
+
473
+ function armFlowsRetry(read: MemberFlowsRead): void {
474
+ flowsRetriesLeft = !read.ok && read.notReady ? SOCIAL_RETRIES : 0;
475
+ }
442
476
 
443
477
  function armSocialRetry(read: SocialProvidersRead): void {
444
478
  if (read.ok) socialRetriesLeft = read.providers.length ? 0 : SOCIAL_RETRIES;
@@ -450,8 +484,14 @@ async function refreshSocial(): Promise<S> {
450
484
  applySocialProviders(await readSocialProviders());
451
485
  if (socialProviders.length) socialRetriesLeft = 0;
452
486
  }
487
+ if (flowsRetriesLeft > 0) {
488
+ flowsRetriesLeft -= 1;
489
+ const flows = await readMemberFlows();
490
+ applyMemberFlows(flows);
491
+ if (flows.ok || !flows.notReady) flowsRetriesLeft = 0;
492
+ }
453
493
  const current = svc.getState();
454
- return derive({ ...current, ...(socialRetriesLeft > 0 ? {} : { _poll: { id: SOCIAL_POLL.id, stop: true } }) });
494
+ return derive({ ...current, ...(socialRetriesLeft > 0 || flowsRetriesLeft > 0 ? {} : { _poll: { id: SOCIAL_POLL.id, stop: true } }) });
455
495
  }
456
496
 
457
497
  function socialCancelled(raw: unknown): boolean {
@@ -664,6 +704,10 @@ interface S extends IapRestoreFields {
664
704
  isRecovering: boolean;
665
705
  notRecovering: boolean;
666
706
  hideSignInChoices: boolean;
707
+ /** The form's Create account / Forgot password links: hidden while registering or recovering, and when the binding
708
+ * cannot run the flow (`himi.wix.memberFlows`). */
709
+ hideShowRegister: boolean;
710
+ hideShowRecovery: boolean;
667
711
  hideAppleSignIn: boolean;
668
712
  hideGoogleSignIn: boolean;
669
713
  /** The social block and its "or" divider: no provider to show, or resetting a password. */
@@ -755,6 +799,8 @@ function derive(s: S): S {
755
799
  isRecovering,
756
800
  notRecovering: !isRecovering,
757
801
  hideSignInChoices: isRegistering || isRecovering,
802
+ hideShowRegister: isRegistering || isRecovering || !signUpAvailable,
803
+ hideShowRecovery: isRegistering || isRecovering || !passwordResetAvailable,
758
804
  hideAppleSignIn: !socialProviders.includes("apple"),
759
805
  hideGoogleSignIn: !socialProviders.includes("google"),
760
806
  hideSocialSignIn: isRecovering || socialProviders.length === 0,
@@ -833,9 +879,13 @@ async function probe(s: S, arg?: unknown, config: AppearConfig = appearConfig(s,
833
879
  // snapshot restored, not a 0 that would empty the badge until the appear refresh lands.
834
880
  const cartCountRead = cartCountRequested ? cartItemCount(s.cartCount ?? 0) : Promise.resolve(s.cartCount ?? 0);
835
881
  const socialRead: Promise<SocialProvidersRead> = standaloneRequested ? readSocialProviders() : Promise.resolve({ ok: false });
882
+ const flowsRead: Promise<MemberFlowsRead> = standaloneRequested ? readMemberFlows() : Promise.resolve({ ok: false, notReady: false });
836
883
  const profile = await loadMemberProfile(copyParam("storeAccount.guestDetail", "Sign in to keep your cart and orders connected."));
837
884
  const social = await socialRead;
838
885
  applySocialProviders(social);
886
+ const flows = await flowsRead;
887
+ applyMemberFlows(flows);
888
+ armFlowsRetry(flows);
839
889
  armSocialRetry(social);
840
890
  // Not the boot load: it never carries the copy, and the appear refresh that does is coming.
841
891
  if (strField(arg, "boot") !== "1") headingReady = true;
@@ -965,6 +1015,8 @@ const svc = defineService<S, {
965
1015
  isRecovering: false,
966
1016
  notRecovering: true,
967
1017
  hideSignInChoices: false,
1018
+ hideShowRegister: false,
1019
+ hideShowRecovery: false,
968
1020
  hideAppleSignIn: true,
969
1021
  hideGoogleSignIn: true,
970
1022
  hideSocialSignIn: true,
@@ -278,7 +278,7 @@ const NO_VISIT = {
278
278
  const VISIT_KEYS = Object.keys(NO_VISIT) as (keyof typeof NO_VISIT)[];
279
279
  /** What derive() computes from the visit keys. Hydration copies keys without re-deriving,
280
280
  * so these stay out of the snapshot with them, or the first paint mixes two visits. */
281
- const VISIT_DERIVED_KEYS = ["notRegistering", "notRecovering", "hideSignInChoices", "authTitle", "authBody",
281
+ const VISIT_DERIVED_KEYS = ["notRegistering", "notRecovering", "hideSignInChoices", "hideShowRegister", "hideShowRecovery", "authTitle", "authBody",
282
282
  "hasReturnPath", "noReturnPath", "returnCta"] as const;
283
283
 
284
284
  // Actions are not serialized: two quick Sign in taps both run against the pre-tap
@@ -321,7 +321,7 @@ function appearBase(): Partial<S> {
321
321
  pollIdentity: pollIdentityRequested,
322
322
  restorePurchases: restorePurchasesRequested,
323
323
  // One `_poll` per state: Account polls identity and never shows the social block.
324
- ...(pollIdentityRequested ? { _poll: { ...IDENTITY_POLL } } : socialRetriesLeft > 0 ? { _poll: { ...SOCIAL_POLL } } : {}),
324
+ ...(pollIdentityRequested ? { _poll: { ...IDENTITY_POLL } } : socialRetriesLeft > 0 || flowsRetriesLeft > 0 ? { _poll: { ...SOCIAL_POLL } } : {}),
325
325
  };
326
326
  }
327
327
 
@@ -433,12 +433,46 @@ function applySocialProviders(read: SocialProvidersRead): void {
433
433
  if (read.ok) socialProviders = read.providers;
434
434
  }
435
435
 
436
+ // Which member flows this binding can run (the host's `himi.wix.memberFlows`). A One App binding with no Headless OAuth client
437
+ // signs members in with email and password only, so Create account and Forgot password would fail: the form hides them. Module
438
+ // state like the providers above. A host without the action (web, an older binary) never answers, and the form keeps both,
439
+ // exactly what it showed before.
440
+ let signUpAvailable = true;
441
+ let passwordResetAvailable = true;
442
+
443
+ /** `notReady`: the host said `unavailable` (its auth boot has not wired the provider yet), so the answer is worth asking for again. */
444
+ type MemberFlowsRead = { ok: true; signUp: boolean; passwordReset: boolean } | { ok: false; notReady: boolean };
445
+
446
+ async function readMemberFlows(): Promise<MemberFlowsRead> {
447
+ try {
448
+ const raw = await dispatch("himi.wix.memberFlows") as { status?: unknown; payload?: Record<string, unknown>; signUp?: unknown; passwordReset?: unknown } | null;
449
+ const answer = raw?.payload ?? raw;
450
+ return typeof answer?.signUp === "boolean" && typeof answer?.passwordReset === "boolean"
451
+ ? { ok: true, signUp: answer.signUp, passwordReset: answer.passwordReset }
452
+ : { ok: false, notReady: raw?.status === "unavailable" };
453
+ } catch {
454
+ return { ok: false, notReady: false };
455
+ }
456
+ }
457
+
458
+ /** A failed or missing read keeps what the last read showed (both flows until a host says otherwise). */
459
+ function applyMemberFlows(read: MemberFlowsRead): void {
460
+ if (read.ok) { signUpAvailable = read.signUp; passwordResetAvailable = read.passwordReset; }
461
+ }
462
+
436
463
  // An empty list is also what the host answers before its auth boot has wired the provider (a
437
464
  // cold launch straight onto the form), so it is re-read on a short poll; a site with no social
438
465
  // login stops after a few reads.
439
466
  const SOCIAL_POLL = { id: "himi-account-social", intervalMs: 1500, action: "himiStoreAccount.refreshSocial" };
440
467
  const SOCIAL_RETRIES = 4;
441
468
  let socialRetriesLeft = 0;
469
+ // The member flows are read on the same short poll: before the host's auth boot has wired the provider (a cold launch straight
470
+ // onto the gate screen) it answers `unavailable` and is asked again; a host that does not know the verb (web, an older binary) is not.
471
+ let flowsRetriesLeft = 0;
472
+
473
+ function armFlowsRetry(read: MemberFlowsRead): void {
474
+ flowsRetriesLeft = !read.ok && read.notReady ? SOCIAL_RETRIES : 0;
475
+ }
442
476
 
443
477
  function armSocialRetry(read: SocialProvidersRead): void {
444
478
  if (read.ok) socialRetriesLeft = read.providers.length ? 0 : SOCIAL_RETRIES;
@@ -450,8 +484,14 @@ async function refreshSocial(): Promise<S> {
450
484
  applySocialProviders(await readSocialProviders());
451
485
  if (socialProviders.length) socialRetriesLeft = 0;
452
486
  }
487
+ if (flowsRetriesLeft > 0) {
488
+ flowsRetriesLeft -= 1;
489
+ const flows = await readMemberFlows();
490
+ applyMemberFlows(flows);
491
+ if (flows.ok || !flows.notReady) flowsRetriesLeft = 0;
492
+ }
453
493
  const current = svc.getState();
454
- return derive({ ...current, ...(socialRetriesLeft > 0 ? {} : { _poll: { id: SOCIAL_POLL.id, stop: true } }) });
494
+ return derive({ ...current, ...(socialRetriesLeft > 0 || flowsRetriesLeft > 0 ? {} : { _poll: { id: SOCIAL_POLL.id, stop: true } }) });
455
495
  }
456
496
 
457
497
  function socialCancelled(raw: unknown): boolean {
@@ -664,6 +704,10 @@ interface S extends IapRestoreFields {
664
704
  isRecovering: boolean;
665
705
  notRecovering: boolean;
666
706
  hideSignInChoices: boolean;
707
+ /** The form's Create account / Forgot password links: hidden while registering or recovering, and when the binding
708
+ * cannot run the flow (`himi.wix.memberFlows`). */
709
+ hideShowRegister: boolean;
710
+ hideShowRecovery: boolean;
667
711
  hideAppleSignIn: boolean;
668
712
  hideGoogleSignIn: boolean;
669
713
  /** The social block and its "or" divider: no provider to show, or resetting a password. */
@@ -755,6 +799,8 @@ function derive(s: S): S {
755
799
  isRecovering,
756
800
  notRecovering: !isRecovering,
757
801
  hideSignInChoices: isRegistering || isRecovering,
802
+ hideShowRegister: isRegistering || isRecovering || !signUpAvailable,
803
+ hideShowRecovery: isRegistering || isRecovering || !passwordResetAvailable,
758
804
  hideAppleSignIn: !socialProviders.includes("apple"),
759
805
  hideGoogleSignIn: !socialProviders.includes("google"),
760
806
  hideSocialSignIn: isRecovering || socialProviders.length === 0,
@@ -833,9 +879,13 @@ async function probe(s: S, arg?: unknown, config: AppearConfig = appearConfig(s,
833
879
  // snapshot restored, not a 0 that would empty the badge until the appear refresh lands.
834
880
  const cartCountRead = cartCountRequested ? cartItemCount(s.cartCount ?? 0) : Promise.resolve(s.cartCount ?? 0);
835
881
  const socialRead: Promise<SocialProvidersRead> = standaloneRequested ? readSocialProviders() : Promise.resolve({ ok: false });
882
+ const flowsRead: Promise<MemberFlowsRead> = standaloneRequested ? readMemberFlows() : Promise.resolve({ ok: false, notReady: false });
836
883
  const profile = await loadMemberProfile(copyParam("storeAccount.guestDetail", "Sign in to keep your cart and orders connected."));
837
884
  const social = await socialRead;
838
885
  applySocialProviders(social);
886
+ const flows = await flowsRead;
887
+ applyMemberFlows(flows);
888
+ armFlowsRetry(flows);
839
889
  armSocialRetry(social);
840
890
  // Not the boot load: it never carries the copy, and the appear refresh that does is coming.
841
891
  if (strField(arg, "boot") !== "1") headingReady = true;
@@ -965,6 +1015,8 @@ const svc = defineService<S, {
965
1015
  isRecovering: false,
966
1016
  notRecovering: true,
967
1017
  hideSignInChoices: false,
1018
+ hideShowRegister: false,
1019
+ hideShowRecovery: false,
968
1020
  hideAppleSignIn: true,
969
1021
  hideGoogleSignIn: true,
970
1022
  hideSocialSignIn: true,
@@ -5600,7 +5600,7 @@ const SCREENS = runtimeSetting({
5600
5600
  }
5601
5601
  },
5602
5602
  "modifiers": {
5603
- "hiddenPath": "$service:himiStoreAccount.hideSignInChoices"
5603
+ "hiddenPath": "$service:himiStoreAccount.hideShowRegister"
5604
5604
  }
5605
5605
  },
5606
5606
  {
@@ -5657,7 +5657,7 @@ const SCREENS = runtimeSetting({
5657
5657
  }
5658
5658
  },
5659
5659
  "modifiers": {
5660
- "hiddenPath": "$service:himiStoreAccount.hideSignInChoices"
5660
+ "hiddenPath": "$service:himiStoreAccount.hideShowRecovery"
5661
5661
  }
5662
5662
  }
5663
5663
  ]