@wix/cli-app 1.1.130 → 1.1.132
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/build/{AddPermissionCommand-BNQLVVG2.js → AddPermissionCommand-7QIFVBXV.js} +2 -2
- package/build/{DevCommand-RROFLNVA.js → DevCommand-RDPL27X5.js} +10 -10
- package/build/{GenerateCommand-G4UXQSC4.js → GenerateCommand-6ADO2EJU.js} +7 -7
- package/build/{LogsCommand-ZSHD4GIP.js → LogsCommand-PIRWJADI.js} +3 -3
- package/build/PreviewCommand-AN6WMCYS.js +19 -0
- package/build/ReleaseCommand-DAK2EFM2.js +23 -0
- package/build/{ServeCommand-S6M35AKW.js → ServeCommand-5HERPY2Q.js} +3 -3
- package/build/{build-RUSZ3TSC.js → build-6IDZAW4E.js} +6 -6
- package/build/{chunk-WKSWNCTU.js → chunk-DK2KK5UN.js} +2 -2
- package/build/{chunk-NJJYZJQS.js → chunk-ESTYQVMX.js} +666 -450
- package/build/{chunk-NJJYZJQS.js.map → chunk-ESTYQVMX.js.map} +1 -1
- package/build/{chunk-NGOYJYOW.js → chunk-FWRUE2NB.js} +2 -2
- package/build/{chunk-JQTGMEWQ.js → chunk-GNL53AZS.js} +3 -3
- package/build/{chunk-DRD6GB7Q.js → chunk-IIF6P6XG.js} +2 -2
- package/build/{chunk-HAIW522F.js → chunk-JYZ5QJ5C.js} +2 -2
- package/build/{chunk-Y4JFLKW4.js → chunk-KHUHWBJD.js} +55 -9
- package/build/chunk-KHUHWBJD.js.map +1 -0
- package/build/{chunk-SOU6HNBH.js → chunk-KVESKT7X.js} +4 -4
- package/build/{chunk-KIVZW6PT.js → chunk-LQZSH33G.js} +6 -6
- package/build/{chunk-O6H7XIDU.js → chunk-NJXD2TTX.js} +221 -148
- package/build/chunk-NJXD2TTX.js.map +1 -0
- package/build/{chunk-GK6REVIM.js → chunk-O2MISIES.js} +2 -2
- package/build/{chunk-HJMVSDM6.js → chunk-PREYTA74.js} +27 -17
- package/build/{chunk-HJMVSDM6.js.map → chunk-PREYTA74.js.map} +1 -1
- package/build/{chunk-YUGELGFN.js → chunk-QQ4OBBX7.js} +6 -6
- package/build/{chunk-SQNOCNCP.js → chunk-UJ4SA2PC.js} +2 -2
- package/build/{chunk-YKE5JW33.js → chunk-VDQEUTFT.js} +4 -4
- package/build/{chunk-2CWSXZNM.js → chunk-WA2CFDB5.js} +2 -2
- package/build/{chunk-JACM7HP5.js → chunk-XDUVJLLQ.js} +2 -2
- package/build/index.js +23 -23
- package/build/platform-sdk/{chunk-J3SVE4GM.js → chunk-R7FAXXP7.js} +1 -1
- package/build/platform-sdk/{chunk-J3SVE4GM.js.map → chunk-R7FAXXP7.js.map} +1 -1
- package/build/platform-sdk/{chunk-QFPCSRLT.js → chunk-WBKL5IQV.js} +2 -2
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/dashboard.js.map +1 -1
- package/build/platform-sdk/editor.js +1 -1
- package/build/platform-sdk/editor.js.map +1 -1
- package/build/platform-sdk/sdk-context.js +1 -1
- package/build/platform-sdk/sdk-context.js.map +1 -1
- package/build/platform-sdk/site.js +1 -1
- package/build/{preview-IMIIDIZG.js → preview-IXHPIOMO.js} +12 -12
- package/build/{release-T4YODE2A.js → release-RFFKID6V.js} +14 -14
- package/build/{render-command-JIQJEJ2I.js → render-command-NUU6LT5M.js} +5 -5
- package/package.json +6 -6
- package/schemas/wix-config.json +1 -1
- package/build/PreviewCommand-TJDGT26I.js +0 -19
- package/build/ReleaseCommand-225R4KKI.js +0 -23
- package/build/chunk-O6H7XIDU.js.map +0 -1
- package/build/chunk-Y4JFLKW4.js.map +0 -1
- /package/build/{AddPermissionCommand-BNQLVVG2.js.map → AddPermissionCommand-7QIFVBXV.js.map} +0 -0
- /package/build/{DevCommand-RROFLNVA.js.map → DevCommand-RDPL27X5.js.map} +0 -0
- /package/build/{GenerateCommand-G4UXQSC4.js.map → GenerateCommand-6ADO2EJU.js.map} +0 -0
- /package/build/{LogsCommand-ZSHD4GIP.js.map → LogsCommand-PIRWJADI.js.map} +0 -0
- /package/build/{PreviewCommand-TJDGT26I.js.map → PreviewCommand-AN6WMCYS.js.map} +0 -0
- /package/build/{ReleaseCommand-225R4KKI.js.map → ReleaseCommand-DAK2EFM2.js.map} +0 -0
- /package/build/{ServeCommand-S6M35AKW.js.map → ServeCommand-5HERPY2Q.js.map} +0 -0
- /package/build/{build-RUSZ3TSC.js.map → build-6IDZAW4E.js.map} +0 -0
- /package/build/{chunk-WKSWNCTU.js.map → chunk-DK2KK5UN.js.map} +0 -0
- /package/build/{chunk-NGOYJYOW.js.map → chunk-FWRUE2NB.js.map} +0 -0
- /package/build/{chunk-JQTGMEWQ.js.map → chunk-GNL53AZS.js.map} +0 -0
- /package/build/{chunk-DRD6GB7Q.js.map → chunk-IIF6P6XG.js.map} +0 -0
- /package/build/{chunk-HAIW522F.js.map → chunk-JYZ5QJ5C.js.map} +0 -0
- /package/build/{chunk-SOU6HNBH.js.map → chunk-KVESKT7X.js.map} +0 -0
- /package/build/{chunk-KIVZW6PT.js.map → chunk-LQZSH33G.js.map} +0 -0
- /package/build/{chunk-GK6REVIM.js.map → chunk-O2MISIES.js.map} +0 -0
- /package/build/{chunk-YUGELGFN.js.map → chunk-QQ4OBBX7.js.map} +0 -0
- /package/build/{chunk-SQNOCNCP.js.map → chunk-UJ4SA2PC.js.map} +0 -0
- /package/build/{chunk-YKE5JW33.js.map → chunk-VDQEUTFT.js.map} +0 -0
- /package/build/{chunk-2CWSXZNM.js.map → chunk-WA2CFDB5.js.map} +0 -0
- /package/build/{chunk-JACM7HP5.js.map → chunk-XDUVJLLQ.js.map} +0 -0
- /package/build/platform-sdk/{chunk-QFPCSRLT.js.map → chunk-WBKL5IQV.js.map} +0 -0
- /package/build/{preview-IMIIDIZG.js.map → preview-IXHPIOMO.js.map} +0 -0
- /package/build/{release-T4YODE2A.js.map → release-RFFKID6V.js.map} +0 -0
- /package/build/{render-command-JIQJEJ2I.js.map → render-command-NUU6LT5M.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import { createRequire as _createRequire } from 'node:module';
|
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
readAppManifestFile
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GNL53AZS.js";
|
|
6
6
|
import {
|
|
7
7
|
ArmTagProvider,
|
|
8
8
|
ExtensionDataProvider,
|
|
@@ -16,16 +16,16 @@ import {
|
|
|
16
16
|
useResolvePlatformUrl,
|
|
17
17
|
useSite,
|
|
18
18
|
useSiteOverrideClient
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-KHUHWBJD.js";
|
|
20
20
|
import {
|
|
21
21
|
useBackendComponents
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JYZ5QJ5C.js";
|
|
23
23
|
import {
|
|
24
24
|
getMonitoringProvider,
|
|
25
25
|
updateAppManifestComponents,
|
|
26
26
|
updateMonitoring,
|
|
27
27
|
updateTopology
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-PREYTA74.js";
|
|
29
29
|
import {
|
|
30
30
|
Alert,
|
|
31
31
|
Box_default,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
useHttpClient,
|
|
55
55
|
useProjectModel,
|
|
56
56
|
useTranslation
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-ESTYQVMX.js";
|
|
58
58
|
import {
|
|
59
59
|
__toESM,
|
|
60
60
|
init_esm_shims
|
|
@@ -282,4 +282,4 @@ export {
|
|
|
282
282
|
assertBuildOutputExists,
|
|
283
283
|
PreviewCommand
|
|
284
284
|
};
|
|
285
|
-
//# sourceMappingURL=chunk-
|
|
285
|
+
//# sourceMappingURL=chunk-QQ4OBBX7.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isCliSystemError,
|
|
6
6
|
wixCliCliCommand,
|
|
7
7
|
wixCliCliCommandStatus
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ESTYQVMX.js";
|
|
9
9
|
import {
|
|
10
10
|
__commonJS,
|
|
11
11
|
__toESM,
|
|
@@ -594,4 +594,4 @@ export {
|
|
|
594
594
|
addUserFields,
|
|
595
595
|
reportCommandStartEvent
|
|
596
596
|
};
|
|
597
|
-
//# sourceMappingURL=chunk-
|
|
597
|
+
//# sourceMappingURL=chunk-UJ4SA2PC.js.map
|
|
@@ -2,13 +2,13 @@ import { createRequire as _createRequire } from 'node:module';
|
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
addUserFields
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UJ4SA2PC.js";
|
|
6
6
|
import {
|
|
7
7
|
messages_default
|
|
8
8
|
} from "./chunk-ZHQREOZP.js";
|
|
9
9
|
import {
|
|
10
10
|
DebugLogProvider
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IIF6P6XG.js";
|
|
12
12
|
import {
|
|
13
13
|
AccountAuthProvider,
|
|
14
14
|
BiProvider,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
getDebugLogFilePath,
|
|
23
23
|
isLoggedInToAccount,
|
|
24
24
|
require_react
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ESTYQVMX.js";
|
|
26
26
|
import {
|
|
27
27
|
__toESM,
|
|
28
28
|
init_esm_shims
|
|
@@ -64,4 +64,4 @@ export {
|
|
|
64
64
|
log,
|
|
65
65
|
executeCommand
|
|
66
66
|
};
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
67
|
+
//# sourceMappingURL=chunk-VDQEUTFT.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
require_lib,
|
|
11
11
|
require_react,
|
|
12
12
|
useTranslation
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ESTYQVMX.js";
|
|
14
14
|
import {
|
|
15
15
|
__toESM,
|
|
16
16
|
init_esm_shims
|
|
@@ -179,4 +179,4 @@ export {
|
|
|
179
179
|
docsExtensionTypeSchema,
|
|
180
180
|
getGenerateFlowByDocsExtensionType
|
|
181
181
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
182
|
+
//# sourceMappingURL=chunk-WA2CFDB5.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
createRendererToString,
|
|
6
6
|
isCliError,
|
|
7
7
|
require_react
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ESTYQVMX.js";
|
|
9
9
|
import {
|
|
10
10
|
__toESM,
|
|
11
11
|
init_esm_shims
|
|
@@ -61,4 +61,4 @@ function createLogger({
|
|
|
61
61
|
export {
|
|
62
62
|
createLogger
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-XDUVJLLQ.js.map
|
package/build/index.js
CHANGED
|
@@ -3,18 +3,18 @@ const require = _createRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
createI18nT,
|
|
5
5
|
docsExtensionTypeSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WA2CFDB5.js";
|
|
7
7
|
import {
|
|
8
8
|
runCommand
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-KVESKT7X.js";
|
|
10
|
+
import "./chunk-UJ4SA2PC.js";
|
|
11
11
|
import "./chunk-ZHQREOZP.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-IIF6P6XG.js";
|
|
13
13
|
import {
|
|
14
14
|
external_exports,
|
|
15
15
|
package_default,
|
|
16
16
|
require_react
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ESTYQVMX.js";
|
|
18
18
|
import {
|
|
19
19
|
__commonJS,
|
|
20
20
|
__require,
|
|
@@ -3377,8 +3377,8 @@ var {
|
|
|
3377
3377
|
// src/commands/build.ts
|
|
3378
3378
|
init_esm_shims();
|
|
3379
3379
|
var buildCommand = (services) => createCommand("build").action(async (_, command) => {
|
|
3380
|
-
const { runCommand: runCommand2 } = await import("./render-command-
|
|
3381
|
-
const { build } = await import("./build-
|
|
3380
|
+
const { runCommand: runCommand2 } = await import("./render-command-NUU6LT5M.js");
|
|
3381
|
+
const { build } = await import("./build-6IDZAW4E.js");
|
|
3382
3382
|
await runCommand2(command, services, build);
|
|
3383
3383
|
});
|
|
3384
3384
|
|
|
@@ -3443,8 +3443,8 @@ var devCommand = (services) => {
|
|
|
3443
3443
|
return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).option("--port <port>", t("dev_command_def.option.port"), validatePort).addOption(
|
|
3444
3444
|
new Option("--origin <url>", t("dev_command_def.option.origin")).argParser(validateBase).hideHelp()
|
|
3445
3445
|
).action(async (options, command) => {
|
|
3446
|
-
const { DevCommand } = await import("./DevCommand-
|
|
3447
|
-
const { renderCommand } = await import("./render-command-
|
|
3446
|
+
const { DevCommand } = await import("./DevCommand-RDPL27X5.js");
|
|
3447
|
+
const { renderCommand } = await import("./render-command-NUU6LT5M.js");
|
|
3448
3448
|
const { https = false, origin, port } = options;
|
|
3449
3449
|
await renderCommand(
|
|
3450
3450
|
command,
|
|
@@ -3483,17 +3483,17 @@ var previewCommand = (services) => {
|
|
|
3483
3483
|
).hideHelp()
|
|
3484
3484
|
).action(async (options, command) => {
|
|
3485
3485
|
const { site, baseUrl, json } = options;
|
|
3486
|
-
const { renderCommand, runCommand: runCommand2 } = await import("./render-command-
|
|
3486
|
+
const { renderCommand, runCommand: runCommand2 } = await import("./render-command-NUU6LT5M.js");
|
|
3487
3487
|
if (json) {
|
|
3488
3488
|
return runCommand2(command, services, async (model) => {
|
|
3489
|
-
const { nonInteractivePreview } = await import("./preview-
|
|
3489
|
+
const { nonInteractivePreview } = await import("./preview-IXHPIOMO.js");
|
|
3490
3490
|
return nonInteractivePreview(services, model, {
|
|
3491
3491
|
baseUrl,
|
|
3492
3492
|
siteId: site
|
|
3493
3493
|
});
|
|
3494
3494
|
});
|
|
3495
3495
|
}
|
|
3496
|
-
const { PreviewCommand } = await import("./PreviewCommand-
|
|
3496
|
+
const { PreviewCommand } = await import("./PreviewCommand-AN6WMCYS.js");
|
|
3497
3497
|
await renderCommand(
|
|
3498
3498
|
command,
|
|
3499
3499
|
services,
|
|
@@ -3510,8 +3510,8 @@ var addPermissionCommand = (services) => {
|
|
|
3510
3510
|
return createCommand("add-permission").description("adding a permission to the app").addOption(
|
|
3511
3511
|
new Option("-p, --permission-id <id>", t("the permission id to add"))
|
|
3512
3512
|
).action(async (options, command) => {
|
|
3513
|
-
const { renderCommand } = await import("./render-command-
|
|
3514
|
-
const { AddPermissionCommand } = await import("./AddPermissionCommand-
|
|
3513
|
+
const { renderCommand } = await import("./render-command-NUU6LT5M.js");
|
|
3514
|
+
const { AddPermissionCommand } = await import("./AddPermissionCommand-7QIFVBXV.js");
|
|
3515
3515
|
const { permissionId = "" } = options;
|
|
3516
3516
|
await renderCommand(
|
|
3517
3517
|
command,
|
|
@@ -3527,8 +3527,8 @@ var import_react4 = __toESM(require_react(), 1);
|
|
|
3527
3527
|
var serveCommand = (services) => {
|
|
3528
3528
|
const t = createI18nT();
|
|
3529
3529
|
return createCommand("serve").description(t("serve_command_def.description")).action(async (_, command) => {
|
|
3530
|
-
const { renderCommand } = await import("./render-command-
|
|
3531
|
-
const { ServeCommandDeprecated } = await import("./ServeCommand-
|
|
3530
|
+
const { renderCommand } = await import("./render-command-NUU6LT5M.js");
|
|
3531
|
+
const { ServeCommandDeprecated } = await import("./ServeCommand-5HERPY2Q.js");
|
|
3532
3532
|
await renderCommand(command, services, /* @__PURE__ */ import_react4.default.createElement(ServeCommandDeprecated, null));
|
|
3533
3533
|
});
|
|
3534
3534
|
};
|
|
@@ -3543,8 +3543,8 @@ var generateCommand = (services) => {
|
|
|
3543
3543
|
t("generate_command.type_flag"),
|
|
3544
3544
|
validateDocsExtensionType
|
|
3545
3545
|
).description(t("generate_command.description")).action(async (options, command) => {
|
|
3546
|
-
const { GenerateCommand } = await import("./GenerateCommand-
|
|
3547
|
-
const { renderCommand } = await import("./render-command-
|
|
3546
|
+
const { GenerateCommand } = await import("./GenerateCommand-6ADO2EJU.js");
|
|
3547
|
+
const { renderCommand } = await import("./render-command-NUU6LT5M.js");
|
|
3548
3548
|
const { type } = options;
|
|
3549
3549
|
await renderCommand(
|
|
3550
3550
|
command,
|
|
@@ -3568,8 +3568,8 @@ var logsCommand = (services) => {
|
|
|
3568
3568
|
validateVersion
|
|
3569
3569
|
).action(async (options, command) => {
|
|
3570
3570
|
const { version } = options;
|
|
3571
|
-
const { renderCommand } = await import("./render-command-
|
|
3572
|
-
const { LogsCommand } = await import("./LogsCommand-
|
|
3571
|
+
const { renderCommand } = await import("./render-command-NUU6LT5M.js");
|
|
3572
|
+
const { LogsCommand } = await import("./LogsCommand-PIRWJADI.js");
|
|
3573
3573
|
await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(LogsCommand, { version }));
|
|
3574
3574
|
});
|
|
3575
3575
|
};
|
|
@@ -3602,8 +3602,8 @@ var releaseCommand = (services) => {
|
|
|
3602
3602
|
t("app_preview_command_def.option.json")
|
|
3603
3603
|
).hideHelp()
|
|
3604
3604
|
).action(async (options, command) => {
|
|
3605
|
-
const { renderCommand } = await import("./render-command-
|
|
3606
|
-
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-
|
|
3605
|
+
const { renderCommand } = await import("./render-command-NUU6LT5M.js");
|
|
3606
|
+
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-DAK2EFM2.js");
|
|
3607
3607
|
const { baseUrl, site, comment, json } = options;
|
|
3608
3608
|
const versionType = options.versionType ? {
|
|
3609
3609
|
major: ReleaseVersionType.MAJOR,
|
|
@@ -3617,7 +3617,7 @@ var releaseCommand = (services) => {
|
|
|
3617
3617
|
};
|
|
3618
3618
|
if (json) {
|
|
3619
3619
|
return runCommand(command, services, async (model) => {
|
|
3620
|
-
const { nonInteractiveRelease } = await import("./release-
|
|
3620
|
+
const { nonInteractiveRelease } = await import("./release-RFFKID6V.js");
|
|
3621
3621
|
return nonInteractiveRelease(services, model, props);
|
|
3622
3622
|
});
|
|
3623
3623
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{wixContext as n}from"@wix/sdk-context";function d(o,t){return(...i)=>{let e=u();return e?e.initWixModules(o,t).apply(void 0,i):o.apply(void 0,i)}}function u(){let o=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(o)return{initWixModules(e,l){return r(()=>o(e,l))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof n.client<"u"?n.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof n.elevatedClient<"u"?n.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!i))return{initWixModules(e,l){if(l){if(!i)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return r(()=>i.use(e))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return r(()=>t.use(e))},fetchWithAuth:(e,l)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(e,l)},getAuth(){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.auth},async graphql(e,l,x){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(e,l,x)}}}function r(o){let t=globalThis.__wix_context__,i={client:n.client,elevatedClient:n.elevatedClient},e;globalThis.__wix_context__=void 0,n.client=void 0,n.elevatedClient=void 0,typeof $wixContext<"u"&&(e={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return o()}finally{globalThis.__wix_context__=t,n.client=i.client,n.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=e.client,$wixContext.elevatedClient=e.elevatedClient)}}export{d as a,r as b};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-R7FAXXP7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context-v2.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n throw new Error('An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n getAuth() {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.auth;\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function getContextualAuth() {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.getAuth();\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { EventDefinition, ServicePluginDefinition, } from '@wix/sdk-types';\nimport { resolveContext } from './context.js';\nexport { EventDefinition, ServicePluginDefinition, };\nexport function contextualizeHostModuleV2(hostModule, props) {\n return {\n ...hostModule,\n ...Object.fromEntries(props.map((prop) => [\n prop,\n (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(hostModule)[prop].apply(undefined, args);\n },\n ])),\n };\n}\nexport function contextualizeRESTModuleV2(restModule, elevated) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n // @ts-expect-error - if there is no context, we want to behave like the original module\n return restModule.apply(undefined, args);\n }\n return (context\n .initWixModules(restModule, elevated)\n // @ts-expect-error - we know the args here are meant to be passed to the initalized module\n .apply(undefined, args));\n });\n}\nexport function contextualizeEventDefinitionModuleV2(eventDefinition) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n contextualMethod.__type = eventDefinition.__type;\n contextualMethod.type = eventDefinition.type;\n contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;\n contextualMethod.transformations = eventDefinition.transformations;\n return contextualMethod;\n}\nexport function contextualizeSerivcePluginModuleV2(servicePlugin) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n contextualMethod.__type = servicePlugin.__type;\n contextualMethod.componentType = servicePlugin.componentType;\n contextualMethod.methods = servicePlugin.methods;\n return contextualMethod;\n}\n"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,mBCmBpB,SAASC,EAA0BC,EAAYC,EAAU,CAC5D,MAAQ,IAAIC,IAAS,CACjB,IAAMC,EAAUC,EAAe,EAC/B,OAAKD,EAIGA,EACH,eAAeH,EAAYC,CAAQ,EAEnC,MAAM,OAAWC,CAAI,EALfF,EAAW,MAAM,OAAWE,CAAI,CAM/C,CACJ,CD9BO,SAASG,GAAiB,CAC7B,IAAMC,EAAa,OAAO,YAAgB,KAAe,YAAY,eAC/D,YAAY,eACZ,OAAO,WAAW,gBAAoB,KACpC,WAAW,gBAAgB,eACzB,WAAW,gBAAgB,eAC3B,OACV,GAAIA,EACA,MAAO,CAEH,eAAeC,EAASC,EAAU,CAC9B,OAAOC,EAAkB,IAAMH,EAAWC,EAASC,CAAQ,CAAC,CAChE,EACA,eAAgB,CACZ,MAAM,IAAI,MAAM,gDAAgD,CACpE,EACA,SAAU,CACN,MAAM,IAAI,MAAM,0CAA0C,CAC9D,CACJ,EAEJ,IAAME,EAAmB,OAAO,YAAgB,IAC1C,YAAY,OACZ,OAAOC,EAAW,OAAW,IACzBA,EAAW,OACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,OAC3B,OACRC,EAAiB,OAAO,YAAgB,IACxC,YAAY,eACZ,OAAOD,EAAW,eAAmB,IACjCA,EAAW,eACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,eAC3B,OACd,GAAI,GAACD,GAAoB,CAACE,GAG1B,MAAO,CACH,eAAeC,EAAYL,EAAU,CACjC,GAAIA,EAAU,CACV,GAAI,CAACI,EACD,MAAM,IAAI,MAAM,2JAA2J,EAE/K,OAAOH,EAAkB,IAAMG,EAAe,IAAIC,CAAU,CAAC,CACjE,CACA,GAAI,CAACH,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOD,EAAkB,IAAMC,EAAiB,IAAIG,CAAU,CAAC,CACnE,EACA,cAAe,CAACC,EAAcC,IAAgB,CAC1C,GAAI,CAACL,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,cAAcI,EAAcC,CAAW,CACnE,EACA,SAAU,CACN,GAAI,CAACL,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,IAC5B,EACA,MAAM,QAAQM,EAAOC,EAAWC,EAAM,CAClC,GAAI,CAACR,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,QAAQM,EAAOC,EAAWC,CAAI,CAC1D,CACJ,CACJ,CA+CO,SAASC,EAAkBC,EAAI,CAClC,IAAMC,EAAgB,WAAW,gBAC3BC,EAAgB,CAClB,OAAQC,EAAW,OACnB,eAAgBA,EAAW,cAC/B,EACIC,EACJ,WAAW,gBAAkB,OAC7BD,EAAW,OAAS,OACpBA,EAAW,eAAiB,OACxB,OAAO,YAAgB,MACvBC,EAAiB,CACb,OAAQ,aAAa,OACrB,eAAgB,aAAa,cACjC,EACA,OAAO,YAAY,OACnB,OAAO,YAAY,gBAEvB,GAAI,CACA,OAAOJ,EAAG,CACd,QACA,CACI,WAAW,gBAAkBC,EAC7BE,EAAW,OAASD,EAAc,OAClCC,EAAW,eAAiBD,EAAc,eACtC,OAAO,YAAgB,MACvB,YAAY,OAASE,EAAe,OACpC,YAAY,eAAiBA,EAAe,eAEpD,CACJ","names":["wixContext","contextualizeRESTModuleV2","restModule","elevated","args","context","resolveContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","wixContext","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext"]}
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context-v2.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n throw new Error('An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n getAuth() {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.auth;\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function getContextualAuth() {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.getAuth();\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { EventDefinition, ServicePluginDefinition, } from '@wix/sdk-types';\nimport { resolveContext } from './context.js';\nexport { EventDefinition, ServicePluginDefinition, };\nexport function contextualizeHostModuleV2(hostModule, props) {\n return {\n ...hostModule,\n ...Object.fromEntries(props.map((prop) => [\n prop,\n (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(hostModule)[prop].apply(undefined, args);\n },\n ])),\n };\n}\nexport function contextualizeRESTModuleV2(restModule, elevated) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n // @ts-expect-error - if there is no context, we want to behave like the original module\n return restModule.apply(undefined, args);\n }\n return (context\n .initWixModules(restModule, elevated)\n // @ts-expect-error - we know the args here are meant to be passed to the initalized module\n .apply(undefined, args));\n });\n}\nexport function contextualizeEventDefinitionModuleV2(eventDefinition) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => {\n // used by the CLI for webhook registration on build time\n return {\n slug: eventDefinition.type,\n };\n };\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n contextualMethod.__type = eventDefinition.__type;\n contextualMethod.type = eventDefinition.type;\n contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;\n contextualMethod.transformations = eventDefinition.transformations;\n return contextualMethod;\n}\nexport function contextualizeSerivcePluginModuleV2(servicePlugin) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n contextualMethod.__type = servicePlugin.__type;\n contextualMethod.componentType = servicePlugin.componentType;\n contextualMethod.methods = servicePlugin.methods;\n return contextualMethod;\n}\n"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,mBCmBpB,SAASC,EAA0BC,EAAYC,EAAU,CAC5D,MAAQ,IAAIC,IAAS,CACjB,IAAMC,EAAUC,EAAe,EAC/B,OAAKD,EAIGA,EACH,eAAeH,EAAYC,CAAQ,EAEnC,MAAM,OAAWC,CAAI,EALfF,EAAW,MAAM,OAAWE,CAAI,CAM/C,CACJ,CD9BO,SAASG,GAAiB,CAC7B,IAAMC,EAAa,OAAO,YAAgB,KAAe,YAAY,eAC/D,YAAY,eACZ,OAAO,WAAW,gBAAoB,KACpC,WAAW,gBAAgB,eACzB,WAAW,gBAAgB,eAC3B,OACV,GAAIA,EACA,MAAO,CAEH,eAAeC,EAASC,EAAU,CAC9B,OAAOC,EAAkB,IAAMH,EAAWC,EAASC,CAAQ,CAAC,CAChE,EACA,eAAgB,CACZ,MAAM,IAAI,MAAM,gDAAgD,CACpE,EACA,SAAU,CACN,MAAM,IAAI,MAAM,0CAA0C,CAC9D,CACJ,EAEJ,IAAME,EAAmB,OAAO,YAAgB,IAC1C,YAAY,OACZ,OAAOC,EAAW,OAAW,IACzBA,EAAW,OACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,OAC3B,OACRC,EAAiB,OAAO,YAAgB,IACxC,YAAY,eACZ,OAAOD,EAAW,eAAmB,IACjCA,EAAW,eACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,eAC3B,OACd,GAAI,GAACD,GAAoB,CAACE,GAG1B,MAAO,CACH,eAAeC,EAAYL,EAAU,CACjC,GAAIA,EAAU,CACV,GAAI,CAACI,EACD,MAAM,IAAI,MAAM,2JAA2J,EAE/K,OAAOH,EAAkB,IAAMG,EAAe,IAAIC,CAAU,CAAC,CACjE,CACA,GAAI,CAACH,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOD,EAAkB,IAAMC,EAAiB,IAAIG,CAAU,CAAC,CACnE,EACA,cAAe,CAACC,EAAcC,IAAgB,CAC1C,GAAI,CAACL,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,cAAcI,EAAcC,CAAW,CACnE,EACA,SAAU,CACN,GAAI,CAACL,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,IAC5B,EACA,MAAM,QAAQM,EAAOC,EAAWC,EAAM,CAClC,GAAI,CAACR,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,QAAQM,EAAOC,EAAWC,CAAI,CAC1D,CACJ,CACJ,CA+CO,SAASC,EAAkBC,EAAI,CAClC,IAAMC,EAAgB,WAAW,gBAC3BC,EAAgB,CAClB,OAAQC,EAAW,OACnB,eAAgBA,EAAW,cAC/B,EACIC,EACJ,WAAW,gBAAkB,OAC7BD,EAAW,OAAS,OACpBA,EAAW,eAAiB,OACxB,OAAO,YAAgB,MACvBC,EAAiB,CACb,OAAQ,aAAa,OACrB,eAAgB,aAAa,cACjC,EACA,OAAO,YAAY,OACnB,OAAO,YAAY,gBAEvB,GAAI,CACA,OAAOJ,EAAG,CACd,QACA,CACI,WAAW,gBAAkBC,EAC7BE,EAAW,OAASD,EAAc,OAClCC,EAAW,eAAiBD,EAAc,eACtC,OAAO,YAAgB,MACvB,YAAY,OAASE,EAAe,OACpC,YAAY,eAAiBA,EAAe,eAEpD,CACJ","names":["wixContext","contextualizeRESTModuleV2","restModule","elevated","args","context","resolveContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","wixContext","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as P}from"./chunk-J3SVE4GM.js";import{a as R,b as M,d as $}from"./chunk-7EYXEF6M.js";import{f as _}from"./chunk-SBZEOPXX.js";$();import{wixContext as Z}from"@wix/sdk-context";var ee=e=>{switch(e){case"get":case"GET":return"GET";case"post":case"POST":return"POST";case"put":case"PUT":return"PUT";case"delete":case"DELETE":return"DELETE";case"patch":case"PATCH":return"PATCH";case"head":case"HEAD":return"HEAD";case"options":case"OPTIONS":return"OPTIONS";default:throw new Error(`Unknown method: ${e}`)}},q=e=>t=>async s=>{let a,r=n=>{if(a=e(s)(n),a.url===void 0)throw new Error("Url was not successfully created for this request, please reach out to support channels for assistance.");let{method:i,url:o,params:p}=a;return{...a,method:ee(i),url:o,data:a.data,params:p}};try{let n=await t.request(r);if(a===void 0)throw new Error("Request options were not created for this request, please reach out to support channels for assistance.");let i=Array.isArray(a.transformResponse)?a.transformResponse:[a.transformResponse],o=n.data;return i.forEach(p=>{p&&(o=p(n.data,n.headers))}),o}catch(n){throw typeof n=="object"&&n!==null&&"response"in n&&typeof n.response=="object"&&n.response!==null&&"data"in n.response?n.response.data:n}},j=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var N="__metadata",x="www.wixapis.com",O="edge.wixapis.com";var b=class extends Error{constructor(s,a){super(s);_(this,"message");_(this,"response");this.message=s,this.response=a}async details(){let s=await this.response.json();return te(this.response.status,s?.message,s?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:s})}},te=(e,t,s,a)=>({details:{...!s?.validationError&&{applicationError:{description:t,code:e,data:a}},...s},message:t,requestId:a?.requestId});var W=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},J=e=>e&&typeof e=="object"&&!Array.isArray(e);var D=e=>e.__type==="host";function F(e,t){return e.create(t)}var se="x-wix-bi-gateway";function k(e,t,s){return{[se]:re({environment:`js-sdk${s?`-${s}`:""}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function re(e){return Object.entries(e).filter(([t,s])=>!!s).map(([t,s])=>`${t}=${s}`).join(",")}function I(e){return ie(e).map(t=>t.toLocaleUpperCase()).join("_")}var ne=/([\p{Ll}\d])(\p{Lu})/gu,oe=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,B="$1\0$2",ae=/[^\p{L}\d]+/giu;function ie(e){let t=e.trim();t=t.replace(ne,B).replace(oe,B),t=t.replace(ae,"\0");let s=0,a=t.length;for(;t.charAt(s)==="\0";)s++;if(s===a)return[];for(;t.charAt(a-1)==="\0";)a--;return t.slice(s,a).split(/\0/g)}var de=e=>"validationError"in(e.response?.data?.details??{}),ce=e=>"applicationError"in(e.response?.data?.details??{}),pe=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function C(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},s=[]){if(typeof e!="object"||e===null)throw e;if(de(e))return ue(e,t,s);if(ce(e))return le(e);if(pe(e)){let a=e.response?.status,r=e.response?.statusText??"UNKNOWN",n=e.response?.data?.message??r,i={applicationError:{description:r,code:I(r),data:{}},requestId:e.requestId};return H(e,{message:JSON.stringify({message:n,details:i},null,2),extraProperties:{details:i,status:a}})}return fe(e)}var ue=(e,t,s)=>{let a=e.response?.data,r=e.requestId,{fieldViolations:n}=a.details.validationError,i=he(t,n,s)?.sort((f,c)=>f.field<c.field?-1:1),o=`INVALID_ARGUMENT: ${i?.map(({field:f,description:c})=>`"${f}" ${c}`)?.join(", ")}`,p={validationError:{fieldViolations:i},requestId:r};return H(e,{message:JSON.stringify({message:o,details:p},null,2),extraProperties:{details:p,status:e.response?.status,requestId:r}})},H=(e,{message:t,extraProperties:s})=>Object.assign(e,{...s,message:t}),le=e=>{let t=e.response?.status,s=e.response?.statusText??"UNKNOWN",a=e.response?.data?.message??s,r=e.response?.data?.details?.applicationError?.description??s,n=e.response?.data?.details?.applicationError?.code??I(s),i=e.response?.data?.details?.applicationError?.data??{},o=a===r?a:`${a}: ${r}`,p={applicationError:{description:r,code:n,data:i},requestId:e.requestId};return H(e,{message:JSON.stringify({message:o,details:p},null,2),extraProperties:{details:p,status:t,requestId:e.requestId}})},fe=e=>{let t=e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`;return H(e,{message:t,extraProperties:{requestId:e.requestId,status:e.response?.status,code:I(e.response?.statusText??"UNKNOWN"),...!e.response&&{runtimeError:e}}})},he=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:s},a,r)=>{let n={...e,...t},i=Object.keys(n);return a?.filter(o=>!a.some(f=>f.field.length>o.field.length&&f.field.startsWith(o.field)&&i.includes(f.field))).map(o=>{let p=t[o.field];if(p)return{...o,field:G(p,r)};let f=i?.sort((c,u)=>u.length-c.length)?.find(c=>o.field.startsWith(c));if(f){let c=n[f];if(c)return{...o,field:o.field.replace(f,G(c,r))}}return s?{...o,field:`${r[0]}.${o.field}`}:o})},G=(e,t)=>{let s=me(e);return s!==null&&typeof s<"u"?e.replace(`$[${s}]`,t[s]):e},me=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function X(e,t,s,a,r,n,i,o,p){return P(()=>e({request:async f=>{let c=f({host:i?.HTTPHost||x}),u=c;u.method==="GET"&&u.fallback?.length&&(u.params?.toString().length??0)>4e3&&(u=c.fallback[0]);let y=i?.HTTPHost??x,d=`https://${p?O:y}${u.url}`;u.params&&u.params.toString()&&(d+=`?${u.params.toString()}`);try{let l=k(c,t,o),E={method:u.method,...u.data&&{body:JSON.stringify(u.data)},headers:{...l}},h=await s(d,E);if(h.status!==200){let T=null;try{T=await h.json()}catch{}let A=ye(h.status,T?.message,T?.details,{requestId:h.headers.get("X-Wix-Request-Id"),details:T}),v=C(A);throw a?.handleError(v,{requestOptions:{url:u.url,method:u.method,entityFqdn:c.entityFqdn,methodFqn:c.methodFqn}}),A}let g=await h.json();return{data:u.migrationOptions?.optInTransformResponse&&u.transformResponse?Array.isArray(u.transformResponse)?u.transformResponse[0](g):u.transformResponse(g):g,headers:h.headers,status:h.status,statusText:h.statusText}}catch(l){throw l.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),l}},fetchWithAuth:s,wixAPIFetch:r,getActiveToken:n}))}var L=class extends Error{constructor(s){super();_(this,"response");_(this,"requestId");this.response=s.response,this.requestId=s.requestId}},ye=(e,t,s,a)=>new L({response:{data:{details:{...!s?.validationError&&{applicationError:{description:t,code:e,data:a}},...s},message:t},status:e},requestId:a?.requestId});$();function U(){return{emit(e,...t){for(let s=0,a=this.events[e]||[],r=a.length;s<r;s++)a[s](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(s=>t!==s)}}}}var Y=e=>e.__type==="event-definition";function K(e,t,s,a){let r;if(e.isDomainEvent){let i=s,{deletedEvent:o,actionEvent:p,createdEvent:f,updatedEvent:c,...u}=i,y={...a,...u};o?o?.deletedEntity?r={entity:o?.deletedEntity,metadata:y}:r={metadata:y}:p?r={data:p.body,metadata:y}:r={entity:f?.entity??c?.currentEntity,metadata:y}}else r={data:s,metadata:a};let n=e.transformations??(i=>i);return t(n(r))}function z(e){let t=new Map,s=U(),a={...s,getRegisteredEvents:()=>t,async process(r,n={expectedEvents:[]}){let{eventType:i,identity:o,instanceId:p,payload:f}=await this.parseJWT(r),c=[...n.expectedEvents,...Array.from(t.keys()).map(y=>({type:y}))];if(c.length>0&&!c.some(({type:y})=>y===i))throw new Error(`Unexpected event type: ${i}. Expected one of: ${c.map(y=>y.type).join(", ")}`);let u=t.get(i)??[];return await Promise.all(u.map(({eventDefinition:y,handler:d})=>K(y,d,f,{instanceId:p,identity:o}))),{instanceId:p,eventType:i,payload:f,identity:o}},async processRequest(r,n){let i=await r.text();return this.process(i,n)},async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:n,valid:i}=await e.decodeJWT(r);if(!i)throw new Error("JWT is not valid");if(typeof n.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof n.data}`);let o=JSON.parse(n.data),p=o.eventType,f=o.instanceId,c=o.identity?JSON.parse(o.identity):void 0,u=JSON.parse(o.data);return{instanceId:f,eventType:p,payload:u,identity:c}},async parseRequest(r){let n=await r.text();return this.parseJWT(n)},async executeHandlers(r){let n=Array.from(t.keys()).map(o=>({type:o}));if(n.length>0&&!n.some(({type:o})=>o===r.eventType))throw new Error(`Unexpected event type: ${r.eventType}. Expected one of: ${n.map(o=>o.type).join(", ")}`);let i=t.get(r.eventType)??[];await Promise.all(i.map(({eventDefinition:o,handler:p})=>K(o,p,r.payload,{instanceId:r.instanceId,identity:r.identity})))},apps:{AppInstalled:R("AppInstalled")(),AppRemoved:R("AppRemoved")()}};return{initModule(r){return n=>{let i=t.get(r.type)??[];i.push({eventDefinition:r,handler:n}),t.set(r.type,i),s.emit("registered",r)}},client:a}}var Q=e=>e.__type==="service-plugin-definition";function V(e){let t=new Map,s=U(),a={...s,getRegisteredServicePlugins:()=>t,async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:n,valid:i}=await e.decodeJWT(r,!0);if(!i)throw new Error("JWT is not valid");if(typeof n.data!="object"||n.data===null||!("metadata"in n.data)||typeof n.data.metadata!="object"||n.data.metadata===null||!("appExtensionType"in n.data.metadata)||typeof n.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return n.data},async process(r){let n=await this.parseJWT(r.body);return this.executeHandler(n,r.url)},async parseRequest(r){let n=await r.text();return this.parseJWT(n)},async processRequest(r){let n=r.url,i=await r.text();try{let o=await this.process({url:n,body:i});return Response.json(o)}catch(o){if(o.errorType==="SPI"&&o.applicationCode&&o.httpCode)return Response.json({applicationError:{code:o.applicationCode,data:o.data}},{status:o.httpCode});throw o}},async executeHandler(r,n){let i=r.metadata.appExtensionType.toLowerCase(),o=t.get(i)??[];if(o.length===0)throw new Error(`No service plugin implementations found for component type ${i}`);if(o.length>1)throw new Error(`Multiple service plugin implementations found for component type ${i}. This is currently not supported`);let{implementation:p,servicePluginDefinition:f}=o[0],c=f.methods.find(y=>n.endsWith(y.primaryHttpMappingPath));if(!c)throw new Error("Unexpect request: request url did not match any method: "+n);let u=p[c.name];if(!u)throw new Error(`Got request for service plugin method ${c.name} but no implementation was provided. Available methods: ${Object.keys(p).join(", ")}`);return c.transformations.toREST(await u(c.transformations.fromREST(r)))}};return{initModule(r){return n=>{let i=t.get(r.componentType.toLowerCase())??[];i.push({servicePluginDefinition:r,implementation:n}),t.set(r.componentType.toLowerCase(),i),s.emit("registered",r)}},client:a}}var w="X-Wix-Consistent";function Qe(e){let t=e.headers||{Authorization:""},s=e.auth||{getAuthHeaders:d=>Promise.resolve({headers:{}})},a=s.getAuthHeaders.bind(void 0,e.host);s.getAuthHeaders=a;let r=async(d,l)=>{let E=await a(),h={...l?.headers??{},...E.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}},g=e.host?.getErrorHandler?.();try{if(typeof d=="string"||d instanceof URL){let m=await fetch(d,{...l,headers:h});g?.handleError(m,{requestOptions:{url:d.toString(),method:l?.method}});let T=S(m);return T&&(t[w]=T),m}else{for(let[A,v]of Object.entries(h))typeof v=="string"&&d.headers.set(A,v);let m=await fetch(d,l);g?.handleError(m,{requestOptions:{url:d.url,method:l?.method}});let T=S(m);return T&&(t[w]=T),m}}catch(m){throw g?.handleError(m,{requestOptions:{url:typeof d=="string"||d instanceof URL?d.toString():d.url,method:l?.method}}),m}},{client:n,initModule:i}=V(s),{client:o,initModule:p}=z(s),f=async(d,l)=>{let E=await a(),h=W(l),g=await fetch(d,{...l,headers:{...h,...t,...E?.headers,...l?.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}}}),m=S(g);return m&&(t[w]=m),g},c=(d,l)=>{if(Y(d))return p(d);if(Q(d))return i(d);if(D(d)&&e.host)return F(d,e.host);if(typeof d=="function"){if("__type"in d&&d.__type===M)return d;let E=e.host?.apiBaseUrl??x,h=e.useCDN===void 0?e.auth?.shouldUseCDN:e.useCDN;return X(P(()=>j(d))?q(d):d,l??{},f,e.host?.getErrorHandler?.(),(g,m)=>{let T=new URL(g,`https://${E}`);return T.host=E,T.protocol="https",f(T.toString(),m)},s.getActiveToken,{HTTPHost:E},e.host?.name,h)}else return J(d)?Object.fromEntries(Object.entries(d).map(([E,h])=>[E,c(h,d[N])])):d},u=d=>{for(let l in d)t[l]=d[l]};return{...e.modules?c(e.modules):{},auth:s,setHeaders:u,use:c,enableContext(d,l={elevated:!1}){d==="global"?globalThis.__wix_context__!=null?l.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:l.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:l.elevated?Z.elevatedClient=this:Z.client=this},fetch:(d,l)=>{let E=e.host?.apiBaseUrl??x,h=new URL(d,`https://${E}`);return h.host=E,h.protocol="https",f(h.toString(),l)},fetchWithAuth:r,async graphql(d,l,E={apiVersion:"alpha"}){let h=e?.host?.apiBaseUrl??x,g=await f(`https://${h}/graphql/${E.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:d,variables:l})});if(g.status!==200)throw new b(`GraphQL request failed with status ${g.status}`,g);let{data:m,errors:T}=await g.json();return{data:m??{},errors:T}},webhooks:o,servicePlugins:n}}function S(e){return e.headers?.get(w)??e.headers?.get(w.toLowerCase())}export{Qe as a};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as P}from"./chunk-R7FAXXP7.js";import{a as R,b as M,d as $}from"./chunk-7EYXEF6M.js";import{f as _}from"./chunk-SBZEOPXX.js";$();import{wixContext as Z}from"@wix/sdk-context";var ee=e=>{switch(e){case"get":case"GET":return"GET";case"post":case"POST":return"POST";case"put":case"PUT":return"PUT";case"delete":case"DELETE":return"DELETE";case"patch":case"PATCH":return"PATCH";case"head":case"HEAD":return"HEAD";case"options":case"OPTIONS":return"OPTIONS";default:throw new Error(`Unknown method: ${e}`)}},q=e=>t=>async s=>{let a,r=n=>{if(a=e(s)(n),a.url===void 0)throw new Error("Url was not successfully created for this request, please reach out to support channels for assistance.");let{method:i,url:o,params:p}=a;return{...a,method:ee(i),url:o,data:a.data,params:p}};try{let n=await t.request(r);if(a===void 0)throw new Error("Request options were not created for this request, please reach out to support channels for assistance.");let i=Array.isArray(a.transformResponse)?a.transformResponse:[a.transformResponse],o=n.data;return i.forEach(p=>{p&&(o=p(n.data,n.headers))}),o}catch(n){throw typeof n=="object"&&n!==null&&"response"in n&&typeof n.response=="object"&&n.response!==null&&"data"in n.response?n.response.data:n}},j=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var N="__metadata",x="www.wixapis.com",O="edge.wixapis.com";var b=class extends Error{constructor(s,a){super(s);_(this,"message");_(this,"response");this.message=s,this.response=a}async details(){let s=await this.response.json();return te(this.response.status,s?.message,s?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:s})}},te=(e,t,s,a)=>({details:{...!s?.validationError&&{applicationError:{description:t,code:e,data:a}},...s},message:t,requestId:a?.requestId});var W=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},J=e=>e&&typeof e=="object"&&!Array.isArray(e);var D=e=>e.__type==="host";function F(e,t){return e.create(t)}var se="x-wix-bi-gateway";function k(e,t,s){return{[se]:re({environment:`js-sdk${s?`-${s}`:""}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function re(e){return Object.entries(e).filter(([t,s])=>!!s).map(([t,s])=>`${t}=${s}`).join(",")}function I(e){return ie(e).map(t=>t.toLocaleUpperCase()).join("_")}var ne=/([\p{Ll}\d])(\p{Lu})/gu,oe=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,B="$1\0$2",ae=/[^\p{L}\d]+/giu;function ie(e){let t=e.trim();t=t.replace(ne,B).replace(oe,B),t=t.replace(ae,"\0");let s=0,a=t.length;for(;t.charAt(s)==="\0";)s++;if(s===a)return[];for(;t.charAt(a-1)==="\0";)a--;return t.slice(s,a).split(/\0/g)}var de=e=>"validationError"in(e.response?.data?.details??{}),ce=e=>"applicationError"in(e.response?.data?.details??{}),pe=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function C(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},s=[]){if(typeof e!="object"||e===null)throw e;if(de(e))return ue(e,t,s);if(ce(e))return le(e);if(pe(e)){let a=e.response?.status,r=e.response?.statusText??"UNKNOWN",n=e.response?.data?.message??r,i={applicationError:{description:r,code:I(r),data:{}},requestId:e.requestId};return H(e,{message:JSON.stringify({message:n,details:i},null,2),extraProperties:{details:i,status:a}})}return fe(e)}var ue=(e,t,s)=>{let a=e.response?.data,r=e.requestId,{fieldViolations:n}=a.details.validationError,i=he(t,n,s)?.sort((f,c)=>f.field<c.field?-1:1),o=`INVALID_ARGUMENT: ${i?.map(({field:f,description:c})=>`"${f}" ${c}`)?.join(", ")}`,p={validationError:{fieldViolations:i},requestId:r};return H(e,{message:JSON.stringify({message:o,details:p},null,2),extraProperties:{details:p,status:e.response?.status,requestId:r}})},H=(e,{message:t,extraProperties:s})=>Object.assign(e,{...s,message:t}),le=e=>{let t=e.response?.status,s=e.response?.statusText??"UNKNOWN",a=e.response?.data?.message??s,r=e.response?.data?.details?.applicationError?.description??s,n=e.response?.data?.details?.applicationError?.code??I(s),i=e.response?.data?.details?.applicationError?.data??{},o=a===r?a:`${a}: ${r}`,p={applicationError:{description:r,code:n,data:i},requestId:e.requestId};return H(e,{message:JSON.stringify({message:o,details:p},null,2),extraProperties:{details:p,status:t,requestId:e.requestId}})},fe=e=>{let t=e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`;return H(e,{message:t,extraProperties:{requestId:e.requestId,status:e.response?.status,code:I(e.response?.statusText??"UNKNOWN"),...!e.response&&{runtimeError:e}}})},he=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:s},a,r)=>{let n={...e,...t},i=Object.keys(n);return a?.filter(o=>!a.some(f=>f.field.length>o.field.length&&f.field.startsWith(o.field)&&i.includes(f.field))).map(o=>{let p=t[o.field];if(p)return{...o,field:G(p,r)};let f=i?.sort((c,u)=>u.length-c.length)?.find(c=>o.field.startsWith(c));if(f){let c=n[f];if(c)return{...o,field:o.field.replace(f,G(c,r))}}return s?{...o,field:`${r[0]}.${o.field}`}:o})},G=(e,t)=>{let s=me(e);return s!==null&&typeof s<"u"?e.replace(`$[${s}]`,t[s]):e},me=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function X(e,t,s,a,r,n,i,o,p){return P(()=>e({request:async f=>{let c=f({host:i?.HTTPHost||x}),u=c;u.method==="GET"&&u.fallback?.length&&(u.params?.toString().length??0)>4e3&&(u=c.fallback[0]);let y=i?.HTTPHost??x,d=`https://${p?O:y}${u.url}`;u.params&&u.params.toString()&&(d+=`?${u.params.toString()}`);try{let l=k(c,t,o),E={method:u.method,...u.data&&{body:JSON.stringify(u.data)},headers:{...l}},h=await s(d,E);if(h.status!==200){let T=null;try{T=await h.json()}catch{}let A=ye(h.status,T?.message,T?.details,{requestId:h.headers.get("X-Wix-Request-Id"),details:T}),v=C(A);throw a?.handleError(v,{requestOptions:{url:u.url,method:u.method,entityFqdn:c.entityFqdn,methodFqn:c.methodFqn}}),A}let g=await h.json();return{data:u.migrationOptions?.optInTransformResponse&&u.transformResponse?Array.isArray(u.transformResponse)?u.transformResponse[0](g):u.transformResponse(g):g,headers:h.headers,status:h.status,statusText:h.statusText}}catch(l){throw l.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),l}},fetchWithAuth:s,wixAPIFetch:r,getActiveToken:n}))}var L=class extends Error{constructor(s){super();_(this,"response");_(this,"requestId");this.response=s.response,this.requestId=s.requestId}},ye=(e,t,s,a)=>new L({response:{data:{details:{...!s?.validationError&&{applicationError:{description:t,code:e,data:a}},...s},message:t},status:e},requestId:a?.requestId});$();function U(){return{emit(e,...t){for(let s=0,a=this.events[e]||[],r=a.length;s<r;s++)a[s](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(s=>t!==s)}}}}var Y=e=>e.__type==="event-definition";function K(e,t,s,a){let r;if(e.isDomainEvent){let i=s,{deletedEvent:o,actionEvent:p,createdEvent:f,updatedEvent:c,...u}=i,y={...a,...u};o?o?.deletedEntity?r={entity:o?.deletedEntity,metadata:y}:r={metadata:y}:p?r={data:p.body,metadata:y}:r={entity:f?.entity??c?.currentEntity,metadata:y}}else r={data:s,metadata:a};let n=e.transformations??(i=>i);return t(n(r))}function z(e){let t=new Map,s=U(),a={...s,getRegisteredEvents:()=>t,async process(r,n={expectedEvents:[]}){let{eventType:i,identity:o,instanceId:p,payload:f}=await this.parseJWT(r),c=[...n.expectedEvents,...Array.from(t.keys()).map(y=>({type:y}))];if(c.length>0&&!c.some(({type:y})=>y===i))throw new Error(`Unexpected event type: ${i}. Expected one of: ${c.map(y=>y.type).join(", ")}`);let u=t.get(i)??[];return await Promise.all(u.map(({eventDefinition:y,handler:d})=>K(y,d,f,{instanceId:p,identity:o}))),{instanceId:p,eventType:i,payload:f,identity:o}},async processRequest(r,n){let i=await r.text();return this.process(i,n)},async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:n,valid:i}=await e.decodeJWT(r);if(!i)throw new Error("JWT is not valid");if(typeof n.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof n.data}`);let o=JSON.parse(n.data),p=o.eventType,f=o.instanceId,c=o.identity?JSON.parse(o.identity):void 0,u=JSON.parse(o.data);return{instanceId:f,eventType:p,payload:u,identity:c}},async parseRequest(r){let n=await r.text();return this.parseJWT(n)},async executeHandlers(r){let n=Array.from(t.keys()).map(o=>({type:o}));if(n.length>0&&!n.some(({type:o})=>o===r.eventType))throw new Error(`Unexpected event type: ${r.eventType}. Expected one of: ${n.map(o=>o.type).join(", ")}`);let i=t.get(r.eventType)??[];await Promise.all(i.map(({eventDefinition:o,handler:p})=>K(o,p,r.payload,{instanceId:r.instanceId,identity:r.identity})))},apps:{AppInstalled:R("AppInstalled")(),AppRemoved:R("AppRemoved")()}};return{initModule(r){return n=>{let i=t.get(r.type)??[];i.push({eventDefinition:r,handler:n}),t.set(r.type,i),s.emit("registered",r)}},client:a}}var Q=e=>e.__type==="service-plugin-definition";function V(e){let t=new Map,s=U(),a={...s,getRegisteredServicePlugins:()=>t,async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:n,valid:i}=await e.decodeJWT(r,!0);if(!i)throw new Error("JWT is not valid");if(typeof n.data!="object"||n.data===null||!("metadata"in n.data)||typeof n.data.metadata!="object"||n.data.metadata===null||!("appExtensionType"in n.data.metadata)||typeof n.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return n.data},async process(r){let n=await this.parseJWT(r.body);return this.executeHandler(n,r.url)},async parseRequest(r){let n=await r.text();return this.parseJWT(n)},async processRequest(r){let n=r.url,i=await r.text();try{let o=await this.process({url:n,body:i});return Response.json(o)}catch(o){if(o.errorType==="SPI"&&o.applicationCode&&o.httpCode)return Response.json({applicationError:{code:o.applicationCode,data:o.data}},{status:o.httpCode});throw o}},async executeHandler(r,n){let i=r.metadata.appExtensionType.toLowerCase(),o=t.get(i)??[];if(o.length===0)throw new Error(`No service plugin implementations found for component type ${i}`);if(o.length>1)throw new Error(`Multiple service plugin implementations found for component type ${i}. This is currently not supported`);let{implementation:p,servicePluginDefinition:f}=o[0],c=f.methods.find(y=>n.endsWith(y.primaryHttpMappingPath));if(!c)throw new Error("Unexpect request: request url did not match any method: "+n);let u=p[c.name];if(!u)throw new Error(`Got request for service plugin method ${c.name} but no implementation was provided. Available methods: ${Object.keys(p).join(", ")}`);return c.transformations.toREST(await u(c.transformations.fromREST(r)))}};return{initModule(r){return n=>{let i=t.get(r.componentType.toLowerCase())??[];i.push({servicePluginDefinition:r,implementation:n}),t.set(r.componentType.toLowerCase(),i),s.emit("registered",r)}},client:a}}var w="X-Wix-Consistent";function Qe(e){let t=e.headers||{Authorization:""},s=e.auth||{getAuthHeaders:d=>Promise.resolve({headers:{}})},a=s.getAuthHeaders.bind(void 0,e.host);s.getAuthHeaders=a;let r=async(d,l)=>{let E=await a(),h={...l?.headers??{},...E.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}},g=e.host?.getErrorHandler?.();try{if(typeof d=="string"||d instanceof URL){let m=await fetch(d,{...l,headers:h});g?.handleError(m,{requestOptions:{url:d.toString(),method:l?.method}});let T=S(m);return T&&(t[w]=T),m}else{for(let[A,v]of Object.entries(h))typeof v=="string"&&d.headers.set(A,v);let m=await fetch(d,l);g?.handleError(m,{requestOptions:{url:d.url,method:l?.method}});let T=S(m);return T&&(t[w]=T),m}}catch(m){throw g?.handleError(m,{requestOptions:{url:typeof d=="string"||d instanceof URL?d.toString():d.url,method:l?.method}}),m}},{client:n,initModule:i}=V(s),{client:o,initModule:p}=z(s),f=async(d,l)=>{let E=await a(),h=W(l),g=await fetch(d,{...l,headers:{...h,...t,...E?.headers,...l?.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}}}),m=S(g);return m&&(t[w]=m),g},c=(d,l)=>{if(Y(d))return p(d);if(Q(d))return i(d);if(D(d)&&e.host)return F(d,e.host);if(typeof d=="function"){if("__type"in d&&d.__type===M)return d;let E=e.host?.apiBaseUrl??x,h=e.useCDN===void 0?e.auth?.shouldUseCDN:e.useCDN;return X(P(()=>j(d))?q(d):d,l??{},f,e.host?.getErrorHandler?.(),(g,m)=>{let T=new URL(g,`https://${E}`);return T.host=E,T.protocol="https",f(T.toString(),m)},s.getActiveToken,{HTTPHost:E},e.host?.name,h)}else return J(d)?Object.fromEntries(Object.entries(d).map(([E,h])=>[E,c(h,d[N])])):d},u=d=>{for(let l in d)t[l]=d[l]};return{...e.modules?c(e.modules):{},auth:s,setHeaders:u,use:c,enableContext(d,l={elevated:!1}){d==="global"?globalThis.__wix_context__!=null?l.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:l.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:l.elevated?Z.elevatedClient=this:Z.client=this},fetch:(d,l)=>{let E=e.host?.apiBaseUrl??x,h=new URL(d,`https://${E}`);return h.host=E,h.protocol="https",f(h.toString(),l)},fetchWithAuth:r,async graphql(d,l,E={apiVersion:"alpha"}){let h=e?.host?.apiBaseUrl??x,g=await f(`https://${h}/graphql/${E.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:d,variables:l})});if(g.status!==200)throw new b(`GraphQL request failed with status ${g.status}`,g);let{data:m,errors:T}=await g.json();return{data:m??{},errors:T}},webhooks:o,servicePlugins:n}}function S(e){return e.headers?.get(w)??e.headers?.get(w.toLowerCase())}export{Qe as a};
|
|
2
|
+
//# sourceMappingURL=chunk-WBKL5IQV.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Q}from"./chunk-EZGPNUD5.js";import{a as G}from"./chunk-QFPCSRLT.js";import"./chunk-J3SVE4GM.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(null,arguments)}import Be,{useEffect as Ke,useState as _e}from"react";import{wixContext as g}from"@wix/sdk-context";function X(){let e=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(e)return{initWixModules(r,o){return O(()=>e(r,o))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof g.client<"u"?g.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,n=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof g.elevatedClient<"u"?g.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!n))return{initWixModules(r,o){if(o){if(!n)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return O(()=>n.use(r))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return O(()=>t.use(r))},fetchWithAuth:(r,o)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(r,o)},getAuth(){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.auth},async graphql(r,o,s){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(r,o,s)}}}function O(e){let t=globalThis.__wix_context__,n={client:g.client,elevatedClient:g.elevatedClient},r;globalThis.__wix_context__=void 0,g.client=void 0,g.elevatedClient=void 0,typeof $wixContext<"u"&&(r={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,g.client=n.client,g.elevatedClient=n.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=r.client,$wixContext.elevatedClient=r.elevatedClient)}}function Y(e,t){return{...e,...Object.fromEntries(t.map(n=>[n,(...r)=>{let o=X();if(!o)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return o.initWixModules(e)[n].apply(void 0,r)}]))}}function Z(e){return Y({__type:"host",create:t=>Object.entries(e).reduce((n,[r,o])=>({...n,[r]:o(t)}),{})},Object.keys(e))}function b(e){"@babel/helpers - typeof";return b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(e)}function ee(e,t){if(b(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(b(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function te(e){var t=ee(e,"string");return b(t)=="symbol"?t:t+""}function ne(e,t,n){return(t=te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=class extends Error{constructor(t){let{message:n,code:r}=t;super(n),ne(this,"code",void 0),this.message=n,this.code=r}};var re=()=>{let e=l=>{let{channel:i}=l;return function(){let f=i.showToast(...arguments);return{remove:()=>Promise.resolve(f).then(x=>x.remove())}}},t=l=>{let{channel:i}=l;return function(){let f=i.observeState(...arguments);return{disconnect:()=>Promise.resolve(f).then(x=>x.disconnect())}}};return{showToast:e,observeState:t,navigate:l=>{let{channel:i}=l;return function(){return i.navigate(...arguments)}},navigateBack:l=>{let{channel:i}=l;return()=>i.navigateBack()},openModal:l=>{let{channel:i}=l;return(f,m)=>{let[x,k]=typeof f=="string"?[f,m]:[f.modalId,f.params],E=i.openModal(x,k);return{modalClosed:Promise.resolve(E).then(w=>w.modalClosed)}}},closeModal:l=>{let{channel:i}=l;return f=>{if(f===void 0)return i.closeModal();let m=JSON.parse(JSON.stringify(f));return i.closeModal(m)}},getAccessToken:l=>{let{channel:i}=l;return()=>i.getAccessToken()},getPageUrl:l=>{let{channel:i}=l;return function(){return i.getPageUrl(...arguments)}},openMediaManager:l=>{let{channel:i}=l;return function(){return i.openMediaManager(...arguments)}},addSitePlugin:l=>{let{channel:i}=l;return(f,m)=>{let x="802c76e4-b381-4bb3-9152-96acabbf3194",k=m?.placement||{},E=i.openModal(x,{...k,placementsSlotId:m?.slotId,pluginId:f,action:"populate"});return Promise.resolve(E).then(w=>w.modalClosed).then(w=>{if(w?.type===void 0)throw new S({message:"Aborted by user",code:3006});if(w?.type==="ERROR")throw new S(w.data.error)})}},onBeforeUnload:l=>{let{channel:i}=l;return function(){return i.onBeforeUnload(...arguments)}},setPageTitle:l=>{let{channel:i}=l;return f=>i.setPageTitle(f)},getLanguage:l=>{let i=null;return async()=>{var f;if(i)return i;let m=null;return i=await new Promise(x=>{m=t(l)((k,E)=>{x(E.language)})}),(f=m)==null||f.disconnect(),i}},requestFeedback:l=>{let{channel:i}=l;return function(){return i.requestFeedback(...arguments)}},onLayerStateChange:l=>{let{channel:i}=l;return function(){let f=i.onLayerStateChange(...arguments);return{remove:()=>Promise.resolve(f).then(x=>x.remove())}}},installApp:l=>{let{channel:i}=l;return i.installApp},getSiteInfo:l=>{let{channel:i}=l;return i.getSiteInfo},getWidget:l=>{let{channel:i}=l;return function(){if("getWidget"in i)return i.getWidget(...arguments);throw new Error("Unsupported")}},getDashboardPlugins:l=>{let{channel:i}=l;return function(){if("getDashboardPlugins"in i)return i.getDashboardPlugins(...arguments);throw new Error("Unsupported")}},getDashboardMenuPlugins:l=>{let{channel:i}=l;return function(){if("getDashboardMenuPlugins"in i)return i.getDashboardMenuPlugins(...arguments);throw new Error("Unsupported")}}}};var oe=e=>{let{createHost:t}=e,n=re();return{...Z(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var se=Symbol("Comlink.proxy"),Ce=Symbol("Comlink.endpoint"),I=Symbol("Comlink.releaseProxy"),U=Symbol("Comlink.thrown"),ae=e=>typeof e=="object"&&e!==null||typeof e=="function",Ee={canHandle:e=>ae(e)&&e[se],serialize(e){let{port1:t,port2:n}=new MessageChannel;return R(e,t),[n,[n]]},deserialize(e){return e.start(),L(e)}},Se={canHandle:e=>ae(e)&&U in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},le=new Map([["proxy",Ee],["throw",Se]]);function R(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:o,type:s,path:u}=Object.assign({path:[]},r.data),a=(r.data.argumentList||[]).map(v),c;try{let d=u.slice(0,-1).reduce((p,y)=>p[y],e),h=u.reduce((p,y)=>p[y],e);switch(s){case 0:c=h;break;case 1:d[u.slice(-1)[0]]=v(r.data.value),c=!0;break;case 2:c=h.apply(d,a);break;case 3:{let p=new h(...a);c=W(p)}break;case 4:{let{port1:p,port2:y}=new MessageChannel;R(e,y),c=Ae(p,[p])}break;case 5:c=void 0;break}}catch(d){c={value:d,[U]:0}}Promise.resolve(c).catch(d=>({value:d,[U]:0})).then(d=>{let[h,p]=B(d);t.postMessage(Object.assign(Object.assign({},h),{id:o}),p),s===5&&(t.removeEventListener("message",n),ue(t))})}),t.start&&t.start()}function We(e){return e.constructor.name==="MessagePort"}function ue(e){We(e)&&e.close()}function L(e,t){return H(e,[],t)}function T(e){if(e)throw new Error("Proxy has been released and is not useable")}function H(e,t=[],n=function(){}){let r=!1,o=new Proxy(n,{get(s,u){if(T(r),u===I)return()=>P(e,{type:5,path:t.map(a=>a.toString())}).then(()=>{ue(e),r=!0});if(u==="then"){if(t.length===0)return{then:()=>o};let a=P(e,{type:0,path:t.map(c=>c.toString())}).then(v);return a.then.bind(a)}return H(e,[...t,u])},set(s,u,a){T(r);let[c,d]=B(a);return P(e,{type:1,path:[...t,u].map(h=>h.toString()),value:c},d).then(v)},apply(s,u,a){T(r);let c=t[t.length-1];if(c===Ce)return P(e,{type:4}).then(v);if(c==="bind")return H(e,t.slice(0,-1));let[d,h]=ie(a);return P(e,{type:2,path:t.map(p=>p.toString()),argumentList:d},h).then(v)},construct(s,u){T(r);let[a,c]=ie(u);return P(e,{type:3,path:t.map(d=>d.toString()),argumentList:a},c).then(v)}});return o}function ke(e){return Array.prototype.concat.apply([],e)}function ie(e){let t=e.map(B);return[t.map(n=>n[0]),ke(t.map(n=>n[1]))]}var ce=new WeakMap;function Ae(e,t){return ce.set(e,t),e}function W(e){return Object.assign(e,{[se]:!0})}function B(e){for(let[t,n]of le)if(n.canHandle(e)){let[r,o]=n.serialize(e);return[{type:3,name:t,value:r},o]}return[{type:0,value:e},ce.get(e)||[]]}function v(e){switch(e.type){case 3:return le.get(e.name).deserialize(e.value);case 0:return e.value}}function P(e,t,n){return new Promise(r=>{let o=Te();e.addEventListener("message",function s(u){!u.data||!u.data.id||u.data.id!==o||(e.removeEventListener("message",s),r(u.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),n)})}function Te(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var K="__proxyCallbackId__wixSDK__",j="__proxyPromiseId__wixSDK__",fe=e=>ze(e,t=>async function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];let[s,u]=$(r),a=await t(W(s),u);return pe(a)});var De=async e=>{let[t,n]=$(await e);return W({proxies:t,clonables:n})},pe=async e=>z(e?.proxies,await e?.clonables),$=e=>{let t=(o,s)=>{if(he(s)){let u=de();return o.promises[u]=s,{[j]:u}}if(Oe(s)){let u=de();return o.callbacks[u]=(a,c)=>{let d=z(a,c),h=s(...d);return De(h)},{[K]:u}}return Array.isArray(s)?s.map(u=>t(o,u)):D(s)?me(s,u=>t(o,u)):s},n={promises:{},callbacks:{}},r=t(n,e);return[n,r]},z=(e,t)=>{if(Array.isArray(t))return t.map(n=>z(e,n));if(D(t)&&t.hasOwnProperty(j)){let n=t[j];return e.promises[n]}if(D(t)&&t.hasOwnProperty(K)){let n=t[K];return async function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];let[u,a]=$(o),c=await e.callbacks[n](W(u),a);return pe(c)}}return D(t)?me(t,n=>z(e,n)):t},ze=(e,t)=>new Proxy(e,{get(n,r){return n[r]?t(n[r]):()=>{throw new Error(`Serialization error occurred while accessing ${r} property of ${n}`)}}}),he=e=>e instanceof Promise,D=e=>e&&typeof e=="object"&&!he(e),Oe=e=>typeof e=="function",me=(e,t)=>{let n=r=>{let[o,s]=r;return[o,t(s)]};return Object.fromEntries(Object.entries(e).map(n))},de=(()=>{let e=0;return()=>++e})();var Ue="wix-sdk-bo-hello-handshake",xe=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:o}=new MessageChannel;t({code:Ue,version:"1.0.0",port:o},n,[o]);let a=fe(L(r));return{channel:a,close:()=>a[I]()}};var ge=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var He=["https://manage.wix.com","https://manage.editorx.com"],Ie=new Set(He),we=e=>Ie.has(e);var ye=e=>{let t=new EventTarget,n=typeof window>"u",r=a=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(a.preventDefault(),a.returnValue=!0)},o=e.onBeforeUnload(r),s=()=>{n||window.removeEventListener("beforeunload",r),o.then(a=>{let{remove:c}=a;return c()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",s)),{onBeforeUnload:a=>(t.addEventListener("beforeunload",a),{remove:()=>{t.removeEventListener("beforeunload",a)}}),clearBeforeUnloadHandler:s}};function Re(e){if(e)try{return JSON.parse(decodeURIComponent(e))}catch(t){console.warn('Failed to parse "essentials" query parameter. Make sure to run the code inside a supported Wix App extension.',t);return}}function be(e){return e.has("essentials")?Re(e.get("essentials")):void 0}var ve=e=>t=>{let{message:n,action:r,requestId:o}=t;n&&e.showToast({type:"error",details:o!=null?{requestId:o}:void 0,message:n,action:r&&{...r,removeToastOnClick:!0,uiType:"link"}})};var Me=function(e){e===void 0&&(e={});let t=e.fullUrl&&new URL(e.fullUrl).search||typeof window<"u"&&window.location.search||"",n=new URLSearchParams(t),r=e.origin||n.get("origin")||"",o=e.postMessage||window.parent.postMessage.bind(window.parent);if(!we(r))throw new Error("Wix Dashboard SDK: Unable to establish a connection with the Wix dashboard. Please ensure that you are running your app within the Wix dashboard.");let{channel:s,close:u}=xe({postMessage:o,origin:r}),a=[u];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let M=e.autoHeightElement||document.documentElement,_=ge(s,M);a.push(()=>_())}let{onBeforeUnload:c,clearBeforeUnloadHandler:d}=ye(s);a.push(d);let h=Le(n.get("siteInfo")||"","siteInfo"),p=()=>h,y=new Proxy(s,{get(M,_,J){return _==="onBeforeUnload"?c:_==="getSiteInfo"?p:Reflect.get(M,_,J)}}),{monitoring:C,...q}=be(n)||{},F=Q({hostContext:C?.context,monitoringConfig:C?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0}),N={openItemSelector:s.openItemSelector};return{channel:y,close:()=>a.forEach(M=>M()),getMonitoringClient:F,essentials:q,admin:N,showError:ve(s)}},Le=(e,t)=>{try{return JSON.parse(decodeURIComponent(e))}catch(n){return console.warn(`Failed to parse ${t} query parameter. Make sure to run the code inside a supported Wix App extension.`,n),{}}};var V=oe({createHost:Me});var Pe=(e,t)=>{let[n,r]=_e(()=>e());return t(n)&&r(e()),n},je=e=>t=>{let{host:n,compProps:r}=$e(t);return Pe(()=>(G({auth:V.auth(),host:n}).enableContext("module"),n),o=>o!==n),r?Be.createElement(e,A({host:n},r)):null},$e=e=>{let{host:t,...n}=e,{host:r,hostType:o}=Pe(()=>t?{host:t,hostType:"local"}:{host:V.host(),hostType:"remote"},a=>!!t&&t!==a.host),[s,u]=_e(void 0);return Ke(()=>{if(o==="local")return;let a=r.channel.observeState(d=>{u(d||{})}),c=async()=>{(await a).disconnect(),r.close()};return()=>{c()}},[r,o]),o==="local"?{host:r,compProps:n}:{host:r,compProps:s?{...s,...n}:void 0}};export{je as withContextualWixClient};
|
|
1
|
+
import{a as Q}from"./chunk-EZGPNUD5.js";import{a as G}from"./chunk-WBKL5IQV.js";import"./chunk-R7FAXXP7.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(null,arguments)}import Be,{useEffect as Ke,useState as _e}from"react";import{wixContext as g}from"@wix/sdk-context";function X(){let e=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(e)return{initWixModules(r,o){return O(()=>e(r,o))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof g.client<"u"?g.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,n=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof g.elevatedClient<"u"?g.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!n))return{initWixModules(r,o){if(o){if(!n)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return O(()=>n.use(r))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return O(()=>t.use(r))},fetchWithAuth:(r,o)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(r,o)},getAuth(){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.auth},async graphql(r,o,s){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(r,o,s)}}}function O(e){let t=globalThis.__wix_context__,n={client:g.client,elevatedClient:g.elevatedClient},r;globalThis.__wix_context__=void 0,g.client=void 0,g.elevatedClient=void 0,typeof $wixContext<"u"&&(r={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,g.client=n.client,g.elevatedClient=n.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=r.client,$wixContext.elevatedClient=r.elevatedClient)}}function Y(e,t){return{...e,...Object.fromEntries(t.map(n=>[n,(...r)=>{let o=X();if(!o)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return o.initWixModules(e)[n].apply(void 0,r)}]))}}function Z(e){return Y({__type:"host",create:t=>Object.entries(e).reduce((n,[r,o])=>({...n,[r]:o(t)}),{})},Object.keys(e))}function b(e){"@babel/helpers - typeof";return b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(e)}function ee(e,t){if(b(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(b(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function te(e){var t=ee(e,"string");return b(t)=="symbol"?t:t+""}function ne(e,t,n){return(t=te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=class extends Error{constructor(t){let{message:n,code:r}=t;super(n),ne(this,"code",void 0),this.message=n,this.code=r}};var re=()=>{let e=a=>{let{channel:i}=a;return function(){let f=i.showToast(...arguments);return{remove:()=>Promise.resolve(f).then(x=>x.remove())}}},t=a=>{let{channel:i}=a;return function(){let f=i.observeState(...arguments);return{disconnect:()=>Promise.resolve(f).then(x=>x.disconnect())}}};return{showToast:e,observeState:t,navigate:a=>{let{channel:i}=a;return function(){return i.navigate(...arguments)}},navigateBack:a=>{let{channel:i}=a;return()=>i.navigateBack()},openModal:a=>{let{channel:i}=a;return(f,m)=>{let[x,k]=typeof f=="string"?[f,m]:[f.modalId,f.params],C=i.openModal(x,k);return{modalClosed:Promise.resolve(C).then(w=>w.modalClosed)}}},closeModal:a=>{let{channel:i}=a;return f=>{if(f===void 0)return i.closeModal();let m=JSON.parse(JSON.stringify(f));return i.closeModal(m)}},getAccessToken:a=>{let{channel:i}=a;return()=>i.getAccessToken()},getPageUrl:a=>{let{channel:i}=a;return function(){return i.getPageUrl(...arguments)}},openMediaManager:a=>{let{channel:i}=a;return function(){return i.openMediaManager(...arguments)}},addSitePlugin:a=>{let{channel:i}=a;return(f,m)=>{let x="802c76e4-b381-4bb3-9152-96acabbf3194",k=m?.placement||{},C=i.openModal(x,{...k,placementsSlotId:m?.slotId,pluginId:f,action:"populate"});return Promise.resolve(C).then(w=>w.modalClosed).then(w=>{if(w?.type===void 0)throw new E({message:"Aborted by user",code:3006});if(w?.type==="ERROR")throw new E(w.data.error)})}},onBeforeUnload:a=>{let{channel:i}=a;return function(){return i.onBeforeUnload(...arguments)}},setPageTitle:a=>{let{channel:i}=a;return f=>i.setPageTitle(f)},getLanguage:a=>{let i=null;return async()=>{var f;if(i)return i;let m=null;return i=await new Promise(x=>{m=t(a)((k,C)=>{x(C.language)})}),(f=m)==null||f.disconnect(),i}},requestFeedback:a=>{let{channel:i}=a;return function(){return i.requestFeedback(...arguments)}},onLayerStateChange:a=>{let{channel:i}=a;return function(){let f=i.onLayerStateChange(...arguments);return{remove:()=>Promise.resolve(f).then(x=>x.remove())}}},installApp:a=>{let{channel:i}=a;return i.installApp},getSiteInfo:a=>{let{channel:i}=a;return i.getSiteInfo},getWidget:a=>{let{channel:i}=a;return function(){if("getWidget"in i)return i.getWidget(...arguments);throw new Error("Unsupported")}},getDashboardPlugins:a=>{let{channel:i}=a;return function(){if("getDashboardPlugins"in i)return i.getDashboardPlugins(...arguments);throw new Error("Unsupported")}},getDashboardMenuPlugins:a=>{let{channel:i}=a;return function(){if("getDashboardMenuPlugins"in i)return i.getDashboardMenuPlugins(...arguments);throw new Error("Unsupported")}},createStore:a=>{let{channel:i}=a;if(i.createStore)return i.createStore},getStore:a=>{let{channel:i}=a;if(i.getStore)return i.getStore}}};var oe=e=>{let{createHost:t}=e,n=re();return{...Z(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var se=Symbol("Comlink.proxy"),Pe=Symbol("Comlink.endpoint"),I=Symbol("Comlink.releaseProxy"),U=Symbol("Comlink.thrown"),ae=e=>typeof e=="object"&&e!==null||typeof e=="function",Ce={canHandle:e=>ae(e)&&e[se],serialize(e){let{port1:t,port2:n}=new MessageChannel;return R(e,t),[n,[n]]},deserialize(e){return e.start(),L(e)}},Ee={canHandle:e=>ae(e)&&U in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},le=new Map([["proxy",Ce],["throw",Ee]]);function R(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:o,type:s,path:u}=Object.assign({path:[]},r.data),l=(r.data.argumentList||[]).map(v),c;try{let d=u.slice(0,-1).reduce((p,y)=>p[y],e),h=u.reduce((p,y)=>p[y],e);switch(s){case 0:c=h;break;case 1:d[u.slice(-1)[0]]=v(r.data.value),c=!0;break;case 2:c=h.apply(d,l);break;case 3:{let p=new h(...l);c=W(p)}break;case 4:{let{port1:p,port2:y}=new MessageChannel;R(e,y),c=Ae(p,[p])}break;case 5:c=void 0;break}}catch(d){c={value:d,[U]:0}}Promise.resolve(c).catch(d=>({value:d,[U]:0})).then(d=>{let[h,p]=B(d);t.postMessage(Object.assign(Object.assign({},h),{id:o}),p),s===5&&(t.removeEventListener("message",n),ue(t))})}),t.start&&t.start()}function We(e){return e.constructor.name==="MessagePort"}function ue(e){We(e)&&e.close()}function L(e,t){return H(e,[],t)}function T(e){if(e)throw new Error("Proxy has been released and is not useable")}function H(e,t=[],n=function(){}){let r=!1,o=new Proxy(n,{get(s,u){if(T(r),u===I)return()=>S(e,{type:5,path:t.map(l=>l.toString())}).then(()=>{ue(e),r=!0});if(u==="then"){if(t.length===0)return{then:()=>o};let l=S(e,{type:0,path:t.map(c=>c.toString())}).then(v);return l.then.bind(l)}return H(e,[...t,u])},set(s,u,l){T(r);let[c,d]=B(l);return S(e,{type:1,path:[...t,u].map(h=>h.toString()),value:c},d).then(v)},apply(s,u,l){T(r);let c=t[t.length-1];if(c===Pe)return S(e,{type:4}).then(v);if(c==="bind")return H(e,t.slice(0,-1));let[d,h]=ie(l);return S(e,{type:2,path:t.map(p=>p.toString()),argumentList:d},h).then(v)},construct(s,u){T(r);let[l,c]=ie(u);return S(e,{type:3,path:t.map(d=>d.toString()),argumentList:l},c).then(v)}});return o}function ke(e){return Array.prototype.concat.apply([],e)}function ie(e){let t=e.map(B);return[t.map(n=>n[0]),ke(t.map(n=>n[1]))]}var ce=new WeakMap;function Ae(e,t){return ce.set(e,t),e}function W(e){return Object.assign(e,{[se]:!0})}function B(e){for(let[t,n]of le)if(n.canHandle(e)){let[r,o]=n.serialize(e);return[{type:3,name:t,value:r},o]}return[{type:0,value:e},ce.get(e)||[]]}function v(e){switch(e.type){case 3:return le.get(e.name).deserialize(e.value);case 0:return e.value}}function S(e,t,n){return new Promise(r=>{let o=Te();e.addEventListener("message",function s(u){!u.data||!u.data.id||u.data.id!==o||(e.removeEventListener("message",s),r(u.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),n)})}function Te(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var K="__proxyCallbackId__wixSDK__",j="__proxyPromiseId__wixSDK__",fe=e=>ze(e,t=>async function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];let[s,u]=$(r),l=await t(W(s),u);return pe(l)});var De=async e=>{let[t,n]=$(await e);return W({proxies:t,clonables:n})},pe=async e=>z(e?.proxies,await e?.clonables),$=e=>{let t=(o,s)=>{if(he(s)){let u=de();return o.promises[u]=s,{[j]:u}}if(Oe(s)){let u=de();return o.callbacks[u]=(l,c)=>{let d=z(l,c),h=s(...d);return De(h)},{[K]:u}}return Array.isArray(s)?s.map(u=>t(o,u)):D(s)?me(s,u=>t(o,u)):s},n={promises:{},callbacks:{}},r=t(n,e);return[n,r]},z=(e,t)=>{if(Array.isArray(t))return t.map(n=>z(e,n));if(D(t)&&t.hasOwnProperty(j)){let n=t[j];return e.promises[n]}if(D(t)&&t.hasOwnProperty(K)){let n=t[K];return async function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];let[u,l]=$(o),c=await e.callbacks[n](W(u),l);return pe(c)}}return D(t)?me(t,n=>z(e,n)):t},ze=(e,t)=>new Proxy(e,{get(n,r){return n[r]?t(n[r]):()=>{throw new Error(`Serialization error occurred while accessing ${r} property of ${n}`)}}}),he=e=>e instanceof Promise,D=e=>e&&typeof e=="object"&&!he(e),Oe=e=>typeof e=="function",me=(e,t)=>{let n=r=>{let[o,s]=r;return[o,t(s)]};return Object.fromEntries(Object.entries(e).map(n))},de=(()=>{let e=0;return()=>++e})();var Ue="wix-sdk-bo-hello-handshake",xe=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:o}=new MessageChannel;t({code:Ue,version:"1.0.0",port:o},n,[o]);let l=fe(L(r));return{channel:l,close:()=>l[I]()}};var ge=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var He=["https://manage.wix.com","https://manage.editorx.com"],Ie=new Set(He),we=e=>Ie.has(e);var ye=e=>{let t=new EventTarget,n=typeof window>"u",r=l=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(l.preventDefault(),l.returnValue=!0)},o=e.onBeforeUnload(r),s=()=>{n||window.removeEventListener("beforeunload",r),o.then(l=>{let{remove:c}=l;return c()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",s)),{onBeforeUnload:l=>(t.addEventListener("beforeunload",l),{remove:()=>{t.removeEventListener("beforeunload",l)}}),clearBeforeUnloadHandler:s}};function Re(e){if(e)try{return JSON.parse(decodeURIComponent(e))}catch(t){console.warn('Failed to parse "essentials" query parameter. Make sure to run the code inside a supported Wix App extension.',t);return}}function be(e){return e.has("essentials")?Re(e.get("essentials")):void 0}var ve=e=>t=>{let{message:n,action:r,requestId:o}=t;n&&e.showToast({type:"error",details:o!=null?{requestId:o}:void 0,message:n,action:r&&{...r,removeToastOnClick:!0,uiType:"link"}})};var Me=function(e){e===void 0&&(e={});let t=e.fullUrl&&new URL(e.fullUrl).search||typeof window<"u"&&window.location.search||"",n=new URLSearchParams(t),r=e.origin||n.get("origin")||"",o=e.postMessage||window.parent.postMessage.bind(window.parent);if(!we(r))throw new Error("Wix Dashboard SDK: Unable to establish a connection with the Wix dashboard. Please ensure that you are running your app within the Wix dashboard.");let{channel:s,close:u}=xe({postMessage:o,origin:r}),l=[u];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let M=e.autoHeightElement||document.documentElement,_=ge(s,M);l.push(()=>_())}let{onBeforeUnload:c,clearBeforeUnloadHandler:d}=ye(s);l.push(d);let h=Le(n.get("siteInfo")||"","siteInfo"),p=()=>h,y=new Proxy(s,{get(M,_,J){return _==="onBeforeUnload"?c:_==="getSiteInfo"?p:Reflect.get(M,_,J)}}),{monitoring:P,...q}=be(n)||{},F=Q({hostContext:P?.context,monitoringConfig:P?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0}),N={openItemSelector:s.openItemSelector};return{channel:y,close:()=>l.forEach(M=>M()),getMonitoringClient:F,essentials:q,admin:N,showError:ve(s)}},Le=(e,t)=>{try{return JSON.parse(decodeURIComponent(e))}catch(n){return console.warn(`Failed to parse ${t} query parameter. Make sure to run the code inside a supported Wix App extension.`,n),{}}};var V=oe({createHost:Me});var Se=(e,t)=>{let[n,r]=_e(()=>e());return t(n)&&r(e()),n},je=e=>t=>{let{host:n,compProps:r}=$e(t);return Se(()=>(G({auth:V.auth(),host:n}).enableContext("module"),n),o=>o!==n),r?Be.createElement(e,A({host:n},r)):null},$e=e=>{let{host:t,...n}=e,{host:r,hostType:o}=Se(()=>t?{host:t,hostType:"local"}:{host:V.host(),hostType:"remote"},l=>!!t&&t!==l.host),[s,u]=_e(void 0);return Ke(()=>{if(o==="local")return;let l=r.channel.observeState(d=>{u(d||{})}),c=async()=>{(await l).disconnect(),r.close()};return()=>{c()}},[r,o]),o==="local"?{host:r,compProps:n}:{host:r,compProps:s?{...s,...n}:void 0}};export{je as withContextualWixClient};
|
|
2
2
|
//# sourceMappingURL=dashboard.js.map
|