@wix/cli-app 1.1.65 → 1.1.67

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 (77) hide show
  1. package/build/{CreateVersionCommand-3LCMV6MO.js → CreateVersionCommand-OCHQTS2X.js} +14 -14
  2. package/build/{DevCommand-AL5OJMFK.js → DevCommand-4IXIFS3I.js} +12 -12
  3. package/build/{GenerateCommand-P3WBZGMA.js → GenerateCommand-A3NZ4E7M.js} +8 -8
  4. package/build/{LogsCommand-27N3PFUW.js → LogsCommand-VI4SOYOF.js} +4 -4
  5. package/build/PreviewCommand-EDVLRBLK.js +23 -0
  6. package/build/{ReleaseCommand-JVRK6QOZ.js → ReleaseCommand-5JSMZ6UB.js} +17 -16
  7. package/build/ReleaseCommand-5JSMZ6UB.js.map +1 -0
  8. package/build/{ServeCommand-5BSAPNHC.js → ServeCommand-47UYGAUR.js} +13 -13
  9. package/build/{build-IONLFG5I.js → build-WH5DNJQG.js} +7 -7
  10. package/build/{chunk-WRJ57AC2.js → chunk-2APJDT7U.js} +3 -3
  11. package/build/{chunk-BMM7NKZM.js → chunk-2QNFVJOZ.js} +3 -3
  12. package/build/{chunk-YKTRDLGU.js → chunk-72RQ3EPK.js} +8 -8
  13. package/build/{chunk-KQ2A66PL.js → chunk-7KWGY5JA.js} +3 -3
  14. package/build/{chunk-CUVZAENC.js → chunk-FG7KTOQN.js} +2 -2
  15. package/build/{chunk-CUVZAENC.js.map → chunk-FG7KTOQN.js.map} +1 -1
  16. package/build/{chunk-T3OLHPLT.js → chunk-FGRGEANM.js} +3 -3
  17. package/build/{chunk-YCQJNAIT.js → chunk-HIP3A6XH.js} +3 -3
  18. package/build/{chunk-LVHX7JGR.js → chunk-JVYYEP4B.js} +35 -6
  19. package/build/{chunk-LVHX7JGR.js.map → chunk-JVYYEP4B.js.map} +1 -1
  20. package/build/{chunk-L2MHG5WV.js → chunk-L5ETMB4Z.js} +5 -5
  21. package/build/{chunk-4SH3UIG6.js → chunk-LEVI3PK6.js} +3 -3
  22. package/build/{chunk-PZGUE6SY.js → chunk-LTAUYL4H.js} +3 -3
  23. package/build/{chunk-HH64DLEE.js → chunk-NTI35N6X.js} +7 -7
  24. package/build/{chunk-HH64DLEE.js.map → chunk-NTI35N6X.js.map} +1 -1
  25. package/build/{chunk-HTJIY6JE.js → chunk-P4IYXOMH.js} +2 -2
  26. package/build/{chunk-HTJIY6JE.js.map → chunk-P4IYXOMH.js.map} +1 -1
  27. package/build/{chunk-7GJYEEDQ.js → chunk-RSMM6AJY.js} +624 -38
  28. package/build/{chunk-7GJYEEDQ.js.map → chunk-RSMM6AJY.js.map} +1 -1
  29. package/build/{chunk-JAGVJ3T4.js → chunk-VSBG2V5M.js} +3 -3
  30. package/build/{chunk-G2IJ2IWB.js → chunk-WRJRTFOI.js} +3 -3
  31. package/build/{chunk-FASUKQVL.js → chunk-YG3BFHRO.js} +2 -2
  32. package/build/{chunk-DWOAWAAA.js → chunk-ZRS3UMNA.js} +5 -5
  33. package/build/cloudflare-runtime/entry.js +5 -5
  34. package/build/cloudflare-runtime/getRegisteredExtensions.js +5 -5
  35. package/build/index.js +20 -20
  36. package/build/platform-sdk/chunk-42XIZ4MH.js +2 -0
  37. package/build/platform-sdk/chunk-42XIZ4MH.js.map +1 -0
  38. package/build/platform-sdk/chunk-CR7DIEFQ.js +2 -0
  39. package/build/platform-sdk/chunk-CR7DIEFQ.js.map +1 -0
  40. package/build/platform-sdk/{chunk-XYIDODIB.js → chunk-EERHWVVD.js} +2 -2
  41. package/build/platform-sdk/dashboard.js +1 -1
  42. package/build/platform-sdk/editor.js +1 -1
  43. package/build/platform-sdk/sdk-context.js +1 -1
  44. package/build/platform-sdk/sdk-context.js.map +1 -1
  45. package/build/platform-sdk/site.js +1 -1
  46. package/build/{preview-OF2W3WOE.js → preview-6X7F4EFT.js} +12 -12
  47. package/build/{render-command-MCDOFXCD.js → render-command-SSMPKWYD.js} +6 -6
  48. package/package.json +7 -7
  49. package/build/PreviewCommand-KWMT6GOO.js +0 -23
  50. package/build/ReleaseCommand-JVRK6QOZ.js.map +0 -1
  51. package/build/platform-sdk/chunk-BGTZ3RNN.js +0 -2
  52. package/build/platform-sdk/chunk-BGTZ3RNN.js.map +0 -1
  53. package/build/platform-sdk/chunk-RH4X5G4O.js +0 -2
  54. package/build/platform-sdk/chunk-RH4X5G4O.js.map +0 -1
  55. /package/build/{CreateVersionCommand-3LCMV6MO.js.map → CreateVersionCommand-OCHQTS2X.js.map} +0 -0
  56. /package/build/{DevCommand-AL5OJMFK.js.map → DevCommand-4IXIFS3I.js.map} +0 -0
  57. /package/build/{GenerateCommand-P3WBZGMA.js.map → GenerateCommand-A3NZ4E7M.js.map} +0 -0
  58. /package/build/{LogsCommand-27N3PFUW.js.map → LogsCommand-VI4SOYOF.js.map} +0 -0
  59. /package/build/{PreviewCommand-KWMT6GOO.js.map → PreviewCommand-EDVLRBLK.js.map} +0 -0
  60. /package/build/{ServeCommand-5BSAPNHC.js.map → ServeCommand-47UYGAUR.js.map} +0 -0
  61. /package/build/{build-IONLFG5I.js.map → build-WH5DNJQG.js.map} +0 -0
  62. /package/build/{chunk-WRJ57AC2.js.map → chunk-2APJDT7U.js.map} +0 -0
  63. /package/build/{chunk-BMM7NKZM.js.map → chunk-2QNFVJOZ.js.map} +0 -0
  64. /package/build/{chunk-YKTRDLGU.js.map → chunk-72RQ3EPK.js.map} +0 -0
  65. /package/build/{chunk-KQ2A66PL.js.map → chunk-7KWGY5JA.js.map} +0 -0
  66. /package/build/{chunk-T3OLHPLT.js.map → chunk-FGRGEANM.js.map} +0 -0
  67. /package/build/{chunk-YCQJNAIT.js.map → chunk-HIP3A6XH.js.map} +0 -0
  68. /package/build/{chunk-L2MHG5WV.js.map → chunk-L5ETMB4Z.js.map} +0 -0
  69. /package/build/{chunk-4SH3UIG6.js.map → chunk-LEVI3PK6.js.map} +0 -0
  70. /package/build/{chunk-PZGUE6SY.js.map → chunk-LTAUYL4H.js.map} +0 -0
  71. /package/build/{chunk-JAGVJ3T4.js.map → chunk-VSBG2V5M.js.map} +0 -0
  72. /package/build/{chunk-G2IJ2IWB.js.map → chunk-WRJRTFOI.js.map} +0 -0
  73. /package/build/{chunk-FASUKQVL.js.map → chunk-YG3BFHRO.js.map} +0 -0
  74. /package/build/{chunk-DWOAWAAA.js.map → chunk-ZRS3UMNA.js.map} +0 -0
  75. /package/build/platform-sdk/{chunk-XYIDODIB.js.map → chunk-EERHWVVD.js.map} +0 -0
  76. /package/build/{preview-OF2W3WOE.js.map → preview-6X7F4EFT.js.map} +0 -0
  77. /package/build/{render-command-MCDOFXCD.js.map → render-command-SSMPKWYD.js.map} +0 -0
@@ -3,12 +3,12 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  wixCliCliCommand,
5
5
  wixCliCliCommandStatus
6
- } from "./chunk-7GJYEEDQ.js";
6
+ } from "./chunk-RSMM6AJY.js";
7
7
  import {
8
8
  isCliError,
9
9
  isCliSystemError,
10
10
  require_is_ci
11
- } from "./chunk-CUVZAENC.js";
11
+ } from "./chunk-FG7KTOQN.js";
12
12
  import {
13
13
  __toESM,
14
14
  init_esm_shims
@@ -148,4 +148,4 @@ export {
148
148
  addUserFields,
149
149
  reportCommandStartEvent
150
150
  };
151
- //# sourceMappingURL=chunk-JAGVJ3T4.js.map
151
+ //# sourceMappingURL=chunk-VSBG2V5M.js.map
@@ -9,14 +9,14 @@ import {
9
9
  readPackageJson,
10
10
  useProjectModel,
11
11
  writePackageJson
12
- } from "./chunk-7GJYEEDQ.js";
12
+ } from "./chunk-RSMM6AJY.js";
13
13
  import {
14
14
  CliError,
15
15
  CliErrorCode,
16
16
  require_lib,
17
17
  require_react,
18
18
  z
19
- } from "./chunk-CUVZAENC.js";
19
+ } from "./chunk-FG7KTOQN.js";
20
20
  import {
21
21
  __commonJS,
22
22
  __require,
@@ -9345,4 +9345,4 @@ ejs/lib/ejs.js:
9345
9345
  * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
9346
9346
  *)
9347
9347
  */
9348
- //# sourceMappingURL=chunk-G2IJ2IWB.js.map
9348
+ //# sourceMappingURL=chunk-WRJRTFOI.js.map
@@ -5,7 +5,7 @@ import {
5
5
  require_SetCache,
6
6
  require_cacheHas,
7
7
  require_setToArray
8
- } from "./chunk-7GJYEEDQ.js";
8
+ } from "./chunk-RSMM6AJY.js";
9
9
  import {
10
10
  __commonJS,
11
11
  init_esm_shims
@@ -192,4 +192,4 @@ var require_baseUniq = __commonJS({
192
192
  export {
193
193
  require_baseUniq
194
194
  };
195
- //# sourceMappingURL=chunk-FASUKQVL.js.map
195
+ //# sourceMappingURL=chunk-YG3BFHRO.js.map
@@ -2,19 +2,19 @@ import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  usePlatform
5
- } from "./chunk-L2MHG5WV.js";
5
+ } from "./chunk-L5ETMB4Z.js";
6
6
  import {
7
7
  useResolveDashboardExtensionUrl,
8
8
  useResolvePlatformUrl,
9
9
  useSite
10
- } from "./chunk-HH64DLEE.js";
10
+ } from "./chunk-NTI35N6X.js";
11
11
  import {
12
12
  PlatformType,
13
13
  getAppBuildFolder,
14
14
  getAppManifestPath,
15
15
  pathExists,
16
16
  useExtensions
17
- } from "./chunk-7GJYEEDQ.js";
17
+ } from "./chunk-RSMM6AJY.js";
18
18
  import {
19
19
  Box_default,
20
20
  CliError,
@@ -25,7 +25,7 @@ import {
25
25
  Trans,
26
26
  require_react,
27
27
  useTranslation
28
- } from "./chunk-CUVZAENC.js";
28
+ } from "./chunk-FG7KTOQN.js";
29
29
  import {
30
30
  __toESM,
31
31
  init_esm_shims
@@ -93,4 +93,4 @@ export {
93
93
  assertBuildOutputExists,
94
94
  PlatformViewer
95
95
  };
96
- //# sourceMappingURL=chunk-DWOAWAAA.js.map
96
+ //# sourceMappingURL=chunk-ZRS3UMNA.js.map
@@ -11613,7 +11613,7 @@ function objectToKeyValue(input) {
11613
11613
  return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
11614
11614
  }
11615
11615
 
11616
- // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
11616
+ // ../../node_modules/@wix/sdk-runtime/build/context.js
11617
11617
  function runWithoutContext(fn) {
11618
11618
  const globalContext = globalThis.__wix_context__;
11619
11619
  const moduleContext = {
@@ -12142,7 +12142,7 @@ function AppStrategy(opts) {
12142
12142
  })
12143
12143
  });
12144
12144
  if (tokensRes.status !== 200) {
12145
- throw new Error(`Failed to exchange authorization code for refresh token. Unexpected status code from Wix OAuth API: ${tokensRes.status}`);
12145
+ throw new Error(`Failed to exchange authorization code for refresh token. Unexpected status code from Wix OAuth API: ${tokensRes.status}, request id: ${tokensRes.headers.get("x-wix-request-id")}`);
12146
12146
  }
12147
12147
  const tokens = await tokensRes.json();
12148
12148
  refreshToken = tokens.refresh_token;
@@ -12177,7 +12177,7 @@ function AppStrategy(opts) {
12177
12177
  })
12178
12178
  });
12179
12179
  if (tokensRes.status !== 200) {
12180
- throw new Error(`Failed to exchange refresh token for access token. Unexpected status code from Wix OAuth API: ${tokensRes.status}`);
12180
+ throw new Error(`Failed to exchange refresh token for access token. Unexpected status code from Wix OAuth API: ${tokensRes.status}, request id: ${tokensRes.headers.get("x-wix-request-id")}`);
12181
12181
  }
12182
12182
  const tokens = await tokensRes.json();
