@wix/himalaya-cli 0.1399.0 → 0.1401.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview-page/src/capabilities.generated.d.ts +2 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/wix-chat/src/index.d.ts +33 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +8 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/auth-providers/wix/src/auth-modalities.d.ts +13 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/auth-providers/wix/src/index.d.ts +11 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/auth-providers/wix/src/native-engine.d.ts +7 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/copy.generated.d.ts +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/members-v1/src/index.d.ts +66 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/site-media/src/index.d.ts +8 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/auth.mjs +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-auth/worker.mjs +62 -12
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-auth.mjs +69 -12
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-chat.mjs +56 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-members.mjs +45 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-site-media.mjs +17 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +4 -0
- package/dist/cli.mjs +58 -34
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/app-config.md +1 -1
- package/guides/capabilities.md +5 -0
- package/guides/importable-sdks.md +1 -0
- package/guides/sdk-reference.json +163 -0
- package/guides/web-page-sdk-reference.md +1 -0
- package/guides/wix-login-integration.md +42 -0
- package/package.json +2 -2
|
@@ -35,12 +35,13 @@ function dualDomainAuthorizeUrls(clientIds, redirectUri, opts = {}, endpoint = O
|
|
|
35
35
|
|
|
36
36
|
// ../../stdlib/auth-providers/wix/src/native-engine.ts
|
|
37
37
|
var NativeAuthError = class extends Error {
|
|
38
|
-
constructor(kind, message, twoFAToken, twoFAMethod, twoFAMethods) {
|
|
38
|
+
constructor(kind, message, twoFAToken, twoFAMethod, twoFAMethods, verificationId) {
|
|
39
39
|
super(message);
|
|
40
40
|
this.kind = kind;
|
|
41
41
|
this.twoFAToken = twoFAToken;
|
|
42
42
|
this.twoFAMethod = twoFAMethod;
|
|
43
43
|
this.twoFAMethods = twoFAMethods;
|
|
44
|
+
this.verificationId = verificationId;
|
|
44
45
|
this.name = "NativeAuthError";
|
|
45
46
|
}
|
|
46
47
|
};
|
|
@@ -138,12 +139,15 @@ var WixNativeAuthEngine = class {
|
|
|
138
139
|
if (payload.twoFAToken && json.success !== true) {
|
|
139
140
|
const current = payload.currentTwoFAMethod ?? "sms";
|
|
140
141
|
const methods = payload.enabledTwoFAMethods ?? [current];
|
|
142
|
+
const id = payload.verificationId;
|
|
143
|
+
const verificationId = (typeof id === "string" || typeof id === "number") && /^\d+$/.test(String(id)) ? String(id) : void 0;
|
|
141
144
|
throw new NativeAuthError(
|
|
142
145
|
"needsTwoFactor",
|
|
143
146
|
"Two-factor verification required.",
|
|
144
147
|
payload.twoFAToken,
|
|
145
148
|
current,
|
|
146
|
-
methods
|
|
149
|
+
methods,
|
|
150
|
+
verificationId
|
|
147
151
|
);
|
|
148
152
|
}
|
|
149
153
|
if (json.success !== true || !payload.guid) {
|
|
@@ -482,6 +486,15 @@ var WIX_SENSITIVE_KEYS = [
|
|
|
482
486
|
"setcookie",
|
|
483
487
|
// captcha / passwords
|
|
484
488
|
"password",
|
|
489
|
+
"currentpassword",
|
|
490
|
+
"newpassword",
|
|
491
|
+
"confirmpassword",
|
|
492
|
+
"oldpassword",
|
|
493
|
+
// T5 account-settings state uses passwordCurrent/passwordNew/passwordConfirm;
|
|
494
|
+
// redact those camel-case state keys too if state snapshots reach the gateway.
|
|
495
|
+
"passwordcurrent",
|
|
496
|
+
"passwordnew",
|
|
497
|
+
"passwordconfirm",
|
|
485
498
|
"recaptcha",
|
|
486
499
|
"recaptcharesponsefield",
|
|
487
500
|
"pxaccesstoken"
|
|
@@ -905,10 +918,12 @@ function classifyAuthErrorCode(code) {
|
|
|
905
918
|
var WixAuthModalities = class {
|
|
906
919
|
constructor(config = {}) {
|
|
907
920
|
__publicField(this, "baseURL");
|
|
921
|
+
__publicField(this, "verificationBaseURL");
|
|
908
922
|
__publicField(this, "fetchImpl");
|
|
909
923
|
__publicField(this, "sleep");
|
|
910
924
|
__publicField(this, "devMode");
|
|
911
925
|
this.baseURL = config.baseURL ?? "https://users.wix.com";
|
|
926
|
+
this.verificationBaseURL = config.verificationBaseURL ?? "https://manage.wix.com";
|
|
912
927
|
this.fetchImpl = config.fetchImpl ?? globalThis.fetch;
|
|
913
928
|
this.sleep = config.sleep ?? engineSleep("WixAuthModalities");
|
|
914
929
|
this.devMode = config.devMode ?? false;
|
|
@@ -933,25 +948,60 @@ var WixAuthModalities = class {
|
|
|
933
948
|
return { userId: p.guid ?? "", email: p.email ?? "", accessToken: access, refreshToken: p.wixSession2 ?? "" };
|
|
934
949
|
}
|
|
935
950
|
/** Push-based 2FA: poll for the user's approval on their trusted device. Loops
|
|
936
|
-
* until approved/denied/expired or `maxPolls` is hit.
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
951
|
+
* until approved/denied/expired or `maxPolls` is hit (default 60 × 5s = 5 minutes).
|
|
952
|
+
*
|
|
953
|
+
* #4309 — the wire Wix's own native client uses (mobile-native-core LegacyTwoFactor), and
|
|
954
|
+
* the one the native WixNativeAuthEngine polls: Verification v1 GetChallenge,
|
|
955
|
+
* `GET manage.wix.com/_api/verification-web/v1/challenges/get-challenge?verificationId=…`,
|
|
956
|
+
* keyed by the 2FA payload's `verificationId` (digits; `NativeAuthError.verificationId` on the
|
|
957
|
+
* needsTwoFactor challenge — not its `twoFAToken`). After "approved" the caller completes
|
|
958
|
+
* the login with ONE `/auth/m/verifycodeandlogin` carrying an empty code. The old
|
|
959
|
+
* `/auth/m/push2fa/status` route was never Wix's. */
|
|
960
|
+
async pollPushApproval(verificationId, opts = {}) {
|
|
961
|
+
const interval = opts.intervalMs ?? 5e3;
|
|
962
|
+
const maxPolls = opts.maxPolls ?? 60;
|
|
963
|
+
if (!this.devMode && !/^\d+$/.test(verificationId)) {
|
|
964
|
+
throw new NativeAuthError("unknown", "Push approval isn't available. Choose another method.");
|
|
965
|
+
}
|
|
940
966
|
for (let i = 0; i < maxPolls; i++) {
|
|
941
|
-
const state = await this.pushStatusOnce(
|
|
967
|
+
const state = await this.pushStatusOnce(verificationId, i);
|
|
942
968
|
if (state !== "pending") return state;
|
|
943
969
|
await this.sleep(interval);
|
|
944
970
|
}
|
|
945
971
|
return "expired";
|
|
946
972
|
}
|
|
947
|
-
async pushStatusOnce(
|
|
973
|
+
async pushStatusOnce(verificationId, poll) {
|
|
948
974
|
if (this.devMode) {
|
|
949
|
-
if (
|
|
975
|
+
if (verificationId === "deny") return "denied";
|
|
950
976
|
return poll >= 1 ? "approved" : "pending";
|
|
951
977
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
978
|
+
let res;
|
|
979
|
+
try {
|
|
980
|
+
res = await this.fetchImpl(
|
|
981
|
+
`${this.verificationBaseURL}/_api/verification-web/v1/challenges/get-challenge?verificationId=${verificationId}`,
|
|
982
|
+
{ method: "GET", headers: { Accept: "application/json" } }
|
|
983
|
+
);
|
|
984
|
+
} catch {
|
|
985
|
+
return "pending";
|
|
986
|
+
}
|
|
987
|
+
if (res.status === 404) return "expired";
|
|
988
|
+
if (!res.ok) return "pending";
|
|
989
|
+
let j = {};
|
|
990
|
+
try {
|
|
991
|
+
j = JSON.parse(await res.text());
|
|
992
|
+
} catch {
|
|
993
|
+
return "pending";
|
|
994
|
+
}
|
|
995
|
+
switch (j.challenge?.approvalChallenge?.status) {
|
|
996
|
+
case "APPROVED":
|
|
997
|
+
return "approved";
|
|
998
|
+
case "DECLINED":
|
|
999
|
+
return "denied";
|
|
1000
|
+
case "EXPIRED":
|
|
1001
|
+
return "expired";
|
|
1002
|
+
default:
|
|
1003
|
+
return "pending";
|
|
1004
|
+
}
|
|
955
1005
|
}
|
|
956
1006
|
/** Device-login: approve a login started on another device (confirm-on-device). */
|
|
957
1007
|
async confirmDeviceLogin(userCode, authToken) {
|
|
@@ -1185,6 +1235,12 @@ function WixAuthProvider(config) {
|
|
|
1185
1235
|
authorizationEndpoint: config.authorizationEndpoint
|
|
1186
1236
|
});
|
|
1187
1237
|
}
|
|
1238
|
+
function googleClientIds(google) {
|
|
1239
|
+
const out = {};
|
|
1240
|
+
if (google?.iosClientId) out.iosClientId = google.iosClientId;
|
|
1241
|
+
if (google?.serverClientId) out.serverClientId = google.serverClientId;
|
|
1242
|
+
return Object.keys(out).length ? out : void 0;
|
|
1243
|
+
}
|
|
1188
1244
|
function WixNativeAuthProvider(config) {
|
|
1189
1245
|
if (config.mode !== "owner" && config.mode !== "consumer" && config.mode !== "account") {
|
|
1190
1246
|
throw new Error('WixNativeAuthProvider: mode must be "owner", "consumer" or "account".');
|
|
@@ -1196,6 +1252,7 @@ function WixNativeAuthProvider(config) {
|
|
|
1196
1252
|
...config.clientId ? { clientId: config.clientId } : {},
|
|
1197
1253
|
...config.redirectUri ? { redirectUri: config.redirectUri } : {},
|
|
1198
1254
|
...config.social ? { social: config.social } : {},
|
|
1255
|
+
...googleClientIds(config.google) ? { google: googleClientIds(config.google) } : {},
|
|
1199
1256
|
...config.apiBase ? { apiBase: config.apiBase } : {},
|
|
1200
1257
|
...config.pxToken ? { pxToken: config.pxToken } : {},
|
|
1201
1258
|
...config.petriOverrides ? { petriOverrides: config.petriOverrides } : {},
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// ../../core/sdk/dispatch/src/index.ts
|
|
2
|
+
function dispatch(handlerId, params, _options) {
|
|
3
|
+
const himalaya = globalThis.himalaya;
|
|
4
|
+
if (!himalaya) {
|
|
5
|
+
return Promise.reject(
|
|
6
|
+
new Error("@himalaya/dispatch: called outside a Himalaya runtime. This bundle must run inside a JSWorker (Tier 5).")
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
const stringParams = {};
|
|
10
|
+
if (params) {
|
|
11
|
+
for (const [k, v] of Object.entries(params)) stringParams[k] = String(v);
|
|
12
|
+
}
|
|
13
|
+
return himalaya.dispatch(handlerId, stringParams);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// ../../core/sdk/wix-chat/src/index.ts
|
|
17
|
+
function validateActionRef(value, name) {
|
|
18
|
+
if (!/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/.test(value)) {
|
|
19
|
+
throw new Error(`wix-chat.${name}: expected "<service>.<action>"`);
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
async function subscribeRealtime(opts) {
|
|
24
|
+
const onEvent = validateActionRef(opts.onEvent, "subscribeRealtime onEvent");
|
|
25
|
+
const onStatus = opts.onStatus ? validateActionRef(opts.onStatus, "subscribeRealtime onStatus") : "";
|
|
26
|
+
const result = await dispatch("capability.wix_chat.subscribeRealtime", { onEvent, onStatus });
|
|
27
|
+
return {
|
|
28
|
+
subscriptionId: typeof result?.subscriptionId === "string" ? result.subscriptionId : "",
|
|
29
|
+
state: normalizeState(result?.state),
|
|
30
|
+
...!result ? { reason: "runtime_unavailable" } : {},
|
|
31
|
+
...normalizeReason(result?.reason) ? { reason: normalizeReason(result?.reason) } : {}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
async function unsubscribeRealtime(opts) {
|
|
35
|
+
if (!opts.subscriptionId.trim()) return { ok: false };
|
|
36
|
+
const result = await dispatch("capability.wix_chat.unsubscribeRealtime", { subscriptionId: opts.subscriptionId });
|
|
37
|
+
return { ok: result?.ok === true };
|
|
38
|
+
}
|
|
39
|
+
async function getRealtimeStatus(opts) {
|
|
40
|
+
if (!opts.subscriptionId.trim()) return { state: "unavailable", reason: "runtime_unavailable" };
|
|
41
|
+
const result = await dispatch("capability.wix_chat.getRealtimeStatus", { subscriptionId: opts.subscriptionId });
|
|
42
|
+
const reason = normalizeReason(result?.reason);
|
|
43
|
+
return { state: result ? normalizeState(result.state) : "unavailable", ...!result ? { reason: "runtime_unavailable" } : {}, ...reason ? { reason } : {} };
|
|
44
|
+
}
|
|
45
|
+
function normalizeState(value) {
|
|
46
|
+
return value === "connected" || value === "connecting" || value === "reconnecting" || value === "disconnected" || value === "error" ? value : "unavailable";
|
|
47
|
+
}
|
|
48
|
+
function normalizeReason(value) {
|
|
49
|
+
return value === "chat_setup_scope_unavailable" || value === "runtime_unavailable" || value === "invalid_setup_response" || value === "firebase_auth_failed" || value === "firebase_connection_failed" || value === "invalid_event" || value === "event_overflow" ? value : void 0;
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
getRealtimeStatus,
|
|
53
|
+
subscribeRealtime,
|
|
54
|
+
unsubscribeRealtime
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=wix-chat.mjs.map
|
|
@@ -14,6 +14,42 @@ function getMember(id) {
|
|
|
14
14
|
if (!id) throw new Error("getMember: id is required");
|
|
15
15
|
return wixCall("GET", `/members/v1/members/${encodeURIComponent(id)}?fieldsets=FULL`);
|
|
16
16
|
}
|
|
17
|
+
function getMyMember(req = {}) {
|
|
18
|
+
const fieldsets = req.fieldsets?.length ? req.fieldsets.map((fieldset) => `fieldsets=${encodeURIComponent(fieldset)}`).join("&") : "fieldsets=FULL";
|
|
19
|
+
return wixCall("GET", `/members/v1/members/my?${fieldsets}`);
|
|
20
|
+
}
|
|
21
|
+
function updateMember(id, req) {
|
|
22
|
+
if (!id) throw new Error("updateMember: id is required");
|
|
23
|
+
return wixCall("PATCH", `/members/v1/members/${encodeURIComponent(id)}`, req);
|
|
24
|
+
}
|
|
25
|
+
function updateMySlug(req) {
|
|
26
|
+
return wixCall("POST", "/members/v1/members/my/slug", req);
|
|
27
|
+
}
|
|
28
|
+
function listCurrentMemberBlocking(req = {}) {
|
|
29
|
+
const parts = [];
|
|
30
|
+
const paging = req.cursorPaging;
|
|
31
|
+
if (paging?.limit != null) parts.push(`cursorPaging.limit=${encodeURIComponent(String(paging.limit))}`);
|
|
32
|
+
if (paging?.cursor) parts.push(`cursorPaging.cursor=${encodeURIComponent(paging.cursor)}`);
|
|
33
|
+
const query = parts.length ? `?${parts.join("&")}` : "";
|
|
34
|
+
return wixCall("GET", `/members/v1/member-to-member-blocks/members/my${query}`);
|
|
35
|
+
}
|
|
36
|
+
function unblockCurrentMember(memberId) {
|
|
37
|
+
if (!memberId) throw new Error("unblockCurrentMember: memberId is required");
|
|
38
|
+
return wixCall(
|
|
39
|
+
"DELETE",
|
|
40
|
+
`/members/v1/member-to-member-blocks/members/my/${encodeURIComponent(memberId)}`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function deleteMemberPhones(id) {
|
|
44
|
+
if (!id) throw new Error("deleteMemberPhones: id is required");
|
|
45
|
+
return wixCall("DELETE", `/members/v1/members/${encodeURIComponent(id)}/phones`);
|
|
46
|
+
}
|
|
47
|
+
function leaveCommunity() {
|
|
48
|
+
return wixCall("POST", "/members/v1/members/leave-community", {});
|
|
49
|
+
}
|
|
50
|
+
function joinCommunity() {
|
|
51
|
+
return wixCall("POST", "/members/v1/members/join-community", {});
|
|
52
|
+
}
|
|
17
53
|
function approveMember(id) {
|
|
18
54
|
return wixCall("POST", `/members/v1/members/${encodeURIComponent(id)}/approve`, {});
|
|
19
55
|
}
|
|
@@ -58,11 +94,19 @@ export {
|
|
|
58
94
|
approveMember,
|
|
59
95
|
blockMember,
|
|
60
96
|
deleteMember,
|
|
97
|
+
deleteMemberPhones,
|
|
61
98
|
followMember,
|
|
62
99
|
getFollowCounts,
|
|
63
100
|
getMember,
|
|
101
|
+
getMyMember,
|
|
64
102
|
isFollowingMember,
|
|
103
|
+
joinCommunity,
|
|
104
|
+
leaveCommunity,
|
|
105
|
+
listCurrentMemberBlocking,
|
|
65
106
|
queryMembers,
|
|
66
|
-
|
|
107
|
+
unblockCurrentMember,
|
|
108
|
+
unfollowMember,
|
|
109
|
+
updateMember,
|
|
110
|
+
updateMySlug
|
|
67
111
|
};
|
|
68
112
|
//# sourceMappingURL=wix-members.mjs.map
|
|
@@ -14,7 +14,24 @@ function generateUploadUrl(mimeType, fileName, parentFolderId) {
|
|
|
14
14
|
if (parentFolderId) body.parentFolderId = parentFolderId;
|
|
15
15
|
return wixCall("POST", "/site-media/v1/files/generate-upload-url", body);
|
|
16
16
|
}
|
|
17
|
+
function generateMemberPhotoUploadUrl(functionName, mimeType, fileName) {
|
|
18
|
+
if (!/^[A-Za-z][A-Za-z0-9_]{0,63}$/.test(functionName)) {
|
|
19
|
+
throw new Error("generateMemberPhotoUploadUrl: invalid function name");
|
|
20
|
+
}
|
|
21
|
+
if (!mimeType || mimeType.length > 127 || /[\r\n]/.test(mimeType)) {
|
|
22
|
+
throw new Error("generateMemberPhotoUploadUrl: invalid MIME type");
|
|
23
|
+
}
|
|
24
|
+
if (!fileName || fileName.length > 255 || /[\u0000-\u001f\u007f]/.test(fileName)) {
|
|
25
|
+
throw new Error("generateMemberPhotoUploadUrl: invalid file name");
|
|
26
|
+
}
|
|
27
|
+
return wixCall(
|
|
28
|
+
"POST",
|
|
29
|
+
`/velo/v1/http/invoke/${encodeURIComponent(functionName)}`,
|
|
30
|
+
{ mimeType, fileName }
|
|
31
|
+
);
|
|
32
|
+
}
|
|
17
33
|
export {
|
|
34
|
+
generateMemberPhotoUploadUrl,
|
|
18
35
|
generateUploadUrl,
|
|
19
36
|
wixCall
|
|
20
37
|
};
|
|
@@ -322,6 +322,10 @@
|
|
|
322
322
|
"types": "./dist/_types/core/sdk/wix-cashier/src/index.d.ts",
|
|
323
323
|
"import": "./dist/wix-cashier.mjs"
|
|
324
324
|
},
|
|
325
|
+
"./wix-chat": {
|
|
326
|
+
"types": "./dist/_types/core/sdk/wix-chat/src/index.d.ts",
|
|
327
|
+
"import": "./dist/wix-chat.mjs"
|
|
328
|
+
},
|
|
325
329
|
"./wix-chat-web": {
|
|
326
330
|
"types": "./dist/_types/stdlib/wix-sdk/chat-web/src/index.d.ts",
|
|
327
331
|
"import": "./dist/wix-chat-web.mjs"
|