@wix/cli-app 1.1.127 → 1.1.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{AddPermissionCommand-JFRWIRZI.js → AddPermissionCommand-SWMX36RL.js} +2 -2
- package/build/{DevCommand-3PRNRUFO.js → DevCommand-WT3TK4N7.js} +10 -10
- package/build/{GenerateCommand-NKNV35NN.js → GenerateCommand-X3CVLXLM.js} +7 -7
- package/build/{LogsCommand-BIPYLEUC.js → LogsCommand-B6ZWCUVZ.js} +3 -3
- package/build/PreviewCommand-G7RZZRA5.js +19 -0
- package/build/ReleaseCommand-MHJQ6PC5.js +23 -0
- package/build/{ServeCommand-DUKZODY6.js → ServeCommand-7YN4VIKD.js} +3 -3
- package/build/{build-FG6B7OQH.js → build-5Z4UY34D.js} +24 -7
- package/build/build-5Z4UY34D.js.map +1 -0
- package/build/{chunk-4KUHW5B7.js → chunk-3FY2AOJE.js} +2 -2
- package/build/{chunk-C73XJ57U.js → chunk-6XLUQZ5F.js} +2 -2
- package/build/{chunk-ROHDWZI4.js → chunk-6Z3URTTC.js} +3 -3
- package/build/{chunk-4SRMFEJA.js → chunk-CN5TC5DV.js} +2 -2
- package/build/{chunk-EXDWGPUM.js → chunk-E5RQWCTJ.js} +6 -6
- package/build/{chunk-6OIVUPHF.js → chunk-EDDVKT7T.js} +6 -6
- package/build/{chunk-6EOYAASV.js → chunk-FJ7TH3XD.js} +4 -4
- package/build/{chunk-C75VAILG.js → chunk-G4S5FTS3.js} +2 -2
- package/build/{chunk-4EAHNYEH.js → chunk-HV62P45K.js} +2 -2
- package/build/{chunk-T3EBYWJV.js → chunk-M432FMZZ.js} +45 -2
- package/build/chunk-M432FMZZ.js.map +1 -0
- package/build/{chunk-LC6RJKUL.js → chunk-MXW7RVZQ.js} +2 -2
- package/build/{chunk-XPNO6MSO.js → chunk-MYW44QQC.js} +7 -7
- package/build/{chunk-XPNO6MSO.js.map → chunk-MYW44QQC.js.map} +1 -1
- package/build/{chunk-C55WMKMJ.js → chunk-URLY2YGI.js} +22 -4
- package/build/{chunk-C55WMKMJ.js.map → chunk-URLY2YGI.js.map} +1 -1
- package/build/{chunk-TCBGU4X6.js → chunk-VUTYEP7L.js} +4 -4
- package/build/{chunk-U5ROEYJA.js → chunk-VY54JSUP.js} +2 -2
- package/build/{chunk-F3FIVJZD.js → chunk-Y7QMQO2O.js} +2 -2
- package/build/{chunk-UNCNFFF6.js → chunk-YN6G2AVC.js} +160 -60
- package/build/chunk-YN6G2AVC.js.map +1 -0
- package/build/index.js +23 -23
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/dashboard.js.map +1 -1
- package/build/platform-sdk/editor.js +1 -1
- package/build/platform-sdk/editor.js.map +1 -1
- package/build/platform-sdk/site.js +1 -1
- package/build/platform-sdk/site.js.map +1 -1
- package/build/{preview-QT6BIZNI.js → preview-2FJE66R2.js} +12 -12
- package/build/{release-7ITKDBFT.js → release-YTUA7L5B.js} +14 -14
- package/build/{render-command-XRP2XSWT.js → render-command-2PXTOG5R.js} +5 -5
- package/package.json +4 -4
- package/build/PreviewCommand-FWV6LIFS.js +0 -19
- package/build/ReleaseCommand-ZG5W6RG4.js +0 -23
- package/build/build-FG6B7OQH.js.map +0 -1
- package/build/chunk-T3EBYWJV.js.map +0 -1
- package/build/chunk-UNCNFFF6.js.map +0 -1
- /package/build/{AddPermissionCommand-JFRWIRZI.js.map → AddPermissionCommand-SWMX36RL.js.map} +0 -0
- /package/build/{DevCommand-3PRNRUFO.js.map → DevCommand-WT3TK4N7.js.map} +0 -0
- /package/build/{GenerateCommand-NKNV35NN.js.map → GenerateCommand-X3CVLXLM.js.map} +0 -0
- /package/build/{LogsCommand-BIPYLEUC.js.map → LogsCommand-B6ZWCUVZ.js.map} +0 -0
- /package/build/{PreviewCommand-FWV6LIFS.js.map → PreviewCommand-G7RZZRA5.js.map} +0 -0
- /package/build/{ReleaseCommand-ZG5W6RG4.js.map → ReleaseCommand-MHJQ6PC5.js.map} +0 -0
- /package/build/{ServeCommand-DUKZODY6.js.map → ServeCommand-7YN4VIKD.js.map} +0 -0
- /package/build/{chunk-4KUHW5B7.js.map → chunk-3FY2AOJE.js.map} +0 -0
- /package/build/{chunk-C73XJ57U.js.map → chunk-6XLUQZ5F.js.map} +0 -0
- /package/build/{chunk-ROHDWZI4.js.map → chunk-6Z3URTTC.js.map} +0 -0
- /package/build/{chunk-4SRMFEJA.js.map → chunk-CN5TC5DV.js.map} +0 -0
- /package/build/{chunk-EXDWGPUM.js.map → chunk-E5RQWCTJ.js.map} +0 -0
- /package/build/{chunk-6OIVUPHF.js.map → chunk-EDDVKT7T.js.map} +0 -0
- /package/build/{chunk-6EOYAASV.js.map → chunk-FJ7TH3XD.js.map} +0 -0
- /package/build/{chunk-C75VAILG.js.map → chunk-G4S5FTS3.js.map} +0 -0
- /package/build/{chunk-4EAHNYEH.js.map → chunk-HV62P45K.js.map} +0 -0
- /package/build/{chunk-LC6RJKUL.js.map → chunk-MXW7RVZQ.js.map} +0 -0
- /package/build/{chunk-TCBGU4X6.js.map → chunk-VUTYEP7L.js.map} +0 -0
- /package/build/{chunk-U5ROEYJA.js.map → chunk-VY54JSUP.js.map} +0 -0
- /package/build/{chunk-F3FIVJZD.js.map → chunk-Y7QMQO2O.js.map} +0 -0
- /package/build/{preview-QT6BIZNI.js.map → preview-2FJE66R2.js.map} +0 -0
- /package/build/{release-7ITKDBFT.js.map → release-YTUA7L5B.js.map} +0 -0
- /package/build/{render-command-XRP2XSWT.js.map → render-command-2PXTOG5R.js.map} +0 -0
package/build/index.js
CHANGED
|
@@ -3,18 +3,18 @@ const require = _createRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
createI18nT,
|
|
5
5
|
docsExtensionTypeSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VY54JSUP.js";
|
|
7
7
|
import {
|
|
8
8
|
runCommand
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-FJ7TH3XD.js";
|
|
10
|
+
import "./chunk-MXW7RVZQ.js";
|
|
11
11
|
import "./chunk-ZHQREOZP.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-CN5TC5DV.js";
|
|
13
13
|
import {
|
|
14
14
|
external_exports,
|
|
15
15
|
package_default,
|
|
16
16
|
require_react
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-URLY2YGI.js";
|
|
18
18
|
import {
|
|
19
19
|
__commonJS,
|
|
20
20
|
__require,
|
|
@@ -3377,8 +3377,8 @@ var {
|
|
|
3377
3377
|
// src/commands/build.ts
|
|
3378
3378
|
init_esm_shims();
|
|
3379
3379
|
var buildCommand = (services) => createCommand("build").action(async (_, command) => {
|
|
3380
|
-
const { runCommand: runCommand2 } = await import("./render-command-
|
|
3381
|
-
const { build } = await import("./build-
|
|
3380
|
+
const { runCommand: runCommand2 } = await import("./render-command-2PXTOG5R.js");
|
|
3381
|
+
const { build } = await import("./build-5Z4UY34D.js");
|
|
3382
3382
|
await runCommand2(command, services, build);
|
|
3383
3383
|
});
|
|
3384
3384
|
|
|
@@ -3443,8 +3443,8 @@ var devCommand = (services) => {
|
|
|
3443
3443
|
return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).option("--port <port>", t("dev_command_def.option.port"), validatePort).addOption(
|
|
3444
3444
|
new Option("--origin <url>", t("dev_command_def.option.origin")).argParser(validateBase).hideHelp()
|
|
3445
3445
|
).action(async (options, command) => {
|
|
3446
|
-
const { DevCommand } = await import("./DevCommand-
|
|
3447
|
-
const { renderCommand } = await import("./render-command-
|
|
3446
|
+
const { DevCommand } = await import("./DevCommand-WT3TK4N7.js");
|
|
3447
|
+
const { renderCommand } = await import("./render-command-2PXTOG5R.js");
|
|
3448
3448
|
const { https = false, origin, port } = options;
|
|
3449
3449
|
await renderCommand(
|
|
3450
3450
|
command,
|
|
@@ -3483,17 +3483,17 @@ var previewCommand = (services) => {
|
|
|
3483
3483
|
).hideHelp()
|
|
3484
3484
|
).action(async (options, command) => {
|
|
3485
3485
|
const { site, baseUrl, json } = options;
|
|
3486
|
-
const { renderCommand, runCommand: runCommand2 } = await import("./render-command-
|
|
3486
|
+
const { renderCommand, runCommand: runCommand2 } = await import("./render-command-2PXTOG5R.js");
|
|
3487
3487
|
if (json) {
|
|
3488
3488
|
return runCommand2(command, services, async (model) => {
|
|
3489
|
-
const { nonInteractivePreview } = await import("./preview-
|
|
3489
|
+
const { nonInteractivePreview } = await import("./preview-2FJE66R2.js");
|
|
3490
3490
|
return nonInteractivePreview(services, model, {
|
|
3491
3491
|
baseUrl,
|
|
3492
3492
|
siteId: site
|
|
3493
3493
|
});
|
|
3494
3494
|
});
|
|
3495
3495
|
}
|
|
3496
|
-
const { PreviewCommand } = await import("./PreviewCommand-
|
|
3496
|
+
const { PreviewCommand } = await import("./PreviewCommand-G7RZZRA5.js");
|
|
3497
3497
|
await renderCommand(
|
|
3498
3498
|
command,
|
|
3499
3499
|
services,
|
|
@@ -3510,8 +3510,8 @@ var addPermissionCommand = (services) => {
|
|
|
3510
3510
|
return createCommand("add-permission").description("adding a permission to the app").addOption(
|
|
3511
3511
|
new Option("-p, --permission-id <id>", t("the permission id to add"))
|
|
3512
3512
|
).action(async (options, command) => {
|
|
3513
|
-
const { renderCommand } = await import("./render-command-
|
|
3514
|
-
const { AddPermissionCommand } = await import("./AddPermissionCommand-
|
|
3513
|
+
const { renderCommand } = await import("./render-command-2PXTOG5R.js");
|
|
3514
|
+
const { AddPermissionCommand } = await import("./AddPermissionCommand-SWMX36RL.js");
|
|
3515
3515
|
const { permissionId = "" } = options;
|
|
3516
3516
|
await renderCommand(
|
|
3517
3517
|
command,
|
|
@@ -3527,8 +3527,8 @@ var import_react4 = __toESM(require_react(), 1);
|
|
|
3527
3527
|
var serveCommand = (services) => {
|
|
3528
3528
|
const t = createI18nT();
|
|
3529
3529
|
return createCommand("serve").description(t("serve_command_def.description")).action(async (_, command) => {
|
|
3530
|
-
const { renderCommand } = await import("./render-command-
|
|
3531
|
-
const { ServeCommandDeprecated } = await import("./ServeCommand-
|
|
3530
|
+
const { renderCommand } = await import("./render-command-2PXTOG5R.js");
|
|
3531
|
+
const { ServeCommandDeprecated } = await import("./ServeCommand-7YN4VIKD.js");
|
|
3532
3532
|
await renderCommand(command, services, /* @__PURE__ */ import_react4.default.createElement(ServeCommandDeprecated, null));
|
|
3533
3533
|
});
|
|
3534
3534
|
};
|
|
@@ -3543,8 +3543,8 @@ var generateCommand = (services) => {
|
|
|
3543
3543
|
t("generate_command.type_flag"),
|
|
3544
3544
|
validateDocsExtensionType
|
|
3545
3545
|
).description(t("generate_command.description")).action(async (options, command) => {
|
|
3546
|
-
const { GenerateCommand } = await import("./GenerateCommand-
|
|
3547
|
-
const { renderCommand } = await import("./render-command-
|
|
3546
|
+
const { GenerateCommand } = await import("./GenerateCommand-X3CVLXLM.js");
|
|
3547
|
+
const { renderCommand } = await import("./render-command-2PXTOG5R.js");
|
|
3548
3548
|
const { type } = options;
|
|
3549
3549
|
await renderCommand(
|
|
3550
3550
|
command,
|
|
@@ -3568,8 +3568,8 @@ var logsCommand = (services) => {
|
|
|
3568
3568
|
validateVersion
|
|
3569
3569
|
).action(async (options, command) => {
|
|
3570
3570
|
const { version } = options;
|
|
3571
|
-
const { renderCommand } = await import("./render-command-
|
|
3572
|
-
const { LogsCommand } = await import("./LogsCommand-
|
|
3571
|
+
const { renderCommand } = await import("./render-command-2PXTOG5R.js");
|
|
3572
|
+
const { LogsCommand } = await import("./LogsCommand-B6ZWCUVZ.js");
|
|
3573
3573
|
await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(LogsCommand, { version }));
|
|
3574
3574
|
});
|
|
3575
3575
|
};
|
|
@@ -3602,8 +3602,8 @@ var releaseCommand = (services) => {
|
|
|
3602
3602
|
t("app_preview_command_def.option.json")
|
|
3603
3603
|
).hideHelp()
|
|
3604
3604
|
).action(async (options, command) => {
|
|
3605
|
-
const { renderCommand } = await import("./render-command-
|
|
3606
|
-
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-
|
|
3605
|
+
const { renderCommand } = await import("./render-command-2PXTOG5R.js");
|
|
3606
|
+
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-MHJQ6PC5.js");
|
|
3607
3607
|
const { baseUrl, site, comment, json } = options;
|
|
3608
3608
|
const versionType = options.versionType ? {
|
|
3609
3609
|
major: ReleaseVersionType.MAJOR,
|
|
@@ -3617,7 +3617,7 @@ var releaseCommand = (services) => {
|
|
|
3617
3617
|
};
|
|
3618
3618
|
if (json) {
|
|
3619
3619
|
return runCommand(command, services, async (model) => {
|
|
3620
|
-
const { nonInteractiveRelease } = await import("./release-
|
|
3620
|
+
const { nonInteractiveRelease } = await import("./release-YTUA7L5B.js");
|
|
3621
3621
|
return nonInteractiveRelease(services, model, props);
|
|
3622
3622
|
});
|
|
3623
3623
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Q}from"./chunk-EZGPNUD5.js";import{a as G}from"./chunk-QFPCSRLT.js";import"./chunk-J3SVE4GM.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function W(){return W=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},W.apply(null,arguments)}import Be,{useEffect as Ke,useState as Pe}from"react";import{wixContext as g}from"@wix/sdk-context";function X(){let e=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(e)return{initWixModules(r,o){return D(()=>e(r,o))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof g.client<"u"?g.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,n=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof g.elevatedClient<"u"?g.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!n))return{initWixModules(r,o){if(o){if(!n)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return D(()=>n.use(r))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return D(()=>t.use(r))},fetchWithAuth:(r,o)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(r,o)},getAuth(){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.auth},async graphql(r,o,a){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(r,o,a)}}}function D(e){let t=globalThis.__wix_context__,n={client:g.client,elevatedClient:g.elevatedClient},r;globalThis.__wix_context__=void 0,g.client=void 0,g.elevatedClient=void 0,typeof $wixContext<"u"&&(r={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,g.client=n.client,g.elevatedClient=n.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=r.client,$wixContext.elevatedClient=r.elevatedClient)}}function Y(e,t){return{...e,...Object.fromEntries(t.map(n=>[n,(...r)=>{let o=X();if(!o)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return o.initWixModules(e)[n].apply(void 0,r)}]))}}function Z(e){return Y({__type:"host",create:t=>Object.entries(e).reduce((n,[r,o])=>({...n,[r]:o(t)}),{})},Object.keys(e))}function b(e){"@babel/helpers - typeof";return b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(e)}function ee(e,t){if(b(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(b(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function te(e){var t=ee(e,"string");return b(t)=="symbol"?t:t+""}function ne(e,t,n){return(t=te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var C=class extends Error{constructor(t){let{message:n,code:r}=t;super(n),ne(this,"code",void 0),this.message=n,this.code=r}};var re=()=>{let e=s=>{let{channel:i}=s;return function(){let d=i.showToast(...arguments);return{remove:()=>Promise.resolve(d).then(x=>x.remove())}}},t=s=>{let{channel:i}=s;return function(){let d=i.observeState(...arguments);return{disconnect:()=>Promise.resolve(d).then(x=>x.disconnect())}}};return{showToast:e,observeState:t,navigate:s=>{let{channel:i}=s;return function(){return i.navigate(...arguments)}},navigateBack:s=>{let{channel:i}=s;return()=>i.navigateBack()},openModal:s=>{let{channel:i}=s;return(d,m)=>{let[x,S]=typeof d=="string"?[d,m]:[d.modalId,d.params],P=i.openModal(x,S);return{modalClosed:Promise.resolve(P).then(y=>y.modalClosed)}}},closeModal:s=>{let{channel:i}=s;return d=>{if(d===void 0)return i.closeModal();let m=JSON.parse(JSON.stringify(d));return i.closeModal(m)}},getAccessToken:s=>{let{channel:i}=s;return()=>i.getAccessToken()},getPageUrl:s=>{let{channel:i}=s;return function(){return i.getPageUrl(...arguments)}},openMediaManager:s=>{let{channel:i}=s;return function(){return i.openMediaManager(...arguments)}},addSitePlugin:s=>{let{channel:i}=s;return(d,m)=>{let x="802c76e4-b381-4bb3-9152-96acabbf3194",S=m?.placement||{},P=i.openModal(x,{...S,pluginId:d,action:"populate"});return Promise.resolve(P).then(y=>y.modalClosed).then(y=>{if(y?.type===void 0)throw new C({message:"Aborted by user",code:3006});if(y?.type==="ERROR")throw new C(y.data.error)})}},onBeforeUnload:s=>{let{channel:i}=s;return function(){return i.onBeforeUnload(...arguments)}},setPageTitle:s=>{let{channel:i}=s;return d=>i.setPageTitle(d)},getLanguage:s=>{let i=null;return async()=>{var d;if(i)return i;let m=null;return i=await new Promise(x=>{m=t(s)((S,P)=>{x(P.language)})}),(d=m)==null||d.disconnect(),i}},requestFeedback:s=>{let{channel:i}=s;return function(){return i.requestFeedback(...arguments)}},onLayerStateChange:s=>{let{channel:i}=s;return function(){let d=i.onLayerStateChange(...arguments);return{remove:()=>Promise.resolve(d).then(x=>x.remove())}}},installApp:s=>{let{channel:i}=s;return i.installApp},getSiteInfo:s=>{let{channel:i}=s;return i.getSiteInfo},getWidget:s=>{let{channel:i}=s;return function(){if("getWidget"in i)return i.getWidget(...arguments);throw new Error("Unsupported")}},getDashboardPlugins:s=>{let{channel:i}=s;return function(){if("getDashboardPlugins"in i)return i.getDashboardPlugins(...arguments);throw new Error("Unsupported")}},getDashboardMenuPlugins:s=>{let{channel:i}=s;return function(){if("getDashboardMenuPlugins"in i)return i.getDashboardMenuPlugins(...arguments);throw new Error("Unsupported")}}}};var oe=e=>{let{createHost:t}=e,n=re();return{...Z(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var se=Symbol("Comlink.proxy"),Ee=Symbol("Comlink.endpoint"),I=Symbol("Comlink.releaseProxy"),z=Symbol("Comlink.thrown"),ae=e=>typeof e=="object"&&e!==null||typeof e=="function",Se={canHandle:e=>ae(e)&&e[se],serialize(e){let{port1:t,port2:n}=new MessageChannel;return U(e,t),[n,[n]]},deserialize(e){return e.start(),H(e)}},We={canHandle:e=>ae(e)&&z in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},le=new Map([["proxy",Se],["throw",We]]);function U(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:o,type:a,path:u}=Object.assign({path:[]},r.data),l=(r.data.argumentList||[]).map(v),c;try{let f=u.slice(0,-1).reduce((p,w)=>p[w],e),h=u.reduce((p,w)=>p[w],e);switch(a){case 0:c=h;break;case 1:f[u.slice(-1)[0]]=v(r.data.value),c=!0;break;case 2:c=h.apply(f,l);break;case 3:{let p=new h(...l);c=E(p)}break;case 4:{let{port1:p,port2:w}=new MessageChannel;U(e,w),c=Te(p,[p])}break;case 5:c=void 0;break}}catch(f){c={value:f,[z]:0}}Promise.resolve(c).catch(f=>({value:f,[z]:0})).then(f=>{let[h,p]=R(f);t.postMessage(Object.assign(Object.assign({},h),{id:o}),p),a===5&&(t.removeEventListener("message",n),ue(t))})}),t.start&&t.start()}function ke(e){return e.constructor.name==="MessagePort"}function ue(e){ke(e)&&e.close()}function H(e,t){return O(e,[],t)}function k(e){if(e)throw new Error("Proxy has been released and is not useable")}function O(e,t=[],n=function(){}){let r=!1,o=new Proxy(n,{get(a,u){if(k(r),u===I)return()=>M(e,{type:5,path:t.map(l=>l.toString())}).then(()=>{ue(e),r=!0});if(u==="then"){if(t.length===0)return{then:()=>o};let l=M(e,{type:0,path:t.map(c=>c.toString())}).then(v);return l.then.bind(l)}return O(e,[...t,u])},set(a,u,l){k(r);let[c,f]=R(l);return M(e,{type:1,path:[...t,u].map(h=>h.toString()),value:c},f).then(v)},apply(a,u,l){k(r);let c=t[t.length-1];if(c===Ee)return M(e,{type:4}).then(v);if(c==="bind")return O(e,t.slice(0,-1));let[f,h]=ie(l);return M(e,{type:2,path:t.map(p=>p.toString()),argumentList:f},h).then(v)},construct(a,u){k(r);let[l,c]=ie(u);return M(e,{type:3,path:t.map(f=>f.toString()),argumentList:l},c).then(v)}});return o}function Ae(e){return Array.prototype.concat.apply([],e)}function ie(e){let t=e.map(R);return[t.map(n=>n[0]),Ae(t.map(n=>n[1]))]}var ce=new WeakMap;function Te(e,t){return ce.set(e,t),e}function E(e){return Object.assign(e,{[se]:!0})}function R(e){for(let[t,n]of le)if(n.canHandle(e)){let[r,o]=n.serialize(e);return[{type:3,name:t,value:r},o]}return[{type:0,value:e},ce.get(e)||[]]}function v(e){switch(e.type){case 3:return le.get(e.name).deserialize(e.value);case 0:return e.value}}function M(e,t,n){return new Promise(r=>{let o=De();e.addEventListener("message",function a(u){!u.data||!u.data.id||u.data.id!==o||(e.removeEventListener("message",a),r(u.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),n)})}function De(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var L="__proxyCallbackId__wixSDK__",B="__proxyPromiseId__wixSDK__",fe=e=>Oe(e,t=>async function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];let[a,u]=K(r),l=await t(E(a),u);return pe(l)});var ze=async e=>{let[t,n]=K(await e);return E({proxies:t,clonables:n})},pe=async e=>T(e?.proxies,await e?.clonables),K=e=>{let t=(o,a)=>{if(he(a)){let u=de();return o.promises[u]=a,{[B]:u}}if(Ie(a)){let u=de();return o.callbacks[u]=(l,c)=>{let f=T(l,c),h=a(...f);return ze(h)},{[L]:u}}return Array.isArray(a)?a.map(u=>t(o,u)):A(a)?me(a,u=>t(o,u)):a},n={promises:{},callbacks:{}},r=t(n,e);return[n,r]},T=(e,t)=>{if(Array.isArray(t))return t.map(n=>T(e,n));if(A(t)&&t.hasOwnProperty(B)){let n=t[B];return e.promises[n]}if(A(t)&&t.hasOwnProperty(L)){let n=t[L];return async function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];let[u,l]=K(o),c=await e.callbacks[n](E(u),l);return pe(c)}}return A(t)?me(t,n=>T(e,n)):t},Oe=(e,t)=>new Proxy(e,{get(n,r){return n[r]?t(n[r]):()=>{throw new Error(`Serialization error occurred while accessing ${r} property of ${n}`)}}}),he=e=>e instanceof Promise,A=e=>e&&typeof e=="object"&&!he(e),Ie=e=>typeof e=="function",me=(e,t)=>{let n=r=>{let[o,a]=r;return[o,t(a)]};return Object.fromEntries(Object.entries(e).map(n))},de=(()=>{let e=0;return()=>++e})();var Ue="wix-sdk-bo-hello-handshake",xe=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:o}=new MessageChannel;t({code:Ue,version:"1.0.0",port:o},n,[o]);let l=fe(H(r));return{channel:l,close:()=>l[I]()}};var ge=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var He=["https://manage.wix.com","https://manage.editorx.com"],Re=new Set(He),we=e=>Re.has(e);var ye=e=>{let t=new EventTarget,n=typeof window>"u",r=l=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(l.preventDefault(),l.returnValue=!0)},o=e.onBeforeUnload(r),a=()=>{n||window.removeEventListener("beforeunload",r),o.then(l=>{let{remove:c}=l;return c()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",a)),{onBeforeUnload:l=>(t.addEventListener("beforeunload",l),{remove:()=>{t.removeEventListener("beforeunload",l)}}),clearBeforeUnloadHandler:a}};function Le(e){if(e)try{return JSON.parse(decodeURIComponent(e))}catch(t){console.warn('Failed to parse "essentials" query parameter. Make sure to run the code inside a supported Wix App extension.',t);return}}function be(e){return e.has("essentials")?Le(e.get("essentials")):void 0}var ve=e=>t=>{let{message:n,action:r,requestId:o}=t;n&&e.showToast({type:"error",details:o!=null?{requestId:o}:void 0,message:n,action:r&&{...r,removeToastOnClick:!0,uiType:"link"}})};var _e=function(e){e===void 0&&(e={});let t=e.fullUrl&&new URL(e.fullUrl).search||typeof window<"u"&&window.location.search||"",n=new URLSearchParams(t),r=e.origin||n.get("origin")||"",o=e.postMessage||window.parent.postMessage.bind(window.parent);if(!we(r))throw new Error("Wix Dashboard SDK: Unable to establish a connection with the Wix dashboard. Please ensure that you are running your app within the Wix dashboard.");let{channel:a,close:u}=xe({postMessage:o,origin:r}),l=[u];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let s=e.autoHeightElement||document.documentElement,i=ge(a,s);l.push(()=>i())}let{onBeforeUnload:c,clearBeforeUnloadHandler:f}=ye(a);l.push(f);let h=Me(n.get("siteInfo")||"","siteInfo"),p=()=>h,w=Me(n.get("contextIds")||"","contextIds"),$=()=>w,V=!!w,q=new Proxy(a,{get(s,i,d){return i==="onBeforeUnload"?c:i==="getSiteInfo"?p:Reflect.get(s,i,d)}}),F={getContextIds:$,openItemSelector:()=>{throw new Error("openItemSelector is not implemented")}},{monitoring:_,...N}=be(n)||{},J=Q({hostContext:_?.context,monitoringConfig:_?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{channel:q,close:()=>l.forEach(s=>s()),getMonitoringClient:J,essentials:N,...V&&{admin:F},showError:ve(a)}},Me=(e,t)=>{try{return JSON.parse(decodeURIComponent(e))}catch(n){return console.warn(`Failed to parse ${t} query parameter. Make sure to run the code inside a supported Wix App extension.`,n),{}}};var j=oe({createHost:_e});var Ce=(e,t)=>{let[n,r]=Pe(()=>e());return t(n)&&r(e()),n},je=e=>t=>{let{host:n,compProps:r}=$e(t);return Ce(()=>(G({auth:j.auth(),host:n}).enableContext("module"),n),o=>o!==n),r?Be.createElement(e,W({host:n},r)):null},$e=e=>{let{host:t,...n}=e,{host:r,hostType:o}=Ce(()=>t?{host:t,hostType:"local"}:{host:j.host(),hostType:"remote"},l=>!!t&&t!==l.host),[a,u]=Pe(void 0);return Ke(()=>{if(o==="local")return;let l=r.channel.observeState(f=>{u(f||{})}),c=async()=>{(await l).disconnect(),r.close()};return()=>{c()}},[r,o]),o==="local"?{host:r,compProps:n}:{host:r,compProps:a?{...a,...n}:void 0}};export{je as withContextualWixClient};
|
|
1
|
+
import{a as Q}from"./chunk-EZGPNUD5.js";import{a as G}from"./chunk-QFPCSRLT.js";import"./chunk-J3SVE4GM.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(null,arguments)}import Be,{useEffect as Ke,useState as _e}from"react";import{wixContext as g}from"@wix/sdk-context";function X(){let e=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(e)return{initWixModules(r,o){return O(()=>e(r,o))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof g.client<"u"?g.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,n=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof g.elevatedClient<"u"?g.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!n))return{initWixModules(r,o){if(o){if(!n)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return O(()=>n.use(r))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return O(()=>t.use(r))},fetchWithAuth:(r,o)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(r,o)},getAuth(){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.auth},async graphql(r,o,s){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(r,o,s)}}}function O(e){let t=globalThis.__wix_context__,n={client:g.client,elevatedClient:g.elevatedClient},r;globalThis.__wix_context__=void 0,g.client=void 0,g.elevatedClient=void 0,typeof $wixContext<"u"&&(r={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,g.client=n.client,g.elevatedClient=n.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=r.client,$wixContext.elevatedClient=r.elevatedClient)}}function Y(e,t){return{...e,...Object.fromEntries(t.map(n=>[n,(...r)=>{let o=X();if(!o)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return o.initWixModules(e)[n].apply(void 0,r)}]))}}function Z(e){return Y({__type:"host",create:t=>Object.entries(e).reduce((n,[r,o])=>({...n,[r]:o(t)}),{})},Object.keys(e))}function b(e){"@babel/helpers - typeof";return b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(e)}function ee(e,t){if(b(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(b(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function te(e){var t=ee(e,"string");return b(t)=="symbol"?t:t+""}function ne(e,t,n){return(t=te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=class extends Error{constructor(t){let{message:n,code:r}=t;super(n),ne(this,"code",void 0),this.message=n,this.code=r}};var re=()=>{let e=l=>{let{channel:i}=l;return function(){let f=i.showToast(...arguments);return{remove:()=>Promise.resolve(f).then(x=>x.remove())}}},t=l=>{let{channel:i}=l;return function(){let f=i.observeState(...arguments);return{disconnect:()=>Promise.resolve(f).then(x=>x.disconnect())}}};return{showToast:e,observeState:t,navigate:l=>{let{channel:i}=l;return function(){return i.navigate(...arguments)}},navigateBack:l=>{let{channel:i}=l;return()=>i.navigateBack()},openModal:l=>{let{channel:i}=l;return(f,m)=>{let[x,k]=typeof f=="string"?[f,m]:[f.modalId,f.params],E=i.openModal(x,k);return{modalClosed:Promise.resolve(E).then(w=>w.modalClosed)}}},closeModal:l=>{let{channel:i}=l;return f=>{if(f===void 0)return i.closeModal();let m=JSON.parse(JSON.stringify(f));return i.closeModal(m)}},getAccessToken:l=>{let{channel:i}=l;return()=>i.getAccessToken()},getPageUrl:l=>{let{channel:i}=l;return function(){return i.getPageUrl(...arguments)}},openMediaManager:l=>{let{channel:i}=l;return function(){return i.openMediaManager(...arguments)}},addSitePlugin:l=>{let{channel:i}=l;return(f,m)=>{let x="802c76e4-b381-4bb3-9152-96acabbf3194",k=m?.placement||{},E=i.openModal(x,{...k,placementsSlotId:m?.slotId,pluginId:f,action:"populate"});return Promise.resolve(E).then(w=>w.modalClosed).then(w=>{if(w?.type===void 0)throw new S({message:"Aborted by user",code:3006});if(w?.type==="ERROR")throw new S(w.data.error)})}},onBeforeUnload:l=>{let{channel:i}=l;return function(){return i.onBeforeUnload(...arguments)}},setPageTitle:l=>{let{channel:i}=l;return f=>i.setPageTitle(f)},getLanguage:l=>{let i=null;return async()=>{var f;if(i)return i;let m=null;return i=await new Promise(x=>{m=t(l)((k,E)=>{x(E.language)})}),(f=m)==null||f.disconnect(),i}},requestFeedback:l=>{let{channel:i}=l;return function(){return i.requestFeedback(...arguments)}},onLayerStateChange:l=>{let{channel:i}=l;return function(){let f=i.onLayerStateChange(...arguments);return{remove:()=>Promise.resolve(f).then(x=>x.remove())}}},installApp:l=>{let{channel:i}=l;return i.installApp},getSiteInfo:l=>{let{channel:i}=l;return i.getSiteInfo},getWidget:l=>{let{channel:i}=l;return function(){if("getWidget"in i)return i.getWidget(...arguments);throw new Error("Unsupported")}},getDashboardPlugins:l=>{let{channel:i}=l;return function(){if("getDashboardPlugins"in i)return i.getDashboardPlugins(...arguments);throw new Error("Unsupported")}},getDashboardMenuPlugins:l=>{let{channel:i}=l;return function(){if("getDashboardMenuPlugins"in i)return i.getDashboardMenuPlugins(...arguments);throw new Error("Unsupported")}}}};var oe=e=>{let{createHost:t}=e,n=re();return{...Z(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var se=Symbol("Comlink.proxy"),Ce=Symbol("Comlink.endpoint"),I=Symbol("Comlink.releaseProxy"),U=Symbol("Comlink.thrown"),ae=e=>typeof e=="object"&&e!==null||typeof e=="function",Ee={canHandle:e=>ae(e)&&e[se],serialize(e){let{port1:t,port2:n}=new MessageChannel;return R(e,t),[n,[n]]},deserialize(e){return e.start(),L(e)}},Se={canHandle:e=>ae(e)&&U in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},le=new Map([["proxy",Ee],["throw",Se]]);function R(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:o,type:s,path:u}=Object.assign({path:[]},r.data),a=(r.data.argumentList||[]).map(v),c;try{let d=u.slice(0,-1).reduce((p,y)=>p[y],e),h=u.reduce((p,y)=>p[y],e);switch(s){case 0:c=h;break;case 1:d[u.slice(-1)[0]]=v(r.data.value),c=!0;break;case 2:c=h.apply(d,a);break;case 3:{let p=new h(...a);c=W(p)}break;case 4:{let{port1:p,port2:y}=new MessageChannel;R(e,y),c=Ae(p,[p])}break;case 5:c=void 0;break}}catch(d){c={value:d,[U]:0}}Promise.resolve(c).catch(d=>({value:d,[U]:0})).then(d=>{let[h,p]=B(d);t.postMessage(Object.assign(Object.assign({},h),{id:o}),p),s===5&&(t.removeEventListener("message",n),ue(t))})}),t.start&&t.start()}function We(e){return e.constructor.name==="MessagePort"}function ue(e){We(e)&&e.close()}function L(e,t){return H(e,[],t)}function T(e){if(e)throw new Error("Proxy has been released and is not useable")}function H(e,t=[],n=function(){}){let r=!1,o=new Proxy(n,{get(s,u){if(T(r),u===I)return()=>P(e,{type:5,path:t.map(a=>a.toString())}).then(()=>{ue(e),r=!0});if(u==="then"){if(t.length===0)return{then:()=>o};let a=P(e,{type:0,path:t.map(c=>c.toString())}).then(v);return a.then.bind(a)}return H(e,[...t,u])},set(s,u,a){T(r);let[c,d]=B(a);return P(e,{type:1,path:[...t,u].map(h=>h.toString()),value:c},d).then(v)},apply(s,u,a){T(r);let c=t[t.length-1];if(c===Ce)return P(e,{type:4}).then(v);if(c==="bind")return H(e,t.slice(0,-1));let[d,h]=ie(a);return P(e,{type:2,path:t.map(p=>p.toString()),argumentList:d},h).then(v)},construct(s,u){T(r);let[a,c]=ie(u);return P(e,{type:3,path:t.map(d=>d.toString()),argumentList:a},c).then(v)}});return o}function ke(e){return Array.prototype.concat.apply([],e)}function ie(e){let t=e.map(B);return[t.map(n=>n[0]),ke(t.map(n=>n[1]))]}var ce=new WeakMap;function Ae(e,t){return ce.set(e,t),e}function W(e){return Object.assign(e,{[se]:!0})}function B(e){for(let[t,n]of le)if(n.canHandle(e)){let[r,o]=n.serialize(e);return[{type:3,name:t,value:r},o]}return[{type:0,value:e},ce.get(e)||[]]}function v(e){switch(e.type){case 3:return le.get(e.name).deserialize(e.value);case 0:return e.value}}function P(e,t,n){return new Promise(r=>{let o=Te();e.addEventListener("message",function s(u){!u.data||!u.data.id||u.data.id!==o||(e.removeEventListener("message",s),r(u.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),n)})}function Te(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var K="__proxyCallbackId__wixSDK__",j="__proxyPromiseId__wixSDK__",fe=e=>ze(e,t=>async function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];let[s,u]=$(r),a=await t(W(s),u);return pe(a)});var De=async e=>{let[t,n]=$(await e);return W({proxies:t,clonables:n})},pe=async e=>z(e?.proxies,await e?.clonables),$=e=>{let t=(o,s)=>{if(he(s)){let u=de();return o.promises[u]=s,{[j]:u}}if(Oe(s)){let u=de();return o.callbacks[u]=(a,c)=>{let d=z(a,c),h=s(...d);return De(h)},{[K]:u}}return Array.isArray(s)?s.map(u=>t(o,u)):D(s)?me(s,u=>t(o,u)):s},n={promises:{},callbacks:{}},r=t(n,e);return[n,r]},z=(e,t)=>{if(Array.isArray(t))return t.map(n=>z(e,n));if(D(t)&&t.hasOwnProperty(j)){let n=t[j];return e.promises[n]}if(D(t)&&t.hasOwnProperty(K)){let n=t[K];return async function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];let[u,a]=$(o),c=await e.callbacks[n](W(u),a);return pe(c)}}return D(t)?me(t,n=>z(e,n)):t},ze=(e,t)=>new Proxy(e,{get(n,r){return n[r]?t(n[r]):()=>{throw new Error(`Serialization error occurred while accessing ${r} property of ${n}`)}}}),he=e=>e instanceof Promise,D=e=>e&&typeof e=="object"&&!he(e),Oe=e=>typeof e=="function",me=(e,t)=>{let n=r=>{let[o,s]=r;return[o,t(s)]};return Object.fromEntries(Object.entries(e).map(n))},de=(()=>{let e=0;return()=>++e})();var Ue="wix-sdk-bo-hello-handshake",xe=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:o}=new MessageChannel;t({code:Ue,version:"1.0.0",port:o},n,[o]);let a=fe(L(r));return{channel:a,close:()=>a[I]()}};var ge=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var He=["https://manage.wix.com","https://manage.editorx.com"],Ie=new Set(He),we=e=>Ie.has(e);var ye=e=>{let t=new EventTarget,n=typeof window>"u",r=a=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(a.preventDefault(),a.returnValue=!0)},o=e.onBeforeUnload(r),s=()=>{n||window.removeEventListener("beforeunload",r),o.then(a=>{let{remove:c}=a;return c()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",s)),{onBeforeUnload:a=>(t.addEventListener("beforeunload",a),{remove:()=>{t.removeEventListener("beforeunload",a)}}),clearBeforeUnloadHandler:s}};function Re(e){if(e)try{return JSON.parse(decodeURIComponent(e))}catch(t){console.warn('Failed to parse "essentials" query parameter. Make sure to run the code inside a supported Wix App extension.',t);return}}function be(e){return e.has("essentials")?Re(e.get("essentials")):void 0}var ve=e=>t=>{let{message:n,action:r,requestId:o}=t;n&&e.showToast({type:"error",details:o!=null?{requestId:o}:void 0,message:n,action:r&&{...r,removeToastOnClick:!0,uiType:"link"}})};var Me=function(e){e===void 0&&(e={});let t=e.fullUrl&&new URL(e.fullUrl).search||typeof window<"u"&&window.location.search||"",n=new URLSearchParams(t),r=e.origin||n.get("origin")||"",o=e.postMessage||window.parent.postMessage.bind(window.parent);if(!we(r))throw new Error("Wix Dashboard SDK: Unable to establish a connection with the Wix dashboard. Please ensure that you are running your app within the Wix dashboard.");let{channel:s,close:u}=xe({postMessage:o,origin:r}),a=[u];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let M=e.autoHeightElement||document.documentElement,_=ge(s,M);a.push(()=>_())}let{onBeforeUnload:c,clearBeforeUnloadHandler:d}=ye(s);a.push(d);let h=Le(n.get("siteInfo")||"","siteInfo"),p=()=>h,y=new Proxy(s,{get(M,_,J){return _==="onBeforeUnload"?c:_==="getSiteInfo"?p:Reflect.get(M,_,J)}}),{monitoring:C,...q}=be(n)||{},F=Q({hostContext:C?.context,monitoringConfig:C?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0}),N={openItemSelector:s.openItemSelector};return{channel:y,close:()=>a.forEach(M=>M()),getMonitoringClient:F,essentials:q,admin:N,showError:ve(s)}},Le=(e,t)=>{try{return JSON.parse(decodeURIComponent(e))}catch(n){return console.warn(`Failed to parse ${t} query parameter. Make sure to run the code inside a supported Wix App extension.`,n),{}}};var V=oe({createHost:Me});var Pe=(e,t)=>{let[n,r]=_e(()=>e());return t(n)&&r(e()),n},je=e=>t=>{let{host:n,compProps:r}=$e(t);return Pe(()=>(G({auth:V.auth(),host:n}).enableContext("module"),n),o=>o!==n),r?Be.createElement(e,A({host:n},r)):null},$e=e=>{let{host:t,...n}=e,{host:r,hostType:o}=Pe(()=>t?{host:t,hostType:"local"}:{host:V.host(),hostType:"remote"},a=>!!t&&t!==a.host),[s,u]=_e(void 0);return Ke(()=>{if(o==="local")return;let a=r.channel.observeState(d=>{u(d||{})}),c=async()=>{(await a).disconnect(),r.close()};return()=>{c()}},[r,o]),o==="local"?{host:r,compProps:n}:{host:r,compProps:s?{...s,...n}:void 0}};export{je as withContextualWixClient};
|
|
2
2
|
//# sourceMappingURL=dashboard.js.map
|