12183
12183
  refreshToken = tokens.refresh_token;
@@ -12203,7 +12203,7 @@ function AppStrategy(opts) {
12203
12203
  })
12204
12204
  });
12205
12205
  if (tokensRes.status !== 200) {
12206
- throw new Error(`Failed to exchange instance ID for access token. Unexpected status code from Wix OAuth API: ${tokensRes.status}`);
12206
+ throw new Error(`Failed to exchange instance ID for access token. Unexpected status code from Wix OAuth API: ${tokensRes.status}, request id: ${tokensRes.headers.get("x-wix-request-id")}`);
12207
12207
  }
12208
12208
  const tokens = await tokensRes.json();
12209
12209
  cachedToken = {
@@ -12228,7 +12228,7 @@ function AppStrategy(opts) {
12228
12228
  })
12229
12229
  });
12230
12230
  if (tokenRes.status !== 200) {
12231
- throw new Error(`Failed to get unbound token. Unexpected status code from Wix OAuth API: ${tokenRes.status}`);
12231
+ throw new Error(`Failed to get unbound token. Unexpected status code from Wix OAuth API: ${tokenRes.status}, request id: ${tokenRes.headers.get("x-wix-request-id")}`);
12232
12232
  }
12233
12233
  const { access_token, expires_in } = await tokenRes.json();
12234
12234
  cachedToken = {
@@ -4414,7 +4414,7 @@ function objectToKeyValue(input) {
4414
4414
  return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
4415
4415
  }
4416
4416
 
4417
- // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
4417
+ // ../../node_modules/@wix/sdk-runtime/build/context.js
4418
4418
  function runWithoutContext(fn) {
4419
4419
  const globalContext = globalThis.__wix_context__;
4420
4420
  const moduleContext = {
@@ -4943,7 +4943,7 @@ function AppStrategy(opts) {
4943
4943
  })
4944
4944
  });
4945
4945
  if (tokensRes.status !== 200) {
4946
- throw new Error(`Failed to exchange authorization code for refresh token. Unexpected status code from Wix OAuth API: ${tokensRes.status}`);
4946
+ throw new Error(`Failed to exchange authorization code for refresh token. Unexpected status code from Wix OAuth API: ${tokensRes.status}, request id: ${tokensRes.headers.get("x-wix-request-id")}`);
4947
4947
  }
4948
4948
  const tokens = await tokensRes.json();
4949
4949
  refreshToken = tokens.refresh_token;
@@ -4978,7 +4978,7 @@ function AppStrategy(opts) {
4978
4978
  })
4979
4979
  });
4980
4980
  if (tokensRes.status !== 200) {
4981
- throw new Error(`Failed to exchange refresh token for access token. Unexpected status code from Wix OAuth API: ${tokensRes.status}`);
4981
+ throw new Error(`Failed to exchange refresh token for access token. Unexpected status code from Wix OAuth API: ${tokensRes.status}, request id: ${tokensRes.headers.get("x-wix-request-id")}`);
4982
4982
  }
4983
4983
  const tokens = await tokensRes.json();
4984
4984
  refreshToken = tokens.refresh_token;
@@ -5004,7 +5004,7 @@ function AppStrategy(opts) {
5004
5004
  })
5005
5005
  });
5006
5006
  if (tokensRes.status !== 200) {
5007
- throw new Error(`Failed to exchange instance ID for access token. Unexpected status code from Wix OAuth API: ${tokensRes.status}`);
5007
+ throw new Error(`Failed to exchange instance ID for access token. Unexpected status code from Wix OAuth API: ${tokensRes.status}, request id: ${tokensRes.headers.get("x-wix-request-id")}`);
5008
5008
  }
5009
5009
  const tokens = await tokensRes.json();
5010
5010
  cachedToken = {
@@ -5029,7 +5029,7 @@ function AppStrategy(opts) {
5029
5029
  })
5030
5030
  });
5031
5031
  if (tokenRes.status !== 200) {
5032
- throw new Error(`Failed to get unbound token. Unexpected status code from Wix OAuth API: ${tokenRes.status}`);
5032
+ throw new Error(`Failed to get unbound token. Unexpected status code from Wix OAuth API: ${tokenRes.status}, request id: ${tokenRes.headers.get("x-wix-request-id")}`);
5033
5033
  }
5034
5034
  const { access_token, expires_in } = await tokenRes.json();
