@wix/cli-app 1.1.131 → 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.
Files changed (71) hide show
  1. package/build/{AddPermissionCommand-XSII6GZZ.js → AddPermissionCommand-7QIFVBXV.js} +2 -2
  2. package/build/{DevCommand-2T4E6IPK.js → DevCommand-RDPL27X5.js} +10 -10
  3. package/build/{GenerateCommand-OP6IU3NS.js → GenerateCommand-6ADO2EJU.js} +7 -7
  4. package/build/{LogsCommand-2ADHXDRY.js → LogsCommand-PIRWJADI.js} +3 -3
  5. package/build/PreviewCommand-AN6WMCYS.js +19 -0
  6. package/build/ReleaseCommand-DAK2EFM2.js +23 -0
  7. package/build/{ServeCommand-4ZRI7MZC.js → ServeCommand-5HERPY2Q.js} +3 -3
  8. package/build/{build-PRVKXQCP.js → build-6IDZAW4E.js} +6 -6
  9. package/build/{chunk-EGGJUE6G.js → chunk-DK2KK5UN.js} +2 -2
  10. package/build/{chunk-TMLNYIG3.js → chunk-ESTYQVMX.js} +208 -15
  11. package/build/{chunk-TMLNYIG3.js.map → chunk-ESTYQVMX.js.map} +1 -1
  12. package/build/{chunk-R3HBG3QU.js → chunk-FWRUE2NB.js} +2 -2
  13. package/build/{chunk-IRQCSOFI.js → chunk-GNL53AZS.js} +3 -3
  14. package/build/{chunk-GMWG6N2T.js → chunk-IIF6P6XG.js} +2 -2
  15. package/build/{chunk-AJWBEG3J.js → chunk-JYZ5QJ5C.js} +2 -2
  16. package/build/{chunk-JYCCDTAH.js → chunk-KHUHWBJD.js} +30 -9
  17. package/build/{chunk-JYCCDTAH.js.map → chunk-KHUHWBJD.js.map} +1 -1
  18. package/build/{chunk-2OG4EPK4.js → chunk-KVESKT7X.js} +4 -4
  19. package/build/{chunk-JSPL2MJP.js → chunk-LQZSH33G.js} +6 -6
  20. package/build/{chunk-2WRJ6SAT.js → chunk-NJXD2TTX.js} +74 -2
  21. package/build/chunk-NJXD2TTX.js.map +1 -0
  22. package/build/{chunk-4EI4C7ZX.js → chunk-O2MISIES.js} +2 -2
  23. package/build/{chunk-TURHJBQY.js → chunk-PREYTA74.js} +27 -17
  24. package/build/{chunk-TURHJBQY.js.map → chunk-PREYTA74.js.map} +1 -1
  25. package/build/{chunk-SLWJRTHZ.js → chunk-QQ4OBBX7.js} +6 -6
  26. package/build/{chunk-3J2LWCT4.js → chunk-UJ4SA2PC.js} +2 -2
  27. package/build/{chunk-RIUA44FB.js → chunk-VDQEUTFT.js} +4 -4
  28. package/build/{chunk-VIA44IXQ.js → chunk-WA2CFDB5.js} +2 -2
  29. package/build/{chunk-KTJCVUFW.js → chunk-XDUVJLLQ.js} +2 -2
  30. package/build/index.js +23 -23
  31. package/build/platform-sdk/{chunk-J3SVE4GM.js → chunk-R7FAXXP7.js} +1 -1
  32. package/build/platform-sdk/{chunk-J3SVE4GM.js.map → chunk-R7FAXXP7.js.map} +1 -1
  33. package/build/platform-sdk/{chunk-QFPCSRLT.js → chunk-WBKL5IQV.js} +2 -2
  34. package/build/platform-sdk/dashboard.js +1 -1
  35. package/build/platform-sdk/editor.js +1 -1
  36. package/build/platform-sdk/sdk-context.js +1 -1
  37. package/build/platform-sdk/sdk-context.js.map +1 -1
  38. package/build/platform-sdk/site.js +1 -1
  39. package/build/{preview-6CYFWYOM.js → preview-IXHPIOMO.js} +12 -12
  40. package/build/{release-IKWZ3WBN.js → release-RFFKID6V.js} +14 -14
  41. package/build/{render-command-QG5VW3MN.js → render-command-NUU6LT5M.js} +5 -5
  42. package/package.json +4 -4
  43. package/schemas/wix-config.json +1 -1
  44. package/build/PreviewCommand-6KHLT4FS.js +0 -19
  45. package/build/ReleaseCommand-Q3ITCK4T.js +0 -23
  46. package/build/chunk-2WRJ6SAT.js.map +0 -1
  47. /package/build/{AddPermissionCommand-XSII6GZZ.js.map → AddPermissionCommand-7QIFVBXV.js.map} +0 -0
  48. /package/build/{DevCommand-2T4E6IPK.js.map → DevCommand-RDPL27X5.js.map} +0 -0
  49. /package/build/{GenerateCommand-OP6IU3NS.js.map → GenerateCommand-6ADO2EJU.js.map} +0 -0
  50. /package/build/{LogsCommand-2ADHXDRY.js.map → LogsCommand-PIRWJADI.js.map} +0 -0
  51. /package/build/{PreviewCommand-6KHLT4FS.js.map → PreviewCommand-AN6WMCYS.js.map} +0 -0
  52. /package/build/{ReleaseCommand-Q3ITCK4T.js.map → ReleaseCommand-DAK2EFM2.js.map} +0 -0
  53. /package/build/{ServeCommand-4ZRI7MZC.js.map → ServeCommand-5HERPY2Q.js.map} +0 -0
  54. /package/build/{build-PRVKXQCP.js.map → build-6IDZAW4E.js.map} +0 -0
  55. /package/build/{chunk-EGGJUE6G.js.map → chunk-DK2KK5UN.js.map} +0 -0
  56. /package/build/{chunk-R3HBG3QU.js.map → chunk-FWRUE2NB.js.map} +0 -0
  57. /package/build/{chunk-IRQCSOFI.js.map → chunk-GNL53AZS.js.map} +0 -0
  58. /package/build/{chunk-GMWG6N2T.js.map → chunk-IIF6P6XG.js.map} +0 -0
  59. /package/build/{chunk-AJWBEG3J.js.map → chunk-JYZ5QJ5C.js.map} +0 -0
  60. /package/build/{chunk-2OG4EPK4.js.map → chunk-KVESKT7X.js.map} +0 -0
  61. /package/build/{chunk-JSPL2MJP.js.map → chunk-LQZSH33G.js.map} +0 -0
  62. /package/build/{chunk-4EI4C7ZX.js.map → chunk-O2MISIES.js.map} +0 -0
  63. /package/build/{chunk-SLWJRTHZ.js.map → chunk-QQ4OBBX7.js.map} +0 -0
  64. /package/build/{chunk-3J2LWCT4.js.map → chunk-UJ4SA2PC.js.map} +0 -0
  65. /package/build/{chunk-RIUA44FB.js.map → chunk-VDQEUTFT.js.map} +0 -0
  66. /package/build/{chunk-VIA44IXQ.js.map → chunk-WA2CFDB5.js.map} +0 -0
  67. /package/build/{chunk-KTJCVUFW.js.map → chunk-XDUVJLLQ.js.map} +0 -0
  68. /package/build/platform-sdk/{chunk-QFPCSRLT.js.map → chunk-WBKL5IQV.js.map} +0 -0
  69. /package/build/{preview-6CYFWYOM.js.map → preview-IXHPIOMO.js.map} +0 -0
  70. /package/build/{release-IKWZ3WBN.js.map → release-RFFKID6V.js.map} +0 -0
  71. /package/build/{render-command-QG5VW3MN.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-IRQCSOFI.js";
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-JYCCDTAH.js";
19
+ } from "./chunk-KHUHWBJD.js";
20
20
  import {
21
21
  useBackendComponents
22
- } from "./chunk-AJWBEG3J.js";
22
+ } from "./chunk-JYZ5QJ5C.js";
23
23
  import {
24
24
  getMonitoringProvider,
25
25
  updateAppManifestComponents,
26
26
  updateMonitoring,
27
27
  updateTopology
28
- } from "./chunk-TURHJBQY.js";
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-TMLNYIG3.js";
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-SLWJRTHZ.js.map
285
+ //# sourceMappingURL=chunk-QQ4OBBX7.js.map
@@ -5,7 +5,7 @@ import {
5
5
  isCliSystemError,
6
6
  wixCliCliCommand,
7
7
  wixCliCliCommandStatus
8
- } from "./chunk-TMLNYIG3.js";
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-3J2LWCT4.js.map
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-3J2LWCT4.js";
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-GMWG6N2T.js";
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-TMLNYIG3.js";
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-RIUA44FB.js.map
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-TMLNYIG3.js";
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-VIA44IXQ.js.map
182
+ //# sourceMappingURL=chunk-WA2CFDB5.js.map
@@ -5,7 +5,7 @@ import {
5
5
  createRendererToString,
6
6
  isCliError,
7
7
  require_react
8
- } from "./chunk-TMLNYIG3.js";
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-KTJCVUFW.js.map
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-VIA44IXQ.js";
6
+ } from "./chunk-WA2CFDB5.js";
7
7
  import {
8
8
  runCommand
9
- } from "./chunk-2OG4EPK4.js";
10
- import "./chunk-3J2LWCT4.js";
9
+ } from "./chunk-KVESKT7X.js";
10
+ import "./chunk-UJ4SA2PC.js";
11
11
  import "./chunk-ZHQREOZP.js";
