@wix/cli-app 1.1.55 → 1.1.57

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 (129) hide show
  1. package/build/CreateVersionCommand-AIXBHCYB.js +269 -0
  2. package/build/{CreateVersionCommand-XTZT5DED.js.map → CreateVersionCommand-AIXBHCYB.js.map} +1 -1
  3. package/build/DevCommand-TOFPM7DZ.js +1168 -0
  4. package/build/{DevCommand-Q5XLAGMG.js.map → DevCommand-TOFPM7DZ.js.map} +1 -1
  5. package/build/GenerateCommand-HB46FNMR.js +12392 -0
  6. package/build/GenerateCommand-HB46FNMR.js.map +1 -0
  7. package/build/LogsCommand-Q2HRBR6G.js +284 -0
  8. package/build/{LogsCommand-XJHE75L2.js.map → LogsCommand-Q2HRBR6G.js.map} +1 -1
  9. package/build/PreviewCommand-XBSTVGWT.js +23 -0
  10. package/build/ServeCommand-ZEXPLXTI.js +165 -0
  11. package/build/{ServeCommand-CPZOI7DC.js.map → ServeCommand-ZEXPLXTI.js.map} +1 -1
  12. package/build/build-3AJU7FWE.js +97 -0
  13. package/build/{build-3RXHADZD.js.map → build-3AJU7FWE.js.map} +1 -1
  14. package/build/build-EC7LZLAY.js +3596 -0
  15. package/build/{build-D3GVJS75.js.map → build-EC7LZLAY.js.map} +1 -1
  16. package/build/chunk-2BYVOUAH.js +46 -0
  17. package/build/{chunk-4BHNJVL2.js.map → chunk-2BYVOUAH.js.map} +1 -1
  18. package/build/chunk-2CUJME55.js +897 -0
  19. package/build/{chunk-7VOKCPZP.js.map → chunk-2CUJME55.js.map} +1 -1
  20. package/build/chunk-2GIVAXZY.js +32 -0
  21. package/build/{chunk-QOUZ6J7N.js.map → chunk-2GIVAXZY.js.map} +1 -1
  22. package/build/chunk-4JP2XRKG.js +39101 -0
  23. package/build/chunk-4JP2XRKG.js.map +1 -0
  24. package/build/chunk-6A37LXDJ.js +51 -0
  25. package/build/{chunk-HDXLQ34N.js.map → chunk-6A37LXDJ.js.map} +1 -1
  26. package/build/chunk-77XREOLU.js +183 -0
  27. package/build/{chunk-X4BLMM2K.js.map → chunk-77XREOLU.js.map} +1 -1
  28. package/build/chunk-BMVZ7QCF.js +104 -0
  29. package/build/{chunk-FKBCPMYK.js.map → chunk-BMVZ7QCF.js.map} +1 -1
  30. package/build/chunk-F2XRLYHS.js +635 -0
  31. package/build/{chunk-GWU77DPO.js.map → chunk-F2XRLYHS.js.map} +1 -1
  32. package/build/chunk-FH6U3Y37.js +19 -0
  33. package/build/chunk-FH6U3Y37.js.map +1 -0
  34. package/build/chunk-FOKCY5BR.js +38035 -0
  35. package/build/{chunk-N5D4TFKX.js.map → chunk-FOKCY5BR.js.map} +1 -1
  36. package/build/chunk-FTNALO4B.js +45 -0
  37. package/build/{chunk-B4SDDVMV.js.map → chunk-FTNALO4B.js.map} +1 -1
  38. package/build/chunk-HL4K6RV3.js +195 -0
  39. package/build/{chunk-C4SXZWXS.js.map → chunk-HL4K6RV3.js.map} +1 -1
  40. package/build/chunk-IJVKSYIY.js +222 -0
  41. package/build/chunk-IJVKSYIY.js.map +1 -0
  42. package/build/chunk-JZVNLHD3.js +151 -0
  43. package/build/{chunk-6HSUK2A2.js.map → chunk-JZVNLHD3.js.map} +1 -1
  44. package/build/chunk-MGPAOFO3.js +29231 -0
  45. package/build/chunk-MGPAOFO3.js.map +1 -0
  46. package/build/chunk-N6O7J2WO.js +1323 -0
  47. package/build/{chunk-LJEYXY4V.js.map → chunk-N6O7J2WO.js.map} +1 -1
  48. package/build/chunk-PYIAC2GK.js +66 -0
  49. package/build/{chunk-V4TR6DCM.js.map → chunk-PYIAC2GK.js.map} +1 -1
  50. package/build/chunk-QG2TLAMS.js +96 -0
  51. package/build/{chunk-K2A77MMN.js.map → chunk-QG2TLAMS.js.map} +1 -1
  52. package/build/chunk-QZOQAFHK.js +2197 -0
  53. package/build/chunk-QZOQAFHK.js.map +1 -0
  54. package/build/chunk-XQ2F7ZVH.js +23 -0
  55. package/build/{chunk-2FB5F5QF.js.map → chunk-XQ2F7ZVH.js.map} +1 -1
  56. package/build/chunk-Y6SGP7TM.js +29 -0
  57. package/build/{chunk-KG7BHEJG.js.map → chunk-Y6SGP7TM.js.map} +1 -1
  58. package/build/cloudflare-runtime/entry.js +1 -1
  59. package/build/cloudflare-runtime/getRegisteredExtensions.js +1 -1
  60. package/build/devtools-YPSDP32D.js +3702 -0
  61. package/build/{devtools-4JFNYU2B.js.map → devtools-YPSDP32D.js.map} +1 -1
  62. package/build/esm-YQVNLOAI.js +22083 -0
  63. package/build/{esm-HBMYQBEO.js.map → esm-YQVNLOAI.js.map} +1 -1
  64. package/build/index.js +3252 -21
  65. package/build/index.js.map +1 -1
  66. package/build/platform-sdk/chunk-DGX4CFXG.js +2 -0
  67. package/build/platform-sdk/chunk-DGX4CFXG.js.map +1 -0
  68. package/build/platform-sdk/chunk-TN6HYRXL.js +2 -0
  69. package/build/platform-sdk/chunk-TN6HYRXL.js.map +1 -0
  70. package/build/platform-sdk/dashboard.js +1 -1
  71. package/build/platform-sdk/dashboard.js.map +1 -1
  72. package/build/platform-sdk/editor.js +5 -5
  73. package/build/platform-sdk/editor.js.map +1 -1
  74. package/build/platform-sdk/site.js +1 -1
  75. package/build/preview-C7XYH7BB.js +138 -0
  76. package/build/{preview-TM7JAWFS.js.map → preview-C7XYH7BB.js.map} +1 -1
  77. package/build/render-command-BMSK4YLL.js +117 -0
  78. package/build/{render-command-QEQ3L7OX.js.map → render-command-BMSK4YLL.js.map} +1 -1
  79. package/build/types.impl-CD4WWRUK.js +10 -0
  80. package/package.json +10 -5
  81. package/templates/custom-element/dependencies.json +1 -1
  82. package/templates/dashboard-modal/dependencies.json +1 -1
  83. package/templates/site-plugin/dependencies.json +1 -1
  84. package/build/CreateVersionCommand-XTZT5DED.js +0 -4
  85. package/build/DevCommand-Q5XLAGMG.js +0 -4
  86. package/build/GenerateCommand-HNFICZJA.js +0 -128
  87. package/build/GenerateCommand-HNFICZJA.js.map +0 -1
  88. package/build/LogsCommand-XJHE75L2.js +0 -4
  89. package/build/PreviewCommand-JKPFMGWV.js +0 -4
  90. package/build/ServeCommand-CPZOI7DC.js +0 -4
  91. package/build/build-3RXHADZD.js +0 -4
  92. package/build/build-D3GVJS75.js +0 -5
  93. package/build/chunk-2FB5F5QF.js +0 -4
  94. package/build/chunk-4BHNJVL2.js +0 -4
  95. package/build/chunk-5OZZ7R6I.js +0 -11
  96. package/build/chunk-5OZZ7R6I.js.map +0 -1
  97. package/build/chunk-6HSUK2A2.js +0 -4
  98. package/build/chunk-7VOKCPZP.js +0 -5
  99. package/build/chunk-B4SDDVMV.js +0 -4
  100. package/build/chunk-C4SXZWXS.js +0 -4
  101. package/build/chunk-FKBCPMYK.js +0 -11
  102. package/build/chunk-FMIXY6J5.js +0 -115
  103. package/build/chunk-FMIXY6J5.js.map +0 -1
  104. package/build/chunk-GWU77DPO.js +0 -4
  105. package/build/chunk-HDXLQ34N.js +0 -4
  106. package/build/chunk-JXE3LQ2S.js +0 -100
  107. package/build/chunk-JXE3LQ2S.js.map +0 -1
  108. package/build/chunk-K2A77MMN.js +0 -4
  109. package/build/chunk-KG7BHEJG.js +0 -4
  110. package/build/chunk-LJEYXY4V.js +0 -4
  111. package/build/chunk-N5D4TFKX.js +0 -280
  112. package/build/chunk-PCBMS46R.js +0 -4
  113. package/build/chunk-PCBMS46R.js.map +0 -1
  114. package/build/chunk-QOUZ6J7N.js +0 -4
  115. package/build/chunk-V4TR6DCM.js +0 -4
  116. package/build/chunk-WJTPY35F.js +0 -9
  117. package/build/chunk-WJTPY35F.js.map +0 -1
  118. package/build/chunk-X4BLMM2K.js +0 -4
  119. package/build/devtools-4JFNYU2B.js +0 -10
  120. package/build/esm-HBMYQBEO.js +0 -466
  121. package/build/platform-sdk/chunk-GZP4Z76C.js +0 -2
  122. package/build/platform-sdk/chunk-GZP4Z76C.js.map +0 -1
  123. package/build/platform-sdk/chunk-KGLNBMRO.js +0 -2
  124. package/build/platform-sdk/chunk-KGLNBMRO.js.map +0 -1
  125. package/build/preview-TM7JAWFS.js +0 -4
  126. package/build/render-command-QEQ3L7OX.js +0 -4
  127. package/build/types.impl-L2DPGJ77.js +0 -4
  128. /package/build/{PreviewCommand-JKPFMGWV.js.map → PreviewCommand-XBSTVGWT.js.map} +0 -0
  129. /package/build/{types.impl-L2DPGJ77.js.map → types.impl-CD4WWRUK.js.map} +0 -0
