@wix/cli-app 1.1.134 → 1.1.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/build/{AddPermissionCommand-TL46A3YR.js → AddPermissionCommand-J747FJOD.js} +2 -2
  2. package/build/{DevCommand-KKSEAF6U.js → DevCommand-WHO2FPZA.js} +11 -11
  3. package/build/{GenerateCommand-CHACGG6N.js → GenerateCommand-G7GZAQRU.js} +8 -8
  4. package/build/{LogsCommand-ONUNVGZR.js → LogsCommand-UYRXNYT6.js} +4 -4
  5. package/build/PreviewCommand-AK7QEFIM.js +19 -0
  6. package/build/ReleaseCommand-DK24QEHP.js +23 -0
  7. package/build/{ServeCommand-I57RKIFD.js → ServeCommand-P52GP36W.js} +4 -4
  8. package/build/{build-UZCNG6SL.js → build-QHEECRN2.js} +6 -6
  9. package/build/{chunk-PTXQ3EPG.js → chunk-3FSEHEJA.js} +3 -3
  10. package/build/{chunk-DLJA76CA.js → chunk-4GVN5OSZ.js} +15 -9
  11. package/build/{chunk-DLJA76CA.js.map → chunk-4GVN5OSZ.js.map} +1 -1
  12. package/build/{chunk-U2CR5VPH.js → chunk-5I6K4LMZ.js} +10 -7
  13. package/build/{chunk-U2CR5VPH.js.map → chunk-5I6K4LMZ.js.map} +1 -1
  14. package/build/{chunk-WOIU7VIM.js → chunk-CXBQHWIM.js} +2 -2
  15. package/build/{chunk-R5HMH6QX.js → chunk-HBEVHWYL.js} +2 -2
  16. package/build/{chunk-R5HMH6QX.js.map → chunk-HBEVHWYL.js.map} +1 -1
  17. package/build/{chunk-TNH2NG27.js → chunk-HPHTU6UB.js} +3 -3
  18. package/build/{chunk-GY4LG7V4.js → chunk-I2JVZXWM.js} +2 -2
  19. package/build/{chunk-NU7CPDB5.js → chunk-IPSCL6EX.js} +4 -4
  20. package/build/{chunk-NQ4YNX6A.js → chunk-KJXVS3IU.js} +4 -4
  21. package/build/{chunk-JPSY3QB7.js → chunk-L6XIG76V.js} +3 -3
  22. package/build/{chunk-3GHB2NXZ.js → chunk-MFPD7G6B.js} +2 -2
  23. package/build/{chunk-GWE3BRHX.js → chunk-P7IRRCF7.js} +4 -4
  24. package/build/chunk-P7IRRCF7.js.map +1 -0
  25. package/build/{chunk-FDSZMRFC.js → chunk-QVI67Q6A.js} +2 -2
  26. package/build/{chunk-UWCQA4MW.js → chunk-RPHZ4OP3.js} +6 -4
  27. package/build/{chunk-UWCQA4MW.js.map → chunk-RPHZ4OP3.js.map} +1 -1
  28. package/build/{chunk-PRRRKDRX.js → chunk-SMEOB2J6.js} +6 -6
  29. package/build/{chunk-YLUVMDX7.js → chunk-V4VNLYCR.js} +2 -2
  30. package/build/{chunk-FUAEI7OE.js → chunk-W6OUY5DV.js} +6 -6
  31. package/build/{chunk-NPYJ3GAT.js → chunk-Z6H5SRVH.js} +2 -2
  32. package/build/cloudflare-runtime/entry.js +3 -3
  33. package/build/cloudflare-runtime/getRegisteredExtensions.js +3 -3
  34. package/build/index.js +23 -23
  35. package/build/platform-sdk/{chunk-WBKL5IQV.js → chunk-RJD2G2AE.js} +2 -2
  36. package/build/platform-sdk/chunk-RJD2G2AE.js.map +1 -0
  37. package/build/platform-sdk/{chunk-R7FAXXP7.js → chunk-Y4HYNW3N.js} +1 -1
  38. package/build/platform-sdk/chunk-Y4HYNW3N.js.map +1 -0
  39. package/build/platform-sdk/dashboard.js +1 -1
  40. package/build/platform-sdk/editor.js +1 -1
  41. package/build/platform-sdk/sdk-context.js +1 -1
  42. package/build/platform-sdk/sdk-context.js.map +1 -1
  43. package/build/platform-sdk/site.js +1 -1
  44. package/build/{preview-6SJAV4D6.js → preview-3ABHWSP4.js} +13 -13
  45. package/build/{release-JUZK53KH.js → release-DZGPFN7M.js} +15 -15
  46. package/build/{render-command-FFAZSU54.js → render-command-TDM7CFXE.js} +5 -5
  47. package/package.json +5 -5
  48. package/templates/custom-element/files/element.tsx.ejs +1 -1
  49. package/build/PreviewCommand-Y7JEA26N.js +0 -19
  50. package/build/ReleaseCommand-QIDFQA2M.js +0 -23
  51. package/build/chunk-GWE3BRHX.js.map +0 -1
  52. package/build/platform-sdk/chunk-R7FAXXP7.js.map +0 -1
  53. package/build/platform-sdk/chunk-WBKL5IQV.js.map +0 -1
  54. /package/build/{AddPermissionCommand-TL46A3YR.js.map → AddPermissionCommand-J747FJOD.js.map} +0 -0
  55. /package/build/{DevCommand-KKSEAF6U.js.map → DevCommand-WHO2FPZA.js.map} +0 -0
  56. /package/build/{GenerateCommand-CHACGG6N.js.map → GenerateCommand-G7GZAQRU.js.map} +0 -0
  57. /package/build/{LogsCommand-ONUNVGZR.js.map → LogsCommand-UYRXNYT6.js.map} +0 -0
  58. /package/build/{PreviewCommand-Y7JEA26N.js.map → PreviewCommand-AK7QEFIM.js.map} +0 -0
  59. /package/build/{ReleaseCommand-QIDFQA2M.js.map → ReleaseCommand-DK24QEHP.js.map} +0 -0
  60. /package/build/{ServeCommand-I57RKIFD.js.map → ServeCommand-P52GP36W.js.map} +0 -0
  61. /package/build/{build-UZCNG6SL.js.map → build-QHEECRN2.js.map} +0 -0
  62. /package/build/{chunk-PTXQ3EPG.js.map → chunk-3FSEHEJA.js.map} +0 -0
  63. /package/build/{chunk-WOIU7VIM.js.map → chunk-CXBQHWIM.js.map} +0 -0
  64. /package/build/{chunk-TNH2NG27.js.map → chunk-HPHTU6UB.js.map} +0 -0
  65. /package/build/{chunk-GY4LG7V4.js.map → chunk-I2JVZXWM.js.map} +0 -0
  66. /package/build/{chunk-NU7CPDB5.js.map → chunk-IPSCL6EX.js.map} +0 -0
  67. /package/build/{chunk-NQ4YNX6A.js.map → chunk-KJXVS3IU.js.map} +0 -0
  68. /package/build/{chunk-JPSY3QB7.js.map → chunk-L6XIG76V.js.map} +0 -0
  69. /package/build/{chunk-3GHB2NXZ.js.map → chunk-MFPD7G6B.js.map} +0 -0
  70. /package/build/{chunk-FDSZMRFC.js.map → chunk-QVI67Q6A.js.map} +0 -0
  71. /package/build/{chunk-PRRRKDRX.js.map → chunk-SMEOB2J6.js.map} +0 -0
  72. /package/build/{chunk-YLUVMDX7.js.map → chunk-V4VNLYCR.js.map} +0 -0
  73. /package/build/{chunk-FUAEI7OE.js.map → chunk-W6OUY5DV.js.map} +0 -0
  74. /package/build/{chunk-NPYJ3GAT.js.map → chunk-Z6H5SRVH.js.map} +0 -0
  75. /package/build/{preview-6SJAV4D6.js.map → preview-3ABHWSP4.js.map} +0 -0
  76. /package/build/{release-JUZK53KH.js.map → release-DZGPFN7M.js.map} +0 -0
  77. /package/build/{render-command-FFAZSU54.js.map → render-command-TDM7CFXE.js.map} +0 -0
@@ -2,7 +2,7 @@ import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  readAppManifestFile
5
- } from "./chunk-TNH2NG27.js";
5
+ } from "./chunk-HPHTU6UB.js";
6
6
  import {
7
7
  ArmTagProvider,
8
8
  ExtensionDataProvider,
@@ -16,16 +16,16 @@ import {
16
16
  useResolvePlatformUrl,
17
17
  useSite,
18
18
  useSiteOverrideClient
19
- } from "./chunk-U2CR5VPH.js";
19
+ } from "./chunk-5I6K4LMZ.js";
20
20
  import {
21
21
  useBackendComponents
22
- } from "./chunk-YLUVMDX7.js";
22
+ } from "./chunk-V4VNLYCR.js";
23
23
  import {
24
24
  getMonitoringProvider,
25
25
  updateAppManifestComponents,
26
26
  updateMonitoring,
27
27
  updateTopology
28
- } from "./chunk-UWCQA4MW.js";
28
+ } from "./chunk-RPHZ4OP3.js";
29
29
  import {
30
30
  Alert,
31
31
  Box_default,
@@ -54,7 +54,7 @@ import {
54
54
  useHttpClient,
55
55
  useProjectModel,
56
56
  useTranslation
57
- } from "./chunk-DLJA76CA.js";
57
+ } from "./chunk-4GVN5OSZ.js";
58
58
  import {
59
59
  __toESM,
60
60
  init_esm_shims
@@ -282,4 +282,4 @@ export {
282
282
  assertBuildOutputExists,
283
283
  PreviewCommand
284
284
  };
285
- //# sourceMappingURL=chunk-PRRRKDRX.js.map
285
+ //# sourceMappingURL=chunk-SMEOB2J6.js.map
@@ -15,7 +15,7 @@ import {
15
15
  require_react,
16
16
  useProjectModel,
17
17
  writePackageJson
18
- } from "./chunk-DLJA76CA.js";
18
+ } from "./chunk-4GVN5OSZ.js";
19
19
  import {
20
20
  __commonJS,
21
21
  __require,
@@ -9385,4 +9385,4 @@ ejs/lib/ejs.js:
9385
9385
  * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
9386
9386
  *)
9387
9387
  */
9388
- //# sourceMappingURL=chunk-YLUVMDX7.js.map
9388
+ //# sourceMappingURL=chunk-V4VNLYCR.js.map
@@ -3,16 +3,16 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  PreviewCommand,
5
5
  assertBuildOutputExists
