@wix/cli-app 1.1.240 → 1.1.242

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 (73) hide show
  1. package/build/{AddPermissionCommand-UOKG3DRO.js → AddPermissionCommand-NLUR2C32.js} +2 -2
  2. package/build/{DevCommand-HCWH3OHY.js → DevCommand-Q2FYB3XY.js} +10 -10
  3. package/build/{GenerateCommand-OVNCGGHO.js → GenerateCommand-F52FFNBI.js} +7 -7
  4. package/build/{LogsCommand-7XQMJNCS.js → LogsCommand-5UYLBRQZ.js} +3 -3
  5. package/build/PreviewCommand-IQAJTIVR.js +19 -0
  6. package/build/ReleaseCommand-XQSVZICW.js +23 -0
  7. package/build/{ServeCommand-KYY7EMSY.js → ServeCommand-SPJHLK7U.js} +3 -3
  8. package/build/{build-OWIIXCY5.js → build-2T5BFUWM.js} +6 -6
  9. package/build/{chunk-452BSZIG.js → chunk-63VFX6QK.js} +2 -2
  10. package/build/{chunk-452BSZIG.js.map → chunk-63VFX6QK.js.map} +1 -1
  11. package/build/{chunk-RJ5AE5PA.js → chunk-7DXNLVMY.js} +2 -2
  12. package/build/{chunk-ROUPG4XJ.js → chunk-B3XIOUQT.js} +2 -2
  13. package/build/{chunk-CHCM5GIW.js → chunk-BMVS42XS.js} +3 -3
  14. package/build/{chunk-NBX5ZDG4.js → chunk-C42KLSNW.js} +2 -2
  15. package/build/{chunk-JNQZZJEG.js → chunk-GTSFGE5V.js} +3 -3
  16. package/build/{chunk-D5PXGLRN.js → chunk-JK7EYVDW.js} +11 -7
  17. package/build/{chunk-D5PXGLRN.js.map → chunk-JK7EYVDW.js.map} +1 -1
  18. package/build/{chunk-KNEYNMAC.js → chunk-KF4Y7AR3.js} +2 -2
  19. package/build/{chunk-OSOIJLUZ.js → chunk-KGCNOH2C.js} +2 -2
  20. package/build/{chunk-BUFZB2WZ.js → chunk-LUVRH4ML.js} +8 -8
  21. package/build/{chunk-3FHYQY34.js → chunk-QK72TUIO.js} +5 -4
  22. package/build/{chunk-3FHYQY34.js.map → chunk-QK72TUIO.js.map} +1 -1
  23. package/build/{chunk-4EN3XULI.js → chunk-QSLY47CE.js} +6 -6
  24. package/build/{chunk-63ZWJD2E.js → chunk-R52Q3OHG.js} +2 -2
  25. package/build/{chunk-5LEKQK4K.js → chunk-V5F6GGW4.js} +3 -3
  26. package/build/{chunk-5ADLOYER.js → chunk-YO7FIWQY.js} +6 -6
  27. package/build/{chunk-M2DNPZJ6.js → chunk-ZQAW4UYV.js} +2 -2
  28. package/build/cloudflare-runtime/entry.js +1 -1
  29. package/build/cloudflare-runtime/getRegisteredExtensions.js +1 -1
  30. package/build/index.js +22 -22
  31. package/build/platform-sdk/{chunk-UTEFPCPF.js → chunk-KXCY2KWZ.js} +2 -2
  32. package/build/platform-sdk/chunk-S46ZF4YM.js +2 -0
  33. package/build/platform-sdk/chunk-S46ZF4YM.js.map +1 -0
  34. package/build/platform-sdk/dashboard.js +1 -1
  35. package/build/platform-sdk/editor.js +1 -1
  36. package/build/platform-sdk/sdk-context.js +1 -1
  37. package/build/platform-sdk/sdk-context.js.map +1 -1
  38. package/build/platform-sdk/site.js +1 -1
  39. package/build/platform-sdk/site.js.map +1 -1
  40. package/build/platform-sdk/web-methods.js +1 -1
  41. package/build/{preview-EFKSIVQM.js → preview-KPMG263Y.js} +11 -11
  42. package/build/{release-ID5VU6AQ.js → release-EOP3M5P7.js} +13 -13
  43. package/build/{render-command-WGIVK7NK.js → render-command-YNOAIR7C.js} +4 -4
  44. package/package.json +2 -2
  45. package/build/PreviewCommand-I2WAW3M3.js +0 -19
  46. package/build/ReleaseCommand-PBSE5PLP.js +0 -23
  47. package/build/platform-sdk/chunk-2QLMI2GU.js +0 -2
  48. package/build/platform-sdk/chunk-2QLMI2GU.js.map +0 -1
  49. /package/build/{AddPermissionCommand-UOKG3DRO.js.map → AddPermissionCommand-NLUR2C32.js.map} +0 -0
  50. /package/build/{DevCommand-HCWH3OHY.js.map → DevCommand-Q2FYB3XY.js.map} +0 -0
  51. /package/build/{GenerateCommand-OVNCGGHO.js.map → GenerateCommand-F52FFNBI.js.map} +0 -0
  52. /package/build/{LogsCommand-7XQMJNCS.js.map → LogsCommand-5UYLBRQZ.js.map} +0 -0
  53. /package/build/{PreviewCommand-I2WAW3M3.js.map → PreviewCommand-IQAJTIVR.js.map} +0 -0
  54. /package/build/{ReleaseCommand-PBSE5PLP.js.map → ReleaseCommand-XQSVZICW.js.map} +0 -0
  55. /package/build/{ServeCommand-KYY7EMSY.js.map → ServeCommand-SPJHLK7U.js.map} +0 -0
  56. /package/build/{build-OWIIXCY5.js.map → build-2T5BFUWM.js.map} +0 -0
  57. /package/build/{chunk-RJ5AE5PA.js.map → chunk-7DXNLVMY.js.map} +0 -0
  58. /package/build/{chunk-ROUPG4XJ.js.map → chunk-B3XIOUQT.js.map} +0 -0
  59. /package/build/{chunk-CHCM5GIW.js.map → chunk-BMVS42XS.js.map} +0 -0
  60. /package/build/{chunk-NBX5ZDG4.js.map → chunk-C42KLSNW.js.map} +0 -0
  61. /package/build/{chunk-JNQZZJEG.js.map → chunk-GTSFGE5V.js.map} +0 -0
  62. /package/build/{chunk-KNEYNMAC.js.map → chunk-KF4Y7AR3.js.map} +0 -0
  63. /package/build/{chunk-OSOIJLUZ.js.map → chunk-KGCNOH2C.js.map} +0 -0
  64. /package/build/{chunk-BUFZB2WZ.js.map → chunk-LUVRH4ML.js.map} +0 -0
  65. /package/build/{chunk-4EN3XULI.js.map → chunk-QSLY47CE.js.map} +0 -0
  66. /package/build/{chunk-63ZWJD2E.js.map → chunk-R52Q3OHG.js.map} +0 -0
  67. /package/build/{chunk-5LEKQK4K.js.map → chunk-V5F6GGW4.js.map} +0 -0
  68. /package/build/{chunk-5ADLOYER.js.map → chunk-YO7FIWQY.js.map} +0 -0
  69. /package/build/{chunk-M2DNPZJ6.js.map → chunk-ZQAW4UYV.js.map} +0 -0
  70. /package/build/platform-sdk/{chunk-UTEFPCPF.js.map → chunk-KXCY2KWZ.js.map} +0 -0
  71. /package/build/{preview-EFKSIVQM.js.map → preview-KPMG263Y.js.map} +0 -0
  72. /package/build/{release-ID5VU6AQ.js.map → release-EOP3M5P7.js.map} +0 -0
  73. /package/build/{render-command-WGIVK7NK.js.map → render-command-YNOAIR7C.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as Q}from"./chunk-EZGPNUD5.js";import{a as G}from"./chunk-2QLMI2GU.js";import"./chunk-TONDB6MX.js";import"./chunk-UTEFPCPF.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 Le,{useEffect as Be,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 z(()=>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 z(()=>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 z(()=>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 z(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=a=>{let{channel:i}=a;return function(){let d=i.showToast(...arguments);return{remove:()=>Promise.resolve(d).then(x=>x.remove())}}},t=a=>{let{channel:i}=a;return function(){let d=i.observeState(...arguments);return{disconnect:()=>Promise.resolve(d).then(x=>x.disconnect())}}};return{showToast:e,observeState:t,navigate:a=>{let{channel:i}=a;return function(){return i.navigate(...arguments)}},navigateBack:a=>{let{channel:i}=a;return()=>i.navigateBack()},openModal:a=>{let{channel:i}=a;return(d,m)=>{let[x,k]=typeof d=="string"?[d,m]:[d.modalId,d.params],E=i.openModal(x,k);return{modalClosed:Promise.resolve(E).then(w=>w.modalClosed)}}},closeModal:a=>{let{channel:i}=a;return d=>{if(d===void 0)return i.closeModal();let m=JSON.parse(JSON.stringify(d));return i.closeModal(m)}},getAccessToken:a=>{let{channel:i}=a;return()=>i.getAccessToken()},getPageUrl:a=>{let{channel:i}=a;return function(){return i.getPageUrl(...arguments)}},openMediaManager:a=>{let{channel:i}=a;return function(){return i.openMediaManager(...arguments)}},addSitePlugin:a=>{let{channel:i}=a;return(d,m)=>{let x="802c76e4-b381-4bb3-9152-96acabbf3194",k=m?.placement||{},E=i.openModal(x,{...k,placementsSlotId:m?.slotId,pluginId:d,action:"populate"});return Promise.resolve(E).then(w=>w.modalClosed).then(w=>{if(w?.type===void 0)throw new C({message:"Aborted by user",code:3006});if(w?.type==="ERROR")throw new C(w.data.error)})}},onBeforeUnload:a=>{let{channel:i}=a;return function(){return i.onBeforeUnload(...arguments)}},setPageTitle:a=>{let{channel:i}=a;return d=>i.setPageTitle(d)},getLanguage:a=>{let i=null;return async()=>{var d;if(i)return i;let m=null;return i=await new Promise(x=>{m=t(a)((k,E)=>{x(E.language)})}),(d=m)==null||d.disconnect(),i}},requestFeedback:a=>{let{channel:i}=a;return function(){return i.requestFeedback(...arguments)}},onLayerStateChange:a=>{let{channel:i}=a;return function(){let d=i.onLayerStateChange(...arguments);return{remove:()=>Promise.resolve(d).then(x=>x.remove())}}},installApp:a=>{let{channel:i}=a;return i.installApp},getSiteInfo:a=>{let{channel:i}=a;return i.getSiteInfo},getWidget:a=>{let{channel:i}=a;return function(){if("getWidget"in i)return i.getWidget(...arguments);throw new Error("Unsupported")}},getWidgetAsync:a=>{let{channel:i}=a;return d=>{if("getWidgetAsync"in i)return i.getWidgetAsync(d);throw new Error("Unsupported")}},getDashboardPlugins:a=>{let{channel:i}=a;return function(){if("getDashboardPlugins"in i)return i.getDashboardPlugins(...arguments);throw new Error("Unsupported")}},getDashboardMenuPlugins:a=>{let{channel:i}=a;return function(){if("getDashboardMenuPlugins"in i)return i.getDashboardMenuPlugins(...arguments);throw new Error("Unsupported")}},createStore:a=>{let{channel:i}=a;if(i.createStore)return i.createStore},getStore:a=>{let{channel:i}=a;if(i.getStore)return i.getStore}}};var oe=e=>{let{createHost:t}=e,n=re();return{...Z(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var se=Symbol("Comlink.proxy"),Se=Symbol("Comlink.endpoint"),H=Symbol("Comlink.releaseProxy"),I=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)}},Ce={canHandle:e=>ae(e)&&I 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",Ce]]);function R(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:o,type:s,path:u}=Object.assign({path:[]},r.data),l=(r.data.argumentList||[]).map(v),c;try{let f=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: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=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(f){c={value:f,[I]:0}}Promise.resolve(c).catch(f=>({value:f,[I]:0})).then(f=>{let[h,p]=B(f);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 O(e,[],t)}function D(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(s,u){if(D(r),u===H)return()=>_(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=_(e,{type:0,path:t.map(c=>c.toString())}).then(v);return l.then.bind(l)}return O(e,[...t,u])},set(s,u,l){D(r);let[c,f]=B(l);return _(e,{type:1,path:[...t,u].map(h=>h.toString()),value:c},f).then(v)},apply(s,u,l){D(r);let c=t[t.length-1];if(c===Se)return _(e,{type:4}).then(v);if(c==="bind")return O(e,t.slice(0,-1));let[f,h]=ie(l);return _(e,{type:2,path:t.map(p=>p.toString()),argumentList:f},h).then(v)},construct(s,u){D(r);let[l,c]=ie(u);return _(e,{type:3,path:t.map(f=>f.toString()),argumentList:l},c).then(v)}});return o}function ke(e){return Array.prototype.concat.apply([],e)}function ie(e){let t=e.map(B);return[t.map(n=>n[0]),ke(t.map(n=>n[1]))]}var ce=new WeakMap;function Ae(e,t){return ce.set(e,t),e}function W(e){return Object.assign(e,{[se]:!0})}function B(e){for(let[t,n]of le)if(n.canHandle(e)){let[r,o]=n.serialize(e);return[{type:3,name:t,value:r},o]}return[{type:0,value:e},ce.get(e)||[]]}function v(e){switch(e.type){case 3:return le.get(e.name).deserialize(e.value);case 0:return e.value}}function _(e,t,n){return new Promise(r=>{let o=De();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 De(){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=>Ue(e,t=>async function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];let[s,u]=$(r),l=await t(W(s),u);return pe(l)});var Te=async e=>{let[t,n]=$(await e);return W({proxies:t,clonables:n})},pe=async e=>U(e?.proxies,await e?.clonables),$=e=>{let t=(o,s)=>{if(he(s)){let u=de();return o.promises[u]=s,{[j]:u}}if(ze(s)){let u=de();return o.callbacks[u]=(l,c)=>{let f=U(l,c),h=s(...f);return Te(h)},{[K]:u}}return Array.isArray(s)?s.map(u=>t(o,u)):T(s)?me(s,u=>t(o,u)):s},n={promises:{},callbacks:{}},r=t(n,e);return[n,r]},U=(e,t)=>{if(Array.isArray(t))return t.map(n=>U(e,n));if(T(t)&&t.hasOwnProperty(j)){let n=t[j];return e.promises[n]}if(T(t)&&t.hasOwnProperty(K)){let n=t[K];return async function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];let[u,l]=$(o),c=await e.callbacks[n](W(u),l);return pe(c)}}return T(t)?me(t,n=>U(e,n)):t},Ue=(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,T=e=>e&&typeof e=="object"&&!he(e),ze=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 Ie="wix-sdk-bo-hello-handshake",xe=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:o}=new MessageChannel;t({code:Ie,version:"1.0.0",port:o},n,[o]);let l=fe(L(r));return{channel:l,close:()=>l[H]()}};var ge=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var Oe=/^https:\/\/(([a-z0-9-]+)\.)?manage\.wix\.com$/,we=e=>Oe.test(e);var ye=e=>{let t=new EventTarget,n=typeof window>"u",r=l=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(l.preventDefault(),l.returnValue=!0)},o=e.onBeforeUnload(r),s=()=>{n||window.removeEventListener("beforeunload",r),o.then(l=>{let{remove:c}=l;return c()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",s)),{onBeforeUnload:l=>(t.addEventListener("beforeunload",l),{remove:()=>{t.removeEventListener("beforeunload",l)}}),clearBeforeUnloadHandler:s}};function He(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")?He(e.get("essentials")):void 0}var ve=e=>t=>{let{message:n,action:r,requestId:o}=t;n&&e.showToast({type:"error",details:o!=null?{requestId:o}:void 0,message:n,action:r&&{...r,removeToastOnClick:!0,uiType:"link"}})};var Me=function(e){e===void 0&&(e={});let t=e.fullUrl&&new URL(e.fullUrl).search||typeof window<"u"&&window.location.search||"",n=new URLSearchParams(t),r=e.origin||n.get("origin")||"",o=e.postMessage||window.parent.postMessage.bind(window.parent);if(!we(r))throw new Error("Wix Dashboard SDK: Unable to establish a connection with the Wix dashboard. Please ensure that you are running your app within the Wix dashboard.");let{channel:s,close:u}=xe({postMessage:o,origin:r}),l=[u];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let M=e.autoHeightElement||document.documentElement,P=ge(s,M);l.push(()=>P())}let{onBeforeUnload:c,clearBeforeUnloadHandler:f}=ye(s);l.push(f);let h=Re(n.get("siteInfo")||"","siteInfo"),p=()=>h,y=new Proxy(s,{get(M,P,J){return P==="onBeforeUnload"?c:P==="getSiteInfo"?p:Reflect.get(M,P,J)}}),{monitoring:S,...V}=be(n)||{},q=Q({hostContext:S?.context,monitoringConfig:S?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0}),N={openItemSelector:s.openItemSelector,apps:{startInstallFlow:s.startInstallFlow,startPurchasePlanFlow:s.startPurchasePlanFlow,startUpdateFlow:s.startUpdateFlow,openContactSupport:s.openContactSupport},credits:{openPaywallModal:s.openPaywallModal}};return{channel:y,close:()=>l.forEach(M=>M()),getMonitoringClient:q,essentials:V,workspace:N,showError:ve(s)}},Re=(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 F=oe({createHost:Me});var _e=(e,t)=>{let[n,r]=Pe(()=>e());return t(n)&&r(e()),n},Ke=e=>t=>{let{host:n,compProps:r}=je(t);return _e(()=>(G({auth:F.auth(),host:n}).enableContext("module"),n),o=>o!==n),r?Le.createElement(e,A({host:n},r)):null},je=e=>{let{host:t,...n}=e,{host:r,hostType:o}=_e(()=>t?{host:t,hostType:"local"}:{host:F.host(),hostType:"remote"},l=>!!t&&t!==l.host),[s,u]=Pe(void 0);return Be(()=>{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:s?{...s,...n}:void 0}};export{Ke as withContextualWixClient};
1
+ import{a as Q}from"./chunk-EZGPNUD5.js";import{a as G}from"./chunk-S46ZF4YM.js";import"./chunk-TONDB6MX.js";import"./chunk-KXCY2KWZ.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 Le,{useEffect as Be,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 z(()=>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 z(()=>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 z(()=>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 z(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=a=>{let{channel:i}=a;return function(){let d=i.showToast(...arguments);return{remove:()=>Promise.resolve(d).then(x=>x.remove())}}},t=a=>{let{channel:i}=a;return function(){let d=i.observeState(...arguments);return{disconnect:()=>Promise.resolve(d).then(x=>x.disconnect())}}};return{showToast:e,observeState:t,navigate:a=>{let{channel:i}=a;return function(){return i.navigate(...arguments)}},navigateBack:a=>{let{channel:i}=a;return()=>i.navigateBack()},openModal:a=>{let{channel:i}=a;return(d,m)=>{let[x,k]=typeof d=="string"?[d,m]:[d.modalId,d.params],E=i.openModal(x,k);return{modalClosed:Promise.resolve(E).then(w=>w.modalClosed)}}},closeModal:a=>{let{channel:i}=a;return d=>{if(d===void 0)return i.closeModal();let m=JSON.parse(JSON.stringify(d));return i.closeModal(m)}},getAccessToken:a=>{let{channel:i}=a;return()=>i.getAccessToken()},getPageUrl:a=>{let{channel:i}=a;return function(){return i.getPageUrl(...arguments)}},openMediaManager:a=>{let{channel:i}=a;return function(){return i.openMediaManager(...arguments)}},addSitePlugin:a=>{let{channel:i}=a;return(d,m)=>{let x="802c76e4-b381-4bb3-9152-96acabbf3194",k=m?.placement||{},E=i.openModal(x,{...k,placementsSlotId:m?.slotId,pluginId:d,action:"populate"});return Promise.resolve(E).then(w=>w.modalClosed).then(w=>{if(w?.type===void 0)throw new C({message:"Aborted by user",code:3006});if(w?.type==="ERROR")throw new C(w.data.error)})}},onBeforeUnload:a=>{let{channel:i}=a;return function(){return i.onBeforeUnload(...arguments)}},setPageTitle:a=>{let{channel:i}=a;return d=>i.setPageTitle(d)},getLanguage:a=>{let i=null;return async()=>{var d;if(i)return i;let m=null;return i=await new Promise(x=>{m=t(a)((k,E)=>{x(E.language)})}),(d=m)==null||d.disconnect(),i}},requestFeedback:a=>{let{channel:i}=a;return function(){return i.requestFeedback(...arguments)}},onLayerStateChange:a=>{let{channel:i}=a;return function(){let d=i.onLayerStateChange(...arguments);return{remove:()=>Promise.resolve(d).then(x=>x.remove())}}},installApp:a=>{let{channel:i}=a;return i.installApp},getSiteInfo:a=>{let{channel:i}=a;return i.getSiteInfo},getWidget:a=>{let{channel:i}=a;return function(){if("getWidget"in i)return i.getWidget(...arguments);throw new Error("Unsupported")}},getWidgetAsync:a=>{let{channel:i}=a;return d=>{if("getWidgetAsync"in i)return i.getWidgetAsync(d);throw new Error("Unsupported")}},getDashboardPlugins:a=>{let{channel:i}=a;return function(){if("getDashboardPlugins"in i)return i.getDashboardPlugins(...arguments);throw new Error("Unsupported")}},getDashboardMenuPlugins:a=>{let{channel:i}=a;return function(){if("getDashboardMenuPlugins"in i)return i.getDashboardMenuPlugins(...arguments);throw new Error("Unsupported")}},createStore:a=>{let{channel:i}=a;if(i.createStore)return i.createStore},getStore:a=>{let{channel:i}=a;if(i.getStore)return i.getStore}}};var oe=e=>{let{createHost:t}=e,n=re();return{...Z(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var se=Symbol("Comlink.proxy"),Se=Symbol("Comlink.endpoint"),H=Symbol("Comlink.releaseProxy"),I=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)}},Ce={canHandle:e=>ae(e)&&I 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",Ce]]);function R(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:o,type:s,path:u}=Object.assign({path:[]},r.data),l=(r.data.argumentList||[]).map(v),c;try{let f=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: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=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(f){c={value:f,[I]:0}}Promise.resolve(c).catch(f=>({value:f,[I]:0})).then(f=>{let[h,p]=B(f);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 O(e,[],t)}function D(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(s,u){if(D(r),u===H)return()=>_(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=_(e,{type:0,path:t.map(c=>c.toString())}).then(v);return l.then.bind(l)}return O(e,[...t,u])},set(s,u,l){D(r);let[c,f]=B(l);return _(e,{type:1,path:[...t,u].map(h=>h.toString()),value:c},f).then(v)},apply(s,u,l){D(r);let c=t[t.length-1];if(c===Se)return _(e,{type:4}).then(v);if(c==="bind")return O(e,t.slice(0,-1));let[f,h]=ie(l);return _(e,{type:2,path:t.map(p=>p.toString()),argumentList:f},h).then(v)},construct(s,u){D(r);let[l,c]=ie(u);return _(e,{type:3,path:t.map(f=>f.toString()),argumentList:l},c).then(v)}});return o}function ke(e){return Array.prototype.concat.apply([],e)}function ie(e){let t=e.map(B);return[t.map(n=>n[0]),ke(t.map(n=>n[1]))]}var ce=new WeakMap;function Ae(e,t){return ce.set(e,t),e}function W(e){return Object.assign(e,{[se]:!0})}function B(e){for(let[t,n]of le)if(n.canHandle(e)){let[r,o]=n.serialize(e);return[{type:3,name:t,value:r},o]}return[{type:0,value:e},ce.get(e)||[]]}function v(e){switch(e.type){case 3:return le.get(e.name).deserialize(e.value);case 0:return e.value}}function _(e,t,n){return new Promise(r=>{let o=De();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 De(){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=>Ue(e,t=>async function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];let[s,u]=$(r),l=await t(W(s),u);return pe(l)});var Te=async e=>{let[t,n]=$(await e);return W({proxies:t,clonables:n})},pe=async e=>U(e?.proxies,await e?.clonables),$=e=>{let t=(o,s)=>{if(he(s)){let u=de();return o.promises[u]=s,{[j]:u}}if(ze(s)){let u=de();return o.callbacks[u]=(l,c)=>{let f=U(l,c),h=s(...f);return Te(h)},{[K]:u}}return Array.isArray(s)?s.map(u=>t(o,u)):T(s)?me(s,u=>t(o,u)):s},n={promises:{},callbacks:{}},r=t(n,e);return[n,r]},U=(e,t)=>{if(Array.isArray(t))return t.map(n=>U(e,n));if(T(t)&&t.hasOwnProperty(j)){let n=t[j];return e.promises[n]}if(T(t)&&t.hasOwnProperty(K)){let n=t[K];return async function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];let[u,l]=$(o),c=await e.callbacks[n](W(u),l);return pe(c)}}return T(t)?me(t,n=>U(e,n)):t},Ue=(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,T=e=>e&&typeof e=="object"&&!he(e),ze=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 Ie="wix-sdk-bo-hello-handshake",xe=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:o}=new MessageChannel;t({code:Ie,version:"1.0.0",port:o},n,[o]);let l=fe(L(r));return{channel:l,close:()=>l[H]()}};var ge=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var Oe=/^https:\/\/(([a-z0-9-]+)\.)?manage\.wix\.com$/,we=e=>Oe.test(e);var ye=e=>{let t=new EventTarget,n=typeof window>"u",r=l=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(l.preventDefault(),l.returnValue=!0)},o=e.onBeforeUnload(r),s=()=>{n||window.removeEventListener("beforeunload",r),o.then(l=>{let{remove:c}=l;return c()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",s)),{onBeforeUnload:l=>(t.addEventListener("beforeunload",l),{remove:()=>{t.removeEventListener("beforeunload",l)}}),clearBeforeUnloadHandler:s}};function He(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")?He(e.get("essentials")):void 0}var ve=e=>t=>{let{message:n,action:r,requestId:o}=t;n&&e.showToast({type:"error",details:o!=null?{requestId:o}:void 0,message:n,action:r&&{...r,removeToastOnClick:!0,uiType:"link"}})};var Me=function(e){e===void 0&&(e={});let t=e.fullUrl&&new URL(e.fullUrl).search||typeof window<"u"&&window.location.search||"",n=new URLSearchParams(t),r=e.origin||n.get("origin")||"",o=e.postMessage||window.parent.postMessage.bind(window.parent);if(!we(r))throw new Error("Wix Dashboard SDK: Unable to establish a connection with the Wix dashboard. Please ensure that you are running your app within the Wix dashboard.");let{channel:s,close:u}=xe({postMessage:o,origin:r}),l=[u];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let M=e.autoHeightElement||document.documentElement,P=ge(s,M);l.push(()=>P())}let{onBeforeUnload:c,clearBeforeUnloadHandler:f}=ye(s);l.push(f);let h=Re(n.get("siteInfo")||"","siteInfo"),p=()=>h,y=new Proxy(s,{get(M,P,J){return P==="onBeforeUnload"?c:P==="getSiteInfo"?p:Reflect.get(M,P,J)}}),{monitoring:S,...V}=be(n)||{},q=Q({hostContext:S?.context,monitoringConfig:S?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0}),N={openItemSelector:s.openItemSelector,apps:{startInstallFlow:s.startInstallFlow,startPurchasePlanFlow:s.startPurchasePlanFlow,startUpdateFlow:s.startUpdateFlow,openContactSupport:s.openContactSupport},credits:{openPaywallModal:s.openPaywallModal}};return{channel:y,close:()=>l.forEach(M=>M()),getMonitoringClient:q,essentials:V,workspace:N,showError:ve(s)}},Re=(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 F=oe({createHost:Me});var _e=(e,t)=>{let[n,r]=Pe(()=>e());return t(n)&&r(e()),n},Ke=e=>t=>{let{host:n,compProps:r}=je(t);return _e(()=>(G({auth:F.auth(),host:n}).enableContext("module"),n),o=>o!==n),r?Le.createElement(e,A({host:n},r)):null},je=e=>{let{host:t,...n}=e,{host:r,hostType:o}=_e(()=>t?{host:t,hostType:"local"}:{host:F.host(),hostType:"remote"},l=>!!t&&t!==l.host),[s,u]=Pe(void 0);return Be(()=>{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:s?{...s,...n}:void 0}};export{Ke as withContextualWixClient};
2
2
  //# sourceMappingURL=dashboard.js.map
@@ -1,4 +1,4 @@
1
- import{a as ke}from"./chunk-EZGPNUD5.js";import{a as Ne}from"./chunk-2QLMI2GU.js";import"./chunk-TONDB6MX.js";import{c as fi,d as Pi}from"./chunk-UTEFPCPF.js";import{b as Se,d as Oe,e as ui,f as l,g as a,h,i as w,j as u}from"./chunk-SBZEOPXX.js";var Fe=Se(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.EventType=void 0;var We;(function(i){i.removeAppCompleted="removeAppCompleted",i.componentSelectionChanged="componentSelectionChanged",i.appInstalled="appInstalled",i.appUpdateCompleted="appUpdateCompleted"})(We||(ht.EventType=We={}))});var Ut=Se(A=>{"use strict";var mi=A&&A.__createBinding||(Object.create?function(i,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,s)}:function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]}),gi=A&&A.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),Ii=A&&A.__importStar||function(){var i=function(t){return i=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},i(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=i(t),s=0;s<n.length;s++)n[s]!=="default"&&mi(e,t,n[s]);return gi(e,t),e}}();Object.defineProperty(A,"__esModule",{value:!0});A.EventType=A.WixSDKTypes=void 0;var wi=Ii((Pi(),ui(fi)));A.WixSDKTypes=wi;var Ai=Fe();Object.defineProperty(A,"EventType",{enumerable:!0,get:function(){return Ai.EventType}})});var H=Oe(Ut(),1);var O=class O{constructor(){l(this,"uid",0);l(this,"callbacks",new Map);l(this,"inTransaction",!1);l(this,"isSilent",!1);l(this,"queue",[])}silent(t=!0){this.isSilent=t}startTransaction(){this.inTransaction=!0}commit(){this.inTransaction=!1;let t=this.queue;this.queue=[],this.isSilent||t.forEach(e=>{this.notify(e)})}notify(t){this.isSilent||(this.inTransaction?this.queue.push(t):this.callbacks.forEach(e=>{e(t)}))}subscribe(t){let e=this.uid++;return this.callbacks.set(e,t),()=>{this.callbacks.delete(e)}}notifyWithStep(t,e){this.notify({...t,meta:{...t.meta,step:e}})}async withEvent(t,e){let n=e();if(n&&n.hasOwnProperty("then"))try{return this.notifyWithStep(t,O.EventSteps.Start),n=await n,this.notifyWithStep(t,O.EventSteps.End),n}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},O.EventSteps.Error),s}else return this.notify(t),n}};l(O,"biEvents",{PLATFORM_WORKER_SPAWN:123,PLATFORM_APP_RUNNER_INIT_APP_API:124,PLATFORM_APP_RUNNER_RUN_APP:125,PLATFORM_APP_RUNNER_REMOVE_APP:126,PLATFORM_WORKER_APP_BUNDLE_LOAD:127,PLATFORM_WORKER_APP_BUNDLE_EXECUTE:128,PLATFORM_IFRAME_INIT:129,PLATFORM_APP_API_INIT:130,PLATFORM_APP_API_GET:131}),l(O,"EventSteps",{Start:"start",End:"end",Error:"error"});var $t=O,ut=(i=>(i.WorkerSpawn="WorkerSpawn",i.HostEvent="HostEvent",i.ApplicationsSpecsReceived="ApplicationsSpecsReceived",i.InitApplicationApi="InitApplicationApi",i.RunApplication="RunApplication",i.getApplicationApi="getApplicationApi",i.IframeInit="IframeInit",i))(ut||{}),qt=(i=>(i.EditorReady="EditorReady",i))(qt||{});var v=(i=>(i.ApplicationInit="ApplicationInit",i.ApplicationExecute="ApplicationExecute",i.ApplicationRemoved="ApplicationRemoved",i.ApplicationLoad="ApplicationLoad",i.ApplicationApiInit="ApplicationApiInit",i.CustomEvent="CustomEvent",i.HostEvent="HostEvent",i.EditorReady="EditorReady",i))(v||{}),jt=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_APP_BUNDLE_LOAD,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationExecuteEvent(t,e){return{type:"ApplicationExecute",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_APP_BUNDLE_EXECUTE,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationApiInitEvent(t,e){return{type:"ApplicationApiInit",payload:{appDefinitionId:t},meta:{bi:{evid:C.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},C=class extends $t{constructor(){super(...arguments);l(this,"factories",new jt)}},dt=class dt{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ut.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);dt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};l(dt,"allowedEvents",[H.EventType.componentSelectionChanged,H.EventType.appInstalled,H.EventType.appUpdateCompleted,H.EventType.removeAppCompleted]);var Le=dt;var I=class i extends Error{constructor(e,n,s){let r=e?` ${e}`:"",o=`[${s}]#${n}`;super(`${o}.${r}`);l(this,"state",{});l(this,"displayName");l(this,"prefix");l(this,"errorMessage");l(this,"parent");l(this,"messages",[]);l(this,"code");this.displayName=o,this.errorMessage=e,this.prefix=s,this.code=n,this.name=o,Object.defineProperty(this,"message",{get:()=>this.getDisplayMessage()}),Error.captureStackTrace&&Error.captureStackTrace(this,i)}get parentError(){let e=this.parent;if(!e)return null;if(this.parent instanceof i)return this.parent;let n=e.name??"[Unknown Error]";return{getBreadcrumbs(){return[n]},getMessage(){return[n,e.message??"unknown error message"].join(`
1
+ import{a as ke}from"./chunk-EZGPNUD5.js";import{a as Ne}from"./chunk-S46ZF4YM.js";import"./chunk-TONDB6MX.js";import{a as fi,b as Pi}from"./chunk-KXCY2KWZ.js";import{b as Se,d as Oe,e as ui,f as l,g as a,h,i as w,j as u}from"./chunk-SBZEOPXX.js";var Fe=Se(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.EventType=void 0;var We;(function(i){i.removeAppCompleted="removeAppCompleted",i.componentSelectionChanged="componentSelectionChanged",i.appInstalled="appInstalled",i.appUpdateCompleted="appUpdateCompleted"})(We||(ht.EventType=We={}))});var Ut=Se(A=>{"use strict";var mi=A&&A.__createBinding||(Object.create?function(i,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,s)}:function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]}),gi=A&&A.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),Ii=A&&A.__importStar||function(){var i=function(t){return i=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},i(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=i(t),s=0;s<n.length;s++)n[s]!=="default"&&mi(e,t,n[s]);return gi(e,t),e}}();Object.defineProperty(A,"__esModule",{value:!0});A.EventType=A.WixSDKTypes=void 0;var wi=Ii((Pi(),ui(fi)));A.WixSDKTypes=wi;var Ai=Fe();Object.defineProperty(A,"EventType",{enumerable:!0,get:function(){return Ai.EventType}})});var H=Oe(Ut(),1);var O=class O{constructor(){l(this,"uid",0);l(this,"callbacks",new Map);l(this,"inTransaction",!1);l(this,"isSilent",!1);l(this,"queue",[])}silent(t=!0){this.isSilent=t}startTransaction(){this.inTransaction=!0}commit(){this.inTransaction=!1;let t=this.queue;this.queue=[],this.isSilent||t.forEach(e=>{this.notify(e)})}notify(t){this.isSilent||(this.inTransaction?this.queue.push(t):this.callbacks.forEach(e=>{e(t)}))}subscribe(t){let e=this.uid++;return this.callbacks.set(e,t),()=>{this.callbacks.delete(e)}}notifyWithStep(t,e){this.notify({...t,meta:{...t.meta,step:e}})}async withEvent(t,e){let n=e();if(n&&n.hasOwnProperty("then"))try{return this.notifyWithStep(t,O.EventSteps.Start),n=await n,this.notifyWithStep(t,O.EventSteps.End),n}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},O.EventSteps.Error),s}else return this.notify(t),n}};l(O,"biEvents",{PLATFORM_WORKER_SPAWN:123,PLATFORM_APP_RUNNER_INIT_APP_API:124,PLATFORM_APP_RUNNER_RUN_APP:125,PLATFORM_APP_RUNNER_REMOVE_APP:126,PLATFORM_WORKER_APP_BUNDLE_LOAD:127,PLATFORM_WORKER_APP_BUNDLE_EXECUTE:128,PLATFORM_IFRAME_INIT:129,PLATFORM_APP_API_INIT:130,PLATFORM_APP_API_GET:131}),l(O,"EventSteps",{Start:"start",End:"end",Error:"error"});var $t=O,ut=(i=>(i.WorkerSpawn="WorkerSpawn",i.HostEvent="HostEvent",i.ApplicationsSpecsReceived="ApplicationsSpecsReceived",i.InitApplicationApi="InitApplicationApi",i.RunApplication="RunApplication",i.getApplicationApi="getApplicationApi",i.IframeInit="IframeInit",i))(ut||{}),qt=(i=>(i.EditorReady="EditorReady",i))(qt||{});var v=(i=>(i.ApplicationInit="ApplicationInit",i.ApplicationExecute="ApplicationExecute",i.ApplicationRemoved="ApplicationRemoved",i.ApplicationLoad="ApplicationLoad",i.ApplicationApiInit="ApplicationApiInit",i.CustomEvent="CustomEvent",i.HostEvent="HostEvent",i.EditorReady="EditorReady",i))(v||{}),jt=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_APP_BUNDLE_LOAD,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationExecuteEvent(t,e){return{type:"ApplicationExecute",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_APP_BUNDLE_EXECUTE,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationApiInitEvent(t,e){return{type:"ApplicationApiInit",payload:{appDefinitionId:t},meta:{bi:{evid:C.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},C=class extends $t{constructor(){super(...arguments);l(this,"factories",new jt)}},dt=class dt{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ut.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);dt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};l(dt,"allowedEvents",[H.EventType.componentSelectionChanged,H.EventType.appInstalled,H.EventType.appUpdateCompleted,H.EventType.removeAppCompleted]);var Le=dt;var I=class i extends Error{constructor(e,n,s){let r=e?` ${e}`:"",o=`[${s}]#${n}`;super(`${o}.${r}`);l(this,"state",{});l(this,"displayName");l(this,"prefix");l(this,"errorMessage");l(this,"parent");l(this,"messages",[]);l(this,"code");this.displayName=o,this.errorMessage=e,this.prefix=s,this.code=n,this.name=o,Object.defineProperty(this,"message",{get:()=>this.getDisplayMessage()}),Error.captureStackTrace&&Error.captureStackTrace(this,i)}get parentError(){let e=this.parent;if(!e)return null;if(this.parent instanceof i)return this.parent;let n=e.name??"[Unknown Error]";return{getBreadcrumbs(){return[n]},getMessage(){return[n,e.message??"unknown error message"].join(`
2
2
  `)}}}getDisplayMessage(){return[(this.parentError?this.getBreadcrumbs():[]).join(" -> "),this.getMessage()].filter(n=>n.trim().length).join(`
3
3
  `)}getMessage(){let e=Object.entries(this.state).reduce((c,[p,d])=>(d&&c.push(` \u2013 ${p}: ${d}`),c),[]).join(`
4
4
  `),n=this.messages.reduce((c,p)=>(c.push(` - ${p.join(" ")}`),c),[]).join(`
@@ -1,2 +1,2 @@
1
- import{c as o}from"./chunk-TONDB6MX.js";import"./chunk-UTEFPCPF.js";import"./chunk-SBZEOPXX.js";import{wixContext as n}from"@wix/sdk-context";function r(t,e){e==="global"?globalThis.__wix_context__!=null?globalThis.__wix_context__.client=t:globalThis.__wix_context__={client:t}:n.client=t}var c=o(t=>(e,l)=>t.fetchWithAuth(e,l));export{r as enableContext};
1
+ import{c as o}from"./chunk-TONDB6MX.js";import"./chunk-SBZEOPXX.js";import{wixContext as n}from"@wix/sdk-context";function r(t,e){e==="global"?globalThis.__wix_context__!=null?globalThis.__wix_context__.client=t:globalThis.__wix_context__={client:t}:n.client=t}var c=o(t=>(e,l)=>t.fetchWithAuth(e,l));export{r as enableContext};
2
2
  //# sourceMappingURL=sdk-context.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/@wix/sdk/build/enable-context.js","../../../node_modules/@wix/sdk/build/context.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nexport function enableContext(wixClient, contextType) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n globalThis.__wix_context__.client = wixClient;\n }\n else {\n globalThis.__wix_context__ = { client: wixClient };\n }\n }\n else {\n wixContext.client = wixClient;\n }\n}\n","import { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nexport function elevate(restModule) {\n return createRESTModule(restModule, true);\n}\nexport const fetchWithAuth = createRESTModule((restModuleOpts) => {\n return ((url, options) => restModuleOpts.fetchWithAuth(url, options));\n});\nexport { graphql } from './graphql.js';\nexport { setGlobalWixContext } from './wix-context.js';\nexport { enableContext } from './enable-context.js';\n"],"mappings":"gGAAA,OAAS,cAAAA,MAAkB,mBACpB,SAASC,EAAcC,EAAWC,EAAa,CAC9CA,IAAgB,SACZ,WAAW,iBAAmB,KAC9B,WAAW,gBAAgB,OAASD,EAGpC,WAAW,gBAAkB,CAAE,OAAQA,CAAU,EAIrDF,EAAW,OAASE,CAE5B,CCTO,IAAME,EAAgBC,EAAkBC,GACnC,CAACC,EAAKC,IAAYF,EAAe,cAAcC,EAAKC,CAAO,CACtE","names":["wixContext","enableContext","wixClient","contextType","fetchWithAuth","createRESTModule","restModuleOpts","url","options"]}
1
+ {"version":3,"sources":["../../../node_modules/@wix/sdk/build/enable-context.js","../../../node_modules/@wix/sdk/build/context.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nexport function enableContext(wixClient, contextType) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n globalThis.__wix_context__.client = wixClient;\n }\n else {\n globalThis.__wix_context__ = { client: wixClient };\n }\n }\n else {\n wixContext.client = wixClient;\n }\n}\n","import { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nexport function elevate(restModule) {\n return createRESTModule(restModule, true);\n}\nexport const fetchWithAuth = createRESTModule((restModuleOpts) => {\n return ((url, options) => restModuleOpts.fetchWithAuth(url, options));\n});\nexport { graphql } from './graphql.js';\nexport { setGlobalWixContext } from './wix-context.js';\nexport { enableContext } from './enable-context.js';\n"],"mappings":"oEAAA,OAAS,cAAAA,MAAkB,mBACpB,SAASC,EAAcC,EAAWC,EAAa,CAC9CA,IAAgB,SACZ,WAAW,iBAAmB,KAC9B,WAAW,gBAAgB,OAASD,EAGpC,WAAW,gBAAkB,CAAE,OAAQA,CAAU,EAIrDF,EAAW,OAASE,CAE5B,CCTO,IAAME,EAAgBC,EAAkBC,GACnC,CAACC,EAAKC,IAAYF,EAAe,cAAcC,EAAKC,CAAO,CACtE","names":["wixContext","enableContext","wixClient","contextType","fetchWithAuth","createRESTModule","restModuleOpts","url","options"]}
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-2QLMI2GU.js";import"./chunk-TONDB6MX.js";import"./chunk-UTEFPCPF.js";import"./chunk-SBZEOPXX.js";function c(){let n=null,e=null;return{promise:new Promise((o,i)=>{n=o,e=i}),resolve:n,reject:e}}var d=({createHost:n})=>({__type:"host",create:e=>({}),host:e=>{let{applicationId:t}=e??{},o=typeof window<"u"?window.wixEmbedsAPI:void 0,i=n(e),r=m();return{...i,apiBaseUrl:r,getMonitoringClient:o?.getMonitoringClientFunction?.(t),essentials:{language:typeof window<"u"?window.commonConfig?.language:void 0,locale:typeof window<"u"?window.commonConfig?.locale:void 0}}},auth:e=>{let t=typeof window<"u"?window.wixEmbedsAPI:void 0;e||(e=t?.getAccessTokenFunction?.());let o=!1,{resolve:i,promise:r}=c();return{getAuthHeaders:async()=>{if(!e&&o&&(e=await r),!e)throw new Error("Failed to resolve auth token");return{headers:{Authorization:await e()}}},getAccessTokenInjector:()=>(o=!0,u=>{i(u)})}}});function m(){let e=(typeof window<"u"?window.wixEmbedsAPI:void 0)?.getExternalBaseUrl?.();if(!e)return;let t=new URL(e);return t?.pathname&&t.pathname!=="/"?`${t.hostname}${t.pathname}`:t.hostname}var l=({clientSdk:n,applicationId:e})=>({invoke:async({namespace:t,method:o,args:i})=>{if(!n)throw new Error("Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction");return n.invoke({namespace:t,method:o,args:i,applicationId:e,accessToken:"accessToken"})},getAccessToken:()=>{throw new Error("Not implemented")},observeState:()=>({disconnect:()=>{}})});var w=function(n){let e=(typeof $wixContext<"u"?$wixContext.clientSdk:void 0)??n?.clientSdk??(typeof window<"u"?window?.clientSdk:void 0),{applicationId:t}=n||{};if(!t)throw new Error('"createHost" was called without a required field "applicationId"');return{channel:l({clientSdk:e,applicationId:t}),close:()=>{}}};var a=d({createHost:w});var v=n=>{let e=a.host({applicationId:n}),t=a.auth(),o=t.getAccessTokenInjector();return s({auth:t,host:e}).enableContext("module"),{injectGetAccessToken:o}},P=({host:n,auth:e})=>{s({host:n,auth:e}).enableContext("module")};export{v as enableClient,P as enablePanelClient};
1
+ import{a as s}from"./chunk-S46ZF4YM.js";import"./chunk-TONDB6MX.js";import"./chunk-SBZEOPXX.js";function c(){let n=null,e=null;return{promise:new Promise((o,i)=>{n=o,e=i}),resolve:n,reject:e}}var d=({createHost:n})=>({__type:"host",create:e=>({}),host:e=>{let{applicationId:t}=e??{},o=typeof window<"u"?window.wixEmbedsAPI:void 0,i=n(e),r=m();return{...i,apiBaseUrl:r,getMonitoringClient:o?.getMonitoringClientFunction?.(t),essentials:{language:typeof window<"u"?window.commonConfig?.language:void 0,locale:typeof window<"u"?window.commonConfig?.locale:void 0}}},auth:e=>{let t=typeof window<"u"?window.wixEmbedsAPI:void 0;e||(e=t?.getAccessTokenFunction?.());let o=!1,{resolve:i,promise:r}=c();return{getAuthHeaders:async()=>{if(!e&&o&&(e=await r),!e)throw new Error("Failed to resolve auth token");return{headers:{Authorization:await e()}}},getAccessTokenInjector:()=>(o=!0,u=>{i(u)})}}});function m(){let e=(typeof window<"u"?window.wixEmbedsAPI:void 0)?.getExternalBaseUrl?.();if(!e)return;let t=new URL(e);return t?.pathname&&t.pathname!=="/"?`${t.hostname}${t.pathname}`:t.hostname}var l=({clientSdk:n,applicationId:e})=>({invoke:async({namespace:t,method:o,args:i})=>{if(!n)throw new Error("Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction");return n.invoke({namespace:t,method:o,args:i,applicationId:e,accessToken:"accessToken"})},getAccessToken:()=>{throw new Error("Not implemented")},observeState:()=>({disconnect:()=>{}})});var w=function(n){let e=(typeof $wixContext<"u"?$wixContext.clientSdk:void 0)??n?.clientSdk??(typeof window<"u"?window?.clientSdk:void 0),{applicationId:t}=n||{};if(!t)throw new Error('"createHost" was called without a required field "applicationId"');return{channel:l({clientSdk:e,applicationId:t}),close:()=>{}}};var a=d({createHost:w});var v=n=>{let e=a.host({applicationId:n}),t=a.auth(),o=t.getAccessTokenInjector();return s({auth:t,host:e}).enableContext("module"),{injectGetAccessToken:o}},P=({host:n,auth:e})=>{s({host:n,auth:e}).enableContext("module")};export{v as enableClient,P as enablePanelClient};
2
2
  //# sourceMappingURL=site.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/@wix/site/src/utils.ts","../../../node_modules/@wix/site/src/websiteHostModule.ts","../../../node_modules/@wix/site/src/channel.ts","../../../node_modules/@wix/site/src/hostPlatform.ts","../../../node_modules/@wix/site/src/index.ts","../src/site.ts"],"sourcesContent":[null,null,null,null,null,"import { site } from '@wix/site';\nimport { createClient } from '@wix/sdk';\n\nimport type { AuthenticationStrategy, Host } from '@wix/sdk';\n\nexport const enableClient = (applicationId: string) => {\n const host = site.host({ applicationId });\n const auth = site.auth();\n const injectGetAccessToken = auth.getAccessTokenInjector();\n\n const wixClient = createClient({\n auth,\n host,\n });\n wixClient.enableContext('module');\n\n return {\n injectGetAccessToken,\n };\n};\n\nexport const enablePanelClient = ({\n host,\n auth,\n}: {\n host: Host;\n auth?: AuthenticationStrategy;\n}) => {\n const wixClient = createClient({ host, auth });\n wixClient.enableContext('module');\n};\n"],"mappings":"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","names":["withResolvers","resolve","reject","resolveFn","rejectFn","createWebsiteModule","createHost","_host","options","applicationId","wixEmbedsAPI","host","apiBaseUrl","getApiBaseUrl","getAccessTokenFn","injectorCreated","resolveAccessTokenFn","accessTokenFnPromise","withResolvers","_getAccessTokenFn","parsedUrlObject","createWebsiteChannel","clientSdk","applicationId","namespace","method","args","createHost","config","clientSdk","applicationId","createWebsiteChannel","site","createWebsiteModule","createHost","enableClient","applicationId","host","site","auth","injectGetAccessToken","createClient","enablePanelClient"]}
1
+ {"version":3,"sources":["../../../node_modules/@wix/site/src/utils.ts","../../../node_modules/@wix/site/src/websiteHostModule.ts","../../../node_modules/@wix/site/src/channel.ts","../../../node_modules/@wix/site/src/hostPlatform.ts","../../../node_modules/@wix/site/src/index.ts","../src/site.ts"],"sourcesContent":[null,null,null,null,null,"import { site } from '@wix/site';\nimport { createClient } from '@wix/sdk';\n\nimport type { AuthenticationStrategy, Host } from '@wix/sdk';\n\nexport const enableClient = (applicationId: string) => {\n const host = site.host({ applicationId });\n const auth = site.auth();\n const injectGetAccessToken = auth.getAccessTokenInjector();\n\n const wixClient = createClient({\n auth,\n host,\n });\n wixClient.enableContext('module');\n\n return {\n injectGetAccessToken,\n };\n};\n\nexport const enablePanelClient = ({\n host,\n auth,\n}: {\n host: Host;\n auth?: AuthenticationStrategy;\n}) => {\n const wixClient = createClient({ host, auth });\n wixClient.enableContext('module');\n};\n"],"mappings":"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","names":["withResolvers","resolve","reject","resolveFn","rejectFn","createWebsiteModule","createHost","_host","options","applicationId","wixEmbedsAPI","host","apiBaseUrl","getApiBaseUrl","getAccessTokenFn","injectorCreated","resolveAccessTokenFn","accessTokenFnPromise","withResolvers","_getAccessTokenFn","parsedUrlObject","createWebsiteChannel","clientSdk","applicationId","namespace","method","args","createHost","config","clientSdk","applicationId","createWebsiteChannel","site","createWebsiteModule","createHost","enableClient","applicationId","host","site","auth","injectGetAccessToken","createClient","enablePanelClient"]}
@@ -1,2 +1,2 @@
1
- import"./chunk-UTEFPCPF.js";import"./chunk-SBZEOPXX.js";import{wixContext as o}from"@wix/sdk-context";function c(){let n=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(n)return{initWixModules(t,r){return a(()=>n(t,r))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let e=typeof $wixContext<"u"?$wixContext.client:typeof o.client<"u"?o.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof o.elevatedClient<"u"?o.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!e&&!i))return{initWixModules(t,r){if(r){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 a(()=>i.use(t))}if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return a(()=>e.use(t))},fetchWithAuth:(t,r)=>{if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.fetchWithAuth(t,r)},getAuth(){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.auth},async graphql(t,r,s){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.graphql(t,r,s)}}}function a(n){let e=globalThis.__wix_context__,i={client:o.client,elevatedClient:o.elevatedClient},t;globalThis.__wix_context__=void 0,o.client=void 0,o.elevatedClient=void 0,typeof $wixContext<"u"&&(t={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return n()}finally{globalThis.__wix_context__=e,o.client=i.client,o.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=t.client,$wixContext.elevatedClient=t.elevatedClient)}}function u(n,e){return(...i)=>{let t=c();return t?t.initWixModules(n,e).apply(void 0,i):n.apply(void 0,i)}}function x(n,e=!1){return u(n,e)}var d=["wix.com","editorx.com"];var E=new RegExp(`\\.(${d.join("|")})$`),f=["42.wixprod.net","uw2-edt-1.wixprod.net"],p="dev.wix-code.com";var C=new RegExp(`\\.(${f.join("|")})$`),M=new RegExp(`.*\\.${p}$`);var v=x(n=>async({baseURL:e,filename:i,method:t,args:r})=>{let l=await(await n.fetchWithAuth(`${e}/_webMethods/${i}/${t}.ajax`,{body:JSON.stringify(r),method:"POST"})).json();if(l.exception===!0)throw l.result;return l.result});export{v as callWebMethod};
1
+ import"./chunk-KXCY2KWZ.js";import"./chunk-SBZEOPXX.js";import{wixContext as o}from"@wix/sdk-context";function c(){let n=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(n)return{initWixModules(t,r){return a(()=>n(t,r))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let e=typeof $wixContext<"u"?$wixContext.client:typeof o.client<"u"?o.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof o.elevatedClient<"u"?o.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!e&&!i))return{initWixModules(t,r){if(r){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 a(()=>i.use(t))}if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return a(()=>e.use(t))},fetchWithAuth:(t,r)=>{if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.fetchWithAuth(t,r)},getAuth(){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.auth},async graphql(t,r,s){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.graphql(t,r,s)}}}function a(n){let e=globalThis.__wix_context__,i={client:o.client,elevatedClient:o.elevatedClient},t;globalThis.__wix_context__=void 0,o.client=void 0,o.elevatedClient=void 0,typeof $wixContext<"u"&&(t={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return n()}finally{globalThis.__wix_context__=e,o.client=i.client,o.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=t.client,$wixContext.elevatedClient=t.elevatedClient)}}function u(n,e){return(...i)=>{let t=c();return t?t.initWixModules(n,e).apply(void 0,i):n.apply(void 0,i)}}function x(n,e=!1){return u(n,e)}var d=["wix.com","editorx.com"];var E=new RegExp(`\\.(${d.join("|")})$`),f=["42.wixprod.net","uw2-edt-1.wixprod.net"],p="dev.wix-code.com";var C=new RegExp(`\\.(${f.join("|")})$`),M=new RegExp(`.*\\.${p}$`);var v=x(n=>async({baseURL:e,filename:i,method:t,args:r})=>{let l=await(await n.fetchWithAuth(`${e}/_webMethods/${i}/${t}.ajax`,{body:JSON.stringify(r),method:"POST"})).json();if(l.exception===!0)throw l.result;return l.result});export{v as callWebMethod};
2
2
  //# sourceMappingURL=web-methods.js.map
@@ -3,24 +3,24 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  executeCommand,
5
5
  log
6
- } from "./chunk-CHCM5GIW.js";
6
+ } from "./chunk-BMVS42XS.js";
7
7
  import {
8
8
  PreviewCommand
9
- } from "./chunk-5ADLOYER.js";
9
+ } from "./chunk-YO7FIWQY.js";
10
10
  import "./chunk-QBRIDBYB.js";
11
- import "./chunk-5LEKQK4K.js";
12
- import "./chunk-BUFZB2WZ.js";
13
- import "./chunk-D5PXGLRN.js";
14
- import "./chunk-KNEYNMAC.js";
11
+ import "./chunk-V5F6GGW4.js";
12
+ import "./chunk-LUVRH4ML.js";
13
+ import "./chunk-JK7EYVDW.js";
14
+ import "./chunk-KF4Y7AR3.js";
15
15
  import "./chunk-GWE3BRHX.js";
16
- import "./chunk-RJ5AE5PA.js";
17
- import "./chunk-3FHYQY34.js";
18
- import "./chunk-NBX5ZDG4.js";
16
+ import "./chunk-7DXNLVMY.js";
17
+ import "./chunk-QK72TUIO.js";
18
+ import "./chunk-C42KLSNW.js";
19
19
  import {
20
20
  CliError,
21
21
  CliErrorCode,
22
22
  require_react
23
- } from "./chunk-452BSZIG.js";
23
+ } from "./chunk-63VFX6QK.js";
24
24
  import {
25
25
  __toESM,
26
26
  init_esm_shims
@@ -50,4 +50,4 @@ async function nonInteractivePreview(services, model, options) {
50
50
  export {
51
51
  nonInteractivePreview
52
52
  };
53
- //# sourceMappingURL=preview-EFKSIVQM.js.map
53
+ //# sourceMappingURL=preview-KPMG263Y.js.map
@@ -3,27 +3,27 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  executeCommand,
5
5
  log
6
- } from "./chunk-CHCM5GIW.js";
6
+ } from "./chunk-BMVS42XS.js";
7
7
  import {
8
8
  ReleaseCommand
9
- } from "./chunk-4EN3XULI.js";
10
- import "./chunk-5ADLOYER.js";
9
+ } from "./chunk-QSLY47CE.js";
10
+ import "./chunk-YO7FIWQY.js";
11
11
  import "./chunk-QBRIDBYB.js";
12
- import "./chunk-5LEKQK4K.js";
13
- import "./chunk-BUFZB2WZ.js";
14
- import "./chunk-M2DNPZJ6.js";
15
- import "./chunk-D5PXGLRN.js";
16
- import "./chunk-KNEYNMAC.js";
12
+ import "./chunk-V5F6GGW4.js";
13
+ import "./chunk-LUVRH4ML.js";
14
+ import "./chunk-ZQAW4UYV.js";
15
+ import "./chunk-JK7EYVDW.js";
16
+ import "./chunk-KF4Y7AR3.js";
17
17
  import "./chunk-GWE3BRHX.js";
18
- import "./chunk-RJ5AE5PA.js";
19
- import "./chunk-3FHYQY34.js";
20
- import "./chunk-NBX5ZDG4.js";
18
+ import "./chunk-7DXNLVMY.js";
19
+ import "./chunk-QK72TUIO.js";
20
+ import "./chunk-C42KLSNW.js";
21
21
  import {
22
22
  CliError,
23
23
  CliErrorCode,
24
24
  require_react,
25
25
  toJsonString
26
- } from "./chunk-452BSZIG.js";
26
+ } from "./chunk-63VFX6QK.js";
27
27
  import {
28
28
  __toESM,
29
29
  init_esm_shims
@@ -55,4 +55,4 @@ async function nonInteractiveRelease(services, model, releaseProps) {
55
55
  export {
56
56
  nonInteractiveRelease
57
57
  };
58
- //# sourceMappingURL=release-ID5VU6AQ.js.map
58
+ //# sourceMappingURL=release-EOP3M5P7.js.map
@@ -3,13 +3,13 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  renderCommand,
5
5
  runCommand
6
- } from "./chunk-JNQZZJEG.js";
6
+ } from "./chunk-GTSFGE5V.js";
7
7
  import "./chunk-QBRIDBYB.js";
8
- import "./chunk-RJ5AE5PA.js";
9
- import "./chunk-452BSZIG.js";
8
+ import "./chunk-7DXNLVMY.js";
9
+ import "./chunk-63VFX6QK.js";
10
10
  import "./chunk-4EFJZ3GQ.js";
11
11
  export {
12
12
  renderCommand,
13
13
  runCommand
14
14
  };
15
- //# sourceMappingURL=render-command-WGIVK7NK.js.map
15
+ //# sourceMappingURL=render-command-YNOAIR7C.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wix/cli-app",
3
3
  "description": "CLI tool for Wix apps",
4
- "version": "1.1.240",
4
+ "version": "1.1.242",
5
5
  "author": "Amit Dahan",
6
6
  "dependencies": {
7
7
  "esbuild": "^0.25.0",
@@ -155,5 +155,5 @@
155
155
  ]
156
156
  }
157
157
  },
158
- "falconPackageHash": "692709b2af75584a92966df33faeaff25ed3c1ccf971fa4b28ca0c69"
158
+ "falconPackageHash": "f861e0e8cb85ad3643d0a46c75f0abf4f4e353db8263220583874ca4"
159
159
  }