@@ -1,2 +0,0 @@
1
- import{c as t}from"./chunk-KGLNBMRO.js";function i(e){return t({__type:"host",create:r=>Object.entries(e).reduce((o,[c,n])=>({...o,[c]:n(r)}),{})},Object.keys(e))}export{i as a};
2
- //# sourceMappingURL=chunk-GZP4Z76C.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/@wix/sdk-runtime/build/host-modules.js"],"sourcesContent":["import { contextualizeHostModuleV2 } from './context-v2.js';\nexport function createHostModule(hostModuleAPI) {\n return contextualizeHostModuleV2({\n __type: 'host',\n create: (host) => Object.entries(hostModuleAPI).reduce((acc, [key, fn]) => ({\n ...acc,\n [key]: fn(host),\n }), {}),\n }, Object.keys(hostModuleAPI));\n}\n"],"mappings":"wCACO,SAASA,EAAiBC,EAAe,CAC5C,OAAOC,EAA0B,CAC7B,OAAQ,OACR,OAASC,GAAS,OAAO,QAAQF,CAAa,EAAE,OAAO,CAACG,EAAK,CAACC,EAAKC,CAAE,KAAO,CACxE,GAAGF,EACH,CAACC,CAAG,EAAGC,EAAGH,CAAI,CAClB,GAAI,CAAC,CAAC,CACV,EAAG,OAAO,KAAKF,CAAa,CAAC,CACjC","names":["createHostModule","hostModuleAPI","contextualizeHostModuleV2","host","acc","key","fn"]}
@@ -1,2 +0,0 @@
1
- import{a as re,b as ie,c as se,d as ae,f as W}from"./chunk-SBZEOPXX.js";var le={};se(le,{EventDefinition:()=>v,SERVICE_PLUGIN_ERROR_TYPE:()=>S,ServicePluginDefinition:()=>ce});function v(e,t=!1,n=i=>i){return()=>({__type:"event-definition",type:e,isDomainEvent:t,transformations:n})}function ce(e,t){return{__type:"service-plugin-definition",componentType:e,methods:t}}var S,A=re(()=>{"use strict";S="wix_spi_error"});var K=ie((Fe,G)=>{"use strict";var R=class e extends Error{constructor(t){super(e._prepareSuperMessage(t)),Object.defineProperty(this,"name",{value:"NonError",configurable:!0,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(this,e)}static _prepareSuperMessage(t){try{return JSON.stringify(t)}catch{return String(t)}}},xe=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0}],P=Symbol(".toJSON called"),me=e=>{e[P]=!0;let t=e.toJSON();return delete e[P],t},j=({from:e,seen:t,to_:n,forceEnumerable:i,maxDepth:o,depth:r})=>{let a=n||(Array.isArray(e)?[]:{});if(t.push(e),r>=o)return a;if(typeof e.toJSON=="function"&&e[P]!==!0)return me(e);for(let[s,l]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(l)){a[s]="[object Buffer]";continue}if(typeof l!="function"){if(!l||typeof l!="object"){a[s]=l;continue}if(!t.includes(e[s])){r++,a[s]=j({from:e[s],seen:t.slice(),forceEnumerable:i,maxDepth:o,depth:r});continue}a[s]="[Circular]"}}for(let{property:s,enumerable:l}of xe)typeof e[s]=="string"&&Object.defineProperty(a,s,{value:e[s],enumerable:i?!0:l,configurable:!0,writable:!0});return a},we=(e,t={})=>{let{maxDepth:n=Number.POSITIVE_INFINITY}=t;return typeof e=="object"&&e!==null?j({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0}):typeof e=="function"?`[Function: ${e.name||"anonymous"}]`:e},ye=(e,t={})=>{let{maxDepth:n=Number.POSITIVE_INFINITY}=t;if(e instanceof Error)return e;if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let i=new Error;return j({from:e,seen:[],to_:i,maxDepth:n,depth:0}),i}return new R(e)};G.exports={serializeError:we,deserializeError:ye}});A();import{wixContext as te}from"@wix/sdk-context";var de=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}`)}},H=e=>t=>async n=>{let i,o=r=>{if(i=e(n)(r),i.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:s,params:l}=i;return{...i,method:de(a),url:s,data:i.data,params:l}};try{let r=await t.request(o);if(i===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(i.transformResponse)?i.transformResponse:[i.transformResponse],s=r.data;return a.forEach(l=>{l&&(s=l(r.data,r.headers))}),s}catch(r){throw typeof r=="object"&&r!==null&&"response"in r&&typeof r.response=="object"&&r.response!==null&&"data"in r.response?r.response.data:r}},I=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var $="__metadata",E="www.wixapis.com";var M=class extends Error{constructor(n,i){super(n);W(this,"message");W(this,"response");this.message=n,this.response=i}async details(){let n=await this.response.json();return ue(this.response.status,n?.message,n?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:n})}},ue=(e,t,n,i)=>({details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:i}},...n},message:t});var k=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},U=e=>e&&typeof e=="object"&&!Array.isArray(e);var O=e=>e.__type==="host";function N(e,t){return e.create(t)}var pe="x-wix-bi-gateway";function q(e,t,n){return{[pe]:fe({environment:`js-sdk${n?`-${n}`:""}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function fe(e){return Object.entries(e).filter(([t,n])=>!!n).map(([t,n])=>`${t}=${n}`).join(",")}import{wixContext as y}from"@wix/sdk-context";function Pe(e,t){return{...e,...Object.fromEntries(t.map(n=>[n,(...i)=>{let o=J();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,i)}]))}}function J(){let e=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(e)return{initWixModules(i,o){return _(()=>e(i,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 y.client<"u"?y.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,n=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof y.elevatedClient<"u"?y.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!n))return{initWixModules(i,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 _(()=>n.use(i))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return _(()=>t.use(i))},fetchWithAuth:(i,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(i,o)},async graphql(i,o,r){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(i,o,r)}}}function _(e){let t=globalThis.__wix_context__,n={client:y.client,elevatedClient:y.elevatedClient},i;globalThis.__wix_context__=void 0,y.client=void 0,y.elevatedClient=void 0,typeof $wixContext<"u"&&(i={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,y.client=n.client,y.elevatedClient=n.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=i.client,$wixContext.elevatedClient=i.elevatedClient)}}function D(e,t,n,i,o,r,a){return _(()=>e({request:async s=>{let l=s({host:r?.HTTPHost||E}),d=l;d.method==="GET"&&d.fallback?.length&&d.params.toString().length>4e3&&(d=l.fallback[0]);let h=`https://${r?.HTTPHost??E}${d.url}`;d.params&&d.params.toString()&&(h+=`?${d.params.toString()}`);try{let p=q(l,t,a),w=await n(h,{method:d.method,...d.data&&{body:JSON.stringify(d.data)},headers:{...p}});if(w.status!==200){let c=null;try{c=await w.json()}catch{}throw he(w.status,c?.message,c?.details,{requestId:w.headers.get("X-Wix-Request-Id"),details:c})}return{data:await w.json(),headers:w.headers,status:w.status,statusText:w.statusText}}catch(p){throw p.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),p}},fetchWithAuth:n,wixAPIFetch:i,getActiveToken:o}))}var he=(e,t,n,i)=>({response:{data:{details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:i}},...n},message:t},status:e}});A();function C(){return{emit(e,...t){for(let n=0,i=this.events[e]||[],o=i.length;n<o;n++)i[n](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(n=>t!==n)}}}}var L=e=>e.__type==="event-definition";function z(e,t,n,i){let o;if(e.isDomainEvent){let a=n,{deletedEvent:s,actionEvent:l,createdEvent:d,updatedEvent:u,...h}=a,p={...i,...h};s?s?.deletedEntity?o={entity:s?.deletedEntity,metadata:p}:o={metadata:p}:l?o={data:l.body,metadata:p}:o={entity:d?.entity??u?.currentEntity,metadata:p}}else o={data:n,metadata:i};let r=e.transformations??(a=>a);return t(r(o))}function B(e){let t=new Map,n=C(),i={...n,getRegisteredEvents:()=>t,async process(o,r={expectedEvents:[]}){let{eventType:a,identity:s,instanceId:l,payload:d}=await this.parseJWT(o),u=[...r.expectedEvents,...Array.from(t.keys()).map(p=>({type:p}))];if(u.length>0&&!u.some(({type:p})=>p===a))throw new Error(`Unexpected event type: ${a}. Expected one of: ${u.map(p=>p.type).join(", ")}`);let h=t.get(a)??[];return await Promise.all(h.map(({eventDefinition:p,handler:w})=>z(p,w,d,{instanceId:l,identity:s}))),{instanceId:l,eventType:a,payload:d,identity:s}},async processRequest(o,r){let a=await o.text();return this.process(a,r)},async parseJWT(o){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:r,valid:a}=await e.decodeJWT(o);if(!a)throw new Error("JWT is not valid");if(typeof r.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof r.data}`);let s=JSON.parse(r.data),l=s.eventType,d=s.instanceId,u=s.identity?JSON.parse(s.identity):void 0,h=JSON.parse(s.data);return{instanceId:d,eventType:l,payload:h,identity:u}},async parseRequest(o){let r=await o.text();return this.parseJWT(r)},async executeHandlers(o){let r=Array.from(t.keys()).map(s=>({type:s}));if(r.length>0&&!r.some(({type:s})=>s===o.eventType))throw new Error(`Unexpected event type: ${o.eventType}. Expected one of: ${r.map(s=>s.type).join(", ")}`);let a=t.get(o.eventType)??[];await Promise.all(a.map(({eventDefinition:s,handler:l})=>z(s,l,o.payload,{instanceId:o.instanceId,identity:o.identity})))},apps:{AppInstalled:v("AppInstalled")(),AppRemoved:v("AppRemoved")()}};return{initModule(o){return r=>{let a=t.get(o.type)??[];a.push({eventDefinition:o,handler:r}),t.set(o.type,a),n.emit("registered",o)}},client:i}}var F=e=>e.__type==="service-plugin-definition";function V(e){let t=new Map,n=C(),i={...n,getRegisteredServicePlugins:()=>t,async parseJWT(o){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:r,valid:a}=await e.decodeJWT(o,!0);if(!a)throw new Error("JWT is not valid");if(typeof r.data!="object"||r.data===null||!("metadata"in r.data)||typeof r.data.metadata!="object"||r.data.metadata===null||!("appExtensionType"in r.data.metadata)||typeof r.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return r.data},async process(o){let r=await this.parseJWT(o.body);return this.executeHandler(r,o.url)},async parseRequest(o){let r=await o.text();return this.parseJWT(r)},async processRequest(o){let r=o.url,a=await o.text();try{let s=await this.process({url:r,body:a});return Response.json(s)}catch(s){if(s.errorType==="SPI"&&s.applicationCode&&s.httpCode)return Response.json({applicationError:{code:s.applicationCode,data:s.data}},{status:s.httpCode});throw s}},async executeHandler(o,r){let a=o.metadata.appExtensionType.toLowerCase(),s=t.get(a)??[];if(s.length===0)throw new Error(`No service plugin implementations found for component type ${a}`);if(s.length>1)throw new Error(`Multiple service plugin implementations found for component type ${a}. This is currently not supported`);let{implementation:l,servicePluginDefinition:d}=s[0],u=d.methods.find(p=>r.endsWith(p.primaryHttpMappingPath));if(!u)throw new Error("Unexpect request: request url did not match any method: "+r);let h=l[u.name];if(!h)throw new Error(`Got request for service plugin method ${u.name} but no implementation was provided. Available methods: ${Object.keys(l).join(", ")}`);return u.transformations.toREST(await h(u.transformations.fromREST(o)))}};return{initModule(o){return r=>{let a=t.get(o.componentType.toLowerCase())??[];a.push({servicePluginDefinition:o,implementation:r}),t.set(o.componentType.toLowerCase(),a),n.emit("registered",o)}},client:i}}var Q=ae(K(),1);async function Y(e){let t=await fetch("https://www.wixapis.com/oauth2/token-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});if(t.status!==200)throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${t.status}`);return await t.json()}var Z=e=>e.__type==="web-method-module",g;(function(e){e.Anyone="anyone",e.Admin="admin",e.SiteMember="site-member"})(g||(g={}));async function Ee(e,t){let n=e.headers.get("Authorization");if(!n)throw new Error("Request is missing authentication data");let{subjectType:i}=await Y(n);switch(t){case g.Anyone:{if(i!=="VISITOR"&&i!=="MEMBER"&&i!=="USER")throw new Error("Insufficient permissions");break}case g.SiteMember:{if(i!=="MEMBER"&&i!=="USER")throw new Error("Insufficient permissions");break}case g.Admin:{if(i!=="USER")throw new Error("Insufficient permissions");break}}}var _e=/\/_webMethods\/(.+\..+)\/(.+\..+)/;function be(e){let t=e.match(_e);if(t)return[t[1],t[2].replace(".ajax","")]}function Te(e){return!!e&&typeof e=="object"&&Array.isArray(e)}var X="Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.";function ee(){let e={};return{initModule(n){Object.assign(e,n)},client:{async processRequest(n,i=!1){let o=be(n.url);if(!o)return new Response("invalid request",{status:400});let[r,a]=o,s=await n.json();if(!Te(s))return new Response("invalid request",{status:400});let l=e[`/${r}`];try{if(!l)throw new Error(`Error loading web module ${r}: Cannot find module '${r}'`);let u=(await l())[a];if(!u)throw new Error(`Error loading function from web module ${r}: function '${a}' not found`);return await Ee(n,u.permission),Response.json({result:await u.handler(...s)})}catch(d){let u=(0,Q.serializeError)(d,{maxDepth:1});return Response.json({result:i||!(d instanceof Error)?u:{...u,message:X,stack:X},exception:!0})}}}}}function ct(e){let t=e.headers||{Authorization:""},n=e.auth||{getAuthHeaders:c=>Promise.resolve({headers:{}})},i=n.getAuthHeaders.bind(void 0,e.host);n.getAuthHeaders=i;let o=async(c,f)=>{if(typeof c=="string"||c instanceof URL)return fetch(c,{...f,headers:{...f?.headers,...(await i()).headers}});for(let[x,m]of Object.entries((await i()).headers))c.headers.set(x,m);return fetch(c,f)},{client:r,initModule:a}=V(n),{client:s,initModule:l}=B(n),{client:d,initModule:u}=ee(),h=async(c,f)=>{let x=await i(),m=k(f);return fetch(c,{...f,headers:{...m,...t,...x?.headers,...f?.headers,...e.host?.essentials?.passThroughHeaders}})},p=(c,f)=>{if(L(c))return l(c);if(F(c))return a(c);if(O(c)&&e.host)return N(c,e.host);if(Z(c))return u(c);if(typeof c=="function"){if("__type"in c&&c.__type===S)return c;let x=e.host?.apiBaseUrl??E;return D(_(()=>I(c))?H(c):c,f??{},h,(m,b)=>{let T=new URL(m,`https://${x}`);return T.host=x,T.protocol="https",h(T.toString(),b)},n.getActiveToken,{HTTPHost:x},e.host?.name)}else return U(c)?Object.fromEntries(Object.entries(c).map(([x,m])=>[x,p(m,c[$])])):c},w=c=>{for(let f in c)t[f]=c[f]};return{...e.modules?p(e.modules):{},auth:n,setHeaders:w,use:p,enableContext(c,f={elevated:!1}){c==="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?te.elevatedClient=this:te.client=this},fetch:(c,f)=>{let x=e.host?.apiBaseUrl??E,m=new URL(c,`https://${x}`);return m.host=x,m.protocol="https",h(m.toString(),f)},fetchWithAuth:o,async graphql(c,f,x={apiVersion:"alpha"}){let m=e?.host?.apiBaseUrl??E,b=await h(`https://${m}/graphql/${x.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:c,variables:f})});if(b.status!==200)throw new M(`GraphQL request failed with status ${b.status}`,b);let{data:T,errors:oe}=await b.json();return{data:T??{},errors:oe}},webhooks:s,webMethods:d,servicePlugins:r}}export{le as a,A as b,Pe as c,ct as d};
2
- //# sourceMappingURL=chunk-KGLNBMRO.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/@wix/sdk-types/build/browser/index.mjs","../../../node_modules/serialize-error/index.js","../../../node_modules/@wix/sdk/build/wixClient.js","../../../node_modules/@wix/sdk/build/ambassador-modules.js","../../../node_modules/@wix/sdk/build/common.js","../../../node_modules/@wix/sdk/build/fetch-error.js","../../../node_modules/@wix/sdk/build/helpers.js","../../../node_modules/@wix/sdk/build/host-modules.js","../../../node_modules/@wix/sdk/build/bi/biHeaderGenerator.js","../../../node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk-runtime/build/context-v2.js","../../../node_modules/@wix/sdk/build/rest-modules.js","../../../node_modules/@wix/sdk/build/event-handlers-modules.js","../../../node_modules/@wix/sdk/build/nanoevents.js","../../../node_modules/@wix/sdk/build/service-plugin-modules.js","../../../node_modules/@wix/sdk/build/web-method-modules.js","../../../node_modules/@wix/sdk/build/get-token-info.js"],"sourcesContent":["// src/event-handlers-modules.ts\nfunction EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {\n return () => ({\n __type: \"event-definition\",\n type,\n isDomainEvent,\n transformations\n });\n}\n\n// src/service-plugins.ts\nfunction ServicePluginDefinition(componentType, methods) {\n return {\n __type: \"service-plugin-definition\",\n componentType,\n methods\n };\n}\nvar SERVICE_PLUGIN_ERROR_TYPE = \"wix_spi_error\";\nexport {\n EventDefinition,\n SERVICE_PLUGIN_ERROR_TYPE,\n ServicePluginDefinition\n};\n","'use strict';\n\nclass NonError extends Error {\n\tconstructor(message) {\n\t\tsuper(NonError._prepareSuperMessage(message));\n\t\tObject.defineProperty(this, 'name', {\n\t\t\tvalue: 'NonError',\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t});\n\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, NonError);\n\t\t}\n\t}\n\n\tstatic _prepareSuperMessage(message) {\n\t\ttry {\n\t\t\treturn JSON.stringify(message);\n\t\t} catch {\n\t\t\treturn String(message);\n\t\t}\n\t}\n}\n\nconst commonProperties = [\n\t{property: 'name', enumerable: false},\n\t{property: 'message', enumerable: false},\n\t{property: 'stack', enumerable: false},\n\t{property: 'code', enumerable: true}\n];\n\nconst isCalled = Symbol('.toJSON called');\n\nconst toJSON = from => {\n\tfrom[isCalled] = true;\n\tconst json = from.toJSON();\n\tdelete from[isCalled];\n\treturn json;\n};\n\nconst destroyCircular = ({\n\tfrom,\n\tseen,\n\tto_,\n\tforceEnumerable,\n\tmaxDepth,\n\tdepth\n}) => {\n\tconst to = to_ || (Array.isArray(from) ? [] : {});\n\n\tseen.push(from);\n\n\tif (depth >= maxDepth) {\n\t\treturn to;\n\t}\n\n\tif (typeof from.toJSON === 'function' && from[isCalled] !== true) {\n\t\treturn toJSON(from);\n\t}\n\n\tfor (const [key, value] of Object.entries(from)) {\n\t\tif (typeof Buffer === 'function' && Buffer.isBuffer(value)) {\n\t\t\tto[key] = '[object Buffer]';\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (typeof value === 'function') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!value || typeof value !== 'object') {\n\t\t\tto[key] = value;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!seen.includes(from[key])) {\n\t\t\tdepth++;\n\n\t\t\tto[key] = destroyCircular({\n\t\t\t\tfrom: from[key],\n\t\t\t\tseen: seen.slice(),\n\t\t\t\tforceEnumerable,\n\t\t\t\tmaxDepth,\n\t\t\t\tdepth\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tto[key] = '[Circular]';\n\t}\n\n\tfor (const {property, enumerable} of commonProperties) {\n\t\tif (typeof from[property] === 'string') {\n\t\t\tObject.defineProperty(to, property, {\n\t\t\t\tvalue: from[property],\n\t\t\t\tenumerable: forceEnumerable ? true : enumerable,\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true\n\t\t\t});\n\t\t}\n\t}\n\n\treturn to;\n};\n\nconst serializeError = (value, options = {}) => {\n\tconst {maxDepth = Number.POSITIVE_INFINITY} = options;\n\n\tif (typeof value === 'object' && value !== null) {\n\t\treturn destroyCircular({\n\t\t\tfrom: value,\n\t\t\tseen: [],\n\t\t\tforceEnumerable: true,\n\t\t\tmaxDepth,\n\t\t\tdepth: 0\n\t\t});\n\t}\n\n\t// People sometimes throw things besides Error objects…\n\tif (typeof value === 'function') {\n\t\t// `JSON.stringify()` discards functions. We do too, unless a function is thrown directly.\n\t\treturn `[Function: ${(value.name || 'anonymous')}]`;\n\t}\n\n\treturn value;\n};\n\nconst deserializeError = (value, options = {}) => {\n\tconst {maxDepth = Number.POSITIVE_INFINITY} = options;\n\n\tif (value instanceof Error) {\n\t\treturn value;\n\t}\n\n\tif (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n\t\tconst newError = new Error(); // eslint-disable-line unicorn/error-message\n\t\tdestroyCircular({\n\t\t\tfrom: value,\n\t\t\tseen: [],\n\t\t\tto_: newError,\n\t\t\tmaxDepth,\n\t\t\tdepth: 0\n\t\t});\n\t\treturn newError;\n\t}\n\n\treturn new NonError(value);\n};\n\nmodule.exports = {\n\tserializeError,\n\tdeserializeError\n};\n","import { wixContext } from '@wix/sdk-context';\nimport { SERVICE_PLUGIN_ERROR_TYPE, } from '@wix/sdk-types';\nimport { isAmbassadorModule, toHTTPModule } from './ambassador-modules.js';\nimport { DEFAULT_API_URL, PUBLIC_METADATA_KEY } from './common.js';\nimport { FetchErrorResponse } from './fetch-error.js';\nimport { getDefaultContentHeader, isObject } from './helpers.js';\nimport { buildHostModule, isHostModule } from './host-modules.js';\nimport { buildRESTDescriptor } from './rest-modules.js';\nimport { eventHandlersModules, isEventHandlerModule, } from './event-handlers-modules.js';\nimport { isServicePluginModule, servicePluginsModules, } from './service-plugin-modules.js';\nimport { runWithoutContext } from '@wix/sdk-runtime/context';\nimport { isWebMethodModules, webMethodModules, } from './web-method-modules.js';\nexport function createClient(config) {\n const _headers = config.headers || { Authorization: '' };\n const authStrategy = config.auth ||\n {\n getAuthHeaders: (_) => Promise.resolve({ headers: {} }),\n };\n const boundGetAuthHeaders = authStrategy.getAuthHeaders.bind(undefined, config.host);\n authStrategy.getAuthHeaders = boundGetAuthHeaders;\n const fetchWithAuth = async (urlOrRequest, requestInit) => {\n if (typeof urlOrRequest === 'string' || urlOrRequest instanceof URL) {\n return fetch(urlOrRequest, {\n ...requestInit,\n headers: {\n ...requestInit?.headers,\n ...(await boundGetAuthHeaders()).headers,\n },\n });\n }\n else {\n for (const [k, v] of Object.entries((await boundGetAuthHeaders()).headers)) {\n urlOrRequest.headers.set(k, v);\n }\n return fetch(urlOrRequest, requestInit);\n }\n };\n const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(authStrategy);\n const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(authStrategy);\n const { client: webMethodClient, initModule } = webMethodModules();\n const boundFetch = async (url, options) => {\n const authHeaders = await boundGetAuthHeaders();\n const defaultContentTypeHeader = getDefaultContentHeader(options);\n return fetch(url, {\n ...options,\n headers: {\n ...defaultContentTypeHeader,\n ..._headers,\n ...authHeaders?.headers,\n ...options?.headers,\n ...config.host?.essentials?.passThroughHeaders,\n },\n });\n };\n // This is typed as `any` because when trying to properly type it as defined\n // on the WixClient, typescript starts failing with `Type instantiation is\n // excessively deep and possibly infinite.`\n const use = (modules, metadata) => {\n if (isEventHandlerModule(modules)) {\n return initEventHandlerModule(modules);\n }\n else if (isServicePluginModule(modules)) {\n return initServicePluginModule(modules);\n }\n else if (isHostModule(modules) && config.host) {\n return buildHostModule(modules, config.host);\n }\n else if (isWebMethodModules(modules)) {\n return initModule(modules);\n }\n else if (typeof modules === 'function') {\n // The generated namespaces all have the error classes on them and\n // a class is also a function, so we need to explicitly ignore these\n // error classes using a static field that exists on them.\n if ('__type' in modules && modules.__type === SERVICE_PLUGIN_ERROR_TYPE) {\n return modules;\n }\n const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;\n return buildRESTDescriptor(runWithoutContext(() => isAmbassadorModule(modules))\n ? toHTTPModule(modules)\n : modules, metadata ?? {}, boundFetch, (relativeUrl, fetchOptions) => {\n const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);\n finalUrl.host = apiBaseUrl;\n finalUrl.protocol = 'https';\n return boundFetch(finalUrl.toString(), fetchOptions);\n }, authStrategy.getActiveToken, { HTTPHost: apiBaseUrl }, config.host?.name);\n }\n else if (isObject(modules)) {\n return Object.fromEntries(Object.entries(modules).map(([key, value]) => {\n return [key, use(value, modules[PUBLIC_METADATA_KEY])];\n }));\n }\n else {\n return modules;\n }\n };\n const setHeaders = (headers) => {\n for (const k in headers) {\n _headers[k] = headers[k];\n }\n };\n const wrappedModules = config.modules\n ? use(config.modules)\n : {};\n return {\n ...wrappedModules,\n auth: authStrategy,\n setHeaders,\n use,\n enableContext(contextType, opts = { elevated: false }) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n if (opts.elevated) {\n globalThis.__wix_context__.elevatedClient = this;\n }\n else {\n globalThis.__wix_context__.client = this;\n }\n }\n else {\n if (opts.elevated) {\n globalThis.__wix_context__ = { elevatedClient: this };\n }\n else {\n globalThis.__wix_context__ = { client: this };\n }\n }\n }\n else {\n if (opts.elevated) {\n wixContext.elevatedClient = this;\n }\n else {\n wixContext.client = this;\n }\n }\n },\n /**\n * @param relativeUrl The URL to fetch relative to the API base URL\n * @param options The fetch options\n * @returns The fetch Response object\n * @deprecated Use `fetchWithAuth` instead\n */\n fetch: (relativeUrl, options) => {\n const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;\n const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);\n finalUrl.host = apiBaseUrl;\n finalUrl.protocol = 'https';\n return boundFetch(finalUrl.toString(), options);\n },\n fetchWithAuth,\n async graphql(query, variables, opts = {\n apiVersion: 'alpha',\n }) {\n const apiBaseUrl = config?.host?.apiBaseUrl ?? DEFAULT_API_URL;\n const res = await boundFetch(`https://${apiBaseUrl}/graphql/${opts.apiVersion}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ query, variables }),\n });\n if (res.status !== 200) {\n throw new FetchErrorResponse(`GraphQL request failed with status ${res.status}`, res);\n }\n const { data, errors } = await res.json();\n return { data: data ?? {}, errors };\n },\n webhooks: eventHandlersClient,\n webMethods: webMethodClient,\n servicePlugins: servicePluginsClient,\n };\n}\n","const parseMethod = (method) => {\n switch (method) {\n case 'get':\n case 'GET':\n return 'GET';\n case 'post':\n case 'POST':\n return 'POST';\n case 'put':\n case 'PUT':\n return 'PUT';\n case 'delete':\n case 'DELETE':\n return 'DELETE';\n case 'patch':\n case 'PATCH':\n return 'PATCH';\n case 'head':\n case 'HEAD':\n return 'HEAD';\n case 'options':\n case 'OPTIONS':\n return 'OPTIONS';\n default:\n throw new Error(`Unknown method: ${method}`);\n }\n};\nexport const toHTTPModule = (factory) => (httpClient) => async (payload) => {\n let requestOptions;\n const HTTPFactory = (context) => {\n requestOptions = factory(payload)(context);\n if (requestOptions.url === undefined) {\n throw new Error('Url was not successfully created for this request, please reach out to support channels for assistance.');\n }\n const { method, url, params } = requestOptions;\n return {\n ...requestOptions,\n method: parseMethod(method),\n url,\n data: requestOptions.data,\n params,\n };\n };\n try {\n const response = await httpClient.request(HTTPFactory);\n if (requestOptions === undefined) {\n throw new Error('Request options were not created for this request, please reach out to support channels for assistance.');\n }\n const transformations = Array.isArray(requestOptions.transformResponse)\n ? requestOptions.transformResponse\n : [requestOptions.transformResponse];\n /**\n * Based on Axios implementation:\n * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/lib/core/transformData.js#L22\n */\n let data = response.data;\n transformations.forEach((transform) => {\n if (transform) {\n data = transform(response.data, response.headers);\n }\n });\n return data;\n }\n catch (e) {\n if (typeof e === 'object' &&\n e !== null &&\n 'response' in e &&\n typeof e.response === 'object' &&\n e.response !== null &&\n 'data' in e.response) {\n throw e.response.data;\n }\n throw e;\n }\n};\n/*\n * Because of issues with tree-shaking, we cant really put static parameter on module.\n * We still have check for __isAmbassador for backward compatibility\n */\nexport const isAmbassadorModule = (module) => {\n if (module.__isAmbassador) {\n return true;\n }\n const fn = module();\n return Boolean(fn.__isAmbassador);\n};\n","export const PUBLIC_METADATA_KEY = '__metadata';\nexport const DEFAULT_API_URL = 'www.wixapis.com';\nexport const FORCE_WRITE_API_URLS = ['/ecom/v1/carts/current'];\n","export class FetchErrorResponse extends Error {\n message;\n response;\n constructor(message, response) {\n super(message);\n this.message = message;\n this.response = response;\n }\n async details() {\n const dataError = await this.response.json();\n return errorBuilder(this.response.status, dataError?.message, dataError?.details, {\n requestId: this.response.headers.get('X-Wix-Request-Id'),\n details: dataError,\n });\n }\n}\nconst errorBuilder = (code, description, details, data) => {\n return {\n details: {\n ...(!details?.validationError && {\n applicationError: {\n description,\n code,\n data,\n },\n }),\n ...details,\n },\n message: description,\n };\n};\n","// we follow a simplified version of the axios convention\n// https://github.com/axios/axios/blob/649d739288c8e2c55829ac60e2345a0f3439c730/lib/defaults/index.js#L65\nexport const getDefaultContentHeader = (options) => {\n if (options?.method &&\n ['post', 'put', 'patch'].includes(options.method.toLocaleLowerCase()) &&\n options.body) {\n return { 'Content-Type': 'application/json' };\n }\n return {};\n};\nexport const isObject = (val) => val && typeof val === 'object' && !Array.isArray(val);\nexport function parsePublicKeyIfEncoded(publicKey) {\n if (publicKey.includes('\\n') || publicKey.includes('\\r')) {\n // publicKey is multi-line string, can be used as is\n return publicKey.trim();\n }\n else {\n // publicKey is base64 encoded\n return typeof atob !== 'undefined'\n ? atob(publicKey)\n : Buffer.from(publicKey, 'base64').toString('utf-8');\n }\n}\n","export const isHostModule = (val) => val.__type === 'host';\nexport function buildHostModule(val, host) {\n return val.create(host);\n}\n","export const WixBIHeaderName = 'x-wix-bi-gateway';\nexport function biHeaderGenerator(apiMetadata, publicMetadata, environment) {\n return {\n [WixBIHeaderName]: objectToKeyValue({\n environment: `js-sdk${environment ? `-${environment}` : ``}`,\n 'package-name': apiMetadata.packageName ?? publicMetadata?.PACKAGE_NAME,\n 'method-fqn': apiMetadata.methodFqn,\n entity: apiMetadata.entityFqdn,\n }),\n };\n}\nfunction objectToKeyValue(input) {\n return Object.entries(input)\n .filter(([_, value]) => Boolean(value))\n .map(([key, value]) => `${key}=${value}`)\n .join(',');\n}\n","import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n throw new Error('An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { EventDefinition, ServicePluginDefinition, } from '@wix/sdk-types';\nimport { resolveContext } from './context.js';\nexport { EventDefinition, ServicePluginDefinition, };\nexport function contextualizeHostModuleV2(hostModule, props) {\n return {\n ...hostModule,\n ...Object.fromEntries(props.map((prop) => [\n prop,\n (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(hostModule)[prop].apply(undefined, args);\n },\n ])),\n };\n}\nexport function contextualizeRESTModuleV2(restModule, elevated) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n // @ts-expect-error - if there is no context, we want to behave like the original module\n return restModule.apply(undefined, args);\n }\n return (context\n .initWixModules(restModule, elevated)\n // @ts-expect-error - we know the args here are meant to be passed to the initalized module\n .apply(undefined, args));\n });\n}\nexport function contextualizeEventDefinitionModuleV2(eventDefinition) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n contextualMethod.__type = eventDefinition.__type;\n contextualMethod.type = eventDefinition.type;\n contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;\n contextualMethod.transformations = eventDefinition.transformations;\n return contextualMethod;\n}\nexport function contextualizeSerivcePluginModuleV2(servicePlugin) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n contextualMethod.__type = servicePlugin.__type;\n contextualMethod.componentType = servicePlugin.componentType;\n contextualMethod.methods = servicePlugin.methods;\n return contextualMethod;\n}\n","import { biHeaderGenerator } from './bi/biHeaderGenerator.js';\nimport { DEFAULT_API_URL } from './common.js';\nimport { runWithoutContext } from '@wix/sdk-runtime/context';\nexport function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, getActiveToken, options, hostName) {\n return runWithoutContext(() => origFunc({\n request: async (factory) => {\n const requestOptions = factory({\n host: options?.HTTPHost || DEFAULT_API_URL,\n });\n let request = requestOptions;\n if (request.method === 'GET' &&\n request.fallback?.length &&\n request.params.toString().length > 4000) {\n request = requestOptions.fallback[0];\n }\n const domain = options?.HTTPHost ?? DEFAULT_API_URL;\n let url = `https://${domain}${request.url}`;\n if (request.params && request.params.toString()) {\n url += `?${request.params.toString()}`;\n }\n try {\n const biHeader = biHeaderGenerator(requestOptions, publicMetadata, hostName);\n const res = await boundFetch(url, {\n method: request.method,\n ...(request.data && {\n body: JSON.stringify(request.data),\n }),\n headers: {\n ...biHeader,\n },\n });\n if (res.status !== 200) {\n let dataError = null;\n try {\n dataError = await res.json();\n }\n catch (e) {\n //\n }\n throw errorBuilder(res.status, dataError?.message, dataError?.details, {\n requestId: res.headers.get('X-Wix-Request-Id'),\n details: dataError,\n });\n }\n const data = await res.json();\n return {\n data,\n headers: res.headers,\n status: res.status,\n statusText: res.statusText,\n };\n }\n catch (e) {\n if (e.message?.includes('fetch is not defined')) {\n console.error('Node.js v18+ is required');\n }\n throw e;\n }\n },\n fetchWithAuth: boundFetch,\n wixAPIFetch,\n getActiveToken,\n }));\n}\nconst errorBuilder = (code, description, details, data) => {\n return {\n response: {\n data: {\n details: {\n ...(!details?.validationError && {\n applicationError: {\n description,\n code,\n data,\n },\n }),\n ...details,\n },\n message: description,\n },\n status: code,\n },\n };\n};\n","import { EventDefinition, } from '@wix/sdk-types';\nimport { createNanoEvents } from './nanoevents.js';\nexport const isEventHandlerModule = (val) => val.__type === 'event-definition';\nexport function buildEventDefinition(eventDefinition, registerHandler) {\n return (handler) => {\n registerHandler(eventDefinition, handler);\n };\n}\nfunction runHandler(eventDefinition, handler, payload, baseEventMetadata) {\n let envelope;\n if (eventDefinition.isDomainEvent) {\n const domainEventPayload = payload;\n const { deletedEvent, actionEvent, createdEvent, updatedEvent, ...domainEventMetadata } = domainEventPayload;\n const metadata = {\n ...baseEventMetadata,\n ...domainEventMetadata,\n };\n if (deletedEvent) {\n if (deletedEvent?.deletedEntity) {\n envelope = {\n entity: deletedEvent?.deletedEntity,\n metadata,\n };\n }\n else {\n envelope = { metadata };\n }\n }\n else if (actionEvent) {\n envelope = {\n data: actionEvent.body,\n metadata,\n };\n }\n else {\n envelope = {\n entity: createdEvent?.entity ?? updatedEvent?.currentEntity,\n metadata,\n };\n }\n }\n else {\n envelope = {\n data: payload,\n metadata: baseEventMetadata,\n };\n }\n const transformFromRESTFn = eventDefinition.transformations ?? ((x) => x);\n return handler(transformFromRESTFn(envelope));\n}\nexport function eventHandlersModules(authStrategy) {\n const eventHandlers = new Map();\n const webhooksEmitter = createNanoEvents();\n const client = {\n ...webhooksEmitter,\n getRegisteredEvents: () => eventHandlers,\n async process(jwt, opts = {\n expectedEvents: [],\n }) {\n const { eventType, identity, instanceId, payload } = await this.parseJWT(jwt);\n const allExpectedEvents = [\n ...opts.expectedEvents,\n ...Array.from(eventHandlers.keys()).map((type) => ({ type })),\n ];\n if (allExpectedEvents.length > 0 &&\n !allExpectedEvents.some(({ type }) => type === eventType)) {\n throw new Error(`Unexpected event type: ${eventType}. Expected one of: ${allExpectedEvents\n .map((x) => x.type)\n .join(', ')}`);\n }\n const handlers = eventHandlers.get(eventType) ?? [];\n await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, payload, {\n instanceId,\n identity,\n })));\n return {\n instanceId,\n eventType,\n payload,\n identity,\n };\n },\n async processRequest(request, opts) {\n const body = await request.text();\n return this.process(body, opts);\n },\n async parseJWT(jwt) {\n if (!authStrategy.decodeJWT) {\n throw new Error('decodeJWT is not supported by the authentication strategy');\n }\n const { decoded, valid } = await authStrategy.decodeJWT(jwt);\n if (!valid) {\n throw new Error('JWT is not valid');\n }\n if (typeof decoded.data !== 'string') {\n throw new Error(`Unexpected type of JWT data: expected string, got ${typeof decoded.data}`);\n }\n const parsedDecoded = JSON.parse(decoded.data);\n const eventType = parsedDecoded.eventType;\n const instanceId = parsedDecoded.instanceId;\n const identity = parsedDecoded.identity\n ? JSON.parse(parsedDecoded.identity)\n : undefined;\n const payload = JSON.parse(parsedDecoded.data);\n return {\n instanceId,\n eventType,\n payload,\n identity,\n };\n },\n async parseRequest(request) {\n const jwt = await request.text();\n return this.parseJWT(jwt);\n },\n async executeHandlers(event) {\n const allExpectedEvents = Array.from(eventHandlers.keys()).map((type) => ({ type }));\n if (allExpectedEvents.length > 0 &&\n !allExpectedEvents.some(({ type }) => type === event.eventType)) {\n throw new Error(`Unexpected event type: ${event.eventType}. Expected one of: ${allExpectedEvents\n .map((x) => x.type)\n .join(', ')}`);\n }\n const handlers = eventHandlers.get(event.eventType) ?? [];\n await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, event.payload, {\n instanceId: event.instanceId,\n identity: event.identity,\n })));\n },\n apps: {\n AppInstalled: EventDefinition('AppInstalled')(),\n AppRemoved: EventDefinition('AppRemoved')(),\n },\n };\n return {\n initModule(eventDefinition) {\n return (handler) => {\n const handlers = eventHandlers.get(eventDefinition.type) ?? [];\n handlers.push({ eventDefinition, handler });\n eventHandlers.set(eventDefinition.type, handlers);\n webhooksEmitter.emit('registered', eventDefinition);\n };\n },\n client,\n };\n}\n","// Inlined from https://github.com/ai/nanoevents/blob/main/index.js\n/**\n * Create event emitter.\n *\n * ```js\n * import { createNanoEvents } from 'nanoevents'\n *\n * class Ticker {\n * constructor() {\n * this.emitter = createNanoEvents()\n * }\n * on(...args) {\n * return this.emitter.on(...args)\n * }\n * tick() {\n * this.emitter.emit('tick')\n * }\n * }\n * ```\n * @returns Event emitter.\n */\nexport function createNanoEvents() {\n return {\n emit(event, ...args) {\n for (let i = 0, callbacks = this.events[event] || [], length = callbacks.length; i < length; i++) {\n callbacks[i](...args);\n }\n },\n events: {},\n on(event, cb) {\n (this.events[event] ||= []).push(cb);\n return () => {\n this.events[event] = this.events[event]?.filter((i) => cb !== i);\n };\n },\n };\n}\n","import { createNanoEvents } from './nanoevents.js';\nexport const isServicePluginModule = (val) => val.__type === 'service-plugin-definition';\nexport function servicePluginsModules(authStrategy) {\n const servicePluginsImplementations = new Map();\n const servicePluginsEmitter = createNanoEvents();\n const client = {\n ...servicePluginsEmitter,\n getRegisteredServicePlugins: () => servicePluginsImplementations,\n async parseJWT(jwt) {\n if (!authStrategy.decodeJWT) {\n throw new Error('decodeJWT is not supported by the authentication strategy');\n }\n const { decoded, valid } = await authStrategy.decodeJWT(jwt, true);\n if (!valid) {\n throw new Error('JWT is not valid');\n }\n if (typeof decoded.data !== 'object' ||\n decoded.data === null ||\n !('metadata' in decoded.data) ||\n typeof decoded.data.metadata !== 'object' ||\n decoded.data.metadata === null ||\n !('appExtensionType' in decoded.data.metadata) ||\n typeof decoded.data.metadata.appExtensionType !== 'string') {\n throw new Error('Unexpected JWT data: expected object with metadata.appExtensionType string');\n }\n return decoded.data;\n },\n async process(request) {\n const servicePluginRequest = await this.parseJWT(request.body);\n return this.executeHandler(servicePluginRequest, request.url);\n },\n async parseRequest(request) {\n const body = await request.text();\n return this.parseJWT(body);\n },\n async processRequest(request) {\n const url = request.url;\n const body = await request.text();\n try {\n const implMethodResult = await this.process({ url, body });\n return Response.json(implMethodResult);\n }\n catch (err) {\n if (err.errorType === 'SPI' && err.applicationCode && err.httpCode) {\n return Response.json({ applicationError: { code: err.applicationCode, data: err.data } }, { status: err.httpCode });\n }\n throw err;\n }\n },\n async executeHandler(servicePluginRequest, url) {\n const componentType = servicePluginRequest.metadata.appExtensionType.toLowerCase();\n const implementations = servicePluginsImplementations.get(componentType) ?? [];\n if (implementations.length === 0) {\n throw new Error(`No service plugin implementations found for component type ${componentType}`);\n }\n else if (implementations.length > 1) {\n throw new Error(`Multiple service plugin implementations found for component type ${componentType}. This is currently not supported`);\n }\n const { implementation: impl, servicePluginDefinition } = implementations[0];\n const method = servicePluginDefinition.methods.find((m) => url.endsWith(m.primaryHttpMappingPath));\n if (!method) {\n throw new Error('Unexpect request: request url did not match any method: ' + url);\n }\n const implMethod = impl[method.name];\n if (!implMethod) {\n throw new Error(`Got request for service plugin method ${method.name} but no implementation was provided. Available methods: ${Object.keys(impl).join(', ')}`);\n }\n return method.transformations.toREST(await implMethod(method.transformations.fromREST(servicePluginRequest)));\n },\n };\n return {\n initModule(servicePluginDefinition) {\n return (implementation) => {\n const implementations = servicePluginsImplementations.get(servicePluginDefinition.componentType.toLowerCase()) ?? [];\n implementations.push({ servicePluginDefinition, implementation });\n servicePluginsImplementations.set(servicePluginDefinition.componentType.toLowerCase(), implementations);\n servicePluginsEmitter.emit('registered', servicePluginDefinition);\n };\n },\n client,\n };\n}\n","import { serializeError } from 'serialize-error';\nimport { getTokenInfo } from './get-token-info.js';\nexport const isWebMethodModules = (val) => val.__type === 'web-method-module';\nvar Permissions;\n(function (Permissions) {\n Permissions[\"Anyone\"] = \"anyone\";\n Permissions[\"Admin\"] = \"admin\";\n Permissions[\"SiteMember\"] = \"site-member\";\n})(Permissions || (Permissions = {}));\nasync function checkPermission(request, permission) {\n const accessToken = request.headers.get('Authorization');\n if (!accessToken) {\n throw new Error('Request is missing authentication data');\n }\n const { subjectType } = await getTokenInfo(accessToken);\n switch (permission) {\n case Permissions.Anyone: {\n if (subjectType !== 'VISITOR' &&\n subjectType !== 'MEMBER' &&\n subjectType !== 'USER') {\n throw new Error('Insufficient permissions');\n }\n break;\n }\n case Permissions.SiteMember: {\n if (subjectType !== 'MEMBER' && subjectType !== 'USER') {\n throw new Error('Insufficient permissions');\n }\n break;\n }\n case Permissions.Admin: {\n if (subjectType !== 'USER') {\n throw new Error('Insufficient permissions');\n }\n break;\n }\n }\n}\nconst urlRegex = /\\/_webMethods\\/(.+\\..+)\\/(.+\\..+)/;\n// /_webMethods/backend/my-module.web.js/multiply.ajax\nfunction extractUrlParts(url) {\n const parts = url.match(urlRegex);\n if (parts) {\n return [parts[1], parts[2].replace('.ajax', '')];\n }\n}\nfunction isRequestBodyValid(body) {\n return !!body && typeof body === 'object' && Array.isArray(body);\n}\nconst productionErrorMessage = 'Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.';\nexport function webMethodModules() {\n const webMethods = {};\n const client = {\n async processRequest(request, devMode = false) {\n const urlParts = extractUrlParts(request.url);\n if (!urlParts) {\n return new Response('invalid request', { status: 400 });\n }\n const [file, method] = urlParts;\n const body = (await request.json());\n if (!isRequestBodyValid(body)) {\n return new Response('invalid request', { status: 400 });\n }\n const loadWebMethodFile = webMethods[`/${file}`];\n try {\n if (!loadWebMethodFile) {\n throw new Error(`Error loading web module ${file}: Cannot find module '${file}'`);\n }\n const webMethodFile = await loadWebMethodFile();\n const webMethod = webMethodFile[method];\n if (!webMethod) {\n throw new Error(`Error loading function from web module ${file}: function '${method}' not found`);\n }\n await checkPermission(request, webMethod.permission);\n return Response.json({\n result: await webMethod.handler(...body),\n });\n }\n catch (error) {\n const serializedError = serializeError(error, { maxDepth: 1 });\n return Response.json({\n result: devMode || !(error instanceof Error)\n ? serializedError\n : {\n ...serializedError,\n message: productionErrorMessage,\n stack: productionErrorMessage,\n },\n exception: true,\n });\n }\n },\n };\n return {\n initModule(webMethodModule) {\n Object.assign(webMethods, webMethodModule);\n },\n client,\n };\n}\n","export async function getTokenInfo(token) {\n const tokenInfoRes = await fetch('https://www.wixapis.com/oauth2/token-info', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n token,\n }),\n });\n if (tokenInfoRes.status !== 200) {\n throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${tokenInfoRes.status}`);\n }\n return (await tokenInfoRes.json());\n}\n"],"mappings":"wEAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,qBAAAE,EAAA,8BAAAC,EAAA,4BAAAC,KACA,SAASF,EAAgBG,EAAMC,EAAgB,GAAOC,EAAmBC,GAAMA,EAAG,CAChF,MAAO,KAAO,CACZ,OAAQ,mBACR,KAAAH,EACA,cAAAC,EACA,gBAAAC,CACF,EACF,CAGA,SAASH,GAAwBK,EAAeC,EAAS,CACvD,MAAO,CACL,OAAQ,4BACR,cAAAD,EACA,QAAAC,CACF,CACF,CAjBA,IAkBIP,EAlBJQ,EAAAC,GAAA,kBAkBIT,EAA4B,kBClBhC,IAAAU,EAAAC,GAAA,CAAAC,GAAAC,IAAA,cAEA,IAAMC,EAAN,MAAMC,UAAiB,KAAM,CAC5B,YAAYC,EAAS,CACpB,MAAMD,EAAS,qBAAqBC,CAAO,CAAC,EAC5C,OAAO,eAAe,KAAM,OAAQ,CACnC,MAAO,WACP,aAAc,GACd,SAAU,EACX,CAAC,EAEG,MAAM,mBACT,MAAM,kBAAkB,KAAMD,CAAQ,CAExC,CAEA,OAAO,qBAAqBC,EAAS,CACpC,GAAI,CACH,OAAO,KAAK,UAAUA,CAAO,CAC9B,MAAQ,CACP,OAAO,OAA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CACC,IAAMhB,EAAalC,GAAQ,MAAM,YAAcmC,EACzCmB,EAAM,MAAMnC,EAAW,WAAWe,CAAU,YAAYgB,EAAK,UAAU,GAAI,CAC7E,OAAQ,OACR,QAAS,CACL,eAAgB,kBACpB,EACA,KAAM,KAAK,UAAU,CAAE,MAAAE,EAAO,UAAAC,CAAU,CAAC,CAC7C,CAAC,EACD,GAAIC,EAAI,SAAW,IACf,MAAM,IAAIC,EAAmB,sCAAsCD,EAAI,MAAM,GAAIA,CAAG,EAExF,GAAM,CAAE,KAAAE,EAAM,OAAAC,EAAO,EAAI,MAAMH,EAAI,KAAK,EACxC,MAAO,CAAE,KAAME,GAAQ,CAAC,EAAG,OAAAC,EAAO,CACtC,EACA,SAAU5C,EACV,WAAYG,EACZ,eAAgBN,CACpB,CACJ","names":["browser_exports","__export","EventDefinition","SERVICE_PLUGIN_ERROR_TYPE","ServicePluginDefinition","type","isDomainEvent","transformations","x","componentType","methods","init_browser","__esmMin","require_serialize_error","__commonJSMin","exports","module","NonError","_NonError","message","commonProperties","isCalled","toJSON","from","json","destroyCircular","seen","to_","forceEnumerable","maxDepth","depth","to","key","value","property","enumerable","serializeError","options","deserializeError","newError","init_browser","wixContext","parseMethod","method","toHTTPModule","factory","httpClient","payload","requestOptions","HTTPFactory","context","url","params","response","transformations","data","transform","e","isAmbassadorModule","module","PUBLIC_METADATA_KEY","DEFAULT_API_URL","FetchErrorResponse","message","response","__publicField","dataError","errorBuilder","code","description","details","data","getDefaultContentHeader","options","isObject","val","isHostModule","val","buildHostModule","host","WixBIHeaderName","biHeaderGenerator","apiMetadata","publicMetadata","environment","objectToKeyValue","input","_","value","key","wixContext","contextualizeHostModuleV2","hostModule","props","prop","args","context","resolveContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","wixContext","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext","buildRESTDescriptor","origFunc","publicMetadata","boundFetch","wixAPIFetch","getActiveToken","options","hostName","runWithoutContext","factory","requestOptions","DEFAULT_API_URL","request","url","biHeader","biHeaderGenerator","res","dataError","errorBuilder","e","code","description","details","data","init_browser","createNanoEvents","event","args","i","callbacks","length","cb","isEventHandlerModule","val","runHandler","eventDefinition","handler","payload","baseEventMetadata","envelope","domainEventPayload","deletedEvent","actionEvent","createdEvent","updatedEvent","domainEventMetadata","metadata","transformFromRESTFn","x","eventHandlersModules","authStrategy","eventHandlers","webhooksEmitter","createNanoEvents","client","jwt","opts","eventType","identity","instanceId","allExpectedEvents","type","handlers","request","body","decoded","valid","parsedDecoded","event","EventDefinition","isServicePluginModule","val","servicePluginsModules","authStrategy","servicePluginsImplementations","servicePluginsEmitter","createNanoEvents","client","jwt","decoded","valid","request","servicePluginRequest","body","url","implMethodResult","err","componentType","implementations","impl","servicePluginDefinition","method","m","implMethod","implementation","import_serialize_error","getTokenInfo","token","tokenInfoRes","isWebMethodModules","val","Permissions","checkPermission","request","permission","accessToken","subjectType","getTokenInfo","urlRegex","extractUrlParts","url","parts","isRequestBodyValid","body","productionErrorMessage","webMethodModules","webMethods","webMethodModule","devMode","urlParts","file","method","loadWebMethodFile","webMethod","error","serializedError","createClient","config","_headers","authStrategy","_","boundGetAuthHeaders","fetchWithAuth","urlOrRequest","requestInit","k","v","servicePluginsClient","initServicePluginModule","servicePluginsModules","eventHandlersClient","initEventHandlerModule","eventHandlersModules","webMethodClient","initModule","webMethodModules","boundFetch","url","options","authHeaders","defaultContentTypeHeader","getDefaultContentHeader","use","modules","metadata","isEventHandlerModule","isServicePluginModule","isHostModule","buildHostModule","isWebMethodModules","SERVICE_PLUGIN_ERROR_TYPE","apiBaseUrl","DEFAULT_API_URL","buildRESTDescriptor","runWithoutContext","isAmbassadorModule","toHTTPModule","relativeUrl","fetchOptions","finalUrl","isObject","key","value","PUBLIC_METADATA_KEY","setHeaders","headers","contextType","opts","wixContext","query","variables","res","FetchErrorResponse","data","errors"]}
@@ -1,4 +0,0 @@
1
- import { createRequire as _createRequire } from 'node:module';
2
- const require = _createRequire(import.meta.url);
3
- import{a as x}from"./chunk-4BHNJVL2.js";import{a as b}from"./chunk-6HSUK2A2.js";import"./chunk-QOUZ6J7N.js";import{a as U,e as S,f as j,s as y,v as I}from"./chunk-LJEYXY4V.js";import"./chunk-B4SDDVMV.js";import"./chunk-7VOKCPZP.js";import"./chunk-WJTPY35F.js";import"./chunk-FKBCPMYK.js";import"./chunk-N5D4TFKX.js";import"./chunk-C4SXZWXS.js";import{Ba as n,E as w,cb as P,g as v,oa as h}from"./chunk-FMIXY6J5.js";import{c as C,e as l,f as m}from"./chunk-JXE3LQ2S.js";import{e as u,h as o}from"./chunk-V4TR6DCM.js";o();o();var f=u(C(),1);o();var D=u(C(),1);async function M(e,r,s){let t=new U(r),i=await S({siteId:s,projectFolder:e.projectFolder,siteListClient:t});return(0,D.match)(i,{NotConfigured:()=>{throw new l({code:m.SiteConfiguredRequired(),cause:null})},NotFound:()=>{throw new l({code:m.SiteConfiguredRequired(),cause:null})},Resolved:({site:a})=>a})}o();var d=u(C(),1);var A=({model:e,site:r,tag:s})=>{let t=e.components.filter(a=>(0,d.isType)(a,n.DashboardPage)||(0,d.isType)(a,n.DashboardPlugin)||(0,d.isType)(a,n.DashboardMenuPlugin)),i={appId:e.config.appId,site:r,tag:s};return t[0]?I(t[0],i):y(h.Dashboard(),i)};o();function E(e){console.log(e)}async function H(e,r,s){let t=await w();if(!t)throw new l({code:m.AuthenticationRequired(),cause:null});s.errorReporter.setUser({id:t.userInfo.userId}),b(s.biLogger,t.userInfo.userId);let i=v({type:"backoffice",getAppToken:()=>t.getAccessToken()}),a=await M(r,i,e.siteId),T=r.components.filter(g=>(0,f.isType)(g,n.Api)||(0,f.isType)(g,n.Event)||(0,f.isType)(g,n.ServicePlugin)),{serveUrl:k,backendServerUrl:R}=e.baseUrl?{serveUrl:e.baseUrl,backendServerUrl:void 0}:await P(r.config.appId,r.projectFolder,s.biLogger,i,T.length>0),F=new j(i),L=await x({model:r,arm:F,serveUrl:k,backendServerUrl:R}),q=A({site:a,model:r,tag:L});E(q)}export{H as nonInteractivePreview};
4
- //# sourceMappingURL=preview-TM7JAWFS.js.map
@@ -1,4 +0,0 @@
1
- import { createRequire as _createRequire } from 'node:module';
2
- const require = _createRequire(import.meta.url);
3
- import{a as E}from"./chunk-5OZZ7R6I.js";import{a as j,b as y}from"./chunk-6HSUK2A2.js";import{a as P}from"./chunk-FKBCPMYK.js";import{B as C,D as h,I as w,t as v,yb as I,zb as x}from"./chunk-FMIXY6J5.js";import{U as u,Z as g,a as c,b,e as l,f}from"./chunk-JXE3LQ2S.js";import{e as F,h as s}from"./chunk-V4TR6DCM.js";s();var i=F(b(),1);import{cwd as D}from"node:process";async function M(e,{biLogger:o,errorReporter:r}){r.setContext("app info",{appId:e.config.appId,projectId:e.config.projectId}),o.updateDefaults({_appId:e.config.appId})}function S(e,o){switch(e){case"dev":case"preview":return{is_mocking_values:o.some(r=>r.type==="EmbeddedScript"&&r.paramsOverride)};default:return}}async function T(e,{biLogger:o,errorReporter:r},n,m){await L(e,{biLogger:o,errorReporter:r},async t=>{if(t.components.length===0&&!m?.skipProjectValidation)throw new l({code:f.NoExtensionsFound(),cause:null});o.updateDefaults({command:e.name()});let a=w(t.projectFolder);await u(i.default.createElement(v,{value:o},i.default.createElement(C,{value:r},i.default.createElement(h,{onLogin:p=>{r.setUser({id:p.userId}),j(o,p.userId)}},i.default.createElement(g,{messages:E},i.default.createElement(P,{filePath:a},i.default.createElement(x,{value:t,watchForChanges:m?.watchForModelChanges},n)))))))})}async function L(e,o,r){let n=await I(D());await M(n,o),o.biLogger.updateDefaults({command:e.name()});let m=y({biLogger:o.biLogger,command:e,cliVersion:c,flow:"Apps",projectId:n.config.projectId,extensions:n.components.reduce((t,a)=>{let d=t[a.type];return t[a.type]=d?d+1:1,t},{}),extraFields:S(e.name(),n.components)});try{await r(n),m.succeed()}catch(t){throw m.failed(t),t}}export{T as renderCommand,L as runCommand};
4
- //# sourceMappingURL=render-command-QEQ3L7OX.js.map
@@ -1,4 +0,0 @@
1
- import { createRequire as _createRequire } from 'node:module';
2
- const require = _createRequire(import.meta.url);
3
- import{a}from"./chunk-PCBMS46R.js";import"./chunk-V4TR6DCM.js";export{a as VersionType};
4
- //# sourceMappingURL=types.impl-L2DPGJ77.js.map