6
- } from "./chunk-PRRRKDRX.js";
6
+ } from "./chunk-SMEOB2J6.js";
7
7
  import {
8
8
  useARMClient
9
- } from "./chunk-U2CR5VPH.js";
9
+ } from "./chunk-5I6K4LMZ.js";
10
10
  import {
11
11
  useWixCliAppBi
12
- } from "./chunk-3GHB2NXZ.js";
12
+ } from "./chunk-MFPD7G6B.js";
13
13
  import {
14
14
  useBackendComponents
15
- } from "./chunk-YLUVMDX7.js";
15
+ } from "./chunk-V4VNLYCR.js";
16
16
  import {
17
17
  Alert,
18
18
  Box_default,
@@ -36,7 +36,7 @@ import {
36
36
  useAsyncCallback,
37
37
  useProjectModel,
38
38
  useTranslation
39
- } from "./chunk-DLJA76CA.js";
39
+ } from "./chunk-4GVN5OSZ.js";
40
40
  import {
41
41
  __toESM,
42
42
  init_esm_shims
@@ -399,4 +399,4 @@ export {
399
399
  ReleaseVersionType,
400
400
  ReleaseCommand
401
401
  };
402
- //# sourceMappingURL=chunk-FUAEI7OE.js.map
402
+ //# sourceMappingURL=chunk-W6OUY5DV.js.map
@@ -5,7 +5,7 @@ import {
5
5
  createRendererToString,
6
6
  isCliError,
7
7
  require_react
8
- } from "./chunk-DLJA76CA.js";
8
+ } from "./chunk-4GVN5OSZ.js";
9
9
  import {
10
10
  __toESM,
11
11
  init_esm_shims
@@ -61,4 +61,4 @@ function createLogger({
61
61
  export {
62
62
  createLogger
63
63
  };
64
- //# sourceMappingURL=chunk-NPYJ3GAT.js.map
64
+ //# sourceMappingURL=chunk-Z6H5SRVH.js.map
@@ -4595,7 +4595,7 @@ function objectToKeyValue(input) {
4595
4595
  return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
4596
4596
  }
4597
4597
 
4598
- // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
4598
+ // ../../node_modules/@wix/sdk-runtime/build/context.js
4599
4599
  function runWithoutContext(fn) {
4600
4600
  const globalContext = globalThis.__wix_context__;
4601
4601
  const moduleContext = {
@@ -4627,7 +4627,7 @@ function runWithoutContext(fn) {
4627
4627
  }
4628
4628
  }
4629
4629
 
4630
- // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/utils.js
4630
+ // ../../node_modules/@wix/sdk-runtime/build/utils.js
4631
4631
  function constantCase(input) {
4632
4632
  return split(input).map((part) => part.toLocaleUpperCase()).join("_");
4633
4633
  }
@@ -4653,7 +4653,7 @@ function split(value) {
4653
4653
  return result.slice(start, end).split(/\0/g);
4654
4654
  }
4655
4655
 
4656
- // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/transform-error.js
4656
+ // ../../node_modules/@wix/sdk-runtime/build/transform-error.js
4657
4657
  var isValidationError = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
4658
4658
  var isApplicationError = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
4659
4659
  var isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
@@ -4438,7 +4438,7 @@ function objectToKeyValue(input) {
4438
4438
  return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
4439
4439
  }
4440
4440
 
4441
- // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
4441
+ // ../../node_modules/@wix/sdk-runtime/build/context.js
4442
4442
  function runWithoutContext(fn) {
4443
4443
  const globalContext = globalThis.__wix_context__;
4444
4444
  const moduleContext = {
@@ -4470,7 +4470,7 @@ function runWithoutContext(fn) {
4470
4470
  }
4471
4471
  }
4472
4472
 
4473
- // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/utils.js
4473
+ // ../../node_modules/@wix/sdk-runtime/build/utils.js
4474
4474
  function constantCase(input) {
4475
4475
  return split(input).map((part) => part.toLocaleUpperCase()).join("_");
4476
4476
  }
@@ -4496,7 +4496,7 @@ function split(value) {
4496
4496
  return result.slice(start, end).split(/\0/g);
4497
4497
  }
4498
4498
 
4499
- // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/transform-error.js
4499
+ // ../../node_modules/@wix/sdk-runtime/build/transform-error.js
4500
4500
  var isValidationError = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
4501
4501
  var isApplicationError = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
4502
4502
  var isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
package/build/index.js CHANGED
@@ -3,18 +3,18 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  createI18nT,
5
5
  docsExtensionTypeSchema
6
- } from "./chunk-GY4LG7V4.js";
6
+ } from "./chunk-I2JVZXWM.js";
7
7
  import {
8
8
  runCommand
9
- } from "./chunk-NU7CPDB5.js";
10
- import "./chunk-WOIU7VIM.js";
9
+ } from "./chunk-IPSCL6EX.js";
10
+ import "./chunk-CXBQHWIM.js";
11
11
  import "./chunk-3QFT6UQF.js";
12
- import "./chunk-FDSZMRFC.js";
12
+ import "./chunk-QVI67Q6A.js";
13
13
  import {
14
14
  external_exports,
15
15
  package_default,
16
16
  require_react
17
- } from "./chunk-DLJA76CA.js";
17
+ } from "./chunk-4GVN5OSZ.js";
18
18
  import {
19
19
  __commonJS,
20
20
  __require,
@@ -3377,8 +3377,8 @@ var {
3377
3377
  // src/commands/build.ts
3378
3378
  init_esm_shims();
3379
3379
  var buildCommand = (services) => createCommand("build").action(async (_, command) => {
3380
- const { runCommand: runCommand2 } = await import("./render-command-FFAZSU54.js");
3381
- const { build } = await import("./build-UZCNG6SL.js");
3380
+ const { runCommand: runCommand2 } = await import("./render-command-TDM7CFXE.js");
3381
+ const { build } = await import("./build-QHEECRN2.js");
3382
3382
  await runCommand2(command, services, build);
3383
3383
  });
3384
3384
 
@@ -3443,8 +3443,8 @@ var devCommand = (services) => {
3443
3443
  return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).option("--port <port>", t("dev_command_def.option.port"), validatePort).addOption(
3444
3444
  new Option("--origin <url>", t("dev_command_def.option.origin")).argParser(validateBase).hideHelp()
3445
3445
  ).action(async (options, command) => {
3446
- const { DevCommand } = await import("./DevCommand-KKSEAF6U.js");
3447
- const { renderCommand } = await import("./render-command-FFAZSU54.js");
3446
+ const { DevCommand } = await import("./DevCommand-WHO2FPZA.js");
3447
+ const { renderCommand } = await import("./render-command-TDM7CFXE.js");
3448
3448
  const { https = false, origin, port } = options;
3449
3449
  await renderCommand(
3450
3450
  command,
@@ -3483,17 +3483,17 @@ var previewCommand = (services) => {
3483
3483
  ).hideHelp()
3484
3484
  ).action(async (options, command) => {
3485
3485
  const { site, baseUrl, json } = options;
3486
- const { renderCommand, runCommand: runCommand2 } = await import("./render-command-FFAZSU54.js");
3486
+ const { renderCommand, runCommand: runCommand2 } = await import("./render-command-TDM7CFXE.js");
3487
3487
  if (json) {
3488
3488
  return runCommand2(command, services, async (model) => {
3489
- const { nonInteractivePreview } = await import("./preview-6SJAV4D6.js");
3489
+ const { nonInteractivePreview } = await import("./preview-3ABHWSP4.js");
3490
3490
  return nonInteractivePreview(services, model, {
3491
3491
  baseUrl,
3492
3492
  siteId: site
3493
3493
  });
3494
3494
  });
3495
3495
  }
3496
- const { PreviewCommand } = await import("./PreviewCommand-Y7JEA26N.js");
3496
+ const { PreviewCommand } = await import("./PreviewCommand-AK7QEFIM.js");
3497
3497
  await renderCommand(
3498
3498
  command,
3499
3499
  services,
@@ -3510,8 +3510,8 @@ var addPermissionCommand = (services) => {
3510
3510
  return createCommand("add-permission").description("adding a permission to the app").addOption(
3511
3511
  new Option("-p, --permission-id <id>", t("the permission id to add"))
3512
3512
  ).action(async (options, command) => {
3513
- const { renderCommand } = await import("./render-command-FFAZSU54.js");
3514
- const { AddPermissionCommand } = await import("./AddPermissionCommand-TL46A3YR.js");
3513
+ const { renderCommand } = await import("./render-command-TDM7CFXE.js");
3514
+ const { AddPermissionCommand } = await import("./AddPermissionCommand-J747FJOD.js");
3515
3515
  const { permissionId = "" } = options;
3516
3516
  await renderCommand(
3517
3517
  command,
@@ -3527,8 +3527,8 @@ var import_react4 = __toESM(require_react(), 1);
3527
3527
  var serveCommand = (services) => {
3528
3528
  const t = createI18nT();
3529
3529
  return createCommand("serve").description(t("serve_command_def.description")).action(async (_, command) => {
3530
- const { renderCommand } = await import("./render-command-FFAZSU54.js");
3531
- const { ServeCommandDeprecated } = await import("./ServeCommand-I57RKIFD.js");
3530
+ const { renderCommand } = await import("./render-command-TDM7CFXE.js");
3531
+ const { ServeCommandDeprecated } = await import("./ServeCommand-P52GP36W.js");
3532
3532
  await renderCommand(command, services, /* @__PURE__ */ import_react4.default.createElement(ServeCommandDeprecated, null));
3533
3533
  });
3534
3534
  };
@@ -3543,8 +3543,8 @@ var generateCommand = (services) => {
3543
3543
  t("generate_command.type_flag"),
3544
3544
  validateDocsExtensionType
3545
3545
  ).description(t("generate_command.description")).action(async (options, command) => {
3546
- const { GenerateCommand } = await import("./GenerateCommand-CHACGG6N.js");
3547
- const { renderCommand } = await import("./render-command-FFAZSU54.js");
3546
+ const { GenerateCommand } = await import("./GenerateCommand-G7GZAQRU.js");
3547
+ const { renderCommand } = await import("./render-command-TDM7CFXE.js");
3548
3548
  const { type } = options;
3549
3549
  await renderCommand(
3550
3550
  command,
@@ -3568,8 +3568,8 @@ var logsCommand = (services) => {
3568
3568
  validateVersion
3569
3569
  ).action(async (options, command) => {
3570
3570
  const { version } = options;
3571
- const { renderCommand } = await import("./render-command-FFAZSU54.js");
3572
- const { LogsCommand } = await import("./LogsCommand-ONUNVGZR.js");
3571
+ const { renderCommand } = await import("./render-command-TDM7CFXE.js");
3572
+ const { LogsCommand } = await import("./LogsCommand-UYRXNYT6.js");
3573
3573
  await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(LogsCommand, { version }));
3574
3574
  });
3575
3575
  };
@@ -3602,8 +3602,8 @@ var releaseCommand = (services) => {
3602
3602
  t("app_preview_command_def.option.json")
3603
3603
  ).hideHelp()
3604
3604
  ).action(async (options, command) => {
3605
- const { renderCommand } = await import("./render-command-FFAZSU54.js");
3606
- const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-QIDFQA2M.js");
3605
+ const { renderCommand } = await import("./render-command-TDM7CFXE.js");
3606
+ const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-DK24QEHP.js");
3607
3607
  const { baseUrl, site, comment, json } = options;
3608
3608
  const versionType = options.versionType ? {
3609
3609
  major: ReleaseVersionType.MAJOR,
@@ -3617,7 +3617,7 @@ var releaseCommand = (services) => {
3617
3617
  };
3618
3618
  if (json) {
3619
3619
  return runCommand(command, services, async (model) => {
3620
- const { nonInteractiveRelease } = await import("./release-JUZK53KH.js");
3620
+ const { nonInteractiveRelease } = await import("./release-DZGPFN7M.js");
3621
3621
  return nonInteractiveRelease(services, model, props);
3622
3622
  });
3623
3623
  }
@@ -1,2 +1,2 @@
1
- import{b as P}from"./chunk-R7FAXXP7.js";import{a as R,b as M,d as $}from"./chunk-7EYXEF6M.js";import{f as _}from"./chunk-SBZEOPXX.js";$();import{wixContext as Z}from"@wix/sdk-context";var ee=e=>{switch(e){case"get":case"GET":return"GET";case"post":case"POST":return"POST";case"put":case"PUT":return"PUT";case"delete":case"DELETE":return"DELETE";case"patch":case"PATCH":return"PATCH";case"head":case"HEAD":return"HEAD";case"options":case"OPTIONS":return"OPTIONS";default:throw new Error(`Unknown method: ${e}`)}},q=e=>t=>async s=>{let a,r=n=>{if(a=e(s)(n),a.url===void 0)throw new Error("Url was not successfully created for this request, please reach out to support channels for assistance.");let{method:i,url:o,params:p}=a;return{...a,method:ee(i),url:o,data:a.data,params:p}};try{let n=await t.request(r);if(a===void 0)throw new Error("Request options were not created for this request, please reach out to support channels for assistance.");let i=Array.isArray(a.transformResponse)?a.transformResponse:[a.transformResponse],o=n.data;return i.forEach(p=>{p&&(o=p(n.data,n.headers))}),o}catch(n){throw typeof n=="object"&&n!==null&&"response"in n&&typeof n.response=="object"&&n.response!==null&&"data"in n.response?n.response.data:n}},j=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var N="__metadata",x="www.wixapis.com",O="edge.wixapis.com";var b=class extends Error{constructor(s,a){super(s);_(this,"message");_(this,"response");this.message=s,this.response=a}async details(){let s=await this.response.json();return te(this.response.status,s?.message,s?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:s})}},te=(e,t,s,a)=>({details:{...!s?.validationError&&{applicationError:{description:t,code:e,data:a}},...s},message:t,requestId:a?.requestId});var W=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},J=e=>e&&typeof e=="object"&&!Array.isArray(e);var D=e=>e.__type==="host";function F(e,t){return e.create(t)}var se="x-wix-bi-gateway";function k(e,t,s){return{[se]:re({environment:`js-sdk${s?`-${s}`:""}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function re(e){return Object.entries(e).filter(([t,s])=>!!s).map(([t,s])=>`${t}=${s}`).join(",")}function I(e){return ie(e).map(t=>t.toLocaleUpperCase()).join("_")}var ne=/([\p{Ll}\d])(\p{Lu})/gu,oe=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,B="$1\0$2",ae=/[^\p{L}\d]+/giu;function ie(e){let t=e.trim();t=t.replace(ne,B).replace(oe,B),t=t.replace(ae,"\0");let s=0,a=t.length;for(;t.charAt(s)==="\0";)s++;if(s===a)return[];for(;t.charAt(a-1)==="\0";)a--;return t.slice(s,a).split(/\0/g)}var de=e=>"validationError"in(e.response?.data?.details??{}),ce=e=>"applicationError"in(e.response?.data?.details??{}),pe=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function C(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},s=[]){if(typeof e!="object"||e===null)throw e;if(de(e))return ue(e,t,s);if(ce(e))return le(e);if(pe(e)){let a=e.response?.status,r=e.response?.statusText??"UNKNOWN",n=e.response?.data?.message??r,i={applicationError:{description:r,code:I(r),data:{}},requestId:e.requestId};return H(e,{message:JSON.stringify({message:n,details:i},null,2),extraProperties:{details:i,status:a}})}return fe(e)}var ue=(e,t,s)=>{let a=e.response?.data,r=e.requestId,{fieldViolations:n}=a.details.validationError,i=he(t,n,s)?.sort((f,c)=>f.field<c.field?-1:1),o=`INVALID_ARGUMENT: ${i?.map(({field:f,description:c})=>`"${f}" ${c}`)?.join(", ")}`,p={validationError:{fieldViolations:i},requestId:r};return H(e,{message:JSON.stringify({message:o,details:p},null,2),extraProperties:{details:p,status:e.response?.status,requestId:r}})},H=(e,{message:t,extraProperties:s})=>Object.assign(e,{...s,message:t}),le=e=>{let t=e.response?.status,s=e.response?.statusText??"UNKNOWN",a=e.response?.data?.message??s,r=e.response?.data?.details?.applicationError?.description??s,n=e.response?.data?.details?.applicationError?.code??I(s),i=e.response?.data?.details?.applicationError?.data??{},o=a===r?a:`${a}: ${r}`,p={applicationError:{description:r,code:n,data:i},requestId:e.requestId};return H(e,{message:JSON.stringify({message:o,details:p},null,2),extraProperties:{details:p,status:t,requestId:e.requestId}})},fe=e=>{let t=e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`;return H(e,{message:t,extraProperties:{requestId:e.requestId,status:e.response?.status,code:I(e.response?.statusText??"UNKNOWN"),...!e.response&&{runtimeError:e}}})},he=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:s},a,r)=>{let n={...e,...t},i=Object.keys(n);return a?.filter(o=>!a.some(f=>f.field.length>o.field.length&&f.field.startsWith(o.field)&&i.includes(f.field))).map(o=>{let p=t[o.field];if(p)return{...o,field:G(p,r)};let f=i?.sort((c,u)=>u.length-c.length)?.find(c=>o.field.startsWith(c));if(f){let c=n[f];if(c)return{...o,field:o.field.replace(f,G(c,r))}}return s?{...o,field:`${r[0]}.${o.field}`}:o})},G=(e,t)=>{let s=me(e);return s!==null&&typeof s<"u"?e.replace(`$[${s}]`,t[s]):e},me=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function X(e,t,s,a,r,n,i,o,p){return P(()=>e({request:async f=>{let c=f({host:i?.HTTPHost||x}),u=c;u.method==="GET"&&u.fallback?.length&&(u.params?.toString().length??0)>4e3&&(u=c.fallback[0]);let y=i?.HTTPHost??x,d=`https://${p?O:y}${u.url}`;u.params&&u.params.toString()&&(d+=`?${u.params.toString()}`);try{let l=k(c,t,o),E={method:u.method,...u.data&&{body:JSON.stringify(u.data)},headers:{...l}},h=await s(d,E);if(h.status!==200){let T=null;try{T=await h.json()}catch{}let A=ye(h.status,T?.message,T?.details,{requestId:h.headers.get("X-Wix-Request-Id"),details:T}),v=C(A);throw a?.handleError(v,{requestOptions:{url:u.url,method:u.method,entityFqdn:c.entityFqdn,methodFqn:c.methodFqn}}),A}let g=await h.json();return{data:u.migrationOptions?.optInTransformResponse&&u.transformResponse?Array.isArray(u.transformResponse)?u.transformResponse[0](g):u.transformResponse(g):g,headers:h.headers,status:h.status,statusText:h.statusText}}catch(l){throw l.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),l}},fetchWithAuth:s,wixAPIFetch:r,getActiveToken:n}))}var L=class extends Error{constructor(s){super();_(this,"response");_(this,"requestId");this.response=s.response,this.requestId=s.requestId}},ye=(e,t,s,a)=>new L({response:{data:{details:{...!s?.validationError&&{applicationError:{description:t,code:e,data:a}},...s},message:t},status:e},requestId:a?.requestId});$();function U(){return{emit(e,...t){for(let s=0,a=this.events[e]||[],r=a.length;s<r;s++)a[s](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(s=>t!==s)}}}}var Y=e=>e.__type==="event-definition";function K(e,t,s,a){let r;if(e.isDomainEvent){let i=s,{deletedEvent:o,actionEvent:p,createdEvent:f,updatedEvent:c,...u}=i,y={...a,...u};o?o?.deletedEntity?r={entity:o?.deletedEntity,metadata:y}:r={metadata:y}:p?r={data:p.body,metadata:y}:r={entity:f?.entity??c?.currentEntity,metadata:y}}else r={data:s,metadata:a};let n=e.transformations??(i=>i);return t(n(r))}function z(e){let t=new Map,s=U(),a={...s,getRegisteredEvents:()=>t,async process(r,n={expectedEvents:[]}){let{eventType:i,identity:o,instanceId:p,payload:f}=await this.parseJWT(r),c=[...n.expectedEvents,...Array.from(t.keys()).map(y=>({type:y}))];if(c.length>0&&!c.some(({type:y})=>y===i))throw new Error(`Unexpected event type: ${i}. Expected one of: ${c.map(y=>y.type).join(", ")}`);let u=t.get(i)??[];return await Promise.all(u.map(({eventDefinition:y,handler:d})=>K(y,d,f,{instanceId:p,identity:o}))),{instanceId:p,eventType:i,payload:f,identity:o}},async processRequest(r,n){let i=await r.text();return this.process(i,n)},async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:n,valid:i}=await e.decodeJWT(r);if(!i)throw new Error("JWT is not valid");if(typeof n.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof n.data}`);let o=JSON.parse(n.data),p=o.eventType,f=o.instanceId,c=o.identity?JSON.parse(o.identity):void 0,u=JSON.parse(o.data);return{instanceId:f,eventType:p,payload:u,identity:c}},async parseRequest(r){let n=await r.text();return this.parseJWT(n)},async executeHandlers(r){let n=Array.from(t.keys()).map(o=>({type:o}));if(n.length>0&&!n.some(({type:o})=>o===r.eventType))throw new Error(`Unexpected event type: ${r.eventType}. Expected one of: ${n.map(o=>o.type).join(", ")}`);let i=t.get(r.eventType)??[];await Promise.all(i.map(({eventDefinition:o,handler:p})=>K(o,p,r.payload,{instanceId:r.instanceId,identity:r.identity})))},apps:{AppInstalled:R("AppInstalled")(),AppRemoved:R("AppRemoved")()}};return{initModule(r){return n=>{let i=t.get(r.type)??[];i.push({eventDefinition:r,handler:n}),t.set(r.type,i),s.emit("registered",r)}},client:a}}var Q=e=>e.__type==="service-plugin-definition";function V(e){let t=new Map,s=U(),a={...s,getRegisteredServicePlugins:()=>t,async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:n,valid:i}=await e.decodeJWT(r,!0);if(!i)throw new Error("JWT is not valid");if(typeof n.data!="object"||n.data===null||!("metadata"in n.data)||typeof n.data.metadata!="object"||n.data.metadata===null||!("appExtensionType"in n.data.metadata)||typeof n.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return n.data},async process(r){let n=await this.parseJWT(r.body);return this.executeHandler(n,r.url)},async parseRequest(r){let n=await r.text();return this.parseJWT(n)},async processRequest(r){let n=r.url,i=await r.text();try{let o=await this.process({url:n,body:i});return Response.json(o)}catch(o){if(o.errorType==="SPI"&&o.applicationCode&&o.httpCode)return Response.json({applicationError:{code:o.applicationCode,data:o.data}},{status:o.httpCode});throw o}},async executeHandler(r,n){let i=r.metadata.appExtensionType.toLowerCase(),o=t.get(i)??[];if(o.length===0)throw new Error(`No service plugin implementations found for component type ${i}`);if(o.length>1)throw new Error(`Multiple service plugin implementations found for component type ${i}. This is currently not supported`);let{implementation:p,servicePluginDefinition:f}=o[0],c=f.methods.find(y=>n.endsWith(y.primaryHttpMappingPath));if(!c)throw new Error("Unexpect request: request url did not match any method: "+n);let u=p[c.name];if(!u)throw new Error(`Got request for service plugin method ${c.name} but no implementation was provided. Available methods: ${Object.keys(p).join(", ")}`);return c.transformations.toREST(await u(c.transformations.fromREST(r)))}};return{initModule(r){return n=>{let i=t.get(r.componentType.toLowerCase())??[];i.push({servicePluginDefinition:r,implementation:n}),t.set(r.componentType.toLowerCase(),i),s.emit("registered",r)}},client:a}}var w="X-Wix-Consistent";function Qe(e){let t=e.headers||{Authorization:""},s=e.auth||{getAuthHeaders:d=>Promise.resolve({headers:{}})},a=s.getAuthHeaders.bind(void 0,e.host);s.getAuthHeaders=a;let r=async(d,l)=>{let E=await a(),h={...l?.headers??{},...E.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}},g=e.host?.getErrorHandler?.();try{if(typeof d=="string"||d instanceof URL){let m=await fetch(d,{...l,headers:h});g?.handleError(m,{requestOptions:{url:d.toString(),method:l?.method}});let T=S(m);return T&&(t[w]=T),m}else{for(let[A,v]of Object.entries(h))typeof v=="string"&&d.headers.set(A,v);let m=await fetch(d,l);g?.handleError(m,{requestOptions:{url:d.url,method:l?.method}});let T=S(m);return T&&(t[w]=T),m}}catch(m){throw g?.handleError(m,{requestOptions:{url:typeof d=="string"||d instanceof URL?d.toString():d.url,method:l?.method}}),m}},{client:n,initModule:i}=V(s),{client:o,initModule:p}=z(s),f=async(d,l)=>{let E=await a(),h=W(l),g=await fetch(d,{...l,headers:{...h,...t,...E?.headers,...l?.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}}}),m=S(g);return m&&(t[w]=m),g},c=(d,l)=>{if(Y(d))return p(d);if(Q(d))return i(d);if(D(d)&&e.host)return F(d,e.host);if(typeof d=="function"){if("__type"in d&&d.__type===M)return d;let E=e.host?.apiBaseUrl??x,h=e.useCDN===void 0?e.auth?.shouldUseCDN:e.useCDN;return X(P(()=>j(d))?q(d):d,l??{},f,e.host?.getErrorHandler?.(),(g,m)=>{let T=new URL(g,`https://${E}`);return T.host=E,T.protocol="https",f(T.toString(),m)},s.getActiveToken,{HTTPHost:E},e.host?.name,h)}else return J(d)?Object.fromEntries(Object.entries(d).map(([E,h])=>[E,c(h,d[N])])):d},u=d=>{for(let l in d)t[l]=d[l]};return{...e.modules?c(e.modules):{},auth:s,setHeaders:u,use:c,enableContext(d,l={elevated:!1}){d==="global"?globalThis.__wix_context__!=null?l.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:l.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:l.elevated?Z.elevatedClient=this:Z.client=this},fetch:(d,l)=>{let E=e.host?.apiBaseUrl??x,h=new URL(d,`https://${E}`);return h.host=E,h.protocol="https",f(h.toString(),l)},fetchWithAuth:r,async graphql(d,l,E={apiVersion:"alpha"}){let h=e?.host?.apiBaseUrl??x,g=await f(`https://${h}/graphql/${E.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:d,variables:l})});if(g.status!==200)throw new b(`GraphQL request failed with status ${g.status}`,g);let{data:m,errors:T}=await g.json();return{data:m??{},errors:T}},webhooks:o,servicePlugins:n}}function S(e){return e.headers?.get(w)??e.headers?.get(w.toLowerCase())}export{Qe as a};
2
- //# sourceMappingURL=chunk-WBKL5IQV.js.map
1
+ import{b as P}from"./chunk-Y4HYNW3N.js";import{a as R,b as M,d as $}from"./chunk-7EYXEF6M.js";import{f as _}from"./chunk-SBZEOPXX.js";$();import{wixContext as Z}from"@wix/sdk-context";var ee=e=>{switch(e){case"get":case"GET":return"GET";case"post":case"POST":return"POST";case"put":case"PUT":return"PUT";case"delete":case"DELETE":return"DELETE";case"patch":case"PATCH":return"PATCH";case"head":case"HEAD":return"HEAD";case"options":case"OPTIONS":return"OPTIONS";default:throw new Error(`Unknown method: ${e}`)}},q=e=>t=>async s=>{let a,r=n=>{if(a=e(s)(n),a.url===void 0)throw new Error("Url was not successfully created for this request, please reach out to support channels for assistance.");let{method:i,url:o,params:p}=a;return{...a,method:ee(i),url:o,data:a.data,params:p}};try{let n=await t.request(r);if(a===void 0)throw new Error("Request options were not created for this request, please reach out to support channels for assistance.");let i=Array.isArray(a.transformResponse)?a.transformResponse:[a.transformResponse],o=n.data;return i.forEach(p=>{p&&(o=p(n.data,n.headers))}),o}catch(n){throw typeof n=="object"&&n!==null&&"response"in n&&typeof n.response=="object"&&n.response!==null&&"data"in n.response?n.response.data:n}},j=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var N="__metadata",x="www.wixapis.com",O="edge.wixapis.com";var b=class extends Error{constructor(s,a){super(s);_(this,"message");_(this,"response");this.message=s,this.response=a}async details(){let s=await this.response.json();return te(this.response.status,s?.message,s?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:s})}},te=(e,t,s,a)=>({details:{...!s?.validationError&&{applicationError:{description:t,code:e,data:a}},...s},message:t,requestId:a?.requestId});var W=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},J=e=>e&&typeof e=="object"&&!Array.isArray(e);var D=e=>e.__type==="host";function F(e,t){return e.create(t)}var se="x-wix-bi-gateway";function k(e,t,s){return{[se]:re({environment:`js-sdk${s?`-${s}`:""}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function re(e){return Object.entries(e).filter(([t,s])=>!!s).map(([t,s])=>`${t}=${s}`).join(",")}function I(e){return ie(e).map(t=>t.toLocaleUpperCase()).join("_")}var ne=/([\p{Ll}\d])(\p{Lu})/gu,oe=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,B="$1\0$2",ae=/[^\p{L}\d]+/giu;function ie(e){let t=e.trim();t=t.replace(ne,B).replace(oe,B),t=t.replace(ae,"\0");let s=0,a=t.length;for(;t.charAt(s)==="\0";)s++;if(s===a)return[];for(;t.charAt(a-1)==="\0";)a--;return t.slice(s,a).split(/\0/g)}var de=e=>"validationError"in(e.response?.data?.details??{}),ce=e=>"applicationError"in(e.response?.data?.details??{}),pe=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function C(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},s=[]){if(typeof e!="object"||e===null)throw e;if(de(e))return ue(e,t,s);if(ce(e))return le(e);if(pe(e)){let a=e.response?.status,r=e.response?.statusText??"UNKNOWN",n=e.response?.data?.message??r,i={applicationError:{description:r,code:I(r),data:{}},requestId:e.requestId};return H(e,{message:JSON.stringify({message:n,details:i},null,2),extraProperties:{details:i,status:a}})}return fe(e)}var ue=(e,t,s)=>{let a=e.response?.data,r=e.requestId,{fieldViolations:n}=a.details.validationError,i=he(t,n,s)?.sort((f,c)=>f.field<c.field?-1:1),o=`INVALID_ARGUMENT: ${i?.map(({field:f,description:c})=>`"${f}" ${c}`)?.join(", ")}`,p={validationError:{fieldViolations:i},requestId:r};return H(e,{message:JSON.stringify({message:o,details:p},null,2),extraProperties:{details:p,status:e.response?.status,requestId:r}})},H=(e,{message:t,extraProperties:s})=>Object.assign(e,{...s,message:t}),le=e=>{let t=e.response?.status,s=e.response?.statusText??"UNKNOWN",a=e.response?.data?.message??s,r=e.response?.data?.details?.applicationError?.description??s,n=e.response?.data?.details?.applicationError?.code??I(s),i=e.response?.data?.details?.applicationError?.data??{},o=a===r?a:`${a}: ${r}`,p={applicationError:{description:r,code:n,data:i},requestId:e.requestId};return H(e,{message:JSON.stringify({message:o,details:p},null,2),extraProperties:{details:p,status:t,requestId:e.requestId}})},fe=e=>{let t=e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`;return H(e,{message:t,extraProperties:{requestId:e.requestId,status:e.response?.status,code:I(e.response?.statusText??"UNKNOWN"),...!e.response&&{runtimeError:e}}})},he=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:s},a,r)=>{let n={...e,...t},i=Object.keys(n);return a?.filter(o=>!a.some(f=>f.field.length>o.field.length&&f.field.startsWith(o.field)&&i.includes(f.field))).map(o=>{let p=t[o.field];if(p)return{...o,field:G(p,r)};let f=i?.sort((c,u)=>u.length-c.length)?.find(c=>o.field.startsWith(c));if(f){let c=n[f];if(c)return{...o,field:o.field.replace(f,G(c,r))}}return s?{...o,field:`${r[0]}.${o.field}`}:o})},G=(e,t)=>{let s=me(e);return s!==null&&typeof s<"u"?e.replace(`$[${s}]`,t[s]):e},me=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function X(e,t,s,a,r,n,i,o,p){return P(()=>e({request:async f=>{let c=f({host:i?.HTTPHost||x}),u=c;u.method==="GET"&&u.fallback?.length&&(u.params?.toString().length??0)>4e3&&(u=c.fallback[0]);let y=i?.HTTPHost??x,d=`https://${p?O:y}${u.url}`;u.params&&u.params.toString()&&(d+=`?${u.params.toString()}`);try{let l=k(c,t,o),E={method:u.method,...u.data&&{body:JSON.stringify(u.data)},headers:{...l}},h=await s(d,E);if(h.status!==200){let T=null;try{T=await h.json()}catch{}let A=ye(h.status,T?.message,T?.details,{requestId:h.headers.get("X-Wix-Request-Id"),details:T}),v=C(A);throw a?.handleError(v,{requestOptions:{url:u.url,method:u.method,entityFqdn:c.entityFqdn,methodFqn:c.methodFqn}}),A}let g=await h.json();return{data:u.migrationOptions?.optInTransformResponse&&u.transformResponse?Array.isArray(u.transformResponse)?u.transformResponse[0](g):u.transformResponse(g):g,headers:h.headers,status:h.status,statusText:h.statusText}}catch(l){throw l.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),l}},fetchWithAuth:s,wixAPIFetch:r,getActiveToken:n}))}var L=class extends Error{constructor(s){super();_(this,"response");_(this,"requestId");this.response=s.response,this.requestId=s.requestId}},ye=(e,t,s,a)=>new L({response:{data:{details:{...!s?.validationError&&{applicationError:{description:t,code:e,data:a}},...s},message:t},status:e},requestId:a?.requestId});$();function U(){return{emit(e,...t){for(let s=0,a=this.events[e]||[],r=a.length;s<r;s++)a[s](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(s=>t!==s)}}}}var Y=e=>e.__type==="event-definition";function K(e,t,s,a){let r;if(e.isDomainEvent){let i=s,{deletedEvent:o,actionEvent:p,createdEvent:f,updatedEvent:c,...u}=i,y={...a,...u};o?o?.deletedEntity?r={entity:o?.deletedEntity,metadata:y}:r={metadata:y}:p?r={data:p.body,metadata:y}:r={entity:f?.entity??c?.currentEntity,metadata:y}}else r={data:s,metadata:a};let n=e.transformations??(i=>i);return t(n(r))}function z(e){let t=new Map,s=U(),a={...s,getRegisteredEvents:()=>t,async process(r,n={expectedEvents:[]}){let{eventType:i,identity:o,instanceId:p,payload:f}=await this.parseJWT(r),c=[...n.expectedEvents,...Array.from(t.keys()).map(y=>({type:y}))];if(c.length>0&&!c.some(({type:y})=>y===i))throw new Error(`Unexpected event type: ${i}. Expected one of: ${c.map(y=>y.type).join(", ")}`);let u=t.get(i)??[];return await Promise.all(u.map(({eventDefinition:y,handler:d})=>K(y,d,f,{instanceId:p,identity:o}))),{instanceId:p,eventType:i,payload:f,identity:o}},async processRequest(r,n){let i=await r.text();return this.process(i,n)},async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:n,valid:i}=await e.decodeJWT(r);if(!i)throw new Error("JWT is not valid");if(typeof n.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof n.data}`);let o=JSON.parse(n.data),p=o.eventType,f=o.instanceId,c=o.identity?JSON.parse(o.identity):void 0,u=JSON.parse(o.data);return{instanceId:f,eventType:p,payload:u,identity:c}},async parseRequest(r){let n=await r.text();return this.parseJWT(n)},async executeHandlers(r){let n=Array.from(t.keys()).map(o=>({type:o}));if(n.length>0&&!n.some(({type:o})=>o===r.eventType))throw new Error(`Unexpected event type: ${r.eventType}. Expected one of: ${n.map(o=>o.type).join(", ")}`);let i=t.get(r.eventType)??[];await Promise.all(i.map(({eventDefinition:o,handler:p})=>K(o,p,r.payload,{instanceId:r.instanceId,identity:r.identity})))},apps:{AppInstalled:R("AppInstalled")(),AppRemoved:R("AppRemoved")()}};return{initModule(r){return n=>{let i=t.get(r.type)??[];i.push({eventDefinition:r,handler:n}),t.set(r.type,i),s.emit("registered",r)}},client:a}}var Q=e=>e.__type==="service-plugin-definition";function V(e){let t=new Map,s=U(),a={...s,getRegisteredServicePlugins:()=>t,async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:n,valid:i}=await e.decodeJWT(r,!0);if(!i)throw new Error("JWT is not valid");if(typeof n.data!="object"||n.data===null||!("metadata"in n.data)||typeof n.data.metadata!="object"||n.data.metadata===null||!("appExtensionType"in n.data.metadata)||typeof n.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return n.data},async process(r){let n=await this.parseJWT(r.body);return this.executeHandler(n,r.url)},async parseRequest(r){let n=await r.text();return this.parseJWT(n)},async processRequest(r){let n=r.url,i=await r.text();try{let o=await this.process({url:n,body:i});return Response.json(o)}catch(o){if(o.errorType==="SPI"&&o.applicationCode&&o.httpCode)return Response.json({applicationError:{code:o.applicationCode,data:o.data}},{status:o.httpCode});throw o}},async executeHandler(r,n){let i=r.metadata.appExtensionType.toLowerCase(),o=t.get(i)??[];if(o.length===0)throw new Error(`No service plugin implementations found for component type ${i}`);if(o.length>1)throw new Error(`Multiple service plugin implementations found for component type ${i}. This is currently not supported`);let{implementation:p,servicePluginDefinition:f}=o[0],c=f.methods.find(y=>n.endsWith(y.primaryHttpMappingPath));if(!c)throw new Error("Unexpect request: request url did not match any method: "+n);let u=p[c.name];if(!u)throw new Error(`Got request for service plugin method ${c.name} but no implementation was provided. Available methods: ${Object.keys(p).join(", ")}`);return c.transformations.toREST(await u(c.transformations.fromREST(r)))}};return{initModule(r){return n=>{let i=t.get(r.componentType.toLowerCase())??[];i.push({servicePluginDefinition:r,implementation:n}),t.set(r.componentType.toLowerCase(),i),s.emit("registered",r)}},client:a}}var w="X-Wix-Consistent";function Qe(e){let t=e.headers||{Authorization:""},s=e.auth||{getAuthHeaders:d=>Promise.resolve({headers:{}})},a=s.getAuthHeaders.bind(void 0,e.host);s.getAuthHeaders=a;let r=async(d,l)=>{let E=await a(),h={...l?.headers??{},...E.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}},g=e.host?.getErrorHandler?.();try{if(typeof d=="string"||d instanceof URL){let m=await fetch(d,{...l,headers:h});g?.handleError(m,{requestOptions:{url:d.toString(),method:l?.method}});let T=S(m);return T&&(t[w]=T),m}else{for(let[A,v]of Object.entries(h))typeof v=="string"&&d.headers.set(A,v);let m=await fetch(d,l);g?.handleError(m,{requestOptions:{url:d.url,method:l?.method}});let T=S(m);return T&&(t[w]=T),m}}catch(m){throw g?.handleError(m,{requestOptions:{url:typeof d=="string"||d instanceof URL?d.toString():d.url,method:l?.method}}),m}},{client:n,initModule:i}=V(s),{client:o,initModule:p}=z(s),f=async(d,l)=>{let E=await a(),h=W(l),g=await fetch(d,{...l,headers:{...h,...t,...E?.headers,...l?.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}}}),m=S(g);return m&&(t[w]=m),g},c=(d,l)=>{if(Y(d))return p(d);if(Q(d))return i(d);if(D(d)&&e.host)return F(d,e.host);if(typeof d=="function"){if("__type"in d&&d.__type===M)return d;let E=e.host?.apiBaseUrl??x,h=e.useCDN===void 0?e.auth?.shouldUseCDN:e.useCDN;return X(P(()=>j(d))?q(d):d,l??{},f,e.host?.getErrorHandler?.(),(g,m)=>{let T=new URL(g,`https://${E}`);return T.host=E,T.protocol="https",f(T.toString(),m)},s.getActiveToken,{HTTPHost:E},e.host?.name,h)}else return J(d)?Object.fromEntries(Object.entries(d).map(([E,h])=>[E,c(h,d[N])])):d},u=d=>{for(let l in d)t[l]=d[l]};return{...e.modules?c(e.modules):{},auth:s,setHeaders:u,use:c,enableContext(d,l={elevated:!1}){d==="global"?globalThis.__wix_context__!=null?l.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:l.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:l.elevated?Z.elevatedClient=this:Z.client=this},fetch:(d,l)=>{let E=e.host?.apiBaseUrl??x,h=new URL(d,`https://${E}`);return h.host=E,h.protocol="https",f(h.toString(),l)},fetchWithAuth:r,async graphql(d,l,E={apiVersion:"alpha"}){let h=e?.host?.apiBaseUrl??x,g=await f(`https://${h}/graphql/${E.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:d,variables:l})});if(g.status!==200)throw new b(`GraphQL request failed with status ${g.status}`,g);let{data:m,errors:T}=await g.json();return{data:m??{},errors:T}},webhooks:o,servicePlugins:n}}function S(e){return e.headers?.get(w)??e.headers?.get(w.toLowerCase())}export{Qe as a};
2
+ //# sourceMappingURL=chunk-RJD2G2AE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/@wix/sdk/build/wixClient.js","../../../node_modules/@wix/sdk/build/ambassador-modules.js","../../../node_modules/@wix/sdk/build/common.js","../../../node_modules/@wix/sdk/build/fetch-error.js","../../../node_modules/@wix/sdk/build/helpers.js","../../../node_modules/@wix/sdk/build/host-modules.js","../../../node_modules/@wix/sdk/build/bi/biHeaderGenerator.js","../../../node_modules/@wix/sdk-runtime/build/utils.js","../../../node_modules/@wix/sdk-runtime/build/transform-error.js","../../../node_modules/@wix/sdk/build/rest-modules.js","../../../node_modules/@wix/sdk/build/event-handlers-modules.js","../../../node_modules/@wix/sdk/build/nanoevents.js","../../../node_modules/@wix/sdk/build/service-plugin-modules.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nimport { SERVICE_PLUGIN_ERROR_TYPE, } from '@wix/sdk-types';\nimport { isAmbassadorModule, toHTTPModule } from './ambassador-modules.js';\nimport { DEFAULT_API_URL, PUBLIC_METADATA_KEY } from './common.js';\nimport { FetchErrorResponse } from './fetch-error.js';\nimport { getDefaultContentHeader, isObject } from './helpers.js';\nimport { buildHostModule, isHostModule } from './host-modules.js';\nimport { buildRESTDescriptor } from './rest-modules.js';\nimport { eventHandlersModules, isEventHandlerModule, } from './event-handlers-modules.js';\nimport { isServicePluginModule, servicePluginsModules, } from './service-plugin-modules.js';\nimport { runWithoutContext } from '@wix/sdk-runtime/context';\nexport const X_WIX_CONSISTENT_HEADER = 'X-Wix-Consistent';\nexport function createClient(config) {\n const _headers = config.headers || { Authorization: '' };\n const authStrategy = config.auth ||\n {\n getAuthHeaders: (_) => Promise.resolve({ headers: {} }),\n };\n const boundGetAuthHeaders = authStrategy.getAuthHeaders.bind(undefined, config.host);\n authStrategy.getAuthHeaders = boundGetAuthHeaders;\n const fetchWithAuth = async (urlOrRequest, requestInit) => {\n const authHeaders = await boundGetAuthHeaders();\n const headers = {\n ...(requestInit?.headers ?? {}),\n ...authHeaders.headers,\n ...config.host?.essentials?.passThroughHeaders,\n ...(_headers[X_WIX_CONSISTENT_HEADER]\n ? { [X_WIX_CONSISTENT_HEADER]: _headers[X_WIX_CONSISTENT_HEADER] }\n : {}),\n };\n const errorHandler = config.host?.getErrorHandler?.();\n try {\n if (typeof urlOrRequest === 'string' || urlOrRequest instanceof URL) {\n const response = await fetch(urlOrRequest, {\n ...requestInit,\n headers,\n });\n errorHandler?.handleError(response, {\n requestOptions: {\n url: urlOrRequest.toString(),\n method: requestInit?.method,\n },\n });\n const consistentHeader = findConsistentHeader(response);\n if (consistentHeader) {\n _headers[X_WIX_CONSISTENT_HEADER] = consistentHeader;\n }\n return response;\n }\n else {\n for (const [k, v] of Object.entries(headers)) {\n if (typeof v === 'string') {\n urlOrRequest.headers.set(k, v);\n }\n }\n const response = await fetch(urlOrRequest, requestInit);\n errorHandler?.handleError(response, {\n requestOptions: {\n url: urlOrRequest.url,\n method: requestInit?.method,\n },\n });\n const consistentHeader = findConsistentHeader(response);\n if (consistentHeader) {\n _headers[X_WIX_CONSISTENT_HEADER] = consistentHeader;\n }\n return response;\n }\n }\n catch (e) {\n errorHandler?.handleError(e, {\n requestOptions: {\n url: typeof urlOrRequest === 'string' || urlOrRequest instanceof URL\n ? urlOrRequest.toString()\n : urlOrRequest.url,\n method: requestInit?.method,\n },\n });\n throw e;\n }\n };\n const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(authStrategy);\n const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(authStrategy);\n const boundFetch = async (url, options) => {\n const authHeaders = await boundGetAuthHeaders();\n const defaultContentTypeHeader = getDefaultContentHeader(options);\n const response = await fetch(url, {\n ...options,\n headers: {\n ...defaultContentTypeHeader,\n ..._headers,\n ...authHeaders?.headers,\n ...options?.headers,\n ...config.host?.essentials?.passThroughHeaders,\n // Ensure consistent header always takes precedence\n ...(_headers[X_WIX_CONSISTENT_HEADER]\n ? { [X_WIX_CONSISTENT_HEADER]: _headers[X_WIX_CONSISTENT_HEADER] }\n : {}),\n },\n });\n const consistentHeader = findConsistentHeader(response);\n if (consistentHeader) {\n _headers[X_WIX_CONSISTENT_HEADER] = consistentHeader;\n }\n return response;\n };\n // This is typed as `any` because when trying to properly type it as defined\n // on the WixClient, typescript starts failing with `Type instantiation is\n // excessively deep and possibly infinite.`\n const use = (modules, metadata) => {\n if (isEventHandlerModule(modules)) {\n return initEventHandlerModule(modules);\n }\n else if (isServicePluginModule(modules)) {\n return initServicePluginModule(modules);\n }\n else if (isHostModule(modules) && config.host) {\n return buildHostModule(modules, config.host);\n }\n else if (typeof modules === 'function') {\n // The generated namespaces all have the error classes on them and\n // a class is also a function, so we need to explicitly ignore these\n // error classes using a static field that exists on them.\n if ('__type' in modules && modules.__type === SERVICE_PLUGIN_ERROR_TYPE) {\n return modules;\n }\n const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;\n const shouldUseCDN = config.useCDN === undefined ? config.auth?.shouldUseCDN : config.useCDN;\n return buildRESTDescriptor(runWithoutContext(() => isAmbassadorModule(modules))\n ? toHTTPModule(modules)\n : modules, metadata ?? {}, boundFetch, config.host?.getErrorHandler?.(), (relativeUrl, fetchOptions) => {\n const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);\n finalUrl.host = apiBaseUrl;\n finalUrl.protocol = 'https';\n return boundFetch(finalUrl.toString(), fetchOptions);\n }, authStrategy.getActiveToken, { HTTPHost: apiBaseUrl }, config.host?.name, shouldUseCDN);\n }\n else if (isObject(modules)) {\n return Object.fromEntries(Object.entries(modules).map(([key, value]) => {\n return [key, use(value, modules[PUBLIC_METADATA_KEY])];\n }));\n }\n else {\n return modules;\n }\n };\n const setHeaders = (headers) => {\n for (const k in headers) {\n _headers[k] = headers[k];\n }\n };\n const wrappedModules = config.modules\n ? use(config.modules)\n : {};\n return {\n ...wrappedModules,\n auth: authStrategy,\n setHeaders,\n use,\n enableContext(contextType, opts = { elevated: false }) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n if (opts.elevated) {\n globalThis.__wix_context__.elevatedClient = this;\n }\n else {\n globalThis.__wix_context__.client = this;\n }\n }\n else {\n if (opts.elevated) {\n globalThis.__wix_context__ = { elevatedClient: this };\n }\n else {\n globalThis.__wix_context__ = { client: this };\n }\n }\n }\n else {\n if (opts.elevated) {\n wixContext.elevatedClient = this;\n }\n else {\n wixContext.client = this;\n }\n }\n },\n /**\n * @param relativeUrl The URL to fetch relative to the API base URL\n * @param options The fetch options\n * @returns The fetch Response object\n * @deprecated Use `fetchWithAuth` instead\n */\n fetch: (relativeUrl, options) => {\n const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;\n const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);\n finalUrl.host = apiBaseUrl;\n finalUrl.protocol = 'https';\n return boundFetch(finalUrl.toString(), options);\n },\n fetchWithAuth,\n async graphql(query, variables, opts = {\n apiVersion: 'alpha',\n }) {\n const apiBaseUrl = config?.host?.apiBaseUrl ?? DEFAULT_API_URL;\n const res = await boundFetch(`https://${apiBaseUrl}/graphql/${opts.apiVersion}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ query, variables }),\n });\n if (res.status !== 200) {\n throw new FetchErrorResponse(`GraphQL request failed with status ${res.status}`, res);\n }\n const { data, errors } = await res.json();\n return { data: data ?? {}, errors };\n },\n webhooks: eventHandlersClient,\n servicePlugins: servicePluginsClient,\n };\n}\nfunction findConsistentHeader(response) {\n return (response.headers?.get(X_WIX_CONSISTENT_HEADER) ??\n response.headers?.get(X_WIX_CONSISTENT_HEADER.toLowerCase()));\n}\n","const parseMethod = (method) => {\n switch (method) {\n case 'get':\n case 'GET':\n return 'GET';\n case 'post':\n case 'POST':\n return 'POST';\n case 'put':\n case 'PUT':\n return 'PUT';\n case 'delete':\n case 'DELETE':\n return 'DELETE';\n case 'patch':\n case 'PATCH':\n return 'PATCH';\n case 'head':\n case 'HEAD':\n return 'HEAD';\n case 'options':\n case 'OPTIONS':\n return 'OPTIONS';\n default:\n throw new Error(`Unknown method: ${method}`);\n }\n};\nexport const toHTTPModule = (factory) => (httpClient) => async (payload) => {\n let requestOptions;\n const HTTPFactory = (context) => {\n requestOptions = factory(payload)(context);\n if (requestOptions.url === undefined) {\n throw new Error('Url was not successfully created for this request, please reach out to support channels for assistance.');\n }\n const { method, url, params } = requestOptions;\n return {\n ...requestOptions,\n method: parseMethod(method),\n url,\n data: requestOptions.data,\n params,\n };\n };\n try {\n const response = await httpClient.request(HTTPFactory);\n if (requestOptions === undefined) {\n throw new Error('Request options were not created for this request, please reach out to support channels for assistance.');\n }\n const transformations = Array.isArray(requestOptions.transformResponse)\n ? requestOptions.transformResponse\n : [requestOptions.transformResponse];\n /**\n * Based on Axios implementation:\n * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/lib/core/transformData.js#L22\n */\n let data = response.data;\n transformations.forEach((transform) => {\n if (transform) {\n data = transform(response.data, response.headers);\n }\n });\n return data;\n }\n catch (e) {\n if (typeof e === 'object' &&\n e !== null &&\n 'response' in e &&\n typeof e.response === 'object' &&\n e.response !== null &&\n 'data' in e.response) {\n throw e.response.data;\n }\n throw e;\n }\n};\n/*\n * Because of issues with tree-shaking, we cant really put static parameter on module.\n * We still have check for __isAmbassador for backward compatibility\n */\nexport const isAmbassadorModule = (module) => {\n if (module.__isAmbassador) {\n return true;\n }\n const fn = module();\n return Boolean(fn.__isAmbassador);\n};\n","export const PUBLIC_METADATA_KEY = '__metadata';\nexport const DEFAULT_API_URL = 'www.wixapis.com';\nexport const DEFAULT_EDGE_API_URL = 'edge.wixapis.com';\nexport const FORCE_WRITE_API_URLS = ['/ecom/v1/carts/current'];\n","export class FetchErrorResponse extends Error {\n message;\n response;\n constructor(message, response) {\n super(message);\n this.message = message;\n this.response = response;\n }\n async details() {\n const dataError = await this.response.json();\n return errorBuilder(this.response.status, dataError?.message, dataError?.details, {\n requestId: this.response.headers.get('X-Wix-Request-Id'),\n details: dataError,\n });\n }\n}\nconst errorBuilder = (code, description, details, data) => {\n return {\n details: {\n ...(!details?.validationError && {\n applicationError: {\n description,\n code,\n data,\n },\n }),\n ...details,\n },\n message: description,\n requestId: data?.requestId,\n };\n};\n","// we follow a simplified version of the axios convention\n// https://github.com/axios/axios/blob/649d739288c8e2c55829ac60e2345a0f3439c730/lib/defaults/index.js#L65\nexport const getDefaultContentHeader = (options) => {\n if (options?.method &&\n ['post', 'put', 'patch'].includes(options.method.toLocaleLowerCase()) &&\n options.body) {\n return { 'Content-Type': 'application/json' };\n }\n return {};\n};\nexport const isObject = (val) => val && typeof val === 'object' && !Array.isArray(val);\nexport function parsePublicKeyIfEncoded(publicKey) {\n if (publicKey.includes('\\n') || publicKey.includes('\\r')) {\n // publicKey is multi-line string, can be used as is\n return publicKey.trim();\n }\n else {\n // publicKey is base64 encoded\n return typeof atob !== 'undefined'\n ? atob(publicKey)\n : Buffer.from(publicKey, 'base64').toString('utf-8');\n }\n}\n","export const isHostModule = (val) => val.__type === 'host';\nexport function buildHostModule(val, host) {\n return val.create(host);\n}\n","export const WixBIHeaderName = 'x-wix-bi-gateway';\nexport function biHeaderGenerator(apiMetadata, publicMetadata, environment) {\n return {\n [WixBIHeaderName]: objectToKeyValue({\n environment: `js-sdk${environment ? `-${environment}` : ``}`,\n 'package-name': apiMetadata.packageName ?? publicMetadata?.PACKAGE_NAME,\n 'method-fqn': apiMetadata.methodFqn,\n entity: apiMetadata.entityFqdn,\n }),\n };\n}\nfunction objectToKeyValue(input) {\n return Object.entries(input)\n .filter(([_, value]) => Boolean(value))\n .map(([key, value]) => `${key}=${value}`)\n .join(',');\n}\n","import { WIX_PROTOCOL } from './constants.js';\nexport function alignIfLegacy(url, type) {\n const { protocol } = new URL(url);\n return protocol === `${type}:` ? `${WIX_PROTOCOL}${url}` : url;\n}\nexport function removeUndefinedKeys(obj) {\n return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));\n}\nexport function constantCase(input) {\n return split(input)\n .map((part) => part.toLocaleUpperCase())\n .join('_');\n}\nconst SPLIT_LOWER_UPPER_RE = /([\\p{Ll}\\d])(\\p{Lu})/gu;\nconst SPLIT_UPPER_UPPER_RE = /(\\p{Lu})([\\p{Lu}][\\p{Ll}])/gu;\nconst SPLIT_REPLACE_VALUE = '$1\\0$2';\nconst DEFAULT_STRIP_REGEXP = /[^\\p{L}\\d]+/giu;\nexport function split(value) {\n let result = value.trim();\n result = result\n .replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)\n .replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);\n result = result.replace(DEFAULT_STRIP_REGEXP, '\\0');\n let start = 0;\n let end = result.length;\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === '\\0') {\n start++;\n }\n if (start === end) {\n return [];\n }\n while (result.charAt(end - 1) === '\\0') {\n end--;\n }\n return result.slice(start, end).split(/\\0/g);\n}\n","import { constantCase } from './utils.js';\nconst isValidationError = (httpClientError) => 'validationError' in (httpClientError.response?.data?.details ?? {});\nconst isApplicationError = (httpClientError) => 'applicationError' in\n (httpClientError.response?.data?.details ?? {});\nconst isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 &&\n (httpClientError.response?.status ?? -1) < 500;\nexport function transformError(httpClientError, pathsToArguments = {\n explicitPathsToArguments: {},\n spreadPathsToArguments: {},\n singleArgumentUnchanged: false,\n}, argumentNames = []) {\n if (typeof httpClientError !== 'object' || httpClientError === null) {\n throw httpClientError;\n }\n if (isValidationError(httpClientError)) {\n return buildValidationError(httpClientError, pathsToArguments, argumentNames);\n }\n if (isApplicationError(httpClientError)) {\n return buildApplicationError(httpClientError);\n }\n if (isClientError(httpClientError)) {\n const status = httpClientError.response?.status;\n const statusText = httpClientError.response?.statusText ?? 'UNKNOWN';\n const message = httpClientError.response?.data?.message ?? statusText;\n const details = {\n applicationError: {\n description: statusText,\n code: constantCase(statusText),\n data: {},\n },\n requestId: httpClientError.requestId,\n };\n return wrapError(httpClientError, {\n message: JSON.stringify({\n message,\n details,\n }, null, 2),\n extraProperties: {\n details,\n status,\n },\n });\n }\n return buildSystemError(httpClientError);\n}\nconst buildValidationError = (httpClientError, pathsToArguments, argumentNames) => {\n const validationErrorResponse = httpClientError.response\n ?.data;\n const requestId = httpClientError.requestId;\n const { fieldViolations } = validationErrorResponse.details.validationError;\n const transformedFieldViolations = violationsWithRenamedFields(pathsToArguments, fieldViolations, argumentNames)?.sort((a, b) => (a.field < b.field ? -1 : 1));\n const message = `INVALID_ARGUMENT: ${transformedFieldViolations\n ?.map(({ field, description }) => `\"${field}\" ${description}`)\n ?.join(', ')}`;\n const details = {\n validationError: { fieldViolations: transformedFieldViolations },\n requestId,\n };\n return wrapError(httpClientError, {\n message: JSON.stringify({ message, details }, null, 2),\n extraProperties: {\n details,\n status: httpClientError.response?.status,\n requestId,\n },\n });\n};\nconst wrapError = (baseError, { message, extraProperties, }) => {\n return Object.assign(baseError, {\n ...extraProperties,\n message,\n });\n};\nconst buildApplicationError = (httpClientError) => {\n const status = httpClientError.response?.status;\n const statusText = httpClientError.response?.statusText ?? 'UNKNOWN';\n const message = httpClientError.response?.data?.message ?? statusText;\n const description = httpClientError.response?.data?.details?.applicationError?.description ??\n statusText;\n const code = httpClientError.response?.data?.details?.applicationError?.code ??\n constantCase(statusText);\n const data = httpClientError.response?.data?.details?.applicationError?.data ?? {};\n const combinedMessage = message === description ? message : `${message}: ${description}`;\n const details = {\n applicationError: {\n description,\n code,\n data,\n },\n requestId: httpClientError.requestId,\n };\n return wrapError(httpClientError, {\n message: JSON.stringify({ message: combinedMessage, details }, null, 2),\n extraProperties: {\n details,\n status,\n requestId: httpClientError.requestId,\n },\n });\n};\nconst buildSystemError = (httpClientError) => {\n const message = httpClientError.requestId\n ? `System error occurred, request-id: ${httpClientError.requestId}`\n : `System error occurred: ${JSON.stringify(httpClientError)}`;\n return wrapError(httpClientError, {\n message,\n extraProperties: {\n requestId: httpClientError.requestId,\n status: httpClientError.response?.status,\n code: constantCase(httpClientError.response?.statusText ?? 'UNKNOWN'),\n ...(!httpClientError.response && {\n runtimeError: httpClientError,\n }),\n },\n });\n};\nconst violationsWithRenamedFields = ({ spreadPathsToArguments, explicitPathsToArguments, singleArgumentUnchanged, }, fieldViolations, argumentNames) => {\n const allPathsToArguments = {\n ...spreadPathsToArguments,\n ...explicitPathsToArguments,\n };\n const allPathsToArgumentsKeys = Object.keys(allPathsToArguments);\n return fieldViolations\n ?.filter((fieldViolation) => {\n // In some cases, the violations error will include both some.nested and some.nested.path,\n // so we'll pick the more specific one if it's covered by the paths in the transformation.\n const containedInAMoreSpecificViolationField = fieldViolations.some((anotherViolation) => anotherViolation.field.length > fieldViolation.field.length &&\n anotherViolation.field.startsWith(fieldViolation.field) &&\n allPathsToArgumentsKeys.includes(anotherViolation.field));\n return !containedInAMoreSpecificViolationField;\n })\n .map((fieldViolation) => {\n // This means we've got some.nested.field in the violation,\n // matched against { some: { nested: { field: $[0].a.b.c } } } in the transformation.\n // some.nested.field is replaced entirely with $[0].a.b.c, with $[0] replaced with the name of argument 0\n const exactMatchArgumentExpression = explicitPathsToArguments[fieldViolation.field];\n if (exactMatchArgumentExpression) {\n return {\n ...fieldViolation,\n field: withRenamedArgument(exactMatchArgumentExpression, argumentNames),\n };\n }\n const longestPartialPathMatch = allPathsToArgumentsKeys\n ?.sort((a, b) => b.length - a.length)\n ?.find((path) => fieldViolation.field.startsWith(path));\n if (longestPartialPathMatch) {\n // This means we've got some.nested.field in the violation,\n // matched against { some: { nested: { *: $[0].a.b.c } } } in the transformation.\n // Only the prefix some.nested is replaced with $[0].a.b.c, with $[0] replaced with the name of argument 0\n // This can also happen in the case where the #wrap function is used.\n const partialMatchArgumentExpression = allPathsToArguments[longestPartialPathMatch];\n if (partialMatchArgumentExpression) {\n return {\n ...fieldViolation,\n field: fieldViolation.field.replace(longestPartialPathMatch, withRenamedArgument(partialMatchArgumentExpression, argumentNames)),\n };\n }\n }\n if (singleArgumentUnchanged) {\n return {\n ...fieldViolation,\n field: `${argumentNames[0]}.${fieldViolation.field}`,\n };\n }\n return fieldViolation;\n });\n};\nconst withRenamedArgument = (fieldValue, argumentNames) => {\n const argIndex = getArgumentIndex(fieldValue);\n if (argIndex !== null && typeof argIndex !== 'undefined') {\n return fieldValue.replace(`$[${argIndex}]`, argumentNames[argIndex]);\n }\n return fieldValue;\n};\nconst getArgumentIndex = (s) => {\n const match = s.match(/\\$\\[(?<argIndex>\\d+)\\]/);\n return match && match.groups && Number(match.groups.argIndex);\n};\n","import { biHeaderGenerator } from './bi/biHeaderGenerator.js';\nimport { DEFAULT_API_URL, DEFAULT_EDGE_API_URL } from './common.js';\nimport { runWithoutContext } from '@wix/sdk-runtime/context';\nimport { transformError } from '@wix/sdk-runtime/transform-error';\nexport function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, errorHandler, wixAPIFetch, getActiveToken, options, hostName, useCDN) {\n return runWithoutContext(() => origFunc({\n request: async (factory) => {\n const requestOptions = factory({\n host: options?.HTTPHost || DEFAULT_API_URL,\n });\n let request = requestOptions;\n if (request.method === 'GET' &&\n request.fallback?.length &&\n (request.params?.toString().length ?? 0) > 4000) {\n request = requestOptions.fallback[0];\n }\n const domain = options?.HTTPHost ?? DEFAULT_API_URL;\n let url = `https://${useCDN ? DEFAULT_EDGE_API_URL : domain}${request.url}`;\n if (request.params && request.params.toString()) {\n url += `?${request.params.toString()}`;\n }\n try {\n const biHeader = biHeaderGenerator(requestOptions, publicMetadata, hostName);\n const requestOptionsInit = {\n method: request.method,\n ...(request.data && {\n body: JSON.stringify(request.data),\n }),\n headers: {\n ...biHeader,\n },\n };\n const res = await boundFetch(url, requestOptionsInit);\n if (res.status !== 200) {\n let dataError = null;\n try {\n dataError = await res.json();\n }\n catch (e) {\n //\n }\n const error = errorBuilder(res.status, dataError?.message, dataError?.details, {\n requestId: res.headers.get('X-Wix-Request-Id'),\n details: dataError,\n });\n const transformedError = transformError(error);\n errorHandler?.handleError(transformedError, {\n requestOptions: {\n url: request.url,\n method: request.method,\n entityFqdn: requestOptions.entityFqdn,\n methodFqn: requestOptions.methodFqn,\n },\n });\n throw error;\n }\n const rawData = await res.json();\n const data = \n // we only transform the response if the optInTransformResponse flag is set\n // this is for backwards compatibility as some users might rely on not transforming the response\n // in older modules. In that case the modules would not have the optInTransformResponse flag set\n request.migrationOptions?.optInTransformResponse &&\n request.transformResponse\n ? Array.isArray(request.transformResponse)\n ? request.transformResponse[0](rawData)\n : request.transformResponse(rawData)\n : rawData;\n return {\n data,\n headers: res.headers,\n status: res.status,\n statusText: res.statusText,\n };\n }\n catch (e) {\n if (e.message?.includes('fetch is not defined')) {\n console.error('Node.js v18+ is required');\n }\n throw e;\n }\n },\n fetchWithAuth: boundFetch,\n wixAPIFetch,\n getActiveToken,\n }));\n}\nclass SDKError extends Error {\n response;\n requestId;\n constructor(params) {\n super();\n this.response = params.response;\n this.requestId = params.requestId;\n }\n}\nconst errorBuilder = (code, description, details, data) => {\n return new SDKError({\n response: {\n data: {\n details: {\n ...(!details?.validationError && {\n applicationError: {\n description,\n code,\n data,\n },\n }),\n ...details,\n },\n message: description,\n },\n status: code,\n },\n requestId: data?.requestId,\n });\n};\n","import { EventDefinition, } from '@wix/sdk-types';\nimport { createNanoEvents } from './nanoevents.js';\nexport const isEventHandlerModule = (val) => val.__type === 'event-definition';\nexport function buildEventDefinition(eventDefinition, registerHandler) {\n return (handler) => {\n registerHandler(eventDefinition, handler);\n };\n}\nfunction runHandler(eventDefinition, handler, payload, baseEventMetadata) {\n let envelope;\n if (eventDefinition.isDomainEvent) {\n const domainEventPayload = payload;\n const { deletedEvent, actionEvent, createdEvent, updatedEvent, ...domainEventMetadata } = domainEventPayload;\n const metadata = {\n ...baseEventMetadata,\n ...domainEventMetadata,\n };\n if (deletedEvent) {\n if (deletedEvent?.deletedEntity) {\n envelope = {\n entity: deletedEvent?.deletedEntity,\n metadata,\n };\n }\n else {\n envelope = { metadata };\n }\n }\n else if (actionEvent) {\n envelope = {\n data: actionEvent.body,\n metadata,\n };\n }\n else {\n envelope = {\n entity: createdEvent?.entity ?? updatedEvent?.currentEntity,\n metadata,\n };\n }\n }\n else {\n envelope = {\n data: payload,\n metadata: baseEventMetadata,\n };\n }\n const transformFromRESTFn = eventDefinition.transformations ?? ((x) => x);\n return handler(transformFromRESTFn(envelope));\n}\nexport function eventHandlersModules(authStrategy) {\n const eventHandlers = new Map();\n const webhooksEmitter = createNanoEvents();\n const client = {\n ...webhooksEmitter,\n getRegisteredEvents: () => eventHandlers,\n async process(jwt, opts = {\n expectedEvents: [],\n }) {\n const { eventType, identity, instanceId, payload } = await this.parseJWT(jwt);\n const allExpectedEvents = [\n ...opts.expectedEvents,\n ...Array.from(eventHandlers.keys()).map((type) => ({ type })),\n ];\n if (allExpectedEvents.length > 0 &&\n !allExpectedEvents.some(({ type }) => type === eventType)) {\n throw new Error(`Unexpected event type: ${eventType}. Expected one of: ${allExpectedEvents\n .map((x) => x.type)\n .join(', ')}`);\n }\n const handlers = eventHandlers.get(eventType) ?? [];\n await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, payload, {\n instanceId,\n identity,\n })));\n return {\n instanceId,\n eventType,\n payload,\n identity,\n };\n },\n async processRequest(request, opts) {\n const body = await request.text();\n return this.process(body, opts);\n },\n async parseJWT(jwt) {\n if (!authStrategy.decodeJWT) {\n throw new Error('decodeJWT is not supported by the authentication strategy');\n }\n const { decoded, valid } = await authStrategy.decodeJWT(jwt);\n if (!valid) {\n throw new Error('JWT is not valid');\n }\n if (typeof decoded.data !== 'string') {\n throw new Error(`Unexpected type of JWT data: expected string, got ${typeof decoded.data}`);\n }\n const parsedDecoded = JSON.parse(decoded.data);\n const eventType = parsedDecoded.eventType;\n const instanceId = parsedDecoded.instanceId;\n const identity = parsedDecoded.identity\n ? JSON.parse(parsedDecoded.identity)\n : undefined;\n const payload = JSON.parse(parsedDecoded.data);\n return {\n instanceId,\n eventType,\n payload,\n identity,\n };\n },\n async parseRequest(request) {\n const jwt = await request.text();\n return this.parseJWT(jwt);\n },\n async executeHandlers(event) {\n const allExpectedEvents = Array.from(eventHandlers.keys()).map((type) => ({ type }));\n if (allExpectedEvents.length > 0 &&\n !allExpectedEvents.some(({ type }) => type === event.eventType)) {\n throw new Error(`Unexpected event type: ${event.eventType}. Expected one of: ${allExpectedEvents\n .map((x) => x.type)\n .join(', ')}`);\n }\n const handlers = eventHandlers.get(event.eventType) ?? [];\n await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, event.payload, {\n instanceId: event.instanceId,\n identity: event.identity,\n })));\n },\n apps: {\n AppInstalled: EventDefinition('AppInstalled')(),\n AppRemoved: EventDefinition('AppRemoved')(),\n },\n };\n return {\n initModule(eventDefinition) {\n return (handler) => {\n const handlers = eventHandlers.get(eventDefinition.type) ?? [];\n handlers.push({ eventDefinition, handler });\n eventHandlers.set(eventDefinition.type, handlers);\n webhooksEmitter.emit('registered', eventDefinition);\n };\n },\n client,\n };\n}\n","// Inlined from https://github.com/ai/nanoevents/blob/main/index.js\n/**\n * Create event emitter.\n *\n * ```js\n * import { createNanoEvents } from 'nanoevents'\n *\n * class Ticker {\n * constructor() {\n * this.emitter = createNanoEvents()\n * }\n * on(...args) {\n * return this.emitter.on(...args)\n * }\n * tick() {\n * this.emitter.emit('tick')\n * }\n * }\n * ```\n * @returns Event emitter.\n */\nexport function createNanoEvents() {\n return {\n emit(event, ...args) {\n for (let i = 0, callbacks = this.events[event] || [], length = callbacks.length; i < length; i++) {\n callbacks[i](...args);\n }\n },\n events: {},\n on(event, cb) {\n (this.events[event] ||= []).push(cb);\n return () => {\n this.events[event] = this.events[event]?.filter((i) => cb !== i);\n };\n },\n };\n}\n","import { createNanoEvents } from './nanoevents.js';\nexport const isServicePluginModule = (val) => val.__type === 'service-plugin-definition';\nexport function servicePluginsModules(authStrategy) {\n const servicePluginsImplementations = new Map();\n const servicePluginsEmitter = createNanoEvents();\n const client = {\n ...servicePluginsEmitter,\n getRegisteredServicePlugins: () => servicePluginsImplementations,\n async parseJWT(jwt) {\n if (!authStrategy.decodeJWT) {\n throw new Error('decodeJWT is not supported by the authentication strategy');\n }\n const { decoded, valid } = await authStrategy.decodeJWT(jwt, true);\n if (!valid) {\n throw new Error('JWT is not valid');\n }\n if (typeof decoded.data !== 'object' ||\n decoded.data === null ||\n !('metadata' in decoded.data) ||\n typeof decoded.data.metadata !== 'object' ||\n decoded.data.metadata === null ||\n !('appExtensionType' in decoded.data.metadata) ||\n typeof decoded.data.metadata.appExtensionType !== 'string') {\n throw new Error('Unexpected JWT data: expected object with metadata.appExtensionType string');\n }\n return decoded.data;\n },\n async process(request) {\n const servicePluginRequest = await this.parseJWT(request.body);\n return this.executeHandler(servicePluginRequest, request.url);\n },\n async parseRequest(request) {\n const body = await request.text();\n return this.parseJWT(body);\n },\n async processRequest(request) {\n const url = request.url;\n const body = await request.text();\n try {\n const implMethodResult = await this.process({ url, body });\n return Response.json(implMethodResult);\n }\n catch (err) {\n if (err.errorType === 'SPI' && err.applicationCode && err.httpCode) {\n return Response.json({ applicationError: { code: err.applicationCode, data: err.data } }, { status: err.httpCode });\n }\n throw err;\n }\n },\n async executeHandler(servicePluginRequest, url) {\n const componentType = servicePluginRequest.metadata.appExtensionType.toLowerCase();\n const implementations = servicePluginsImplementations.get(componentType) ?? [];\n if (implementations.length === 0) {\n throw new Error(`No service plugin implementations found for component type ${componentType}`);\n }\n else if (implementations.length > 1) {\n throw new Error(`Multiple service plugin implementations found for component type ${componentType}. This is currently not supported`);\n }\n const { implementation: impl, servicePluginDefinition } = implementations[0];\n const method = servicePluginDefinition.methods.find((m) => url.endsWith(m.primaryHttpMappingPath));\n if (!method) {\n throw new Error('Unexpect request: request url did not match any method: ' + url);\n }\n const implMethod = impl[method.name];\n if (!implMethod) {\n throw new Error(`Got request for service plugin method ${method.name} but no implementation was provided. Available methods: ${Object.keys(impl).join(', ')}`);\n }\n return method.transformations.toREST(await implMethod(method.transformations.fromREST(servicePluginRequest)));\n },\n };\n return {\n initModule(servicePluginDefinition) {\n return (implementation) => {\n const implementations = servicePluginsImplementations.get(servicePluginDefinition.componentType.toLowerCase()) ?? [];\n implementations.push({ servicePluginDefinition, implementation });\n servicePluginsImplementations.set(servicePluginDefinition.componentType.toLowerCase(), implementations);\n servicePluginsEmitter.emit('registered', servicePluginDefinition);\n };\n },\n client,\n };\n}\n"],"mappings":"sIACAA,IADA,OAAS,cAAAC,MAAkB,mBCA3B,IAAMC,GAAeC,GAAW,CAC5B,OAAQA,EAAQ,CACZ,IAAK,MACL,IAAK,MACD,MAAO,MACX,IAAK,OACL,IAAK,OACD,MAAO,OACX,IAAK,MACL,IAAK,MACD,MAAO,MACX,IAAK,SACL,IAAK,SACD,MAAO,SACX,IAAK,QACL,IAAK,QACD,MAAO,QACX,IAAK,OACL,IAAK,OACD,MAAO,OACX,IAAK,UACL,IAAK,UACD,MAAO,UACX,QACI,MAAM,IAAI,MAAM,mBAAmBA,CAAM,EAAE,CACnD,CACJ,EACaC,EAAgBC,GA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CAC/CD,IAAgB,SACZ,WAAW,iBAAmB,KAC1BC,EAAK,SACL,WAAW,gBAAgB,eAAiB,KAG5C,WAAW,gBAAgB,OAAS,KAIpCA,EAAK,SACL,WAAW,gBAAkB,CAAE,eAAgB,IAAK,EAGpD,WAAW,gBAAkB,CAAE,OAAQ,IAAK,EAKhDA,EAAK,SACLC,EAAW,eAAiB,KAG5BA,EAAW,OAAS,IAGhC,EAOA,MAAO,CAACV,EAAalB,IAAY,CAC7B,IAAMW,EAAanC,EAAO,MAAM,YAAcoC,EACxCQ,EAAW,IAAI,IAAIF,EAAa,WAAWP,CAAU,EAAE,EAC7D,OAAAS,EAAS,KAAOT,EAChBS,EAAS,SAAW,QACbtB,EAAWsB,EAAS,SAAS,EAAGpB,CAAO,CAClD,EACA,cAAAnB,EACA,MAAM,QAAQgD,EAAOC,EAAWH,EAAO,CACnC,WAAY,OAChB,EAAG,CACC,IAAMhB,EAAanC,GAAQ,MAAM,YAAcoC,EACzCmB,EAAM,MAAMjC,EAAW,WAAWa,CAAU,YAAYgB,EAAK,UAAU,GAAI,CAC7E,OAAQ,OACR,QAAS,CACL,eAAgB,kBACpB,EACA,KAAM,KAAK,UAAU,CAAE,MAAAE,EAAO,UAAAC,CAAU,CAAC,CAC7C,CAAC,EACD,GAAIC,EAAI,SAAW,IACf,MAAM,IAAIC,EAAmB,sCAAsCD,EAAI,MAAM,GAAIA,CAAG,EAExF,GAAM,CAAE,KAAAE,EAAM,OAAAC,CAAO,EAAI,MAAMH,EAAI,KAAK,EACxC,MAAO,CAAE,KAAME,GAAQ,CAAC,EAAG,OAAAC,CAAO,CACtC,EACA,SAAUvC,EACV,eAAgBH,CACpB,CACJ,CACA,SAASH,EAAqBF,EAAU,CACpC,OAAQA,EAAS,SAAS,IAAIb,CAAuB,GACjDa,EAAS,SAAS,IAAIb,EAAwB,YAAY,CAAC,CACnE","names":["init_browser","wixContext","parseMethod","method","toHTTPModule","factory","httpClient","payload","requestOptions","HTTPFactory","context","url","params","response","transformations","data","transform","e","isAmbassadorModule","module","PUBLIC_METADATA_KEY","DEFAULT_API_URL","DEFAULT_EDGE_API_URL","FetchErrorResponse","message","response","__publicField","dataError","errorBuilder","code","description","details","data","getDefaultContentHeader","options","isObject","val","isHostModule","val","buildHostModule","host","WixBIHeaderName","biHeaderGenerator","apiMetadata","publicMetadata","environment","objectToKeyValue","input","_","value","key","constantCase","input","split","part","SPLIT_LOWER_UPPER_RE","SPLIT_UPPER_UPPER_RE","SPLIT_REPLACE_VALUE","DEFAULT_STRIP_REGEXP","value","result","start","end","isValidationError","httpClientError","isApplicationError","isClientError","transformError","pathsToArguments","argumentNames","buildValidationError","buildApplicationError","status","statusText","message","details","constantCase","wrapError","buildSystemError","validationErrorResponse","requestId","fieldViolations","transformedFieldViolations","violationsWithRenamedFields","a","b","field","description","baseError","extraProperties","code","data","combinedMessage","spreadPathsToArguments","explicitPathsToArguments","singleArgumentUnchanged","allPathsToArguments","allPathsToArgumentsKeys","fieldViolation","anotherViolation","exactMatchArgumentExpression","withRenamedArgument","longestPartialPathMatch","path","partialMatchArgumentExpression","fieldValue","argIndex","getArgumentIndex","s","match","buildRESTDescriptor","origFunc","publicMetadata","boundFetch","errorHandler","wixAPIFetch","getActiveToken","options","hostName","useCDN","runWithoutContext","factory","requestOptions","DEFAULT_API_URL","request","domain","url","DEFAULT_EDGE_API_URL","biHeader","biHeaderGenerator","requestOptionsInit","res","dataError","error","errorBuilder","transformedError","transformError","rawData","e","SDKError","params","__publicField","code","description","details","data","init_browser","createNanoEvents","event","args","i","callbacks","length","cb","isEventHandlerModule","val","runHandler","eventDefinition","handler","payload","baseEventMetadata","envelope","domainEventPayload","deletedEvent","actionEvent","createdEvent","updatedEvent","domainEventMetadata","metadata","transformFromRESTFn","x","eventHandlersModules","authStrategy","eventHandlers","webhooksEmitter","createNanoEvents","client","jwt","opts","eventType","identity","instanceId","allExpectedEvents","type","handlers","request","body","decoded","valid","parsedDecoded","event","EventDefinition","isServicePluginModule","val","servicePluginsModules","authStrategy","servicePluginsImplementations","servicePluginsEmitter","createNanoEvents","client","jwt","decoded","valid","request","servicePluginRequest","body","url","implMethodResult","err","componentType","implementations","impl","servicePluginDefinition","method","m","implMethod","implementation","X_WIX_CONSISTENT_HEADER","createClient","config","_headers","authStrategy","_","boundGetAuthHeaders","fetchWithAuth","urlOrRequest","requestInit","authHeaders","headers","errorHandler","response","consistentHeader","findConsistentHeader","k","e","servicePluginsClient","initServicePluginModule","servicePluginsModules","eventHandlersClient","initEventHandlerModule","eventHandlersModules","boundFetch","url","options","defaultContentTypeHeader","getDefaultContentHeader","use","modules","metadata","isEventHandlerModule","isServicePluginModule","isHostModule","buildHostModule","SERVICE_PLUGIN_ERROR_TYPE","apiBaseUrl","DEFAULT_API_URL","shouldUseCDN","buildRESTDescriptor","runWithoutContext","isAmbassadorModule","toHTTPModule","relativeUrl","fetchOptions","finalUrl","isObject","key","value","PUBLIC_METADATA_KEY","setHeaders","contextType","opts","wixContext","query","variables","res","FetchErrorResponse","data","errors"]}
@@ -1,2 +1,2 @@
1
1
  import{wixContext as n}from"@wix/sdk-context";function d(o,t){return(...i)=>{let e=u();return e?e.initWixModules(o,t).apply(void 0,i):o.apply(void 0,i)}}function u(){let o=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(o)return{initWixModules(e,l){return r(()=>o(e,l))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof n.client<"u"?n.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof n.elevatedClient<"u"?n.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!i))return{initWixModules(e,l){if(l){if(!i)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return r(()=>i.use(e))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return r(()=>t.use(e))},fetchWithAuth:(e,l)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(e,l)},getAuth(){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.auth},async graphql(e,l,x){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(e,l,x)}}}function r(o){let t=globalThis.__wix_context__,i={client:n.client,elevatedClient:n.elevatedClient},e;globalThis.__wix_context__=void 0,n.client=void 0,n.elevatedClient=void 0,typeof $wixContext<"u"&&(e={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return o()}finally{globalThis.__wix_context__=t,n.client=i.client,n.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=e.client,$wixContext.elevatedClient=e.elevatedClient)}}export{d as a,r as b};
2
- //# sourceMappingURL=chunk-R7FAXXP7.js.map
2
+ //# sourceMappingURL=chunk-Y4HYNW3N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk-runtime/build/context-v2.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n throw new Error('An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n getAuth() {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.auth;\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function getContextualAuth() {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.getAuth();\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { EventDefinition, ServicePluginDefinition, } from '@wix/sdk-types';\nimport { resolveContext } from './context.js';\nexport { EventDefinition, ServicePluginDefinition, };\nexport function contextualizeHostModuleV2(hostModule, props) {\n return {\n ...hostModule,\n ...Object.fromEntries(props.map((prop) => [\n prop,\n (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(hostModule)[prop].apply(undefined, args);\n },\n ])),\n };\n}\nexport function contextualizeRESTModuleV2(restModule, elevated) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n // @ts-expect-error - if there is no context, we want to behave like the original module\n return restModule.apply(undefined, args);\n }\n return (context\n .initWixModules(restModule, elevated)\n // @ts-expect-error - we know the args here are meant to be passed to the initalized module\n .apply(undefined, args));\n });\n}\nexport function contextualizeEventDefinitionModuleV2(eventDefinition) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => {\n // used by the CLI for webhook registration on build time\n return {\n slug: eventDefinition.type,\n };\n };\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n contextualMethod.__type = eventDefinition.__type;\n contextualMethod.type = eventDefinition.type;\n contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;\n contextualMethod.transformations = eventDefinition.transformations;\n return contextualMethod;\n}\nexport function contextualizeSerivcePluginModuleV2(servicePlugin) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n contextualMethod.__type = servicePlugin.__type;\n contextualMethod.componentType = servicePlugin.componentType;\n contextualMethod.methods = servicePlugin.methods;\n return contextualMethod;\n}\n"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,mBCmBpB,SAASC,EAA0BC,EAAYC,EAAU,CAC5D,MAAQ,IAAIC,IAAS,CACjB,IAAMC,EAAUC,EAAe,EAC/B,OAAKD,EAIGA,EACH,eAAeH,EAAYC,CAAQ,EAEnC,MAAM,OAAWC,CAAI,EALfF,EAAW,MAAM,OAAWE,CAAI,CAM/C,CACJ,CD9BO,SAASG,GAAiB,CA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H,OAAOA,EAAiB,QAAQM,EAAOC,EAAWC,CAAI,CAC1D,CACJ,CACJ,CA+CO,SAASC,EAAkBC,EAAI,CAClC,IAAMC,EAAgB,WAAW,gBAC3BC,EAAgB,CAClB,OAAQC,EAAW,OACnB,eAAgBA,EAAW,cAC/B,EACIC,EACJ,WAAW,gBAAkB,OAC7BD,EAAW,OAAS,OACpBA,EAAW,eAAiB,OACxB,OAAO,YAAgB,MACvBC,EAAiB,CACb,OAAQ,aAAa,OACrB,eAAgB,aAAa,cACjC,EACA,OAAO,YAAY,OACnB,OAAO,YAAY,gBAEvB,GAAI,CACA,OAAOJ,EAAG,CACd,QACA,CACI,WAAW,gBAAkBC,EAC7BE,EAAW,OAASD,EAAc,OAClCC,EAAW,eAAiBD,EAAc,eACtC,OAAO,YAAgB,MACvB,YAAY,OAASE,EAAe,OACpC,YAAY,eAAiBA,EAAe,eAEpD,CACJ","names":["wixContext","contextualizeRESTModuleV2","restModule","elevated","args","context","resolveContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","wixContext","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext"]}