@wix/cli-app 1.1.89 → 1.1.90

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 (80) hide show
  1. package/build/{AddPermissionCommand-2YPAU7OW.js → AddPermissionCommand-XY4GGAKI.js} +2 -2
  2. package/build/{CreateVersionCommand-PRWTINI7.js → CreateVersionCommand-AFO6QZ3K.js} +3 -3
  3. package/build/{DevCommand-QZJYRWL6.js → DevCommand-LMH2ZEYS.js} +114 -11
  4. package/build/DevCommand-LMH2ZEYS.js.map +1 -0
  5. package/build/{GenerateCommand-RUUOZIHZ.js → GenerateCommand-3CK2O4L6.js} +7 -7
  6. package/build/{LogsCommand-CYDOEGLP.js → LogsCommand-T2OR2ZNI.js} +3 -3
  7. package/build/PreviewCommand-GKWGXWGO.js +19 -0
  8. package/build/ReleaseCommand-VRSGVCA5.js +28 -0
  9. package/build/{ServeCommand-7NSOPNJF.js → ServeCommand-RPXEURIC.js} +3 -3
  10. package/build/{build-73EP4WHX.js → build-R24UOFVB.js} +6 -6
  11. package/build/{chunk-OGZPS3MG.js → chunk-3C7IDKDV.js} +2 -2
  12. package/build/{chunk-2HDS4ZWR.js → chunk-AGCEJPNC.js} +2 -2
  13. package/build/{chunk-6WCP2JAM.js → chunk-AWOS3TAC.js} +158 -3
  14. package/build/{chunk-6WCP2JAM.js.map → chunk-AWOS3TAC.js.map} +1 -1
  15. package/build/{chunk-MO5LBUBH.js → chunk-BFYHGTJS.js} +3 -3
  16. package/build/{chunk-4NGBBEXE.js → chunk-CNLLDB7V.js} +6 -6
  17. package/build/{chunk-EUMKSOWX.js → chunk-DT5SDTRI.js} +4 -4
  18. package/build/{chunk-AYJSLRDQ.js → chunk-EYJO2C25.js} +4 -4
  19. package/build/{chunk-IJMHSG3L.js → chunk-G2EJCOG4.js} +2 -2
  20. package/build/{chunk-JNBDGVOZ.js → chunk-HUQZJ7BP.js} +2 -2
  21. package/build/{chunk-BWPO4SRH.js → chunk-K3B5VWLJ.js} +2 -2
  22. package/build/{chunk-ZEMJL4BF.js → chunk-M7GDC5QO.js} +2 -2
  23. package/build/{chunk-2VVRDZWE.js → chunk-MAYXQQ44.js} +6 -6
  24. package/build/{chunk-3JZI5Z2Q.js → chunk-S3RIMPQQ.js} +443 -12
  25. package/build/{chunk-3JZI5Z2Q.js.map → chunk-S3RIMPQQ.js.map} +1 -1
  26. package/build/{chunk-QMEDSKG3.js → chunk-UUZAWTTZ.js} +2 -2
  27. package/build/{chunk-KLJCH3V7.js → chunk-YB5ZT6ZJ.js} +2 -2
  28. package/build/{chunk-2SU57F7I.js → chunk-YBZ4LUI2.js} +13 -7
  29. package/build/{chunk-2SU57F7I.js.map → chunk-YBZ4LUI2.js.map} +1 -1
  30. package/build/{chunk-H36QZENX.js → chunk-ZZSRD3XC.js} +5 -3
  31. package/build/{chunk-H36QZENX.js.map → chunk-ZZSRD3XC.js.map} +1 -1
  32. package/build/cloudflare-runtime/entry.js +1 -1
  33. package/build/cloudflare-runtime/getRegisteredExtensions.js +1 -1
  34. package/build/index.js +25 -25
  35. package/build/platform-sdk/chunk-BGTZ3RNN.js +2 -0
  36. package/build/platform-sdk/chunk-BGTZ3RNN.js.map +1 -0
  37. package/build/platform-sdk/chunk-LPGY6RYR.js +2 -0
  38. package/build/platform-sdk/chunk-LPGY6RYR.js.map +1 -0
  39. package/build/platform-sdk/{chunk-3WHQP2RD.js → chunk-MM2KVUBI.js} +2 -2
  40. package/build/platform-sdk/dashboard.js +1 -1
  41. package/build/platform-sdk/editor.js +1 -1
  42. package/build/platform-sdk/sdk-context.js +1 -1
  43. package/build/platform-sdk/sdk-context.js.map +1 -1
  44. package/build/platform-sdk/site.js +1 -1
  45. package/build/{preview-QRW2EM5P.js → preview-MQRVT6F3.js} +12 -12
  46. package/build/{release-MGYPKXX3.js → release-BVT34U5G.js} +14 -14
  47. package/build/{render-command-V2CJCT3J.js → render-command-I7TJW3BF.js} +5 -5
  48. package/package.json +2 -2
  49. package/build/DevCommand-QZJYRWL6.js.map +0 -1
  50. package/build/PreviewCommand-QHWB6EJY.js +0 -19
  51. package/build/ReleaseCommand-UU3NTHNH.js +0 -28
  52. package/build/platform-sdk/chunk-42XIZ4MH.js +0 -2
  53. package/build/platform-sdk/chunk-42XIZ4MH.js.map +0 -1
  54. package/build/platform-sdk/chunk-7LWEMZNS.js +0 -2
  55. package/build/platform-sdk/chunk-7LWEMZNS.js.map +0 -1
  56. /package/build/{AddPermissionCommand-2YPAU7OW.js.map → AddPermissionCommand-XY4GGAKI.js.map} +0 -0
  57. /package/build/{CreateVersionCommand-PRWTINI7.js.map → CreateVersionCommand-AFO6QZ3K.js.map} +0 -0
  58. /package/build/{GenerateCommand-RUUOZIHZ.js.map → GenerateCommand-3CK2O4L6.js.map} +0 -0
  59. /package/build/{LogsCommand-CYDOEGLP.js.map → LogsCommand-T2OR2ZNI.js.map} +0 -0
  60. /package/build/{PreviewCommand-QHWB6EJY.js.map → PreviewCommand-GKWGXWGO.js.map} +0 -0
  61. /package/build/{ReleaseCommand-UU3NTHNH.js.map → ReleaseCommand-VRSGVCA5.js.map} +0 -0
  62. /package/build/{ServeCommand-7NSOPNJF.js.map → ServeCommand-RPXEURIC.js.map} +0 -0
  63. /package/build/{build-73EP4WHX.js.map → build-R24UOFVB.js.map} +0 -0
  64. /package/build/{chunk-OGZPS3MG.js.map → chunk-3C7IDKDV.js.map} +0 -0
  65. /package/build/{chunk-2HDS4ZWR.js.map → chunk-AGCEJPNC.js.map} +0 -0
  66. /package/build/{chunk-MO5LBUBH.js.map → chunk-BFYHGTJS.js.map} +0 -0
  67. /package/build/{chunk-4NGBBEXE.js.map → chunk-CNLLDB7V.js.map} +0 -0
  68. /package/build/{chunk-EUMKSOWX.js.map → chunk-DT5SDTRI.js.map} +0 -0
  69. /package/build/{chunk-AYJSLRDQ.js.map → chunk-EYJO2C25.js.map} +0 -0
  70. /package/build/{chunk-IJMHSG3L.js.map → chunk-G2EJCOG4.js.map} +0 -0
  71. /package/build/{chunk-JNBDGVOZ.js.map → chunk-HUQZJ7BP.js.map} +0 -0
  72. /package/build/{chunk-BWPO4SRH.js.map → chunk-K3B5VWLJ.js.map} +0 -0
  73. /package/build/{chunk-ZEMJL4BF.js.map → chunk-M7GDC5QO.js.map} +0 -0
  74. /package/build/{chunk-2VVRDZWE.js.map → chunk-MAYXQQ44.js.map} +0 -0
  75. /package/build/{chunk-QMEDSKG3.js.map → chunk-UUZAWTTZ.js.map} +0 -0
  76. /package/build/{chunk-KLJCH3V7.js.map → chunk-YB5ZT6ZJ.js.map} +0 -0
  77. /package/build/platform-sdk/{chunk-3WHQP2RD.js.map → chunk-MM2KVUBI.js.map} +0 -0
  78. /package/build/{preview-QRW2EM5P.js.map → preview-MQRVT6F3.js.map} +0 -0
  79. /package/build/{release-MGYPKXX3.js.map → release-BVT34U5G.js.map} +0 -0
  80. /package/build/{render-command-V2CJCT3J.js.map → render-command-I7TJW3BF.js.map} +0 -0
@@ -4594,7 +4594,7 @@ function objectToKeyValue(input) {
4594
4594
  return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
4595
4595
  }
4596
4596
 