5035
5035
  cachedToken = {
package/build/index.js CHANGED
@@ -2,13 +2,13 @@ import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  createI18nT
5
- } from "./chunk-YCQJNAIT.js";
6
- import "./chunk-HTJIY6JE.js";
5
+ } from "./chunk-HIP3A6XH.js";
6
+ import "./chunk-P4IYXOMH.js";
7
7
  import {
8
8
  require_react,
9
9
  version,
10
10
  z
11
- } from "./chunk-CUVZAENC.js";
11
+ } from "./chunk-FG7KTOQN.js";
12
12
  import {
13
13
  __commonJS,
14
14
  __require,
@@ -3371,8 +3371,8 @@ var {
3371
3371
  // src/commands/build.ts
3372
3372
  init_esm_shims();
3373
3373
  var buildCommand = (services) => createCommand("build").action(async (_, command) => {
3374
- const { runCommand } = await import("./render-command-MCDOFXCD.js");
3375
- const { build } = await import("./build-IONLFG5I.js");
3374
+ const { runCommand } = await import("./render-command-SSMPKWYD.js");
3375
+ const { build } = await import("./build-WH5DNJQG.js");
3376
3376
  await runCommand(command, services, build);
3377
3377
  });
3378
3378
 
@@ -3382,8 +3382,8 @@ var import_react = __toESM(require_react(), 1);
3382
3382
  var devCommand = (services) => {
3383
3383
  const t = createI18nT();
3384
3384
  return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).action(async (options, command) => {
3385
- const { DevCommand } = await import("./DevCommand-AL5OJMFK.js");
3386
- const { renderCommand } = await import("./render-command-MCDOFXCD.js");
3385
+ const { DevCommand } = await import("./DevCommand-4IXIFS3I.js");
3386
+ const { renderCommand } = await import("./render-command-SSMPKWYD.js");
3387
3387
  const { https = false } = options;
3388
3388
  await renderCommand(command, services, /* @__PURE__ */ import_react.default.createElement(DevCommand, { https }), {
3389
3389
  watchForModelChanges: true
@@ -3443,10 +3443,10 @@ var previewCommand = (services) => {
3443
3443
  validateBase
3444
3444
  ).option("--no-input", t("app_preview_command_def.option.no_input")).action(async (options, command) => {
3445
3445
  const { site, baseUrl, input } = options;
3446
- const { renderCommand, runCommand } = await import("./render-command-MCDOFXCD.js");
3446
+ const { renderCommand, runCommand } = await import("./render-command-SSMPKWYD.js");
3447
3447
  if (!input) {
3448
3448
  return runCommand(command, services, async (model) => {
3449
- const { nonInteractivePreview } = await import("./preview-OF2W3WOE.js");
3449
+ const { nonInteractivePreview } = await import("./preview-6X7F4EFT.js");
3450
3450
  return nonInteractivePreview(
3451
3451
  { siteId: site, baseUrl },
3452
3452
  model,
@@ -3454,7 +3454,7 @@ var previewCommand = (services) => {
3454
3454
  );
3455
3455
  });
3456
3456
  }
3457
- const { PreviewCommand } = await import("./PreviewCommand-KWMT6GOO.js");
3457
+ const { PreviewCommand } = await import("./PreviewCommand-EDVLRBLK.js");
3458
3458
  await renderCommand(
3459
3459
  command,
3460
3460
  services,
@@ -3486,8 +3486,8 @@ var createVersionCommand = (services) => {
3486
3486
  validateBase
3487
3487
  ).action(async (options, command) => {
3488
3488
  const { VersionType } = await import("./types.impl-CD4WWRUK.js");
3489
- const { renderCommand } = await import("./render-command-MCDOFXCD.js");
3490
- const { CreateVersionCommand } = await import("./CreateVersionCommand-3LCMV6MO.js");
3489
+ const { renderCommand } = await import("./render-command-SSMPKWYD.js");
3490
+ const { CreateVersionCommand } = await import("./CreateVersionCommand-OCHQTS2X.js");
3491
3491
  const {
3492
3492
  approvePreview = false,
3493
3493
  versionType: versionTypeString,
@@ -3519,8 +3519,8 @@ var createVersionCommand = (services) => {
3519
3519
  init_esm_shims();
3520
3520
  var import_react4 = __toESM(require_react(), 1);
3521
3521
  var serveCommand = (services) => createCommand("serve").action(async (_, command) => {
3522
- const { renderCommand } = await import("./render-command-MCDOFXCD.js");
3523
- const { ServeCommand } = await import("./ServeCommand-5BSAPNHC.js");
3522
+ const { renderCommand } = await import("./render-command-SSMPKWYD.js");
3523
+ const { ServeCommand } = await import("./ServeCommand-47UYGAUR.js");
3524
3524
  await renderCommand(command, services, /* @__PURE__ */ import_react4.default.createElement(ServeCommand, null));
3525
3525
  });
3526
3526
 
@@ -3530,8 +3530,8 @@ var import_react5 = __toESM(require_react(), 1);
3530
3530
  var generateCommand = (services) => {
3531
3531
  const t = createI18nT();
3532
3532
  return createCommand("generate").description(t("generate_command.description")).action(async (options, command) => {
3533
- const { GenerateCommand } = await import("./GenerateCommand-P3WBZGMA.js");
3534
- const { renderCommand } = await import("./render-command-MCDOFXCD.js");
3533
+ const { GenerateCommand } = await import("./GenerateCommand-A3NZ4E7M.js");
3534
+ const { renderCommand } = await import("./render-command-SSMPKWYD.js");
3535
3535
  await renderCommand(command, services, /* @__PURE__ */ import_react5.default.createElement(GenerateCommand, null), {
3536
3536
  skipProjectValidation: true
3537
3537
  });
@@ -3549,8 +3549,8 @@ var logsCommand = (services) => {
3549
3549
  validateVersion
3550
3550
  ).action(async (options, command) => {
3551
3551
  const { version: version2 } = options;
3552
- const { renderCommand } = await import("./render-command-MCDOFXCD.js");
3553
- const { LogsCommand } = await import("./LogsCommand-27N3PFUW.js");
3552
+ const { renderCommand } = await import("./render-command-SSMPKWYD.js");
3553
+ const { LogsCommand } = await import("./LogsCommand-VI4SOYOF.js");
3554
3554
  await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(LogsCommand, { version: version2 }));
3555
3555
  });
3556
3556
  };
@@ -3581,8 +3581,8 @@ var releaseCommand = (services) => {
3581
3581
  "-y, --approve-minor",
3582
3582
  t("release_command_def.option.approve_minor")
3583
3583
  ).action(async (options, command) => {
3584
- const { renderCommand } = await import("./render-command-MCDOFXCD.js");
3585
- const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-JVRK6QOZ.js");
3584
+ const { renderCommand } = await import("./render-command-SSMPKWYD.js");
3585
+ const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-5JSMZ6UB.js");
3586
3586
  const { baseUrl, site, comment, approveMinor = false } = options;
3587
3587
  const versionType = options.versionType ? {
3588
3588
  major: ReleaseVersionType.MAJOR,
@@ -0,0 +1,2 @@
1
+ import{wixContext as l}from"@wix/sdk-context";function d(i,t){return{...i,...Object.fromEntries(t.map(n=>[n,(...e)=>{let o=r();if(!o)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return o.initWixModules(i)[n].apply(void 0,e)}]))}}function c(i,t){return(...n)=>{let e=r();return e?e.initWixModules(i,t).apply(void 0,n):i.apply(void 0,n)}}function r(){let i=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(i)return{initWixModules(e,o){return x(()=>i(e,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 l.client<"u"?l.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,n=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof l.elevatedClient<"u"?l.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!n))return{initWixModules(e,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 x(()=>n.use(e))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return x(()=>t.use(e))},fetchWithAuth:(e,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(e,o)},async graphql(e,o,u){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,o,u)}}}function x(i){let t=globalThis.__wix_context__,n={client:l.client,elevatedClient:l.elevatedClient},e;globalThis.__wix_context__=void 0,l.client=void 0,l.elevatedClient=void 0,typeof $wixContext<"u"&&(e={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return i()}finally{globalThis.__wix_context__=t,l.client=n.client,l.elevatedClient=n.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=e.client,$wixContext.elevatedClient=e.elevatedClient)}}export{d as a,c as b,x as c};
2
+ //# sourceMappingURL=chunk-42XIZ4MH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/@wix/sdk-runtime/build/context.js","../../../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 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 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,mBCGpB,SAASC,EAA0BC,EAAYC,EAAO,CACzD,MAAO,CACH,GAAGD,EACH,GAAG,OAAO,YAAYC,EAAM,IAAKC,GAAS,CACtCA,EACA,IAAIC,IAAS,CACT,IAAMC,EAAUC,EAAe,EAC/B,GAAI,CAACD,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EACF,eAAeJ,CAAU,EAAEE,CAAI,EAAE,MAAM,OAAWC,CAAI,CAC/D,CACJ,CAAC,CAAC,CACN,CACJ,CACO,SAASG,EAA0BC,EAAYC,EAAU,CAC5D,MAAQ,IAAIL,IAAS,CACjB,IAAMC,EAAUC,EAAe,EAC/B,OAAKD,EAIGA,EACH,eAAeG,EAAYC,CAAQ,EAEnC,MAAM,OAAWL,CAAI,EALfI,EAAW,MAAM,OAAWJ,CAAI,CAM/C,CACJ,CD9BO,SAASM,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,MAAM,QAAQC,EAAOC,EAAWC,EAAM,CAClC,GAAI,CAACR,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,QAAQM,EAAOC,EAAWC,CAAI,CAC1D,CACJ,CACJ,CAwCO,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","contextualizeHostModuleV2","hostModule","props","prop","args","context","resolveContext","contextualizeRESTModuleV2","restModule","elevated","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","wixContext","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext"]}
@@ -0,0 +1,2 @@
1
+ import{a as p}from"./chunk-42XIZ4MH.js";function T(e){return p({__type:"host",create:t=>Object.entries(e).reduce((r,[n,s])=>({...r,[n]:s(t)}),{})},Object.keys(e))}var k=e=>e!=null&&e!=="",a=e=>u(e,k);function u(e,t=r=>!!r){if(!e)return{};let r={};for(let n in e)t(e[n],n)&&(r[n]=e[n]);return r}var d=e=>{let t=a({"app.id":e.appId,"app.version":e.appVersion,"app.instanceId":e.appInstanceId,"extension.id":e.extensionId,"extension.name":e.extensionName,"extension.type":e.extensionType,platform:e.platform}),r=u({"extension.data":a({...e.extensionData}),site:a({url:e.siteUrl,id:e.tenantType==="SITE"?e.tenantId:void 0}),account:a({id:e.tenantType==="ACCOUNT"?e.tenantId:void 0})},n=>!!n&&Object.keys(n).length>0);return{tags:t,contexts:r}},x=class{constructor(e){this.message=e,this.captureException=()=>(console.error(this.message),""),this.captureMessage=()=>(console.error(this.message),""),this.startSpan=()=>(console.error(this.message),{}),this.addBreadcrumb=()=>{console.error(this.message)}}},i=e=>new x(e);var y=(e,{tags:t,contexts:r})=>{t&&e.setTags(t),r&&Object.entries(r).forEach(([n,s])=>typeof s<"u"&&e.setContext(n,s))},w=(e,t)=>{if(!t)return;let{tags:r,contexts:n}=d(t);y(e,{tags:r,contexts:n})},g=(e,t,r,n={},s="info",o)=>{let l=new r.Hub(e,t);return l.withScope(c=>{let{level:S=s,tags:f,contexts:C}=n;return c.setLevel(S),y(c,{tags:f,contexts:C}),o(c,l)})},m=class{constructor(e){this.sentry=e.sentrySDK,this.scope=new this.sentry.Scope,this.sentryClient=new this.sentry.BrowserClient({dsn:e.dsn,transport:e.transport??this.sentry.makeFetchTransport,integrations:this.sentry.getDefaultIntegrations({}),stackParser:this.sentry.defaultStackParser,tracesSampleRate:e.tracesSampleRate||1,debug:e.debug??!1,environment:e.environment,release:e.release}),w(this.scope,e.hostContext),this.scope.setClient(this.sentryClient),this.sentryClient.init()}},B=class extends m{constructor(){super(...arguments),this.addBreadcrumb=e=>{let t={type:e.type,category:e.category,message:e.message,level:e.level,data:e.data};this.scope.addBreadcrumb(t)},this.captureException=(e,t)=>g(this.sentryClient,this.scope,this.sentry,t,"error",r=>r.captureException(e)),this.captureMessage=(e,t)=>g(this.sentryClient,this.scope,this.sentry,t,"info",r=>r.captureMessage(e)),this.startSpan=(e,t)=>{let r={name:e.name,tags:e.tags};return this.sentry.startSpan({...r,scope:this.scope},t)}}},M=class extends m{constructor(){super(...arguments),this.addBreadcrumb=e=>{let t={type:e.type,category:e.category,message:e.message,level:e.level,data:e.data};this.scope.addBreadcrumb(t)},this.captureException=(e,t)=>this.sentryClient.captureException(e,{captureContext:{level:t?.level??"error",tags:t?.tags,contexts:t?.contexts}},this.scope),this.captureMessage=(e,t)=>this.sentryClient.captureMessage(e,t?.level??"error",{captureContext:{level:t?.level??"error",tags:t?.tags,contexts:t?.contexts}},this.scope),this.startSpan=(e,t)=>{let r={name:e.name,tags:e.tags};return this.sentry.startSpan({...r,scope:this.scope},t)}}},h=e=>`Sentry SDK version "${e}" is not supported. Please make sure to use monitoring SDK only in supported environments.`,I=e=>{try{return parseInt(e.split(".")[0],10)}catch{console.warn("Failed to parse Sentry SDK version");return}},v=({microFrontendEnvironment:e,sentrySDK:t,dsn:r,...n})=>{if(!t)return i("Unsupported environment - Sentry SDK is not loaded into the environment. Please make sure to use monitoring SDK only in supported environments.");if(!r)return i("Missing Sentry DSN in the app's monitoring configuration. Please make sure to set it.");try{let s=t.SDK_VERSION&&I(t.SDK_VERSION);return e?s&&s!==7?i(h(t.SDK_VERSION)):new B({...n,dsn:r,sentrySDK:t}):s&&s<7?i(h(t.SDK_VERSION)):new M({...n,dsn:r,sentrySDK:t})}catch(s){return i(`Failed to initialize monitoring client: ${s.message}`)}};var E=e=>e?.type==="SENTRY",U=({sentrySDK:e,sentryTransport:t,monitoringConfig:r,hostContext:n,microFrontendEnvironment:s})=>{if(E(r)){let{sentryOptions:o}=r;return()=>v({microFrontendEnvironment:s,dsn:o?.dsn,hostContext:n,sentrySDK:e,transport:t})}return()=>i("Invalid monitoring configuration. Please check the monitoring setup of your application.")};export{T as a,U as b};
2
+ //# sourceMappingURL=chunk-CR7DIEFQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/@wix/sdk-runtime/build/host-modules.js","../../../node_modules/@wix/monitoring/build/index.js","../../../node_modules/@wix/monitoring-browser-sentry/build/index.js","../../../node_modules/@wix/monitoring-browser-sdk-host/build/index.js"],"sourcesContent":["import { contextualizeHostModuleV2 } from './context-v2.js';\nexport function createHostModule(hostModuleAPI) {\n return contextualizeHostModuleV2({\n __type: 'host',\n create: (host) => Object.entries(hostModuleAPI).reduce((acc, [key, fn]) => ({\n ...acc,\n [key]: fn(host),\n }), {}),\n }, Object.keys(hostModuleAPI));\n}\n","// src/context/context-utils.ts\nvar validValue = (value) => value !== void 0 && value !== null && value !== \"\";\nvar pickByValidValues = (obj) => pickBy(obj, validValue);\nfunction pickBy(object, predicate = (value) => !!value) {\n if (!object) {\n return {};\n }\n const result = {};\n for (const key in object) {\n if (predicate(object[key], key)) {\n result[key] = object[key];\n }\n }\n return result;\n}\nvar generateTagsAndContext = (context) => {\n const tags = pickByValidValues({\n \"app.id\": context.appId,\n \"app.version\": context.appVersion,\n \"app.instanceId\": context.appInstanceId,\n \"extension.id\": context.extensionId,\n \"extension.name\": context.extensionName,\n \"extension.type\": context.extensionType,\n platform: context.platform\n });\n const contexts = pickBy(\n {\n \"extension.data\": pickByValidValues({\n ...context.extensionData\n }),\n site: pickByValidValues({\n url: context.siteUrl,\n id: context.tenantType === \"SITE\" ? context.tenantId : void 0\n }),\n account: pickByValidValues({\n id: context.tenantType === \"ACCOUNT\" ? context.tenantId : void 0\n })\n },\n (value) => !!value && Object.keys(value).length > 0\n );\n return {\n tags,\n contexts\n };\n};\n\n// src/fallback-client.ts\nvar FallbackMonitoringClient = class {\n constructor(message) {\n this.message = message;\n this.captureException = () => {\n console.error(this.message);\n return \"\";\n };\n this.captureMessage = () => {\n console.error(this.message);\n return \"\";\n };\n this.startSpan = () => {\n console.error(this.message);\n return {};\n };\n this.addBreadcrumb = () => {\n console.error(this.message);\n };\n }\n};\nvar createFallbackMonitoringClient = (message) => {\n return new FallbackMonitoringClient(message);\n};\nexport {\n createFallbackMonitoringClient,\n generateTagsAndContext\n};\n","// src/factory.ts\nimport { createFallbackMonitoringClient } from \"@wix/monitoring\";\n\n// src/utils.ts\nimport { generateTagsAndContext } from \"@wix/monitoring\";\nvar setTagsAndContextsOnScope = (scope, { tags, contexts }) => {\n if (tags) {\n scope.setTags(tags);\n }\n if (contexts) {\n Object.entries(contexts).forEach(\n ([key, value]) => typeof value !== \"undefined\" && scope.setContext(key, value)\n );\n }\n};\nvar setHostContextOnScope = (scope, hostContext) => {\n if (!hostContext) {\n return;\n }\n const { tags, contexts } = generateTagsAndContext(hostContext);\n setTagsAndContextsOnScope(scope, { tags, contexts });\n};\n\n// src/micro-frontend/utils.ts\nvar withCaptureScope = (client, scope, sentry, captureContext = {}, defaultLevel = \"info\", callback) => {\n const hub = new sentry.Hub(client, scope);\n return hub.withScope((_scope) => {\n const { level = defaultLevel, tags, contexts } = captureContext;\n _scope.setLevel(level);\n setTagsAndContextsOnScope(_scope, { tags, contexts });\n return callback(_scope, hub);\n });\n};\n\n// src/abstract-browser-client.ts\nvar AbstractSentryBrowserClient = class {\n constructor(options) {\n this.sentry = options.sentrySDK;\n this.scope = new this.sentry.Scope();\n this.sentryClient = new this.sentry.BrowserClient({\n dsn: options.dsn,\n transport: options.transport ?? this.sentry.makeFetchTransport,\n integrations: this.sentry.getDefaultIntegrations({}),\n stackParser: this.sentry.defaultStackParser,\n tracesSampleRate: options.tracesSampleRate || 1,\n debug: options.debug ?? false,\n environment: options.environment,\n release: options.release\n });\n setHostContextOnScope(this.scope, options.hostContext);\n this.scope.setClient(this.sentryClient);\n this.sentryClient.init();\n }\n};\n\n// src/micro-frontend/client.ts\nvar SentryBrowserMicroFrontendClient = class extends AbstractSentryBrowserClient {\n constructor() {\n super(...arguments);\n /**\n * Records a new breadcrumb which will be attached to future events.\n * Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.\n * @param breadcrumb The breadcrumb to record.\n */\n this.addBreadcrumb = (breadcrumb) => {\n const filteredBreadcrumb = {\n type: breadcrumb.type,\n category: breadcrumb.category,\n message: breadcrumb.message,\n level: breadcrumb.level,\n data: breadcrumb.data\n };\n this.scope.addBreadcrumb(filteredBreadcrumb);\n };\n /**\n * Captures an exception event and sends it to Sentry.\n * @param error The error to capture\n * @param captureContext Optional additional data to attach to the Sentry e vent.\n * @returns the id of the captured Sentry event.\n */\n this.captureException = (error, captureContext) => {\n return withCaptureScope(\n this.sentryClient,\n this.scope,\n this.sentry,\n captureContext,\n \"error\",\n (scope) => scope.captureException(error)\n );\n };\n /**\n * Captures a message event and sends it to Sentry.\n * @param message The message to capture\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\n this.captureMessage = (message, captureContext) => {\n return withCaptureScope(\n this.sentryClient,\n this.scope,\n this.sentry,\n captureContext,\n \"info\",\n (scope) => scope.captureMessage(message)\n );\n };\n /**\n * Wraps a function with a span and finishes the span after the function is done. The created span is the active span and will be used as parent by other spans created inside the function, as long as the function is executed while the scope is active.\n * @param spanOptions The options for the span\n * @param callback The function to wrap with a span\n * @returns The return value of the callback\n */\n this.startSpan = (spanOptions, callback) => {\n const filteredSpanOptions = {\n name: spanOptions.name,\n tags: spanOptions.tags\n };\n return this.sentry.startSpan(\n { ...filteredSpanOptions, scope: this.scope },\n callback\n );\n };\n }\n};\n\n// src/browser/client.ts\nvar SentryBrowserClient = class extends AbstractSentryBrowserClient {\n constructor() {\n super(...arguments);\n /**\n * Records a new breadcrumb which will be attached to future events.\n * Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.\n * @param breadcrumb The breadcrumb to record.\n */\n this.addBreadcrumb = (breadcrumb) => {\n const filteredBreadcrumb = {\n type: breadcrumb.type,\n category: breadcrumb.category,\n message: breadcrumb.message,\n level: breadcrumb.level,\n data: breadcrumb.data\n };\n this.scope.addBreadcrumb(filteredBreadcrumb);\n };\n /**\n * Captures an exception event and sends it to Sentry.\n * @param error The error to capture\n * @param captureContext Optional additional data to attach to the Sentry e vent.\n * @returns the id of the captured Sentry event.\n */\n this.captureException = (error, captureContext) => {\n return this.sentryClient.captureException(\n error,\n {\n captureContext: {\n level: captureContext?.level ?? \"error\",\n tags: captureContext?.tags,\n contexts: captureContext?.contexts\n }\n },\n this.scope\n );\n };\n /**\n * Captures a message event and sends it to Sentry.\n * @param message The message to capture\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\n this.captureMessage = (message, captureContext) => {\n return this.sentryClient.captureMessage(\n message,\n captureContext?.level ?? \"error\",\n {\n captureContext: {\n level: captureContext?.level ?? \"error\",\n tags: captureContext?.tags,\n contexts: captureContext?.contexts\n }\n },\n this.scope\n );\n };\n /**\n * Wraps a function with a span and finishes the span after the function is done. The created span is the active span and will be used as parent by other spans created inside the function, as long as the function is executed while the scope is active.\n * @param spanOptions The options for the span\n * @param callback The function to wrap with a span\n * @returns The return value of the callback\n */\n this.startSpan = (spanOptions, callback) => {\n const filteredSpanOptions = {\n name: spanOptions.name,\n tags: spanOptions.tags\n };\n return this.sentry.startSpan(\n { ...filteredSpanOptions, scope: this.scope },\n callback\n );\n };\n }\n};\n\n// src/factory.ts\nvar unsupportedEnvironmentMessage = (version) => `Sentry SDK version \"${version}\" is not supported. Please make sure to use monitoring SDK only in supported environments.`;\nvar major = (version) => {\n try {\n return parseInt(version.split(\".\")[0], 10);\n } catch {\n console.warn(\"Failed to parse Sentry SDK version\");\n return void 0;\n }\n};\nvar createSentryBrowserClient = ({\n microFrontendEnvironment,\n sentrySDK,\n dsn,\n ...options\n}) => {\n if (!sentrySDK) {\n return createFallbackMonitoringClient(\n \"Unsupported environment - Sentry SDK is not loaded into the environment. Please make sure to use monitoring SDK only in supported environments.\"\n );\n }\n if (!dsn) {\n return createFallbackMonitoringClient(\n \"Missing Sentry DSN in the app's monitoring configuration. Please make sure to set it.\"\n );\n }\n try {\n const sentrySdkMajorVersion = sentrySDK.SDK_VERSION && major(sentrySDK.SDK_VERSION);\n if (microFrontendEnvironment) {\n if (sentrySdkMajorVersion && sentrySdkMajorVersion !== 7) {\n return createFallbackMonitoringClient(\n unsupportedEnvironmentMessage(sentrySDK.SDK_VERSION)\n );\n }\n return new SentryBrowserMicroFrontendClient({\n ...options,\n dsn,\n sentrySDK\n });\n }\n if (sentrySdkMajorVersion && sentrySdkMajorVersion < 7) {\n return createFallbackMonitoringClient(\n unsupportedEnvironmentMessage(sentrySDK.SDK_VERSION)\n );\n }\n return new SentryBrowserClient({ ...options, dsn, sentrySDK });\n } catch (e) {\n return createFallbackMonitoringClient(\n `Failed to initialize monitoring client: ${e.message}`\n );\n }\n};\nexport {\n createSentryBrowserClient\n};\n","// src/monitoring-client.ts\nimport { createFallbackMonitoringClient } from \"@wix/monitoring\";\nimport { createSentryBrowserClient } from \"@wix/monitoring-browser-sentry\";\nvar isSentryConfig = (monitoringConfig) => monitoringConfig?.type === \"SENTRY\";\nvar getMonitoringClientFunction = ({\n sentrySDK,\n sentryTransport,\n monitoringConfig,\n hostContext,\n microFrontendEnvironment\n}) => {\n if (isSentryConfig(monitoringConfig)) {\n const { sentryOptions } = monitoringConfig;\n return () => createSentryBrowserClient({\n microFrontendEnvironment,\n dsn: sentryOptions?.dsn,\n hostContext,\n sentrySDK,\n transport: sentryTransport\n });\n }\n return () => createFallbackMonitoringClient(\n \"Invalid monitoring configuration. Please check the monitoring setup of your application.\"\n );\n};\nexport {\n getMonitoringClientFunction\n};\n"],"mappings":"wCACO,SAASA,EAAiBC,EAAe,CAC5C,OAAOC,EAA0B,CAC7B,OAAQ,OACR,OAASC,GAAS,OAAO,QAAQF,CAAa,EAAE,OAAO,CAACG,EAAK,CAACC,EAAKC,CAAE,KAAO,CACxE,GAAGF,EACH,CAACC,CAAG,EAAGC,EAAGH,CAAI,CAClB,GAAI,CAAC,CAAC,CACV,EAAG,OAAO,KAAKF,CAAa,CAAC,CACjC,CCRA,IAAIM,EAAcC,GAA8BA,GAAU,MAAQA,IAAU,GACxEC,EAAqBC,GAAQC,EAAOD,EAAKH,CAAU,EACvD,SAASI,EAAOC,EAAQC,EAAaL,GAAU,CAAC,CAACA,EAAO,CACtD,GAAI,CAACI,EACH,MAAO,CAAC,EAEV,IAAME,EAAS,CAAC,EAChB,QAAWC,KAAOH,EACZC,EAAUD,EAAOG,CAAG,EAAGA,CAAG,IAC5BD,EAAOC,CAAG,EAAIH,EAAOG,CAAG,GAG5B,OAAOD,CACT,CACA,IAAIE,EAA0BC,GAAY,CACxC,IAAMC,EAAOT,EAAkB,CAC7B,SAAUQ,EAAQ,MAClB,cAAeA,EAAQ,WACvB,iBAAkBA,EAAQ,cAC1B,eAAgBA,EAAQ,YACxB,iBAAkBA,EAAQ,cAC1B,iBAAkBA,EAAQ,cAC1B,SAAUA,EAAQ,QACpB,CAAC,EACKE,EAAWR,EACf,CACE,iBAAkBF,EAAkB,CAClC,GAAGQ,EAAQ,aACb,CAAC,EACD,KAAMR,EAAkB,CACtB,IAAKQ,EAAQ,QACb,GAAIA,EAAQ,aAAe,OAASA,EAAQ,SAAW,MACzD,CAAC,EACD,QAASR,EAAkB,CACzB,GAAIQ,EAAQ,aAAe,UAAYA,EAAQ,SAAW,MAC5D,CAAC,CACH,EACCT,GAAU,CAAC,CAACA,GAAS,OAAO,KAAKA,CAAK,EAAE,OAAS,CACpD,EACA,MAAO,CACL,KAAAU,EACA,SAAAC,CACF,CACF,EAGIC,EAA2B,KAAM,CACnC,YAAYC,EAAS,CACnB,KAAK,QAAUA,EACf,KAAK,iBAAmB,KACtB,QAAQ,MAAM,KAAK,OAAO,EACnB,IAET,KAAK,eAAiB,KACpB,QAAQ,MAAM,KAAK,OAAO,EACnB,IAET,KAAK,UAAY,KACf,QAAQ,MAAM,KAAK,OAAO,EACnB,CAAC,GAEV,KAAK,cAAgB,IAAM,CACzB,QAAQ,MAAM,KAAK,OAAO,CAC5B,CACF,CACF,EACIC,EAAkCD,GAC7B,IAAID,EAAyBC,CAAO,EC/D7C,IAAIE,EAA4B,CAACC,EAAO,CAAE,KAAAC,EAAM,SAAAC,CAAS,IAAM,CACzDD,GACFD,EAAM,QAAQC,CAAI,EAEhBC,GACF,OAAO,QAAQA,CAAQ,EAAE,QACvB,CAAC,CAACC,EAAKC,CAAK,IAAM,OAAOA,EAAU,KAAeJ,EAAM,WAAWG,EAAKC,CAAK,CAC/E,CAEJ,EACIC,EAAwB,CAACL,EAAOM,IAAgB,CAClD,GAAI,CAACA,EACH,OAEF,GAAM,CAAE,KAAAL,EAAM,SAAAC,CAAS,EAAIK,EAAuBD,CAAW,EAC7DP,EAA0BC,EAAO,CAAE,KAAAC,EAAM,SAAAC,CAAS,CAAC,CACrD,EAGIM,EAAmB,CAACC,EAAQT,EAAOU,EAAQC,EAAiB,CAAC,EAAGC,EAAe,OAAQC,IAAa,CACtG,IAAMC,EAAM,IAAIJ,EAAO,IAAID,EAAQT,CAAK,EACxC,OAAOc,EAAI,UAAWC,GAAW,CAC/B,GAAM,CAAE,MAAAC,EAAQJ,EAAc,KAAAX,EAAM,SAAAC,CAAS,EAAIS,EACjD,OAAAI,EAAO,SAASC,CAAK,EACrBjB,EAA0BgB,EAAQ,CAAE,KAAAd,EAAM,SAAAC,CAAS,CAAC,EAC7CW,EAASE,EAAQD,CAAG,CAC7B,CAAC,CACH,EAGIG,EAA8B,KAAM,CACtC,YAAYC,EAAS,CACnB,KAAK,OAASA,EAAQ,UACtB,KAAK,MAAQ,IAAI,KAAK,OAAO,MAC7B,KAAK,aAAe,IAAI,KAAK,OAAO,cAAc,CAChD,IAAKA,EAAQ,IACb,UAAWA,EAAQ,WAAa,KAAK,OAAO,mBAC5C,aAAc,KAAK,OAAO,uBAAuB,CAAC,CAAC,EACnD,YAAa,KAAK,OAAO,mBACzB,iBAAkBA,EAAQ,kBAAoB,EAC9C,MAAOA,EAAQ,OAAS,GACxB,YAAaA,EAAQ,YACrB,QAASA,EAAQ,OACnB,CAAC,EACDb,EAAsB,KAAK,MAAOa,EAAQ,WAAW,EACrD,KAAK,MAAM,UAAU,KAAK,YAAY,EACtC,KAAK,aAAa,KAAK,CACzB,CACF,EAGIC,EAAmC,cAAcF,CAA4B,CAC/E,aAAc,CACZ,MAAM,GAAG,SAAS,EAMlB,KAAK,cAAiBG,GAAe,CACnC,IAAMC,EAAqB,CACzB,KAAMD,EAAW,KACjB,SAAUA,EAAW,SACrB,QAASA,EAAW,QACpB,MAAOA,EAAW,MAClB,KAAMA,EAAW,IACnB,EACA,KAAK,MAAM,cAAcC,CAAkB,CAC7C,EAOA,KAAK,iBAAmB,CAACC,EAAOX,IACvBH,EACL,KAAK,aACL,KAAK,MACL,KAAK,OACLG,EACA,QACCX,GAAUA,EAAM,iBAAiBsB,CAAK,CACzC,EAQF,KAAK,eAAiB,CAACC,EAASZ,IACvBH,EACL,KAAK,aACL,KAAK,MACL,KAAK,OACLG,EACA,OACCX,GAAUA,EAAM,eAAeuB,CAAO,CACzC,EAQF,KAAK,UAAY,CAACC,EAAaX,IAAa,CAC1C,IAAMY,EAAsB,CAC1B,KAAMD,EAAY,KAClB,KAAMA,EAAY,IACpB,EACA,OAAO,KAAK,OAAO,UACjB,CAAE,GAAGC,EAAqB,MAAO,KAAK,KAAM,EAC5CZ,CACF,CACF,CACF,CACF,EAGIa,EAAsB,cAAcT,CAA4B,CAClE,aAAc,CACZ,MAAM,GAAG,SAAS,EAMlB,KAAK,cAAiBG,GAAe,CACnC,IAAMC,EAAqB,CACzB,KAAMD,EAAW,KACjB,SAAUA,EAAW,SACrB,QAASA,EAAW,QACpB,MAAOA,EAAW,MAClB,KAAMA,EAAW,IACnB,EACA,KAAK,MAAM,cAAcC,CAAkB,CAC7C,EAOA,KAAK,iBAAmB,CAACC,EAAOX,IACvB,KAAK,aAAa,iBACvBW,EACA,CACE,eAAgB,CACd,MAAOX,GAAgB,OAAS,QAChC,KAAMA,GAAgB,KACtB,SAAUA,GAAgB,QAC5B,CACF,EACA,KAAK,KACP,EAQF,KAAK,eAAiB,CAACY,EAASZ,IACvB,KAAK,aAAa,eACvBY,EACAZ,GAAgB,OAAS,QACzB,CACE,eAAgB,CACd,MAAOA,GAAgB,OAAS,QAChC,KAAMA,GAAgB,KACtB,SAAUA,GAAgB,QAC5B,CACF,EACA,KAAK,KACP,EAQF,KAAK,UAAY,CAACa,EAAaX,IAAa,CAC1C,IAAMY,EAAsB,CAC1B,KAAMD,EAAY,KAClB,KAAMA,EAAY,IACpB,EACA,OAAO,KAAK,OAAO,UACjB,CAAE,GAAGC,EAAqB,MAAO,KAAK,KAAM,EAC5CZ,CACF,CACF,CACF,CACF,EAGIc,EAAiCC,GAAY,uBAAuBA,CAAO,6FAC3EC,EAASD,GAAY,CACvB,GAAI,CACF,OAAO,SAASA,EAAQ,MAAM,GAAG,EAAE,CAAC,EAAG,EAAE,CAC3C,MAAQ,CACN,QAAQ,KAAK,oCAAoC,EACjD,MACF,CACF,EACIE,EAA4B,CAAC,CAC/B,yBAAAC,EACA,UAAAC,EACA,IAAAC,EACA,GAAGf,CACL,IAAM,CACJ,GAAI,CAACc,EACH,OAAOE,EACL,iJACF,EAEF,GAAI,CAACD,EACH,OAAOC,EACL,uFACF,EAEF,GAAI,CACF,IAAMC,EAAwBH,EAAU,aAAeH,EAAMG,EAAU,WAAW,EAClF,OAAID,EACEI,GAAyBA,IAA0B,EAC9CD,EACLP,EAA8BK,EAAU,WAAW,CACrD,EAEK,IAAIb,EAAiC,CAC1C,GAAGD,EACH,IAAAe,EACA,UAAAD,CACF,CAAC,EAECG,GAAyBA,EAAwB,EAC5CD,EACLP,EAA8BK,EAAU,WAAW,CACrD,EAEK,IAAIN,EAAoB,CAAE,GAAGR,EAAS,IAAAe,EAAK,UAAAD,CAAU,CAAC,CAC/D,OAASI,EAAG,CACV,OAAOF,EACL,2CAA2CE,EAAE,OAAO,EACtD,CACF,CACF,EC1PA,IAAIC,EAAkBC,GAAqBA,GAAkB,OAAS,SAClEC,EAA8B,CAAC,CACjC,UAAAC,EACA,gBAAAC,EACA,iBAAAH,EACA,YAAAI,EACA,yBAAAC,CACF,IAAM,CACJ,GAAIN,EAAeC,CAAgB,EAAG,CACpC,GAAM,CAAE,cAAAM,CAAc,EAAIN,EAC1B,MAAO,IAAMO,EAA0B,CACrC,yBAAAF,EACA,IAAKC,GAAe,IACpB,YAAAF,EACA,UAAAF,EACA,UAAWC,CACb,CAAC,CACH,CACA,MAAO,IAAMK,EACX,0FACF,CACF","names":["createHostModule","hostModuleAPI","contextualizeHostModuleV2","host","acc","key","fn","validValue","value","pickByValidValues","obj","pickBy","object","predicate","result","key","generateTagsAndContext","context","tags","contexts","FallbackMonitoringClient","message","createFallbackMonitoringClient","setTagsAndContextsOnScope","scope","tags","contexts","key","value","setHostContextOnScope","hostContext","generateTagsAndContext","withCaptureScope","client","sentry","captureContext","defaultLevel","callback","hub","_scope","level","AbstractSentryBrowserClient","options","SentryBrowserMicroFrontendClient","breadcrumb","filteredBreadcrumb","error","message","spanOptions","filteredSpanOptions","SentryBrowserClient","unsupportedEnvironmentMessage","version","major","createSentryBrowserClient","microFrontendEnvironment","sentrySDK","dsn","createFallbackMonitoringClient","sentrySdkMajorVersion","e","isSentryConfig","monitoringConfig","getMonitoringClientFunction","sentrySDK","sentryTransport","hostContext","microFrontendEnvironment","sentryOptions","createSentryBrowserClient","createFallbackMonitoringClient"]}
@@ -1,2 +1,2 @@
1
- import{b as x}from"./chunk-BGTZ3RNN.js";import{a as b,b as A,d as H}from"./chunk-7EYXEF6M.js";import{f as v}from"./chunk-SBZEOPXX.js";H();import{wixContext as N}from"@wix/sdk-context";var B=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}`)}},P=e=>a=>async s=>{let d,r=t=>{if(d=e(s)(t),d.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}=d;return{...d,method:B(i),url:o,data:d.data,params:p}};try{let t=await a.request(r);if(d===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(d.transformResponse)?d.transformResponse:[d.transformResponse],o=t.data;return i.forEach(p=>{p&&(o=p(t.data,t.headers))}),o}catch(t){throw typeof t=="object"&&t!==null&&"response"in t&&typeof t.response=="object"&&t.response!==null&&"data"in t.response?t.response.data:t}},M=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var R="__metadata",w="www.wixapis.com";var g=class extends Error{constructor(s,d){super(s);v(this,"message");v(this,"response");this.message=s,this.response=d}async details(){let s=await this.response.json();return D(this.response.status,s?.message,s?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:s})}},D=(e,a,s,d)=>({details:{...!s?.validationError&&{applicationError:{description:a,code:e,data:d}},...s},message:a});var C=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},U=e=>e&&typeof e=="object"&&!Array.isArray(e);var j=e=>e.__type==="host";function S(e,a){return e.create(a)}var G="x-wix-bi-gateway";function W(e,a,s){return{[G]:F({environment:`js-sdk${s?`-${s}`:""}`,"package-name":e.packageName??a?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function F(e){return Object.entries(e).filter(([a,s])=>!!s).map(([a,s])=>`${a}=${s}`).join(",")}function I(e,a,s,d,r,t,i){return x(()=>e({request:async o=>{let p=o({host:t?.HTTPHost||w}),c=p;c.method==="GET"&&c.fallback?.length&&c.params.toString().length>4e3&&(c=p.fallback[0]);let y=`https://${t?.HTTPHost??w}${c.url}`;c.params&&c.params.toString()&&(y+=`?${c.params.toString()}`);try{let u=W(p,a,i),n=await s(y,{method:c.method,...c.data&&{body:JSON.stringify(c.data)},headers:{...u}});if(n.status!==200){let h=null;try{h=await n.json()}catch{}throw V(n.status,h?.message,h?.details,{requestId:n.headers.get("X-Wix-Request-Id"),details:h})}return{data:await n.json(),headers:n.headers,status:n.status,statusText:n.statusText}}catch(u){throw u.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),u}},fetchWithAuth:s,wixAPIFetch:d,getActiveToken:r}))}var V=(e,a,s,d)=>({response:{data:{details:{...!s?.validationError&&{applicationError:{description:a,code:e,data:d}},...s},message:a},status:e}});H();function _(){return{emit(e,...a){for(let s=0,d=this.events[e]||[],r=d.length;s<r;s++)d[s](...a)},events:{},on(e,a){return(this.events[e]||=[]).push(a),()=>{this.events[e]=this.events[e]?.filter(s=>a!==s)}}}}var J=e=>e.__type==="event-definition";function $(e,a,s,d){let r;if(e.isDomainEvent){let i=s,{deletedEvent:o,actionEvent:p,createdEvent:c,updatedEvent:f,...y}=i,u={...d,...y};o?o?.deletedEntity?r={entity:o?.deletedEntity,metadata:u}:r={metadata:u}:p?r={data:p.body,metadata:u}:r={entity:c?.entity??f?.currentEntity,metadata:u}}else r={data:s,metadata:d};let t=e.transformations??(i=>i);return a(t(r))}function L(e){let a=new Map,s=_(),d={...s,getRegisteredEvents:()=>a,async process(r,t={expectedEvents:[]}){let{eventType:i,identity:o,instanceId:p,payload:c}=await this.parseJWT(r),f=[...t.expectedEvents,...Array.from(a.keys()).map(u=>({type:u}))];if(f.length>0&&!f.some(({type:u})=>u===i))throw new Error(`Unexpected event type: ${i}. Expected one of: ${f.map(u=>u.type).join(", ")}`);let y=a.get(i)??[];return await Promise.all(y.map(({eventDefinition:u,handler:n})=>$(u,n,c,{instanceId:p,identity:o}))),{instanceId:p,eventType:i,payload:c,identity:o}},async processRequest(r,t){let i=await r.text();return this.process(i,t)},async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:t,valid:i}=await e.decodeJWT(r);if(!i)throw new Error("JWT is not valid");if(typeof t.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof t.data}`);let o=JSON.parse(t.data),p=o.eventType,c=o.instanceId,f=o.identity?JSON.parse(o.identity):void 0,y=JSON.parse(o.data);return{instanceId:c,eventType:p,payload:y,identity:f}},async parseRequest(r){let t=await r.text();return this.parseJWT(t)},async executeHandlers(r){let t=Array.from(a.keys()).map(o=>({type:o}));if(t.length>0&&!t.some(({type:o})=>o===r.eventType))throw new Error(`Unexpected event type: ${r.eventType}. Expected one of: ${t.map(o=>o.type).join(", ")}`);let i=a.get(r.eventType)??[];await Promise.all(i.map(({eventDefinition:o,handler:p})=>$(o,p,r.payload,{instanceId:r.instanceId,identity:r.identity})))},apps:{AppInstalled:b("AppInstalled")(),AppRemoved:b("AppRemoved")()}};return{initModule(r){return t=>{let i=a.get(r.type)??[];i.push({eventDefinition:r,handler:t}),a.set(r.type,i),s.emit("registered",r)}},client:d}}var O=e=>e.__type==="service-plugin-definition";function q(e){let a=new Map,s=_(),d={...s,getRegisteredServicePlugins:()=>a,async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:t,valid:i}=await e.decodeJWT(r,!0);if(!i)throw new Error("JWT is not valid");if(typeof t.data!="object"||t.data===null||!("metadata"in t.data)||typeof t.data.metadata!="object"||t.data.metadata===null||!("appExtensionType"in t.data.metadata)||typeof t.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return t.data},async process(r){let t=await this.parseJWT(r.body);return this.executeHandler(t,r.url)},async parseRequest(r){let t=await r.text();return this.parseJWT(t)},async processRequest(r){let t=r.url,i=await r.text();try{let o=await this.process({url:t,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,t){let i=r.metadata.appExtensionType.toLowerCase(),o=a.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:c}=o[0],f=c.methods.find(u=>t.endsWith(u.primaryHttpMappingPath));if(!f)throw new Error("Unexpect request: request url did not match any method: "+t);let y=p[f.name];if(!y)throw new Error(`Got request for service plugin method ${f.name} but no implementation was provided. Available methods: ${Object.keys(p).join(", ")}`);return f.transformations.toREST(await y(f.transformations.fromREST(r)))}};return{initModule(r){return t=>{let i=a.get(r.componentType.toLowerCase())??[];i.push({servicePluginDefinition:r,implementation:t}),a.set(r.componentType.toLowerCase(),i),s.emit("registered",r)}},client:d}}function _e(e){let a=e.headers||{Authorization:""},s=e.auth||{getAuthHeaders:n=>Promise.resolve({headers:{}})},d=s.getAuthHeaders.bind(void 0,e.host);s.getAuthHeaders=d;let r=async(n,l)=>{if(typeof n=="string"||n instanceof URL)return fetch(n,{...l,headers:{...l?.headers,...(await d()).headers}});for(let[h,m]of Object.entries((await d()).headers))n.headers.set(h,m);return fetch(n,l)},{client:t,initModule:i}=q(s),{client:o,initModule:p}=L(s),c=async(n,l)=>{let h=await d(),m=C(l);return fetch(n,{...l,headers:{...m,...a,...h?.headers,...l?.headers,...e.host?.essentials?.passThroughHeaders}})},f=(n,l)=>{if(J(n))return p(n);if(O(n))return i(n);if(j(n)&&e.host)return S(n,e.host);if(typeof n=="function"){if("__type"in n&&n.__type===A)return n;let h=e.host?.apiBaseUrl??w;return I(x(()=>M(n))?P(n):n,l??{},c,(m,E)=>{let T=new URL(m,`https://${h}`);return T.host=h,T.protocol="https",c(T.toString(),E)},s.getActiveToken,{HTTPHost:h},e.host?.name)}else return U(n)?Object.fromEntries(Object.entries(n).map(([h,m])=>[h,f(m,n[R])])):n},y=n=>{for(let l in n)a[l]=n[l]};return{...e.modules?f(e.modules):{},auth:s,setHeaders:y,use:f,enableContext(n,l={elevated:!1}){n==="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?N.elevatedClient=this:N.client=this},fetch:(n,l)=>{let h=e.host?.apiBaseUrl??w,m=new URL(n,`https://${h}`);return m.host=h,m.protocol="https",c(m.toString(),l)},fetchWithAuth:r,async graphql(n,l,h={apiVersion:"alpha"}){let m=e?.host?.apiBaseUrl??w,E=await c(`https://${m}/graphql/${h.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:n,variables:l})});if(E.status!==200)throw new g(`GraphQL request failed with status ${E.status}`,E);let{data:T,errors:k}=await E.json();return{data:T??{},errors:k}},webhooks:o,servicePlugins:t}}export{_e as a};
2
- //# sourceMappingURL=chunk-XYIDODIB.js.map
1
+ import{c as x}from"./chunk-42XIZ4MH.js";import{a as b,b as A,d as H}from"./chunk-7EYXEF6M.js";import{f as v}from"./chunk-SBZEOPXX.js";H();import{wixContext as N}from"@wix/sdk-context";var B=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}`)}},P=e=>a=>async s=>{let d,r=t=>{if(d=e(s)(t),d.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}=d;return{...d,method:B(i),url:o,data:d.data,params:p}};try{let t=await a.request(r);if(d===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(d.transformResponse)?d.transformResponse:[d.transformResponse],o=t.data;return i.forEach(p=>{p&&(o=p(t.data,t.headers))}),o}catch(t){throw typeof t=="object"&&t!==null&&"response"in t&&typeof t.response=="object"&&t.response!==null&&"data"in t.response?t.response.data:t}},M=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var R="__metadata",w="www.wixapis.com";var g=class extends Error{constructor(s,d){super(s);v(this,"message");v(this,"response");this.message=s,this.response=d}async details(){let s=await this.response.json();return D(this.response.status,s?.message,s?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:s})}},D=(e,a,s,d)=>({details:{...!s?.validationError&&{applicationError:{description:a,code:e,data:d}},...s},message:a});var C=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},U=e=>e&&typeof e=="object"&&!Array.isArray(e);var j=e=>e.__type==="host";function S(e,a){return e.create(a)}var G="x-wix-bi-gateway";function W(e,a,s){return{[G]:F({environment:`js-sdk${s?`-${s}`:""}`,"package-name":e.packageName??a?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function F(e){return Object.entries(e).filter(([a,s])=>!!s).map(([a,s])=>`${a}=${s}`).join(",")}function I(e,a,s,d,r,t,i){return x(()=>e({request:async o=>{let p=o({host:t?.HTTPHost||w}),c=p;c.method==="GET"&&c.fallback?.length&&c.params.toString().length>4e3&&(c=p.fallback[0]);let y=`https://${t?.HTTPHost??w}${c.url}`;c.params&&c.params.toString()&&(y+=`?${c.params.toString()}`);try{let u=W(p,a,i),n=await s(y,{method:c.method,...c.data&&{body:JSON.stringify(c.data)},headers:{...u}});if(n.status!==200){let h=null;try{h=await n.json()}catch{}throw V(n.status,h?.message,h?.details,{requestId:n.headers.get("X-Wix-Request-Id"),details:h})}return{data:await n.json(),headers:n.headers,status:n.status,statusText:n.statusText}}catch(u){throw u.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),u}},fetchWithAuth:s,wixAPIFetch:d,getActiveToken:r}))}var V=(e,a,s,d)=>({response:{data:{details:{...!s?.validationError&&{applicationError:{description:a,code:e,data:d}},...s},message:a},status:e}});H();function _(){return{emit(e,...a){for(let s=0,d=this.events[e]||[],r=d.length;s<r;s++)d[s](...a)},events:{},on(e,a){return(this.events[e]||=[]).push(a),()=>{this.events[e]=this.events[e]?.filter(s=>a!==s)}}}}var J=e=>e.__type==="event-definition";function $(e,a,s,d){let r;if(e.isDomainEvent){let i=s,{deletedEvent:o,actionEvent:p,createdEvent:c,updatedEvent:f,...y}=i,u={...d,...y};o?o?.deletedEntity?r={entity:o?.deletedEntity,metadata:u}:r={metadata:u}:p?r={data:p.body,metadata:u}:r={entity:c?.entity??f?.currentEntity,metadata:u}}else r={data:s,metadata:d};let t=e.transformations??(i=>i);return a(t(r))}function L(e){let a=new Map,s=_(),d={...s,getRegisteredEvents:()=>a,async process(r,t={expectedEvents:[]}){let{eventType:i,identity:o,instanceId:p,payload:c}=await this.parseJWT(r),f=[...t.expectedEvents,...Array.from(a.keys()).map(u=>({type:u}))];if(f.length>0&&!f.some(({type:u})=>u===i))throw new Error(`Unexpected event type: ${i}. Expected one of: ${f.map(u=>u.type).join(", ")}`);let y=a.get(i)??[];return await Promise.all(y.map(({eventDefinition:u,handler:n})=>$(u,n,c,{instanceId:p,identity:o}))),{instanceId:p,eventType:i,payload:c,identity:o}},async processRequest(r,t){let i=await r.text();return this.process(i,t)},async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:t,valid:i}=await e.decodeJWT(r);if(!i)throw new Error("JWT is not valid");if(typeof t.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof t.data}`);let o=JSON.parse(t.data),p=o.eventType,c=o.instanceId,f=o.identity?JSON.parse(o.identity):void 0,y=JSON.parse(o.data);return{instanceId:c,eventType:p,payload:y,identity:f}},async parseRequest(r){let t=await r.text();return this.parseJWT(t)},async executeHandlers(r){let t=Array.from(a.keys()).map(o=>({type:o}));if(t.length>0&&!t.some(({type:o})=>o===r.eventType))throw new Error(`Unexpected event type: ${r.eventType}. Expected one of: ${t.map(o=>o.type).join(", ")}`);let i=a.get(r.eventType)??[];await Promise.all(i.map(({eventDefinition:o,handler:p})=>$(o,p,r.payload,{instanceId:r.instanceId,identity:r.identity})))},apps:{AppInstalled:b("AppInstalled")(),AppRemoved:b("AppRemoved")()}};return{initModule(r){return t=>{let i=a.get(r.type)??[];i.push({eventDefinition:r,handler:t}),a.set(r.type,i),s.emit("registered",r)}},client:d}}var O=e=>e.__type==="service-plugin-definition";function q(e){let a=new Map,s=_(),d={...s,getRegisteredServicePlugins:()=>a,async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:t,valid:i}=await e.decodeJWT(r,!0);if(!i)throw new Error("JWT is not valid");if(typeof t.data!="object"||t.data===null||!("metadata"in t.data)||typeof t.data.metadata!="object"||t.data.metadata===null||!("appExtensionType"in t.data.metadata)||typeof t.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return t.data},async process(r){let t=await this.parseJWT(r.body);return this.executeHandler(t,r.url)},async parseRequest(r){let t=await r.text();return this.parseJWT(t)},async processRequest(r){let t=r.url,i=await r.text();try{let o=await this.process({url:t,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,t){let i=r.metadata.appExtensionType.toLowerCase(),o=a.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:c}=o[0],f=c.methods.find(u=>t.endsWith(u.primaryHttpMappingPath));if(!f)throw new Error("Unexpect request: request url did not match any method: "+t);let y=p[f.name];if(!y)throw new Error(`Got request for service plugin method ${f.name} but no implementation was provided. Available methods: ${Object.keys(p).join(", ")}`);return f.transformations.toREST(await y(f.transformations.fromREST(r)))}};return{initModule(r){return t=>{let i=a.get(r.componentType.toLowerCase())??[];i.push({servicePluginDefinition:r,implementation:t}),a.set(r.componentType.toLowerCase(),i),s.emit("registered",r)}},client:d}}function _e(e){let a=e.headers||{Authorization:""},s=e.auth||{getAuthHeaders:n=>Promise.resolve({headers:{}})},d=s.getAuthHeaders.bind(void 0,e.host);s.getAuthHeaders=d;let r=async(n,l)=>{if(typeof n=="string"||n instanceof URL)return fetch(n,{...l,headers:{...l?.headers,...(await d()).headers}});for(let[h,m]of Object.entries((await d()).headers))n.headers.set(h,m);return fetch(n,l)},{client:t,initModule:i}=q(s),{client:o,initModule:p}=L(s),c=async(n,l)=>{let h=await d(),m=C(l);return fetch(n,{...l,headers:{...m,...a,...h?.headers,...l?.headers,...e.host?.essentials?.passThroughHeaders}})},f=(n,l)=>{if(J(n))return p(n);if(O(n))return i(n);if(j(n)&&e.host)return S(n,e.host);if(typeof n=="function"){if("__type"in n&&n.__type===A)return n;let h=e.host?.apiBaseUrl??w;return I(x(()=>M(n))?P(n):n,l??{},c,(m,E)=>{let T=new URL(m,`https://${h}`);return T.host=h,T.protocol="https",c(T.toString(),E)},s.getActiveToken,{HTTPHost:h},e.host?.name)}else return U(n)?Object.fromEntries(Object.entries(n).map(([h,m])=>[h,f(m,n[R])])):n},y=n=>{for(let l in n)a[l]=n[l]};return{...e.modules?f(e.modules):{},auth:s,setHeaders:y,use:f,enableContext(n,l={elevated:!1}){n==="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?N.elevatedClient=this:N.client=this},fetch:(n,l)=>{let h=e.host?.apiBaseUrl??w,m=new URL(n,`https://${h}`);return m.host=h,m.protocol="https",c(m.toString(),l)},fetchWithAuth:r,async graphql(n,l,h={apiVersion:"alpha"}){let m=e?.host?.apiBaseUrl??w,E=await c(`https://${m}/graphql/${h.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:n,variables:l})});if(E.status!==200)throw new g(`GraphQL request failed with status ${E.status}`,E);let{data:T,errors:k}=await E.json();return{data:T??{},errors:k}},webhooks:o,servicePlugins:t}}export{_e as a};
2
+ //# sourceMappingURL=chunk-EERHWVVD.js.map
@@ -1,2 +1,2 @@
1
- import{a as K,b as N}from"./chunk-RH4X5G4O.js";import{a as F}from"./chunk-XYIDODIB.js";import"./chunk-BGTZ3RNN.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function C(){return C=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},C.apply(null,arguments)}import Oe,{useEffect as He,useState as pe}from"react";function w(e){"@babel/helpers - typeof";return w=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},w(e)}function q(e,t){if(w(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(w(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function J(e){var t=q(e,"string");return w(t)=="symbol"?t:t+""}function G(e,t,n){return(t=J(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=class extends Error{constructor(t){let{message:n,code:r}=t;super(n),G(this,"code",void 0),this.message=n,this.code=r}};var Q=()=>{let e=u=>{let{channel:o}=u;return function(){let f=o.showToast(...arguments);return{remove:()=>Promise.resolve(f).then(h=>h.remove())}}},t=u=>{let{channel:o}=u;return function(){let f=o.observeState(...arguments);return{disconnect:()=>Promise.resolve(f).then(h=>h.disconnect())}}};return{showToast:e,observeState:t,navigate:u=>{let{channel:o}=u;return function(){return o.navigate(...arguments)}},navigateBack:u=>{let{channel:o}=u;return()=>o.navigateBack()},openModal:u=>{let{channel:o}=u;return(f,g)=>{let[h,A]=typeof f=="string"?[f,g]:[f.modalId,f.params],E=o.openModal(h,A);return{modalClosed:Promise.resolve(E).then(y=>y.modalClosed)}}},closeModal:u=>{let{channel:o}=u;return f=>{if(f===void 0)return o.closeModal();let g=JSON.parse(JSON.stringify(f));return o.closeModal(g)}},getAccessToken:u=>{let{channel:o}=u;return()=>o.getAccessToken()},getPageUrl:u=>{let{channel:o}=u;return function(){return o.getPageUrl(...arguments)}},openMediaManager:u=>{let{channel:o}=u;return function(){return o.openMediaManager(...arguments)}},addSitePlugin:u=>{let{channel:o}=u;return(f,g)=>{let h="802c76e4-b381-4bb3-9152-96acabbf3194",A=g?.placement||{},E=o.openModal(h,{...A,pluginId:f,action:"populate"});return Promise.resolve(E).then(y=>y.modalClosed).then(y=>{if(y?.type===void 0)throw new S({message:"Aborted by user",code:3006});if(y?.type==="ERROR")throw new S(y.data.error)})}},onBeforeUnload:u=>{let{channel:o}=u;return function(){return o.onBeforeUnload(...arguments)}},setPageTitle:u=>{let{channel:o}=u;return f=>o.setPageTitle(f)},getLanguage:u=>{let o=null;return async()=>{var f;if(o)return o;let g=null;return o=await new Promise(h=>{g=t(u)((A,E)=>{h(E.language)})}),(f=g)==null||f.disconnect(),o}},requestFeedback:u=>{let{channel:o}=u;return function(){return o.requestFeedback(...arguments)}},onLayerStateChange:u=>{let{channel:o}=u;return function(){let f=o.onLayerStateChange(...arguments);return{remove:()=>Promise.resolve(f).then(h=>h.remove())}}},installApp:u=>{let{channel:o}=u;return o.installApp},getWidget:u=>{let{channel:o}=u;return function(){if("getWidget"in o)return o.getWidget(...arguments);throw new Error("Unsupported")}},getDashboardPlugins:u=>{let{channel:o}=u;return function(){if("getDashboardPlugins"in o)return o.getDashboardPlugins(...arguments);throw new Error("Unsupported")}},getDashboardMenuPlugins:u=>{let{channel:o}=u;return function(){if("getDashboardMenuPlugins"in o)return o.getDashboardMenuPlugins(...arguments);throw new Error("Unsupported")}}}};var $=e=>{let{createHost:t}=e,n=Q();return{...K(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var Y=Symbol("Comlink.proxy"),he=Symbol("Comlink.endpoint"),D=Symbol("Comlink.releaseProxy"),L=Symbol("Comlink.thrown"),Z=e=>typeof e=="object"&&e!==null||typeof e=="function",ye={canHandle:e=>Z(e)&&e[Y],serialize(e){let{port1:t,port2:n}=new MessageChannel;return _(e,t),[n,[n]]},deserialize(e){return e.start(),B(e)}},be={canHandle:e=>Z(e)&&L 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}},ee=new Map([["proxy",ye],["throw",be]]);function _(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:s,type:i,path:a}=Object.assign({path:[]},r.data),c=(r.data.argumentList||[]).map(P),l;try{let d=a.slice(0,-1).reduce((p,b)=>p[b],e),m=a.reduce((p,b)=>p[b],e);switch(i){case 0:l=m;break;case 1:d[a.slice(-1)[0]]=P(r.data.value),l=!0;break;case 2:l=m.apply(d,c);break;case 3:{let p=new m(...c);l=k(p)}break;case 4:{let{port1:p,port2:b}=new MessageChannel;_(e,b),l=xe(p,[p])}break;case 5:l=void 0;break}}catch(d){l={value:d,[L]:0}}Promise.resolve(l).catch(d=>({value:d,[L]:0})).then(d=>{let[m,p]=W(d);t.postMessage(Object.assign(Object.assign({},m),{id:s}),p),i===5&&(t.removeEventListener("message",n),te(t))})}),t.start&&t.start()}function we(e){return e.constructor.name==="MessagePort"}function te(e){we(e)&&e.close()}function B(e,t){return R(e,[],t)}function U(e){if(e)throw new Error("Proxy has been released and is not useable")}function R(e,t=[],n=function(){}){let r=!1,s=new Proxy(n,{get(i,a){if(U(r),a===D)return()=>v(e,{type:5,path:t.map(c=>c.toString())}).then(()=>{te(e),r=!0});if(a==="then"){if(t.length===0)return{then:()=>s};let c=v(e,{type:0,path:t.map(l=>l.toString())}).then(P);return c.then.bind(c)}return R(e,[...t,a])},set(i,a,c){U(r);let[l,d]=W(c);return v(e,{type:1,path:[...t,a].map(m=>m.toString()),value:l},d).then(P)},apply(i,a,c){U(r);let l=t[t.length-1];if(l===he)return v(e,{type:4}).then(P);if(l==="bind")return R(e,t.slice(0,-1));let[d,m]=X(c);return v(e,{type:2,path:t.map(p=>p.toString()),argumentList:d},m).then(P)},construct(i,a){U(r);let[c,l]=X(a);return v(e,{type:3,path:t.map(d=>d.toString()),argumentList:c},l).then(P)}});return s}function Pe(e){return Array.prototype.concat.apply([],e)}function X(e){let t=e.map(W);return[t.map(n=>n[0]),Pe(t.map(n=>n[1]))]}var ne=new WeakMap;function xe(e,t){return ne.set(e,t),e}function k(e){return Object.assign(e,{[Y]:!0})}function W(e){for(let[t,n]of ee)if(n.canHandle(e)){let[r,s]=n.serialize(e);return[{type:3,name:t,value:r},s]}return[{type:0,value:e},ne.get(e)||[]]}function P(e){switch(e.type){case 3:return ee.get(e.name).deserialize(e.value);case 0:return e.value}}function v(e,t,n){return new Promise(r=>{let s=ve();e.addEventListener("message",function i(a){!a.data||!a.data.id||a.data.id!==s||(e.removeEventListener("message",i),r(a.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),n)})}function ve(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var T="__proxyCallbackId__wixSDK__",I="__proxyPromiseId__wixSDK__",oe=e=>Ee(e,t=>async function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];let[i,a]=j(r),c=await t(k(i),a);return se(c)});var Me=async e=>{let[t,n]=j(await e);return k({proxies:t,clonables:n})},se=async e=>H(e?.proxies,await e?.clonables),j=e=>{let t=(s,i)=>{if(ae(i)){let a=re();return s.promises[a]=i,{[I]:a}}if(Se(i)){let a=re();return s.callbacks[a]=(c,l)=>{let d=H(c,l),m=i(...d);return Me(m)},{[T]:a}}return Array.isArray(i)?i.map(a=>t(s,a)):O(i)?ie(i,a=>t(s,a)):i},n={promises:{},callbacks:{}},r=t(n,e);return[n,r]},H=(e,t)=>{if(Array.isArray(t))return t.map(n=>H(e,n));if(O(t)&&t.hasOwnProperty(I)){let n=t[I];return e.promises[n]}if(O(t)&&t.hasOwnProperty(T)){let n=t[T];return async function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];let[a,c]=j(s),l=await e.callbacks[n](k(a),c);return se(l)}}return O(t)?ie(t,n=>H(e,n)):t},Ee=(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}`)}}}),ae=e=>e instanceof Promise,O=e=>e&&typeof e=="object"&&!ae(e),Se=e=>typeof e=="function",ie=(e,t)=>{let n=r=>{let[s,i]=r;return[s,t(i)]};return Object.fromEntries(Object.entries(e).map(n))},re=(()=>{let e=0;return()=>++e})();var ke="wix-sdk-bo-hello-handshake",ce=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:s}=new MessageChannel;t({code:ke,version:"1.0.0",port:s},n,[s]);let c=oe(B(r));return{channel:c,close:()=>c[D]()}};var ue=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var Ae=["https://manage.wix.com","https://manage.editorx.com"],Ce=new Set(Ae),le=e=>Ce.has(e);var de=e=>{let t=new EventTarget,n=typeof window>"u",r=c=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(c.preventDefault(),c.returnValue=!0)},s=e.onBeforeUnload(r),i=()=>{n||window.removeEventListener("beforeunload",r),s.then(c=>{let{remove:l}=c;return l()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",i)),{onBeforeUnload:c=>(t.addEventListener("beforeunload",c),{remove:()=>{t.removeEventListener("beforeunload",c)}}),clearBeforeUnloadHandler:i}};function Ue(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 fe(e){return e.has("essentials")?Ue(e.get("essentials")):void 0}var me=function(e){e===void 0&&(e={});let t=new URLSearchParams(typeof window<"u"?window.location.search:"?"),n=e.origin||t.get("origin")||"",r=e.postMessage||window.parent.postMessage.bind(window.parent);if(!le(n))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:i}=ce({postMessage:r,origin:n}),a=[i];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let x=e.autoHeightElement||document.documentElement,M=ue(s,x);a.push(()=>M())}let{onBeforeUnload:c,clearBeforeUnloadHandler:l}=de(s);a.push(l);let d=new Proxy(s,{get(x,M,V){return M==="onBeforeUnload"?c:Reflect.get(x,M,V)}}),{monitoring:m,...p}=fe(t)||{},b=N({hostContext:m?.context,monitoringConfig:m?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{channel:d,close:()=>a.forEach(x=>x()),getMonitoringClient:b,essentials:p}};var z=$({createHost:me});var ge=(e,t)=>{let[n,r]=pe(()=>e());return t(n)&&r(e()),n},Le=e=>t=>{let{host:n,compProps:r}=Re(t);return ge(()=>(F({auth:z.auth(),host:n}).enableContext("module"),n),s=>s!==n),r?Oe.createElement(e,C({host:n},r)):null},Re=e=>{let{host:t,...n}=e,{host:r,hostType:s}=ge(()=>t?{host:t,hostType:"local"}:{host:z.host(),hostType:"remote"},c=>!!t&&t!==c.host),[i,a]=pe(void 0);return He(()=>{if(s==="local")return;let c=r.channel.observeState(d=>{a(d||{})}),l=async()=>{(await c).disconnect(),r.close()};return()=>{l()}},[r,s]),s==="local"?{host:r,compProps:n}:{host:r,compProps:i?{...i,...n}:void 0}};export{Le as withContextualWixClient};
1
+ import{a as K,b as N}from"./chunk-CR7DIEFQ.js";import{a as F}from"./chunk-EERHWVVD.js";import"./chunk-42XIZ4MH.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function C(){return C=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},C.apply(null,arguments)}import Oe,{useEffect as He,useState as pe}from"react";function w(e){"@babel/helpers - typeof";return w=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},w(e)}function q(e,t){if(w(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(w(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function J(e){var t=q(e,"string");return w(t)=="symbol"?t:t+""}function G(e,t,n){return(t=J(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=class extends Error{constructor(t){let{message:n,code:r}=t;super(n),G(this,"code",void 0),this.message=n,this.code=r}};var Q=()=>{let e=u=>{let{channel:o}=u;return function(){let f=o.showToast(...arguments);return{remove:()=>Promise.resolve(f).then(h=>h.remove())}}},t=u=>{let{channel:o}=u;return function(){let f=o.observeState(...arguments);return{disconnect:()=>Promise.resolve(f).then(h=>h.disconnect())}}};return{showToast:e,observeState:t,navigate:u=>{let{channel:o}=u;return function(){return o.navigate(...arguments)}},navigateBack:u=>{let{channel:o}=u;return()=>o.navigateBack()},openModal:u=>{let{channel:o}=u;return(f,g)=>{let[h,A]=typeof f=="string"?[f,g]:[f.modalId,f.params],E=o.openModal(h,A);return{modalClosed:Promise.resolve(E).then(y=>y.modalClosed)}}},closeModal:u=>{let{channel:o}=u;return f=>{if(f===void 0)return o.closeModal();let g=JSON.parse(JSON.stringify(f));return o.closeModal(g)}},getAccessToken:u=>{let{channel:o}=u;return()=>o.getAccessToken()},getPageUrl:u=>{let{channel:o}=u;return function(){return o.getPageUrl(...arguments)}},openMediaManager:u=>{let{channel:o}=u;return function(){return o.openMediaManager(...arguments)}},addSitePlugin:u=>{let{channel:o}=u;return(f,g)=>{let h="802c76e4-b381-4bb3-9152-96acabbf3194",A=g?.placement||{},E=o.openModal(h,{...A,pluginId:f,action:"populate"});return Promise.resolve(E).then(y=>y.modalClosed).then(y=>{if(y?.type===void 0)throw new S({message:"Aborted by user",code:3006});if(y?.type==="ERROR")throw new S(y.data.error)})}},onBeforeUnload:u=>{let{channel:o}=u;return function(){return o.onBeforeUnload(...arguments)}},setPageTitle:u=>{let{channel:o}=u;return f=>o.setPageTitle(f)},getLanguage:u=>{let o=null;return async()=>{var f;if(o)return o;let g=null;return o=await new Promise(h=>{g=t(u)((A,E)=>{h(E.language)})}),(f=g)==null||f.disconnect(),o}},requestFeedback:u=>{let{channel:o}=u;return function(){return o.requestFeedback(...arguments)}},onLayerStateChange:u=>{let{channel:o}=u;return function(){let f=o.onLayerStateChange(...arguments);return{remove:()=>Promise.resolve(f).then(h=>h.remove())}}},installApp:u=>{let{channel:o}=u;return o.installApp},getWidget:u=>{let{channel:o}=u;return function(){if("getWidget"in o)return o.getWidget(...arguments);throw new Error("Unsupported")}},getDashboardPlugins:u=>{let{channel:o}=u;return function(){if("getDashboardPlugins"in o)return o.getDashboardPlugins(...arguments);throw new Error("Unsupported")}},getDashboardMenuPlugins:u=>{let{channel:o}=u;return function(){if("getDashboardMenuPlugins"in o)return o.getDashboardMenuPlugins(...arguments);throw new Error("Unsupported")}}}};var $=e=>{let{createHost:t}=e,n=Q();return{...K(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var Y=Symbol("Comlink.proxy"),he=Symbol("Comlink.endpoint"),D=Symbol("Comlink.releaseProxy"),L=Symbol("Comlink.thrown"),Z=e=>typeof e=="object"&&e!==null||typeof e=="function",ye={canHandle:e=>Z(e)&&e[Y],serialize(e){let{port1:t,port2:n}=new MessageChannel;return _(e,t),[n,[n]]},deserialize(e){return e.start(),B(e)}},be={canHandle:e=>Z(e)&&L 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}},ee=new Map([["proxy",ye],["throw",be]]);function _(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:s,type:i,path:a}=Object.assign({path:[]},r.data),c=(r.data.argumentList||[]).map(P),l;try{let d=a.slice(0,-1).reduce((p,b)=>p[b],e),m=a.reduce((p,b)=>p[b],e);switch(i){case 0:l=m;break;case 1:d[a.slice(-1)[0]]=P(r.data.value),l=!0;break;case 2:l=m.apply(d,c);break;case 3:{let p=new m(...c);l=k(p)}break;case 4:{let{port1:p,port2:b}=new MessageChannel;_(e,b),l=xe(p,[p])}break;case 5:l=void 0;break}}catch(d){l={value:d,[L]:0}}Promise.resolve(l).catch(d=>({value:d,[L]:0})).then(d=>{let[m,p]=W(d);t.postMessage(Object.assign(Object.assign({},m),{id:s}),p),i===5&&(t.removeEventListener("message",n),te(t))})}),t.start&&t.start()}function we(e){return e.constructor.name==="MessagePort"}function te(e){we(e)&&e.close()}function B(e,t){return R(e,[],t)}function U(e){if(e)throw new Error("Proxy has been released and is not useable")}function R(e,t=[],n=function(){}){let r=!1,s=new Proxy(n,{get(i,a){if(U(r),a===D)return()=>v(e,{type:5,path:t.map(c=>c.toString())}).then(()=>{te(e),r=!0});if(a==="then"){if(t.length===0)return{then:()=>s};let c=v(e,{type:0,path:t.map(l=>l.toString())}).then(P);return c.then.bind(c)}return R(e,[...t,a])},set(i,a,c){U(r);let[l,d]=W(c);return v(e,{type:1,path:[...t,a].map(m=>m.toString()),value:l},d).then(P)},apply(i,a,c){U(r);let l=t[t.length-1];if(l===he)return v(e,{type:4}).then(P);if(l==="bind")return R(e,t.slice(0,-1));let[d,m]=X(c);return v(e,{type:2,path:t.map(p=>p.toString()),argumentList:d},m).then(P)},construct(i,a){U(r);let[c,l]=X(a);return v(e,{type:3,path:t.map(d=>d.toString()),argumentList:c},l).then(P)}});return s}function Pe(e){return Array.prototype.concat.apply([],e)}function X(e){let t=e.map(W);return[t.map(n=>n[0]),Pe(t.map(n=>n[1]))]}var ne=new WeakMap;function xe(e,t){return ne.set(e,t),e}function k(e){return Object.assign(e,{[Y]:!0})}function W(e){for(let[t,n]of ee)if(n.canHandle(e)){let[r,s]=n.serialize(e);return[{type:3,name:t,value:r},s]}return[{type:0,value:e},ne.get(e)||[]]}function P(e){switch(e.type){case 3:return ee.get(e.name).deserialize(e.value);case 0:return e.value}}function v(e,t,n){return new Promise(r=>{let s=ve();e.addEventListener("message",function i(a){!a.data||!a.data.id||a.data.id!==s||(e.removeEventListener("message",i),r(a.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),n)})}function ve(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var T="__proxyCallbackId__wixSDK__",I="__proxyPromiseId__wixSDK__",oe=e=>Ee(e,t=>async function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];let[i,a]=j(r),c=await t(k(i),a);return se(c)});var Me=async e=>{let[t,n]=j(await e);return k({proxies:t,clonables:n})},se=async e=>H(e?.proxies,await e?.clonables),j=e=>{let t=(s,i)=>{if(ae(i)){let a=re();return s.promises[a]=i,{[I]:a}}if(Se(i)){let a=re();return s.callbacks[a]=(c,l)=>{let d=H(c,l),m=i(...d);return Me(m)},{[T]:a}}return Array.isArray(i)?i.map(a=>t(s,a)):O(i)?ie(i,a=>t(s,a)):i},n={promises:{},callbacks:{}},r=t(n,e);return[n,r]},H=(e,t)=>{if(Array.isArray(t))return t.map(n=>H(e,n));if(O(t)&&t.hasOwnProperty(I)){let n=t[I];return e.promises[n]}if(O(t)&&t.hasOwnProperty(T)){let n=t[T];return async function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];let[a,c]=j(s),l=await e.callbacks[n](k(a),c);return se(l)}}return O(t)?ie(t,n=>H(e,n)):t},Ee=(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}`)}}}),ae=e=>e instanceof Promise,O=e=>e&&typeof e=="object"&&!ae(e),Se=e=>typeof e=="function",ie=(e,t)=>{let n=r=>{let[s,i]=r;return[s,t(i)]};return Object.fromEntries(Object.entries(e).map(n))},re=(()=>{let e=0;return()=>++e})();var ke="wix-sdk-bo-hello-handshake",ce=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:s}=new MessageChannel;t({code:ke,version:"1.0.0",port:s},n,[s]);let c=oe(B(r));return{channel:c,close:()=>c[D]()}};var ue=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var Ae=["https://manage.wix.com","https://manage.editorx.com"],Ce=new Set(Ae),le=e=>Ce.has(e);var de=e=>{let t=new EventTarget,n=typeof window>"u",r=c=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(c.preventDefault(),c.returnValue=!0)},s=e.onBeforeUnload(r),i=()=>{n||window.removeEventListener("beforeunload",r),s.then(c=>{let{remove:l}=c;return l()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",i)),{onBeforeUnload:c=>(t.addEventListener("beforeunload",c),{remove:()=>{t.removeEventListener("beforeunload",c)}}),clearBeforeUnloadHandler:i}};function Ue(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 fe(e){return e.has("essentials")?Ue(e.get("essentials")):void 0}var me=function(e){e===void 0&&(e={});let t=new URLSearchParams(typeof window<"u"?window.location.search:"?"),n=e.origin||t.get("origin")||"",r=e.postMessage||window.parent.postMessage.bind(window.parent);if(!le(n))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:i}=ce({postMessage:r,origin:n}),a=[i];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let x=e.autoHeightElement||document.documentElement,M=ue(s,x);a.push(()=>M())}let{onBeforeUnload:c,clearBeforeUnloadHandler:l}=de(s);a.push(l);let d=new Proxy(s,{get(x,M,V){return M==="onBeforeUnload"?c:Reflect.get(x,M,V)}}),{monitoring:m,...p}=fe(t)||{},b=N({hostContext:m?.context,monitoringConfig:m?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{channel:d,close:()=>a.forEach(x=>x()),getMonitoringClient:b,essentials:p}};var z=$({createHost:me});var ge=(e,t)=>{let[n,r]=pe(()=>e());return t(n)&&r(e()),n},Le=e=>t=>{let{host:n,compProps:r}=Re(t);return ge(()=>(F({auth:z.auth(),host:n}).enableContext("module"),n),s=>s!==n),r?Oe.createElement(e,C({host:n},r)):null},Re=e=>{let{host:t,...n}=e,{host:r,hostType:s}=ge(()=>t?{host:t,hostType:"local"}:{host:z.host(),hostType:"remote"},c=>!!t&&t!==c.host),[i,a]=pe(void 0);return He(()=>{if(s==="local")return;let c=r.channel.observeState(d=>{a(d||{})}),l=async()=>{(await c).disconnect(),r.close()};return()=>{l()}},[r,s]),s==="local"?{host:r,compProps:n}:{host:r,compProps:i?{...i,...n}:void 0}};export{Le as withContextualWixClient};
2
2
  //# sourceMappingURL=dashboard.js.map
@@ -1,4 +1,4 @@
1
- import{a as Ie,b as ge}from"./chunk-RH4X5G4O.js";import{a as Pe}from"./chunk-XYIDODIB.js";import"./chunk-BGTZ3RNN.js";import{c as Je,d as He}from"./chunk-7EYXEF6M.js";import{b as me,d as ye,e as Ye,f as p,g as a,h as l,i as w,j as d}from"./chunk-SBZEOPXX.js";var Ee=me(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.EventType=void 0;var we;(function(n){n.removeAppCompleted="removeAppCompleted",n.componentSelectionChanged="componentSelectionChanged",n.appInstalled="appInstalled",n.appUpdateCompleted="appUpdateCompleted"})(we||(ot.EventType=we={}))});var Mt=me(m=>{"use strict";var Xe=m&&m.__createBinding||(Object.create?function(n,t,e,i){i===void 0&&(i=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(n,i,s)}:function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]}),Qe=m&&m.__setModuleDefault||(Object.create?function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}:function(n,t){n.default=t}),Ze=m&&m.__importStar||function(){var n=function(t){return n=Object.getOwnPropertyNames||function(e){var i=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[i.length]=s);return i},n(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var i=n(t),s=0;s<i.length;s++)i[s]!=="default"&&Xe(e,t,i[s]);return Qe(e,t),e}}();Object.defineProperty(m,"__esModule",{value:!0});m.EventType=m.WixSDKTypes=void 0;var tn=Ze((He(),Ye(Je)));m.WixSDKTypes=tn;var en=Ee();Object.defineProperty(m,"EventType",{enumerable:!0,get:function(){return en.EventType}})});var q=ye(Mt(),1);var N=class N{constructor(){p(this,"uid",0);p(this,"callbacks",new Map);p(this,"inTransaction",!1);p(this,"isSilent",!1);p(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 i=e();if(i&&i.hasOwnProperty("then"))try{return this.notifyWithStep(t,N.EventSteps.Start),i=await i,this.notifyWithStep(t,N.EventSteps.End),i}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},N.EventSteps.Error),s}else return this.notify(t),i}};p(N,"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}),p(N,"EventSteps",{Start:"start",End:"end",Error:"error"});var Dt=N,ct=(n=>(n.WorkerSpawn="WorkerSpawn",n.HostEvent="HostEvent",n.ApplicationsSpecsReceived="ApplicationsSpecsReceived",n.InitApplicationApi="InitApplicationApi",n.RunApplication="RunApplication",n.getApplicationApi="getApplicationApi",n.IframeInit="IframeInit",n))(ct||{}),kt=(n=>(n.EditorReady="EditorReady",n))(kt||{});var E=(n=>(n.ApplicationInit="ApplicationInit",n.ApplicationExecute="ApplicationExecute",n.ApplicationRemoved="ApplicationRemoved",n.ApplicationLoad="ApplicationLoad",n.ApplicationApiInit="ApplicationApiInit",n.CustomEvent="CustomEvent",n.HostEvent="HostEvent",n.EditorReady="EditorReady",n))(E||{}),St=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:v.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:v.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:v.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:v.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},v=class extends Dt{constructor(){super(...arguments);p(this,"factories",new St)}},at=class at{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ct.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);at.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};p(at,"allowedEvents",[q.EventType.componentSelectionChanged,q.EventType.appInstalled,q.EventType.appUpdateCompleted,q.EventType.removeAppCompleted]);var ve=at;var y=class n extends Error{constructor(e,i,s){let r=e?` ${e}`:"",o=`[${s}]#${i}`;super(`${o}.${r}`);p(this,"state",{});p(this,"displayName");p(this,"prefix");p(this,"errorMessage");p(this,"parent");p(this,"messages",[]);p(this,"code");this.displayName=o,this.errorMessage=e,this.prefix=s,this.code=i,this.name=o,Object.defineProperty(this,"message",{get:()=>this.getDisplayMessage()}),Error.captureStackTrace&&Error.captureStackTrace(this,n)}get parentError(){let e=this.parent;if(!e)return null;if(this.parent instanceof n)return this.parent;let i=e.name??"[Unknown Error]";return{getBreadcrumbs(){return[i]},getMessage(){return[i,e.message??"unknown error message"].join(`
1
+ import{a as Ie,b as ge}from"./chunk-CR7DIEFQ.js";import{a as Pe}from"./chunk-EERHWVVD.js";import"./chunk-42XIZ4MH.js";import{c as Je,d as He}from"./chunk-7EYXEF6M.js";import{b as me,d as ye,e as Ye,f as p,g as a,h as l,i as w,j as d}from"./chunk-SBZEOPXX.js";var Ee=me(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.EventType=void 0;var we;(function(n){n.removeAppCompleted="removeAppCompleted",n.componentSelectionChanged="componentSelectionChanged",n.appInstalled="appInstalled",n.appUpdateCompleted="appUpdateCompleted"})(we||(ot.EventType=we={}))});var Mt=me(m=>{"use strict";var Xe=m&&m.__createBinding||(Object.create?function(n,t,e,i){i===void 0&&(i=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(n,i,s)}:function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]}),Qe=m&&m.__setModuleDefault||(Object.create?function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}:function(n,t){n.default=t}),Ze=m&&m.__importStar||function(){var n=function(t){return n=Object.getOwnPropertyNames||function(e){var i=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[i.length]=s);return i},n(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var i=n(t),s=0;s<i.length;s++)i[s]!=="default"&&Xe(e,t,i[s]);return Qe(e,t),e}}();Object.defineProperty(m,"__esModule",{value:!0});m.EventType=m.WixSDKTypes=void 0;var tn=Ze((He(),Ye(Je)));m.WixSDKTypes=tn;var en=Ee();Object.defineProperty(m,"EventType",{enumerable:!0,get:function(){return en.EventType}})});var q=ye(Mt(),1);var N=class N{constructor(){p(this,"uid",0);p(this,"callbacks",new Map);p(this,"inTransaction",!1);p(this,"isSilent",!1);p(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 i=e();if(i&&i.hasOwnProperty("then"))try{return this.notifyWithStep(t,N.EventSteps.Start),i=await i,this.notifyWithStep(t,N.EventSteps.End),i}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},N.EventSteps.Error),s}else return this.notify(t),i}};p(N,"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}),p(N,"EventSteps",{Start:"start",End:"end",Error:"error"});var Dt=N,ct=(n=>(n.WorkerSpawn="WorkerSpawn",n.HostEvent="HostEvent",n.ApplicationsSpecsReceived="ApplicationsSpecsReceived",n.InitApplicationApi="InitApplicationApi",n.RunApplication="RunApplication",n.getApplicationApi="getApplicationApi",n.IframeInit="IframeInit",n))(ct||{}),kt=(n=>(n.EditorReady="EditorReady",n))(kt||{});var E=(n=>(n.ApplicationInit="ApplicationInit",n.ApplicationExecute="ApplicationExecute",n.ApplicationRemoved="ApplicationRemoved",n.ApplicationLoad="ApplicationLoad",n.ApplicationApiInit="ApplicationApiInit",n.CustomEvent="CustomEvent",n.HostEvent="HostEvent",n.EditorReady="EditorReady",n))(E||{}),St=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:v.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:v.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:v.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:v.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},v=class extends Dt{constructor(){super(...arguments);p(this,"factories",new St)}},at=class at{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ct.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);at.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};p(at,"allowedEvents",[q.EventType.componentSelectionChanged,q.EventType.appInstalled,q.EventType.appUpdateCompleted,q.EventType.removeAppCompleted]);var ve=at;var y=class n extends Error{constructor(e,i,s){let r=e?` ${e}`:"",o=`[${s}]#${i}`;super(`${o}.${r}`);p(this,"state",{});p(this,"displayName");p(this,"prefix");p(this,"errorMessage");p(this,"parent");p(this,"messages",[]);p(this,"code");this.displayName=o,this.errorMessage=e,this.prefix=s,this.code=i,this.name=o,Object.defineProperty(this,"message",{get:()=>this.getDisplayMessage()}),Error.captureStackTrace&&Error.captureStackTrace(this,n)}get parentError(){let e=this.parent;if(!e)return null;if(this.parent instanceof n)return this.parent;let i=e.name??"[Unknown Error]";return{getBreadcrumbs(){return[i]},getMessage(){return[i,e.message??"unknown error message"].join(`
2
2
  `)}}}getDisplayMessage(){return[(this.parentError?this.getBreadcrumbs():[]).join(" -> "),this.getMessage()].filter(i=>i.trim().length).join(`
3
3
  `)}getMessage(){let e=Object.entries(this.state).reduce((c,[h,u])=>(u&&c.push(` \u2013 ${h}: ${u}`),c),[]).join(`
4
4
  `),i=this.messages.reduce((c,h)=>(c.push(` - ${h.join(" ")}`),c),[]).join(`
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-BGTZ3RNN.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function o(e,t=!1){return n(e,t)}var i=["wix.com","editorx.com"];var _=new RegExp(`\\.(${i.join("|")})$`),s=["42.wixprod.net","uw2-edt-1.wixprod.net"],a="dev.wix-code.com";var u=new RegExp(`\\.(${s.join("|")})$`),p=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 b=o(e=>(t,c)=>e.fetchWithAuth(t,c));export{r as enableContext};
1
+ import{b as n}from"./chunk-42XIZ4MH.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function o(e,t=!1){return n(e,t)}var i=["wix.com","editorx.com"];var _=new RegExp(`\\.(${i.join("|")})$`),s=["42.wixprod.net","uw2-edt-1.wixprod.net"],a="dev.wix-code.com";var u=new RegExp(`\\.(${s.join("|")})$`),p=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 b=o(e=>(t,c)=>e.fetchWithAuth(t,c));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 const searchParams = 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 || param === null) {\n return;\n }\n urlSearchParams.append(key, param);\n });\n return urlSearchParams;\n }, new URLSearchParams());\n if (isComplexRequest) {\n searchParams.append('.r', base64Encode(JSON.stringify(params)));\n }\n return searchParams;\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,CAiDA,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,EC3DnF,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-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 const searchParams = 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 || param === null) {\n return;\n }\n urlSearchParams.append(key, param);\n });\n return urlSearchParams;\n }, new URLSearchParams());\n if (isComplexRequest) {\n searchParams.append('.r', base64Encode(JSON.stringify(params)));\n }\n return searchParams;\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,CAiDA,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,EC3DnF,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"]}