12
- import "./chunk-GMWG6N2T.js";
12
+ import "./chunk-IIF6P6XG.js";
13
13
  import {
14
14
  external_exports,
15
15
  package_default,
16
16
  require_react
17
- } from "./chunk-TMLNYIG3.js";
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-QG5VW3MN.js");
3381
- const { build } = await import("./build-PRVKXQCP.js");
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-2T4E6IPK.js");
3447
- const { renderCommand } = await import("./render-command-QG5VW3MN.js");
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-QG5VW3MN.js");
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-6CYFWYOM.js");
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-6KHLT4FS.js");
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-QG5VW3MN.js");
3514
- const { AddPermissionCommand } = await import("./AddPermissionCommand-XSII6GZZ.js");
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-QG5VW3MN.js");
3531
- const { ServeCommandDeprecated } = await import("./ServeCommand-4ZRI7MZC.js");
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-OP6IU3NS.js");
3547
- const { renderCommand } = await import("./render-command-QG5VW3MN.js");
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-QG5VW3MN.js");
3572
- const { LogsCommand } = await import("./LogsCommand-2ADHXDRY.js");
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-QG5VW3MN.js");
3606
- const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-Q3ITCK4T.js");
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-IKWZ3WBN.js");
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-J3SVE4GM.js.map
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-QFPCSRLT.js.map
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 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};
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
@@ -1,4 +1,4 @@
1
- import{a as ke}from"./chunk-EZGPNUD5.js";import{a as Ne}from"./chunk-QFPCSRLT.js";import"./chunk-J3SVE4GM.js";import{c as fi,d as Pi}from"./chunk-7EYXEF6M.js";import{b as Se,d as Oe,e as ui,f as l,g as a,h,i as w,j as u}from"./chunk-SBZEOPXX.js";var Fe=Se(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.EventType=void 0;var We;(function(i){i.removeAppCompleted="removeAppCompleted",i.componentSelectionChanged="componentSelectionChanged",i.appInstalled="appInstalled",i.appUpdateCompleted="appUpdateCompleted"})(We||(ht.EventType=We={}))});var Ut=Se(A=>{"use strict";var gi=A&&A.__createBinding||(Object.create?function(i,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,s)}:function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]}),mi=A&&A.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),Ii=A&&A.__importStar||function(){var i=function(t){return i=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},i(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=i(t),s=0;s<n.length;s++)n[s]!=="default"&&gi(e,t,n[s]);return mi(e,t),e}}();Object.defineProperty(A,"__esModule",{value:!0});A.EventType=A.WixSDKTypes=void 0;var wi=Ii((Pi(),ui(fi)));A.WixSDKTypes=wi;var Ai=Fe();Object.defineProperty(A,"EventType",{enumerable:!0,get:function(){return Ai.EventType}})});var H=Oe(Ut(),1);var O=class O{constructor(){l(this,"uid",0);l(this,"callbacks",new Map);l(this,"inTransaction",!1);l(this,"isSilent",!1);l(this,"queue",[])}silent(t=!0){this.isSilent=t}startTransaction(){this.inTransaction=!0}commit(){this.inTransaction=!1;let t=this.queue;this.queue=[],this.isSilent||t.forEach(e=>{this.notify(e)})}notify(t){this.isSilent||(this.inTransaction?this.queue.push(t):this.callbacks.forEach(e=>{e(t)}))}subscribe(t){let e=this.uid++;return this.callbacks.set(e,t),()=>{this.callbacks.delete(e)}}notifyWithStep(t,e){this.notify({...t,meta:{...t.meta,step:e}})}async withEvent(t,e){let n=e();if(n&&n.hasOwnProperty("then"))try{return this.notifyWithStep(t,O.EventSteps.Start),n=await n,this.notifyWithStep(t,O.EventSteps.End),n}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},O.EventSteps.Error),s}else return this.notify(t),n}};l(O,"biEvents",{PLATFORM_WORKER_SPAWN:123,PLATFORM_APP_RUNNER_INIT_APP_API:124,PLATFORM_APP_RUNNER_RUN_APP:125,PLATFORM_APP_RUNNER_REMOVE_APP:126,PLATFORM_WORKER_APP_BUNDLE_LOAD:127,PLATFORM_WORKER_APP_BUNDLE_EXECUTE:128,PLATFORM_IFRAME_INIT:129,PLATFORM_APP_API_INIT:130,PLATFORM_APP_API_GET:131}),l(O,"EventSteps",{Start:"start",End:"end",Error:"error"});var $t=O,ut=(i=>(i.WorkerSpawn="WorkerSpawn",i.HostEvent="HostEvent",i.ApplicationsSpecsReceived="ApplicationsSpecsReceived",i.InitApplicationApi="InitApplicationApi",i.RunApplication="RunApplication",i.getApplicationApi="getApplicationApi",i.IframeInit="IframeInit",i))(ut||{}),qt=(i=>(i.EditorReady="EditorReady",i))(qt||{});var x=(i=>(i.ApplicationInit="ApplicationInit",i.ApplicationExecute="ApplicationExecute",i.ApplicationRemoved="ApplicationRemoved",i.ApplicationLoad="ApplicationLoad",i.ApplicationApiInit="ApplicationApiInit",i.CustomEvent="CustomEvent",i.HostEvent="HostEvent",i.EditorReady="EditorReady",i))(x||{}),jt=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_APP_BUNDLE_LOAD,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationExecuteEvent(t,e){return{type:"ApplicationExecute",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_APP_BUNDLE_EXECUTE,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationApiInitEvent(t,e){return{type:"ApplicationApiInit",payload:{appDefinitionId:t},meta:{bi:{evid:C.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},C=class extends $t{constructor(){super(...arguments);l(this,"factories",new jt)}},dt=class dt{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ut.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);dt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};l(dt,"allowedEvents",[H.EventType.componentSelectionChanged,H.EventType.appInstalled,H.EventType.appUpdateCompleted,H.EventType.removeAppCompleted]);var Le=dt;var I=class i extends Error{constructor(e,n,s){let o=e?` ${e}`:"",r=`[${s}]#${n}`;super(`${r}.${o}`);l(this,"state",{});l(this,"displayName");l(this,"prefix");l(this,"errorMessage");l(this,"parent");l(this,"messages",[]);l(this,"code");this.displayName=r,this.errorMessage=e,this.prefix=s,this.code=n,this.name=r,Object.defineProperty(this,"message",{get:()=>this.getDisplayMessage()}),Error.captureStackTrace&&Error.captureStackTrace(this,i)}get parentError(){let e=this.parent;if(!e)return null;if(this.parent instanceof i)return this.parent;let n=e.name??"[Unknown Error]";return{getBreadcrumbs(){return[n]},getMessage(){return[n,e.message??"unknown error message"].join(`
1
+ import{a as ke}from"./chunk-EZGPNUD5.js";import{a as Ne}from"./chunk-WBKL5IQV.js";import"./chunk-R7FAXXP7.js";import{c as fi,d as Pi}from"./chunk-7EYXEF6M.js";import{b as Se,d as Oe,e as ui,f as l,g as a,h,i as w,j as u}from"./chunk-SBZEOPXX.js";var Fe=Se(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.EventType=void 0;var We;(function(i){i.removeAppCompleted="removeAppCompleted",i.componentSelectionChanged="componentSelectionChanged",i.appInstalled="appInstalled",i.appUpdateCompleted="appUpdateCompleted"})(We||(ht.EventType=We={}))});var Ut=Se(A=>{"use strict";var gi=A&&A.__createBinding||(Object.create?function(i,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,s)}:function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]}),mi=A&&A.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),Ii=A&&A.__importStar||function(){var i=function(t){return i=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},i(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=i(t),s=0;s<n.length;s++)n[s]!=="default"&&gi(e,t,n[s]);return mi(e,t),e}}();Object.defineProperty(A,"__esModule",{value:!0});A.EventType=A.WixSDKTypes=void 0;var wi=Ii((Pi(),ui(fi)));A.WixSDKTypes=wi;var Ai=Fe();Object.defineProperty(A,"EventType",{enumerable:!0,get:function(){return Ai.EventType}})});var H=Oe(Ut(),1);var O=class O{constructor(){l(this,"uid",0);l(this,"callbacks",new Map);l(this,"inTransaction",!1);l(this,"isSilent",!1);l(this,"queue",[])}silent(t=!0){this.isSilent=t}startTransaction(){this.inTransaction=!0}commit(){this.inTransaction=!1;let t=this.queue;this.queue=[],this.isSilent||t.forEach(e=>{this.notify(e)})}notify(t){this.isSilent||(this.inTransaction?this.queue.push(t):this.callbacks.forEach(e=>{e(t)}))}subscribe(t){let e=this.uid++;return this.callbacks.set(e,t),()=>{this.callbacks.delete(e)}}notifyWithStep(t,e){this.notify({...t,meta:{...t.meta,step:e}})}async withEvent(t,e){let n=e();if(n&&n.hasOwnProperty("then"))try{return this.notifyWithStep(t,O.EventSteps.Start),n=await n,this.notifyWithStep(t,O.EventSteps.End),n}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},O.EventSteps.Error),s}else return this.notify(t),n}};l(O,"biEvents",{PLATFORM_WORKER_SPAWN:123,PLATFORM_APP_RUNNER_INIT_APP_API:124,PLATFORM_APP_RUNNER_RUN_APP:125,PLATFORM_APP_RUNNER_REMOVE_APP:126,PLATFORM_WORKER_APP_BUNDLE_LOAD:127,PLATFORM_WORKER_APP_BUNDLE_EXECUTE:128,PLATFORM_IFRAME_INIT:129,PLATFORM_APP_API_INIT:130,PLATFORM_APP_API_GET:131}),l(O,"EventSteps",{Start:"start",End:"end",Error:"error"});var $t=O,ut=(i=>(i.WorkerSpawn="WorkerSpawn",i.HostEvent="HostEvent",i.ApplicationsSpecsReceived="ApplicationsSpecsReceived",i.InitApplicationApi="InitApplicationApi",i.RunApplication="RunApplication",i.getApplicationApi="getApplicationApi",i.IframeInit="IframeInit",i))(ut||{}),qt=(i=>(i.EditorReady="EditorReady",i))(qt||{});var x=(i=>(i.ApplicationInit="ApplicationInit",i.ApplicationExecute="ApplicationExecute",i.ApplicationRemoved="ApplicationRemoved",i.ApplicationLoad="ApplicationLoad",i.ApplicationApiInit="ApplicationApiInit",i.CustomEvent="CustomEvent",i.HostEvent="HostEvent",i.EditorReady="EditorReady",i))(x||{}),jt=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_APP_BUNDLE_LOAD,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationExecuteEvent(t,e){return{type:"ApplicationExecute",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_APP_BUNDLE_EXECUTE,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationApiInitEvent(t,e){return{type:"ApplicationApiInit",payload:{appDefinitionId:t},meta:{bi:{evid:C.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},C=class extends $t{constructor(){super(...arguments);l(this,"factories",new jt)}},dt=class dt{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ut.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);dt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};l(dt,"allowedEvents",[H.EventType.componentSelectionChanged,H.EventType.appInstalled,H.EventType.appUpdateCompleted,H.EventType.removeAppCompleted]);var Le=dt;var I=class i extends Error{constructor(e,n,s){let o=e?` ${e}`:"",r=`[${s}]#${n}`;super(`${r}.${o}`);l(this,"state",{});l(this,"displayName");l(this,"prefix");l(this,"errorMessage");l(this,"parent");l(this,"messages",[]);l(this,"code");this.displayName=r,this.errorMessage=e,this.prefix=s,this.code=n,this.name=r,Object.defineProperty(this,"message",{get:()=>this.getDisplayMessage()}),Error.captureStackTrace&&Error.captureStackTrace(this,i)}get parentError(){let e=this.parent;if(!e)return null;if(this.parent instanceof i)return this.parent;let n=e.name??"[Unknown Error]";return{getBreadcrumbs(){return[n]},getMessage(){return[n,e.message??"unknown error message"].join(`
2
2
  `)}}}getDisplayMessage(){return[(this.parentError?this.getBreadcrumbs():[]).join(" -> "),this.getMessage()].filter(n=>n.trim().length).join(`
3
3
  `)}getMessage(){let e=Object.entries(this.state).reduce((c,[p,d])=>(d&&c.push(` \u2013 ${p}: ${d}`),c),[]).join(`
4
4
  `),n=this.messages.reduce((c,p)=>(c.push(` - ${p.join(" ")}`),c),[]).join(`
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-J3SVE4GM.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function o(e,t=!1){return n(e,t)}var c=["wix.com","editorx.com"];var u=new RegExp(`\\.(${c.join("|")})$`),s=["42.wixprod.net","uw2-edt-1.wixprod.net"],a="dev.wix-code.com";var _=new RegExp(`\\.(${s.join("|")})$`),d=new RegExp(`.*\\.${a}$`);import{wixContext as f}from"@wix/sdk-context";function r(e,t){t==="global"?globalThis.__wix_context__!=null?globalThis.__wix_context__.client=e:globalThis.__wix_context__={client:e}:f.client=e}var E=o(e=>(t,i)=>e.fetchWithAuth(t,i));export{r as enableContext};
1
+ import{a as n}from"./chunk-R7FAXXP7.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function o(e,t=!1){return n(e,t)}var s=["wix.com","editorx.com"];var u=new RegExp(`\\.(${s.join("|")})$`),c=["42.wixprod.net","uw2-edt-1.wixprod.net"],a="dev.wix-code.com";var _=new RegExp(`\\.(${c.join("|")})$`),m=new RegExp(`.*\\.${a}$`);import{wixContext as f}from"@wix/sdk-context";function r(e,t){t==="global"?globalThis.__wix_context__!=null?globalThis.__wix_context__.client=e:globalThis.__wix_context__={client:e}:f.client=e}var E=o(e=>(t,i)=>e.fetchWithAuth(t,i));export{r as enableContext};
2
2
  //# sourceMappingURL=sdk-context.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/rest-modules.js","../../../node_modules/@wix/sdk/build/enable-context.js","../../../node_modules/@wix/sdk/build/context.js"],"sourcesContent":["import { contextualizeRESTModuleV2 } from './context-v2.js';\nexport function createRESTModule(descriptor, elevated = false) {\n return contextualizeRESTModuleV2(descriptor, elevated);\n}\nexport function toURLSearchParams(params, isComplexRequest) {\n const flatten = flattenParams(params);\n // payloads with deep arrays or complex arrays are not serializable as URLSearchParams\n const isPayloadNonSerializableAsUrlSearchParams = Object.entries(flatten).some(([key, value]) => key.includes('.') ||\n (Array.isArray(value) && value.some((v) => typeof v === 'object')));\n const shouldSerializeToRParam = isComplexRequest && isPayloadNonSerializableAsUrlSearchParams;\n if (shouldSerializeToRParam) {\n return new URLSearchParams({ '.r': base64Encode(JSON.stringify(params)) });\n }\n else {\n return Object.entries(flatten).reduce((urlSearchParams, [key, value]) => {\n // inorder to make `foo: [1,2]` turn into `foo=1&foo=2` and not `foo[]=1&foo[]=2`\n const keyParams = Array.isArray(value) ? value : [value];\n keyParams.forEach((param) => {\n if (param === undefined ||\n param === null ||\n (Array.isArray(value) && typeof param === 'object')) {\n return;\n }\n urlSearchParams.append(key, param);\n });\n return urlSearchParams;\n }, new URLSearchParams());\n }\n}\nexport function resolveUrl(opts) {\n const domain = resolveDomain(opts.host);\n const mappings = resolveMappingsByDomain(domain, opts.domainToMappings);\n const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});\n return resolvePathFromMappings(path, mappings);\n}\nfunction flattenParams(data, path = '') {\n const params = {};\n Object.entries(data).forEach(([key, value]) => {\n const isObject = value !== null && typeof value === 'object' && !Array.isArray(value);\n const fieldPath = resolvePath(path, key);\n if (isObject) {\n const serializedObject = flattenParams(value, fieldPath);\n Object.assign(params, serializedObject);\n }\n else {\n params[fieldPath] = value;\n }\n });\n return params;\n}\nfunction resolvePath(path, key) {\n return `${path}${path ? '.' : ''}${key}`;\n}\nconst base64Encode = (value) => {\n const base64 = typeof btoa !== 'undefined'\n ? btoa(value)\n : Buffer.from(value, 'utf-8').toString('base64');\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nconst DOMAINS = ['wix.com', 'editorx.com'];\nconst USER_DOMAIN = '_';\nconst REGEX_CAPTURE_DOMAINS = new RegExp(`\\\\.(${DOMAINS.join('|')})$`);\nconst WIX_API_DOMAINS = ['42.wixprod.net', 'uw2-edt-1.wixprod.net'];\nconst DEV_WIX_CODE_DOMAIN = 'dev.wix-code.com';\nconst REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;\nconst REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\\\.(${WIX_API_DOMAINS.join('|')})$`);\nconst REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\\\.${DEV_WIX_CODE_DOMAIN}$`);\nfunction resolveDomain(host) {\n const resolvedHost = fixHostExceptions(host);\n return resolvedHost\n .replace(REGEX_CAPTURE_DOMAINS, '._base_domain_')\n .replace(REGEX_CAPTURE_API_DOMAINS, '._api_base_domain_')\n .replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, '*.dev.wix-code.com');\n}\n// hosts which standard string replacing doesn't apply to them, will be fixed here.\nfunction fixHostExceptions(host) {\n // https://system-kb.wixanswers.com/kb/en/article/editorx-domains-matching-to-wixcom\n return host.replace('create.editorx.com', 'editor.editorx.com');\n}\nfunction resolveMappingsByDomain(domain, domainToMappings) {\n const mappings = domainToMappings[domain] || domainToMappings[USER_DOMAIN];\n if (!mappings) {\n if (isBaseDomain(domain)) {\n // fallback <lang>.wix.com sub domains to www.wix.com\n // since all of the languages subdomain are not mapped automatically in FP and we want to support those kind of calls\n // for example: fr.wix.com\n return domainToMappings[wwwBaseDomain];\n }\n }\n return mappings;\n}\nfunction isBaseDomain(domain) {\n return !!domain.match(/\\._base_domain_$/);\n}\nconst wwwBaseDomain = 'www._base_domain_';\nfunction injectDataIntoProtoPath(protoPath, data) {\n return protoPath\n .split('/')\n .map((path) => maybeProtoPathToData(path, data))\n .join('/');\n}\nfunction maybeProtoPathToData(protoPath, data) {\n const protoRegExpMatch = protoPath.match(REGEX_CAPTURE_PROTO_FIELD) || [];\n const field = protoRegExpMatch[1];\n if (field) {\n const suffix = protoPath.replace(protoRegExpMatch[0], '');\n return findByPath(data, field, protoPath, suffix);\n }\n return protoPath;\n}\nfunction findByPath(obj, path, defaultValue, suffix) {\n let result = obj;\n for (const field of path.split('.')) {\n if (!result) {\n return defaultValue;\n }\n result = result[field];\n }\n return `${result}${suffix}`;\n}\nfunction resolvePathFromMappings(protoPath, mappings) {\n const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));\n if (!mapping) {\n // todo: should we return the path? if no - what should we do in case of testings?\n return protoPath;\n }\n return mapping.srcPath + protoPath.slice(mapping.destPath.length);\n}\n","import { wixContext } from '@wix/sdk-context';\nexport function enableContext(wixClient, contextType) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n globalThis.__wix_context__.client = wixClient;\n }\n else {\n globalThis.__wix_context__ = { client: wixClient };\n }\n }\n else {\n wixContext.client = wixClient;\n }\n}\n","import { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nexport function elevate(restModule) {\n return createRESTModule(restModule, true);\n}\nexport const fetchWithAuth = createRESTModule((restModuleOpts) => {\n return ((url, options) => restModuleOpts.fetchWithAuth(url, options));\n});\nexport { graphql } from './graphql.js';\nexport { setGlobalWixContext } from './wix-context.js';\nexport { enableContext } from './enable-context.js';\n"],"mappings":"gGACO,SAASA,EAAiBC,EAAYC,EAAW,GAAO,CAC3D,OAAOC,EAA0BF,EAAYC,CAAQ,CACzD,CAwDA,IAAME,EAAU,CAAC,UAAW,aAAa,EAEzC,IAAMC,EAAwB,IAAI,OAAO,OAAOC,EAAQ,KAAK,GAAG,CAAC,IAAI,EAC/DC,EAAkB,CAAC,iBAAkB,uBAAuB,EAC5DC,EAAsB,mBAE5B,IAAMC,EAA4B,IAAI,OAAO,OAAOC,EAAgB,KAAK,GAAG,CAAC,IAAI,EAC3EC,EAAoC,IAAI,OAAO,QAAQC,CAAmB,GAAG,EClEnF,OAAS,cAAAC,MAAkB,mBACpB,SAASC,EAAcC,EAAWC,EAAa,CAC9CA,IAAgB,SACZ,WAAW,iBAAmB,KAC9B,WAAW,gBAAgB,OAASD,EAGpC,WAAW,gBAAkB,CAAE,OAAQA,CAAU,EAIrDF,EAAW,OAASE,CAE5B,CCTO,IAAME,EAAgBC,EAAkBC,GACnC,CAACC,EAAKC,IAAYF,EAAe,cAAcC,EAAKC,CAAO,CACtE","names":["createRESTModule","descriptor","elevated","contextualizeRESTModuleV2","DOMAINS","REGEX_CAPTURE_DOMAINS","DOMAINS","WIX_API_DOMAINS","DEV_WIX_CODE_DOMAIN","REGEX_CAPTURE_API_DOMAINS","WIX_API_DOMAINS","REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN","DEV_WIX_CODE_DOMAIN","wixContext","enableContext","wixClient","contextType","fetchWithAuth","createRESTModule","restModuleOpts","url","options"]}
1
+ {"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/rest-modules.js","../../../node_modules/@wix/sdk/build/enable-context.js","../../../node_modules/@wix/sdk/build/context.js"],"sourcesContent":["import { contextualizeRESTModuleV2 } from './context-v2.js';\nexport function createRESTModule(descriptor, elevated = false) {\n return contextualizeRESTModuleV2(descriptor, elevated);\n}\nexport function toURLSearchParams(params, isComplexRequest) {\n const flatten = flattenParams(params);\n // payloads with deep arrays or complex arrays are not serializable as URLSearchParams\n const isPayloadNonSerializableAsUrlSearchParams = Object.entries(flatten).some(([key, value]) => key.includes('.') ||\n (Array.isArray(value) && value.some((v) => typeof v === 'object')));\n const shouldSerializeToRParam = isComplexRequest && isPayloadNonSerializableAsUrlSearchParams;\n if (shouldSerializeToRParam) {\n return new URLSearchParams({ '.r': base64Encode(JSON.stringify(params)) });\n }\n else {\n return Object.entries(flatten).reduce((urlSearchParams, [key, value]) => {\n // inorder to make `foo: [1,2]` turn into `foo=1&foo=2` and not `foo[]=1&foo[]=2`\n const keyParams = Array.isArray(value) ? value : [value];\n keyParams.forEach((param) => {\n if (param === undefined ||\n param === null ||\n (Array.isArray(value) && typeof param === 'object')) {\n return;\n }\n urlSearchParams.append(key, param);\n });\n return urlSearchParams;\n }, new URLSearchParams());\n }\n}\nexport function resolveUrl(opts) {\n const domain = resolveDomain(opts.host);\n const mappings = resolveMappingsByDomain(domain, opts.domainToMappings);\n const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});\n return resolvePathFromMappings(path, mappings);\n}\nfunction flattenParams(data, path = '') {\n const params = {};\n Object.entries(data).forEach(([key, value]) => {\n const isObject = value !== null && typeof value === 'object' && !Array.isArray(value);\n const fieldPath = resolvePath(path, key);\n if (isObject) {\n const serializedObject = flattenParams(value, fieldPath);\n Object.assign(params, serializedObject);\n }\n else {\n params[fieldPath] = value;\n }\n });\n return params;\n}\nfunction resolvePath(path, key) {\n return `${path}${path ? '.' : ''}${key}`;\n}\nconst base64Encode = (value) => {\n const base64 = typeof btoa !== 'undefined'\n ? btoa(value)\n : Buffer.from(value, 'utf-8').toString('base64');\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nconst DOMAINS = ['wix.com', 'editorx.com'];\nconst USER_DOMAIN = '_';\nconst REGEX_CAPTURE_DOMAINS = new RegExp(`\\\\.(${DOMAINS.join('|')})$`);\nconst WIX_API_DOMAINS = ['42.wixprod.net', 'uw2-edt-1.wixprod.net'];\nconst DEV_WIX_CODE_DOMAIN = 'dev.wix-code.com';\nconst REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;\nconst REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\\\.(${WIX_API_DOMAINS.join('|')})$`);\nconst REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\\\.${DEV_WIX_CODE_DOMAIN}$`);\nfunction resolveDomain(host) {\n const resolvedHost = fixHostExceptions(host);\n return resolvedHost\n .replace(REGEX_CAPTURE_DOMAINS, '._base_domain_')\n .replace(REGEX_CAPTURE_API_DOMAINS, '._api_base_domain_')\n .replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, '*.dev.wix-code.com');\n}\n// hosts which standard string replacing doesn't apply to them, will be fixed here.\nfunction fixHostExceptions(host) {\n // https://system-kb.wixanswers.com/kb/en/article/editorx-domains-matching-to-wixcom\n return host.replace('create.editorx.com', 'editor.editorx.com');\n}\nfunction resolveMappingsByDomain(domain, domainToMappings) {\n const mappings = domainToMappings[domain] || domainToMappings[USER_DOMAIN];\n if (mappings) {\n return mappings;\n }\n const rootDomainMappings = resolveRootDomain(domain, domainToMappings);\n if (!rootDomainMappings) {\n if (isBaseDomain(domain)) {\n // fallback <lang>.wix.com sub domains to www.wix.com\n // since all of the languages subdomain are not mapped automatically in FP and we want to support those kind of calls\n // for example: fr.wix.com\n return domainToMappings[wwwBaseDomain];\n }\n }\n return rootDomainMappings ?? [];\n}\nfunction resolveRootDomain(domain, domainToMappings) {\n return Object.entries(domainToMappings).find(([entryDomain]) => {\n const [, ...rooDomainSegments] = domain.split('.');\n return rooDomainSegments.join('.') === entryDomain;\n })?.[1];\n}\nfunction isBaseDomain(domain) {\n return !!domain.match(/\\._base_domain_$/);\n}\nconst wwwBaseDomain = 'www._base_domain_';\nfunction injectDataIntoProtoPath(protoPath, data) {\n return protoPath\n .split('/')\n .map((path) => maybeProtoPathToData(path, data))\n .join('/');\n}\nfunction maybeProtoPathToData(protoPath, data) {\n const protoRegExpMatch = protoPath.match(REGEX_CAPTURE_PROTO_FIELD) || [];\n const field = protoRegExpMatch[1];\n if (field) {\n const suffix = protoPath.replace(protoRegExpMatch[0], '');\n return findByPath(data, field, protoPath, suffix);\n }\n return protoPath;\n}\nfunction findByPath(obj, path, defaultValue, suffix) {\n let result = obj;\n for (const field of path.split('.')) {\n if (!result) {\n return defaultValue;\n }\n result = result[field];\n }\n return `${result}${suffix}`;\n}\nfunction resolvePathFromMappings(protoPath, mappings) {\n const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));\n if (!mapping) {\n // todo: should we return the path? if no - what should we do in case of testings?\n return protoPath;\n }\n return mapping.srcPath + protoPath.slice(mapping.destPath.length);\n}\n","import { wixContext } from '@wix/sdk-context';\nexport function enableContext(wixClient, contextType) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n globalThis.__wix_context__.client = wixClient;\n }\n else {\n globalThis.__wix_context__ = { client: wixClient };\n }\n }\n else {\n wixContext.client = wixClient;\n }\n}\n","import { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nexport function elevate(restModule) {\n return createRESTModule(restModule, true);\n}\nexport const fetchWithAuth = createRESTModule((restModuleOpts) => {\n return ((url, options) => restModuleOpts.fetchWithAuth(url, options));\n});\nexport { graphql } from './graphql.js';\nexport { setGlobalWixContext } from './wix-context.js';\nexport { enableContext } from './enable-context.js';\n"],"mappings":"gGACO,SAASA,EAAiBC,EAAYC,EAAW,GAAO,CAC3D,OAAOC,EAA0BF,EAAYC,CAAQ,CACzD,CAwDA,IAAME,EAAU,CAAC,UAAW,aAAa,EAEzC,IAAMC,EAAwB,IAAI,OAAO,OAAOC,EAAQ,KAAK,GAAG,CAAC,IAAI,EAC/DC,EAAkB,CAAC,iBAAkB,uBAAuB,EAC5DC,EAAsB,mBAE5B,IAAMC,EAA4B,IAAI,OAAO,OAAOC,EAAgB,KAAK,GAAG,CAAC,IAAI,EAC3EC,EAAoC,IAAI,OAAO,QAAQC,CAAmB,GAAG,EClEnF,OAAS,cAAAC,MAAkB,mBACpB,SAASC,EAAcC,EAAWC,EAAa,CAC9CA,IAAgB,SACZ,WAAW,iBAAmB,KAC9B,WAAW,gBAAgB,OAASD,EAGpC,WAAW,gBAAkB,CAAE,OAAQA,CAAU,EAIrDF,EAAW,OAASE,CAE5B,CCTO,IAAME,EAAgBC,EAAkBC,GACnC,CAACC,EAAKC,IAAYF,EAAe,cAAcC,EAAKC,CAAO,CACtE","names":["createRESTModule","descriptor","elevated","contextualizeRESTModuleV2","DOMAINS","REGEX_CAPTURE_DOMAINS","DOMAINS","WIX_API_DOMAINS","DEV_WIX_CODE_DOMAIN","REGEX_CAPTURE_API_DOMAINS","WIX_API_DOMAINS","REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN","DEV_WIX_CODE_DOMAIN","wixContext","enableContext","wixClient","contextType","fetchWithAuth","createRESTModule","restModuleOpts","url","options"]}
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-QFPCSRLT.js";import"./chunk-J3SVE4GM.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function c(){let n=null,e=null;return{promise:new Promise((o,i)=>{n=o,e=i}),resolve:n,reject:e}}var d=({createHost:n})=>({__type:"host",create:e=>({}),host:e=>{let{applicationId:t}=e??{},o=typeof window<"u"?window.wixEmbedsAPI:void 0,i=n(e),r=m();return{...i,apiBaseUrl:r,getMonitoringClient:o?.getMonitoringClientFunction?.(t),essentials:{language:typeof window<"u"?window.commonConfig?.language:void 0,locale:typeof window<"u"?window.commonConfig?.locale:void 0}}},auth:e=>{let t=typeof window<"u"?window.wixEmbedsAPI:void 0;e||(e=t?.getAccessTokenFunction?.());let o=!1,{resolve:i,promise:r}=c();return{getAuthHeaders:async()=>{if(!e&&o&&(e=await r),!e)throw new Error("Failed to resolve auth token");return{headers:{Authorization:await e()}}},getAccessTokenInjector:()=>(o=!0,u=>{i(u)})}}});function m(){let e=(typeof window<"u"?window.wixEmbedsAPI:void 0)?.getExternalBaseUrl?.();if(!e)return;let t=new URL(e);return t?.pathname&&t.pathname!=="/"?`${t.hostname}${t.pathname}`:t.hostname}var l=({clientSdk:n,applicationId:e})=>({invoke:async({namespace:t,method:o,args:i})=>{if(!n)throw new Error("Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction");return n.invoke({namespace:t,method:o,args:i,applicationId:e,accessToken:"accessToken"})},getAccessToken:()=>{throw new Error("Not implemented")},observeState:()=>({disconnect:()=>{}})});var w=function(n){let e=(typeof $wixContext<"u"?$wixContext.clientSdk:void 0)??n?.clientSdk??(typeof window<"u"?window?.clientSdk:void 0),{applicationId:t}=n||{};if(!t)throw new Error('"createHost" was called without a required field "applicationId"');return{channel:l({clientSdk:e,applicationId:t}),close:()=>{}}};var a=d({createHost:w});var v=n=>{let e=a.host({applicationId:n}),t=a.auth(),o=t.getAccessTokenInjector();return s({auth:t,host:e}).enableContext("module"),{injectGetAccessToken:o}},P=({host:n,auth:e})=>{s({host:n,auth:e}).enableContext("module")};export{v as enableClient,P as enablePanelClient};
1
+ import{a as s}from"./chunk-WBKL5IQV.js";import"./chunk-R7FAXXP7.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function c(){let n=null,e=null;return{promise:new Promise((o,i)=>{n=o,e=i}),resolve:n,reject:e}}var d=({createHost:n})=>({__type:"host",create:e=>({}),host:e=>{let{applicationId:t}=e??{},o=typeof window<"u"?window.wixEmbedsAPI:void 0,i=n(e),r=m();return{...i,apiBaseUrl:r,getMonitoringClient:o?.getMonitoringClientFunction?.(t),essentials:{language:typeof window<"u"?window.commonConfig?.language:void 0,locale:typeof window<"u"?window.commonConfig?.locale:void 0}}},auth:e=>{let t=typeof window<"u"?window.wixEmbedsAPI:void 0;e||(e=t?.getAccessTokenFunction?.());let o=!1,{resolve:i,promise:r}=c();return{getAuthHeaders:async()=>{if(!e&&o&&(e=await r),!e)throw new Error("Failed to resolve auth token");return{headers:{Authorization:await e()}}},getAccessTokenInjector:()=>(o=!0,u=>{i(u)})}}});function m(){let e=(typeof window<"u"?window.wixEmbedsAPI:void 0)?.getExternalBaseUrl?.();if(!e)return;let t=new URL(e);return t?.pathname&&t.pathname!=="/"?`${t.hostname}${t.pathname}`:t.hostname}var l=({clientSdk:n,applicationId:e})=>({invoke:async({namespace:t,method:o,args:i})=>{if(!n)throw new Error("Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction");return n.invoke({namespace:t,method:o,args:i,applicationId:e,accessToken:"accessToken"})},getAccessToken:()=>{throw new Error("Not implemented")},observeState:()=>({disconnect:()=>{}})});var w=function(n){let e=(typeof $wixContext<"u"?$wixContext.clientSdk:void 0)??n?.clientSdk??(typeof window<"u"?window?.clientSdk:void 0),{applicationId:t}=n||{};if(!t)throw new Error('"createHost" was called without a required field "applicationId"');return{channel:l({clientSdk:e,applicationId:t}),close:()=>{}}};var a=d({createHost:w});var v=n=>{let e=a.host({applicationId:n}),t=a.auth(),o=t.getAccessTokenInjector();return s({auth:t,host:e}).enableContext("module"),{injectGetAccessToken:o}},P=({host:n,auth:e})=>{s({host:n,auth:e}).enableContext("module")};export{v as enableClient,P as enablePanelClient};
2
2
  //# sourceMappingURL=site.js.map