4597
- // ../../node_modules/@wix/sdk-runtime/build/context.js
4597
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
4598
4598
  function runWithoutContext(fn) {
4599
4599
  const globalContext = globalThis.__wix_context__;
4600
4600
  const moduleContext = {
@@ -4437,7 +4437,7 @@ function objectToKeyValue(input) {
4437
4437
  return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
4438
4438
  }
4439
4439
 
4440
- // ../../node_modules/@wix/sdk-runtime/build/context.js
4440
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
4441
4441
  function runWithoutContext(fn) {
4442
4442
  const globalContext = globalThis.__wix_context__;
4443
4443
  const moduleContext = {
package/build/index.js CHANGED
@@ -2,18 +2,18 @@ import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  createI18nT
5
- } from "./chunk-QMEDSKG3.js";
5
+ } from "./chunk-UUZAWTTZ.js";
6
6
  import {
7
7
  runCommand
8
- } from "./chunk-EUMKSOWX.js";
9
- import "./chunk-OGZPS3MG.js";
8
+ } from "./chunk-DT5SDTRI.js";
9
+ import "./chunk-3C7IDKDV.js";
10
10
  import "./chunk-6BTLX252.js";
11
- import "./chunk-2HDS4ZWR.js";
11
+ import "./chunk-AGCEJPNC.js";
12
12
  import {
13
13
  package_default,
14
14
  require_react,
15
15
  z
16
- } from "./chunk-3JZI5Z2Q.js";
16
+ } from "./chunk-S3RIMPQQ.js";
17
17
  import {
18
18
  __commonJS,
19
19
  __require,
@@ -3376,8 +3376,8 @@ var {
3376
3376
  // src/commands/build.ts
3377
3377
  init_esm_shims();
3378
3378
  var buildCommand = (services) => createCommand("build").action(async (_, command) => {
3379
- const { runCommand: runCommand2 } = await import("./render-command-V2CJCT3J.js");
3380
- const { build } = await import("./build-73EP4WHX.js");
3379
+ const { runCommand: runCommand2 } = await import("./render-command-I7TJW3BF.js");
3380
+ const { build } = await import("./build-R24UOFVB.js");
3381
3381
  await runCommand2(command, services, build);
3382
3382
  });
3383
3383
 
@@ -3387,8 +3387,8 @@ var import_react = __toESM(require_react(), 1);
3387
3387
  var devCommand = (services) => {
3388
3388
  const t = createI18nT();
3389
3389
  return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).action(async (options, command) => {
3390
- const { DevCommand } = await import("./DevCommand-QZJYRWL6.js");
3391
- const { renderCommand } = await import("./render-command-V2CJCT3J.js");
3390
+ const { DevCommand } = await import("./DevCommand-LMH2ZEYS.js");
3391
+ const { renderCommand } = await import("./render-command-I7TJW3BF.js");
3392
3392
  const { https = false } = options;
3393
3393
  await renderCommand(command, services, /* @__PURE__ */ import_react.default.createElement(DevCommand, { https }), {
3394
3394
  watchForModelChanges: true
@@ -3457,17 +3457,17 @@ var previewCommand = (services) => {
3457
3457
  ).hideHelp()
3458
3458
  ).action(async (options, command) => {
3459
3459
  const { site, baseUrl, json } = options;
3460
- const { renderCommand, runCommand: runCommand2 } = await import("./render-command-V2CJCT3J.js");
3460
+ const { renderCommand, runCommand: runCommand2 } = await import("./render-command-I7TJW3BF.js");
3461
3461
  if (json) {
3462
3462
  return runCommand2(command, services, async (model) => {
3463
- const { nonInteractivePreview } = await import("./preview-QRW2EM5P.js");
3463
+ const { nonInteractivePreview } = await import("./preview-MQRVT6F3.js");
3464
3464
  return nonInteractivePreview(services, model, {
3465
3465
  baseUrl,
3466
3466
  siteId: site
3467
3467
  });
3468
3468
  });
3469
3469
  }
3470
- const { PreviewCommand } = await import("./PreviewCommand-QHWB6EJY.js");
3470
+ const { PreviewCommand } = await import("./PreviewCommand-GKWGXWGO.js");
3471
3471
  await renderCommand(
3472
3472
  command,
3473
3473
  services,
@@ -3498,8 +3498,8 @@ var createVersionCommand = (services) => {
3498
3498
  t("create_version_command_def.option.base_url"),
3499
3499
  validateBase
3500
3500
  ).action(async (options, command) => {
3501
- const { renderCommand } = await import("./render-command-V2CJCT3J.js");
3502
- const { CreateVersionCommandDeprecated } = await import("./CreateVersionCommand-PRWTINI7.js");
3501
+ const { renderCommand } = await import("./render-command-I7TJW3BF.js");
3502
+ const { CreateVersionCommandDeprecated } = await import("./CreateVersionCommand-AFO6QZ3K.js");
3503
3503
  await renderCommand(
3504
3504
  command,
3505
3505
  services,
@@ -3516,8 +3516,8 @@ var addPermissionCommand = (services) => {
3516
3516
  return createCommand("add-permission").description("adding a permission to the app").addOption(
3517
3517
  new Option("-p, --permission-id <id>", t("the permission id to add"))
3518
3518
  ).action(async (options, command) => {
3519
- const { renderCommand } = await import("./render-command-V2CJCT3J.js");
3520
- const { AddPermissionCommand } = await import("./AddPermissionCommand-2YPAU7OW.js");
3519
+ const { renderCommand } = await import("./render-command-I7TJW3BF.js");
3520
+ const { AddPermissionCommand } = await import("./AddPermissionCommand-XY4GGAKI.js");
3521
3521
  const { permissionId = "" } = options;
3522
3522
  await renderCommand(
3523
3523
  command,
@@ -3533,8 +3533,8 @@ var import_react5 = __toESM(require_react(), 1);
3533
3533
  var serveCommand = (services) => {
3534
3534
  const t = createI18nT();
3535
3535
  return createCommand("serve").description(t("serve_command_def.description")).action(async (_, command) => {
3536
- const { renderCommand } = await import("./render-command-V2CJCT3J.js");
3537
- const { ServeCommandDeprecated } = await import("./ServeCommand-7NSOPNJF.js");
3536
+ const { renderCommand } = await import("./render-command-I7TJW3BF.js");
3537
+ const { ServeCommandDeprecated } = await import("./ServeCommand-RPXEURIC.js");
3538
3538
  await renderCommand(command, services, /* @__PURE__ */ import_react5.default.createElement(ServeCommandDeprecated, null));
3539
3539
  });
3540
3540
  };
@@ -3545,8 +3545,8 @@ var import_react6 = __toESM(require_react(), 1);
3545
3545
  var generateCommand = (services) => {
3546
3546
  const t = createI18nT();
3547
3547
  return createCommand("generate").description(t("generate_command.description")).action(async (options, command) => {
3548
- const { GenerateCommand } = await import("./GenerateCommand-RUUOZIHZ.js");
3549
- const { renderCommand } = await import("./render-command-V2CJCT3J.js");
3548
+ const { GenerateCommand } = await import("./GenerateCommand-3CK2O4L6.js");
3549
+ const { renderCommand } = await import("./render-command-I7TJW3BF.js");
3550
3550
  await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(GenerateCommand, null), {
3551
3551
  skipProjectValidation: true
3552
3552
  });
@@ -3564,8 +3564,8 @@ var logsCommand = (services) => {
3564
3564
  validateVersion
3565
3565
  ).action(async (options, command) => {
3566
3566
  const { version } = options;
3567
- const { renderCommand } = await import("./render-command-V2CJCT3J.js");
3568
- const { LogsCommand } = await import("./LogsCommand-CYDOEGLP.js");
3567
+ const { renderCommand } = await import("./render-command-I7TJW3BF.js");
3568
+ const { LogsCommand } = await import("./LogsCommand-T2OR2ZNI.js");
3569
3569
  await renderCommand(command, services, /* @__PURE__ */ import_react7.default.createElement(LogsCommand, { version }));
3570
3570
  });
3571
3571
  };
@@ -3598,8 +3598,8 @@ var releaseCommand = (services) => {
3598
3598
  t("app_preview_command_def.option.json")
3599
3599
  ).hideHelp()
3600
3600
  ).action(async (options, command) => {
3601
- const { renderCommand } = await import("./render-command-V2CJCT3J.js");
3602
- const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-UU3NTHNH.js");
3601
+ const { renderCommand } = await import("./render-command-I7TJW3BF.js");
3602
+ const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-VRSGVCA5.js");
3603
3603
  const { baseUrl, site, comment, json } = options;
3604
3604
  const versionType = options.versionType ? {
3605
3605
  major: ReleaseVersionType.MAJOR,
@@ -3613,7 +3613,7 @@ var releaseCommand = (services) => {
3613
3613
  };
3614
3614
  if (json) {
3615
3615
  return runCommand(command, services, async (model) => {
3616
- const { nonInteractiveRelease } = await import("./release-MGYPKXX3.js");
3616
+ const { nonInteractiveRelease } = await import("./release-BVT34U5G.js");
3617
3617
  return nonInteractiveRelease(services, model, props);
3618
3618
  });
3619
3619
  }
@@ -0,0 +1,2 @@
1
+ import{wixContext as n}from"@wix/sdk-context";function d(o,t){return(...i)=>{let e=x();return e?e.initWixModules(o,t).apply(void 0,i):o.apply(void 0,i)}}function x(){let o=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(o)return{initWixModules(e,l){return r(()=>o(e,l))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof n.client<"u"?n.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof n.elevatedClient<"u"?n.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!i))return{initWixModules(e,l){if(l){if(!i)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return r(()=>i.use(e))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return r(()=>t.use(e))},fetchWithAuth:(e,l)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(e,l)},async graphql(e,l,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,l,u)}}}function r(o){let t=globalThis.__wix_context__,i={client:n.client,elevatedClient:n.elevatedClient},e;globalThis.__wix_context__=void 0,n.client=void 0,n.elevatedClient=void 0,typeof $wixContext<"u"&&(e={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return o()}finally{globalThis.__wix_context__=t,n.client=i.client,n.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=e.client,$wixContext.elevatedClient=e.elevatedClient)}}export{d as a,r as b};
2
+ //# sourceMappingURL=chunk-BGTZ3RNN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context-v2.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n throw new Error('An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n 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,mBCmBpB,SAASC,EAA0BC,EAAYC,EAAU,CAC5D,MAAQ,IAAIC,IAAS,CACjB,IAAMC,EAAUC,EAAe,EAC/B,OAAKD,EAIGA,EACH,eAAeH,EAAYC,CAAQ,EAEnC,MAAM,OAAWC,CAAI,EALfF,EAAW,MAAM,OAAWE,CAAI,CAM/C,CACJ,CD9BO,SAASG,GAAiB,CAC7B,IAAMC,EAAa,OAAO,YAAgB,KAAe,YAAY,eAC/D,YAAY,eACZ,OAAO,WAAW,gBAAoB,KACpC,WAAW,gBAAgB,eACzB,WAAW,gBAAgB,eAC3B,OACV,GAAIA,EACA,MAAO,CAEH,eAAeC,EAASC,EAAU,CAC9B,OAAOC,EAAkB,IAAMH,EAAWC,EAASC,CAAQ,CAAC,CAChE,EACA,eAAgB,CACZ,MAAM,IAAI,MAAM,gDAAgD,CACpE,EACA,SAAU,CACN,MAAM,I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A,CACI,WAAW,gBAAkBC,EAC7BE,EAAW,OAASD,EAAc,OAClCC,EAAW,eAAiBD,EAAc,eACtC,OAAO,YAAgB,MACvB,YAAY,OAASE,EAAe,OACpC,YAAY,eAAiBA,EAAe,eAEpD,CACJ","names":["wixContext","contextualizeRESTModuleV2","restModule","elevated","args","context","resolveContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","wixContext","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext"]}
@@ -0,0 +1,2 @@
1
+ import{wixContext as p}from"@wix/sdk-context";function w(){let e=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(e)return{initWixModules(i,r){return y(()=>e(i,r))},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 p.client<"u"?p.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,n=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof p.elevatedClient<"u"?p.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!n))return{initWixModules(i,r){if(r){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 y(()=>n.use(i))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return y(()=>t.use(i))},fetchWithAuth:(i,r)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(i,r)},async graphql(i,r,o){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(i,r,o)}}}function y(e){let t=globalThis.__wix_context__,n={client:p.client,elevatedClient:p.elevatedClient},i;globalThis.__wix_context__=void 0,p.client=void 0,p.elevatedClient=void 0,typeof $wixContext<"u"&&(i={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,p.client=n.client,p.elevatedClient=n.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=i.client,$wixContext.elevatedClient=i.elevatedClient)}}function M(e,t){return{...e,...Object.fromEntries(t.map(n=>[n,(...i)=>{let r=w();if(!r)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return r.initWixModules(e)[n].apply(void 0,i)}]))}}function te(e){return M({__type:"host",create:t=>Object.entries(e).reduce((n,[i,r])=>({...n,[i]:r(t)}),{})},Object.keys(e))}var F=class{constructor(e){this.message=e,this.captureException=()=>{console.error(this.message)},this.captureMessage=()=>{console.error(this.message)},this.startSpan=(t,n)=>(console.error(this.message),n(void 0)),this.startSpanManual=()=>(console.error(this.message),{end:()=>{},fail:()=>{}}),this.endSpanManual=()=>{console.error(this.message)},this.addBreadcrumb=()=>{console.error(this.message)}}},C=e=>new F(e);var B=e=>e!=null&&e!=="",g=e=>_(e,B);function _(e,t=n=>!!n){if(!e)return{};let n={};for(let i in e)t(e[i],i)&&(n[i]=e[i]);return n}var D=e=>{let t=g({"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}),n=_({"extension.data":g({...e.extensionData}),site:g({url:e.siteUrl,id:e.tenantType==="SITE"?e.tenantId:void 0}),account:g({id:e.tenantType==="ACCOUNT"?e.tenantId:void 0})},i=>!!i&&Object.keys(i).length>0);return{tags:t,contexts:n}},P=class{constructor(e){this.message=e,this.captureException=()=>{console.error(this.message)},this.captureMessage=()=>{console.error(this.message)},this.startSpan=(t,n)=>(console.error(this.message),n(void 0)),this.startSpanManual=()=>(console.error(this.message),{end:()=>{},fail:()=>{}}),this.endSpanManual=()=>{console.error(this.message)},this.addBreadcrumb=()=>{console.error(this.message)}}},f=e=>new P(e);var m=e=>typeof e?.then=="function",T=(e,t)=>t?m(e)?e.then(n=>(t(n,!0),n)):(t(e,!1),e):e,R=(e,t)=>{e&&(t?setTimeout(e,t):e())},v=()=>Date.now()+Math.random(),V=class{constructor(e){this.options=e,this.spanMap=new Map}createSpan(e,t){let n,i,r,o=Date.now(),l,s=T(t,({sentrySDK:u,scope:d},h)=>{h&&(l=Date.now()-o),u.startSpan({...e,scope:d,forceTransaction:this.options.forceTransaction},()=>new Promise((x,K)=>{n=x,i=K}))?.catch(x=>{if(x?.message!==r?.message)throw x})}),a=u=>{this.spanMap.delete(e.name),T(s,()=>{R(u,l)})},c={end:()=>{a(()=>n?.())},fail:u=>{r=r??u,a(()=>i?.(u))}};return this.spanMap.set(e.name,c),c}getSpan(e){return this.spanMap.get(e.name)}},k=e=>new V(e);var z=(e,{tags:t,contexts:n})=>{t&&e.setTags(t),n&&Object.entries(n).forEach(([i,r])=>typeof r<"u"&&e.setContext(i,r))},A=(e,t)=>{if(!t)return;let{tags:n,contexts:i}=D(t);z(e,{tags:n,contexts:i})},O=["onLoad","forceLoad"],E=new Map,$=class{constructor(e){this.options=e,this.resolvedState=null,this.validateOptions=n=>{let i=O.filter(r=>typeof n.sentrySDK?.[r]!="function");if(i.length>0)throw new Error(`Missing the following options.sentrySDK methods: ${i.join(", ")}`)},this.validateOptions(e);let t=E.get(e.dsn);t||(t=k({forceTransaction:!0}),E.set(e.dsn,t)),this.manualSpanRegistry=t}isFullSDK(){return typeof this.options.sentrySDK.BrowserClient=="function"}init(){if(this.resolvedState)return this.resolvedState;let{sentrySDK:e,transport:t,hostContext:n,dsn:i,release:r,environment:o,tracesSampleRate:l=1,debug:s=!1}=this.options,a=new e.Scope,c=new e.BrowserClient({dsn:i,transport:t??e.makeFetchTransport,integrations:e.getDefaultIntegrations({}),stackParser:e.defaultStackParser,tracesSampleRate:l||1,debug:s,environment:o,release:r});return A(a,n),a.setClient(c),c.init(),this.resolvedState={sentrySDK:e,scope:a,sentryClient:c},this.resolvedState}loadFullSDK(e){if(this.isFullSDK()){e?.(this.init());return}if(this.promise){this.promise.then(e);return}this.promise=new Promise(t=>{this.options.sentrySDK.onLoad(()=>{if(this.resolvedState)return;let n=this.init();t(n),e?.(n)})}),this.options.sentrySDK.forceLoad()}},N=class extends ${constructor(){super(...arguments),this.addBreadcrumb=e=>{let t={type:e.type,category:e.category,message:e.message,level:e.level,data:e.data};this.loadFullSDK(({scope:n})=>{n.addBreadcrumb(t)})},this.captureException=(e,t)=>{this.loadFullSDK(({sentryClient:n,scope:i})=>{n.captureException(e,{captureContext:{level:t?.level??"error",tags:t?.tags,contexts:t?.contexts}},i)})},this.captureMessage=(e,t)=>{this.loadFullSDK(({sentryClient:n,scope:i})=>{n.captureMessage(e,t?.level??"error",{captureContext:{level:t?.level??"error",tags:t?.tags,contexts:t?.contexts}},i)})},this.startSpan=(e,t)=>{if(this.isFullSDK()){let{sentrySDK:s,scope:a}=this.init();return s.startSpan({...e,scope:a},t)}this.loadFullSDK();let n=(s,a)=>{let c=Date.now()-a,u=()=>new Promise(d=>setTimeout(()=>d(s),c));this.loadFullSDK(async({sentrySDK:d,scope:h})=>d.startSpan({...e,scope:h},u))},i=async(s,a)=>{let c=Date.now()-a,u=()=>new Promise((d,h)=>setTimeout(()=>h(s),c));this.loadFullSDK(async({sentrySDK:d,scope:h})=>{try{await d.startSpan({...e,scope:h},u)}catch(S){if(S?.message!==s?.message)throw S}})},r=Date.now(),o,l;try{o=t()}catch(s){l=s}if(l)throw i(l,r),l;return m(o)?o.then(s=>n(s,r)).catch(s=>i(s,r)):n(o,r),o},this.startSpanManual=e=>{let t=this.isFullSDK()?this.init():new Promise(i=>this.loadFullSDK(i));return this.manualSpanRegistry.createSpan(e,t)},this.endSpanManual=e=>{this.manualSpanRegistry.getSpan(e)?.end()}}},U=e=>`Sentry SDK version "${e}" is not supported. Please make sure to use monitoring SDK only in supported environments.`,q=e=>{try{return parseInt(e.split(".")[0],10)}catch{console.warn("Failed to parse Sentry SDK version");return}},b=({sentrySDK:e,dsn:t,...n})=>{if(!e)return f("Unsupported environment - Sentry SDK is not loaded into the environment. Please make sure to use monitoring SDK only in supported environments.");if(!t)return f("Missing Sentry DSN in the app's monitoring configuration. Please make sure to set it.");try{let i=e.SDK_VERSION&&q(e.SDK_VERSION);return i&&i<7?f(U(e.SDK_VERSION)):new N({...n,dsn:t,sentrySDK:e})}catch(i){return f(`Failed to initialize monitoring client: ${i.message}`)}};var H=class{constructor(e){this.message=e,this.captureException=()=>{console.error(this.message)},this.captureMessage=()=>{console.error(this.message)},this.startSpan=(t,n)=>(console.error(this.message),n(void 0)),this.startSpanManual=()=>(console.error(this.message),{end:()=>{},fail:()=>{}}),this.endSpanManual=()=>{console.error(this.message)},this.addBreadcrumb=()=>{console.error(this.message)}}},W=e=>new H(e);var L=class{constructor(e){this.options=e,this.captureException=(t,n)=>{let{panoramaClient:i}=this.options;t instanceof Error||(t=new Error(t)),i.errorMonitor().reportError(t,this.contextToData(n))},this.captureMessage=(t,n)=>{let{panoramaClient:i}=this.options,r=i.logger(),o;switch(n?.level){case"error":o=r.error;break;case"warning":o=r.warn;break;default:o=r.info}o(t,this.contextToData(n))},this.startSpan=(t,n)=>{let{panoramaClient:i}=this.options,{name:r}=t,o,l=i.transaction(r,{id:v()}),s=this.contextToData(t);l.start(s);try{o=n(),m(o)?o=o.then(a=>(l.finish(s),a)).catch(a=>{throw this.reportErrorInContextOfSpan(a,t),a}):l.finish(s)}catch(a){throw this.reportErrorInContextOfSpan(a,t),a}return o},this.addBreadcrumb=t=>{let{panoramaClient:n}=this.options;n.errorMonitor().addBreadcrumb(t)}}contextToData(e){return e&&{...e?.tags&&{tags:e.tags},...e?.contexts&&{context:e.contexts},...e?.level&&{severity:e.level}}}reportErrorInContextOfSpan(e,t){let{panoramaClient:n}=this.options,{name:i}=t,r=this.contextToData({...t,contexts:{transaction:{name:i}}});n.errorMonitor().reportError(e,r)}startSpanManual(e){let{panoramaClient:t}=this.options,{name:n}=e,i=t.transaction(n,{id:v()}),r=this.contextToData(e);i.start(r);let o=!1,l=s=>{o||(o=!0,s())};return{end:()=>{l(()=>i.finish(r))},fail:s=>{l(()=>this.reportErrorInContextOfSpan(s,e))}}}endSpanManual(e){let{panoramaClient:t}=this.options,{name:n}=e;t.transaction(n).finish()}},I=e=>{let{panoramaClient:t}=e;return t?new L(e):W("Missing Panorama client")};var j=e=>e?.type==="SENTRY",Y=e=>e?.type==="PANORAMA",De=({sentrySDK:e,sentryTransport:t,panoramaClient:n,monitoringConfig:i,hostContext:r})=>{if(j(i)){let{sentryOptions:o}=i;return()=>b({dsn:o?.dsn,hostContext:r,sentrySDK:e,transport:t})}else if(Y(i))return()=>I({panoramaClient:n});return()=>C("Invalid monitoring configuration. Please check the monitoring setup of your application.")};export{te as a,De as b};
2
+ //# sourceMappingURL=chunk-LPGY6RYR.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","../../../node_modules/@wix/sdk-runtime/build/host-modules.js","../../../node_modules/@wix/monitoring-browser-sdk-host/node_modules/@wix/monitoring/build/index.js","../../../node_modules/@wix/monitoring-browser-sentry/node_modules/@wix/monitoring/build/index.js","../../../node_modules/@wix/monitoring-common-sentry/build/index.js","../../../node_modules/@wix/monitoring-browser-sentry/build/index.js","../../../node_modules/@wix/monitoring-browser-panorama/node_modules/@wix/monitoring/build/index.js","../../../node_modules/@wix/monitoring-browser-panorama/build/index.js","../../../node_modules/@wix/monitoring-browser-sdk-host/build/index.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","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 };\n this.captureMessage = () => {\n console.error(this.message);\n };\n this.startSpan = (spanOptions, callback) => {\n console.error(this.message);\n return callback(void 0);\n };\n this.startSpanManual = () => {\n console.error(this.message);\n return {\n end: () => {\n },\n fail: () => {\n }\n };\n };\n this.endSpanManual = () => {\n console.error(this.message);\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/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 };\n this.captureMessage = () => {\n console.error(this.message);\n };\n this.startSpan = (spanOptions, callback) => {\n console.error(this.message);\n return callback(void 0);\n };\n this.startSpanManual = () => {\n console.error(this.message);\n return {\n end: () => {\n },\n fail: () => {\n }\n };\n };\n this.endSpanManual = () => {\n console.error(this.message);\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/utils.ts\nvar isPromise = (value) => typeof value?.then === \"function\";\nvar runWithMaybePromise = (value, cb) => {\n if (!cb) {\n return value;\n }\n if (isPromise(value)) {\n return value.then((res) => {\n cb(res, true);\n return res;\n });\n } else {\n cb(value, false);\n return value;\n }\n};\nvar runWithMaybeDelay = (cb, maybeTimeCompensation) => {\n if (!cb) {\n return;\n }\n if (maybeTimeCompensation) {\n setTimeout(cb, maybeTimeCompensation);\n } else {\n cb();\n }\n};\nvar generateRandomId = () => Date.now() + Math.random();\n\n// src/manual-span.ts\nvar ManualSpanRegistryImpl = class {\n constructor(options) {\n this.options = options;\n this.spanMap = /* @__PURE__ */ new Map();\n }\n createSpan(spanOptions, sentryOptionsOrPromise) {\n let resolveSpan;\n let rejectSpan;\n let error;\n const startTime = Date.now();\n let maybeDurationCompensation;\n const maybePromise = runWithMaybePromise(\n sentryOptionsOrPromise,\n ({ sentrySDK, scope }, isPromise2) => {\n if (isPromise2) {\n maybeDurationCompensation = Date.now() - startTime;\n }\n const promise = sentrySDK.startSpan(\n {\n ...spanOptions,\n scope,\n forceTransaction: this.options.forceTransaction\n },\n () => new Promise((resolve, reject) => {\n resolveSpan = resolve;\n rejectSpan = reject;\n })\n );\n promise?.catch((e) => {\n if (e?.message !== error?.message) {\n throw e;\n }\n });\n }\n );\n const endSpan = (cb) => {\n this.spanMap.delete(spanOptions.name);\n runWithMaybePromise(maybePromise, () => {\n runWithMaybeDelay(cb, maybeDurationCompensation);\n });\n };\n const span = {\n end: () => {\n endSpan(() => resolveSpan?.());\n },\n fail: (_error) => {\n error = error ?? _error;\n endSpan(() => rejectSpan?.(_error));\n }\n };\n this.spanMap.set(spanOptions.name, span);\n return span;\n }\n getSpan(spanOptions) {\n return this.spanMap.get(spanOptions.name);\n }\n};\nvar createManualSpanRegistry = (options) => new ManualSpanRegistryImpl(options);\nexport {\n createManualSpanRegistry,\n generateRandomId,\n isPromise,\n runWithMaybeDelay,\n runWithMaybePromise\n};\n","// src/factory.ts\nimport { createFallbackMonitoringClient } from \"@wix/monitoring\";\n\n// src/browser/client.ts\nimport { isPromise } from \"@wix/monitoring-common-sentry\";\n\n// src/abstract-browser-client.ts\nimport {\n createManualSpanRegistry\n} from \"@wix/monitoring-common-sentry\";\n\n// src/context-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/abstract-browser-client.ts\nvar MandatorySDKMethods = [\"onLoad\", \"forceLoad\"];\nvar manualSpanRegistryMap = /* @__PURE__ */ new Map();\nvar AbstractSentryBrowserClient = class {\n constructor(options) {\n this.options = options;\n this.resolvedState = null;\n this.validateOptions = (options) => {\n const missingSDKMethods = MandatorySDKMethods.filter(\n (method) => typeof options.sentrySDK?.[method] !== \"function\"\n );\n if (missingSDKMethods.length > 0) {\n throw new Error(\n `Missing the following options.sentrySDK methods: ${missingSDKMethods.join(\", \")}`\n );\n }\n };\n this.validateOptions(options);\n let manualSpanRegistry = manualSpanRegistryMap.get(options.dsn);\n if (!manualSpanRegistry) {\n manualSpanRegistry = createManualSpanRegistry({\n // Force spans to be reported as individual transactions (one http request per one span)\n forceTransaction: true\n });\n manualSpanRegistryMap.set(options.dsn, manualSpanRegistry);\n }\n this.manualSpanRegistry = manualSpanRegistry;\n }\n isFullSDK() {\n return typeof this.options.sentrySDK.BrowserClient === \"function\";\n }\n init() {\n if (this.resolvedState) {\n return this.resolvedState;\n }\n const {\n sentrySDK,\n transport,\n hostContext,\n dsn,\n release,\n environment,\n tracesSampleRate = 1,\n debug = false\n } = this.options;\n const scope = new sentrySDK.Scope();\n const sentryClient = new sentrySDK.BrowserClient({\n dsn,\n transport: transport ?? sentrySDK.makeFetchTransport,\n integrations: sentrySDK.getDefaultIntegrations({}),\n stackParser: sentrySDK.defaultStackParser,\n tracesSampleRate: tracesSampleRate || 1,\n debug,\n environment,\n release\n });\n setHostContextOnScope(scope, hostContext);\n scope.setClient(sentryClient);\n sentryClient.init();\n this.resolvedState = {\n sentrySDK,\n scope,\n sentryClient\n };\n return this.resolvedState;\n }\n loadFullSDK(handler) {\n if (this.isFullSDK()) {\n handler?.(this.init());\n return;\n }\n if (this.promise) {\n this.promise.then(handler);\n return;\n }\n this.promise = new Promise((resolve) => {\n this.options.sentrySDK.onLoad(() => {\n if (this.resolvedState) {\n return;\n }\n const resolvedState = this.init();\n resolve(resolvedState);\n handler?.(resolvedState);\n });\n });\n this.options.sentrySDK.forceLoad();\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.loadFullSDK(({ scope }) => {\n scope.addBreadcrumb(filteredBreadcrumb);\n });\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 event.\n */\n this.captureException = (error, captureContext) => {\n this.loadFullSDK(({ sentryClient, scope }) => {\n sentryClient.captureException(\n error,\n {\n captureContext: {\n level: captureContext?.level ?? \"error\",\n tags: captureContext?.tags,\n contexts: captureContext?.contexts\n }\n },\n scope\n );\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 */\n this.captureMessage = (message, captureContext) => {\n this.loadFullSDK(({ sentryClient, scope }) => {\n 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 scope\n );\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 if (this.isFullSDK()) {\n const { sentrySDK, scope } = this.init();\n return sentrySDK.startSpan({ ...spanOptions, scope }, callback);\n }\n this.loadFullSDK();\n const simulateAndReportSuccessfulSpan = (callbackResult2, startTime2) => {\n const spanDuration = Date.now() - startTime2;\n const simulatedCallback = () => {\n return new Promise(\n (resolve) => setTimeout(() => resolve(callbackResult2), spanDuration)\n );\n };\n this.loadFullSDK(async ({ sentrySDK, scope }) => {\n return sentrySDK.startSpan(\n { ...spanOptions, scope },\n simulatedCallback\n );\n });\n };\n const simulateAndReportFailedSpan = async (error2, startTime2) => {\n const spanDuration = Date.now() - startTime2;\n const simulatedCallback = () => {\n return new Promise(\n (_, reject) => setTimeout(() => reject(error2), spanDuration)\n );\n };\n this.loadFullSDK(async ({ sentrySDK, scope }) => {\n try {\n await sentrySDK.startSpan(\n { ...spanOptions, scope },\n simulatedCallback\n );\n } catch (e) {\n if (e?.message !== error2?.message) {\n throw e;\n }\n }\n });\n };\n const startTime = Date.now();\n let callbackResult;\n let error;\n try {\n callbackResult = callback();\n } catch (e) {\n error = e;\n }\n if (error) {\n simulateAndReportFailedSpan(error, startTime);\n throw error;\n } else {\n if (isPromise(callbackResult)) {\n callbackResult.then((res) => simulateAndReportSuccessfulSpan(res, startTime)).catch((e) => simulateAndReportFailedSpan(e, startTime));\n } else {\n simulateAndReportSuccessfulSpan(callbackResult, startTime);\n }\n return callbackResult;\n }\n };\n this.startSpanManual = (spanOptions) => {\n const resolvedStateOrPromise = this.isFullSDK() ? this.init() : new Promise((resolve) => this.loadFullSDK(resolve));\n const span = this.manualSpanRegistry.createSpan(\n spanOptions,\n resolvedStateOrPromise\n );\n return span;\n };\n this.endSpanManual = (spanOptions) => {\n const span = this.manualSpanRegistry.getSpan(spanOptions);\n span?.end();\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 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 (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/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 };\n this.captureMessage = () => {\n console.error(this.message);\n };\n this.startSpan = (spanOptions, callback) => {\n console.error(this.message);\n return callback(void 0);\n };\n this.startSpanManual = () => {\n console.error(this.message);\n return {\n end: () => {\n },\n fail: () => {\n }\n };\n };\n this.endSpanManual = () => {\n console.error(this.message);\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/client.ts\nimport { generateRandomId, isPromise } from \"@wix/monitoring-common-sentry\";\nvar PanoramaBrowserClient = class {\n constructor(options) {\n this.options = options;\n this.captureException = (error, captureContext) => {\n const { panoramaClient } = this.options;\n if (!(error instanceof Error)) {\n error = new Error(error);\n }\n panoramaClient.errorMonitor().reportError(error, this.contextToData(captureContext));\n };\n this.captureMessage = (message, captureContext) => {\n const { panoramaClient } = this.options;\n const logger = panoramaClient.logger();\n let loggerByLevel;\n switch (captureContext?.level) {\n case \"error\":\n loggerByLevel = logger.error;\n break;\n case \"warning\":\n loggerByLevel = logger.warn;\n break;\n default:\n loggerByLevel = logger.info;\n }\n loggerByLevel(message, this.contextToData(captureContext));\n };\n this.startSpan = (spanOptions, callback) => {\n const { panoramaClient } = this.options;\n const { name } = spanOptions;\n let res;\n const transaction = panoramaClient.transaction(name, {\n id: generateRandomId()\n });\n const data = this.contextToData(spanOptions);\n transaction.start(data);\n try {\n res = callback();\n if (isPromise(res)) {\n res = res.then((_res) => {\n transaction.finish(data);\n return _res;\n }).catch((e) => {\n this.reportErrorInContextOfSpan(e, spanOptions);\n throw e;\n });\n } else {\n transaction.finish(data);\n }\n } catch (e) {\n this.reportErrorInContextOfSpan(e, spanOptions);\n throw e;\n }\n return res;\n };\n this.addBreadcrumb = (breadcrumb) => {\n const { panoramaClient } = this.options;\n panoramaClient.errorMonitor().addBreadcrumb(breadcrumb);\n };\n }\n contextToData(captureContext) {\n return captureContext && {\n ...captureContext?.tags && { tags: captureContext.tags },\n ...captureContext?.contexts && { context: captureContext.contexts },\n ...captureContext?.level && {\n severity: captureContext.level\n }\n };\n }\n reportErrorInContextOfSpan(error, spanOptions) {\n const { panoramaClient } = this.options;\n const { name } = spanOptions;\n const data = this.contextToData({\n ...spanOptions,\n contexts: { transaction: { name } }\n });\n panoramaClient.errorMonitor().reportError(error, data);\n }\n startSpanManual(spanOptions) {\n const { panoramaClient } = this.options;\n const { name } = spanOptions;\n const transaction = panoramaClient.transaction(name, {\n id: generateRandomId()\n });\n const data = this.contextToData(spanOptions);\n transaction.start(data);\n let reported = false;\n const reportOnce = (cb) => {\n if (reported) {\n return;\n }\n reported = true;\n cb();\n };\n return {\n end: () => {\n reportOnce(() => transaction.finish(data));\n },\n fail: (error) => {\n reportOnce(() => this.reportErrorInContextOfSpan(error, spanOptions));\n }\n };\n }\n endSpanManual(spanOptions) {\n const { panoramaClient } = this.options;\n const { name } = spanOptions;\n panoramaClient.transaction(name).finish();\n }\n};\n\n// src/factory.ts\nimport { createFallbackMonitoringClient } from \"@wix/monitoring\";\nvar createPanoramaBrowserClient = (options) => {\n const { panoramaClient } = options;\n if (!panoramaClient) {\n return createFallbackMonitoringClient(\"Missing Panorama client\");\n }\n return new PanoramaBrowserClient(options);\n};\nexport {\n createPanoramaBrowserClient\n};\n","// src/monitoring-client.ts\nimport { createFallbackMonitoringClient } from \"@wix/monitoring\";\nimport { createSentryBrowserClient } from \"@wix/monitoring-browser-sentry\";\nimport {\n createPanoramaBrowserClient\n} from \"@wix/monitoring-browser-panorama\";\nvar isSentryConfig = (monitoringConfig) => monitoringConfig?.type === \"SENTRY\";\nvar isPanoramaConfig = (monitoringConfig) => monitoringConfig?.type === \"PANORAMA\";\nvar getMonitoringClientFunction = ({\n sentrySDK,\n sentryTransport,\n panoramaClient,\n monitoringConfig,\n hostContext\n}) => {\n if (isSentryConfig(monitoringConfig)) {\n const { sentryOptions } = monitoringConfig;\n return () => createSentryBrowserClient({\n dsn: sentryOptions?.dsn,\n hostContext,\n sentrySDK,\n transport: sentryTransport\n });\n } else if (isPanoramaConfig(monitoringConfig)) {\n return () => createPanoramaBrowserClient({ panoramaClient });\n }\n return () => createFallbackMonitoringClient(\n \"Invalid monitoring configuration. Please check the monitoring setup of your application.\"\n );\n};\nexport {\n getMonitoringClientFunction\n};\n"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,mBACpB,SAASC,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,OAAON,EAAW,OAAW,IACzBA,EAAW,OACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,OAC3B,OACRO,EAAiB,OAAO,YAAgB,IACxC,YAAY,eACZ,OAAOP,EAAW,eAAmB,IACjCA,EAAW,eACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,eAC3B,OACd,GAAI,GAACM,GAAoB,CAACC,GAG1B,MAAO,CACH,eAAeC,EAAYJ,EAAU,CACjC,GAAIA,EAAU,CACV,GAAI,CAACG,EACD,MAAM,IAAI,MAAM,2JAA2J,EAE/K,OAAOF,EAAkB,IAAME,EAAe,IAAIC,CAAU,CAAC,CACjE,CACA,GAAI,CAACF,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOD,EAAkB,IAAMC,EAAiB,IAAIE,CAAU,CAAC,CACnE,EACA,cAAe,CAACC,EAAcC,IAAgB,CAC1C,GAAI,CAACJ,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,cAAcG,EAAcC,CAAW,CACnE,EACA,MAAM,QAAQC,EAAOC,EAAWC,EAAM,C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C,CACtE,CACF,CACF,CACA,cAAcA,EAAa,CACzB,GAAM,CAAE,eAAAJ,CAAe,EAAI,KAAK,QAC1B,CAAE,KAAAM,CAAK,EAAIF,EACjBJ,EAAe,YAAYM,CAAI,EAAE,OAAO,CAC1C,CACF,EAIIY,EAA+BrB,GAAY,CAC7C,GAAM,CAAE,eAAAG,CAAe,EAAIH,EAC3B,OAAKG,EAGE,IAAIJ,EAAsBC,CAAO,EAF/BsB,EAA+B,yBAAyB,CAGnE,ECjHA,IAAIC,EAAkBC,GAAqBA,GAAkB,OAAS,SAClEC,EAAoBD,GAAqBA,GAAkB,OAAS,WACpEE,GAA8B,CAAC,CACjC,UAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,iBAAAL,EACA,YAAAM,CACF,IAAM,CACJ,GAAIP,EAAeC,CAAgB,EAAG,CACpC,GAAM,CAAE,cAAAO,CAAc,EAAIP,EAC1B,MAAO,IAAMQ,EAA0B,CACrC,IAAKD,GAAe,IACpB,YAAAD,EACA,UAAAH,EACA,UAAWC,CACb,CAAC,CACH,SAAWH,EAAiBD,CAAgB,EAC1C,MAAO,IAAMS,EAA4B,CAAE,eAAAJ,CAAe,CAAC,EAE7D,MAAO,IAAMK,EACX,0FACF,CACF","names":["wixContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext","contextualizeHostModuleV2","hostModule","props","prop","args","context","resolveContext","createHostModule","hostModuleAPI","contextualizeHostModuleV2","host","acc","key","fn","FallbackMonitoringClient","message","spanOptions","callback","createFallbackMonitoringClient","validValue","value","pickByValidValues","obj","pickBy","object","predicate","result","key","generateTagsAndContext","context","tags","contexts","FallbackMonitoringClient","message","spanOptions","callback","createFallbackMonitoringClient","isPromise","value","runWithMaybePromise","cb","res","runWithMaybeDelay","maybeTimeCompensation","generateRandomId","ManualSpanRegistryImpl","options","spanOptions","sentryOptionsOrPromise","resolveSpan","rejectSpan","error","startTime","maybeDurationCompensation","maybePromise","sentrySDK","scope","isPromise2","resolve","reject","e","endSpan","span","_error","createManualSpanRegistry","setTagsAndContextsOnScope","scope","tags","contexts","key","value","setHostContextOnScope","hostContext","generateTagsAndContext","MandatorySDKMethods","manualSpanRegistryMap","AbstractSentryBrowserClient","options","missingSDKMethods","method","manualSpanRegistry","createManualSpanRegistry","sentrySDK","transport","dsn","release","environment","tracesSampleRate","debug","sentryClient","handler","resolve","resolvedState","SentryBrowserClient","breadcrumb","filteredBreadcrumb","error","captureContext","message","spanOptions","callback","simulateAndReportSuccessfulSpan","callbackResult2","startTime2","spanDuration","simulatedCallback","simulateAndReportFailedSpan","error2","_","reject","e","startTime","callbackResult","isPromise","res","resolvedStateOrPromise","unsupportedEnvironmentMessage","version","major","createSentryBrowserClient","createFallbackMonitoringClient","sentrySdkMajorVersion","FallbackMonitoringClient","message","spanOptions","callback","createFallbackMonitoringClient","PanoramaBrowserClient","options","error","captureContext","panoramaClient","message","logger","loggerByLevel","spanOptions","callback","name","res","transaction","generateRandomId","data","isPromise","_res","e","breadcrumb","reported","reportOnce","cb","createPanoramaBrowserClient","createFallbackMonitoringClient","isSentryConfig","monitoringConfig","isPanoramaConfig","getMonitoringClientFunction","sentrySDK","sentryTransport","panoramaClient","hostContext","sentryOptions","createSentryBrowserClient","createPanoramaBrowserClient","createFallbackMonitoringClient"]}
@@ -1,2 +1,2 @@
1
- import{c as g}from"./chunk-42XIZ4MH.js";import{a as A,b as M,d as R}from"./chunk-7EYXEF6M.js";import{f as H}from"./chunk-SBZEOPXX.js";R();import{wixContext as G}from"@wix/sdk-context";var F=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}`)}},I=e=>s=>async n=>{let d,r=t=>{if(d=e(n)(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:a,params:p}=d;return{...d,method:F(i),url:a,data:d.data,params:p}};try{let t=await s.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],a=t.data;return i.forEach(p=>{p&&(a=p(t.data,t.headers))}),a}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}},U=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var j="__metadata",x="www.wixapis.com";var _=class extends Error{constructor(n,d){super(n);H(this,"message");H(this,"response");this.message=n,this.response=d}async details(){let n=await this.response.json();return X(this.response.status,n?.message,n?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:n})}},X=(e,s,n,d)=>({details:{...!n?.validationError&&{applicationError:{description:s,code:e,data:d}},...n},message:s,requestId:d?.requestId});var S=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},W=e=>e&&typeof e=="object"&&!Array.isArray(e);var L=e=>e.__type==="host";function $(e,s){return e.create(s)}var V="x-wix-bi-gateway";function q(e,s,n){return{[V]:Y({environment:`js-sdk${n?`-${n}`:""}`,"package-name":e.packageName??s?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function Y(e){return Object.entries(e).filter(([s,n])=>!!n).map(([s,n])=>`${s}=${n}`).join(",")}function J(e,s,n,d,r,t,i){return g(()=>e({request:async a=>{let p=a({host:t?.HTTPHost||x}),c=p;c.method==="GET"&&c.fallback?.length&&c.params.toString().length>4e3&&(c=p.fallback[0]);let E=`https://${t?.HTTPHost??x}${c.url}`;c.params&&c.params.toString()&&(E+=`?${c.params.toString()}`);try{let u=q(p,s,i),o=await n(E,{method:c.method,...c.data&&{body:JSON.stringify(c.data)},headers:{...u}});if(o.status!==200){let h=null;try{h=await o.json()}catch{}throw z(o.status,h?.message,h?.details,{requestId:o.headers.get("X-Wix-Request-Id"),details:h})}return{data:await o.json(),headers:o.headers,status:o.status,statusText:o.statusText}}catch(u){throw u.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),u}},fetchWithAuth:n,wixAPIFetch:d,getActiveToken:r}))}var z=(e,s,n,d)=>({response:{data:{details:{...!n?.validationError&&{applicationError:{description:s,code:e,data:d}},...n},message:s},status:e},responseId:d?.requestId});R();function v(){return{emit(e,...s){for(let n=0,d=this.events[e]||[],r=d.length;n<r;n++)d[n](...s)},events:{},on(e,s){return(this.events[e]||=[]).push(s),()=>{this.events[e]=this.events[e]?.filter(n=>s!==n)}}}}var N=e=>e.__type==="event-definition";function O(e,s,n,d){let r;if(e.isDomainEvent){let i=n,{deletedEvent:a,actionEvent:p,createdEvent:c,updatedEvent:f,...E}=i,u={...d,...E};a?a?.deletedEntity?r={entity:a?.deletedEntity,metadata:u}:r={metadata:u}:p?r={data:p.body,metadata:u}:r={entity:c?.entity??f?.currentEntity,metadata:u}}else r={data:n,metadata:d};let t=e.transformations??(i=>i);return s(t(r))}function k(e){let s=new Map,n=v(),d={...n,getRegisteredEvents:()=>s,async process(r,t={expectedEvents:[]}){let{eventType:i,identity:a,instanceId:p,payload:c}=await this.parseJWT(r),f=[...t.expectedEvents,...Array.from(s.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 E=s.get(i)??[];return await Promise.all(E.map(({eventDefinition:u,handler:o})=>O(u,o,c,{instanceId:p,identity:a}))),{instanceId:p,eventType:i,payload:c,identity:a}},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 a=JSON.parse(t.data),p=a.eventType,c=a.instanceId,f=a.identity?JSON.parse(a.identity):void 0,E=JSON.parse(a.data);return{instanceId:c,eventType:p,payload:E,identity:f}},async parseRequest(r){let t=await r.text();return this.parseJWT(t)},async executeHandlers(r){let t=Array.from(s.keys()).map(a=>({type:a}));if(t.length>0&&!t.some(({type:a})=>a===r.eventType))throw new Error(`Unexpected event type: ${r.eventType}. Expected one of: ${t.map(a=>a.type).join(", ")}`);let i=s.get(r.eventType)??[];await Promise.all(i.map(({eventDefinition:a,handler:p})=>O(a,p,r.payload,{instanceId:r.instanceId,identity:r.identity})))},apps:{AppInstalled:A("AppInstalled")(),AppRemoved:A("AppRemoved")()}};return{initModule(r){return t=>{let i=s.get(r.type)??[];i.push({eventDefinition:r,handler:t}),s.set(r.type,i),n.emit("registered",r)}},client:d}}var B=e=>e.__type==="service-plugin-definition";function D(e){let s=new Map,n=v(),d={...n,getRegisteredServicePlugins:()=>s,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 a=await this.process({url:t,body:i});return Response.json(a)}catch(a){if(a.errorType==="SPI"&&a.applicationCode&&a.httpCode)return Response.json({applicationError:{code:a.applicationCode,data:a.data}},{status:a.httpCode});throw a}},async executeHandler(r,t){let i=r.metadata.appExtensionType.toLowerCase(),a=s.get(i)??[];if(a.length===0)throw new Error(`No service plugin implementations found for component type ${i}`);if(a.length>1)throw new Error(`Multiple service plugin implementations found for component type ${i}. This is currently not supported`);let{implementation:p,servicePluginDefinition:c}=a[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 E=p[f.name];if(!E)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 E(f.transformations.fromREST(r)))}};return{initModule(r){return t=>{let i=s.get(r.componentType.toLowerCase())??[];i.push({servicePluginDefinition:r,implementation:t}),s.set(r.componentType.toLowerCase(),i),n.emit("registered",r)}},client:d}}var T="X-Wix-Consistent";function He(e){let s=e.headers||{Authorization:""},n=e.auth||{getAuthHeaders:o=>Promise.resolve({headers:{}})},d=n.getAuthHeaders.bind(void 0,e.host);n.getAuthHeaders=d;let r=async(o,l)=>{let h=await d(),m={...l?.headers??{},...h.headers,...s[T]?{[T]:s[T]}:{}};if(typeof o=="string"||o instanceof URL){let y=await fetch(o,{...l,headers:m}),w=P(y);return w&&(s[T]=w),y}else{for(let[b,C]of Object.entries(m))typeof C=="string"&&o.headers.set(b,C);let y=await fetch(o,l),w=P(y);return w&&(s[T]=w),y}},{client:t,initModule:i}=D(n),{client:a,initModule:p}=k(n),c=async(o,l)=>{let h=await d(),m=S(l),y=await fetch(o,{...l,headers:{...m,...s,...h?.headers,...l?.headers,...e.host?.essentials?.passThroughHeaders}}),w=P(y);return w&&(s[T]=w),y},f=(o,l)=>{if(N(o))return p(o);if(B(o))return i(o);if(L(o)&&e.host)return $(o,e.host);if(typeof o=="function"){if("__type"in o&&o.__type===M)return o;let h=e.host?.apiBaseUrl??x;return J(g(()=>U(o))?I(o):o,l??{},c,(m,y)=>{let w=new URL(m,`https://${h}`);return w.host=h,w.protocol="https",c(w.toString(),y)},n.getActiveToken,{HTTPHost:h},e.host?.name)}else return W(o)?Object.fromEntries(Object.entries(o).map(([h,m])=>[h,f(m,o[j])])):o},E=o=>{for(let l in o)s[l]=o[l]};return{...e.modules?f(e.modules):{},auth:n,setHeaders:E,use:f,enableContext(o,l={elevated:!1}){o==="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?G.elevatedClient=this:G.client=this},fetch:(o,l)=>{let h=e.host?.apiBaseUrl??x,m=new URL(o,`https://${h}`);return m.host=h,m.protocol="https",c(m.toString(),l)},fetchWithAuth:r,async graphql(o,l,h={apiVersion:"alpha"}){let m=e?.host?.apiBaseUrl??x,y=await c(`https://${m}/graphql/${h.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:o,variables:l})});if(y.status!==200)throw new _(`GraphQL request failed with status ${y.status}`,y);let{data:w,errors:b}=await y.json();return{data:w??{},errors:b}},webhooks:a,servicePlugins:t}}function P(e){return e.headers?.get(T)??e.headers?.get(T.toLowerCase())}export{He as a};
2
- //# sourceMappingURL=chunk-3WHQP2RD.js.map
1
+ import{b as g}from"./chunk-BGTZ3RNN.js";import{a as A,b as M,d as R}from"./chunk-7EYXEF6M.js";import{f as H}from"./chunk-SBZEOPXX.js";R();import{wixContext as G}from"@wix/sdk-context";var F=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}`)}},I=e=>s=>async n=>{let d,r=t=>{if(d=e(n)(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:a,params:p}=d;return{...d,method:F(i),url:a,data:d.data,params:p}};try{let t=await s.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],a=t.data;return i.forEach(p=>{p&&(a=p(t.data,t.headers))}),a}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}},U=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var j="__metadata",x="www.wixapis.com";var _=class extends Error{constructor(n,d){super(n);H(this,"message");H(this,"response");this.message=n,this.response=d}async details(){let n=await this.response.json();return X(this.response.status,n?.message,n?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:n})}},X=(e,s,n,d)=>({details:{...!n?.validationError&&{applicationError:{description:s,code:e,data:d}},...n},message:s,requestId:d?.requestId});var S=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},W=e=>e&&typeof e=="object"&&!Array.isArray(e);var L=e=>e.__type==="host";function $(e,s){return e.create(s)}var V="x-wix-bi-gateway";function q(e,s,n){return{[V]:Y({environment:`js-sdk${n?`-${n}`:""}`,"package-name":e.packageName??s?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function Y(e){return Object.entries(e).filter(([s,n])=>!!n).map(([s,n])=>`${s}=${n}`).join(",")}function J(e,s,n,d,r,t,i){return g(()=>e({request:async a=>{let p=a({host:t?.HTTPHost||x}),c=p;c.method==="GET"&&c.fallback?.length&&c.params.toString().length>4e3&&(c=p.fallback[0]);let E=`https://${t?.HTTPHost??x}${c.url}`;c.params&&c.params.toString()&&(E+=`?${c.params.toString()}`);try{let u=q(p,s,i),o=await n(E,{method:c.method,...c.data&&{body:JSON.stringify(c.data)},headers:{...u}});if(o.status!==200){let h=null;try{h=await o.json()}catch{}throw z(o.status,h?.message,h?.details,{requestId:o.headers.get("X-Wix-Request-Id"),details:h})}return{data:await o.json(),headers:o.headers,status:o.status,statusText:o.statusText}}catch(u){throw u.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),u}},fetchWithAuth:n,wixAPIFetch:d,getActiveToken:r}))}var z=(e,s,n,d)=>({response:{data:{details:{...!n?.validationError&&{applicationError:{description:s,code:e,data:d}},...n},message:s},status:e},responseId:d?.requestId});R();function v(){return{emit(e,...s){for(let n=0,d=this.events[e]||[],r=d.length;n<r;n++)d[n](...s)},events:{},on(e,s){return(this.events[e]||=[]).push(s),()=>{this.events[e]=this.events[e]?.filter(n=>s!==n)}}}}var N=e=>e.__type==="event-definition";function O(e,s,n,d){let r;if(e.isDomainEvent){let i=n,{deletedEvent:a,actionEvent:p,createdEvent:c,updatedEvent:f,...E}=i,u={...d,...E};a?a?.deletedEntity?r={entity:a?.deletedEntity,metadata:u}:r={metadata:u}:p?r={data:p.body,metadata:u}:r={entity:c?.entity??f?.currentEntity,metadata:u}}else r={data:n,metadata:d};let t=e.transformations??(i=>i);return s(t(r))}function k(e){let s=new Map,n=v(),d={...n,getRegisteredEvents:()=>s,async process(r,t={expectedEvents:[]}){let{eventType:i,identity:a,instanceId:p,payload:c}=await this.parseJWT(r),f=[...t.expectedEvents,...Array.from(s.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 E=s.get(i)??[];return await Promise.all(E.map(({eventDefinition:u,handler:o})=>O(u,o,c,{instanceId:p,identity:a}))),{instanceId:p,eventType:i,payload:c,identity:a}},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 a=JSON.parse(t.data),p=a.eventType,c=a.instanceId,f=a.identity?JSON.parse(a.identity):void 0,E=JSON.parse(a.data);return{instanceId:c,eventType:p,payload:E,identity:f}},async parseRequest(r){let t=await r.text();return this.parseJWT(t)},async executeHandlers(r){let t=Array.from(s.keys()).map(a=>({type:a}));if(t.length>0&&!t.some(({type:a})=>a===r.eventType))throw new Error(`Unexpected event type: ${r.eventType}. Expected one of: ${t.map(a=>a.type).join(", ")}`);let i=s.get(r.eventType)??[];await Promise.all(i.map(({eventDefinition:a,handler:p})=>O(a,p,r.payload,{instanceId:r.instanceId,identity:r.identity})))},apps:{AppInstalled:A("AppInstalled")(),AppRemoved:A("AppRemoved")()}};return{initModule(r){return t=>{let i=s.get(r.type)??[];i.push({eventDefinition:r,handler:t}),s.set(r.type,i),n.emit("registered",r)}},client:d}}var B=e=>e.__type==="service-plugin-definition";function D(e){let s=new Map,n=v(),d={...n,getRegisteredServicePlugins:()=>s,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 a=await this.process({url:t,body:i});return Response.json(a)}catch(a){if(a.errorType==="SPI"&&a.applicationCode&&a.httpCode)return Response.json({applicationError:{code:a.applicationCode,data:a.data}},{status:a.httpCode});throw a}},async executeHandler(r,t){let i=r.metadata.appExtensionType.toLowerCase(),a=s.get(i)??[];if(a.length===0)throw new Error(`No service plugin implementations found for component type ${i}`);if(a.length>1)throw new Error(`Multiple service plugin implementations found for component type ${i}. This is currently not supported`);let{implementation:p,servicePluginDefinition:c}=a[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 E=p[f.name];if(!E)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 E(f.transformations.fromREST(r)))}};return{initModule(r){return t=>{let i=s.get(r.componentType.toLowerCase())??[];i.push({servicePluginDefinition:r,implementation:t}),s.set(r.componentType.toLowerCase(),i),n.emit("registered",r)}},client:d}}var T="X-Wix-Consistent";function He(e){let s=e.headers||{Authorization:""},n=e.auth||{getAuthHeaders:o=>Promise.resolve({headers:{}})},d=n.getAuthHeaders.bind(void 0,e.host);n.getAuthHeaders=d;let r=async(o,l)=>{let h=await d(),m={...l?.headers??{},...h.headers,...s[T]?{[T]:s[T]}:{}};if(typeof o=="string"||o instanceof URL){let y=await fetch(o,{...l,headers:m}),w=P(y);return w&&(s[T]=w),y}else{for(let[b,C]of Object.entries(m))typeof C=="string"&&o.headers.set(b,C);let y=await fetch(o,l),w=P(y);return w&&(s[T]=w),y}},{client:t,initModule:i}=D(n),{client:a,initModule:p}=k(n),c=async(o,l)=>{let h=await d(),m=S(l),y=await fetch(o,{...l,headers:{...m,...s,...h?.headers,...l?.headers,...e.host?.essentials?.passThroughHeaders}}),w=P(y);return w&&(s[T]=w),y},f=(o,l)=>{if(N(o))return p(o);if(B(o))return i(o);if(L(o)&&e.host)return $(o,e.host);if(typeof o=="function"){if("__type"in o&&o.__type===M)return o;let h=e.host?.apiBaseUrl??x;return J(g(()=>U(o))?I(o):o,l??{},c,(m,y)=>{let w=new URL(m,`https://${h}`);return w.host=h,w.protocol="https",c(w.toString(),y)},n.getActiveToken,{HTTPHost:h},e.host?.name)}else return W(o)?Object.fromEntries(Object.entries(o).map(([h,m])=>[h,f(m,o[j])])):o},E=o=>{for(let l in o)s[l]=o[l]};return{...e.modules?f(e.modules):{},auth:n,setHeaders:E,use:f,enableContext(o,l={elevated:!1}){o==="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?G.elevatedClient=this:G.client=this},fetch:(o,l)=>{let h=e.host?.apiBaseUrl??x,m=new URL(o,`https://${h}`);return m.host=h,m.protocol="https",c(m.toString(),l)},fetchWithAuth:r,async graphql(o,l,h={apiVersion:"alpha"}){let m=e?.host?.apiBaseUrl??x,y=await c(`https://${m}/graphql/${h.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:o,variables:l})});if(y.status!==200)throw new _(`GraphQL request failed with status ${y.status}`,y);let{data:w,errors:b}=await y.json();return{data:w??{},errors:b}},webhooks:a,servicePlugins:t}}function P(e){return e.headers?.get(T)??e.headers?.get(T.toLowerCase())}export{He as a};
2
+ //# sourceMappingURL=chunk-MM2KVUBI.js.map
@@ -1,2 +1,2 @@
1
- import{a as N,b as q}from"./chunk-7LWEMZNS.js";import{a as K}from"./chunk-3WHQP2RD.js";import"./chunk-42XIZ4MH.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function U(){return U=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},U.apply(null,arguments)}import He,{useEffect as Le,useState as ge}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 J(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 G(e){var t=J(e,"string");return w(t)=="symbol"?t:t+""}function Q(e,t,n){return(t=G(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),Q(this,"code",void 0),this.message=n,this.code=r}};var $=()=>{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 X=e=>{let{createHost:t}=e,n=$();return{...N(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var Z=Symbol("Comlink.proxy"),ye=Symbol("Comlink.endpoint"),D=Symbol("Comlink.releaseProxy"),L=Symbol("Comlink.thrown"),ee=e=>typeof e=="object"&&e!==null||typeof e=="function",be={canHandle:e=>ee(e)&&e[Z],serialize(e){let{port1:t,port2:n}=new MessageChannel;return _(e,t),[n,[n]]},deserialize(e){return e.start(),B(e)}},we={canHandle:e=>ee(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}},te=new Map([["proxy",be],["throw",we]]);function _(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:s,type:a,path:c}=Object.assign({path:[]},r.data),i=(r.data.argumentList||[]).map(P),l;try{let d=c.slice(0,-1).reduce((m,b)=>m[b],e),p=c.reduce((m,b)=>m[b],e);switch(a){case 0:l=p;break;case 1:d[c.slice(-1)[0]]=P(r.data.value),l=!0;break;case 2:l=p.apply(d,i);break;case 3:{let m=new p(...i);l=k(m)}break;case 4:{let{port1:m,port2:b}=new MessageChannel;_(e,b),l=ve(m,[m])}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[p,m]=W(d);t.postMessage(Object.assign(Object.assign({},p),{id:s}),m),a===5&&(t.removeEventListener("message",n),ne(t))})}),t.start&&t.start()}function Pe(e){return e.constructor.name==="MessagePort"}function ne(e){Pe(e)&&e.close()}function B(e,t){return R(e,[],t)}function C(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(a,c){if(C(r),c===D)return()=>v(e,{type:5,path:t.map(i=>i.toString())}).then(()=>{ne(e),r=!0});if(c==="then"){if(t.length===0)return{then:()=>s};let i=v(e,{type:0,path:t.map(l=>l.toString())}).then(P);return i.then.bind(i)}return R(e,[...t,c])},set(a,c,i){C(r);let[l,d]=W(i);return v(e,{type:1,path:[...t,c].map(p=>p.toString()),value:l},d).then(P)},apply(a,c,i){C(r);let l=t[t.length-1];if(l===ye)return v(e,{type:4}).then(P);if(l==="bind")return R(e,t.slice(0,-1));let[d,p]=Y(i);return v(e,{type:2,path:t.map(m=>m.toString()),argumentList:d},p).then(P)},construct(a,c){C(r);let[i,l]=Y(c);return v(e,{type:3,path:t.map(d=>d.toString()),argumentList:i},l).then(P)}});return s}function xe(e){return Array.prototype.concat.apply([],e)}function Y(e){let t=e.map(W);return[t.map(n=>n[0]),xe(t.map(n=>n[1]))]}var re=new WeakMap;function ve(e,t){return re.set(e,t),e}function k(e){return Object.assign(e,{[Z]:!0})}function W(e){for(let[t,n]of te)if(n.canHandle(e)){let[r,s]=n.serialize(e);return[{type:3,name:t,value:r},s]}return[{type:0,value:e},re.get(e)||[]]}function P(e){switch(e.type){case 3:return te.get(e.name).deserialize(e.value);case 0:return e.value}}function v(e,t,n){return new Promise(r=>{let s=Me();e.addEventListener("message",function a(c){!c.data||!c.data.id||c.data.id!==s||(e.removeEventListener("message",a),r(c.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),n)})}function Me(){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__",se=e=>Se(e,t=>async function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];let[a,c]=j(r),i=await t(k(a),c);return ae(i)});var Ee=async e=>{let[t,n]=j(await e);return k({proxies:t,clonables:n})},ae=async e=>H(e?.proxies,await e?.clonables),j=e=>{let t=(s,a)=>{if(ie(a)){let c=oe();return s.promises[c]=a,{[I]:c}}if(ke(a)){let c=oe();return s.callbacks[c]=(i,l)=>{let d=H(i,l),p=a(...d);return Ee(p)},{[T]:c}}return Array.isArray(a)?a.map(c=>t(s,c)):O(a)?ce(a,c=>t(s,c)):a},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),a=0;a<r;a++)s[a]=arguments[a];let[c,i]=j(s),l=await e.callbacks[n](k(c),i);return ae(l)}}return O(t)?ce(t,n=>H(e,n)):t},Se=(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}`)}}}),ie=e=>e instanceof Promise,O=e=>e&&typeof e=="object"&&!ie(e),ke=e=>typeof e=="function",ce=(e,t)=>{let n=r=>{let[s,a]=r;return[s,t(a)]};return Object.fromEntries(Object.entries(e).map(n))},oe=(()=>{let e=0;return()=>++e})();var Ae="wix-sdk-bo-hello-handshake",ue=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:s}=new MessageChannel;t({code:Ae,version:"1.0.0",port:s},n,[s]);let i=se(B(r));return{channel:i,close:()=>i[D]()}};var le=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var Ue=["https://manage.wix.com","https://manage.editorx.com"],Ce=new Set(Ue),de=e=>Ce.has(e);var fe=e=>{let t=new EventTarget,n=typeof window>"u",r=i=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(i.preventDefault(),i.returnValue=!0)},s=e.onBeforeUnload(r),a=()=>{n||window.removeEventListener("beforeunload",r),s.then(i=>{let{remove:l}=i;return l()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",a)),{onBeforeUnload:i=>(t.addEventListener("beforeunload",i),{remove:()=>{t.removeEventListener("beforeunload",i)}}),clearBeforeUnloadHandler:a}};function Oe(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 me(e){return e.has("essentials")?Oe(e.get("essentials")):void 0}var pe=function(e){e===void 0&&(e={});let t=e.fullUrl&&new URL(e.fullUrl).search||typeof window<"u"&&window.location.search||"",n=new URLSearchParams(t),r=e.origin||n.get("origin")||"",s=e.postMessage||window.parent.postMessage.bind(window.parent);if(!de(r))throw new Error("Wix Dashboard SDK: Unable to establish a connection with the Wix dashboard. Please ensure that you are running your app within the Wix dashboard.");let{channel:a,close:c}=ue({postMessage:s,origin:r}),i=[c];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let x=e.autoHeightElement||document.documentElement,M=le(a,x);i.push(()=>M())}let{onBeforeUnload:l,clearBeforeUnloadHandler:d}=fe(a);i.push(d);let p=new Proxy(a,{get(x,M,F){return M==="onBeforeUnload"?l:Reflect.get(x,M,F)}}),{monitoring:m,...b}=me(n)||{},V=q({hostContext:m?.context,monitoringConfig:m?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{channel:p,close:()=>i.forEach(x=>x()),getMonitoringClient:V,essentials:b}};var z=X({createHost:pe});var he=(e,t)=>{let[n,r]=ge(()=>e());return t(n)&&r(e()),n},Re=e=>t=>{let{host:n,compProps:r}=De(t);return he(()=>(K({auth:z.auth(),host:n}).enableContext("module"),n),s=>s!==n),r?He.createElement(e,U({host:n},r)):null},De=e=>{let{host:t,...n}=e,{host:r,hostType:s}=he(()=>t?{host:t,hostType:"local"}:{host:z.host(),hostType:"remote"},i=>!!t&&t!==i.host),[a,c]=ge(void 0);return Le(()=>{if(s==="local")return;let i=r.channel.observeState(d=>{c(d||{})}),l=async()=>{(await i).disconnect(),r.close()};return()=>{l()}},[r,s]),s==="local"?{host:r,compProps:n}:{host:r,compProps:a?{...a,...n}:void 0}};export{Re as withContextualWixClient};
1
+ import{a as N,b as q}from"./chunk-LPGY6RYR.js";import{a as K}from"./chunk-MM2KVUBI.js";import"./chunk-BGTZ3RNN.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function U(){return U=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},U.apply(null,arguments)}import He,{useEffect as Le,useState as ge}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 J(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 G(e){var t=J(e,"string");return w(t)=="symbol"?t:t+""}function Q(e,t,n){return(t=G(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),Q(this,"code",void 0),this.message=n,this.code=r}};var $=()=>{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 X=e=>{let{createHost:t}=e,n=$();return{...N(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var Z=Symbol("Comlink.proxy"),ye=Symbol("Comlink.endpoint"),D=Symbol("Comlink.releaseProxy"),L=Symbol("Comlink.thrown"),ee=e=>typeof e=="object"&&e!==null||typeof e=="function",be={canHandle:e=>ee(e)&&e[Z],serialize(e){let{port1:t,port2:n}=new MessageChannel;return _(e,t),[n,[n]]},deserialize(e){return e.start(),B(e)}},we={canHandle:e=>ee(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}},te=new Map([["proxy",be],["throw",we]]);function _(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:s,type:a,path:c}=Object.assign({path:[]},r.data),i=(r.data.argumentList||[]).map(P),l;try{let d=c.slice(0,-1).reduce((m,b)=>m[b],e),p=c.reduce((m,b)=>m[b],e);switch(a){case 0:l=p;break;case 1:d[c.slice(-1)[0]]=P(r.data.value),l=!0;break;case 2:l=p.apply(d,i);break;case 3:{let m=new p(...i);l=k(m)}break;case 4:{let{port1:m,port2:b}=new MessageChannel;_(e,b),l=ve(m,[m])}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[p,m]=W(d);t.postMessage(Object.assign(Object.assign({},p),{id:s}),m),a===5&&(t.removeEventListener("message",n),ne(t))})}),t.start&&t.start()}function Pe(e){return e.constructor.name==="MessagePort"}function ne(e){Pe(e)&&e.close()}function B(e,t){return R(e,[],t)}function C(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(a,c){if(C(r),c===D)return()=>v(e,{type:5,path:t.map(i=>i.toString())}).then(()=>{ne(e),r=!0});if(c==="then"){if(t.length===0)return{then:()=>s};let i=v(e,{type:0,path:t.map(l=>l.toString())}).then(P);return i.then.bind(i)}return R(e,[...t,c])},set(a,c,i){C(r);let[l,d]=W(i);return v(e,{type:1,path:[...t,c].map(p=>p.toString()),value:l},d).then(P)},apply(a,c,i){C(r);let l=t[t.length-1];if(l===ye)return v(e,{type:4}).then(P);if(l==="bind")return R(e,t.slice(0,-1));let[d,p]=Y(i);return v(e,{type:2,path:t.map(m=>m.toString()),argumentList:d},p).then(P)},construct(a,c){C(r);let[i,l]=Y(c);return v(e,{type:3,path:t.map(d=>d.toString()),argumentList:i},l).then(P)}});return s}function xe(e){return Array.prototype.concat.apply([],e)}function Y(e){let t=e.map(W);return[t.map(n=>n[0]),xe(t.map(n=>n[1]))]}var re=new WeakMap;function ve(e,t){return re.set(e,t),e}function k(e){return Object.assign(e,{[Z]:!0})}function W(e){for(let[t,n]of te)if(n.canHandle(e)){let[r,s]=n.serialize(e);return[{type:3,name:t,value:r},s]}return[{type:0,value:e},re.get(e)||[]]}function P(e){switch(e.type){case 3:return te.get(e.name).deserialize(e.value);case 0:return e.value}}function v(e,t,n){return new Promise(r=>{let s=Me();e.addEventListener("message",function a(c){!c.data||!c.data.id||c.data.id!==s||(e.removeEventListener("message",a),r(c.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),n)})}function Me(){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__",se=e=>Se(e,t=>async function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];let[a,c]=j(r),i=await t(k(a),c);return ae(i)});var Ee=async e=>{let[t,n]=j(await e);return k({proxies:t,clonables:n})},ae=async e=>H(e?.proxies,await e?.clonables),j=e=>{let t=(s,a)=>{if(ie(a)){let c=oe();return s.promises[c]=a,{[I]:c}}if(ke(a)){let c=oe();return s.callbacks[c]=(i,l)=>{let d=H(i,l),p=a(...d);return Ee(p)},{[T]:c}}return Array.isArray(a)?a.map(c=>t(s,c)):O(a)?ce(a,c=>t(s,c)):a},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),a=0;a<r;a++)s[a]=arguments[a];let[c,i]=j(s),l=await e.callbacks[n](k(c),i);return ae(l)}}return O(t)?ce(t,n=>H(e,n)):t},Se=(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}`)}}}),ie=e=>e instanceof Promise,O=e=>e&&typeof e=="object"&&!ie(e),ke=e=>typeof e=="function",ce=(e,t)=>{let n=r=>{let[s,a]=r;return[s,t(a)]};return Object.fromEntries(Object.entries(e).map(n))},oe=(()=>{let e=0;return()=>++e})();var Ae="wix-sdk-bo-hello-handshake",ue=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:s}=new MessageChannel;t({code:Ae,version:"1.0.0",port:s},n,[s]);let i=se(B(r));return{channel:i,close:()=>i[D]()}};var le=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var Ue=["https://manage.wix.com","https://manage.editorx.com"],Ce=new Set(Ue),de=e=>Ce.has(e);var fe=e=>{let t=new EventTarget,n=typeof window>"u",r=i=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(i.preventDefault(),i.returnValue=!0)},s=e.onBeforeUnload(r),a=()=>{n||window.removeEventListener("beforeunload",r),s.then(i=>{let{remove:l}=i;return l()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",a)),{onBeforeUnload:i=>(t.addEventListener("beforeunload",i),{remove:()=>{t.removeEventListener("beforeunload",i)}}),clearBeforeUnloadHandler:a}};function Oe(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 me(e){return e.has("essentials")?Oe(e.get("essentials")):void 0}var pe=function(e){e===void 0&&(e={});let t=e.fullUrl&&new URL(e.fullUrl).search||typeof window<"u"&&window.location.search||"",n=new URLSearchParams(t),r=e.origin||n.get("origin")||"",s=e.postMessage||window.parent.postMessage.bind(window.parent);if(!de(r))throw new Error("Wix Dashboard SDK: Unable to establish a connection with the Wix dashboard. Please ensure that you are running your app within the Wix dashboard.");let{channel:a,close:c}=ue({postMessage:s,origin:r}),i=[c];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let x=e.autoHeightElement||document.documentElement,M=le(a,x);i.push(()=>M())}let{onBeforeUnload:l,clearBeforeUnloadHandler:d}=fe(a);i.push(d);let p=new Proxy(a,{get(x,M,F){return M==="onBeforeUnload"?l:Reflect.get(x,M,F)}}),{monitoring:m,...b}=me(n)||{},V=q({hostContext:m?.context,monitoringConfig:m?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{channel:p,close:()=>i.forEach(x=>x()),getMonitoringClient:V,essentials:b}};var z=X({createHost:pe});var he=(e,t)=>{let[n,r]=ge(()=>e());return t(n)&&r(e()),n},Re=e=>t=>{let{host:n,compProps:r}=De(t);return he(()=>(K({auth:z.auth(),host:n}).enableContext("module"),n),s=>s!==n),r?He.createElement(e,U({host:n},r)):null},De=e=>{let{host:t,...n}=e,{host:r,hostType:s}=he(()=>t?{host:t,hostType:"local"}:{host:z.host(),hostType:"remote"},i=>!!t&&t!==i.host),[a,c]=ge(void 0);return Le(()=>{if(s==="local")return;let i=r.channel.observeState(d=>{c(d||{})}),l=async()=>{(await i).disconnect(),r.close()};return()=>{l()}},[r,s]),s==="local"?{host:r,compProps:n}:{host:r,compProps:a?{...a,...n}:void 0}};export{Re as withContextualWixClient};
2
2
  //# sourceMappingURL=dashboard.js.map
@@ -1,4 +1,4 @@
1
- import{a as we,b as ve}from"./chunk-7LWEMZNS.js";import{a as Ie}from"./chunk-3WHQP2RD.js";import"./chunk-42XIZ4MH.js";import{c as He,d as Xe}from"./chunk-7EYXEF6M.js";import{b as ge,d as ye,e as Je,f as p,g as a,h,i as w,j as u}from"./chunk-SBZEOPXX.js";var be=ge(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.EventType=void 0;var Ee;(function(n){n.removeAppCompleted="removeAppCompleted",n.componentSelectionChanged="componentSelectionChanged",n.appInstalled="appInstalled",n.appUpdateCompleted="appUpdateCompleted"})(Ee||(pt.EventType=Ee={}))});var St=ge(m=>{"use strict";var Qe=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]}),Ze=m&&m.__setModuleDefault||(Object.create?function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}:function(n,t){n.default=t}),tn=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"&&Qe(e,t,i[s]);return Ze(e,t),e}}();Object.defineProperty(m,"__esModule",{value:!0});m.EventType=m.WixSDKTypes=void 0;var en=tn((Xe(),Je(He)));m.WixSDKTypes=en;var nn=be();Object.defineProperty(m,"EventType",{enumerable:!0,get:function(){return nn.EventType}})});var G=ye(St(),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 kt=N,ht=(n=>(n.WorkerSpawn="WorkerSpawn",n.HostEvent="HostEvent",n.ApplicationsSpecsReceived="ApplicationsSpecsReceived",n.InitApplicationApi="InitApplicationApi",n.RunApplication="RunApplication",n.getApplicationApi="getApplicationApi",n.IframeInit="IframeInit",n))(ht||{}),Ut=(n=>(n.EditorReady="EditorReady",n))(Ut||{});var v=(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))(v||{}),Lt=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:E.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:E.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:E.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:E.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},E=class extends kt{constructor(){super(...arguments);p(this,"factories",new Lt)}},lt=class lt{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ht.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);lt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};p(lt,"allowedEvents",[G.EventType.componentSelectionChanged,G.EventType.appInstalled,G.EventType.appUpdateCompleted,G.EventType.removeAppCompleted]);var Te=lt;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 we,b as ve}from"./chunk-LPGY6RYR.js";import{a as Ie}from"./chunk-MM2KVUBI.js";import"./chunk-BGTZ3RNN.js";import{c as He,d as Xe}from"./chunk-7EYXEF6M.js";import{b as ge,d as ye,e as Je,f as p,g as a,h,i as w,j as u}from"./chunk-SBZEOPXX.js";var be=ge(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.EventType=void 0;var Ee;(function(n){n.removeAppCompleted="removeAppCompleted",n.componentSelectionChanged="componentSelectionChanged",n.appInstalled="appInstalled",n.appUpdateCompleted="appUpdateCompleted"})(Ee||(pt.EventType=Ee={}))});var St=ge(m=>{"use strict";var Qe=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]}),Ze=m&&m.__setModuleDefault||(Object.create?function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}:function(n,t){n.default=t}),tn=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"&&Qe(e,t,i[s]);return Ze(e,t),e}}();Object.defineProperty(m,"__esModule",{value:!0});m.EventType=m.WixSDKTypes=void 0;var en=tn((Xe(),Je(He)));m.WixSDKTypes=en;var nn=be();Object.defineProperty(m,"EventType",{enumerable:!0,get:function(){return nn.EventType}})});var G=ye(St(),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 kt=N,ht=(n=>(n.WorkerSpawn="WorkerSpawn",n.HostEvent="HostEvent",n.ApplicationsSpecsReceived="ApplicationsSpecsReceived",n.InitApplicationApi="InitApplicationApi",n.RunApplication="RunApplication",n.getApplicationApi="getApplicationApi",n.IframeInit="IframeInit",n))(ht||{}),Ut=(n=>(n.EditorReady="EditorReady",n))(Ut||{});var v=(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))(v||{}),Lt=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:E.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:E.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:E.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:E.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},E=class extends kt{constructor(){super(...arguments);p(this,"factories",new Lt)}},lt=class lt{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ht.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);lt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};p(lt,"allowedEvents",[G.EventType.componentSelectionChanged,G.EventType.appInstalled,G.EventType.appUpdateCompleted,G.EventType.removeAppCompleted]);var Te=lt;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,[l,d])=>(d&&c.push(` \u2013 ${l}: ${d}`),c),[]).join(`
4
4
  `),i=this.messages.reduce((c,l)=>(c.push(` - ${l.join(" ")}`),c),[]).join(`
@@ -1,2 +1,2 @@
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 c=["wix.com","editorx.com"];var u=new RegExp(`\\.(${c.join("|")})$`),s=["42.wixprod.net","uw2-edt-1.wixprod.net"],a="dev.wix-code.com";var _=new RegExp(`\\.(${s.join("|")})$`),d=new RegExp(`.*\\.${a}$`);import{wixContext as f}from"@wix/sdk-context";function r(e,t){t==="global"?globalThis.__wix_context__!=null?globalThis.__wix_context__.client=e:globalThis.__wix_context__={client:e}:f.client=e}var E=o(e=>(t,i)=>e.fetchWithAuth(t,i));export{r as enableContext};
1
+ import{a as n}from"./chunk-BGTZ3RNN.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function o(e,t=!1){return n(e,t)}var c=["wix.com","editorx.com"];var u=new RegExp(`\\.(${c.join("|")})$`),s=["42.wixprod.net","uw2-edt-1.wixprod.net"],a="dev.wix-code.com";var _=new RegExp(`\\.(${s.join("|")})$`),d=new RegExp(`.*\\.${a}$`);import{wixContext as f}from"@wix/sdk-context";function r(e,t){t==="global"?globalThis.__wix_context__!=null?globalThis.__wix_context__.client=e:globalThis.__wix_context__={client:e}:f.client=e}var E=o(e=>(t,i)=>e.fetchWithAuth(t,i));export{r as enableContext};
2
2
  //# sourceMappingURL=sdk-context.js.map
@@ -1 +1 @@
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 // payloads with deep arrays or complex arrays are not serializable as URLSearchParams\n const isPayloadNonSerializableAsUrlSearchParams = Object.entries(flatten).some(([key, value]) => key.includes('.') ||\n (Array.isArray(value) && value.some((v) => typeof v === 'object')));\n const shouldSerializeToRParam = isComplexRequest && isPayloadNonSerializableAsUrlSearchParams;\n if (shouldSerializeToRParam) {\n return new URLSearchParams({ '.r': base64Encode(JSON.stringify(params)) });\n }\n else {\n return Object.entries(flatten).reduce((urlSearchParams, [key, value]) => {\n // inorder to make `foo: [1,2]` turn into `foo=1&foo=2` and not `foo[]=1&foo[]=2`\n const keyParams = Array.isArray(value) ? value : [value];\n keyParams.forEach((param) => {\n if (param === undefined ||\n param === null ||\n (Array.isArray(value) && typeof param === 'object')) {\n return;\n }\n urlSearchParams.append(key, param);\n });\n return urlSearchParams;\n }, new URLSearchParams());\n }\n}\nexport function resolveUrl(opts) {\n const domain = resolveDomain(opts.host);\n const mappings = resolveMappingsByDomain(domain, opts.domainToMappings);\n const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});\n return resolvePathFromMappings(path, mappings);\n}\nfunction flattenParams(data, path = '') {\n const params = {};\n Object.entries(data).forEach(([key, value]) => {\n const isObject = value !== null && typeof value === 'object' && !Array.isArray(value);\n const fieldPath = resolvePath(path, key);\n if (isObject) {\n const serializedObject = flattenParams(value, fieldPath);\n Object.assign(params, serializedObject);\n }\n else {\n params[fieldPath] = value;\n }\n });\n return params;\n}\nfunction resolvePath(path, key) {\n return `${path}${path ? '.' : ''}${key}`;\n}\nconst base64Encode = (value) => {\n const base64 = typeof btoa !== 'undefined'\n ? btoa(value)\n : Buffer.from(value, 'utf-8').toString('base64');\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nconst DOMAINS = ['wix.com', 'editorx.com'];\nconst USER_DOMAIN = '_';\nconst REGEX_CAPTURE_DOMAINS = new RegExp(`\\\\.(${DOMAINS.join('|')})$`);\nconst WIX_API_DOMAINS = ['42.wixprod.net', 'uw2-edt-1.wixprod.net'];\nconst DEV_WIX_CODE_DOMAIN = 'dev.wix-code.com';\nconst REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;\nconst REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\\\.(${WIX_API_DOMAINS.join('|')})$`);\nconst REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\\\.${DEV_WIX_CODE_DOMAIN}$`);\nfunction resolveDomain(host) {\n const resolvedHost = fixHostExceptions(host);\n return resolvedHost\n .replace(REGEX_CAPTURE_DOMAINS, '._base_domain_')\n .replace(REGEX_CAPTURE_API_DOMAINS, '._api_base_domain_')\n .replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, '*.dev.wix-code.com');\n}\n// hosts which standard string replacing doesn't apply to them, will be fixed here.\nfunction fixHostExceptions(host) {\n // https://system-kb.wixanswers.com/kb/en/article/editorx-domains-matching-to-wixcom\n return host.replace('create.editorx.com', 'editor.editorx.com');\n}\nfunction resolveMappingsByDomain(domain, domainToMappings) {\n const mappings = domainToMappings[domain] || domainToMappings[USER_DOMAIN];\n if (!mappings) {\n if (isBaseDomain(domain)) {\n // fallback <lang>.wix.com sub domains to www.wix.com\n // since all of the languages subdomain are not mapped automatically in FP and we want to support those kind of calls\n // for example: fr.wix.com\n return domainToMappings[wwwBaseDomain];\n }\n }\n return mappings;\n}\nfunction isBaseDomain(domain) {\n return !!domain.match(/\\._base_domain_$/);\n}\nconst wwwBaseDomain = 'www._base_domain_';\nfunction injectDataIntoProtoPath(protoPath, data) {\n return protoPath\n .split('/')\n .map((path) => maybeProtoPathToData(path, data))\n .join('/');\n}\nfunction maybeProtoPathToData(protoPath, data) {\n const protoRegExpMatch = protoPath.match(REGEX_CAPTURE_PROTO_FIELD) || [];\n const field = protoRegExpMatch[1];\n if (field) {\n const suffix = protoPath.replace(protoRegExpMatch[0], '');\n return findByPath(data, field, protoPath, suffix);\n }\n return protoPath;\n}\nfunction findByPath(obj, path, defaultValue, suffix) {\n let result = obj;\n for (const field of path.split('.')) {\n if (!result) {\n return defaultValue;\n }\n result = result[field];\n }\n return `${result}${suffix}`;\n}\nfunction resolvePathFromMappings(protoPath, mappings) {\n const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));\n if (!mapping) {\n // todo: should we return the path? if no - what should we do in case of testings?\n return protoPath;\n }\n return mapping.srcPath + protoPath.slice(mapping.destPath.length);\n}\n","import { wixContext } from '@wix/sdk-context';\nexport function enableContext(wixClient, contextType) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n globalThis.__wix_context__.client = wixClient;\n }\n else {\n globalThis.__wix_context__ = { client: wixClient };\n }\n }\n else {\n wixContext.client = wixClient;\n }\n}\n","import { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nexport function elevate(restModule) {\n return createRESTModule(restModule, true);\n}\nexport const fetchWithAuth = createRESTModule((restModuleOpts) => {\n return ((url, options) => restModuleOpts.fetchWithAuth(url, options));\n});\nexport { graphql } from './graphql.js';\nexport { setGlobalWixContext } from './wix-context.js';\nexport { enableContext } from './enable-context.js';\n"],"mappings":"gGACO,SAASA,EAAiBC,EAAYC,EAAW,GAAO,CAC3D,OAAOC,EAA0BF,EAAYC,CAAQ,CACzD,CAwDA,IAAME,EAAU,CAAC,UAAW,aAAa,EAEzC,IAAMC,EAAwB,IAAI,OAAO,OAAOC,EAAQ,KAAK,GAAG,CAAC,IAAI,EAC/DC,EAAkB,CAAC,iBAAkB,uBAAuB,EAC5DC,EAAsB,mBAE5B,IAAMC,EAA4B,IAAI,OAAO,OAAOC,EAAgB,KAAK,GAAG,CAAC,IAAI,EAC3EC,EAAoC,IAAI,OAAO,QAAQC,CAAmB,GAAG,EClEnF,OAAS,cAAAC,MAAkB,mBACpB,SAASC,EAAcC,EAAWC,EAAa,CAC9CA,IAAgB,SACZ,WAAW,iBAAmB,KAC9B,WAAW,gBAAgB,OAASD,EAGpC,WAAW,gBAAkB,CAAE,OAAQA,CAAU,EAIrDF,EAAW,OAASE,CAE5B,CCTO,IAAME,EAAgBC,EAAkBC,GACnC,CAACC,EAAKC,IAAYF,EAAe,cAAcC,EAAKC,CAAO,CACtE","names":["createRESTModule","descriptor","elevated","contextualizeRESTModuleV2","DOMAINS","REGEX_CAPTURE_DOMAINS","DOMAINS","WIX_API_DOMAINS","DEV_WIX_CODE_DOMAIN","REGEX_CAPTURE_API_DOMAINS","WIX_API_DOMAINS","REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN","DEV_WIX_CODE_DOMAIN","wixContext","enableContext","wixClient","contextType","fetchWithAuth","createRESTModule","restModuleOpts","url","options"]}
1
+ {"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/rest-modules.js","../../../node_modules/@wix/sdk/build/enable-context.js","../../../node_modules/@wix/sdk/build/context.js"],"sourcesContent":["import { contextualizeRESTModuleV2 } from './context-v2.js';\nexport function createRESTModule(descriptor, elevated = false) {\n return contextualizeRESTModuleV2(descriptor, elevated);\n}\nexport function toURLSearchParams(params, isComplexRequest) {\n const flatten = flattenParams(params);\n // payloads with deep arrays or complex arrays are not serializable as URLSearchParams\n const isPayloadNonSerializableAsUrlSearchParams = Object.entries(flatten).some(([key, value]) => key.includes('.') ||\n (Array.isArray(value) && value.some((v) => typeof v === 'object')));\n const shouldSerializeToRParam = isComplexRequest && isPayloadNonSerializableAsUrlSearchParams;\n if (shouldSerializeToRParam) {\n return new URLSearchParams({ '.r': base64Encode(JSON.stringify(params)) });\n }\n else {\n return Object.entries(flatten).reduce((urlSearchParams, [key, value]) => {\n // inorder to make `foo: [1,2]` turn into `foo=1&foo=2` and not `foo[]=1&foo[]=2`\n const keyParams = Array.isArray(value) ? value : [value];\n keyParams.forEach((param) => {\n if (param === undefined ||\n param === null ||\n (Array.isArray(value) && typeof param === 'object')) {\n return;\n }\n urlSearchParams.append(key, param);\n });\n return urlSearchParams;\n }, new URLSearchParams());\n }\n}\nexport function resolveUrl(opts) {\n const domain = resolveDomain(opts.host);\n const mappings = resolveMappingsByDomain(domain, opts.domainToMappings);\n const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});\n return resolvePathFromMappings(path, mappings);\n}\nfunction flattenParams(data, path = '') {\n const params = {};\n Object.entries(data).forEach(([key, value]) => {\n const isObject = value !== null && typeof value === 'object' && !Array.isArray(value);\n const fieldPath = resolvePath(path, key);\n if (isObject) {\n const serializedObject = flattenParams(value, fieldPath);\n Object.assign(params, serializedObject);\n }\n else {\n params[fieldPath] = value;\n }\n });\n return params;\n}\nfunction resolvePath(path, key) {\n return `${path}${path ? '.' : ''}${key}`;\n}\nconst base64Encode = (value) => {\n const base64 = typeof btoa !== 'undefined'\n ? btoa(value)\n : Buffer.from(value, 'utf-8').toString('base64');\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nconst DOMAINS = ['wix.com', 'editorx.com'];\nconst USER_DOMAIN = '_';\nconst REGEX_CAPTURE_DOMAINS = new RegExp(`\\\\.(${DOMAINS.join('|')})$`);\nconst WIX_API_DOMAINS = ['42.wixprod.net', 'uw2-edt-1.wixprod.net'];\nconst DEV_WIX_CODE_DOMAIN = 'dev.wix-code.com';\nconst REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;\nconst REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\\\.(${WIX_API_DOMAINS.join('|')})$`);\nconst REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\\\.${DEV_WIX_CODE_DOMAIN}$`);\nfunction resolveDomain(host) {\n const resolvedHost = fixHostExceptions(host);\n return resolvedHost\n .replace(REGEX_CAPTURE_DOMAINS, '._base_domain_')\n .replace(REGEX_CAPTURE_API_DOMAINS, '._api_base_domain_')\n .replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, '*.dev.wix-code.com');\n}\n// hosts which standard string replacing doesn't apply to them, will be fixed here.\nfunction fixHostExceptions(host) {\n // https://system-kb.wixanswers.com/kb/en/article/editorx-domains-matching-to-wixcom\n return host.replace('create.editorx.com', 'editor.editorx.com');\n}\nfunction resolveMappingsByDomain(domain, domainToMappings) {\n const mappings = domainToMappings[domain] || domainToMappings[USER_DOMAIN];\n if (!mappings) {\n if (isBaseDomain(domain)) {\n // fallback <lang>.wix.com sub domains to www.wix.com\n // since all of the languages subdomain are not mapped automatically in FP and we want to support those kind of calls\n // for example: fr.wix.com\n return domainToMappings[wwwBaseDomain];\n }\n }\n return mappings;\n}\nfunction isBaseDomain(domain) {\n return !!domain.match(/\\._base_domain_$/);\n}\nconst wwwBaseDomain = 'www._base_domain_';\nfunction injectDataIntoProtoPath(protoPath, data) {\n return protoPath\n .split('/')\n .map((path) => maybeProtoPathToData(path, data))\n .join('/');\n}\nfunction maybeProtoPathToData(protoPath, data) {\n const protoRegExpMatch = protoPath.match(REGEX_CAPTURE_PROTO_FIELD) || [];\n const field = protoRegExpMatch[1];\n if (field) {\n const suffix = protoPath.replace(protoRegExpMatch[0], '');\n return findByPath(data, field, protoPath, suffix);\n }\n return protoPath;\n}\nfunction findByPath(obj, path, defaultValue, suffix) {\n let result = obj;\n for (const field of path.split('.')) {\n if (!result) {\n return defaultValue;\n }\n result = result[field];\n }\n return `${result}${suffix}`;\n}\nfunction resolvePathFromMappings(protoPath, mappings) {\n const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));\n if (!mapping) {\n // todo: should we return the path? if no - what should we do in case of testings?\n return protoPath;\n }\n return mapping.srcPath + protoPath.slice(mapping.destPath.length);\n}\n","import { wixContext } from '@wix/sdk-context';\nexport function enableContext(wixClient, contextType) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n globalThis.__wix_context__.client = wixClient;\n }\n else {\n globalThis.__wix_context__ = { client: wixClient };\n }\n }\n else {\n wixContext.client = wixClient;\n }\n}\n","import { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nexport function elevate(restModule) {\n return createRESTModule(restModule, true);\n}\nexport const fetchWithAuth = createRESTModule((restModuleOpts) => {\n return ((url, options) => restModuleOpts.fetchWithAuth(url, options));\n});\nexport { graphql } from './graphql.js';\nexport { setGlobalWixContext } from './wix-context.js';\nexport { enableContext } from './enable-context.js';\n"],"mappings":"gGACO,SAASA,EAAiBC,EAAYC,EAAW,GAAO,CAC3D,OAAOC,EAA0BF,EAAYC,CAAQ,CACzD,CAwDA,IAAME,EAAU,CAAC,UAAW,aAAa,EAEzC,IAAMC,EAAwB,IAAI,OAAO,OAAOC,EAAQ,KAAK,GAAG,CAAC,IAAI,EAC/DC,EAAkB,CAAC,iBAAkB,uBAAuB,EAC5DC,EAAsB,mBAE5B,IAAMC,EAA4B,IAAI,OAAO,OAAOC,EAAgB,KAAK,GAAG,CAAC,IAAI,EAC3EC,EAAoC,IAAI,OAAO,QAAQC,CAAmB,GAAG,EClEnF,OAAS,cAAAC,MAAkB,mBACpB,SAASC,EAAcC,EAAWC,EAAa,CAC9CA,IAAgB,SACZ,WAAW,iBAAmB,KAC9B,WAAW,gBAAgB,OAASD,EAGpC,WAAW,gBAAkB,CAAE,OAAQA,CAAU,EAIrDF,EAAW,OAASE,CAE5B,CCTO,IAAME,EAAgBC,EAAkBC,GACnC,CAACC,EAAKC,IAAYF,EAAe,cAAcC,EAAKC,CAAO,CACtE","names":["createRESTModule","descriptor","elevated","contextualizeRESTModuleV2","DOMAINS","REGEX_CAPTURE_DOMAINS","DOMAINS","WIX_API_DOMAINS","DEV_WIX_CODE_DOMAIN","REGEX_CAPTURE_API_DOMAINS","WIX_API_DOMAINS","REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN","DEV_WIX_CODE_DOMAIN","wixContext","enableContext","wixClient","contextType","fetchWithAuth","createRESTModule","restModuleOpts","url","options"]}
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-3WHQP2RD.js";import"./chunk-42XIZ4MH.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function d(){let t=null,n=null;return{promise:new Promise((o,i)=>{t=o,n=i}),resolve:t,reject:n}}var u=t=>{let{createHost:n}=t;return{__type:"host",create:e=>({}),host:e=>{var o,i;let{applicationId:s}=e??{},r=typeof window<"u"?window.wixEmbedsAPI:void 0,l=n(e),p=f();return{...l,apiBaseUrl:p,getMonitoringClient:r==null||r.getMonitoringClientFunction==null?void 0:r.getMonitoringClientFunction(s),essentials:{language:typeof window<"u"?(o=window.commonConfig)==null?void 0:o.language:void 0,locale:typeof window<"u"?(i=window.commonConfig)==null?void 0:i.locale:void 0}}},auth:e=>{let o=typeof window<"u"?window.wixEmbedsAPI:void 0;e||(e=o==null||o.getAccessTokenFunction==null?void 0:o.getAccessTokenFunction());let i=!1,{resolve:s,promise:r}=d();return{getAuthHeaders:async()=>{if(!e&&i&&(e=await r),!e)throw new Error("Failed to resolve auth token");return{headers:{Authorization:await e()}}},getAccessTokenInjector:()=>(i=!0,l=>{s(l)})}}}};function f(){let t=typeof window<"u"?window.wixEmbedsAPI:void 0,n=t==null||t.getExternalBaseUrl==null?void 0:t.getExternalBaseUrl();if(!n)return;let e=new URL(n);return e!=null&&e.pathname&&e.pathname!=="/"?""+e.hostname+e.pathname:e.hostname}var w=t=>{let{clientSdk:n,applicationId:e}=t;return{invoke:async o=>{let{namespace:i,method:s,args:r}=o;if(!n)throw new Error("Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction");return n.invoke({namespace:i,method:s,args:r,applicationId:e,accessToken:"accessToken"})},getAccessToken:()=>{throw new Error("Not implemented")},observeState:()=>({disconnect:()=>{}})}};var m=function(t){let n=typeof $wixContext<"u"&&$wixContext.clientSdk||t?.clientSdk||window.clientSdk,{applicationId:e}=t||{};if(!e)throw new Error('"createHost" was called without a required field "applicationId"');return{channel:w({clientSdk:n,applicationId:e}),close:()=>{}}};var c=u({createHost:m});var S=t=>{let n=c.host({applicationId:t}),e=c.auth(),o=e.getAccessTokenInjector();return a({auth:e,host:n}).enableContext("module"),{injectGetAccessToken:o}};export{S as enableClient};
1
+ import{a}from"./chunk-MM2KVUBI.js";import"./chunk-BGTZ3RNN.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function d(){let t=null,n=null;return{promise:new Promise((o,i)=>{t=o,n=i}),resolve:t,reject:n}}var u=t=>{let{createHost:n}=t;return{__type:"host",create:e=>({}),host:e=>{var o,i;let{applicationId:s}=e??{},r=typeof window<"u"?window.wixEmbedsAPI:void 0,l=n(e),p=f();return{...l,apiBaseUrl:p,getMonitoringClient:r==null||r.getMonitoringClientFunction==null?void 0:r.getMonitoringClientFunction(s),essentials:{language:typeof window<"u"?(o=window.commonConfig)==null?void 0:o.language:void 0,locale:typeof window<"u"?(i=window.commonConfig)==null?void 0:i.locale:void 0}}},auth:e=>{let o=typeof window<"u"?window.wixEmbedsAPI:void 0;e||(e=o==null||o.getAccessTokenFunction==null?void 0:o.getAccessTokenFunction());let i=!1,{resolve:s,promise:r}=d();return{getAuthHeaders:async()=>{if(!e&&i&&(e=await r),!e)throw new Error("Failed to resolve auth token");return{headers:{Authorization:await e()}}},getAccessTokenInjector:()=>(i=!0,l=>{s(l)})}}}};function f(){let t=typeof window<"u"?window.wixEmbedsAPI:void 0,n=t==null||t.getExternalBaseUrl==null?void 0:t.getExternalBaseUrl();if(!n)return;let e=new URL(n);return e!=null&&e.pathname&&e.pathname!=="/"?""+e.hostname+e.pathname:e.hostname}var w=t=>{let{clientSdk:n,applicationId:e}=t;return{invoke:async o=>{let{namespace:i,method:s,args:r}=o;if(!n)throw new Error("Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction");return n.invoke({namespace:i,method:s,args:r,applicationId:e,accessToken:"accessToken"})},getAccessToken:()=>{throw new Error("Not implemented")},observeState:()=>({disconnect:()=>{}})}};var m=function(t){let n=typeof $wixContext<"u"&&$wixContext.clientSdk||t?.clientSdk||window.clientSdk,{applicationId:e}=t||{};if(!e)throw new Error('"createHost" was called without a required field "applicationId"');return{channel:w({clientSdk:n,applicationId:e}),close:()=>{}}};var c=u({createHost:m});var S=t=>{let n=c.host({applicationId:t}),e=c.auth(),o=e.getAccessTokenInjector();return a({auth:e,host:n}).enableContext("module"),{injectGetAccessToken:o}};export{S as enableClient};
2
2
  //# sourceMappingURL=site.js.map