@@ -1,19 +0,0 @@
1
- import { createRequire as _createRequire } from 'node:module';
2
- const require = _createRequire(import.meta.url);
3
- import {
4
- PreviewCommand
5
- } from "./chunk-5ADLOYER.js";
6
- import "./chunk-5LEKQK4K.js";
7
- import "./chunk-BUFZB2WZ.js";
8
- import "./chunk-D5PXGLRN.js";
9
- import "./chunk-KNEYNMAC.js";
10
- import "./chunk-GWE3BRHX.js";
11
- import "./chunk-RJ5AE5PA.js";
12
- import "./chunk-3FHYQY34.js";
13
- import "./chunk-NBX5ZDG4.js";
14
- import "./chunk-452BSZIG.js";
15
- import "./chunk-4EFJZ3GQ.js";
16
- export {
17
- PreviewCommand
18
- };
19
- //# sourceMappingURL=PreviewCommand-I2WAW3M3.js.map
@@ -1,23 +0,0 @@
1
- import { createRequire as _createRequire } from 'node:module';
2
- const require = _createRequire(import.meta.url);
3
- import {
4
- ReleaseCommand,
5
- ReleaseVersionType
6
- } from "./chunk-4EN3XULI.js";
7
- import "./chunk-5ADLOYER.js";
8
- import "./chunk-5LEKQK4K.js";
9
- import "./chunk-BUFZB2WZ.js";
10
- import "./chunk-M2DNPZJ6.js";
11
- import "./chunk-D5PXGLRN.js";
12
- import "./chunk-KNEYNMAC.js";
13
- import "./chunk-GWE3BRHX.js";
14
- import "./chunk-RJ5AE5PA.js";
15
- import "./chunk-3FHYQY34.js";
16
- import "./chunk-NBX5ZDG4.js";
17
- import "./chunk-452BSZIG.js";
18
- import "./chunk-4EFJZ3GQ.js";
19
- export {
20
- ReleaseCommand,
21
- ReleaseVersionType
22
- };
23
- //# sourceMappingURL=ReleaseCommand-PBSE5PLP.js.map
@@ -1,2 +0,0 @@
1
- import{a as I,b as O}from"./chunk-TONDB6MX.js";import{a as C,b as j,d as q}from"./chunk-UTEFPCPF.js";import{f as y}from"./chunk-SBZEOPXX.js";q();import{wixContext as de}from"@wix/sdk-context";var ue=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}`)}},W=e=>t=>async r=>{let n,s=o=>{if(n=e(r)(o),n.url===void 0)throw new Error("Url was not successfully created for this request, please reach out to support channels for assistance.");let{method:a,url:i,params:c}=n;return{...n,method:ue(a),url:i,data:n.data,params:c}};try{let o=await t.request(s);if(n===void 0)throw new Error("Request options were not created for this request, please reach out to support channels for assistance.");let a=Array.isArray(n.transformResponse)?n.transformResponse:[n.transformResponse],i=o.data;return a.forEach(c=>{c&&(i=c(o.data,o.headers))}),i}catch(o){throw typeof o=="object"&&o!==null&&"response"in o&&typeof o.response=="object"&&o.response!==null&&"data"in o.response?o.response.data:o}},B=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var K="__metadata",R="www.wixapis.com",J="edge.wixapis.com";var S=class extends Error{constructor(r,n){super(r);y(this,"message");y(this,"response");this.message=r,this.response=n}async details(){let r=await this.response.json();return le(this.response.status,r?.message,r?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:r})}},le=(e,t,r,n)=>({details:{...!r?.validationError&&{applicationError:{description:t,code:e,data:n}},...r},message:t,requestId:n?.requestId});var k=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},G=e=>e&&typeof e=="object"&&!Array.isArray(e);var X=e=>e.__type==="host";function Y(e,t){return e.create(t)}var pe="x-wix-bi-gateway";function z(e,t,r){return{[pe]:fe({environment:`js-sdk${r?`-${r}`:""}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function fe(e){return Object.entries(e).filter(([t,r])=>!!r).map(([t,r])=>`${t}=${r}`).join(",")}function v(e){return Te(e).map(t=>t.toLocaleUpperCase()).join("_")}var he=/([\p{Ll}\d])(\p{Lu})/gu,me=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,Q="$1\0$2",Ee=/[^\p{L}\d]+/giu;function Te(e){let t=e.trim();t=t.replace(he,Q).replace(me,Q),t=t.replace(Ee,"\0");let r=0,n=t.length;for(;t.charAt(r)==="\0";)r++;if(r===n)return[];for(;t.charAt(n-1)==="\0";)n--;return t.slice(r,n).split(/\0/g)}var ye=e=>"validationError"in(e.response?.data?.details??{}),_e=e=>"applicationError"in(e.response?.data?.details??{}),ge=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function Z(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},r=[]){if(typeof e!="object"||e===null)throw e;if(ye(e))return Ae(e,t,r);if(_e(e))return Pe(e);if(ge(e)){let n=e.response?.status,s=e.response?.statusText??"UNKNOWN",o=e.response?.data?.message??s,a={applicationError:{description:s,code:v(s),data:{}},requestId:e.requestId};return L(e,{message:JSON.stringify({message:o,details:a},null,2),extraProperties:{details:a,status:n}})}return we(e)}var Ae=(e,t,r)=>{let n=e.response?.data,s=e.requestId,{fieldViolations:o}=n.details.validationError,a=xe(t,o,r)?.sort((u,p)=>u.field<p.field?-1:1),i=`INVALID_ARGUMENT: ${a?.map(({field:u,description:p})=>`"${u}" ${p}`)?.join(", ")}`,c={validationError:{fieldViolations:a},requestId:s};return L(e,{message:JSON.stringify({message:i,details:c},null,2),extraProperties:{details:c,status:e.response?.status,requestId:s}})},L=(e,{message:t,extraProperties:r})=>Object.assign(e,{...r,message:t}),Pe=e=>{let t=e.response?.status,r=e.response?.statusText??"UNKNOWN",n=e.response?.data?.message??r,s=e.response?.data?.details?.applicationError?.description??r,o=e.response?.data?.details?.applicationError?.code??v(r),a=e.response?.data?.details?.applicationError?.data??{},i=n===s?n:`${n}: ${s}`,c={applicationError:{description:s,code:o,data:a},requestId:e.requestId};return L(e,{message:JSON.stringify({message:i,details:c},null,2),extraProperties:{details:c,status:t,requestId:e.requestId}})},we=e=>{let t=e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`;return L(e,{message:t,extraProperties:{requestId:e.requestId,status:e.response?.status,code:v(e.response?.statusText??"UNKNOWN"),...!e.response&&{runtimeError:e}}})},xe=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:r},n,s)=>{let o={...e,...t},a=Object.keys(o);return n?.filter(i=>!n.some(u=>u.field.length>i.field.length&&u.field.startsWith(i.field)&&a.includes(u.field))).map(i=>{let c=t[i.field];if(c)return{...i,field:V(c,s)};let u=a?.sort((p,E)=>E.length-p.length)?.find(p=>i.field.startsWith(p));if(u){let p=o[u];if(p)return{...i,field:i.field.replace(u,V(p,s))}}return r?{...i,field:`${s[0]}.${i.field}`}:i})},V=(e,t)=>{let r=Re(e);return r!==null&&typeof r<"u"?e.replace(`$[${r}]`,t[r]):e},Re=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function ee(e,t,r,n,s,o,a,i,c,u,p){return I(()=>e({request:async E=>{let T=E({host:i?.HTTPHost||R}),l=T;l.method==="GET"&&l.fallback?.length&&(l.params?.toString().length??0)>4e3&&(l=T.fallback[0]);let P=i?.HTTPHost??R,H=`https://${u?J:P}${l.url}`;l.params&&l.params.toString()&&(H+=`?${l.params.toString()}`);try{let d=z(T,t,c),f={method:l.method,...l.data&&{body:JSON.stringify(l.data)},headers:{...d}},h=await r(H,f);if(h.status!==200){let g=null;try{g=await h.json()}catch{}let m=be(h.status,g?.message??h.statusText,g?.details,{requestId:h.headers.get("X-Wix-Request-Id"),details:g}),x=Z(m);throw n?.handleError(x,{requestOptions:{url:l.url,method:l.method,entityFqdn:T.entityFqdn,methodFqn:T.methodFqn}}),m}let _=await h.json();return{data:l.migrationOptions?.optInTransformResponse&&l.transformResponse?Array.isArray(l.transformResponse)?l.transformResponse[0](_):l.transformResponse(_):_,headers:h.headers,status:h.status,statusText:h.statusText}}catch(d){throw d.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),d}},fetchWithAuth:r,wixAPIFetch:s,getActiveToken:o,getAuthHeaders:a},{validateRequestSchema:p}))}var D=class extends Error{constructor(r){super();y(this,"response");y(this,"requestId");this.response=r.response,this.requestId=r.requestId}},be=(e,t,r,n)=>new D({response:{data:{details:{...!r?.validationError&&{applicationError:{description:t,code:e,data:n}},...r},message:t},status:e},requestId:n?.requestId});q();var Ie=".";function te(e,t,r){if(e==null)throw new Error("Cannot set value on null or undefined");let n=N(t),s=e;for(let o=0;o<n.length;o++){let a=n[o];if(o===n.length-1){s[a]=r;break}let i=n[o+1];!(a in s)||s[a]==null?s[a]=typeof i=="number"?[]:{}:(typeof s[a]!="object"||s[a]===null)&&(s[a]=typeof i=="number"?[]:{}),s=s[a]}return e}function N(e){return Array.isArray(e)?e:e.split(Ie).map(t=>Se(t)?Number(t):t)}function Se(e){return/^\d+$/.test(e)}function se(e){let t={};for(let[r,n]of Object.entries(e)){if(ve(r))continue;let s=N(r);te(t,s,n)}return t}function ve(e){return e==="__proto__"||e==="constructor"||e==="prototype"}var U=class{constructor(t){y(this,"BRACKET_PATTERN",/\[(\d+)\]/g);y(this,"NUMERIC_PATTERN",/^\d+$/);y(this,"ESCAPED_DOT_PATTERN",/\\\./g);y(this,"ESCAPED_LEFT_BRACKET_PATTERN",/\\\[/g);y(this,"ESCAPED_RIGHT_BRACKET_PATTERN",/\\\]/g);y(this,"SPLIT_PATTERN",/\.|\[(\d+)\]/g);y(this,"DOT_BEFORE_BRACKET_PATTERN",/\.\[/g);y(this,"ESCAPED_DOT_PLACEHOLDER","__DOT__");y(this,"ESCAPED_RIGHT_BRACKET_PLACEHOLDER","__RB__");y(this,"ESCAPED_LEFT_BRACKET_PLACEHOLDER","__LB__");y(this,"modifiedFields");y(this,"cleanedModifiedFields");this.modifiedFields=t}replaceEscapedCharacters(t){return t.replace(this.ESCAPED_DOT_PATTERN,this.ESCAPED_DOT_PLACEHOLDER).replace(this.ESCAPED_LEFT_BRACKET_PATTERN,this.ESCAPED_LEFT_BRACKET_PLACEHOLDER).replace(this.ESCAPED_RIGHT_BRACKET_PATTERN,this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER)}restoreEscapedCharacters(t){return t.replace(this.ESCAPED_DOT_PLACEHOLDER,"\\.").replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER,"\\]").replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER,"\\[")}unflatten(){return this.cleanedModifiedFields=Object.fromEntries(Object.entries(this.modifiedFields).map(([t,r])=>[this.replaceEscapedCharacters(this.bracketToDotNotation(t)),r])),se(this.cleanedModifiedFields)}flatten(t){let r={};for(let n of Object.keys(this.cleanedModifiedFields)){let s=this.splitPath(n),o=this.navigatePath(t,s);r={...r,...o}}return Object.fromEntries(Object.entries(r).map(([n,s])=>[this.restoreEscapedCharacters(n),s]))}splitPath(t){let r=[],n=0,s=Array.from(t.matchAll(this.SPLIT_PATTERN));for(let o of s)o.index>n&&r.push(t.substring(n,o.index)),o[1]&&r.push(o[1]),n=o.index+o[0].length;return n<t.length&&r.push(t.substring(n)),r}navigatePath(t,r){let n=t,s=[],o=c=>{if(!Array.isArray(n))throw new Error(`Expected array at path ${this.buildPathString(s)}, but got ${typeof n}`);s.push(`[${c}]`),n=n[parseInt(c,10)]},a=(c,u)=>{let p=c in O?O[c]:void 0;if(p&&p in u){s.push(p),n=u[p];return}let E=Ce(c);if(E&&E in u){s.push(E),n=u[E];return}throw new Error(`Cannot find key '${c}' or its transformations at path ${this.buildPathString(s)}`)},i=(c,u)=>{s.push(c),n=u[c]};for(let c of r){if(this.NUMERIC_PATTERN.test(c)){o(c);continue}if(n===null||typeof n!="object")throw new Error(`Cannot access property '${c}' on ${typeof n} at path ${this.buildPathString(s)}`);let u=n;if(c in n){i(c,u);continue}a(c,u)}return{[this.buildPathString(s)]:n}}buildPathString(t){return t.join(".").replace(this.DOT_BEFORE_BRACKET_PATTERN,"[")}bracketToDotNotation(t){return t.replace(this.BRACKET_PATTERN,(r,n,s)=>s>0&&t[s-1]==="\\"?r:"."+n)}};function re(e,t){let r=e?.modifiedFields;if(!r)return null;let n=Le(r);if(!n)return null;let{unflattenedModifiedFields:s,modifiedFieldsManipulator:o}=n;e={...e,modifiedFields:s};let a=t(e),i=a?.modifiedFields;if(!i)return null;let c=He(i,o);return c!==null?(a.modifiedFields=c,a):null}function Le(e){if(typeof e=="object"&&e!==null&&!Array.isArray(e))try{let t=new U(e);return{unflattenedModifiedFields:t.unflatten(),modifiedFieldsManipulator:t}}catch{return null}return null}function He(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e))try{return t.flatten(e)}catch{return null}return null}function Ce(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^./,t=>t.toLowerCase())}function b(){return{emit(e,...t){for(let r=0,n=this.events[e]||[],s=n.length;r<s;r++)n[r](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(r=>t!==r)}}}}var oe=e=>e.__type==="event-definition";function ne(e,t,r,n){let s;if(e.isDomainEvent){let c=r,{deletedEvent:u,actionEvent:p,createdEvent:E,updatedEvent:T,...l}=c,P={...n,...l};u?u?.deletedEntity?s={entity:u?.deletedEntity,metadata:P}:s={metadata:P}:p?s={data:p.body,metadata:P}:T?s={entity:T.currentEntity,metadata:P,...T.modifiedFields?{modifiedFields:T.modifiedFields}:{}}:s={entity:E?.entity,metadata:P}}else s={data:r,metadata:n};let o=e.transformations??(c=>c),a=s,i=s;if(i.modifiedFields){let c=i.modifiedFields;if(typeof c=="object"&&c!==null&&!Array.isArray(c)){a=structuredClone(s);let u=re(i,o);if(u)return t(u)}}return t(o(a))}function ae(e){let t=new Map,r=b(),n={...r,getRegisteredEvents:()=>t,async process(s,o={expectedEvents:[]}){let{eventType:a,identity:i,instanceId:c,payload:u,accountInfo:p}=await this.parseJWT(s),E=[...o.expectedEvents,...Array.from(t.keys()).map(l=>({type:l}))];if(E.length>0&&!E.some(({type:l})=>l===a))throw new Error(`Unexpected event type: ${a}. Expected one of: ${E.map(l=>l.type).join(", ")}`);let T=t.get(a)??[];return await Promise.all(T.map(({eventDefinition:l,handler:P})=>ne(l,P,u,{instanceId:c,identity:i,accountInfo:p}))),{instanceId:c,eventType:a,payload:u,identity:i,accountInfo:p}},async processRequest(s,o){let a=await s.text();return this.process(a,o)},async parseJWT(s){let o=e();if(!o.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:a,valid:i}=await o.decodeJWT(s);if(!i)throw new Error("JWT is not valid");if(typeof a.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof a.data}`);let c=JSON.parse(a.data),u=c.eventType,p=c.accountInfo,E=c.instanceId,T=c.identity?JSON.parse(c.identity):void 0,l=JSON.parse(c.data);return{instanceId:E,eventType:u,payload:l,identity:T,accountInfo:p}},async parseRequest(s){let o=await s.text();return this.parseJWT(o)},async executeHandlers(s){let o=Array.from(t.keys()).map(i=>({type:i}));if(o.length>0&&!o.some(({type:i})=>i===s.eventType))throw new Error(`Unexpected event type: ${s.eventType}. Expected one of: ${o.map(i=>i.type).join(", ")}`);let a=t.get(s.eventType)??[];await Promise.all(a.map(({eventDefinition:i,handler:c})=>ne(i,c,s.payload,{instanceId:s.instanceId,identity:s.identity})))},apps:{AppInstalled:C("AppInstalled")(),AppRemoved:C("AppRemoved")()}};return{initModule(s){return o=>{let a=t.get(s.type)??[];a.push({eventDefinition:s,handler:o}),t.set(s.type,a),r.emit("registered",s)}},client:n}}var ie=e=>e.__type==="service-plugin-definition";function ce(e){let t=new Map,r=b(),n={...r,getRegisteredServicePlugins:()=>t,async parseJWT(s){let o=e();if(!o.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:a,valid:i}=await o.decodeJWT(s,!0);if(!i)throw new Error("JWT is not valid");if(typeof a.data!="object"||a.data===null||!("metadata"in a.data)||typeof a.data.metadata!="object"||a.data.metadata===null||!("appExtensionType"in a.data.metadata)||typeof a.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return a.data},async process(s){let o=await this.parseJWT(s.body);return this.executeHandler(o,s.url)},async parseRequest(s){let o=await s.text();return this.parseJWT(o)},async processRequest(s){let o=s.url,a=await s.text();try{let i=await this.process({url:o,body:a});return Response.json(i)}catch(i){if(i.errorType==="SPI"&&i.applicationCode&&i.httpCode)return Response.json({applicationError:{code:i.applicationCode,data:i.data}},{status:i.httpCode});throw i}},async executeHandler(s,o){let a=s.metadata.appExtensionType.toLowerCase(),i=t.get(a)??[];if(i.length===0)throw new Error(`No service plugin implementations found for component type ${a}`);if(i.length>1)throw new Error(`Multiple service plugin implementations found for component type ${a}. This is currently not supported`);let{implementation:c,servicePluginDefinition:u}=i[0],p=u.methods.find(T=>o.endsWith(T.primaryHttpMappingPath));if(!p)throw new Error("Unexpect request: request url did not match any method: "+o);let E=c[p.name];if(!E)throw new Error(`Got request for service plugin method ${p.name} but no implementation was provided. Available methods: ${Object.keys(c).join(", ")}`);return p.transformations.toREST(await E(p.transformations.fromREST(s)))}};return{initModule(s){return o=>{let a=t.get(s.componentType.toLowerCase())??[];a.push({servicePluginDefinition:s,implementation:o}),t.set(s.componentType.toLowerCase(),a),r.emit("registered",s)}},client:n}}var w="X-Wix-Consistent";function Pt(e){let t=e.headers||{Authorization:""},r={getAuthHeaders:d=>Promise.resolve({headers:{}})},n=e.auth,s=typeof n=="function"?n:()=>n??r,o=()=>s().getAuthHeaders(e.host),a=()=>e.fetch??fetch,i=async(d,f)=>{let h=a(),_=await o(),A={...f?.headers??{},..._.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 h(d,{...f,headers:A});g?.handleError(m,{requestOptions:{url:d.toString(),method:f?.method}});let x=M(m);return x&&(t[w]=x),m}else{for(let[$,F]of Object.entries(A))typeof F=="string"&&d.headers.set($,F);let m=await h(d,f);g?.handleError(m,{requestOptions:{url:d.url,method:f?.method}});let x=M(m);return x&&(t[w]=x),m}}catch(m){throw g?.handleError(m,{requestOptions:{url:typeof d=="string"||d instanceof URL?d.toString():d.url,method:f?.method}}),m}},{client:c,initModule:u}=ce(s),{client:p,initModule:E}=ae(s),T=async(d,f)=>{let h=a(),_=await o(),A=k(f),g=await h(d,{...f,headers:{...A,...t,..._?.headers,...f?.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}}}),m=M(g);return m&&(t[w]=m),g},l=(d,f)=>{if(oe(d))return E(d);if(ie(d))return u(d);if(X(d)&&e.host)return Y(d,e.host);if(typeof d=="function"){if("__type"in d&&d.__type===j)return d;let h=e.host?.apiBaseUrl??R,_=e.useCDN===void 0?s().shouldUseCDN:e.useCDN;return ee(I(()=>B(d))?W(d):d,f??{},T,e.host?.getErrorHandler?.(),(A,g)=>{let m=new URL(A,`https://${h}`);return m.host=h,m.protocol="https",T(m.toString(),g)},s().getActiveToken,async()=>o(),{HTTPHost:h},e.host?.name,_,e.validateRequestSchema)}else return G(d)?Object.fromEntries(Object.entries(d).map(([h,_])=>[h,l(_,d[K])])):d},P=d=>{for(let f in d)t[f]=d[f]};return{...e.modules?l(e.modules):{},get auth(){let d=s(),f=d.getAuthHeaders;return d.getAuthHeaders=f.bind(void 0,e.host),d},setHeaders:P,use:l,enableContext(d,f={elevated:!1}){d==="global"?globalThis.__wix_context__!=null?f.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:f.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:f.elevated?de.elevatedClient=this:de.client=this},fetch:(d,f)=>{let h=e.host?.apiBaseUrl??R,_=new URL(d,`https://${h}`);return _.host=h,_.protocol="https",T(_.toString(),f)},fetchWithAuth:i,async graphql(d,f,h={apiVersion:"alpha"}){let _=e?.host?.apiBaseUrl??R,A=await T(`https://${_}/graphql/${h.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:d,variables:f})});if(A.status!==200)throw new S(`GraphQL request failed with status ${A.status}`,A);let{data:g,errors:m}=await A.json();return{data:g??{},errors:m}},webhooks:p,servicePlugins:c}}function M(e){return e.headers?.get(w)??e.headers?.get(w.toLowerCase())}export{Pt as a};
2
- //# sourceMappingURL=chunk-2QLMI2GU.js.map