@wix/cli-app 1.1.71 → 1.1.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{CreateVersionCommand-NCNK3B4H.js → CreateVersionCommand-FCCW72OR.js} +14 -14
- package/build/{DevCommand-YDLV2KJM.js → DevCommand-MEZJSQNF.js} +12 -12
- package/build/{GenerateCommand-MHQOLSPN.js → GenerateCommand-2LLGGJP3.js} +707 -509
- package/build/GenerateCommand-2LLGGJP3.js.map +1 -0
- package/build/{LogsCommand-727BQUJX.js → LogsCommand-RX7XJGDW.js} +4 -4
- package/build/PreviewCommand-R4CKNYGV.js +23 -0
- package/build/{ReleaseCommand-VU6V7GEV.js → ReleaseCommand-I4QRSGS4.js} +15 -15
- package/build/{ServeCommand-KBS3RLPD.js → ServeCommand-ELSJTRIC.js} +14 -14
- package/build/ServeCommand-ELSJTRIC.js.map +1 -0
- package/build/{build-E34NPSSH.js → build-DS5D6JSR.js} +33 -14
- package/build/build-DS5D6JSR.js.map +1 -0
- package/build/{chunk-MRMIQOH4.js → chunk-2QGU64R5.js} +4 -3
- package/build/{chunk-DQXLAGEX.js → chunk-4T3TWPYN.js} +2 -2
- package/build/{chunk-EAPMWJ4C.js → chunk-5SSFYBVB.js} +60 -35
- package/build/chunk-5SSFYBVB.js.map +1 -0
- package/build/{chunk-HY44AJBX.js → chunk-7DBU2MOT.js} +10 -3
- package/build/chunk-7DBU2MOT.js.map +1 -0
- package/build/{chunk-GTZDYTFO.js → chunk-7NMRLTE4.js} +3 -3
- package/build/{chunk-A6GRJNEC.js → chunk-BHATQVOE.js} +16 -8
- package/build/chunk-BHATQVOE.js.map +1 -0
- package/build/{chunk-PZFZCK52.js → chunk-CMCLHAKY.js} +214 -107
- package/build/{chunk-PZFZCK52.js.map → chunk-CMCLHAKY.js.map} +1 -1
- package/build/{chunk-75XWKPKF.js → chunk-FOUN6JMR.js} +3 -3
- package/build/{chunk-JXZFXR5O.js → chunk-LARBBDM6.js} +3 -3
- package/build/{chunk-IE6RONCN.js → chunk-N6EVOU72.js} +5 -5
- package/build/{chunk-PH2UYNX4.js → chunk-O333IOVL.js} +8 -8
- package/build/{chunk-Q2DE27PN.js → chunk-PWHSKMWU.js} +3 -3
- package/build/{chunk-G3X4DX2P.js → chunk-PXS7X4U5.js} +8975 -8690
- package/build/chunk-PXS7X4U5.js.map +1 -0
- package/build/{chunk-FG4PQXAC.js → chunk-QEW5QI3A.js} +3 -3
- package/build/{chunk-P7PN4CHV.js → chunk-QQGP63OH.js} +3 -3
- package/build/{chunk-N4ETYB2B.js → chunk-RTSR3LLH.js} +5 -5
- package/build/{chunk-VVLESE4P.js → chunk-TSO3L2US.js} +4 -2
- package/build/chunk-TSO3L2US.js.map +1 -0
- package/build/{chunk-4R3KUQGQ.js → chunk-YQF5FOXN.js} +3 -3
- package/build/cloudflare-runtime/entry.js +33 -13
- package/build/cloudflare-runtime/getRegisteredExtensions.js +33 -13
- package/build/index.js +20 -20
- package/build/platform-sdk/browser-PMX3IJHS.js +5 -0
- package/build/platform-sdk/browser-PMX3IJHS.js.map +1 -0
- package/build/platform-sdk/chunk-6NLQHDP6.js +2 -0
- package/build/platform-sdk/chunk-6NLQHDP6.js.map +1 -0
- package/build/platform-sdk/chunk-BGTZ3RNN.js +2 -0
- package/build/platform-sdk/chunk-BGTZ3RNN.js.map +1 -0
- package/build/platform-sdk/{chunk-EERHWVVD.js → chunk-XYIDODIB.js} +2 -2
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/editor.js +1 -1
- package/build/platform-sdk/sdk-context.js +1 -1
- package/build/platform-sdk/sdk-context.js.map +1 -1
- package/build/platform-sdk/site.js +1 -1
- package/build/{preview-NOGUOO4T.js → preview-RYKMQKPO.js} +12 -12
- package/build/{render-command-WBYARJYH.js → render-command-MZQF2OKS.js} +6 -6
- package/package.json +8 -7
- package/templates/blocks-support/dependencies.json +6 -0
- package/templates/blocks-widget/files/api.ts.ejs +1 -1
- package/templates/blocks-widget/files/widget.ts.ejs +8 -1
- package/templates/blocks-widget-panel/files/panel.ts.ejs +10 -1
- package/templates/custom-element/dependencies.json +1 -1
- package/templates/dashboard-modal/dependencies.json +1 -1
- package/templates/site-plugin/dependencies.json +1 -1
- package/build/GenerateCommand-MHQOLSPN.js.map +0 -1
- package/build/PreviewCommand-RZYVEWL4.js +0 -23
- package/build/ServeCommand-KBS3RLPD.js.map +0 -1
- package/build/build-E34NPSSH.js.map +0 -1
- package/build/chunk-A6GRJNEC.js.map +0 -1
- package/build/chunk-EAPMWJ4C.js.map +0 -1
- package/build/chunk-G3X4DX2P.js.map +0 -1
- package/build/chunk-HY44AJBX.js.map +0 -1
- package/build/chunk-VVLESE4P.js.map +0 -1
- package/build/platform-sdk/browser-5P5TLLCL.js +0 -5
- package/build/platform-sdk/browser-5P5TLLCL.js.map +0 -1
- package/build/platform-sdk/chunk-42XIZ4MH.js +0 -2
- package/build/platform-sdk/chunk-42XIZ4MH.js.map +0 -1
- package/build/platform-sdk/chunk-CR7DIEFQ.js +0 -2
- package/build/platform-sdk/chunk-CR7DIEFQ.js.map +0 -1
- /package/build/{CreateVersionCommand-NCNK3B4H.js.map → CreateVersionCommand-FCCW72OR.js.map} +0 -0
- /package/build/{DevCommand-YDLV2KJM.js.map → DevCommand-MEZJSQNF.js.map} +0 -0
- /package/build/{LogsCommand-727BQUJX.js.map → LogsCommand-RX7XJGDW.js.map} +0 -0
- /package/build/{PreviewCommand-RZYVEWL4.js.map → PreviewCommand-R4CKNYGV.js.map} +0 -0
- /package/build/{ReleaseCommand-VU6V7GEV.js.map → ReleaseCommand-I4QRSGS4.js.map} +0 -0
- /package/build/{chunk-MRMIQOH4.js.map → chunk-2QGU64R5.js.map} +0 -0
- /package/build/{chunk-DQXLAGEX.js.map → chunk-4T3TWPYN.js.map} +0 -0
- /package/build/{chunk-GTZDYTFO.js.map → chunk-7NMRLTE4.js.map} +0 -0
- /package/build/{chunk-75XWKPKF.js.map → chunk-FOUN6JMR.js.map} +0 -0
- /package/build/{chunk-JXZFXR5O.js.map → chunk-LARBBDM6.js.map} +0 -0
- /package/build/{chunk-IE6RONCN.js.map → chunk-N6EVOU72.js.map} +0 -0
- /package/build/{chunk-PH2UYNX4.js.map → chunk-O333IOVL.js.map} +0 -0
- /package/build/{chunk-Q2DE27PN.js.map → chunk-PWHSKMWU.js.map} +0 -0
- /package/build/{chunk-FG4PQXAC.js.map → chunk-QEW5QI3A.js.map} +0 -0
- /package/build/{chunk-P7PN4CHV.js.map → chunk-QQGP63OH.js.map} +0 -0
- /package/build/{chunk-N4ETYB2B.js.map → chunk-RTSR3LLH.js.map} +0 -0
- /package/build/{chunk-4R3KUQGQ.js.map → chunk-YQF5FOXN.js.map} +0 -0
- /package/build/platform-sdk/{chunk-EERHWVVD.js.map → chunk-XYIDODIB.js.map} +0 -0
- /package/build/{preview-NOGUOO4T.js.map → preview-RYKMQKPO.js.map} +0 -0
- /package/build/{render-command-WBYARJYH.js.map → render-command-MZQF2OKS.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{wixContext as r}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(n,o){return c(()=>e(n,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 r.client<"u"?r.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof r.elevatedClient<"u"?r.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!i))return{initWixModules(n,o){if(o){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 c(()=>i.use(n))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return c(()=>t.use(n))},fetchWithAuth:(n,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(n,o)},async graphql(n,o,l){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(n,o,l)}}}function c(e){let t=globalThis.__wix_context__,i={client:r.client,elevatedClient:r.elevatedClient},n;globalThis.__wix_context__=void 0,r.client=void 0,r.elevatedClient=void 0,typeof $wixContext<"u"&&(n={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,r.client=i.client,r.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=n.client,$wixContext.elevatedClient=n.elevatedClient)}}function p(e,t){return{...e,...Object.fromEntries(t.map(i=>[i,(...n)=>{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)[i].apply(void 0,n)}]))}}function F(e){return p({__type:"host",create:t=>Object.entries(e).reduce((i,[n,o])=>({...i,[n]:o(t)}),{})},Object.keys(e))}var y=e=>e!=null&&e!=="",a=e=>f(e,y);function f(e,t=i=>!!i){if(!e)return{};let i={};for(let n in e)t(e[n],n)&&(i[n]=e[n]);return i}var h=e=>{let t=a({"app.id":e.appId,"app.version":e.appVersion,"app.instanceId":e.appInstanceId,"extension.id":e.extensionId,"extension.name":e.extensionName,"extension.type":e.extensionType,platform:e.platform}),i=f({"extension.data":a({...e.extensionData}),site:a({url:e.siteUrl,id:e.tenantType==="SITE"?e.tenantId:void 0}),account:a({id:e.tenantType==="ACCOUNT"?e.tenantId:void 0})},n=>!!n&&Object.keys(n).length>0);return{tags:t,contexts:i}},_=class{constructor(e){this.message=e,this.captureException=()=>{console.error(this.message)},this.captureMessage=()=>{console.error(this.message)},this.startSpan=(t,i)=>(console.error(this.message),Promise.resolve(i(void 0))),this.addBreadcrumb=()=>{console.error(this.message)}}},s=e=>new _(e);var w=(e,{tags:t,contexts:i})=>{t&&e.setTags(t),i&&Object.entries(i).forEach(([n,o])=>typeof o<"u"&&e.setContext(n,o))},S=(e,t)=>{if(!t)return;let{tags:i,contexts:n}=h(t);w(e,{tags:i,contexts:n})},C=["onLoad","forceLoad"],M=class{constructor(e){this.options=e,this.isResolved=!1,this.validateOptions=t=>{let i=C.filter(n=>typeof t.sentrySDK?.[n]!="function");if(i.length>0)throw new Error(`Missing the following options.sentrySDK methods: ${i.join(", ")}`)},this.validateOptions(e)}init(){let{sentrySDK:e,transport:t,hostContext:i,dsn:n,release:o,environment:l,tracesSampleRate:g=1,debug:v=!1}=this.options,u=new e.Scope,d=new e.BrowserClient({dsn:n,transport:t??e.makeFetchTransport,integrations:e.getDefaultIntegrations({}),stackParser:e.defaultStackParser,tracesSampleRate:g||1,debug:v,environment:l,release:o});return S(u,i),u.setClient(d),d.init(),{sentrySDK:e,scope:u,sentryClient:d}}loadFullSDK(){return this.promise?this.promise:(this.promise=new Promise(e=>{this.options.sentrySDK.onLoad(()=>{this.isResolved||(this.isResolved=!0,e(this.init()))})}),this.options.sentrySDK.forceLoad(),this.promise)}},W=class extends M{constructor(){super(...arguments),this.addBreadcrumb=e=>{let t={type:e.type,category:e.category,message:e.message,level:e.level,data:e.data};this.loadFullSDK().then(({scope:i})=>{i.addBreadcrumb(t)})},this.captureException=(e,t)=>{this.loadFullSDK().then(({sentryClient:i,scope:n})=>{i.captureException(e,{captureContext:{level:t?.level??"error",tags:t?.tags,contexts:t?.contexts}},n)})},this.captureMessage=(e,t)=>{this.loadFullSDK().then(({sentryClient:i,scope:n})=>{i.captureMessage(e,t?.level??"error",{captureContext:{level:t?.level??"error",tags:t?.tags,contexts:t?.contexts}},n)})},this.startSpan=async(e,t)=>{let i={name:e.name,tags:e.tags};return this.loadFullSDK().then(({sentrySDK:n,scope:o})=>n.startSpan({...i,scope:o},t))}}},b=e=>`Sentry SDK version "${e}" is not supported. Please make sure to use monitoring SDK only in supported environments.`,D=e=>{try{return parseInt(e.split(".")[0],10)}catch{console.warn("Failed to parse Sentry SDK version");return}},m=({sentrySDK:e,dsn:t,...i})=>{if(!e)return s("Unsupported environment - Sentry SDK is not loaded into the environment. Please make sure to use monitoring SDK only in supported environments.");if(!t)return s("Missing Sentry DSN in the app's monitoring configuration. Please make sure to set it.");try{let n=e.SDK_VERSION&&D(e.SDK_VERSION);return n&&n<7?s(b(e.SDK_VERSION)):new W({...i,dsn:t,sentrySDK:e})}catch(n){return s(`Failed to initialize monitoring client: ${n.message}`)}};var E=e=>e?.type==="SENTRY",L=({sentrySDK:e,sentryTransport:t,monitoringConfig:i,hostContext:n})=>{if(E(i)){let{sentryOptions:o}=i;return()=>m({dsn:o?.dsn,hostContext:n,sentrySDK:e,transport:t})}return()=>s("Invalid monitoring configuration. Please check the monitoring setup of your application.")};export{F as a,L as b};
|
|
2
|
+
//# sourceMappingURL=chunk-6NLQHDP6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk-runtime/build/context-v2.js","../../../node_modules/@wix/sdk-runtime/build/host-modules.js","../../../node_modules/@wix/monitoring/build/index.js","../../../node_modules/@wix/monitoring-browser-sentry/build/index.js","../../../node_modules/@wix/monitoring-browser-sdk-host/build/index.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n throw new Error('An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { EventDefinition, ServicePluginDefinition, } from '@wix/sdk-types';\nimport { resolveContext } from './context.js';\nexport { EventDefinition, ServicePluginDefinition, };\nexport function contextualizeHostModuleV2(hostModule, props) {\n return {\n ...hostModule,\n ...Object.fromEntries(props.map((prop) => [\n prop,\n (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(hostModule)[prop].apply(undefined, args);\n },\n ])),\n };\n}\nexport function contextualizeRESTModuleV2(restModule, elevated) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n // @ts-expect-error - if there is no context, we want to behave like the original module\n return restModule.apply(undefined, args);\n }\n return (context\n .initWixModules(restModule, elevated)\n // @ts-expect-error - we know the args here are meant to be passed to the initalized module\n .apply(undefined, args));\n });\n}\nexport function contextualizeEventDefinitionModuleV2(eventDefinition) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n contextualMethod.__type = eventDefinition.__type;\n contextualMethod.type = eventDefinition.type;\n contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;\n contextualMethod.transformations = eventDefinition.transformations;\n return contextualMethod;\n}\nexport function contextualizeSerivcePluginModuleV2(servicePlugin) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n contextualMethod.__type = servicePlugin.__type;\n contextualMethod.componentType = servicePlugin.componentType;\n contextualMethod.methods = servicePlugin.methods;\n return contextualMethod;\n}\n","import { contextualizeHostModuleV2 } from './context-v2.js';\nexport function createHostModule(hostModuleAPI) {\n return contextualizeHostModuleV2({\n __type: 'host',\n create: (host) => Object.entries(hostModuleAPI).reduce((acc, [key, fn]) => ({\n ...acc,\n [key]: fn(host),\n }), {}),\n }, Object.keys(hostModuleAPI));\n}\n","// src/context/context-utils.ts\nvar validValue = (value) => value !== void 0 && value !== null && value !== \"\";\nvar pickByValidValues = (obj) => pickBy(obj, validValue);\nfunction pickBy(object, predicate = (value) => !!value) {\n if (!object) {\n return {};\n }\n const result = {};\n for (const key in object) {\n if (predicate(object[key], key)) {\n result[key] = object[key];\n }\n }\n return result;\n}\nvar generateTagsAndContext = (context) => {\n const tags = pickByValidValues({\n \"app.id\": context.appId,\n \"app.version\": context.appVersion,\n \"app.instanceId\": context.appInstanceId,\n \"extension.id\": context.extensionId,\n \"extension.name\": context.extensionName,\n \"extension.type\": context.extensionType,\n platform: context.platform\n });\n const contexts = pickBy(\n {\n \"extension.data\": pickByValidValues({\n ...context.extensionData\n }),\n site: pickByValidValues({\n url: context.siteUrl,\n id: context.tenantType === \"SITE\" ? context.tenantId : void 0\n }),\n account: pickByValidValues({\n id: context.tenantType === \"ACCOUNT\" ? context.tenantId : void 0\n })\n },\n (value) => !!value && Object.keys(value).length > 0\n );\n return {\n tags,\n contexts\n };\n};\n\n// src/fallback-client.ts\nvar FallbackMonitoringClient = class {\n constructor(message) {\n this.message = message;\n this.captureException = () => {\n console.error(this.message);\n };\n this.captureMessage = () => {\n console.error(this.message);\n };\n this.startSpan = (spanOptions, callback) => {\n console.error(this.message);\n return Promise.resolve(callback(void 0));\n };\n this.addBreadcrumb = () => {\n console.error(this.message);\n };\n }\n};\nvar createFallbackMonitoringClient = (message) => {\n return new FallbackMonitoringClient(message);\n};\nexport {\n createFallbackMonitoringClient,\n generateTagsAndContext\n};\n","// src/factory.ts\nimport { createFallbackMonitoringClient } from \"@wix/monitoring\";\n\n// src/utils.ts\nimport { generateTagsAndContext } from \"@wix/monitoring\";\nvar setTagsAndContextsOnScope = (scope, { tags, contexts }) => {\n if (tags) {\n scope.setTags(tags);\n }\n if (contexts) {\n Object.entries(contexts).forEach(\n ([key, value]) => typeof value !== \"undefined\" && scope.setContext(key, value)\n );\n }\n};\nvar setHostContextOnScope = (scope, hostContext) => {\n if (!hostContext) {\n return;\n }\n const { tags, contexts } = generateTagsAndContext(hostContext);\n setTagsAndContextsOnScope(scope, { tags, contexts });\n};\n\n// src/abstract-browser-client.ts\nvar MandatorySDKMethods = [\"onLoad\", \"forceLoad\"];\nvar AbstractSentryBrowserClient = class {\n constructor(options) {\n this.options = options;\n this.isResolved = false;\n this.validateOptions = (options) => {\n const missingSDKMethods = MandatorySDKMethods.filter(\n (method) => typeof options.sentrySDK?.[method] !== \"function\"\n );\n if (missingSDKMethods.length > 0) {\n throw new Error(\n `Missing the following options.sentrySDK methods: ${missingSDKMethods.join(\", \")}`\n );\n }\n };\n this.validateOptions(options);\n }\n init() {\n const {\n sentrySDK,\n transport,\n hostContext,\n dsn,\n release,\n environment,\n tracesSampleRate = 1,\n debug = false\n } = this.options;\n const scope = new sentrySDK.Scope();\n const sentryClient = new sentrySDK.BrowserClient({\n dsn,\n transport: transport ?? sentrySDK.makeFetchTransport,\n integrations: sentrySDK.getDefaultIntegrations({}),\n stackParser: sentrySDK.defaultStackParser,\n tracesSampleRate: tracesSampleRate || 1,\n debug,\n environment,\n release\n });\n setHostContextOnScope(scope, hostContext);\n scope.setClient(sentryClient);\n sentryClient.init();\n return {\n sentrySDK,\n scope,\n sentryClient\n };\n }\n loadFullSDK() {\n if (this.promise) {\n return this.promise;\n }\n this.promise = new Promise((resolve) => {\n this.options.sentrySDK.onLoad(() => {\n if (this.isResolved) {\n return;\n }\n this.isResolved = true;\n resolve(this.init());\n });\n });\n this.options.sentrySDK.forceLoad();\n return this.promise;\n }\n};\n\n// src/browser/client.ts\nvar SentryBrowserClient = class extends AbstractSentryBrowserClient {\n constructor() {\n super(...arguments);\n /**\n * Records a new breadcrumb which will be attached to future events.\n * Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.\n * @param breadcrumb The breadcrumb to record.\n */\n this.addBreadcrumb = (breadcrumb) => {\n const filteredBreadcrumb = {\n type: breadcrumb.type,\n category: breadcrumb.category,\n message: breadcrumb.message,\n level: breadcrumb.level,\n data: breadcrumb.data\n };\n this.loadFullSDK().then(({ scope }) => {\n scope.addBreadcrumb(filteredBreadcrumb);\n });\n };\n /**\n * Captures an exception event and sends it to Sentry.\n * @param error The error to capture\n * @param captureContext Optional additional data to attach to the Sentry event.\n */\n this.captureException = (error, captureContext) => {\n this.loadFullSDK().then(({ sentryClient, scope }) => {\n sentryClient.captureException(\n error,\n {\n captureContext: {\n level: captureContext?.level ?? \"error\",\n tags: captureContext?.tags,\n contexts: captureContext?.contexts\n }\n },\n scope\n );\n });\n };\n /**\n * Captures a message event and sends it to Sentry.\n * @param message The message to capture\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n */\n this.captureMessage = (message, captureContext) => {\n this.loadFullSDK().then(({ sentryClient, scope }) => {\n sentryClient.captureMessage(\n message,\n captureContext?.level ?? \"error\",\n {\n captureContext: {\n level: captureContext?.level ?? \"error\",\n tags: captureContext?.tags,\n contexts: captureContext?.contexts\n }\n },\n scope\n );\n });\n };\n /**\n * Wraps a function with a span and finishes the span after the function is done. The created span is the active span and will be used as parent by other spans created inside the function, as long as the function is executed while the scope is active.\n * @param spanOptions The options for the span\n * @param callback The function to wrap with a span\n * @returns The return value of the callback\n */\n this.startSpan = async (spanOptions, callback) => {\n const filteredSpanOptions = {\n name: spanOptions.name,\n tags: spanOptions.tags\n };\n return this.loadFullSDK().then(({ sentrySDK, scope }) => {\n return sentrySDK.startSpan({ ...filteredSpanOptions, scope }, callback);\n });\n };\n }\n};\n\n// src/factory.ts\nvar unsupportedEnvironmentMessage = (version) => `Sentry SDK version \"${version}\" is not supported. Please make sure to use monitoring SDK only in supported environments.`;\nvar major = (version) => {\n try {\n return parseInt(version.split(\".\")[0], 10);\n } catch {\n console.warn(\"Failed to parse Sentry SDK version\");\n return void 0;\n }\n};\nvar createSentryBrowserClient = ({\n sentrySDK,\n dsn,\n ...options\n}) => {\n if (!sentrySDK) {\n return createFallbackMonitoringClient(\n \"Unsupported environment - Sentry SDK is not loaded into the environment. Please make sure to use monitoring SDK only in supported environments.\"\n );\n }\n if (!dsn) {\n return createFallbackMonitoringClient(\n \"Missing Sentry DSN in the app's monitoring configuration. Please make sure to set it.\"\n );\n }\n try {\n const sentrySdkMajorVersion = sentrySDK.SDK_VERSION && major(sentrySDK.SDK_VERSION);\n if (sentrySdkMajorVersion && sentrySdkMajorVersion < 7) {\n return createFallbackMonitoringClient(\n unsupportedEnvironmentMessage(sentrySDK.SDK_VERSION)\n );\n }\n return new SentryBrowserClient({ ...options, dsn, sentrySDK });\n } catch (e) {\n return createFallbackMonitoringClient(\n `Failed to initialize monitoring client: ${e.message}`\n );\n }\n};\nexport {\n createSentryBrowserClient\n};\n","// src/monitoring-client.ts\nimport { createFallbackMonitoringClient } from \"@wix/monitoring\";\nimport { createSentryBrowserClient } from \"@wix/monitoring-browser-sentry\";\nvar isSentryConfig = (monitoringConfig) => monitoringConfig?.type === \"SENTRY\";\nvar getMonitoringClientFunction = ({\n sentrySDK,\n sentryTransport,\n monitoringConfig,\n hostContext\n}) => {\n if (isSentryConfig(monitoringConfig)) {\n const { sentryOptions } = monitoringConfig;\n return () => createSentryBrowserClient({\n dsn: sentryOptions?.dsn,\n hostContext,\n sentrySDK,\n transport: sentryTransport\n });\n }\n return () => createFallbackMonitoringClient(\n \"Invalid monitoring configuration. Please check the monitoring setup of your application.\"\n );\n};\nexport {\n getMonitoringClientFunction\n};\n"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,mBACpB,SAASC,GAAiB,CAC7B,IAAMC,EAAa,OAAO,YAAgB,KAAe,YAAY,eAC/D,YAAY,eACZ,OAAO,WAAW,gBAAoB,KACpC,WAAW,gBAAgB,eACzB,WAAW,gBAAgB,eAC3B,OACV,GAAIA,EACA,MAAO,CAEH,eAAeC,EAASC,EAAU,CAC9B,OAAOC,EAAkB,IAAMH,EAAWC,EAASC,CAAQ,CAAC,CAChE,EACA,eAAgB,CACZ,MAAM,IAAI,MAAM,gDAAgD,CACpE,EACA,SAAU,CACN,MAAM,IAAI,MAAM,0CAA0C,CAC9D,CACJ,EAEJ,IAAME,EAAmB,OAAO,YAAgB,IAC1C,YAAY,OACZ,OAAON,EAAW,OAAW,IACzBA,EAAW,OACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,OAC3B,OACRO,EAAiB,OAAO,YAAgB,IACxC,YAAY,eACZ,OAAOP,EAAW,eAAmB,IACjCA,EAAW,eACX,OAAO,WAAW,gBAAoB,IAClC,WAA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8BlB,EAAU,WAAW,CACrD,EAEK,IAAIS,EAAoB,CAAE,GAAGZ,EAAS,IAAAK,EAAK,UAAAF,CAAU,CAAC,CAC/D,OAASwB,EAAG,CACV,OAAOF,EACL,2CAA2CE,EAAE,OAAO,EACtD,CACF,CACF,EC7MA,IAAIC,EAAkBC,GAAqBA,GAAkB,OAAS,SAClEC,EAA8B,CAAC,CACjC,UAAAC,EACA,gBAAAC,EACA,iBAAAH,EACA,YAAAI,CACF,IAAM,CACJ,GAAIL,EAAeC,CAAgB,EAAG,CACpC,GAAM,CAAE,cAAAK,CAAc,EAAIL,EAC1B,MAAO,IAAMM,EAA0B,CACrC,IAAKD,GAAe,IACpB,YAAAD,EACA,UAAAF,EACA,UAAWC,CACb,CAAC,CACH,CACA,MAAO,IAAMI,EACX,0FACF,CACF","names":["wixContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext","contextualizeHostModuleV2","hostModule","props","prop","args","context","resolveContext","createHostModule","hostModuleAPI","contextualizeHostModuleV2","host","acc","key","fn","validValue","value","pickByValidValues","obj","pickBy","object","predicate","result","key","generateTagsAndContext","context","tags","contexts","FallbackMonitoringClient","message","spanOptions","callback","createFallbackMonitoringClient","setTagsAndContextsOnScope","scope","tags","contexts","key","value","setHostContextOnScope","hostContext","generateTagsAndContext","MandatorySDKMethods","AbstractSentryBrowserClient","options","missingSDKMethods","method","sentrySDK","transport","dsn","release","environment","tracesSampleRate","debug","sentryClient","resolve","SentryBrowserClient","breadcrumb","filteredBreadcrumb","error","captureContext","message","spanOptions","callback","filteredSpanOptions","unsupportedEnvironmentMessage","version","major","createSentryBrowserClient","createFallbackMonitoringClient","sentrySdkMajorVersion","e","isSentryConfig","monitoringConfig","getMonitoringClientFunction","sentrySDK","sentryTransport","hostContext","sentryOptions","createSentryBrowserClient","createFallbackMonitoringClient"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{wixContext as n}from"@wix/sdk-context";function d(o,t){return(...i)=>{let e=x();return e?e.initWixModules(o,t).apply(void 0,i):o.apply(void 0,i)}}function x(){let o=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(o)return{initWixModules(e,l){return r(()=>o(e,l))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof n.client<"u"?n.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof n.elevatedClient<"u"?n.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!i))return{initWixModules(e,l){if(l){if(!i)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return r(()=>i.use(e))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return r(()=>t.use(e))},fetchWithAuth:(e,l)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(e,l)},async graphql(e,l,u){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(e,l,u)}}}function r(o){let t=globalThis.__wix_context__,i={client:n.client,elevatedClient:n.elevatedClient},e;globalThis.__wix_context__=void 0,n.client=void 0,n.elevatedClient=void 0,typeof $wixContext<"u"&&(e={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return o()}finally{globalThis.__wix_context__=t,n.client=i.client,n.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=e.client,$wixContext.elevatedClient=e.elevatedClient)}}export{d as a,r as b};
|
|
2
|
+
//# sourceMappingURL=chunk-BGTZ3RNN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context-v2.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n throw new Error('An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { EventDefinition, ServicePluginDefinition, } from '@wix/sdk-types';\nimport { resolveContext } from './context.js';\nexport { EventDefinition, ServicePluginDefinition, };\nexport function contextualizeHostModuleV2(hostModule, props) {\n return {\n ...hostModule,\n ...Object.fromEntries(props.map((prop) => [\n prop,\n (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(hostModule)[prop].apply(undefined, args);\n },\n ])),\n };\n}\nexport function contextualizeRESTModuleV2(restModule, elevated) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n // @ts-expect-error - if there is no context, we want to behave like the original module\n return restModule.apply(undefined, args);\n }\n return (context\n .initWixModules(restModule, elevated)\n // @ts-expect-error - we know the args here are meant to be passed to the initalized module\n .apply(undefined, args));\n });\n}\nexport function contextualizeEventDefinitionModuleV2(eventDefinition) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n contextualMethod.__type = eventDefinition.__type;\n contextualMethod.type = eventDefinition.type;\n contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;\n contextualMethod.transformations = eventDefinition.transformations;\n return contextualMethod;\n}\nexport function contextualizeSerivcePluginModuleV2(servicePlugin) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n contextualMethod.__type = servicePlugin.__type;\n contextualMethod.componentType = servicePlugin.componentType;\n contextualMethod.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Ae,CAACC,EAAcC,IAAgB,CAC1C,GAAI,CAACL,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,cAAcI,EAAcC,CAAW,CACnE,EACA,MAAM,QAAQC,EAAOC,EAAWC,EAAM,CAClC,GAAI,CAACR,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,QAAQM,EAAOC,EAAWC,CAAI,CAC1D,CACJ,CACJ,CAwCO,SAASC,EAAkBC,EAAI,CAClC,IAAMC,EAAgB,WAAW,gBAC3BC,EAAgB,CAClB,OAAQC,EAAW,OACnB,eAAgBA,EAAW,cAC/B,EACIC,EACJ,WAAW,gBAAkB,OAC7BD,EAAW,OAAS,OACpBA,EAAW,eAAiB,OACxB,OAAO,YAAgB,MACvBC,EAAiB,CACb,OAAQ,aAAa,OACrB,eAAgB,aAAa,cACjC,EACA,OAAO,YAAY,OACnB,OAAO,YAAY,gBAEvB,GAAI,CACA,OAAOJ,EAAG,CACd,QACA,CACI,WAAW,gBAAkBC,EAC7BE,EAAW,OAASD,EAAc,OAClCC,EAAW,eAAiBD,EAAc,eACtC,OAAO,YAAgB,MACvB,YAAY,OAASE,EAAe,OACpC,YAAY,eAAiBA,EAAe,eAEpD,CACJ","names":["wixContext","contextualizeRESTModuleV2","restModule","elevated","args","context","resolveContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","wixContext","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as x}from"./chunk-BGTZ3RNN.js";import{a as b,b as A,d as H}from"./chunk-7EYXEF6M.js";import{f as v}from"./chunk-SBZEOPXX.js";H();import{wixContext as N}from"@wix/sdk-context";var B=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}`)}},P=e=>a=>async s=>{let d,r=t=>{if(d=e(s)(t),d.url===void 0)throw new Error("Url was not successfully created for this request, please reach out to support channels for assistance.");let{method:i,url:o,params:p}=d;return{...d,method:B(i),url:o,data:d.data,params:p}};try{let t=await a.request(r);if(d===void 0)throw new Error("Request options were not created for this request, please reach out to support channels for assistance.");let i=Array.isArray(d.transformResponse)?d.transformResponse:[d.transformResponse],o=t.data;return i.forEach(p=>{p&&(o=p(t.data,t.headers))}),o}catch(t){throw typeof t=="object"&&t!==null&&"response"in t&&typeof t.response=="object"&&t.response!==null&&"data"in t.response?t.response.data:t}},M=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var R="__metadata",w="www.wixapis.com";var g=class extends Error{constructor(s,d){super(s);v(this,"message");v(this,"response");this.message=s,this.response=d}async details(){let s=await this.response.json();return D(this.response.status,s?.message,s?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:s})}},D=(e,a,s,d)=>({details:{...!s?.validationError&&{applicationError:{description:a,code:e,data:d}},...s},message:a});var C=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 j=e=>e.__type==="host";function S(e,a){return e.create(a)}var G="x-wix-bi-gateway";function W(e,a,s){return{[G]:F({environment:`js-sdk${s?`-${s}`:""}`,"package-name":e.packageName??a?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function F(e){return Object.entries(e).filter(([a,s])=>!!s).map(([a,s])=>`${a}=${s}`).join(",")}function I(e,a,s,d,r,t,i){return x(()=>e({request:async o=>{let p=o({host:t?.HTTPHost||w}),c=p;c.method==="GET"&&c.fallback?.length&&c.params.toString().length>4e3&&(c=p.fallback[0]);let y=`https://${t?.HTTPHost??w}${c.url}`;c.params&&c.params.toString()&&(y+=`?${c.params.toString()}`);try{let u=W(p,a,i),n=await s(y,{method:c.method,...c.data&&{body:JSON.stringify(c.data)},headers:{...u}});if(n.status!==200){let h=null;try{h=await n.json()}catch{}throw V(n.status,h?.message,h?.details,{requestId:n.headers.get("X-Wix-Request-Id"),details:h})}return{data:await n.json(),headers:n.headers,status:n.status,statusText:n.statusText}}catch(u){throw u.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),u}},fetchWithAuth:s,wixAPIFetch:d,getActiveToken:r}))}var V=(e,a,s,d)=>({response:{data:{details:{...!s?.validationError&&{applicationError:{description:a,code:e,data:d}},...s},message:a},status:e}});H();function _(){return{emit(e,...a){for(let s=0,d=this.events[e]||[],r=d.length;s<r;s++)d[s](...a)},events:{},on(e,a){return(this.events[e]||=[]).push(a),()=>{this.events[e]=this.events[e]?.filter(s=>a!==s)}}}}var J=e=>e.__type==="event-definition";function $(e,a,s,d){let r;if(e.isDomainEvent){let i=s,{deletedEvent:o,actionEvent:p,createdEvent:c,updatedEvent:f,...y}=i,u={...d,...y};o?o?.deletedEntity?r={entity:o?.deletedEntity,metadata:u}:r={metadata:u}:p?r={data:p.body,metadata:u}:r={entity:c?.entity??f?.currentEntity,metadata:u}}else r={data:s,metadata:d};let t=e.transformations??(i=>i);return a(t(r))}function L(e){let a=new Map,s=_(),d={...s,getRegisteredEvents:()=>a,async process(r,t={expectedEvents:[]}){let{eventType:i,identity:o,instanceId:p,payload:c}=await this.parseJWT(r),f=[...t.expectedEvents,...Array.from(a.keys()).map(u=>({type:u}))];if(f.length>0&&!f.some(({type:u})=>u===i))throw new Error(`Unexpected event type: ${i}. Expected one of: ${f.map(u=>u.type).join(", ")}`);let y=a.get(i)??[];return await Promise.all(y.map(({eventDefinition:u,handler:n})=>$(u,n,c,{instanceId:p,identity:o}))),{instanceId:p,eventType:i,payload:c,identity:o}},async processRequest(r,t){let i=await r.text();return this.process(i,t)},async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:t,valid:i}=await e.decodeJWT(r);if(!i)throw new Error("JWT is not valid");if(typeof t.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof t.data}`);let o=JSON.parse(t.data),p=o.eventType,c=o.instanceId,f=o.identity?JSON.parse(o.identity):void 0,y=JSON.parse(o.data);return{instanceId:c,eventType:p,payload:y,identity:f}},async parseRequest(r){let t=await r.text();return this.parseJWT(t)},async executeHandlers(r){let t=Array.from(a.keys()).map(o=>({type:o}));if(t.length>0&&!t.some(({type:o})=>o===r.eventType))throw new Error(`Unexpected event type: ${r.eventType}. Expected one of: ${t.map(o=>o.type).join(", ")}`);let i=a.get(r.eventType)??[];await Promise.all(i.map(({eventDefinition:o,handler:p})=>$(o,p,r.payload,{instanceId:r.instanceId,identity:r.identity})))},apps:{AppInstalled:b("AppInstalled")(),AppRemoved:b("AppRemoved")()}};return{initModule(r){return t=>{let i=a.get(r.type)??[];i.push({eventDefinition:r,handler:t}),a.set(r.type,i),s.emit("registered",r)}},client:d}}var O=e=>e.__type==="service-plugin-definition";function q(e){let a=new Map,s=_(),d={...s,getRegisteredServicePlugins:()=>a,async parseJWT(r){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:t,valid:i}=await e.decodeJWT(r,!0);if(!i)throw new Error("JWT is not valid");if(typeof t.data!="object"||t.data===null||!("metadata"in t.data)||typeof t.data.metadata!="object"||t.data.metadata===null||!("appExtensionType"in t.data.metadata)||typeof t.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return t.data},async process(r){let t=await this.parseJWT(r.body);return this.executeHandler(t,r.url)},async parseRequest(r){let t=await r.text();return this.parseJWT(t)},async processRequest(r){let t=r.url,i=await r.text();try{let o=await this.process({url:t,body:i});return Response.json(o)}catch(o){if(o.errorType==="SPI"&&o.applicationCode&&o.httpCode)return Response.json({applicationError:{code:o.applicationCode,data:o.data}},{status:o.httpCode});throw o}},async executeHandler(r,t){let i=r.metadata.appExtensionType.toLowerCase(),o=a.get(i)??[];if(o.length===0)throw new Error(`No service plugin implementations found for component type ${i}`);if(o.length>1)throw new Error(`Multiple service plugin implementations found for component type ${i}. This is currently not supported`);let{implementation:p,servicePluginDefinition:c}=o[0],f=c.methods.find(u=>t.endsWith(u.primaryHttpMappingPath));if(!f)throw new Error("Unexpect request: request url did not match any method: "+t);let y=p[f.name];if(!y)throw new Error(`Got request for service plugin method ${f.name} but no implementation was provided. Available methods: ${Object.keys(p).join(", ")}`);return f.transformations.toREST(await y(f.transformations.fromREST(r)))}};return{initModule(r){return t=>{let i=a.get(r.componentType.toLowerCase())??[];i.push({servicePluginDefinition:r,implementation:t}),a.set(r.componentType.toLowerCase(),i),s.emit("registered",r)}},client:d}}function _e(e){let a=e.headers||{Authorization:""},s=e.auth||{getAuthHeaders:n=>Promise.resolve({headers:{}})},d=s.getAuthHeaders.bind(void 0,e.host);s.getAuthHeaders=d;let r=async(n,l)=>{if(typeof n=="string"||n instanceof URL)return fetch(n,{...l,headers:{...l?.headers,...(await d()).headers}});for(let[h,m]of Object.entries((await d()).headers))n.headers.set(h,m);return fetch(n,l)},{client:t,initModule:i}=q(s),{client:o,initModule:p}=L(s),c=async(n,l)=>{let h=await d(),m=C(l);return fetch(n,{...l,headers:{...m,...a,...h?.headers,...l?.headers,...e.host?.essentials?.passThroughHeaders}})},f=(n,l)=>{if(J(n))return p(n);if(O(n))return i(n);if(j(n)&&e.host)return S(n,e.host);if(typeof n=="function"){if("__type"in n&&n.__type===A)return n;let h=e.host?.apiBaseUrl??w;return I(x(()=>M(n))?P(n):n,l??{},c,(m,E)=>{let T=new URL(m,`https://${h}`);return T.host=h,T.protocol="https",c(T.toString(),E)},s.getActiveToken,{HTTPHost:h},e.host?.name)}else return U(n)?Object.fromEntries(Object.entries(n).map(([h,m])=>[h,f(m,n[R])])):n},y=n=>{for(let l in n)a[l]=n[l]};return{...e.modules?f(e.modules):{},auth:s,setHeaders:y,use:f,enableContext(n,l={elevated:!1}){n==="global"?globalThis.__wix_context__!=null?l.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:l.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:l.elevated?N.elevatedClient=this:N.client=this},fetch:(n,l)=>{let h=e.host?.apiBaseUrl??w,m=new URL(n,`https://${h}`);return m.host=h,m.protocol="https",c(m.toString(),l)},fetchWithAuth:r,async graphql(n,l,h={apiVersion:"alpha"}){let m=e?.host?.apiBaseUrl??w,E=await c(`https://${m}/graphql/${h.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:n,variables:l})});if(E.status!==200)throw new g(`GraphQL request failed with status ${E.status}`,E);let{data:T,errors:k}=await E.json();return{data:T??{},errors:k}},webhooks:o,servicePlugins:t}}export{_e as a};
|
|
2
|
+
//# sourceMappingURL=chunk-XYIDODIB.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as K,b as N}from"./chunk-CR7DIEFQ.js";import{a as F}from"./chunk-EERHWVVD.js";import"./chunk-42XIZ4MH.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function C(){return C=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},C.apply(null,arguments)}import Oe,{useEffect as He,useState as pe}from"react";function w(e){"@babel/helpers - typeof";return w=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(e)}function q(e,t){if(w(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(w(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function J(e){var t=q(e,"string");return w(t)=="symbol"?t:t+""}function G(e,t,n){return(t=J(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=class extends Error{constructor(t){let{message:n,code:r}=t;super(n),G(this,"code",void 0),this.message=n,this.code=r}};var Q=()=>{let e=u=>{let{channel:o}=u;return function(){let f=o.showToast(...arguments);return{remove:()=>Promise.resolve(f).then(h=>h.remove())}}},t=u=>{let{channel:o}=u;return function(){let f=o.observeState(...arguments);return{disconnect:()=>Promise.resolve(f).then(h=>h.disconnect())}}};return{showToast:e,observeState:t,navigate:u=>{let{channel:o}=u;return function(){return o.navigate(...arguments)}},navigateBack:u=>{let{channel:o}=u;return()=>o.navigateBack()},openModal:u=>{let{channel:o}=u;return(f,g)=>{let[h,A]=typeof f=="string"?[f,g]:[f.modalId,f.params],E=o.openModal(h,A);return{modalClosed:Promise.resolve(E).then(y=>y.modalClosed)}}},closeModal:u=>{let{channel:o}=u;return f=>{if(f===void 0)return o.closeModal();let g=JSON.parse(JSON.stringify(f));return o.closeModal(g)}},getAccessToken:u=>{let{channel:o}=u;return()=>o.getAccessToken()},getPageUrl:u=>{let{channel:o}=u;return function(){return o.getPageUrl(...arguments)}},openMediaManager:u=>{let{channel:o}=u;return function(){return o.openMediaManager(...arguments)}},addSitePlugin:u=>{let{channel:o}=u;return(f,g)=>{let h="802c76e4-b381-4bb3-9152-96acabbf3194",A=g?.placement||{},E=o.openModal(h,{...A,pluginId:f,action:"populate"});return Promise.resolve(E).then(y=>y.modalClosed).then(y=>{if(y?.type===void 0)throw new S({message:"Aborted by user",code:3006});if(y?.type==="ERROR")throw new S(y.data.error)})}},onBeforeUnload:u=>{let{channel:o}=u;return function(){return o.onBeforeUnload(...arguments)}},setPageTitle:u=>{let{channel:o}=u;return f=>o.setPageTitle(f)},getLanguage:u=>{let o=null;return async()=>{var f;if(o)return o;let g=null;return o=await new Promise(h=>{g=t(u)((A,E)=>{h(E.language)})}),(f=g)==null||f.disconnect(),o}},requestFeedback:u=>{let{channel:o}=u;return function(){return o.requestFeedback(...arguments)}},onLayerStateChange:u=>{let{channel:o}=u;return function(){let f=o.onLayerStateChange(...arguments);return{remove:()=>Promise.resolve(f).then(h=>h.remove())}}},installApp:u=>{let{channel:o}=u;return o.installApp},getWidget:u=>{let{channel:o}=u;return function(){if("getWidget"in o)return o.getWidget(...arguments);throw new Error("Unsupported")}},getDashboardPlugins:u=>{let{channel:o}=u;return function(){if("getDashboardPlugins"in o)return o.getDashboardPlugins(...arguments);throw new Error("Unsupported")}},getDashboardMenuPlugins:u=>{let{channel:o}=u;return function(){if("getDashboardMenuPlugins"in o)return o.getDashboardMenuPlugins(...arguments);throw new Error("Unsupported")}}}};var $=e=>{let{createHost:t}=e,n=Q();return{...K(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var Y=Symbol("Comlink.proxy"),he=Symbol("Comlink.endpoint"),D=Symbol("Comlink.releaseProxy"),L=Symbol("Comlink.thrown"),Z=e=>typeof e=="object"&&e!==null||typeof e=="function",ye={canHandle:e=>Z(e)&&e[Y],serialize(e){let{port1:t,port2:n}=new MessageChannel;return _(e,t),[n,[n]]},deserialize(e){return e.start(),B(e)}},be={canHandle:e=>Z(e)&&L in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},ee=new Map([["proxy",ye],["throw",be]]);function _(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:s,type:i,path:a}=Object.assign({path:[]},r.data),c=(r.data.argumentList||[]).map(P),l;try{let d=a.slice(0,-1).reduce((p,b)=>p[b],e),m=a.reduce((p,b)=>p[b],e);switch(i){case 0:l=m;break;case 1:d[a.slice(-1)[0]]=P(r.data.value),l=!0;break;case 2:l=m.apply(d,c);break;case 3:{let p=new m(...c);l=k(p)}break;case 4:{let{port1:p,port2:b}=new MessageChannel;_(e,b),l=xe(p,[p])}break;case 5:l=void 0;break}}catch(d){l={value:d,[L]:0}}Promise.resolve(l).catch(d=>({value:d,[L]:0})).then(d=>{let[m,p]=W(d);t.postMessage(Object.assign(Object.assign({},m),{id:s}),p),i===5&&(t.removeEventListener("message",n),te(t))})}),t.start&&t.start()}function we(e){return e.constructor.name==="MessagePort"}function te(e){we(e)&&e.close()}function B(e,t){return R(e,[],t)}function U(e){if(e)throw new Error("Proxy has been released and is not useable")}function R(e,t=[],n=function(){}){let r=!1,s=new Proxy(n,{get(i,a){if(U(r),a===D)return()=>v(e,{type:5,path:t.map(c=>c.toString())}).then(()=>{te(e),r=!0});if(a==="then"){if(t.length===0)return{then:()=>s};let c=v(e,{type:0,path:t.map(l=>l.toString())}).then(P);return c.then.bind(c)}return R(e,[...t,a])},set(i,a,c){U(r);let[l,d]=W(c);return v(e,{type:1,path:[...t,a].map(m=>m.toString()),value:l},d).then(P)},apply(i,a,c){U(r);let l=t[t.length-1];if(l===he)return v(e,{type:4}).then(P);if(l==="bind")return R(e,t.slice(0,-1));let[d,m]=X(c);return v(e,{type:2,path:t.map(p=>p.toString()),argumentList:d},m).then(P)},construct(i,a){U(r);let[c,l]=X(a);return v(e,{type:3,path:t.map(d=>d.toString()),argumentList:c},l).then(P)}});return s}function Pe(e){return Array.prototype.concat.apply([],e)}function X(e){let t=e.map(W);return[t.map(n=>n[0]),Pe(t.map(n=>n[1]))]}var ne=new WeakMap;function xe(e,t){return ne.set(e,t),e}function k(e){return Object.assign(e,{[Y]:!0})}function W(e){for(let[t,n]of ee)if(n.canHandle(e)){let[r,s]=n.serialize(e);return[{type:3,name:t,value:r},s]}return[{type:0,value:e},ne.get(e)||[]]}function P(e){switch(e.type){case 3:return ee.get(e.name).deserialize(e.value);case 0:return e.value}}function v(e,t,n){return new Promise(r=>{let s=ve();e.addEventListener("message",function i(a){!a.data||!a.data.id||a.data.id!==s||(e.removeEventListener("message",i),r(a.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),n)})}function ve(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var T="__proxyCallbackId__wixSDK__",I="__proxyPromiseId__wixSDK__",oe=e=>Ee(e,t=>async function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];let[i,a]=j(r),c=await t(k(i),a);return se(c)});var Me=async e=>{let[t,n]=j(await e);return k({proxies:t,clonables:n})},se=async e=>H(e?.proxies,await e?.clonables),j=e=>{let t=(s,i)=>{if(ae(i)){let a=re();return s.promises[a]=i,{[I]:a}}if(Se(i)){let a=re();return s.callbacks[a]=(c,l)=>{let d=H(c,l),m=i(...d);return Me(m)},{[T]:a}}return Array.isArray(i)?i.map(a=>t(s,a)):O(i)?ie(i,a=>t(s,a)):i},n={promises:{},callbacks:{}},r=t(n,e);return[n,r]},H=(e,t)=>{if(Array.isArray(t))return t.map(n=>H(e,n));if(O(t)&&t.hasOwnProperty(I)){let n=t[I];return e.promises[n]}if(O(t)&&t.hasOwnProperty(T)){let n=t[T];return async function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];let[a,c]=j(s),l=await e.callbacks[n](k(a),c);return se(l)}}return O(t)?ie(t,n=>H(e,n)):t},Ee=(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}`)}}}),ae=e=>e instanceof Promise,O=e=>e&&typeof e=="object"&&!ae(e),Se=e=>typeof e=="function",ie=(e,t)=>{let n=r=>{let[s,i]=r;return[s,t(i)]};return Object.fromEntries(Object.entries(e).map(n))},re=(()=>{let e=0;return()=>++e})();var ke="wix-sdk-bo-hello-handshake",ce=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:s}=new MessageChannel;t({code:ke,version:"1.0.0",port:s},n,[s]);let c=oe(B(r));return{channel:c,close:()=>c[D]()}};var ue=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var Ae=["https://manage.wix.com","https://manage.editorx.com"],Ce=new Set(Ae),le=e=>Ce.has(e);var de=e=>{let t=new EventTarget,n=typeof window>"u",r=c=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(c.preventDefault(),c.returnValue=!0)},s=e.onBeforeUnload(r),i=()=>{n||window.removeEventListener("beforeunload",r),s.then(c=>{let{remove:l}=c;return l()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",i)),{onBeforeUnload:c=>(t.addEventListener("beforeunload",c),{remove:()=>{t.removeEventListener("beforeunload",c)}}),clearBeforeUnloadHandler:i}};function Ue(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 fe(e){return e.has("essentials")?Ue(e.get("essentials")):void 0}var me=function(e){e===void 0&&(e={});let t=new URLSearchParams(typeof window<"u"?window.location.search:"?"),n=e.origin||t.get("origin")||"",r=e.postMessage||window.parent.postMessage.bind(window.parent);if(!le(n))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:i}=ce({postMessage:r,origin:n}),a=[i];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let x=e.autoHeightElement||document.documentElement,M=ue(s,x);a.push(()=>M())}let{onBeforeUnload:c,clearBeforeUnloadHandler:l}=de(s);a.push(l);let d=new Proxy(s,{get(x,M,V){return M==="onBeforeUnload"?c:Reflect.get(x,M,V)}}),{monitoring:m,...p}=fe(t)||{},b=N({hostContext:m?.context,monitoringConfig:m?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{channel:d,close:()=>a.forEach(x=>x()),getMonitoringClient:b,essentials:p}};var z=$({createHost:me});var ge=(e,t)=>{let[n,r]=pe(()=>e());return t(n)&&r(e()),n},Le=e=>t=>{let{host:n,compProps:r}=Re(t);return ge(()=>(F({auth:z.auth(),host:n}).enableContext("module"),n),s=>s!==n),r?Oe.createElement(e,C({host:n},r)):null},Re=e=>{let{host:t,...n}=e,{host:r,hostType:s}=ge(()=>t?{host:t,hostType:"local"}:{host:z.host(),hostType:"remote"},c=>!!t&&t!==c.host),[i,a]=pe(void 0);return He(()=>{if(s==="local")return;let c=r.channel.observeState(d=>{a(d||{})}),l=async()=>{(await c).disconnect(),r.close()};return()=>{l()}},[r,s]),s==="local"?{host:r,compProps:n}:{host:r,compProps:i?{...i,...n}:void 0}};export{Le as withContextualWixClient};
|
|
1
|
+
import{a as K,b as N}from"./chunk-6NLQHDP6.js";import{a as F}from"./chunk-XYIDODIB.js";import"./chunk-BGTZ3RNN.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function C(){return C=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},C.apply(null,arguments)}import Oe,{useEffect as He,useState as pe}from"react";function w(e){"@babel/helpers - typeof";return w=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(e)}function q(e,t){if(w(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(w(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function J(e){var t=q(e,"string");return w(t)=="symbol"?t:t+""}function G(e,t,n){return(t=J(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=class extends Error{constructor(t){let{message:n,code:r}=t;super(n),G(this,"code",void 0),this.message=n,this.code=r}};var Q=()=>{let e=u=>{let{channel:o}=u;return function(){let f=o.showToast(...arguments);return{remove:()=>Promise.resolve(f).then(h=>h.remove())}}},t=u=>{let{channel:o}=u;return function(){let f=o.observeState(...arguments);return{disconnect:()=>Promise.resolve(f).then(h=>h.disconnect())}}};return{showToast:e,observeState:t,navigate:u=>{let{channel:o}=u;return function(){return o.navigate(...arguments)}},navigateBack:u=>{let{channel:o}=u;return()=>o.navigateBack()},openModal:u=>{let{channel:o}=u;return(f,g)=>{let[h,A]=typeof f=="string"?[f,g]:[f.modalId,f.params],E=o.openModal(h,A);return{modalClosed:Promise.resolve(E).then(y=>y.modalClosed)}}},closeModal:u=>{let{channel:o}=u;return f=>{if(f===void 0)return o.closeModal();let g=JSON.parse(JSON.stringify(f));return o.closeModal(g)}},getAccessToken:u=>{let{channel:o}=u;return()=>o.getAccessToken()},getPageUrl:u=>{let{channel:o}=u;return function(){return o.getPageUrl(...arguments)}},openMediaManager:u=>{let{channel:o}=u;return function(){return o.openMediaManager(...arguments)}},addSitePlugin:u=>{let{channel:o}=u;return(f,g)=>{let h="802c76e4-b381-4bb3-9152-96acabbf3194",A=g?.placement||{},E=o.openModal(h,{...A,pluginId:f,action:"populate"});return Promise.resolve(E).then(y=>y.modalClosed).then(y=>{if(y?.type===void 0)throw new S({message:"Aborted by user",code:3006});if(y?.type==="ERROR")throw new S(y.data.error)})}},onBeforeUnload:u=>{let{channel:o}=u;return function(){return o.onBeforeUnload(...arguments)}},setPageTitle:u=>{let{channel:o}=u;return f=>o.setPageTitle(f)},getLanguage:u=>{let o=null;return async()=>{var f;if(o)return o;let g=null;return o=await new Promise(h=>{g=t(u)((A,E)=>{h(E.language)})}),(f=g)==null||f.disconnect(),o}},requestFeedback:u=>{let{channel:o}=u;return function(){return o.requestFeedback(...arguments)}},onLayerStateChange:u=>{let{channel:o}=u;return function(){let f=o.onLayerStateChange(...arguments);return{remove:()=>Promise.resolve(f).then(h=>h.remove())}}},installApp:u=>{let{channel:o}=u;return o.installApp},getWidget:u=>{let{channel:o}=u;return function(){if("getWidget"in o)return o.getWidget(...arguments);throw new Error("Unsupported")}},getDashboardPlugins:u=>{let{channel:o}=u;return function(){if("getDashboardPlugins"in o)return o.getDashboardPlugins(...arguments);throw new Error("Unsupported")}},getDashboardMenuPlugins:u=>{let{channel:o}=u;return function(){if("getDashboardMenuPlugins"in o)return o.getDashboardMenuPlugins(...arguments);throw new Error("Unsupported")}}}};var $=e=>{let{createHost:t}=e,n=Q();return{...K(n),host:t,auth:()=>({getAuthHeaders:async r=>({headers:{Authorization:await n.getAccessToken(r)()}})})}};var Y=Symbol("Comlink.proxy"),he=Symbol("Comlink.endpoint"),D=Symbol("Comlink.releaseProxy"),L=Symbol("Comlink.thrown"),Z=e=>typeof e=="object"&&e!==null||typeof e=="function",ye={canHandle:e=>Z(e)&&e[Y],serialize(e){let{port1:t,port2:n}=new MessageChannel;return _(e,t),[n,[n]]},deserialize(e){return e.start(),B(e)}},be={canHandle:e=>Z(e)&&L in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},ee=new Map([["proxy",ye],["throw",be]]);function _(e,t=self){t.addEventListener("message",function n(r){if(!r||!r.data)return;let{id:s,type:i,path:a}=Object.assign({path:[]},r.data),c=(r.data.argumentList||[]).map(P),l;try{let d=a.slice(0,-1).reduce((p,b)=>p[b],e),m=a.reduce((p,b)=>p[b],e);switch(i){case 0:l=m;break;case 1:d[a.slice(-1)[0]]=P(r.data.value),l=!0;break;case 2:l=m.apply(d,c);break;case 3:{let p=new m(...c);l=k(p)}break;case 4:{let{port1:p,port2:b}=new MessageChannel;_(e,b),l=xe(p,[p])}break;case 5:l=void 0;break}}catch(d){l={value:d,[L]:0}}Promise.resolve(l).catch(d=>({value:d,[L]:0})).then(d=>{let[m,p]=W(d);t.postMessage(Object.assign(Object.assign({},m),{id:s}),p),i===5&&(t.removeEventListener("message",n),te(t))})}),t.start&&t.start()}function we(e){return e.constructor.name==="MessagePort"}function te(e){we(e)&&e.close()}function B(e,t){return R(e,[],t)}function U(e){if(e)throw new Error("Proxy has been released and is not useable")}function R(e,t=[],n=function(){}){let r=!1,s=new Proxy(n,{get(i,a){if(U(r),a===D)return()=>v(e,{type:5,path:t.map(c=>c.toString())}).then(()=>{te(e),r=!0});if(a==="then"){if(t.length===0)return{then:()=>s};let c=v(e,{type:0,path:t.map(l=>l.toString())}).then(P);return c.then.bind(c)}return R(e,[...t,a])},set(i,a,c){U(r);let[l,d]=W(c);return v(e,{type:1,path:[...t,a].map(m=>m.toString()),value:l},d).then(P)},apply(i,a,c){U(r);let l=t[t.length-1];if(l===he)return v(e,{type:4}).then(P);if(l==="bind")return R(e,t.slice(0,-1));let[d,m]=X(c);return v(e,{type:2,path:t.map(p=>p.toString()),argumentList:d},m).then(P)},construct(i,a){U(r);let[c,l]=X(a);return v(e,{type:3,path:t.map(d=>d.toString()),argumentList:c},l).then(P)}});return s}function Pe(e){return Array.prototype.concat.apply([],e)}function X(e){let t=e.map(W);return[t.map(n=>n[0]),Pe(t.map(n=>n[1]))]}var ne=new WeakMap;function xe(e,t){return ne.set(e,t),e}function k(e){return Object.assign(e,{[Y]:!0})}function W(e){for(let[t,n]of ee)if(n.canHandle(e)){let[r,s]=n.serialize(e);return[{type:3,name:t,value:r},s]}return[{type:0,value:e},ne.get(e)||[]]}function P(e){switch(e.type){case 3:return ee.get(e.name).deserialize(e.value);case 0:return e.value}}function v(e,t,n){return new Promise(r=>{let s=ve();e.addEventListener("message",function i(a){!a.data||!a.data.id||a.data.id!==s||(e.removeEventListener("message",i),r(a.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),n)})}function ve(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var T="__proxyCallbackId__wixSDK__",I="__proxyPromiseId__wixSDK__",oe=e=>Ee(e,t=>async function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];let[i,a]=j(r),c=await t(k(i),a);return se(c)});var Me=async e=>{let[t,n]=j(await e);return k({proxies:t,clonables:n})},se=async e=>H(e?.proxies,await e?.clonables),j=e=>{let t=(s,i)=>{if(ae(i)){let a=re();return s.promises[a]=i,{[I]:a}}if(Se(i)){let a=re();return s.callbacks[a]=(c,l)=>{let d=H(c,l),m=i(...d);return Me(m)},{[T]:a}}return Array.isArray(i)?i.map(a=>t(s,a)):O(i)?ie(i,a=>t(s,a)):i},n={promises:{},callbacks:{}},r=t(n,e);return[n,r]},H=(e,t)=>{if(Array.isArray(t))return t.map(n=>H(e,n));if(O(t)&&t.hasOwnProperty(I)){let n=t[I];return e.promises[n]}if(O(t)&&t.hasOwnProperty(T)){let n=t[T];return async function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];let[a,c]=j(s),l=await e.callbacks[n](k(a),c);return se(l)}}return O(t)?ie(t,n=>H(e,n)):t},Ee=(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}`)}}}),ae=e=>e instanceof Promise,O=e=>e&&typeof e=="object"&&!ae(e),Se=e=>typeof e=="function",ie=(e,t)=>{let n=r=>{let[s,i]=r;return[s,t(i)]};return Object.fromEntries(Object.entries(e).map(n))},re=(()=>{let e=0;return()=>++e})();var ke="wix-sdk-bo-hello-handshake",ce=e=>{let{postMessage:t,origin:n}=e,{port1:r,port2:s}=new MessageChannel;t({code:ke,version:"1.0.0",port:s},n,[s]);let c=oe(B(r));return{channel:c,close:()=>c[D]()}};var ue=(e,t)=>{let n=()=>e.updateHeight(t.offsetHeight),r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()};var Ae=["https://manage.wix.com","https://manage.editorx.com"],Ce=new Set(Ae),le=e=>Ce.has(e);var de=e=>{let t=new EventTarget,n=typeof window>"u",r=c=>{t.dispatchEvent(new CustomEvent("beforeunload",{cancelable:!0}))||(c.preventDefault(),c.returnValue=!0)},s=e.onBeforeUnload(r),i=()=>{n||window.removeEventListener("beforeunload",r),s.then(c=>{let{remove:l}=c;return l()})};return n||(window.addEventListener("beforeunload",r),window.addEventListener("unload",i)),{onBeforeUnload:c=>(t.addEventListener("beforeunload",c),{remove:()=>{t.removeEventListener("beforeunload",c)}}),clearBeforeUnloadHandler:i}};function Ue(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 fe(e){return e.has("essentials")?Ue(e.get("essentials")):void 0}var me=function(e){e===void 0&&(e={});let t=new URLSearchParams(typeof window<"u"?window.location.search:"?"),n=e.origin||t.get("origin")||"",r=e.postMessage||window.parent.postMessage.bind(window.parent);if(!le(n))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:i}=ce({postMessage:r,origin:n}),a=[i];if(e.autoHeightUpdate===void 0||e.autoHeightUpdate){let x=e.autoHeightElement||document.documentElement,M=ue(s,x);a.push(()=>M())}let{onBeforeUnload:c,clearBeforeUnloadHandler:l}=de(s);a.push(l);let d=new Proxy(s,{get(x,M,V){return M==="onBeforeUnload"?c:Reflect.get(x,M,V)}}),{monitoring:m,...p}=fe(t)||{},b=N({hostContext:m?.context,monitoringConfig:m?.config,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{channel:d,close:()=>a.forEach(x=>x()),getMonitoringClient:b,essentials:p}};var z=$({createHost:me});var ge=(e,t)=>{let[n,r]=pe(()=>e());return t(n)&&r(e()),n},Le=e=>t=>{let{host:n,compProps:r}=Re(t);return ge(()=>(F({auth:z.auth(),host:n}).enableContext("module"),n),s=>s!==n),r?Oe.createElement(e,C({host:n},r)):null},Re=e=>{let{host:t,...n}=e,{host:r,hostType:s}=ge(()=>t?{host:t,hostType:"local"}:{host:z.host(),hostType:"remote"},c=>!!t&&t!==c.host),[i,a]=pe(void 0);return He(()=>{if(s==="local")return;let c=r.channel.observeState(d=>{a(d||{})}),l=async()=>{(await c).disconnect(),r.close()};return()=>{l()}},[r,s]),s==="local"?{host:r,compProps:n}:{host:r,compProps:i?{...i,...n}:void 0}};export{Le as withContextualWixClient};
|
|
2
2
|
//# sourceMappingURL=dashboard.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ie,b as ge}from"./chunk-
|
|
1
|
+
import{a as Ie,b as ge}from"./chunk-6NLQHDP6.js";import{a as Pe}from"./chunk-XYIDODIB.js";import"./chunk-BGTZ3RNN.js";import{c as Je,d as He}from"./chunk-7EYXEF6M.js";import{b as me,d as ye,e as Ye,f as p,g as a,h as l,i as w,j as d}from"./chunk-SBZEOPXX.js";var Ee=me(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.EventType=void 0;var we;(function(n){n.removeAppCompleted="removeAppCompleted",n.componentSelectionChanged="componentSelectionChanged",n.appInstalled="appInstalled",n.appUpdateCompleted="appUpdateCompleted"})(we||(ot.EventType=we={}))});var Mt=me(m=>{"use strict";var Xe=m&&m.__createBinding||(Object.create?function(n,t,e,i){i===void 0&&(i=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,i,s)}:function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]}),Qe=m&&m.__setModuleDefault||(Object.create?function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}:function(n,t){n.default=t}),Ze=m&&m.__importStar||function(){var n=function(t){return n=Object.getOwnPropertyNames||function(e){var i=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[i.length]=s);return i},n(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var i=n(t),s=0;s<i.length;s++)i[s]!=="default"&&Xe(e,t,i[s]);return Qe(e,t),e}}();Object.defineProperty(m,"__esModule",{value:!0});m.EventType=m.WixSDKTypes=void 0;var tn=Ze((He(),Ye(Je)));m.WixSDKTypes=tn;var en=Ee();Object.defineProperty(m,"EventType",{enumerable:!0,get:function(){return en.EventType}})});var q=ye(Mt(),1);var N=class N{constructor(){p(this,"uid",0);p(this,"callbacks",new Map);p(this,"inTransaction",!1);p(this,"isSilent",!1);p(this,"queue",[])}silent(t=!0){this.isSilent=t}startTransaction(){this.inTransaction=!0}commit(){this.inTransaction=!1;let t=this.queue;this.queue=[],this.isSilent||t.forEach(e=>{this.notify(e)})}notify(t){this.isSilent||(this.inTransaction?this.queue.push(t):this.callbacks.forEach(e=>{e(t)}))}subscribe(t){let e=this.uid++;return this.callbacks.set(e,t),()=>{this.callbacks.delete(e)}}notifyWithStep(t,e){this.notify({...t,meta:{...t.meta,step:e}})}async withEvent(t,e){let i=e();if(i&&i.hasOwnProperty("then"))try{return this.notifyWithStep(t,N.EventSteps.Start),i=await i,this.notifyWithStep(t,N.EventSteps.End),i}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},N.EventSteps.Error),s}else return this.notify(t),i}};p(N,"biEvents",{PLATFORM_WORKER_SPAWN:123,PLATFORM_APP_RUNNER_INIT_APP_API:124,PLATFORM_APP_RUNNER_RUN_APP:125,PLATFORM_APP_RUNNER_REMOVE_APP:126,PLATFORM_WORKER_APP_BUNDLE_LOAD:127,PLATFORM_WORKER_APP_BUNDLE_EXECUTE:128,PLATFORM_IFRAME_INIT:129,PLATFORM_APP_API_INIT:130,PLATFORM_APP_API_GET:131}),p(N,"EventSteps",{Start:"start",End:"end",Error:"error"});var Dt=N,ct=(n=>(n.WorkerSpawn="WorkerSpawn",n.HostEvent="HostEvent",n.ApplicationsSpecsReceived="ApplicationsSpecsReceived",n.InitApplicationApi="InitApplicationApi",n.RunApplication="RunApplication",n.getApplicationApi="getApplicationApi",n.IframeInit="IframeInit",n))(ct||{}),kt=(n=>(n.EditorReady="EditorReady",n))(kt||{});var E=(n=>(n.ApplicationInit="ApplicationInit",n.ApplicationExecute="ApplicationExecute",n.ApplicationRemoved="ApplicationRemoved",n.ApplicationLoad="ApplicationLoad",n.ApplicationApiInit="ApplicationApiInit",n.CustomEvent="CustomEvent",n.HostEvent="HostEvent",n.EditorReady="EditorReady",n))(E||{}),St=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:v.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:v.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:v.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:v.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},v=class extends Dt{constructor(){super(...arguments);p(this,"factories",new St)}},at=class at{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ct.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);at.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};p(at,"allowedEvents",[q.EventType.componentSelectionChanged,q.EventType.appInstalled,q.EventType.appUpdateCompleted,q.EventType.removeAppCompleted]);var ve=at;var y=class n extends Error{constructor(e,i,s){let r=e?` ${e}`:"",o=`[${s}]#${i}`;super(`${o}.${r}`);p(this,"state",{});p(this,"displayName");p(this,"prefix");p(this,"errorMessage");p(this,"parent");p(this,"messages",[]);p(this,"code");this.displayName=o,this.errorMessage=e,this.prefix=s,this.code=i,this.name=o,Object.defineProperty(this,"message",{get:()=>this.getDisplayMessage()}),Error.captureStackTrace&&Error.captureStackTrace(this,n)}get parentError(){let e=this.parent;if(!e)return null;if(this.parent instanceof n)return this.parent;let i=e.name??"[Unknown Error]";return{getBreadcrumbs(){return[i]},getMessage(){return[i,e.message??"unknown error message"].join(`
|
|
2
2
|
`)}}}getDisplayMessage(){return[(this.parentError?this.getBreadcrumbs():[]).join(" -> "),this.getMessage()].filter(i=>i.trim().length).join(`
|
|
3
3
|
`)}getMessage(){let e=Object.entries(this.state).reduce((c,[h,u])=>(u&&c.push(` \u2013 ${h}: ${u}`),c),[]).join(`
|
|
4
4
|
`),i=this.messages.reduce((c,h)=>(c.push(` - ${h.join(" ")}`),c),[]).join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as n}from"./chunk-BGTZ3RNN.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function o(e,t=!1){return n(e,t)}var i=["wix.com","editorx.com"];var _=new RegExp(`\\.(${i.join("|")})$`),s=["42.wixprod.net","uw2-edt-1.wixprod.net"],a="dev.wix-code.com";var u=new RegExp(`\\.(${s.join("|")})$`),p=new RegExp(`.*\\.${a}$`);import{wixContext as f}from"@wix/sdk-context";function r(e,t){t==="global"?globalThis.__wix_context__!=null?globalThis.__wix_context__.client=e:globalThis.__wix_context__={client:e}:f.client=e}var b=o(e=>(t,c)=>e.fetchWithAuth(t,c));export{r as enableContext};
|
|
2
2
|
//# sourceMappingURL=sdk-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/@wix/sdk-runtime/build/rest-modules.js","../../../node_modules/@wix/sdk/build/enable-context.js","../../../node_modules/@wix/sdk/build/context.js"],"sourcesContent":["import { contextualizeRESTModuleV2 } from './context-v2.js';\nexport function createRESTModule(descriptor, elevated = false) {\n return contextualizeRESTModuleV2(descriptor, elevated);\n}\nexport function toURLSearchParams(params, isComplexRequest) {\n const flatten = flattenParams(params);\n const searchParams = Object.entries(flatten).reduce((urlSearchParams, [key, value]) => {\n // inorder to make `foo: [1,2]` turn into `foo=1&foo=2` and not `foo[]=1&foo[]=2`\n const keyParams = Array.isArray(value) ? value : [value];\n keyParams.forEach((param) => {\n if (param === undefined || param === null) {\n return;\n }\n urlSearchParams.append(key, param);\n });\n return urlSearchParams;\n }, new URLSearchParams());\n if (isComplexRequest) {\n searchParams.append('.r', base64Encode(JSON.stringify(params)));\n }\n return searchParams;\n}\nexport function resolveUrl(opts) {\n const domain = resolveDomain(opts.host);\n const mappings = resolveMappingsByDomain(domain, opts.domainToMappings);\n const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});\n return resolvePathFromMappings(path, mappings);\n}\nfunction flattenParams(data, path = '') {\n const params = {};\n Object.entries(data).forEach(([key, value]) => {\n const isObject = value !== null && typeof value === 'object' && !Array.isArray(value);\n const fieldPath = resolvePath(path, key);\n if (isObject) {\n const serializedObject = flattenParams(value, fieldPath);\n Object.assign(params, serializedObject);\n }\n else {\n params[fieldPath] = value;\n }\n });\n return params;\n}\nfunction resolvePath(path, key) {\n return `${path}${path ? '.' : ''}${key}`;\n}\nconst base64Encode = (value) => {\n const base64 = typeof btoa !== 'undefined'\n ? btoa(value)\n : Buffer.from(value, 'utf-8').toString('base64');\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nconst DOMAINS = ['wix.com', 'editorx.com'];\nconst USER_DOMAIN = '_';\nconst REGEX_CAPTURE_DOMAINS = new RegExp(`\\\\.(${DOMAINS.join('|')})$`);\nconst WIX_API_DOMAINS = ['42.wixprod.net', 'uw2-edt-1.wixprod.net'];\nconst DEV_WIX_CODE_DOMAIN = 'dev.wix-code.com';\nconst REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;\nconst REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\\\.(${WIX_API_DOMAINS.join('|')})$`);\nconst REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\\\.${DEV_WIX_CODE_DOMAIN}$`);\nfunction resolveDomain(host) {\n const resolvedHost = fixHostExceptions(host);\n return resolvedHost\n .replace(REGEX_CAPTURE_DOMAINS, '._base_domain_')\n .replace(REGEX_CAPTURE_API_DOMAINS, '._api_base_domain_')\n .replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, '*.dev.wix-code.com');\n}\n// hosts which standard string replacing doesn't apply to them, will be fixed here.\nfunction fixHostExceptions(host) {\n // https://system-kb.wixanswers.com/kb/en/article/editorx-domains-matching-to-wixcom\n return host.replace('create.editorx.com', 'editor.editorx.com');\n}\nfunction resolveMappingsByDomain(domain, domainToMappings) {\n const mappings = domainToMappings[domain] || domainToMappings[USER_DOMAIN];\n if (!mappings) {\n if (isBaseDomain(domain)) {\n // fallback <lang>.wix.com sub domains to www.wix.com\n // since all of the languages subdomain are not mapped automatically in FP and we want to support those kind of calls\n // for example: fr.wix.com\n return domainToMappings[wwwBaseDomain];\n }\n }\n return mappings;\n}\nfunction isBaseDomain(domain) {\n return !!domain.match(/\\._base_domain_$/);\n}\nconst wwwBaseDomain = 'www._base_domain_';\nfunction injectDataIntoProtoPath(protoPath, data) {\n return protoPath\n .split('/')\n .map((path) => maybeProtoPathToData(path, data))\n .join('/');\n}\nfunction maybeProtoPathToData(protoPath, data) {\n const protoRegExpMatch = protoPath.match(REGEX_CAPTURE_PROTO_FIELD) || [];\n const field = protoRegExpMatch[1];\n if (field) {\n const suffix = protoPath.replace(protoRegExpMatch[0], '');\n return findByPath(data, field, protoPath, suffix);\n }\n return protoPath;\n}\nfunction findByPath(obj, path, defaultValue, suffix) {\n let result = obj;\n for (const field of path.split('.')) {\n if (!result) {\n return defaultValue;\n }\n result = result[field];\n }\n return `${result}${suffix}`;\n}\nfunction resolvePathFromMappings(protoPath, mappings) {\n const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));\n if (!mapping) {\n // todo: should we return the path? if no - what should we do in case of testings?\n return protoPath;\n }\n return mapping.srcPath + protoPath.slice(mapping.destPath.length);\n}\n","import { wixContext } from '@wix/sdk-context';\nexport function enableContext(wixClient, contextType) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n globalThis.__wix_context__.client = wixClient;\n }\n else {\n globalThis.__wix_context__ = { client: wixClient };\n }\n }\n else {\n wixContext.client = wixClient;\n }\n}\n","import { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nexport function elevate(restModule) {\n return createRESTModule(restModule, true);\n}\nexport const fetchWithAuth = createRESTModule((restModuleOpts) => {\n return ((url, options) => restModuleOpts.fetchWithAuth(url, options));\n});\nexport { graphql } from './graphql.js';\nexport { setGlobalWixContext } from './wix-context.js';\nexport { enableContext } from './enable-context.js';\n"],"mappings":"gGACO,SAASA,EAAiBC,EAAYC,EAAW,GAAO,CAC3D,OAAOC,EAA0BF,EAAYC,CAAQ,CACzD,CAiDA,IAAME,EAAU,CAAC,UAAW,aAAa,EAEzC,IAAMC,EAAwB,IAAI,OAAO,OAAOC,EAAQ,KAAK,GAAG,CAAC,IAAI,EAC/DC,EAAkB,CAAC,iBAAkB,uBAAuB,EAC5DC,EAAsB,mBAE5B,IAAMC,EAA4B,IAAI,OAAO,OAAOC,EAAgB,KAAK,GAAG,CAAC,IAAI,EAC3EC,EAAoC,IAAI,OAAO,QAAQC,CAAmB,GAAG,EC3DnF,OAAS,cAAAC,MAAkB,mBACpB,SAASC,EAAcC,EAAWC,EAAa,CAC9CA,IAAgB,SACZ,WAAW,iBAAmB,KAC9B,WAAW,gBAAgB,OAASD,EAGpC,WAAW,gBAAkB,CAAE,OAAQA,CAAU,EAIrDF,EAAW,OAASE,CAE5B,CCTO,IAAME,EAAgBC,EAAkBC,GACnC,CAACC,EAAKC,IAAYF,EAAe,cAAcC,EAAKC,CAAO,CACtE","names":["createRESTModule","descriptor","elevated","contextualizeRESTModuleV2","DOMAINS","REGEX_CAPTURE_DOMAINS","DOMAINS","WIX_API_DOMAINS","DEV_WIX_CODE_DOMAIN","REGEX_CAPTURE_API_DOMAINS","WIX_API_DOMAINS","REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN","DEV_WIX_CODE_DOMAIN","wixContext","enableContext","wixClient","contextType","fetchWithAuth","createRESTModule","restModuleOpts","url","options"]}
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/rest-modules.js","../../../node_modules/@wix/sdk/build/enable-context.js","../../../node_modules/@wix/sdk/build/context.js"],"sourcesContent":["import { contextualizeRESTModuleV2 } from './context-v2.js';\nexport function createRESTModule(descriptor, elevated = false) {\n return contextualizeRESTModuleV2(descriptor, elevated);\n}\nexport function toURLSearchParams(params, isComplexRequest) {\n const flatten = flattenParams(params);\n const searchParams = Object.entries(flatten).reduce((urlSearchParams, [key, value]) => {\n // inorder to make `foo: [1,2]` turn into `foo=1&foo=2` and not `foo[]=1&foo[]=2`\n const keyParams = Array.isArray(value) ? value : [value];\n keyParams.forEach((param) => {\n if (param === undefined || param === null) {\n return;\n }\n urlSearchParams.append(key, param);\n });\n return urlSearchParams;\n }, new URLSearchParams());\n if (isComplexRequest) {\n searchParams.append('.r', base64Encode(JSON.stringify(params)));\n }\n return searchParams;\n}\nexport function resolveUrl(opts) {\n const domain = resolveDomain(opts.host);\n const mappings = resolveMappingsByDomain(domain, opts.domainToMappings);\n const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});\n return resolvePathFromMappings(path, mappings);\n}\nfunction flattenParams(data, path = '') {\n const params = {};\n Object.entries(data).forEach(([key, value]) => {\n const isObject = value !== null && typeof value === 'object' && !Array.isArray(value);\n const fieldPath = resolvePath(path, key);\n if (isObject) {\n const serializedObject = flattenParams(value, fieldPath);\n Object.assign(params, serializedObject);\n }\n else {\n params[fieldPath] = value;\n }\n });\n return params;\n}\nfunction resolvePath(path, key) {\n return `${path}${path ? '.' : ''}${key}`;\n}\nconst base64Encode = (value) => {\n const base64 = typeof btoa !== 'undefined'\n ? btoa(value)\n : Buffer.from(value, 'utf-8').toString('base64');\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nconst DOMAINS = ['wix.com', 'editorx.com'];\nconst USER_DOMAIN = '_';\nconst REGEX_CAPTURE_DOMAINS = new RegExp(`\\\\.(${DOMAINS.join('|')})$`);\nconst WIX_API_DOMAINS = ['42.wixprod.net', 'uw2-edt-1.wixprod.net'];\nconst DEV_WIX_CODE_DOMAIN = 'dev.wix-code.com';\nconst REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;\nconst REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\\\.(${WIX_API_DOMAINS.join('|')})$`);\nconst REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\\\.${DEV_WIX_CODE_DOMAIN}$`);\nfunction resolveDomain(host) {\n const resolvedHost = fixHostExceptions(host);\n return resolvedHost\n .replace(REGEX_CAPTURE_DOMAINS, '._base_domain_')\n .replace(REGEX_CAPTURE_API_DOMAINS, '._api_base_domain_')\n .replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, '*.dev.wix-code.com');\n}\n// hosts which standard string replacing doesn't apply to them, will be fixed here.\nfunction fixHostExceptions(host) {\n // https://system-kb.wixanswers.com/kb/en/article/editorx-domains-matching-to-wixcom\n return host.replace('create.editorx.com', 'editor.editorx.com');\n}\nfunction resolveMappingsByDomain(domain, domainToMappings) {\n const mappings = domainToMappings[domain] || domainToMappings[USER_DOMAIN];\n if (!mappings) {\n if (isBaseDomain(domain)) {\n // fallback <lang>.wix.com sub domains to www.wix.com\n // since all of the languages subdomain are not mapped automatically in FP and we want to support those kind of calls\n // for example: fr.wix.com\n return domainToMappings[wwwBaseDomain];\n }\n }\n return mappings;\n}\nfunction isBaseDomain(domain) {\n return !!domain.match(/\\._base_domain_$/);\n}\nconst wwwBaseDomain = 'www._base_domain_';\nfunction injectDataIntoProtoPath(protoPath, data) {\n return protoPath\n .split('/')\n .map((path) => maybeProtoPathToData(path, data))\n .join('/');\n}\nfunction maybeProtoPathToData(protoPath, data) {\n const protoRegExpMatch = protoPath.match(REGEX_CAPTURE_PROTO_FIELD) || [];\n const field = protoRegExpMatch[1];\n if (field) {\n const suffix = protoPath.replace(protoRegExpMatch[0], '');\n return findByPath(data, field, protoPath, suffix);\n }\n return protoPath;\n}\nfunction findByPath(obj, path, defaultValue, suffix) {\n let result = obj;\n for (const field of path.split('.')) {\n if (!result) {\n return defaultValue;\n }\n result = result[field];\n }\n return `${result}${suffix}`;\n}\nfunction resolvePathFromMappings(protoPath, mappings) {\n const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));\n if (!mapping) {\n // todo: should we return the path? if no - what should we do in case of testings?\n return protoPath;\n }\n return mapping.srcPath + protoPath.slice(mapping.destPath.length);\n}\n","import { wixContext } from '@wix/sdk-context';\nexport function enableContext(wixClient, contextType) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n globalThis.__wix_context__.client = wixClient;\n }\n else {\n globalThis.__wix_context__ = { client: wixClient };\n }\n }\n else {\n wixContext.client = wixClient;\n }\n}\n","import { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nexport function elevate(restModule) {\n return createRESTModule(restModule, true);\n}\nexport const fetchWithAuth = createRESTModule((restModuleOpts) => {\n return ((url, options) => restModuleOpts.fetchWithAuth(url, options));\n});\nexport { graphql } from './graphql.js';\nexport { setGlobalWixContext } from './wix-context.js';\nexport { enableContext } from './enable-context.js';\n"],"mappings":"gGACO,SAASA,EAAiBC,EAAYC,EAAW,GAAO,CAC3D,OAAOC,EAA0BF,EAAYC,CAAQ,CACzD,CAiDA,IAAME,EAAU,CAAC,UAAW,aAAa,EAEzC,IAAMC,EAAwB,IAAI,OAAO,OAAOC,EAAQ,KAAK,GAAG,CAAC,IAAI,EAC/DC,EAAkB,CAAC,iBAAkB,uBAAuB,EAC5DC,EAAsB,mBAE5B,IAAMC,EAA4B,IAAI,OAAO,OAAOC,EAAgB,KAAK,GAAG,CAAC,IAAI,EAC3EC,EAAoC,IAAI,OAAO,QAAQC,CAAmB,GAAG,EC3DnF,OAAS,cAAAC,MAAkB,mBACpB,SAASC,EAAcC,EAAWC,EAAa,CAC9CA,IAAgB,SACZ,WAAW,iBAAmB,KAC9B,WAAW,gBAAgB,OAASD,EAGpC,WAAW,gBAAkB,CAAE,OAAQA,CAAU,EAIrDF,EAAW,OAASE,CAE5B,CCTO,IAAME,EAAgBC,EAAkBC,GACnC,CAACC,EAAKC,IAAYF,EAAe,cAAcC,EAAKC,CAAO,CACtE","names":["createRESTModule","descriptor","elevated","contextualizeRESTModuleV2","DOMAINS","REGEX_CAPTURE_DOMAINS","DOMAINS","WIX_API_DOMAINS","DEV_WIX_CODE_DOMAIN","REGEX_CAPTURE_API_DOMAINS","WIX_API_DOMAINS","REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN","DEV_WIX_CODE_DOMAIN","wixContext","enableContext","wixClient","contextType","fetchWithAuth","createRESTModule","restModuleOpts","url","options"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-XYIDODIB.js";import"./chunk-BGTZ3RNN.js";import"./chunk-7EYXEF6M.js";import"./chunk-SBZEOPXX.js";function d(){let t=null,n=null;return{promise:new Promise((o,i)=>{t=o,n=i}),resolve:t,reject:n}}var u=t=>{let{createHost:n}=t;return{__type:"host",create:e=>({}),host:e=>{var o,i;let{applicationId:s}=e??{},r=typeof window<"u"?window.wixEmbedsAPI:void 0,l=n(e),p=f();return{...l,apiBaseUrl:p,getMonitoringClient:r==null||r.getMonitoringClientFunction==null?void 0:r.getMonitoringClientFunction(s),essentials:{language:typeof window<"u"?(o=window.commonConfig)==null?void 0:o.language:void 0,locale:typeof window<"u"?(i=window.commonConfig)==null?void 0:i.locale:void 0}}},auth:e=>{let o=typeof window<"u"?window.wixEmbedsAPI:void 0;e||(e=o==null||o.getAccessTokenFunction==null?void 0:o.getAccessTokenFunction());let i=!1,{resolve:s,promise:r}=d();return{getAuthHeaders:async()=>{if(!e&&i&&(e=await r),!e)throw new Error("Failed to resolve auth token");return{headers:{Authorization:await e()}}},getAccessTokenInjector:()=>(i=!0,l=>{s(l)})}}}};function f(){let t=typeof window<"u"?window.wixEmbedsAPI:void 0,n=t==null||t.getExternalBaseUrl==null?void 0:t.getExternalBaseUrl();if(!n)return;let e=new URL(n);return e!=null&&e.pathname&&e.pathname!=="/"?""+e.hostname+e.pathname:e.hostname}var w=t=>{let{clientSdk:n,applicationId:e}=t;return{invoke:async o=>{let{namespace:i,method:s,args:r}=o;if(!n)throw new Error("Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction");return n.invoke({namespace:i,method:s,args:r,applicationId:e,accessToken:"accessToken"})},getAccessToken:()=>{throw new Error("Not implemented")},observeState:()=>({disconnect:()=>{}})}};var m=function(t){let n=typeof $wixContext<"u"&&$wixContext.clientSdk||t?.clientSdk||window.clientSdk,{applicationId:e}=t||{};if(!e)throw new Error('"createHost" was called without a required field "applicationId"');return{channel:w({clientSdk:n,applicationId:e}),close:()=>{}}};var c=u({createHost:m});var S=t=>{let n=c.host({applicationId:t}),e=c.auth(),o=e.getAccessTokenInjector();return a({auth:e,host:n}).enableContext("module"),{injectGetAccessToken:o}};export{S as enableClient};
|
|
2
2
|
//# sourceMappingURL=site.js.map
|
|
@@ -2,36 +2,36 @@ import { createRequire as _createRequire } from 'node:module';
|
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
createPreviewTag
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BHATQVOE.js";
|
|
6
6
|
import {
|
|
7
7
|
addUserFields
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-LARBBDM6.js";
|
|
9
|
+
import "./chunk-FOUN6JMR.js";
|
|
10
10
|
import {
|
|
11
11
|
ARMClient,
|
|
12
12
|
SiteListClient,
|
|
13
13
|
resolveConfiguredSite,
|
|
14
14
|
resolveDashboardExtensionUrl,
|
|
15
15
|
resolvePlatformUrl
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-5SSFYBVB.js";
|
|
17
|
+
import "./chunk-2QGU64R5.js";
|
|
18
|
+
import "./chunk-PWHSKMWU.js";
|
|
19
19
|
import "./chunk-ZR3N5INU.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-YQF5FOXN.js";
|
|
21
|
+
import "./chunk-PXS7X4U5.js";
|
|
22
|
+
import "./chunk-4T3TWPYN.js";
|
|
23
23
|
import {
|
|
24
24
|
DevCenterComponent,
|
|
25
25
|
PlatformType,
|
|
26
26
|
createHttpClient,
|
|
27
27
|
isLoggedInToAccount,
|
|
28
28
|
uploadApplication
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-CMCLHAKY.js";
|
|
30
30
|
import {
|
|
31
31
|
CliError,
|
|
32
32
|
CliErrorCode,
|
|
33
33
|
require_lib
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-TSO3L2US.js";
|
|
35
35
|
import {
|
|
36
36
|
__toESM,
|
|
37
37
|
init_esm_shims
|
|
@@ -135,4 +135,4 @@ async function nonInteractivePreview(options, model, services) {
|
|
|
135
135
|
export {
|
|
136
136
|
nonInteractivePreview
|
|
137
137
|
};
|
|
138
|
-
//# sourceMappingURL=preview-
|
|
138
|
+
//# sourceMappingURL=preview-RYKMQKPO.js.map
|
|
@@ -2,14 +2,14 @@ import { createRequire as _createRequire } from 'node:module';
|
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
messages_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7DBU2MOT.js";
|
|
6
6
|
import {
|
|
7
7
|
addUserFields,
|
|
8
8
|
reportCommandStartEvent
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LARBBDM6.js";
|
|
10
10
|
import {
|
|
11
11
|
DebugLogProvider
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YQF5FOXN.js";
|
|
13
13
|
import {
|
|
14
14
|
AccountAuthProvider,
|
|
15
15
|
BiProvider,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
ProjectModelProvider,
|
|
18
18
|
getDebugLogFilePath,
|
|
19
19
|
loadProjectModel
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-CMCLHAKY.js";
|
|
21
21
|
import {
|
|
22
22
|
CliError,
|
|
23
23
|
CliErrorCode,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
render,
|
|
26
26
|
require_react,
|
|
27
27
|
version
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-TSO3L2US.js";
|
|
29
29
|
import {
|
|
30
30
|
__toESM,
|
|
31
31
|
init_esm_shims
|
|
@@ -114,4 +114,4 @@ export {
|
|
|
114
114
|
renderCommand,
|
|
115
115
|
runCommand
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=render-command-
|
|
117
|
+
//# sourceMappingURL=render-command-MZQF2OKS.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.
|
|
4
|
+
"version": "1.1.73",
|
|
5
5
|
"author": "Amit Dahan",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"esbuild": "^0.21.3",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"@wix/ambassador-cli-site-override-service-v1-site-override": "^1.0.7",
|
|
20
20
|
"@wix/ambassador-ctp-app-cloud-backend-service-v1-app-cloud-backend-deployment": "^1.0.8",
|
|
21
21
|
"@wix/ambassador-ctp-gradual-rollout-v1-app-config": "^1.0.73",
|
|
22
|
-
"@wix/ambassador-devcenter-apps-v1-app": "^1.0.
|
|
23
|
-
"@wix/ambassador-devcenter-components-v1-component": "^1.0.
|
|
24
|
-
"@wix/app-cloud-uploader": "^1.
|
|
22
|
+
"@wix/ambassador-devcenter-apps-v1-app": "^1.0.544",
|
|
23
|
+
"@wix/ambassador-devcenter-components-v1-component": "^1.0.442",
|
|
24
|
+
"@wix/app-cloud-uploader": "^1.17.0",
|
|
25
25
|
"@wix/arm-client": "0.0.0",
|
|
26
26
|
"@wix/bi-logger-dev-tools-data": "^1.95.0",
|
|
27
27
|
"@wix/cli-app-definitions": "0.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@wix/extensions-data-client": "0.0.0",
|
|
53
53
|
"@wix/gena": "0.0.0",
|
|
54
54
|
"@wix/metasite-manager-client": "0.0.0",
|
|
55
|
-
"@wix/monitoring-buildtime": "^1.
|
|
55
|
+
"@wix/monitoring-buildtime": "^1.23.0",
|
|
56
56
|
"@wix/package-manager": "0.0.0",
|
|
57
57
|
"@wix/site-list-client": "0.0.0",
|
|
58
58
|
"@wix/site-override-client": "0.0.0",
|
|
@@ -110,7 +110,8 @@
|
|
|
110
110
|
],
|
|
111
111
|
"peerDependencies": {
|
|
112
112
|
"react": "^16.14 || ^17 || ^18",
|
|
113
|
-
"react-dom": "^16.14 || ^17 || ^18"
|
|
113
|
+
"react-dom": "^16.14 || ^17 || ^18",
|
|
114
|
+
"typescript": ">=5.3.3 <5.8.0"
|
|
114
115
|
},
|
|
115
116
|
"peerDependenciesMeta": {
|
|
116
117
|
"react-dom": {
|
|
@@ -152,5 +153,5 @@
|
|
|
152
153
|
]
|
|
153
154
|
}
|
|
154
155
|
},
|
|
155
|
-
"falconPackageHash": "
|
|
156
|
+
"falconPackageHash": "69b67a8a9ecf95774aa521ab12b4901fe6e86fe0277b619aa71c1cff"
|
|
156
157
|
}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
to: widget.ts
|
|
3
3
|
---
|
|
4
|
+
// This file includes your widget logic
|
|
5
|
+
// Learn about the widget.ts file: https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-cli/supported-extensions/site-extensions/blocks-site-widgets/widget-ts
|
|
6
|
+
// Learn about the Wix CLI and Blocks: https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/code-in-blocks/about-the-blocks-cli-integration
|
|
7
|
+
|
|
4
8
|
import { defineWidget } from '@wix/blocks';
|
|
5
9
|
|
|
6
10
|
export default defineWidget('<%- id -%>', ($w, $widget) => {
|
|
7
11
|
$w.onReady(() => {
|
|
12
|
+
// Initialize your widget here. If your widget has properties, this is a good place to read their values.
|
|
8
13
|
console.log('Widget is ready');
|
|
9
14
|
});
|
|
10
15
|
|
|
11
16
|
$widget.onPropsChanged((oldProps, newProps) => {
|
|
17
|
+
// If your widget has properties, onPropsChanged is where you should handle changes to their values.
|
|
12
18
|
console.log('Widget props changed', {
|
|
13
19
|
oldProps,
|
|
14
20
|
newProps,
|
|
15
21
|
});
|
|
16
22
|
});
|
|
17
|
-
|
|
23
|
+
|
|
18
24
|
return {
|
|
25
|
+
// If your app exposes a function in the api.ts file, make sure to return it here.
|
|
19
26
|
myPublicFunction() { }
|
|
20
27
|
};
|
|
21
28
|
});
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
to: panel.ts
|
|
3
3
|
---
|
|
4
|
+
// This file includes your custom panel logic.
|
|
5
|
+
// Custom panels let users customize your widget in the Editor.
|
|
6
|
+
// Learn about the panel.ts file: https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-cli/supported-extensions/site-extensions/blocks-site-widgets/panel-ts
|
|
7
|
+
// Learn about the Wix CLI and Blocks: https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/code-in-blocks/about-the-blocks-cli-integration
|
|
8
|
+
|
|
4
9
|
import { definePanel } from '@wix/blocks';
|
|
10
|
+
import { widget } from '@wix/editor'; // The Widget API enables you to get and set the properties and design presets of a site widget
|
|
5
11
|
|
|
6
12
|
export default definePanel('<%- id -%>', ($w) => {
|
|
7
|
-
$w.onReady(() => {
|
|
13
|
+
$w.onReady(async () => {
|
|
14
|
+
// Initialize the panel element values according to your widget's properties.
|
|
15
|
+
// Add event handlers for panel elements to update your widget's properties whenever a user interacts with the panel.
|
|
16
|
+
await widget.setProp('displayName', 'My widget!')
|
|
8
17
|
console.log("Panel is ready");
|
|
9
18
|
});
|
|
10
19
|
});
|