@wix/himalaya-cli 0.1751.0 → 0.1752.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 (25) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +1 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +3 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +16 -1
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/auth-providers/wix/src/index.d.ts +1 -1
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/auth-providers/wix/src/native-engine.d.ts +49 -3
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/copy.generated.d.ts +16 -1
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/feedback.d.ts +1 -1
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/auth.mjs +27 -2
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +27 -2
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +1 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-auth/worker.mjs +133 -13
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-auth.mjs +139 -13
  13. package/dist/browser-plane/assets.json +5 -5
  14. package/dist/browser-plane/preview-deferred/{21f35a12bd94f4ab97a9a75453c4adcadc438daf024a4b1950d5c356c123bd01.bin → 2671d1cadb15daa5e59440f4c924e30c221ab3d405e8a56a0ab1cdbe4764af3d.bin} +1 -1
  15. package/dist/browser-plane/sw.js +1 -1
  16. package/dist/cli.mjs +3876 -3340
  17. package/dist/preview-assets.generated.bin +0 -0
  18. package/guides/app-config.md +1 -1
  19. package/guides/himi-json-output.md +25 -3
  20. package/guides/push-cli-onboarding.md +13 -0
  21. package/guides/qa-builds.md +3 -1
  22. package/guides/releasing-with-himi-serve.md +51 -0
  23. package/guides/store-submission.md +46 -1
  24. package/package.json +2 -2
  25. package/templates/fitness-gym/tier5-src/himi-fitcoach-goal/index.ts +3 -4
@@ -139,6 +139,7 @@ export interface NavigationConfig {
139
139
  cashierConfig?: import("@wix/himalaya/core").CashierConfig;
140
140
  base44Config?: import("@wix/himalaya/core").Base44Config;
141
141
  wixIapConfig?: import("@wix/himalaya/core").WixIapConfig;
142
+ socialSignInConfig?: import("@wix/himalaya/core").SocialSignInConfig;
142
143
  contract?: import("./provisioning-facts.js").ServedReleaseContract;
143
144
  wixPlatformConfig?: WixPlatformConfig;
144
145
  devGatewayConfig?: DevGatewayConfig;
@@ -289,6 +289,9 @@ export interface DerivedAppMeta {
289
289
  /** Forwarded from AppConfig.wixIap — feeds the served `wixIapConfig`, which serve-control
290
290
  * projects into the dist contract's `native.iapBinding` (baked at build time, never OTA-read). */
291
291
  wixIap?: import("@wix/himalaya/core").WixIapConfig;
292
+ /** Forwarded from AppConfig.socialSignIn — feeds the served `socialSignInConfig`, which
293
+ * serve-control projects into the dist contract's `native.googleSignIn` (baked, never OTA-read). */
294
+ socialSignIn?: import("@wix/himalaya/core").SocialSignInConfig;
292
295
  /** Forwarded from AppConfig.wixPlatform — feeds the OTA `wixPlatformConfig`
293
296
  * block (RFC 0042 Phase 2 per-member productionization; read natively by
294
297
  * WixPlatformCapability at boot, like iapConfig). */
@@ -324,6 +324,12 @@ export interface AppConfig {
324
324
  * live. Absent ⇒ the app sells nothing through the App Store. See docs/iap-wix-checkout.md.
325
325
  */
326
326
  wixIap?: WixIapConfig;
327
+ /**
328
+ * The app's own OAuth client IDs for member social sign-in, baked into the binary by
329
+ * tools/native-config when the app declares `google_sign_in` (string literals only; never read
330
+ * over the air). Public IDs, no secrets, and no Wix connection IDs: Native Core resolves those.
331
+ */
332
+ socialSignIn?: SocialSignInConfig;
327
333
  /** Unified app-owned KV and Wix Data declaration. */
328
334
  data?: DataResourcesConfig;
329
335
  /**
@@ -887,7 +893,16 @@ export interface OrientationEnvelope {
887
893
  export declare const DEFAULT_ORIENTATION_ENVELOPE: Required<OrientationEnvelope>;
888
894
  /** Fill in the absent families. Total, so callers never branch on `undefined`. */
889
895
  export declare function resolveOrientationEnvelope(env?: OrientationEnvelope): Required<OrientationEnvelope>;
890
- export type Capability = "camera" | "barcode_scanner" | "biometrics" | "secure_storage" | "share" | "push" | "file_picker" | "files" | "open_url" | "pdf" | "clipboard" | "theme" | "l10n" | "photos" | "presigned_upload" | "ui" | "calendar" | "contacts" | "tasks" | "audio_record" | "audio_record_background" | "calls" | "location" | "location_background" | "motion" | "health" | "media_playback" | "webview" | "browser_auth" | "haptic" | "himi_apps" | "iap" | "keyboard" | "torch" | "network" | "wix_cashier" | "wix_chat" | "live_activity" | "local_database" | "speech" | "speaker_diarization" | "system_intents" | "on_device_ai" | "text_recognition" | "translation" | "image_labeling" | "barcode_detection" | "text_embedding" | "entity_extraction" | "app_info" | "release_control" | "legacy_import" | "godot" | "base44" | "animation" | "video_playback";
896
+ export type Capability = "camera" | "barcode_scanner" | "biometrics" | "secure_storage" | "share" | "push" | "file_picker" | "files" | "open_url" | "pdf" | "clipboard" | "theme" | "l10n" | "photos" | "presigned_upload" | "ui" | "calendar" | "contacts" | "tasks" | "audio_record" | "audio_record_background" | "calls" | "location" | "location_background" | "motion" | "health" | "media_playback" | "webview" | "browser_auth" | "haptic" | "himi_apps" | "iap" | "keyboard" | "torch" | "network" | "wix_cashier" | "wix_chat" | "live_activity" | "local_database" | "speech" | "speaker_diarization" | "system_intents" | "on_device_ai" | "text_recognition" | "translation" | "image_labeling" | "barcode_detection" | "text_embedding" | "entity_extraction" | "app_info" | "release_control" | "legacy_import" | "godot" | "base44" | "animation" | "video_playback" | "apple_sign_in" | "google_sign_in";
897
+ /** `defineApp({ socialSignIn })` — see AppConfig.socialSignIn. */
898
+ export interface SocialSignInConfig {
899
+ google?: {
900
+ /** The iOS OAuth client: Info.plist GIDClientID and the token audience on iOS. */
901
+ iosClientId?: string;
902
+ /** The WEB OAuth client Credential Manager mints the Android token for. */
903
+ serverClientId?: string;
904
+ };
905
+ }
891
906
  /** `defineApp({ wixIap })` — the purchases-service app a build binds this app to. */
892
907
  export interface WixIapConfig {
893
908
  /** The purchases service's app UUID, registered on the app's own auth site. Not a secret. */
@@ -1,7 +1,7 @@
1
1
  import type { AuthProvider } from "@wix/himalaya/core";
2
2
  import type { SocialAuthProvider } from "./native-engine.js";
3
3
  export { authorizeParams, authorizeUrl, dualDomainAuthorizeUrls, SESSION_BOUND_ACCESS_SCOPE, WIX_SESSION3_SOFT_INIT_SPEC, OAUTH_AUTHORIZE_ENDPOINT, type WixOAuthDomain, type AuthorizeParamsInput, } from "./oauth-params.js";
4
- export { WixNativeAuthEngine, NativeAuthError, type WixAccountSession, type RegistrationRequest, type SocialAuthProvider, type WixNativeAuthEngineConfig, } from "./native-engine.js";
4
+ export { WixNativeAuthEngine, NativeAuthError, VOICE_CALL_METHOD, twoFactorGateMethods, twoFactorResendForm, twoFactorWireMethod, shapeTwoFactorChallenge, legacyTwoFactorFailure, type TwoFactorChallenge, type WixAccountSession, type RegistrationRequest, type SocialAuthProvider, type WixNativeAuthEngineConfig, } from "./native-engine.js";
5
5
  export { SignedInstanceResolver, SignedInstanceError, InMemorySignedInstanceStorage, type SignedInstanceType, type SignedInstanceServiceResponse, type SignedInstanceRecord, type SignedInstanceFetcher, type SignedInstanceStorage, } from "./signed-instance-resolver.js";
6
6
  export { REDACTED, WIX_SENSITIVE_KEYS, isSensitiveKey, normalizeKey, redactHeaders as redactWixHeaders, redactCookieString, redactJson, redactBody, } from "./redaction.js";
7
7
  export { SessionIDService, InMemorySessionIDStore, bsiShouldRotate, localDayIndex, BSI_ROTATE_INTERVAL_MS, type SessionIDRecord, type SessionIDStore, } from "./session-id.js";
@@ -18,7 +18,15 @@ export interface WixAccountSession {
18
18
  refreshToken: string;
19
19
  signedInstance?: string;
20
20
  }
21
- export type NativeAuthErrorKind = "unsupported" | "invalidCredentials" | "needsTwoFactor" | "recaptchaRequired" | "emailInUse" | "network" | "cancelled" | "unknown";
21
+ export type NativeAuthErrorKind = "unsupported" | "invalidCredentials" | "needsTwoFactor" | "recaptchaRequired" | "emailInUse" | "network" | "cancelled"
22
+ /** Legacy 2FA 8004 — too many codes requested. */
23
+ | "rateLimited"
24
+ /** Legacy 2FA 8034 — the server could not send the code. */
25
+ | "deliveryFailed"
26
+ /** Legacy 2FA 8056 — SMS codes are not offered in the owner's region. */
27
+ | "smsRegionUnsupported"
28
+ /** Legacy 2FA 8002 — the pending verification expired; sign in again. */
29
+ | "verificationExpired" | "unknown";
22
30
  /** Error carrying a stable `kind` so UI maps it the same way on every platform.
23
31
  * `needsTwoFactor` is a control-flow signal (advance to the code screen). */
24
32
  export declare class NativeAuthError extends Error {
@@ -30,12 +38,16 @@ export declare class NativeAuthError extends Error {
30
38
  /** #4309 — the push challenge's id (digits), when the payload carried one: what
31
39
  * `WixAuthModalities.pollPushApproval` polls. */
32
40
  readonly verificationId?: string;
41
+ /** Where the code went (a masked phone or email), when the server named one. */
42
+ readonly twoFAHint?: string;
33
43
  constructor(kind: NativeAuthErrorKind, message: string, twoFAToken?: string, twoFAMethod?: string,
34
44
  /** Every enabled 2FA method (drives the picker when >1). */
35
45
  twoFAMethods?: string[],
36
46
  /** #4309 — the push challenge's id (digits), when the payload carried one: what
37
47
  * `WixAuthModalities.pollPushApproval` polls. */
38
- verificationId?: string);
48
+ verificationId?: string,
49
+ /** Where the code went (a masked phone or email), when the server named one. */
50
+ twoFAHint?: string);
39
51
  }
40
52
  export interface WixNativeAuthEngineConfig {
41
53
  baseURL?: string;
@@ -50,6 +62,33 @@ export interface WixNativeAuthEngineConfig {
50
62
  /** Injectable fetch for tests / non-browser hosts. Defaults to global fetch. */
51
63
  fetchImpl?: typeof fetch;
52
64
  }
65
+ /** The gate's id for "call me with the code". */
66
+ export declare const VOICE_CALL_METHOD = "VoiceCall";
67
+ /** A pending second factor as the gate shows it. */
68
+ export interface TwoFactorChallenge {
69
+ token: string;
70
+ method: string;
71
+ methods: string[];
72
+ hint?: string;
73
+ /** Email was challenged without being listed: re-send it without naming a method. */
74
+ emailUnlisted: boolean;
75
+ /** A push challenge's id (digits) — what `WixAuthModalities.pollPushApproval` polls. */
76
+ verificationId?: string;
77
+ }
78
+ /** The `twoFAMethod` a gate method is sent as: a call is the Phone factor. */
79
+ export declare const twoFactorWireMethod: (m: string) => string;
80
+ /** Every enabled method, plus the current one when the server challenged it without listing it
81
+ * (Email on a new-device login, or a fallback from Phone), plus `VoiceCall` after a phone method. */
82
+ export declare function twoFactorGateMethods(current: string, enabled: string[]): string[];
83
+ /** Shape a challenge payload. `requested` is the gate method that caused it (a call stays
84
+ * `VoiceCall` though the server answers `Phone`); a payload with no method list keeps `previous`'s. */
85
+ export declare function shapeTwoFactorChallenge(payload: Record<string, unknown>, requested: string, previous?: TwoFactorChallenge): TwoFactorChallenge;
86
+ /** The form `resend2facode` gets. An Email code challenged without Email listed is re-sent by the
87
+ * token's own method: the server reads a named `twoFAMethod` as a switch and refuses it. */
88
+ export declare function twoFactorResendForm(token: string, method: string, challenge?: TwoFactorChallenge): Record<string, string>;
89
+ /** What a legacy 2FA error code means, for the codes that are not a wrong code (8001/8005/8006/8008
90
+ * stay `invalidCredentials`). Undefined for any other code. */
91
+ export declare function legacyTwoFactorFailure(errorCode: unknown): NativeAuthError | undefined;
53
92
  export declare class WixNativeAuthEngine {
54
93
  private readonly baseURL;
55
94
  private readonly devMode;
@@ -63,7 +102,14 @@ export declare class WixNativeAuthEngine {
63
102
  signIn(email: string, password: string): Promise<WixAccountSession>;
64
103
  register(req: RegistrationRequest): Promise<WixAccountSession>;
65
104
  submitTwoFactor(token: string, code: string, method: string): Promise<WixAccountSession>;
66
- resendTwoFactor(token: string): Promise<void>;
105
+ private readonly challenges;
106
+ /** The challenge `token` stands for, as the gate shows it. */
107
+ twoFactorChallenge(token: string): TwoFactorChallenge | undefined;
108
+ /** Re-sends the 2FA code via `method` (default: the challenge's current one) — the same call
109
+ * switches to another method; `VoiceCall` asks for the Phone code by a call. Resolves to the
110
+ * new challenge (every send issues a new token), or undefined when the server named none.
111
+ * Rejects when the server refused to send: a failed resend must not read as "a new code was sent". */
112
+ resendTwoFactor(token: string, method?: string): Promise<TwoFactorChallenge | undefined>;
67
113
  sendPasswordReset(email: string): Promise<void>;
68
114
  socialExchange(provider: SocialAuthProvider, credential: Record<string, string>): Promise<WixAccountSession>;
69
115
  /** Owner / Wix-account login (one-app endpoint) — real, no captcha for non-PX
@@ -11,7 +11,6 @@ declare const _default: {
11
11
  readonly "auth.gate.forgotPassword": "Forgot password?";
12
12
  readonly "auth.gate.backToSignIn": "Back to sign in";
13
13
  readonly "auth.gate.continueWith": "Continue with {provider}";
14
- readonly "auth.gate.sendCodeVia": "Send code via";
15
14
  readonly "auth.gate.resendCode": "Didn't get it? Resend code";
16
15
  readonly "auth.gate.field.code": "Verification code";
17
16
  readonly "auth.gate.pushWaiting": "Approve the sign-in on your other device.";
@@ -23,6 +22,19 @@ declare const _default: {
23
22
  readonly "auth.gate.password.hide": "Hide password";
24
23
  readonly "auth.gate.notice.codeResent": "A new code was sent.";
25
24
  readonly "auth.gate.notice.codeSentVia": "Code sent via {method}.";
25
+ readonly "auth.gate.tryAnotherWay": "Try another way";
26
+ readonly "auth.gate.chooseAnotherWay": "Choose another way to verify";
27
+ readonly "auth.gate.method.sms": "SMS";
28
+ readonly "auth.gate.method.voice": "Phone call";
29
+ readonly "auth.gate.method.totp": "Authenticator app";
30
+ readonly "auth.gate.method.push": "Approve on another device";
31
+ readonly "auth.gate.codePrompt.sms": "We sent a code by SMS to {destination}.";
32
+ readonly "auth.gate.codePrompt.smsNoHint": "We sent a code to your phone by SMS.";
33
+ readonly "auth.gate.codePrompt.voice": "We're calling {destination} to read you a code.";
34
+ readonly "auth.gate.codePrompt.voiceNoHint": "We're calling your phone to read you a code.";
35
+ readonly "auth.gate.codePrompt.email": "We sent a code to {destination}.";
36
+ readonly "auth.gate.codePrompt.emailNoHint": "We sent a code to your email.";
37
+ readonly "auth.gate.codePrompt.totp": "Enter the code from your authenticator app.";
26
38
  readonly "auth.gate.notice.resetSent": "If that email is registered, a reset link is on its way.";
27
39
  readonly "auth.biometric.unlockWith": "Unlock with {method}";
28
40
  readonly "auth.biometric.orPassword": "or sign in with your password";
@@ -94,6 +106,9 @@ declare const _default: {
94
106
  readonly "auth.feedback.totp": "That code did not work. Enter the current code from your authenticator app.";
95
107
  readonly "auth.feedback.network": "We could not connect. Check your connection and try again.";
96
108
  readonly "auth.feedback.rate_limited": "Too many attempts. Wait a few minutes and try again.";
109
+ readonly "auth.feedback.delivery_failed": "We couldn't send the code. Try again, or try another way.";
110
+ readonly "auth.feedback.sms_region_unsupported": "SMS codes aren't available in your region. Try another way.";
111
+ readonly "auth.feedback.verification_expired": "This verification has expired. Go back and sign in again.";
97
112
  readonly "auth.feedback.unavailable": "This action is not available here. Use a supported sign-in method or open the app.";
98
113
  readonly "auth.feedback.cancelled": "Sign-in was cancelled. Try again when you are ready.";
99
114
  readonly "auth.feedback.verification_required": "Complete verification to continue, then try again.";
@@ -1,4 +1,4 @@
1
- export type AuthFailureCode = "invalid_input" | "invalid_credentials" | "registration_failed" | "invalid_code" | "expired_code" | "network" | "rate_limited" | "unavailable" | "cancelled" | "verification_required" | "unknown";
1
+ export type AuthFailureCode = "invalid_input" | "invalid_credentials" | "registration_failed" | "invalid_code" | "expired_code" | "network" | "rate_limited" | "unavailable" | "cancelled" | "verification_required" | "delivery_failed" | "sms_region_unsupported" | "verification_expired" | "unknown";
2
2
  export type AuthOperation = "signIn" | "register" | "reset" | "verify";
3
3
  export declare function authMessage(key: string, translate?: (key: string) => string | undefined): string;
4
4
  /** Only structured failure identities cross into UI copy. Never echo server/error text. */
@@ -136,7 +136,6 @@ var copy_generated_default = {
136
136
  "auth.gate.forgotPassword": "Forgot password?",
137
137
  "auth.gate.backToSignIn": "Back to sign in",
138
138
  "auth.gate.continueWith": "Continue with {provider}",
139
- "auth.gate.sendCodeVia": "Send code via",
140
139
  "auth.gate.resendCode": "Didn't get it? Resend code",
141
140
  "auth.gate.field.code": "Verification code",
142
141
  "auth.gate.pushWaiting": "Approve the sign-in on your other device.",
@@ -148,6 +147,19 @@ var copy_generated_default = {
148
147
  "auth.gate.password.hide": "Hide password",
149
148
  "auth.gate.notice.codeResent": "A new code was sent.",
150
149
  "auth.gate.notice.codeSentVia": "Code sent via {method}.",
150
+ "auth.gate.tryAnotherWay": "Try another way",
151
+ "auth.gate.chooseAnotherWay": "Choose another way to verify",
152
+ "auth.gate.method.sms": "SMS",
153
+ "auth.gate.method.voice": "Phone call",
154
+ "auth.gate.method.totp": "Authenticator app",
155
+ "auth.gate.method.push": "Approve on another device",
156
+ "auth.gate.codePrompt.sms": "We sent a code by SMS to {destination}.",
157
+ "auth.gate.codePrompt.smsNoHint": "We sent a code to your phone by SMS.",
158
+ "auth.gate.codePrompt.voice": "We're calling {destination} to read you a code.",
159
+ "auth.gate.codePrompt.voiceNoHint": "We're calling your phone to read you a code.",
160
+ "auth.gate.codePrompt.email": "We sent a code to {destination}.",
161
+ "auth.gate.codePrompt.emailNoHint": "We sent a code to your email.",
162
+ "auth.gate.codePrompt.totp": "Enter the code from your authenticator app.",
151
163
  "auth.gate.notice.resetSent": "If that email is registered, a reset link is on its way.",
152
164
  "auth.biometric.unlockWith": "Unlock with {method}",
153
165
  "auth.biometric.orPassword": "or sign in with your password",
@@ -219,6 +231,9 @@ var copy_generated_default = {
219
231
  "auth.feedback.totp": "That code did not work. Enter the current code from your authenticator app.",
220
232
  "auth.feedback.network": "We could not connect. Check your connection and try again.",
221
233
  "auth.feedback.rate_limited": "Too many attempts. Wait a few minutes and try again.",
234
+ "auth.feedback.delivery_failed": "We couldn't send the code. Try again, or try another way.",
235
+ "auth.feedback.sms_region_unsupported": "SMS codes aren't available in your region. Try another way.",
236
+ "auth.feedback.verification_expired": "This verification has expired. Go back and sign in again.",
222
237
  "auth.feedback.unavailable": "This action is not available here. Use a supported sign-in method or open the app.",
223
238
  "auth.feedback.cancelled": "Sign-in was cancelled. Try again when you are ready.",
224
239
  "auth.feedback.verification_required": "Complete verification to continue, then try again.",
@@ -248,6 +263,11 @@ var failureKeys = {
248
263
  unavailable: "auth.feedback.unavailable",
249
264
  cancelled: "auth.feedback.cancelled",
250
265
  verification_required: "auth.feedback.verification_required",
266
+ // A second factor's code could not be sent, SMS is not offered in the region, or the pending
267
+ // verification expired (Wix legacy 2FA 8034 / 8056 / 8002 — the native engines raise them).
268
+ delivery_failed: "auth.feedback.delivery_failed",
269
+ sms_region_unsupported: "auth.feedback.sms_region_unsupported",
270
+ verification_expired: "auth.feedback.verification_expired",
251
271
  unknown: "auth.feedback.unknown"
252
272
  };
253
273
  var codes = new Set(Object.keys(failureKeys));
@@ -265,7 +285,12 @@ var aliases = {
265
285
  RECAPTCHA_REQUIRED: "verification_required",
266
286
  INVALID_CODE: "invalid_code",
267
287
  EXPIRED_CODE: "expired_code",
268
- TOO_MANY_REQUESTS: "rate_limited"
288
+ TOO_MANY_REQUESTS: "rate_limited",
289
+ // The TS WixNativeAuthEngine's legacy-2FA kinds (8004 / 8034 / 8056 / 8002).
290
+ rateLimited: "rate_limited",
291
+ deliveryFailed: "delivery_failed",
292
+ smsRegionUnsupported: "sms_region_unsupported",
293
+ verificationExpired: "verification_expired"
269
294
  };
270
295
  var iamCredentialCodes = /* @__PURE__ */ new Set(["-19999", "-19976"]);
271
296
  function authMessage(key, translate) {
@@ -978,7 +978,6 @@ var copy_generated_default = {
978
978
  "auth.gate.forgotPassword": "Forgot password?",
979
979
  "auth.gate.backToSignIn": "Back to sign in",
980
980
  "auth.gate.continueWith": "Continue with {provider}",
981
- "auth.gate.sendCodeVia": "Send code via",
982
981
  "auth.gate.resendCode": "Didn't get it? Resend code",
983
982
  "auth.gate.field.code": "Verification code",
984
983
  "auth.gate.pushWaiting": "Approve the sign-in on your other device.",
@@ -990,6 +989,19 @@ var copy_generated_default = {
990
989
  "auth.gate.password.hide": "Hide password",
991
990
  "auth.gate.notice.codeResent": "A new code was sent.",
992
991
  "auth.gate.notice.codeSentVia": "Code sent via {method}.",
992
+ "auth.gate.tryAnotherWay": "Try another way",
993
+ "auth.gate.chooseAnotherWay": "Choose another way to verify",
994
+ "auth.gate.method.sms": "SMS",
995
+ "auth.gate.method.voice": "Phone call",
996
+ "auth.gate.method.totp": "Authenticator app",
997
+ "auth.gate.method.push": "Approve on another device",
998
+ "auth.gate.codePrompt.sms": "We sent a code by SMS to {destination}.",
999
+ "auth.gate.codePrompt.smsNoHint": "We sent a code to your phone by SMS.",
1000
+ "auth.gate.codePrompt.voice": "We're calling {destination} to read you a code.",
1001
+ "auth.gate.codePrompt.voiceNoHint": "We're calling your phone to read you a code.",
1002
+ "auth.gate.codePrompt.email": "We sent a code to {destination}.",
1003
+ "auth.gate.codePrompt.emailNoHint": "We sent a code to your email.",
1004
+ "auth.gate.codePrompt.totp": "Enter the code from your authenticator app.",
993
1005
  "auth.gate.notice.resetSent": "If that email is registered, a reset link is on its way.",
994
1006
  "auth.biometric.unlockWith": "Unlock with {method}",
995
1007
  "auth.biometric.orPassword": "or sign in with your password",
@@ -1061,6 +1073,9 @@ var copy_generated_default = {
1061
1073
  "auth.feedback.totp": "That code did not work. Enter the current code from your authenticator app.",
1062
1074
  "auth.feedback.network": "We could not connect. Check your connection and try again.",
1063
1075
  "auth.feedback.rate_limited": "Too many attempts. Wait a few minutes and try again.",
1076
+ "auth.feedback.delivery_failed": "We couldn't send the code. Try again, or try another way.",
1077
+ "auth.feedback.sms_region_unsupported": "SMS codes aren't available in your region. Try another way.",
1078
+ "auth.feedback.verification_expired": "This verification has expired. Go back and sign in again.",
1064
1079
  "auth.feedback.unavailable": "This action is not available here. Use a supported sign-in method or open the app.",
1065
1080
  "auth.feedback.cancelled": "Sign-in was cancelled. Try again when you are ready.",
1066
1081
  "auth.feedback.verification_required": "Complete verification to continue, then try again.",
@@ -1090,6 +1105,11 @@ var failureKeys = {
1090
1105
  unavailable: "auth.feedback.unavailable",
1091
1106
  cancelled: "auth.feedback.cancelled",
1092
1107
  verification_required: "auth.feedback.verification_required",
1108
+ // A second factor's code could not be sent, SMS is not offered in the region, or the pending
1109
+ // verification expired (Wix legacy 2FA 8034 / 8056 / 8002 — the native engines raise them).
1110
+ delivery_failed: "auth.feedback.delivery_failed",
1111
+ sms_region_unsupported: "auth.feedback.sms_region_unsupported",
1112
+ verification_expired: "auth.feedback.verification_expired",
1093
1113
  unknown: "auth.feedback.unknown"
1094
1114
  };
1095
1115
  var codes = new Set(Object.keys(failureKeys));
@@ -1107,7 +1127,12 @@ var aliases = {
1107
1127
  RECAPTCHA_REQUIRED: "verification_required",
1108
1128
  INVALID_CODE: "invalid_code",
1109
1129
  EXPIRED_CODE: "expired_code",
1110
- TOO_MANY_REQUESTS: "rate_limited"
1130
+ TOO_MANY_REQUESTS: "rate_limited",
1131
+ // The TS WixNativeAuthEngine's legacy-2FA kinds (8004 / 8034 / 8056 / 8002).
1132
+ rateLimited: "rate_limited",
1133
+ deliveryFailed: "delivery_failed",
1134
+ smsRegionUnsupported: "sms_region_unsupported",
1135
+ verificationExpired: "verification_expired"
1111
1136
  };
1112
1137
  var iamCredentialCodes = /* @__PURE__ */ new Set(["-19999", "-19976"]);
1113
1138
  function authMessage(key, translate) {
@@ -9807,6 +9807,7 @@ function deriveAppMeta(name, m, platforms = {}, provisioning = {}) {
9807
9807
  iap: config.iap,
9808
9808
  base44: config.base44,
9809
9809
  wixIap: config.wixIap,
9810
+ socialSignIn: config.socialSignIn,
9810
9811
  // RFC 0042 Phase 2 — optional per-app Wix Platform productionization block.
9811
9812
  // Read loosely (AppConfig in @himalaya/core doesn't type it yet) so apps can
9812
9813
  // opt in without a core-types bump; absent ⇒ all members keep the dev seam.
@@ -167,17 +167,74 @@ var DeviceAuthClient = class {
167
167
 
168
168
  // ../../stdlib/auth-providers/wix/src/native-engine.ts
169
169
  var NativeAuthError = class extends Error {
170
- constructor(kind, message, twoFAToken, twoFAMethod, twoFAMethods, verificationId) {
170
+ constructor(kind, message, twoFAToken, twoFAMethod, twoFAMethods, verificationId, twoFAHint) {
171
171
  super(message);
172
172
  this.kind = kind;
173
173
  this.twoFAToken = twoFAToken;
174
174
  this.twoFAMethod = twoFAMethod;
175
175
  this.twoFAMethods = twoFAMethods;
176
176
  this.verificationId = verificationId;
177
+ this.twoFAHint = twoFAHint;
177
178
  this.name = "NativeAuthError";
178
179
  }
179
180
  };
180
181
  var DEV_PASSWORD = "Passw0rd!";
182
+ var VOICE_CALL_METHOD = "VoiceCall";
183
+ var isPhoneMethod = (m) => ["phone", "sms"].includes(m.toLowerCase());
184
+ var isVoiceCallMethod = (m) => m.toLowerCase() === VOICE_CALL_METHOD.toLowerCase();
185
+ var twoFactorWireMethod = (m) => isVoiceCallMethod(m) ? "Phone" : m;
186
+ var nonBlank = (v) => typeof v === "string" && v.trim() ? v.trim() : void 0;
187
+ function twoFactorGateMethods(current, enabled) {
188
+ const out = [];
189
+ for (const m of [...enabled, current]) {
190
+ if (out.includes(m)) continue;
191
+ out.push(m);
192
+ if (isPhoneMethod(m) && !out.some(isVoiceCallMethod)) out.push(VOICE_CALL_METHOD);
193
+ }
194
+ return out;
195
+ }
196
+ function shapeTwoFactorChallenge(payload, requested, previous) {
197
+ const server = nonBlank(payload.currentTwoFAMethod) ?? twoFactorWireMethod(requested);
198
+ const method = isVoiceCallMethod(requested) && isPhoneMethod(server) ? VOICE_CALL_METHOD : server;
199
+ const enabled = Array.isArray(payload.enabledTwoFAMethods) ? payload.enabledTwoFAMethods.filter((m) => typeof m === "string" && m !== "") : void 0;
200
+ const inherited = previous && previous.emailUnlisted && server !== "Email" ? previous.methods.filter((m) => m.toLowerCase() !== "email") : previous?.methods;
201
+ const methods = enabled ? twoFactorGateMethods(server, enabled) : inherited ?? twoFactorGateMethods(server, []);
202
+ const raw = isPhoneMethod(server) ? nonBlank(payload.phoneHint) ?? nonBlank(payload.twoFAHint) : nonBlank(payload.twoFAHint);
203
+ const id = payload.verificationId;
204
+ const verificationId = (typeof id === "string" || typeof id === "number") && /^\d+$/.test(String(id)) ? String(id) : void 0;
205
+ return {
206
+ verificationId,
207
+ token: String(payload.twoFAToken ?? previous?.token ?? ""),
208
+ method,
209
+ methods: methods.includes(method) ? methods : [...methods, method],
210
+ hint: raw && !raw.startsWith("{") ? raw : void 0,
211
+ // With no list in the reply, Email is unlisted unless the previous challenge listed it — a send
212
+ // that fell back to Email (e.g. from SMS) is still a channel the server never offered.
213
+ emailUnlisted: server === "Email" && (enabled ? !enabled.includes("Email") : previous ? previous.emailUnlisted || !previous.methods.some((m) => m.toLowerCase() === "email") : true)
214
+ };
215
+ }
216
+ function twoFactorResendForm(token, method, challenge) {
217
+ const form = { twoFAToken: token };
218
+ const wire = twoFactorWireMethod(method);
219
+ if (!(challenge?.emailUnlisted && wire.toLowerCase() === "email")) form.twoFAMethod = wire;
220
+ if (isVoiceCallMethod(method)) form.phoneDeliveryMethod = "VOICE_CALL";
221
+ else if (isPhoneMethod(method)) form.phoneDeliveryMethod = "SMS";
222
+ return form;
223
+ }
224
+ function legacyTwoFactorFailure(errorCode) {
225
+ switch (Number(errorCode)) {
226
+ case 8002:
227
+ return new NativeAuthError("verificationExpired", "This verification has expired. Go back and sign in again.");
228
+ case 8004:
229
+ return new NativeAuthError("rateLimited", "Too many attempts. Wait a few minutes and try again.");
230
+ case 8034:
231
+ return new NativeAuthError("deliveryFailed", "We couldn't send the code. Try again, or try another way.");
232
+ case 8056:
233
+ return new NativeAuthError("smsRegionUnsupported", "SMS codes aren't available in your region. Try another way.");
234
+ default:
235
+ return void 0;
236
+ }
237
+ }
181
238
  var WixNativeAuthEngine = class {
182
239
  constructor(config = {}) {
183
240
  __publicField(this, "baseURL");
@@ -185,6 +242,7 @@ var WixNativeAuthEngine = class {
185
242
  __publicField(this, "pxToken");
186
243
  __publicField(this, "petriOverrides");
187
244
  __publicField(this, "fetchImpl");
245
+ __publicField(this, "challenges", /* @__PURE__ */ new Map());
188
246
  this.baseURL = config.baseURL ?? "https://users.wix.com";
189
247
  this.devMode = config.devMode ?? false;
190
248
  this.pxToken = config.pxToken;
@@ -234,13 +292,44 @@ var WixNativeAuthEngine = class {
234
292
  return this.postSignIn("/auth/m/verifycodeandlogin", {
235
293
  twoFAToken: token,
236
294
  code,
237
- twoFAMethod: method,
295
+ twoFAMethod: twoFactorWireMethod(method),
238
296
  rememberMe: "true"
239
297
  });
240
298
  }
241
- async resendTwoFactor(token) {
242
- if (this.devMode) return;
243
- await this.rawPost("/auth/m/resend2facode", { twoFAToken: token });
299
+ /** The challenge `token` stands for, as the gate shows it. */
300
+ twoFactorChallenge(token) {
301
+ return this.challenges.get(token);
302
+ }
303
+ /** Re-sends the 2FA code via `method` (default: the challenge's current one) — the same call
304
+ * switches to another method; `VoiceCall` asks for the Phone code by a call. Resolves to the
305
+ * new challenge (every send issues a new token), or undefined when the server named none.
306
+ * Rejects when the server refused to send: a failed resend must not read as "a new code was sent". */
307
+ async resendTwoFactor(token, method) {
308
+ const previous = this.challenges.get(token);
309
+ const requested = method ?? previous?.method ?? "";
310
+ if (this.devMode) {
311
+ const requested2 = method ?? previous?.method ?? "sms";
312
+ const phone = isPhoneMethod(twoFactorWireMethod(requested2));
313
+ const next2 = shapeTwoFactorChallenge({
314
+ twoFAToken: token,
315
+ currentTwoFAMethod: twoFactorWireMethod(requested2),
316
+ ...phone ? { phoneHint: "\u2022\u2022\u2022-\u2022\u2022\u2022-\u2022\u202234" } : requested2.toLowerCase() === "email" ? { twoFAHint: "2f\u2022\u2022\u2022@himalaya.dev" } : {}
317
+ }, requested2, previous);
318
+ this.challenges.set(token, next2);
319
+ return next2;
320
+ }
321
+ const json = await this.rawPost(
322
+ "/auth/m/resend2facode",
323
+ requested ? twoFactorResendForm(token, requested, previous) : { twoFAToken: token }
324
+ );
325
+ if (json.success !== true) {
326
+ throw legacyTwoFactorFailure(json.errorCode) ?? new NativeAuthError("unknown", "Something went wrong. Please try again.");
327
+ }
328
+ const payload = json.payload ?? json;
329
+ if (typeof payload.twoFAToken !== "string" || !payload.twoFAToken) return void 0;
330
+ const next = shapeTwoFactorChallenge(payload, requested, previous);
331
+ this.challenges.set(next.token, next);
332
+ return next;
244
333
  }
245
334
  async sendPasswordReset(email) {
246
335
  if (this.devMode) return;
@@ -259,7 +348,21 @@ var WixNativeAuthEngine = class {
259
348
  * the account session (uaToken) + sets wixSession2/XSRF cookies. 2FA via the
260
349
  * payload.twoFAToken handshake. Register is captcha-gated (errorCode 9981). */
261
350
  async ownerSignIn(email, password) {
262
- if (this.devMode) return devSignIn(email, password);
351
+ if (this.devMode) {
352
+ try {
353
+ return devSignIn(email, password);
354
+ } catch (e) {
355
+ if (!(e instanceof NativeAuthError) || e.kind !== "needsTwoFactor" || !e.twoFAToken) throw e;
356
+ const c = shapeTwoFactorChallenge({
357
+ twoFAToken: e.twoFAToken,
358
+ currentTwoFAMethod: e.twoFAMethod,
359
+ enabledTwoFAMethods: e.twoFAMethods,
360
+ phoneHint: "\u2022\u2022\u2022-\u2022\u2022\u2022-\u2022\u202234"
361
+ }, e.twoFAMethod ?? "sms");
362
+ this.challenges.set(c.token, c);
363
+ throw new NativeAuthError("needsTwoFactor", e.message, c.token, c.method, c.methods, void 0, c.hint);
364
+ }
365
+ }
263
366
  const form = `email=${encodeURIComponent(email)}&password=${encodeURIComponent(password)}&accept=json` + (this.petriOverrides ? `&petri_ovr=${encodeURIComponent(this.petriOverrides)}` : "");
264
367
  const res = await this.fetchImpl("https://users.wix.com/wix-users/auth/m/login", {
265
368
  method: "POST",
@@ -269,21 +372,25 @@ var WixNativeAuthEngine = class {
269
372
  const json = await res.json();
270
373
  const payload = json.payload ?? {};
271
374
  if (payload.twoFAToken && json.success !== true) {
272
- const current = payload.currentTwoFAMethod ?? "sms";
273
- const methods = payload.enabledTwoFAMethods ?? [current];
375
+ const current = nonBlank(payload.currentTwoFAMethod) ?? "sms";
376
+ const c = shapeTwoFactorChallenge(payload, current);
377
+ this.challenges.set(c.token, c);
274
378
  const id = payload.verificationId;
275
379
  const verificationId = (typeof id === "string" || typeof id === "number") && /^\d+$/.test(String(id)) ? String(id) : void 0;
276
380
  throw new NativeAuthError(
277
381
  "needsTwoFactor",
278
382
  "Two-factor verification required.",
279
383
  payload.twoFAToken,
280
- current,
281
- methods,
282
- verificationId
384
+ c.method,
385
+ c.methods,
386
+ verificationId,
387
+ c.hint
283
388
  );
284
389
  }
285
390
  if (json.success !== true || !payload.guid) {
286
391
  if (json.errorCode === 9981) throw new NativeAuthError("recaptchaRequired", "Additional verification is required.");
392
+ const twoFactor = legacyTwoFactorFailure(json.errorCode);
393
+ if (twoFactor) throw twoFactor;
287
394
  throw new NativeAuthError("invalidCredentials", "Wrong email or password.");
288
395
  }
289
396
  return {
@@ -354,15 +461,21 @@ var WixNativeAuthEngine = class {
354
461
  async postSignIn(path, body) {
355
462
  const json = await this.rawPost(path, body);
356
463
  if (typeof json.twoFAToken === "string" && json.twoFAToken) {
464
+ const method = json.twoFAMethod ?? "sms";
465
+ const c = shapeTwoFactorChallenge({ ...json, currentTwoFAMethod: json.currentTwoFAMethod ?? method }, method);
466
+ this.challenges.set(c.token, c);
357
467
  throw new NativeAuthError(
358
468
  "needsTwoFactor",
359
469
  "Two-factor verification required.",
360
470
  json.twoFAToken,
361
- json.twoFAMethod ?? "sms"
471
+ c.method,
472
+ c.methods,
473
+ c.verificationId,
474
+ c.hint
362
475
  );
363
476
  }
364
477
  if (typeof json.errorCode === "number" && json.errorCode !== 0) {
365
- throw mapErrorCode(json.errorCode, json.errorDescription);
478
+ throw legacyTwoFactorFailure(json.errorCode) ?? mapErrorCode(json.errorCode, json.errorDescription);
366
479
  }
367
480
  const payload = json.payload ?? json;
368
481
  const access = payload.accessToken ?? payload.wixAT;
@@ -407,6 +520,13 @@ function mapErrorCode(code, description) {
407
520
  case -15007:
408
521
  case 1:
409
522
  return new NativeAuthError("invalidCredentials", description || "Wrong email or password.");
523
+ // A wrong 2FA code (legacyTwoFactorFailure leaves these to the credential path): the gate
524
+ // words invalidCredentials on a verify as a bad code. Mirrors the Swift/Kotlin engines.
525
+ case 8001:
526
+ case 8005:
527
+ case 8006:
528
+ case 8008:
529
+ return new NativeAuthError("invalidCredentials", description || "That code isn't right.");
410
530
  case 8051:
411
531
  return new NativeAuthError("unknown", description || "This domain is blocked.");
412
532
  default: