@wix/cli-app 1.1.57 → 1.1.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/build/{CreateVersionCommand-AIXBHCYB.js → CreateVersionCommand-6HJGN4WS.js} +16 -16
  2. package/build/{DevCommand-TOFPM7DZ.js → DevCommand-U7PV4HW6.js} +15 -15
  3. package/build/DevCommand-U7PV4HW6.js.map +1 -0
  4. package/build/{GenerateCommand-HB46FNMR.js → GenerateCommand-M3T6OD4B.js} +316 -194
  5. package/build/GenerateCommand-M3T6OD4B.js.map +1 -0
  6. package/build/{LogsCommand-Q2HRBR6G.js → LogsCommand-ECPZQ3LE.js} +4 -4
  7. package/build/PreviewCommand-ZQ3OUOKW.js +23 -0
  8. package/build/ReleaseCommand-KLZWNOVY.js +91 -0
  9. package/build/ReleaseCommand-KLZWNOVY.js.map +1 -0
  10. package/build/{ServeCommand-ZEXPLXTI.js → ServeCommand-I65XXTLM.js} +13 -13
  11. package/build/{build-3AJU7FWE.js → build-HZ5LVFAS.js} +10 -9
  12. package/build/build-HZ5LVFAS.js.map +1 -0
  13. package/build/{chunk-XQ2F7ZVH.js → chunk-4JDHJDA5.js} +3 -3
  14. package/build/{chunk-2BYVOUAH.js → chunk-ACN6EZGH.js} +3 -3
  15. package/build/{chunk-FOKCY5BR.js → chunk-AQKGIDJO.js} +1969 -342
  16. package/build/chunk-AQKGIDJO.js.map +1 -0
  17. package/build/{chunk-QG2TLAMS.js → chunk-BNROT2BN.js} +5 -5
  18. package/build/{chunk-MGPAOFO3.js → chunk-DXNFLVQP.js} +549 -538
  19. package/build/chunk-DXNFLVQP.js.map +1 -0
  20. package/build/{chunk-Y6SGP7TM.js → chunk-EZLVJJON.js} +3 -3
  21. package/build/{chunk-JZVNLHD3.js → chunk-FHMCCDCY.js} +3 -3
  22. package/build/{chunk-4JP2XRKG.js → chunk-FMM24YL4.js} +2044 -924
  23. package/build/chunk-FMM24YL4.js.map +1 -0
  24. package/build/{chunk-6A37LXDJ.js → chunk-IDWDZWLM.js} +2 -2
  25. package/build/{chunk-F2XRLYHS.js → chunk-OCC6MO6R.js} +5 -5
  26. package/build/{chunk-77XREOLU.js → chunk-PAWIUC26.js} +8 -8
  27. package/build/{chunk-IJVKSYIY.js → chunk-QVGYU6D4.js} +19 -8
  28. package/build/chunk-QVGYU6D4.js.map +1 -0
  29. package/build/{chunk-BMVZ7QCF.js → chunk-QW4WBWJK.js} +3 -3
  30. package/build/{chunk-2GIVAXZY.js → chunk-U72IPCQR.js} +3 -3
  31. package/build/{chunk-FTNALO4B.js → chunk-UQBZVJDQ.js} +6 -3
  32. package/build/chunk-UQBZVJDQ.js.map +1 -0
  33. package/build/{chunk-HL4K6RV3.js → chunk-W4HI7DI3.js} +2 -2
  34. package/build/{chunk-2CUJME55.js → chunk-ZJYRE4BT.js} +3 -3
  35. package/build/{chunk-N6O7J2WO.js → chunk-ZXHKA32C.js} +56 -12
  36. package/build/chunk-ZXHKA32C.js.map +1 -0
  37. package/build/cloudflare-runtime/entry.js +306 -252
  38. package/build/cloudflare-runtime/getRegisteredExtensions.js +21 -273
  39. package/build/index.js +444 -134
  40. package/build/index.js.map +1 -1
  41. package/build/platform-sdk/chunk-7EYXEF6M.js +2 -0
  42. package/build/platform-sdk/chunk-7EYXEF6M.js.map +1 -0
  43. package/build/platform-sdk/chunk-EVF6HSFE.js +2 -0
  44. package/build/platform-sdk/chunk-EVF6HSFE.js.map +1 -0
  45. package/build/platform-sdk/chunk-LO6MZPZE.js +2 -0
  46. package/build/platform-sdk/chunk-LO6MZPZE.js.map +1 -0
  47. package/build/platform-sdk/dashboard.js +1 -1
  48. package/build/platform-sdk/dashboard.js.map +1 -1
  49. package/build/platform-sdk/editor.js +6 -6
  50. package/build/platform-sdk/editor.js.map +1 -1
  51. package/build/platform-sdk/site.js +1 -1
  52. package/build/platform-sdk/site.js.map +1 -1
  53. package/build/platform-sdk/web-methods.js +2 -0
  54. package/build/platform-sdk/web-methods.js.map +1 -0
  55. package/build/{preview-C7XYH7BB.js → preview-FI6WYZUP.js} +13 -13
  56. package/build/preview-FI6WYZUP.js.map +1 -0
  57. package/build/{render-command-BMSK4YLL.js → render-command-UKYXN7C7.js} +6 -6
  58. package/package.json +13 -10
  59. package/schemas/site-plugin.json +1 -0
  60. package/templates/web-method/files/placeholder.ts.ejs +17 -0
  61. package/build/DevCommand-TOFPM7DZ.js.map +0 -1
  62. package/build/GenerateCommand-HB46FNMR.js.map +0 -1
  63. package/build/PreviewCommand-XBSTVGWT.js +0 -23
  64. package/build/build-3AJU7FWE.js.map +0 -1
  65. package/build/chunk-4JP2XRKG.js.map +0 -1
  66. package/build/chunk-FOKCY5BR.js.map +0 -1
  67. package/build/chunk-FTNALO4B.js.map +0 -1
  68. package/build/chunk-IJVKSYIY.js.map +0 -1
  69. package/build/chunk-MGPAOFO3.js.map +0 -1
  70. package/build/chunk-N6O7J2WO.js.map +0 -1
  71. package/build/platform-sdk/chunk-DGX4CFXG.js +0 -2
  72. package/build/platform-sdk/chunk-DGX4CFXG.js.map +0 -1
  73. package/build/platform-sdk/chunk-TN6HYRXL.js +0 -2
  74. package/build/platform-sdk/chunk-TN6HYRXL.js.map +0 -1
  75. package/build/preview-C7XYH7BB.js.map +0 -1
  76. /package/build/{CreateVersionCommand-AIXBHCYB.js.map → CreateVersionCommand-6HJGN4WS.js.map} +0 -0
  77. /package/build/{LogsCommand-Q2HRBR6G.js.map → LogsCommand-ECPZQ3LE.js.map} +0 -0
  78. /package/build/{PreviewCommand-XBSTVGWT.js.map → PreviewCommand-ZQ3OUOKW.js.map} +0 -0
  79. /package/build/{ServeCommand-ZEXPLXTI.js.map → ServeCommand-I65XXTLM.js.map} +0 -0
  80. /package/build/{chunk-XQ2F7ZVH.js.map → chunk-4JDHJDA5.js.map} +0 -0
  81. /package/build/{chunk-2BYVOUAH.js.map → chunk-ACN6EZGH.js.map} +0 -0
  82. /package/build/{chunk-QG2TLAMS.js.map → chunk-BNROT2BN.js.map} +0 -0
  83. /package/build/{chunk-Y6SGP7TM.js.map → chunk-EZLVJJON.js.map} +0 -0
  84. /package/build/{chunk-JZVNLHD3.js.map → chunk-FHMCCDCY.js.map} +0 -0
  85. /package/build/{chunk-6A37LXDJ.js.map → chunk-IDWDZWLM.js.map} +0 -0
  86. /package/build/{chunk-F2XRLYHS.js.map → chunk-OCC6MO6R.js.map} +0 -0
  87. /package/build/{chunk-77XREOLU.js.map → chunk-PAWIUC26.js.map} +0 -0
  88. /package/build/{chunk-BMVZ7QCF.js.map → chunk-QW4WBWJK.js.map} +0 -0
  89. /package/build/{chunk-2GIVAXZY.js.map → chunk-U72IPCQR.js.map} +0 -0
  90. /package/build/{chunk-HL4K6RV3.js.map → chunk-W4HI7DI3.js.map} +0 -0
  91. /package/build/{chunk-2CUJME55.js.map → chunk-ZJYRE4BT.js.map} +0 -0
  92. /package/build/{render-command-BMSK4YLL.js.map → render-command-UKYXN7C7.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/DevCommand/DevEnvironment.tsx","../src/components/DevCommand/useArmUpdater.ts","../../arm-client/src/index.ts","../../arm-client/src/client.ts","../../../node_modules/@wix/ambassador-ctp-gradual-rollout-v1-app-config/http.impl.ts","../../arm-client/src/schemas.ts","../../arm-client/src/useARMClient.ts","../src/components/DevCommand/useDevServer.ts","../src/context/armTag.tsx","../src/components/DevCommand/useSiteOverrideUpdater.ts","../../site-override-client/src/index.ts","../../site-override-client/src/client.ts","../../../node_modules/@wix/ambassador-cli-site-override-service-v1-site-override/http.impl.ts","../../site-override-client/src/schemas.ts","../../site-override-client/src/useSiteOverrideClient.ts","../src/site-override/createSiteOverrides.ts","../../../node_modules/@wix/ambassador-cli-site-override-service-v1-site-override/types.impl.ts","../src/site/useSite.ts","../src/site/context.ts","../src/context/siteOverride.tsx","../../site-list-client/src/site-list-client.ts","../../../node_modules/@wix/ambassador-site-list-v2-site/http.impl.ts","../../site-list-client/src/schemas.ts","../../site-list-client/src/useSiteListClient.ts","../../site-list-client/src/index.ts","../src/site/site-state.ts","../src/site/resolve-configured-site.ts","../src/components/extensions/utils.tsx"],"sourcesContent":["import React, { createContext, useContext } from 'react';\nimport type { FC, ReactNode } from 'react';\nimport { match } from 'variant';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { Spinner, useAsync, Alert } from '@wix/cli-ui-kit';\nimport { ErrorViewer, useErrorReporter } from '@wix/cli-error-reporting';\nimport { useTunnel } from '@wix/cli-tunnel';\nimport { useProjectModel } from '../../model.js';\nimport { useArmUpdater } from './useArmUpdater.js';\nimport type { BackendUrls } from './useArmUpdater.js';\nimport { useClientDevServer, useBackendDevServer } from './useDevServer.js';\nimport { ArmTagProvider } from '../../context/armTag.js';\nimport { useSiteOverrideUpdater } from './useSiteOverrideUpdater.js';\nimport { useBackendComponents } from '../../backend/useBackendComponents.js';\nimport { SiteOverrideProvider } from '../../context/siteOverride.js';\nimport type { Logger } from '../../vite/logger.js';\n\ninterface DevEnvironment {\n https: boolean;\n logger: Logger;\n clientDevServerUrl: string;\n backendDevServerUrl?: string;\n}\n\nconst DevEnvironmentContext = createContext<DevEnvironment | null>(null);\n\nexport const DevEnvironmentProvider: FC<{\n https: boolean;\n logger: Logger;\n children: ReactNode;\n}> = ({ https, logger, children }) => {\n const { t } = useTranslation();\n const { reportError } = useErrorReporter();\n const { backendComponents, backendComponentsByType } = useBackendComponents();\n const createClientDevServer = useClientDevServer({ https });\n const createBackendDevServer = useBackendDevServer({ https });\n const startTunnel = useTunnel();\n const createArmUpdater = useArmUpdater();\n const createSiteOverrideUpdater = useSiteOverrideUpdater();\n const { watcher: projectModelWatcher } = useProjectModel();\n\n const { status } = useAsync(async () => {\n let backendDevServerUrl: BackendUrls | undefined;\n\n if (backendComponents.length > 0) {\n backendDevServerUrl = await createBackendDevServer({\n projectModelWatcher,\n customLogger: logger,\n }).then(async ({ devServerUrl }) => {\n let tunnelUrl: string | undefined;\n if (\n backendComponentsByType.Event.length > 0 ||\n backendComponentsByType.ServicePlugin.length > 0\n ) {\n const { url } = await startTunnel(Number(new URL(devServerUrl).port));\n tunnelUrl = url;\n }\n return { localUrl: devServerUrl, tunnelUrl };\n });\n }\n\n const { devServerUrl: clientDevServerUrl, devServer: clientDevServer } =\n await createClientDevServer({\n baseBackendUrl: backendDevServerUrl?.localUrl,\n projectModelWatcher,\n customLogger: logger,\n });\n\n const armTag = await createArmUpdater({\n backendServerUrl: backendDevServerUrl,\n devServerUrl: clientDevServerUrl,\n projectModelWatcher,\n onChange(changeType) {\n match(changeType, {\n 'change-received': () => {\n logger.info(t('dev_command.config_change'));\n },\n 'model-did-not-change': () => {\n logger.info(t('dev_command.config_didnt_update'));\n },\n 'model-updated': () => {\n clientDevServer.ws.send({ type: 'full-reload' });\n logger.info(t('dev_command.config_update'));\n },\n });\n },\n onError(error) {\n reportError(error);\n\n logger.error(<ErrorViewer error={error} />);\n logger.info(t('dev_command.config_didnt_update'));\n },\n });\n\n const siteOverrideId = await createSiteOverrideUpdater({\n projectModelWatcher,\n });\n\n logger.info(\n <Alert type=\"success\">{t('dev_command.dev_environment.started')}</Alert>\n );\n\n return {\n clientDevServerUrl,\n armTag,\n siteOverrideId,\n https,\n };\n }, []);\n\n return match(status, {\n Error: () => null,\n Loading: () => <Spinner text={t('dev_command.dev_environment.loading')} />,\n Success: ({\n result: { clientDevServerUrl, https, armTag, siteOverrideId },\n }) => (\n <DevEnvironmentContext.Provider\n value={{ clientDevServerUrl, https, logger }}\n >\n <SiteOverrideProvider siteOverrideId={siteOverrideId}>\n <ArmTagProvider armTag={armTag}>{children}</ArmTagProvider>\n </SiteOverrideProvider>\n </DevEnvironmentContext.Provider>\n ),\n });\n};\n\nexport function useDevEnvironment(): DevEnvironment {\n const context = useContext(DevEnvironmentContext);\n if (context == null) {\n throw new Error(\n 'useDevEnvironment() cannot be used without an <DevEnvironmentProvider>'\n );\n }\n return context;\n}\n","import { useCallback } from 'react';\nimport { match } from 'variant';\nimport { deepEqual } from 'fast-equals';\nimport { updateAppManifestWithBaseUrl } from '@wix/cli-app-manifest';\nimport { useARMClient } from '@wix/arm-client';\nimport { useDebugLog } from '@wix/cli-debug-log';\nimport { createAppManifest } from '../../app-manifest/create.js';\nimport { getComponentSourceBuilder } from '../../app-manifest/component-source.js';\nimport type {\n ChangeType,\n ProjectModelWatcher,\n} from '../../app-manifest/project-model-watcher.js';\nimport { readAppConfig, saveAppConfig } from '../../files/app.config.js';\nimport { useProjectModel } from '../../model.js';\nimport type { ProjectModel } from '../../model.js';\n\nexport interface BackendUrls {\n tunnelUrl?: string;\n localUrl: string;\n}\n\nconst createAppManifestWithBaseUrl = async (\n model: ProjectModel,\n clientDevServerUrl: string,\n backendServerUrl?: BackendUrls\n) => {\n const manifest = await createAppManifest({\n appId: model.config.appId,\n components: model.components,\n componentSourceBuilder: getComponentSourceBuilder(\n model,\n { clientDevServerUrl },\n { backendDevServerUrl: backendServerUrl?.localUrl }\n ),\n });\n\n return updateAppManifestWithBaseUrl(\n manifest,\n clientDevServerUrl,\n backendServerUrl?.tunnelUrl\n );\n};\n\ninterface CreateOptions {\n devServerUrl: string;\n backendServerUrl?: BackendUrls;\n projectModelWatcher: ProjectModelWatcher;\n onChange: (changeType: ChangeType) => void;\n onError: (e: unknown) => void;\n}\n\nexport function useArmUpdater() {\n const { model } = useProjectModel();\n const writeDebugLog = useDebugLog();\n const { createAppRelease, updateAppRelease } = useARMClient();\n\n return useCallback(\n async ({\n backendServerUrl,\n devServerUrl,\n projectModelWatcher,\n onChange,\n onError,\n }: CreateOptions) => {\n const { projectId } = model.config;\n\n const appManifest = await createAppManifestWithBaseUrl(\n model,\n devServerUrl,\n backendServerUrl\n );\n\n const appConfig = await readAppConfig(model.projectFolder, writeDebugLog);\n\n const createOrUpdateAppRelease = async (tag?: string) => {\n if (tag) {\n const updateState = await updateAppRelease(appManifest, tag);\n return match(updateState, {\n TagUpdated: () => tag,\n TagNotFound: ({ cause }) => {\n writeDebugLog(cause);\n return createAppRelease(appManifest, projectId);\n },\n });\n }\n return createAppRelease(appManifest, projectId);\n };\n\n const armTag = await createOrUpdateAppRelease(appConfig?.devArmTag);\n\n if (armTag !== appConfig?.devArmTag) {\n await saveAppConfig(model.projectFolder, { devArmTag: armTag }).catch(\n (error: unknown) => writeDebugLog(error)\n );\n }\n\n projectModelWatcher\n .onChange(async (newModel, changeType) => {\n try {\n if (changeType === 'model-updated') {\n if (newModel.components.length === 0) {\n return;\n }\n\n const updatedAppManifest = await createAppManifestWithBaseUrl(\n newModel,\n devServerUrl,\n backendServerUrl\n );\n\n if (!deepEqual(appManifest, updatedAppManifest)) {\n await updateAppRelease(updatedAppManifest, armTag);\n }\n }\n onChange(changeType);\n } catch (e) {\n onError(e);\n }\n })\n .onError(onError);\n\n return armTag;\n },\n [createAppRelease, model, updateAppRelease, writeDebugLog]\n );\n}\n","export { ARMClient } from './client.js';\nexport { useARMClient } from './useARMClient.js';\n","import type {\n ComponentConfig,\n VersionType,\n} from '@wix/ambassador-ctp-gradual-rollout-v1-app-config/types';\nimport type { AppManifest } from '@wix/cli-app-manifest';\nimport type { HttpClient, HttpError } from '@wix/cli-http-client';\nimport type { Options } from 'p-retry';\nimport {\n createAppRelease,\n createComponents,\n promoteAppReleaseToDevCenter,\n updateAppRelease,\n} from '@wix/ambassador-ctp-gradual-rollout-v1-app-config/http';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { isHttpError } from '@wix/cli-http-client';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport pRetry from 'p-retry';\nimport { fields, variant } from 'variant';\nimport { createAppReleaseSchema, promoteAppReleaseSchema } from './schemas.js';\n\nconst { AppPermissionDenied } = CliErrorCode;\n\nconst UpdateAppReleaseData = variant({\n TagNotFound: fields<{ cause: HttpError }>(),\n TagUpdated: {},\n});\n\nexport class ARMClient {\n private readonly retryOptions: Options;\n\n constructor(private readonly httpClient: HttpClient) {\n const { minRetryTimeout } = getTestOverrides();\n\n this.retryOptions = {\n maxTimeout: 3 * 1000,\n minTimeout: minRetryTimeout,\n retries: 3,\n };\n }\n\n createComponents = async (\n appId: string,\n componentConfigs: ComponentConfig[],\n projectId: string\n ) => {\n try {\n await pRetry(\n () =>\n this.httpClient.request(\n createComponents({\n appId,\n componentConfigs,\n projectId,\n })\n ),\n this.retryOptions\n );\n } catch (e) {\n if (isHttpError(e) && e.response?.status === 403) {\n throw new CliError({\n cause: e,\n code: AppPermissionDenied({ appId }),\n });\n }\n throw new CliError({\n cause: e,\n code: CliErrorCode.FailedToCreateComponents(),\n });\n }\n };\n\n createAppRelease = async (manifest: AppManifest, projectId: string) => {\n try {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n createAppRelease({\n appId: manifest.appId,\n componentConfigs: manifest.components,\n projectId,\n })\n ),\n this.retryOptions\n );\n\n return createAppReleaseSchema.parse(data).tag;\n } catch (e) {\n if (isHttpError(e) && e.response?.status === 403) {\n throw new CliError({\n cause: e,\n code: AppPermissionDenied({ appId: manifest.appId }),\n });\n }\n throw new CliError({\n cause: e,\n code: CliErrorCode.FailedToCreateAppRelease(),\n });\n }\n };\n\n updateAppRelease = async (manifest: AppManifest, tag: string) => {\n try {\n await pRetry(\n () =>\n this.httpClient.request(\n updateAppRelease({\n appId: manifest.appId,\n componentConfigs: manifest.components,\n tag,\n })\n ),\n this.retryOptions\n );\n\n return UpdateAppReleaseData.TagUpdated();\n } catch (e) {\n if (isHttpError(e)) {\n if (e.response?.status === 404) {\n return UpdateAppReleaseData.TagNotFound({ cause: e });\n }\n if (e.response?.status === 403) {\n throw new CliError({\n cause: e,\n code: AppPermissionDenied({ appId: manifest.appId }),\n });\n }\n }\n throw new CliError({\n cause: e,\n code: CliErrorCode.FailedToUpdateAppRelease(),\n });\n }\n };\n\n promoteToDevCenter = async (\n appId: string,\n tag: string,\n versionType: VersionType\n ) => {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n promoteAppReleaseToDevCenter({ appId, tag, versionType })\n ),\n this.retryOptions\n );\n\n return promoteAppReleaseSchema.parse(data);\n };\n}\n",null,"import { z } from 'zod';\n\nexport const promoteAppReleaseSchema = z.object({\n newVersion: z.string(),\n});\n\nexport const createAppReleaseSchema = z.object({\n tag: z.string(),\n});\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { ARMClient } from './client.js';\n\nexport function useARMClient(): ARMClient {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new ARMClient(httpClient), [httpClient]);\n}\n","import { useRef, useCallback, useEffect } from 'react';\nimport { createServer } from 'vite';\nimport type { InlineConfig, ViteDevServer } from 'vite';\nimport { useDevCenterClient } from '@wix/dev-center-client';\nimport { useErrorReporter } from '@wix/cli-error-reporting';\nimport type { ClientViteConfigOptions } from '../../vite/index.js';\nimport { getClientViteConfig, getBackendViteConfig } from '../../vite/index.js';\nimport { getViteServerUrl } from '../../vite/vite-server-url.js';\nimport type { ProjectModelWatcher } from '../../app-manifest/project-model-watcher.js';\nimport { useProjectModel } from '../../model.js';\nimport { ConfigType } from '../../vite/vite-config-options.js';\nimport type { Logger } from '../../vite/logger.js';\n\ninterface Options {\n projectModelWatcher: ProjectModelWatcher;\n customLogger: Logger;\n}\n\nfunction useViteDevServer<T>({\n createConfig,\n}: {\n createConfig: (options: T) => Promise<InlineConfig>;\n}) {\n const { reportError } = useErrorReporter();\n const devServerRef = useRef<ViteDevServer>();\n\n useEffect(() => {\n return () => {\n devServerRef.current?.close().catch(reportError);\n };\n }, [reportError]);\n\n return useCallback(\n async (options: T) => {\n const config = await createConfig(options);\n const devServer = await createServer(config);\n\n devServerRef.current = devServer;\n\n await devServer.listen();\n\n return { devServerUrl: getViteServerUrl(devServer), devServer };\n },\n [createConfig]\n );\n}\n\nexport function useClientDevServer({ https }: { https: boolean }) {\n const { model } = useProjectModel();\n\n const createDevServer = useViteDevServer<Options & ClientViteConfigOptions>({\n createConfig: ({ projectModelWatcher, baseBackendUrl, customLogger }) => {\n return getClientViteConfig(\n model,\n {\n type: ConfigType.dev,\n https,\n projectModelWatcher,\n customLogger,\n },\n { baseBackendUrl }\n );\n },\n });\n\n return createDevServer;\n}\n\nexport function useBackendDevServer({ https }: { https: boolean }) {\n const { model } = useProjectModel();\n const { getAppSecret } = useDevCenterClient();\n\n const createDevServer = useViteDevServer<Options>({\n createConfig: async ({ projectModelWatcher, customLogger }) => {\n const appSecret = await getAppSecret({\n appId: model.config.appId,\n });\n\n return getBackendViteConfig(\n model,\n {\n type: ConfigType.dev,\n https,\n customLogger,\n projectModelWatcher,\n },\n appSecret\n );\n },\n });\n\n return createDevServer;\n}\n","import React, { useContext, createContext } from 'react';\nimport type { FC, ReactNode } from 'react';\n\ninterface ArmTag {\n armTag: string;\n}\n\nconst ArmTagContext = createContext<ArmTag | null>(null);\n\nexport const ArmTagProvider: FC<{ children: ReactNode; armTag: string }> = ({\n children,\n armTag,\n}) => {\n return (\n <ArmTagContext.Provider value={{ armTag }}>\n {children}\n </ArmTagContext.Provider>\n );\n};\n\nexport const useArmTag = () => {\n const context = useContext(ArmTagContext);\n\n if (context == null) {\n throw new Error('useArmTag() cannot be used without an <ArmTagProvider>');\n }\n\n return context;\n};\n","import { useCallback, useEffect, useRef } from 'react';\nimport { deepEqual } from 'fast-equals';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { useSiteOverrideClient } from '@wix/site-override-client';\nimport { useDebugLog } from '@wix/cli-debug-log';\nimport { useExit } from '@wix/cli-ui-kit';\nimport type { ProjectModelWatcher } from '../../app-manifest/project-model-watcher.js';\nimport { useProjectModel } from '../../model.js';\nimport { createSiteOverrides } from '../../site-override/createSiteOverrides.js';\nimport { useSite } from '../../site/useSite.js';\nimport { readAppConfig, saveAppConfig } from '../../files/app.config.js';\n\nexport function useSiteOverrideUpdater() {\n const { model } = useProjectModel();\n const { site } = useSite();\n const exit = useExit();\n const writeDebugLog = useDebugLog();\n const { createOverride } = useSiteOverrideClient();\n const { appId } = model.config;\n\n const siteRef = useRef(site);\n const isUpdaterInitialized = useRef(false);\n\n useEffect(() => {\n siteRef.current = site;\n\n const updateSiteOverrides = async () => {\n const overrides = createSiteOverrides(model) ?? {};\n const appConfig = await readAppConfig(model.projectFolder, writeDebugLog);\n const siteOverrideId = appConfig?.devSiteOverrideId;\n\n if (!siteOverrideId) {\n throw new CliError({\n code: CliErrorCode.InvalidSiteOverrideID(),\n cause: null,\n });\n }\n\n await createOverride({\n appId,\n siteId: site.id,\n overrides,\n siteOverrideId,\n });\n };\n\n if (isUpdaterInitialized.current) {\n updateSiteOverrides().catch(exit);\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [site]);\n\n return useCallback(\n async ({\n projectModelWatcher,\n }: {\n projectModelWatcher: ProjectModelWatcher;\n }) => {\n const appConfig = await readAppConfig(model.projectFolder, writeDebugLog);\n let overrides = createSiteOverrides(model) ?? {};\n\n const { id: siteOverrideId } = await createOverride({\n appId,\n siteId: site.id,\n overrides,\n siteOverrideId: appConfig?.devSiteOverrideId,\n });\n\n projectModelWatcher.onChange(async (newModel, changeType) => {\n if (changeType === 'model-updated') {\n const updatedOverrides = createSiteOverrides(newModel) ?? {};\n\n if (!deepEqual(overrides, updatedOverrides)) {\n await createOverride({\n appId,\n siteId: siteRef.current.id,\n overrides: updatedOverrides,\n siteOverrideId,\n });\n\n overrides = updatedOverrides;\n }\n }\n });\n\n if (siteOverrideId !== appConfig?.devSiteOverrideId) {\n await saveAppConfig(model.projectFolder, {\n devSiteOverrideId: siteOverrideId,\n }).catch((error: unknown) => writeDebugLog(error));\n }\n\n isUpdaterInitialized.current = true;\n\n return siteOverrideId;\n },\n [model, writeDebugLog, createOverride, appId, site]\n );\n}\n","export { SiteOverrideClient } from './client.js';\nexport type { ComponentsForSiteOverride } from './client.js';\nexport { useSiteOverrideClient } from './useSiteOverrideClient.js';\n","import type { HttpClient } from '@wix/cli-http-client';\nimport type { Options } from 'p-retry';\nimport pRetry from 'p-retry';\nimport { createOverride } from '@wix/ambassador-cli-site-override-service-v1-site-override/http';\nimport { isHttpError } from '@wix/cli-http-client';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport type { ComponentOverride } from '@wix/ambassador-cli-site-override-service-v1-site-override/types';\nimport { createOverrideSchema } from './schemas.js';\n\nexport type ComponentsForSiteOverride = Record<string, ComponentOverride>;\n\nexport class SiteOverrideClient {\n private readonly retryOptions: Options;\n\n constructor(private readonly httpClient: HttpClient) {\n const { minRetryTimeout } = getTestOverrides();\n\n this.retryOptions = {\n retries: 3,\n minTimeout: minRetryTimeout,\n maxTimeout: 3 * 1000,\n };\n }\n\n public createOverride = async ({\n appId,\n siteId,\n overrides,\n siteOverrideId,\n }: {\n appId: string;\n siteId: string;\n overrides: ComponentsForSiteOverride;\n siteOverrideId?: string;\n }) => {\n try {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n createOverride({\n siteOverride: {\n id: siteOverrideId,\n appId,\n siteId,\n overrides,\n },\n })\n ),\n this.retryOptions\n );\n\n return createOverrideSchema.parse(data).siteOverride;\n } catch (error) {\n if (isHttpError(error) && error.response?.status === 403) {\n if (\n error.response.data?.details?.applicationError?.code ===\n 'PERMISSION_DENIED_FOR_SITE'\n ) {\n throw new CliError({\n code: CliErrorCode.SitePermissionDenied({ siteId }),\n cause: error,\n });\n }\n\n throw new CliError({\n code: CliErrorCode.AppPermissionDenied({ appId }),\n cause: error,\n });\n }\n\n throw new CliError({\n code: CliErrorCode.FailedToCreateSiteOverride(),\n cause: error,\n });\n }\n };\n}\n",null,"import { z } from 'zod';\n\nexport const createOverrideSchema = z.object({\n siteOverride: z.object({\n id: z.string(),\n }),\n});\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { SiteOverrideClient } from './client.js';\n\nexport function useSiteOverrideClient() {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new SiteOverrideClient(httpClient), [httpClient]);\n}\n","import { isType } from 'variant';\nimport { Type } from '@wix/ambassador-cli-site-override-service-v1-site-override/types';\nimport type { ComponentOverride } from '@wix/ambassador-cli-site-override-service-v1-site-override/types';\nimport type { ProjectModel } from '../model.js';\nimport { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\nexport function createSiteOverrides(model: ProjectModel) {\n const componentsToOverride = model.components.filter(\n isType(DevCenterComponent.EmbeddedScript)\n );\n\n if (componentsToOverride.length === 0) {\n return null;\n }\n\n return componentsToOverride.reduce<Record<string, ComponentOverride>>(\n (acc, component) => {\n const paramsOverride = component.paramsOverride ?? {};\n\n return {\n ...acc,\n [component.id]: {\n type: Type.EMBEDDED_SCRIPT,\n componentId: component.id,\n embeddedScriptOptions: { parameters: paramsOverride },\n },\n };\n },\n {}\n );\n}\n",null,"import { useContext } from 'react';\nimport { SiteContext } from './context.js';\nimport type { SiteState } from './context.js';\n\nexport function useSite(): SiteState {\n const context = useContext(SiteContext);\n if (context == null) {\n throw new Error('useSite() cannot be used without an <SiteProvider>');\n }\n return context;\n}\n","import { createContext } from 'react';\nimport type { Site } from '@wix/site-list-client';\n\nexport interface SiteState {\n site: Site;\n setSite: (site: Site) => Promise<void>;\n}\n\nexport const SiteContext = createContext<SiteState | null>(null);\n","import React, { useContext, createContext } from 'react';\nimport type { FC, ReactNode } from 'react';\n\ninterface SiteOverride {\n siteOverrideId?: string;\n}\n\nconst SiteOverrideContext = createContext<SiteOverride | null>(null);\n\nexport const SiteOverrideProvider: FC<{\n children: ReactNode;\n siteOverrideId?: string;\n}> = ({ children, siteOverrideId }) => {\n return (\n <SiteOverrideContext.Provider value={{ siteOverrideId }}>\n {children}\n </SiteOverrideContext.Provider>\n );\n};\n\nexport const useSiteOverrideId = () => {\n const context = useContext(SiteOverrideContext);\n\n if (context == null) {\n throw new Error(\n 'useSiteOverrideId() cannot be used without an <SiteOverrideProvider>'\n );\n }\n\n return context;\n};\n","import pRetry from 'p-retry';\nimport type { Options } from 'p-retry';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { QuerySitesRequest } from '@wix/ambassador-site-list-v2-site/types';\nimport { querySites } from '@wix/ambassador-site-list-v2-site/http';\nimport type { HttpClient } from '@wix/cli-http-client';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { querySitesSchema } from './schemas.js';\n\nexport class SiteListClient {\n private readonly retryOptions: Options;\n\n constructor(private readonly httpClient: HttpClient) {\n const { minRetryTimeout } = getTestOverrides();\n\n this.retryOptions = {\n retries: 3,\n minTimeout: minRetryTimeout,\n maxTimeout: 3 * 1000,\n };\n }\n\n querySites = async (opts: QuerySitesRequest = {}) => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(querySites(opts)),\n this.retryOptions\n );\n\n return querySitesSchema.parse(data).sites;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToQuerySites(),\n cause: e,\n info: { ...opts },\n });\n }\n };\n\n getSite = async (id: string) => {\n try {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n querySites({ query: { filter: { id: { $in: [id] } } } })\n ),\n this.retryOptions\n );\n\n const { sites } = querySitesSchema.parse(data);\n return sites.at(0) ?? null;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToGetSite(),\n cause: e,\n info: { id },\n });\n }\n };\n}\n",null,"import { z } from 'zod';\n\nconst siteSchema = z.object({\n id: z.string(),\n displayName: z.string(),\n viewUrl: z.union([z.string().url(), z.literal('')]).optional(),\n});\n\nexport const querySitesSchema = z.object({\n sites: z.array(siteSchema),\n});\n\nexport type Site = z.TypeOf<typeof siteSchema>;\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { SiteListClient } from './site-list-client.js';\n\nexport function useSiteListClient(): SiteListClient {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new SiteListClient(httpClient), [httpClient]);\n}\n","export { SiteListClient } from './site-list-client.js';\nexport type { Site } from './schemas.js';\nexport { useSiteListClient } from './useSiteListClient.js';\n","import { variant, fields } from 'variant';\nimport type { VariantOf, TypeNames } from 'variant';\nimport type { Site } from '@wix/site-list-client';\n\nexport const SiteState = variant({\n NotConfigured: {},\n NotFound: fields<{ id: string }>(),\n Resolved: fields<{ site: Site }>(),\n});\n\nexport type SiteState<T extends TypeNames<typeof SiteState> = undefined> =\n VariantOf<typeof SiteState, T>;\n","import type { SiteListClient } from '@wix/site-list-client';\nimport type { WriteDebugLogFn } from '@wix/cli-debug-log';\nimport { readAppConfig } from '../files/app.config.js';\nimport { SiteState } from './site-state.js';\n\nexport async function resolveConfiguredSite({\n projectFolder,\n siteListClient: { getSite },\n siteId,\n writeDebugLog,\n}: {\n projectFolder: string;\n siteListClient: SiteListClient;\n siteId?: string;\n writeDebugLog?: WriteDebugLogFn;\n}) {\n const resolvedSiteId = !siteId\n ? (await readAppConfig(projectFolder, writeDebugLog))?.siteId\n : siteId;\n\n if (!resolvedSiteId) {\n return SiteState.NotConfigured();\n }\n\n const site = await getSite(resolvedSiteId);\n\n if (!site) {\n return SiteState.NotFound({ id: resolvedSiteId });\n }\n\n return SiteState.Resolved({ site });\n}\n","import React, { useCallback } from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { matcher, match, isOfVariant, variantList, isType } from 'variant';\nimport { openBrowser } from '@wix/user-browser';\nimport type { Site } from '@wix/site-list-client';\nimport { Alert, Link, Text, Newline } from '@wix/cli-ui-kit';\nimport { PlatformType } from '@wix/cli-app-definitions';\nimport { URL } from 'node:url';\nimport { useProjectModel } from '../../model.js';\nimport { useSite } from '../../site/useSite.js';\nimport { useArmTag } from '../../context/armTag.js';\nimport type { DevCenterComponent } from '../../dev-center/components/dev-center-component.js';\nimport type { DashboardExtension } from './useExtensions.js';\nimport { useSiteOverrideId } from '../../context/siteOverride.js';\nimport { useDevEnvironment } from '../DevCommand/DevEnvironment.js';\n\n/*\nThis function is a workaround to open the new CSM v2 experience to external users before the experiment is open to external users.\n\nIn the *editor and viewer* we are using elgar to redirect the user to the editor with the overrides in his cookie - since there is no support for query params overrides in certain flows.\n*/\nexport const redirectWithCSMv2FTs = (\n url: URL,\n platformType: PlatformType\n): URL => {\n const elgarBaseURL = isType(platformType, PlatformType.Site)\n ? `${url.origin}/_api`\n : 'https://apps.wix.com';\n const elgarRedirectUrl = new URL(`${elgarBaseURL}/elgar-server/redirect`);\n\n const petriOvr = [\n 'specs.UseAppsRuntimeCache',\n 'specs.ApplyQueryParamsOverrides',\n 'specs.thunderbolt.passWidgetBundleUrls',\n 'specs.blocks-client.useBundledWidgetCode',\n ];\n\n for (const spec of petriOvr) {\n elgarRedirectUrl.searchParams.append('experiments', `${spec}#true`);\n }\n elgarRedirectUrl.searchParams.append('redirectToUrl', url.toString());\n elgarRedirectUrl.searchParams.append('staticsVersions', '{}');\n\n return elgarRedirectUrl;\n};\n\nfunction wrapWithRedirectUrl({\n url,\n clientDevServerUrl,\n}: {\n url: string;\n clientDevServerUrl: string;\n}) {\n const redirectUrl = new URL('/redirect', clientDevServerUrl);\n redirectUrl.searchParams.append('url', url);\n\n return redirectUrl.href;\n}\n\nexport function useResolvePlatformUrl() {\n const { model } = useProjectModel();\n const { site } = useSite();\n const { armTag } = useArmTag();\n const { siteOverrideId } = useSiteOverrideId();\n\n return useCallback(\n (platformType: PlatformType) => {\n return resolvePlatformUrl(platformType, {\n site,\n appId: model.config.appId,\n tag: armTag,\n siteOverrideId,\n });\n },\n [site, model.config.appId, armTag, siteOverrideId]\n );\n}\n\nexport function useResolvePlatformDevUrl() {\n const resolvePlatformUrl = useResolvePlatformUrl();\n const { https, clientDevServerUrl } = useDevEnvironment();\n\n return useCallback(\n (platformType: PlatformType) => {\n let url = resolvePlatformUrl(platformType);\n\n if (https) {\n url = wrapWithRedirectUrl({ url, clientDevServerUrl });\n }\n\n return url;\n },\n [resolvePlatformUrl, https, clientDevServerUrl]\n );\n}\n\nexport function resolvePlatformUrl(\n platformType: PlatformType,\n options: {\n site: Site;\n appId: string;\n tag: string;\n siteOverrideId?: string;\n }\n) {\n const { site, tag, siteOverrideId } = options;\n\n const url = match(platformType, {\n Dashboard: () => new URL(`dashboard/${site.id}`, 'https://manage.wix.com/'),\n Editor: () => new URL(`https://wix.com/editor/${site.id}`),\n Site: () => {\n const siteUrl = new URL(site.viewUrl!);\n if (siteOverrideId) {\n siteUrl.searchParams.append('site-override', siteOverrideId);\n }\n return siteUrl;\n },\n });\n\n url.searchParams.append('apps-override', tag);\n\n return isOfVariant(\n platformType,\n variantList([PlatformType.Editor, PlatformType.Site])\n )\n ? redirectWithCSMv2FTs(url, platformType).toString()\n : url.toString();\n}\n\nexport function useResolveDashboardExtensionUrl() {\n const { model } = useProjectModel();\n const { site } = useSite();\n const { armTag } = useArmTag();\n const { siteOverrideId } = useSiteOverrideId();\n\n return useCallback(\n (extension: DevCenterComponent<DashboardExtension>) => {\n return resolveDashboardExtensionUrl(extension, {\n site,\n appId: model.config.appId,\n tag: armTag,\n siteOverrideId,\n });\n },\n [site, model.config.appId, armTag, siteOverrideId]\n );\n}\n\nexport function useResolveDashboardExtensionDevUrl() {\n const resolveDashboardExtensionUrl = useResolveDashboardExtensionUrl();\n const { https, clientDevServerUrl } = useDevEnvironment();\n\n return useCallback(\n (extension: DevCenterComponent<DashboardExtension>) => {\n let url = resolveDashboardExtensionUrl(extension);\n\n if (https) {\n url = wrapWithRedirectUrl({ url, clientDevServerUrl });\n }\n\n return url;\n },\n [resolveDashboardExtensionUrl, https, clientDevServerUrl]\n );\n}\n\nexport function resolveDashboardExtensionUrl(\n extension: DevCenterComponent<DashboardExtension>,\n options: {\n site: Site;\n appId: string;\n tag: string;\n siteOverrideId?: string;\n }\n) {\n const { appId, site, tag } = options;\n\n const url = matcher(extension)\n .with({\n DashboardPage: () =>\n new URL(\n `dashboard/${site.id}/app/${appId}${extension.route}`,\n 'https://manage.wix.com/'\n ),\n })\n .when(\n ['DashboardMenuPlugin', 'DashboardPlugin', 'DashboardModal'],\n () =>\n new URL(\n `dashboard/${site.id}${extension.route}`,\n 'https://manage.wix.com/'\n )\n )\n .complete();\n\n url.searchParams.append('apps-override', tag);\n\n return url.toString();\n}\n\nexport const useOpenPage = () => {\n const { logger } = useDevEnvironment();\n\n return useCallback(\n async ({ url, title }: { url: string; title: string }) => {\n try {\n await openBrowser(url);\n } catch {\n logger.error(\n <Alert type=\"error\">\n <Trans\n i18nKey=\"general.open_page_error\"\n components={[<Text bold />]}\n values={{ title }}\n />\n <Newline />\n <Link url={url} />\n </Alert>\n );\n }\n },\n [logger]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,IAAAA,iBAAiD;AAEjD,IAAAC,kBAAsB;;;ACFtB;AAAA,IAAAC,gBAA4B;AAC5B,IAAAC,kBAAsB;;;ACDtB;;;ACAA;;;ACcA;AAIA,IAAM,2BAA2B,CAAA;AACjC,IAAM,4BAA4B,CAAA;AAClC,IAAM,2BAA2B,CAAA;AACjC,IAAM,4BAA4B,CAAA;AAGlC,IAAM,uCAAuC,CAAA;AAC7C,IAAM,wCAAwC,CAAA;AAC9C,IAAM,2BAA2B,CAAA;AACjC,IAAM,4BAA4B,CAAA;AAElC,SAAS,6CACP,MAA8C;AAE9C,MAAM,mBAAmB;IACvB,yBAAyB;MACvB;QACE,SAAS;QACT,UAAU;;;IAGd,oBAAoB;MAClB;QACE,SAAS;QACT,UAAU;;;IAGd,YAAY;MACV;QACE,SAAS;QACT,UAAU;;;IAGd,cAAc;MACZ;QACE,SAAS;QACT,UAAU;;;IAGd,qBAAqB;MACnB;QACE,SACE;QACF,UAAU;;MAEZ;QACE,SACE;QACF,UAAU;;MAEZ;QACE,SAAS;QACT,UAAU;;MAEZ;QACE,SAAS;QACT,UAAU;;MAEZ;QACE,SAAS;QACT,UAAU;;MAEZ;QACE,SAAS;QACT,UAAU;;;IAGd,wBAAwB;MACtB;QACE,SAAS;QACT,UAAU;;MAEZ;QACE,SAAS;QACT,UAAU;;MAEZ;QACE,SAAS;QACT,UAAU;;MAEZ;QACE,SAAS;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C1D;AACF;AAEO,SAAS,6BACd,WACA,SAMA;AACA,QAAM,EAAE,OAAO,MAAM,IAAI,IAAI;AAE7B,QAAM,UAAM,yBAAQ,SAAS,EAC1B,KAAK;AAAA,IACJ,eAAe,MACb,IAAIF;AAAA,MACF,aAAa,KAAK,EAAE,QAAQ,KAAK,GAAG,UAAU,KAAK;AAAA,MACnD;AAAA,IACF;AAAA,EACJ,CAAC,EACA;AAAA,IACC,CAAC,uBAAuB,mBAAmB,gBAAgB;AAAA,IAC3D,MACE,IAAIA;AAAA,MACF,aAAa,KAAK,EAAE,GAAG,UAAU,KAAK;AAAA,MACtC;AAAA,IACF;AAAA,EACJ,EACC,SAAS;AAEZ,MAAI,aAAa,OAAO,iBAAiB,GAAG;AAE5C,SAAO,IAAI,SAAS;AACtB;AAEO,IAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,OAAO,IAAI,kBAAkB;AAErC,aAAO;AAAA,IACL,OAAO,EAAE,KAAK,MAAM,MAAsC;AACxD,UAAI;AACF,cAAM,YAAY,GAAG;AAAA,MACvB,QAAQ;AACN,eAAO;AAAA,UACL,+BAAAG,QAAA,cAAC,SAAM,MAAK,WACV,+BAAAA,QAAA;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,YAAY,CAAC,+BAAAA,QAAA,cAAC,QAAK,MAAI,MAAC,CAAE;AAAA,cAC1B,QAAQ,EAAE,MAAM;AAAA;AAAA,UAClB,GACA,+BAAAA,QAAA,cAAC,aAAQ,GACT,+BAAAA,QAAA,cAAC,QAAK,KAAU,CAClB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AACF;","names":["import_react","import_variant","import_react","import_variant","_a","_a","createAppRelease","updateAppRelease","import_react","getViteConfig","import_react","React","import_react","_a","import_react","import_variant","Type","WebhookIdentityType","import_react","import_react","createOverride","import_react","React","React","https","_a","import_react","import_variant","import_react","import_variant","URL","URL","resolvePlatformUrl","resolveDashboardExtensionUrl","React"]}
@@ -1,2 +0,0 @@
1
- import{wixContext as l}from"@wix/sdk-context";function u(){let o=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(o)return{initWixModules(e,n){return r(()=>o(e,n))},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 l.client<"u"?l.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof l.elevatedClient<"u"?l.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!i))return{initWixModules(e,n){if(n){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,n)=>{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,n)},async graphql(e,n,a){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(e,n,a)}}}function r(o){let t=globalThis.__wix_context__,i={client:l.client,elevatedClient:l.elevatedClient},e;globalThis.__wix_context__=void 0,l.client=void 0,l.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,l.client=i.client,l.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=e.client,$wixContext.elevatedClient=e.elevatedClient)}}function x(o,t){return{...o,...Object.fromEntries(t.map(i=>[i,(...e)=>{let n=u();if(!n)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return n.initWixModules(o)[i].apply(void 0,e)}]))}}function h(o){return x({__type:"host",create:t=>Object.entries(o).reduce((i,[e,n])=>({...i,[e]:n(t)}),{})},Object.keys(o))}export{h as a};
2
- //# sourceMappingURL=chunk-DGX4CFXG.js.map
@@ -1 +0,0 @@
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"],"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"],"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,WAAW,gBAAgB,eAC3B,OACd,GAAI,GAACM,GAAoB,CAACC,GAG1B,MAAO,CACH,eAAeC,EAAYJ,EAAU,CACjC,GAAIA,EAAU,CACV,GAAI,CAACG,EACD,MAAM,IAAI,MAAM,2JAA2J,EAE/K,OAAOF,EAAkB,IAAME,EAAe,IAAIC,CAAU,CAAC,CACjE,CAC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CAC5C,OAAOC,EAA0B,CAC7B,OAAQ,OACR,OAASC,GAAS,OAAO,QAAQF,CAAa,EAAE,OAAO,CAACG,EAAK,CAACC,EAAKC,CAAE,KAAO,CACxE,GAAGF,EACH,CAACC,CAAG,EAAGC,EAAGH,CAAI,CAClB,GAAI,CAAC,CAAC,CACV,EAAG,OAAO,KAAKF,CAAa,CAAC,CACjC","names":["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"]}
@@ -1,2 +0,0 @@
1
- import{a as re,b as oe,c as ie,d as se,f as A}from"./chunk-SBZEOPXX.js";var ce={};ie(ce,{EventDefinition:()=>T,SERVICE_PLUGIN_ERROR_TYPE:()=>S,ServicePluginDefinition:()=>ae});function T(e,t=!1,n=s=>s){return()=>({__type:"event-definition",type:e,isDomainEvent:t,transformations:n})}function ae(e,t){return{__type:"service-plugin-definition",componentType:e,methods:t}}var S,W=re(()=>{"use strict";S="wix_spi_error"});var K=oe((De,G)=>{"use strict";var P=class e extends Error{constructor(t){super(e._prepareSuperMessage(t)),Object.defineProperty(this,"name",{value:"NonError",configurable:!0,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(this,e)}static _prepareSuperMessage(t){try{return JSON.stringify(t)}catch{return String(t)}}},he=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0}],R=Symbol(".toJSON called"),xe=e=>{e[R]=!0;let t=e.toJSON();return delete e[R],t},j=({from:e,seen:t,to_:n,forceEnumerable:s,maxDepth:o,depth:r})=>{let a=n||(Array.isArray(e)?[]:{});if(t.push(e),r>=o)return a;if(typeof e.toJSON=="function"&&e[R]!==!0)return xe(e);for(let[i,l]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(l)){a[i]="[object Buffer]";continue}if(typeof l!="function"){if(!l||typeof l!="object"){a[i]=l;continue}if(!t.includes(e[i])){r++,a[i]=j({from:e[i],seen:t.slice(),forceEnumerable:s,maxDepth:o,depth:r});continue}a[i]="[Circular]"}}for(let{property:i,enumerable:l}of he)typeof e[i]=="string"&&Object.defineProperty(a,i,{value:e[i],enumerable:s?!0:l,configurable:!0,writable:!0});return a},me=(e,t={})=>{let{maxDepth:n=Number.POSITIVE_INFINITY}=t;return typeof e=="object"&&e!==null?j({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0}):typeof e=="function"?`[Function: ${e.name||"anonymous"}]`:e},we=(e,t={})=>{let{maxDepth:n=Number.POSITIVE_INFINITY}=t;if(e instanceof Error)return e;if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let s=new Error;return j({from:e,seen:[],to_:s,maxDepth:n,depth:0}),s}return new P(e)};G.exports={serializeError:me,deserializeError:we}});W();import{wixContext as ee}from"@wix/sdk-context";var le=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}`)}},I=e=>t=>async n=>{let s,o=r=>{if(s=e(n)(r),s.url===void 0)throw new Error("Url was not successfully created for this request, please reach out to support channels for assistance.");let{method:a,url:i,params:l}=s;return{...s,method:le(a),url:i,data:s.data,params:l}};try{let r=await t.request(o);if(s===void 0)throw new Error("Request options were not created for this request, please reach out to support channels for assistance.");let a=Array.isArray(s.transformResponse)?s.transformResponse:[s.transformResponse],i=r.data;return a.forEach(l=>{l&&(i=l(r.data,r.headers))}),i}catch(r){throw typeof r=="object"&&r!==null&&"response"in r&&typeof r.response=="object"&&r.response!==null&&"data"in r.response?r.response.data:r}},H=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var $="__metadata",y="www.wixapis.com";var v=class extends Error{constructor(n,s){super(n);A(this,"message");A(this,"response");this.message=n,this.response=s}async details(){let n=await this.response.json();return de(this.response.status,n?.message,n?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:n})}},de=(e,t,n,s)=>({details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:s}},...n},message:t});var k=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},U=e=>e&&typeof e=="object"&&!Array.isArray(e);var O=e=>e.__type==="host";function N(e,t){return e.create(t)}var ue="x-wix-bi-gateway";function q(e,t,n){return{[ue]:pe({environment:`js-sdk${n?`-${n}`:""}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function pe(e){return Object.entries(e).filter(([t,n])=>!!n).map(([t,n])=>`${t}=${n}`).join(",")}import{wixContext as _}from"@wix/sdk-context";function M(e){let t=globalThis.__wix_context__,n={client:_.client,elevatedClient:_.elevatedClient},s;globalThis.__wix_context__=void 0,_.client=void 0,_.elevatedClient=void 0,typeof $wixContext<"u"&&(s={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return e()}finally{globalThis.__wix_context__=t,_.client=n.client,_.elevatedClient=n.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=s.client,$wixContext.elevatedClient=s.elevatedClient)}}function J(e,t,n,s,o,r,a){return M(()=>e({request:async i=>{let l=i({host:r?.HTTPHost||y}),d=l;d.method==="GET"&&d.fallback?.length&&d.params.toString().length>4e3&&(d=l.fallback[0]);let h=`https://${r?.HTTPHost??y}${d.url}`;d.params&&d.params.toString()&&(h+=`?${d.params.toString()}`);try{let p=q(l,t,a),w=await n(h,{method:d.method,...d.data&&{body:JSON.stringify(d.data)},headers:{...p}});if(w.status!==200){let c=null;try{c=await w.json()}catch{}throw fe(w.status,c?.message,c?.details,{requestId:w.headers.get("X-Wix-Request-Id"),details:c})}return{data:await w.json(),headers:w.headers,status:w.status,statusText:w.statusText}}catch(p){throw p.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),p}},fetchWithAuth:n,wixAPIFetch:s,getActiveToken:o}))}var fe=(e,t,n,s)=>({response:{data:{details:{...!n?.validationError&&{applicationError:{description:t,code:e,data:s}},...n},message:t},status:e}});W();function C(){return{emit(e,...t){for(let n=0,s=this.events[e]||[],o=s.length;n<o;n++)s[n](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(n=>t!==n)}}}}var L=e=>e.__type==="event-definition";function D(e,t,n,s){let o;if(e.isDomainEvent){let a=n,{deletedEvent:i,actionEvent:l,createdEvent:d,updatedEvent:u,...h}=a,p={...s,...h};i?i?.deletedEntity?o={entity:i?.deletedEntity,metadata:p}:o={metadata:p}:l?o={data:l.body,metadata:p}:o={entity:d?.entity??u?.currentEntity,metadata:p}}else o={data:n,metadata:s};let r=e.transformations??(a=>a);return t(r(o))}function B(e){let t=new Map,n=C(),s={...n,getRegisteredEvents:()=>t,async process(o,r={expectedEvents:[]}){let{eventType:a,identity:i,instanceId:l,payload:d}=await this.parseJWT(o),u=[...r.expectedEvents,...Array.from(t.keys()).map(p=>({type:p}))];if(u.length>0&&!u.some(({type:p})=>p===a))throw new Error(`Unexpected event type: ${a}. Expected one of: ${u.map(p=>p.type).join(", ")}`);let h=t.get(a)??[];return await Promise.all(h.map(({eventDefinition:p,handler:w})=>D(p,w,d,{instanceId:l,identity:i}))),{instanceId:l,eventType:a,payload:d,identity:i}},async processRequest(o,r){let a=await o.text();return this.process(a,r)},async parseJWT(o){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:r,valid:a}=await e.decodeJWT(o);if(!a)throw new Error("JWT is not valid");if(typeof r.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof r.data}`);let i=JSON.parse(r.data),l=i.eventType,d=i.instanceId,u=i.identity?JSON.parse(i.identity):void 0,h=JSON.parse(i.data);return{instanceId:d,eventType:l,payload:h,identity:u}},async parseRequest(o){let r=await o.text();return this.parseJWT(r)},async executeHandlers(o){let r=Array.from(t.keys()).map(i=>({type:i}));if(r.length>0&&!r.some(({type:i})=>i===o.eventType))throw new Error(`Unexpected event type: ${o.eventType}. Expected one of: ${r.map(i=>i.type).join(", ")}`);let a=t.get(o.eventType)??[];await Promise.all(a.map(({eventDefinition:i,handler:l})=>D(i,l,o.payload,{instanceId:o.instanceId,identity:o.identity})))},apps:{AppInstalled:T("AppInstalled")(),AppRemoved:T("AppRemoved")()}};return{initModule(o){return r=>{let a=t.get(o.type)??[];a.push({eventDefinition:o,handler:r}),t.set(o.type,a),n.emit("registered",o)}},client:s}}var z=e=>e.__type==="service-plugin-definition";function F(e){let t=new Map,n=C(),s={...n,getRegisteredServicePlugins:()=>t,async parseJWT(o){if(!e.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:r,valid:a}=await e.decodeJWT(o,!0);if(!a)throw new Error("JWT is not valid");if(typeof r.data!="object"||r.data===null||!("metadata"in r.data)||typeof r.data.metadata!="object"||r.data.metadata===null||!("appExtensionType"in r.data.metadata)||typeof r.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return r.data},async process(o){let r=await this.parseJWT(o.body);return this.executeHandler(r,o.url)},async parseRequest(o){let r=await o.text();return this.parseJWT(r)},async processRequest(o){let r=o.url,a=await o.text();try{let i=await this.process({url:r,body:a});return Response.json(i)}catch(i){if(i.errorType==="SPI"&&i.applicationCode&&i.httpCode)return Response.json({applicationError:{code:i.applicationCode,data:i.data}},{status:i.httpCode});throw i}},async executeHandler(o,r){let a=o.metadata.appExtensionType.toLowerCase(),i=t.get(a)??[];if(i.length===0)throw new Error(`No service plugin implementations found for component type ${a}`);if(i.length>1)throw new Error(`Multiple service plugin implementations found for component type ${a}. This is currently not supported`);let{implementation:l,servicePluginDefinition:d}=i[0],u=d.methods.find(p=>r.endsWith(p.primaryHttpMappingPath));if(!u)throw new Error("Unexpect request: request url did not match any method: "+r);let h=l[u.name];if(!h)throw new Error(`Got request for service plugin method ${u.name} but no implementation was provided. Available methods: ${Object.keys(l).join(", ")}`);return u.transformations.toREST(await h(u.transformations.fromREST(o)))}};return{initModule(o){return r=>{let a=t.get(o.componentType.toLowerCase())??[];a.push({servicePluginDefinition:o,implementation:r}),t.set(o.componentType.toLowerCase(),a),n.emit("registered",o)}},client:s}}var X=se(K(),1);async function V(e){let t=await fetch("https://www.wixapis.com/oauth2/token-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});if(t.status!==200)throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${t.status}`);return await t.json()}var Q=e=>e.__type==="web-method-module",g;(function(e){e.Anyone="anyone",e.Admin="admin",e.SiteMember="site-member"})(g||(g={}));async function ye(e,t){let n=e.headers.get("Authorization");if(!n)throw new Error("Request is missing authentication data");let{subjectType:s}=await V(n);switch(t){case g.Anyone:{if(s!=="VISITOR"&&s!=="MEMBER"&&s!=="USER")throw new Error("Insufficient permissions");break}case g.SiteMember:{if(s!=="MEMBER"&&s!=="USER")throw new Error("Insufficient permissions");break}case g.Admin:{if(s!=="USER")throw new Error("Insufficient permissions");break}}}var Ee=/\/_webMethods\/(.+\..+)\/(.+\..+)/;function _e(e){let t=e.match(Ee);if(t)return[t[1],t[2].replace(".ajax","")]}function be(e){return!!e&&typeof e=="object"&&Array.isArray(e)}var Y="Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.";function Z(){let e={};return{initModule(n){Object.assign(e,n)},client:{async processRequest(n,s=!1){let o=_e(n.url);if(!o)return new Response("invalid request",{status:400});let[r,a]=o,i=await n.json();if(!be(i))return new Response("invalid request",{status:400});let l=e[`/${r}`];try{if(!l)throw new Error(`Error loading web module ${r}: Cannot find module '${r}'`);let u=(await l())[a];if(!u)throw new Error(`Error loading function from web module ${r}: function '${a}' not found`);return await ye(n,u.permission),Response.json({result:await u.handler(...i)})}catch(d){let u=(0,X.serializeError)(d,{maxDepth:1});return Response.json({result:s||!(d instanceof Error)?u:{...u,message:Y,stack:Y},exception:!0})}}}}}function ot(e){let t=e.headers||{Authorization:""},n=e.auth||{getAuthHeaders:c=>Promise.resolve({headers:{}})},s=n.getAuthHeaders.bind(void 0,e.host);n.getAuthHeaders=s;let o=async(c,f)=>{if(typeof c=="string"||c instanceof URL)return fetch(c,{...f,headers:{...f?.headers,...(await s()).headers}});for(let[x,m]of Object.entries((await s()).headers))c.headers.set(x,m);return fetch(c,f)},{client:r,initModule:a}=F(n),{client:i,initModule:l}=B(n),{client:d,initModule:u}=Z(),h=async(c,f)=>{let x=await s(),m=k(f);return fetch(c,{...f,headers:{...m,...t,...x?.headers,...f?.headers,...e.host?.essentials?.passThroughHeaders}})},p=(c,f)=>{if(L(c))return l(c);if(z(c))return a(c);if(O(c)&&e.host)return N(c,e.host);if(Q(c))return u(c);if(typeof c=="function"){if("__type"in c&&c.__type===S)return c;let x=e.host?.apiBaseUrl??y;return J(M(()=>H(c))?I(c):c,f??{},h,(m,E)=>{let b=new URL(m,`https://${x}`);return b.host=x,b.protocol="https",h(b.toString(),E)},n.getActiveToken,{HTTPHost:x},e.host?.name)}else return U(c)?Object.fromEntries(Object.entries(c).map(([x,m])=>[x,p(m,c[$])])):c},w=c=>{for(let f in c)t[f]=c[f]};return{...e.modules?p(e.modules):{},auth:n,setHeaders:w,use:p,enableContext(c,f={elevated:!1}){c==="global"?globalThis.__wix_context__!=null?f.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:f.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:f.elevated?ee.elevatedClient=this:ee.client=this},fetch:(c,f)=>{let x=e.host?.apiBaseUrl??y,m=new URL(c,`https://${x}`);return m.host=x,m.protocol="https",h(m.toString(),f)},fetchWithAuth:o,async graphql(c,f,x={apiVersion:"alpha"}){let m=e?.host?.apiBaseUrl??y,E=await h(`https://${m}/graphql/${x.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:c,variables:f})});if(E.status!==200)throw new v(`GraphQL request failed with status ${E.status}`,E);let{data:b,errors:ne}=await E.json();return{data:b??{},errors:ne}},webhooks:i,webMethods:d,servicePlugins:r}}export{ce as a,W as b,ot as c};
2
- //# sourceMappingURL=chunk-TN6HYRXL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/@wix/sdk-types/build/browser/index.mjs","../../../node_modules/serialize-error/index.js","../../../node_modules/@wix/sdk/build/wixClient.js","../../../node_modules/@wix/sdk/build/ambassador-modules.js","../../../node_modules/@wix/sdk/build/common.js","../../../node_modules/@wix/sdk/build/fetch-error.js","../../../node_modules/@wix/sdk/build/helpers.js","../../../node_modules/@wix/sdk/build/host-modules.js","../../../node_modules/@wix/sdk/build/bi/biHeaderGenerator.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk/build/rest-modules.js","../../../node_modules/@wix/sdk/build/event-handlers-modules.js","../../../node_modules/@wix/sdk/build/nanoevents.js","../../../node_modules/@wix/sdk/build/service-plugin-modules.js","../../../node_modules/@wix/sdk/build/web-method-modules.js","../../../node_modules/@wix/sdk/build/get-token-info.js"],"sourcesContent":["// src/event-handlers-modules.ts\nfunction EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {\n return () => ({\n __type: \"event-definition\",\n type,\n isDomainEvent,\n transformations\n });\n}\n\n// src/service-plugins.ts\nfunction ServicePluginDefinition(componentType, methods) {\n return {\n __type: \"service-plugin-definition\",\n componentType,\n methods\n };\n}\nvar SERVICE_PLUGIN_ERROR_TYPE = \"wix_spi_error\";\nexport {\n EventDefinition,\n SERVICE_PLUGIN_ERROR_TYPE,\n ServicePluginDefinition\n};\n","'use strict';\n\nclass NonError extends Error {\n\tconstructor(message) {\n\t\tsuper(NonError._prepareSuperMessage(message));\n\t\tObject.defineProperty(this, 'name', {\n\t\t\tvalue: 'NonError',\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t});\n\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, NonError);\n\t\t}\n\t}\n\n\tstatic _prepareSuperMessage(message) {\n\t\ttry {\n\t\t\treturn JSON.stringify(message);\n\t\t} catch {\n\t\t\treturn String(message);\n\t\t}\n\t}\n}\n\nconst commonProperties = [\n\t{property: 'name', enumerable: false},\n\t{property: 'message', enumerable: false},\n\t{property: 'stack', enumerable: false},\n\t{property: 'code', enumerable: true}\n];\n\nconst isCalled = Symbol('.toJSON called');\n\nconst toJSON = from => {\n\tfrom[isCalled] = true;\n\tconst json = from.toJSON();\n\tdelete from[isCalled];\n\treturn json;\n};\n\nconst destroyCircular = ({\n\tfrom,\n\tseen,\n\tto_,\n\tforceEnumerable,\n\tmaxDepth,\n\tdepth\n}) => {\n\tconst to = to_ || (Array.isArray(from) ? [] : {});\n\n\tseen.push(from);\n\n\tif (depth >= maxDepth) {\n\t\treturn to;\n\t}\n\n\tif (typeof from.toJSON === 'function' && from[isCalled] !== true) {\n\t\treturn toJSON(from);\n\t}\n\n\tfor (const [key, value] of Object.entries(from)) {\n\t\tif (typeof Buffer === 'function' && Buffer.isBuffer(value)) {\n\t\t\tto[key] = '[object Buffer]';\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (typeof value === 'function') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!value || typeof value !== 'object') {\n\t\t\tto[key] = value;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!seen.includes(from[key])) {\n\t\t\tdepth++;\n\n\t\t\tto[key] = destroyCircular({\n\t\t\t\tfrom: from[key],\n\t\t\t\tseen: seen.slice(),\n\t\t\t\tforceEnumerable,\n\t\t\t\tmaxDepth,\n\t\t\t\tdepth\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tto[key] = '[Circular]';\n\t}\n\n\tfor (const {property, enumerable} of commonProperties) {\n\t\tif (typeof from[property] === 'string') {\n\t\t\tObject.defineProperty(to, property, {\n\t\t\t\tvalue: from[property],\n\t\t\t\tenumerable: forceEnumerable ? true : enumerable,\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true\n\t\t\t});\n\t\t}\n\t}\n\n\treturn to;\n};\n\nconst serializeError = (value, options = {}) => {\n\tconst {maxDepth = Number.POSITIVE_INFINITY} = options;\n\n\tif (typeof value === 'object' && value !== null) {\n\t\treturn destroyCircular({\n\t\t\tfrom: value,\n\t\t\tseen: [],\n\t\t\tforceEnumerable: true,\n\t\t\tmaxDepth,\n\t\t\tdepth: 0\n\t\t});\n\t}\n\n\t// People sometimes throw things besides Error objects…\n\tif (typeof value === 'function') {\n\t\t// `JSON.stringify()` discards functions. We do too, unless a function is thrown directly.\n\t\treturn `[Function: ${(value.name || 'anonymous')}]`;\n\t}\n\n\treturn value;\n};\n\nconst deserializeError = (value, options = {}) => {\n\tconst {maxDepth = Number.POSITIVE_INFINITY} = options;\n\n\tif (value instanceof Error) {\n\t\treturn value;\n\t}\n\n\tif (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n\t\tconst newError = new Error(); // eslint-disable-line unicorn/error-message\n\t\tdestroyCircular({\n\t\t\tfrom: value,\n\t\t\tseen: [],\n\t\t\tto_: newError,\n\t\t\tmaxDepth,\n\t\t\tdepth: 0\n\t\t});\n\t\treturn newError;\n\t}\n\n\treturn new NonError(value);\n};\n\nmodule.exports = {\n\tserializeError,\n\tdeserializeError\n};\n","import { wixContext } from '@wix/sdk-context';\nimport { SERVICE_PLUGIN_ERROR_TYPE, } from '@wix/sdk-types';\nimport { isAmbassadorModule, toHTTPModule } from './ambassador-modules.js';\nimport { DEFAULT_API_URL, PUBLIC_METADATA_KEY } from './common.js';\nimport { FetchErrorResponse } from './fetch-error.js';\nimport { getDefaultContentHeader, isObject } from './helpers.js';\nimport { buildHostModule, isHostModule } from './host-modules.js';\nimport { buildRESTDescriptor } from './rest-modules.js';\nimport { eventHandlersModules, isEventHandlerModule, } from './event-handlers-modules.js';\nimport { isServicePluginModule, servicePluginsModules, } from './service-plugin-modules.js';\nimport { runWithoutContext } from '@wix/sdk-runtime/context';\nimport { isWebMethodModules, webMethodModules, } from './web-method-modules.js';\nexport function createClient(config) {\n const _headers = config.headers || { Authorization: '' };\n const authStrategy = config.auth ||\n {\n getAuthHeaders: (_) => Promise.resolve({ headers: {} }),\n };\n const boundGetAuthHeaders = authStrategy.getAuthHeaders.bind(undefined, config.host);\n authStrategy.getAuthHeaders = boundGetAuthHeaders;\n const fetchWithAuth = async (urlOrRequest, requestInit) => {\n if (typeof urlOrRequest === 'string' || urlOrRequest instanceof URL) {\n return fetch(urlOrRequest, {\n ...requestInit,\n headers: {\n ...requestInit?.headers,\n ...(await boundGetAuthHeaders()).headers,\n },\n });\n }\n else {\n for (const [k, v] of Object.entries((await boundGetAuthHeaders()).headers)) {\n urlOrRequest.headers.set(k, v);\n }\n return fetch(urlOrRequest, requestInit);\n }\n };\n const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(authStrategy);\n const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(authStrategy);\n const { client: webMethodClient, initModule } = webMethodModules();\n const boundFetch = async (url, options) => {\n const authHeaders = await boundGetAuthHeaders();\n const defaultContentTypeHeader = getDefaultContentHeader(options);\n return fetch(url, {\n ...options,\n headers: {\n ...defaultContentTypeHeader,\n ..._headers,\n ...authHeaders?.headers,\n ...options?.headers,\n ...config.host?.essentials?.passThroughHeaders,\n },\n });\n };\n // This is typed as `any` because when trying to properly type it as defined\n // on the WixClient, typescript starts failing with `Type instantiation is\n // excessively deep and possibly infinite.`\n const use = (modules, metadata) => {\n if (isEventHandlerModule(modules)) {\n return initEventHandlerModule(modules);\n }\n else if (isServicePluginModule(modules)) {\n return initServicePluginModule(modules);\n }\n else if (isHostModule(modules) && config.host) {\n return buildHostModule(modules, config.host);\n }\n else if (isWebMethodModules(modules)) {\n return initModule(modules);\n }\n else if (typeof modules === 'function') {\n // The generated namespaces all have the error classes on them and\n // a class is also a function, so we need to explicitly ignore these\n // error classes using a static field that exists on them.\n if ('__type' in modules && modules.__type === SERVICE_PLUGIN_ERROR_TYPE) {\n return modules;\n }\n const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;\n return buildRESTDescriptor(runWithoutContext(() => isAmbassadorModule(modules))\n ? toHTTPModule(modules)\n : modules, metadata ?? {}, boundFetch, (relativeUrl, fetchOptions) => {\n const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);\n finalUrl.host = apiBaseUrl;\n finalUrl.protocol = 'https';\n return boundFetch(finalUrl.toString(), fetchOptions);\n }, authStrategy.getActiveToken, { HTTPHost: apiBaseUrl }, config.host?.name);\n }\n else if (isObject(modules)) {\n return Object.fromEntries(Object.entries(modules).map(([key, value]) => {\n return [key, use(value, modules[PUBLIC_METADATA_KEY])];\n }));\n }\n else {\n return modules;\n }\n };\n const setHeaders = (headers) => {\n for (const k in headers) {\n _headers[k] = headers[k];\n }\n };\n const wrappedModules = config.modules\n ? use(config.modules)\n : {};\n return {\n ...wrappedModules,\n auth: authStrategy,\n setHeaders,\n use,\n enableContext(contextType, opts = { elevated: false }) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n if (opts.elevated) {\n globalThis.__wix_context__.elevatedClient = this;\n }\n else {\n globalThis.__wix_context__.client = this;\n }\n }\n else {\n if (opts.elevated) {\n globalThis.__wix_context__ = { elevatedClient: this };\n }\n else {\n globalThis.__wix_context__ = { client: this };\n }\n }\n }\n else {\n if (opts.elevated) {\n wixContext.elevatedClient = this;\n }\n else {\n wixContext.client = this;\n }\n }\n },\n /**\n * @param relativeUrl The URL to fetch relative to the API base URL\n * @param options The fetch options\n * @returns The fetch Response object\n * @deprecated Use `fetchWithAuth` instead\n */\n fetch: (relativeUrl, options) => {\n const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;\n const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);\n finalUrl.host = apiBaseUrl;\n finalUrl.protocol = 'https';\n return boundFetch(finalUrl.toString(), options);\n },\n fetchWithAuth,\n async graphql(query, variables, opts = {\n apiVersion: 'alpha',\n }) {\n const apiBaseUrl = config?.host?.apiBaseUrl ?? DEFAULT_API_URL;\n const res = await boundFetch(`https://${apiBaseUrl}/graphql/${opts.apiVersion}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ query, variables }),\n });\n if (res.status !== 200) {\n throw new FetchErrorResponse(`GraphQL request failed with status ${res.status}`, res);\n }\n const { data, errors } = await res.json();\n return { data: data ?? {}, errors };\n },\n webhooks: eventHandlersClient,\n webMethods: webMethodClient,\n servicePlugins: servicePluginsClient,\n };\n}\n","const parseMethod = (method) => {\n switch (method) {\n case 'get':\n case 'GET':\n return 'GET';\n case 'post':\n case 'POST':\n return 'POST';\n case 'put':\n case 'PUT':\n return 'PUT';\n case 'delete':\n case 'DELETE':\n return 'DELETE';\n case 'patch':\n case 'PATCH':\n return 'PATCH';\n case 'head':\n case 'HEAD':\n return 'HEAD';\n case 'options':\n case 'OPTIONS':\n return 'OPTIONS';\n default:\n throw new Error(`Unknown method: ${method}`);\n }\n};\nexport const toHTTPModule = (factory) => (httpClient) => async (payload) => {\n let requestOptions;\n const HTTPFactory = (context) => {\n requestOptions = factory(payload)(context);\n if (requestOptions.url === undefined) {\n throw new Error('Url was not successfully created for this request, please reach out to support channels for assistance.');\n }\n const { method, url, params } = requestOptions;\n return {\n ...requestOptions,\n method: parseMethod(method),\n url,\n data: requestOptions.data,\n params,\n };\n };\n try {\n const response = await httpClient.request(HTTPFactory);\n if (requestOptions === undefined) {\n throw new Error('Request options were not created for this request, please reach out to support channels for assistance.');\n }\n const transformations = Array.isArray(requestOptions.transformResponse)\n ? requestOptions.transformResponse\n : [requestOptions.transformResponse];\n /**\n * Based on Axios implementation:\n * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/lib/core/transformData.js#L22\n */\n let data = response.data;\n transformations.forEach((transform) => {\n if (transform) {\n data = transform(response.data, response.headers);\n }\n });\n return data;\n }\n catch (e) {\n if (typeof e === 'object' &&\n e !== null &&\n 'response' in e &&\n typeof e.response === 'object' &&\n e.response !== null &&\n 'data' in e.response) {\n throw e.response.data;\n }\n throw e;\n }\n};\n/*\n * Because of issues with tree-shaking, we cant really put static parameter on module.\n * We still have check for __isAmbassador for backward compatibility\n */\nexport const isAmbassadorModule = (module) => {\n if (module.__isAmbassador) {\n return true;\n }\n const fn = module();\n return Boolean(fn.__isAmbassador);\n};\n","export const PUBLIC_METADATA_KEY = '__metadata';\nexport const DEFAULT_API_URL = 'www.wixapis.com';\nexport const FORCE_WRITE_API_URLS = ['/ecom/v1/carts/current'];\n","export class FetchErrorResponse extends Error {\n message;\n response;\n constructor(message, response) {\n super(message);\n this.message = message;\n this.response = response;\n }\n async details() {\n const dataError = await this.response.json();\n return errorBuilder(this.response.status, dataError?.message, dataError?.details, {\n requestId: this.response.headers.get('X-Wix-Request-Id'),\n details: dataError,\n });\n }\n}\nconst errorBuilder = (code, description, details, data) => {\n return {\n details: {\n ...(!details?.validationError && {\n applicationError: {\n description,\n code,\n data,\n },\n }),\n ...details,\n },\n message: description,\n };\n};\n","// we follow a simplified version of the axios convention\n// https://github.com/axios/axios/blob/649d739288c8e2c55829ac60e2345a0f3439c730/lib/defaults/index.js#L65\nexport const getDefaultContentHeader = (options) => {\n if (options?.method &&\n ['post', 'put', 'patch'].includes(options.method.toLocaleLowerCase()) &&\n options.body) {\n return { 'Content-Type': 'application/json' };\n }\n return {};\n};\nexport const isObject = (val) => val && typeof val === 'object' && !Array.isArray(val);\nexport function parsePublicKeyIfEncoded(publicKey) {\n if (publicKey.includes('\\n') || publicKey.includes('\\r')) {\n // publicKey is multi-line string, can be used as is\n return publicKey.trim();\n }\n else {\n // publicKey is base64 encoded\n return typeof atob !== 'undefined'\n ? atob(publicKey)\n : Buffer.from(publicKey, 'base64').toString('utf-8');\n }\n}\n","export const isHostModule = (val) => val.__type === 'host';\nexport function buildHostModule(val, host) {\n return val.create(host);\n}\n","export const WixBIHeaderName = 'x-wix-bi-gateway';\nexport function biHeaderGenerator(apiMetadata, publicMetadata, environment) {\n return {\n [WixBIHeaderName]: objectToKeyValue({\n environment: `js-sdk${environment ? `-${environment}` : ``}`,\n 'package-name': apiMetadata.packageName ?? publicMetadata?.PACKAGE_NAME,\n 'method-fqn': apiMetadata.methodFqn,\n entity: apiMetadata.entityFqdn,\n }),\n };\n}\nfunction objectToKeyValue(input) {\n return Object.entries(input)\n .filter(([_, value]) => Boolean(value))\n .map(([key, value]) => `${key}=${value}`)\n .join(',');\n}\n","import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n throw new Error('An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { biHeaderGenerator } from './bi/biHeaderGenerator.js';\nimport { DEFAULT_API_URL } from './common.js';\nimport { runWithoutContext } from '@wix/sdk-runtime/context';\nexport function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, getActiveToken, options, hostName) {\n return runWithoutContext(() => origFunc({\n request: async (factory) => {\n const requestOptions = factory({\n host: options?.HTTPHost || DEFAULT_API_URL,\n });\n let request = requestOptions;\n if (request.method === 'GET' &&\n request.fallback?.length &&\n request.params.toString().length > 4000) {\n request = requestOptions.fallback[0];\n }\n const domain = options?.HTTPHost ?? DEFAULT_API_URL;\n let url = `https://${domain}${request.url}`;\n if (request.params && request.params.toString()) {\n url += `?${request.params.toString()}`;\n }\n try {\n const biHeader = biHeaderGenerator(requestOptions, publicMetadata, hostName);\n const res = await boundFetch(url, {\n method: request.method,\n ...(request.data && {\n body: JSON.stringify(request.data),\n }),\n headers: {\n ...biHeader,\n },\n });\n if (res.status !== 200) {\n let dataError = null;\n try {\n dataError = await res.json();\n }\n catch (e) {\n //\n }\n throw errorBuilder(res.status, dataError?.message, dataError?.details, {\n requestId: res.headers.get('X-Wix-Request-Id'),\n details: dataError,\n });\n }\n const data = await res.json();\n return {\n data,\n headers: res.headers,\n status: res.status,\n statusText: res.statusText,\n };\n }\n catch (e) {\n if (e.message?.includes('fetch is not defined')) {\n console.error('Node.js v18+ is required');\n }\n throw e;\n }\n },\n fetchWithAuth: boundFetch,\n wixAPIFetch,\n getActiveToken,\n }));\n}\nconst errorBuilder = (code, description, details, data) => {\n return {\n response: {\n data: {\n details: {\n ...(!details?.validationError && {\n applicationError: {\n description,\n code,\n data,\n },\n }),\n ...details,\n },\n message: description,\n },\n status: code,\n },\n };\n};\n","import { EventDefinition, } from '@wix/sdk-types';\nimport { createNanoEvents } from './nanoevents.js';\nexport const isEventHandlerModule = (val) => val.__type === 'event-definition';\nexport function buildEventDefinition(eventDefinition, registerHandler) {\n return (handler) => {\n registerHandler(eventDefinition, handler);\n };\n}\nfunction runHandler(eventDefinition, handler, payload, baseEventMetadata) {\n let envelope;\n if (eventDefinition.isDomainEvent) {\n const domainEventPayload = payload;\n const { deletedEvent, actionEvent, createdEvent, updatedEvent, ...domainEventMetadata } = domainEventPayload;\n const metadata = {\n ...baseEventMetadata,\n ...domainEventMetadata,\n };\n if (deletedEvent) {\n if (deletedEvent?.deletedEntity) {\n envelope = {\n entity: deletedEvent?.deletedEntity,\n metadata,\n };\n }\n else {\n envelope = { metadata };\n }\n }\n else if (actionEvent) {\n envelope = {\n data: actionEvent.body,\n metadata,\n };\n }\n else {\n envelope = {\n entity: createdEvent?.entity ?? updatedEvent?.currentEntity,\n metadata,\n };\n }\n }\n else {\n envelope = {\n data: payload,\n metadata: baseEventMetadata,\n };\n }\n const transformFromRESTFn = eventDefinition.transformations ?? ((x) => x);\n return handler(transformFromRESTFn(envelope));\n}\nexport function eventHandlersModules(authStrategy) {\n const eventHandlers = new Map();\n const webhooksEmitter = createNanoEvents();\n const client = {\n ...webhooksEmitter,\n getRegisteredEvents: () => eventHandlers,\n async process(jwt, opts = {\n expectedEvents: [],\n }) {\n const { eventType, identity, instanceId, payload } = await this.parseJWT(jwt);\n const allExpectedEvents = [\n ...opts.expectedEvents,\n ...Array.from(eventHandlers.keys()).map((type) => ({ type })),\n ];\n if (allExpectedEvents.length > 0 &&\n !allExpectedEvents.some(({ type }) => type === eventType)) {\n throw new Error(`Unexpected event type: ${eventType}. Expected one of: ${allExpectedEvents\n .map((x) => x.type)\n .join(', ')}`);\n }\n const handlers = eventHandlers.get(eventType) ?? [];\n await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, payload, {\n instanceId,\n identity,\n })));\n return {\n instanceId,\n eventType,\n payload,\n identity,\n };\n },\n async processRequest(request, opts) {\n const body = await request.text();\n return this.process(body, opts);\n },\n async parseJWT(jwt) {\n if (!authStrategy.decodeJWT) {\n throw new Error('decodeJWT is not supported by the authentication strategy');\n }\n const { decoded, valid } = await authStrategy.decodeJWT(jwt);\n if (!valid) {\n throw new Error('JWT is not valid');\n }\n if (typeof decoded.data !== 'string') {\n throw new Error(`Unexpected type of JWT data: expected string, got ${typeof decoded.data}`);\n }\n const parsedDecoded = JSON.parse(decoded.data);\n const eventType = parsedDecoded.eventType;\n const instanceId = parsedDecoded.instanceId;\n const identity = parsedDecoded.identity\n ? JSON.parse(parsedDecoded.identity)\n : undefined;\n const payload = JSON.parse(parsedDecoded.data);\n return {\n instanceId,\n eventType,\n payload,\n identity,\n };\n },\n async parseRequest(request) {\n const jwt = await request.text();\n return this.parseJWT(jwt);\n },\n async executeHandlers(event) {\n const allExpectedEvents = Array.from(eventHandlers.keys()).map((type) => ({ type }));\n if (allExpectedEvents.length > 0 &&\n !allExpectedEvents.some(({ type }) => type === event.eventType)) {\n throw new Error(`Unexpected event type: ${event.eventType}. Expected one of: ${allExpectedEvents\n .map((x) => x.type)\n .join(', ')}`);\n }\n const handlers = eventHandlers.get(event.eventType) ?? [];\n await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, event.payload, {\n instanceId: event.instanceId,\n identity: event.identity,\n })));\n },\n apps: {\n AppInstalled: EventDefinition('AppInstalled')(),\n AppRemoved: EventDefinition('AppRemoved')(),\n },\n };\n return {\n initModule(eventDefinition) {\n return (handler) => {\n const handlers = eventHandlers.get(eventDefinition.type) ?? [];\n handlers.push({ eventDefinition, handler });\n eventHandlers.set(eventDefinition.type, handlers);\n webhooksEmitter.emit('registered', eventDefinition);\n };\n },\n client,\n };\n}\n","// Inlined from https://github.com/ai/nanoevents/blob/main/index.js\n/**\n * Create event emitter.\n *\n * ```js\n * import { createNanoEvents } from 'nanoevents'\n *\n * class Ticker {\n * constructor() {\n * this.emitter = createNanoEvents()\n * }\n * on(...args) {\n * return this.emitter.on(...args)\n * }\n * tick() {\n * this.emitter.emit('tick')\n * }\n * }\n * ```\n * @returns Event emitter.\n */\nexport function createNanoEvents() {\n return {\n emit(event, ...args) {\n for (let i = 0, callbacks = this.events[event] || [], length = callbacks.length; i < length; i++) {\n callbacks[i](...args);\n }\n },\n events: {},\n on(event, cb) {\n (this.events[event] ||= []).push(cb);\n return () => {\n this.events[event] = this.events[event]?.filter((i) => cb !== i);\n };\n },\n };\n}\n","import { createNanoEvents } from './nanoevents.js';\nexport const isServicePluginModule = (val) => val.__type === 'service-plugin-definition';\nexport function servicePluginsModules(authStrategy) {\n const servicePluginsImplementations = new Map();\n const servicePluginsEmitter = createNanoEvents();\n const client = {\n ...servicePluginsEmitter,\n getRegisteredServicePlugins: () => servicePluginsImplementations,\n async parseJWT(jwt) {\n if (!authStrategy.decodeJWT) {\n throw new Error('decodeJWT is not supported by the authentication strategy');\n }\n const { decoded, valid } = await authStrategy.decodeJWT(jwt, true);\n if (!valid) {\n throw new Error('JWT is not valid');\n }\n if (typeof decoded.data !== 'object' ||\n decoded.data === null ||\n !('metadata' in decoded.data) ||\n typeof decoded.data.metadata !== 'object' ||\n decoded.data.metadata === null ||\n !('appExtensionType' in decoded.data.metadata) ||\n typeof decoded.data.metadata.appExtensionType !== 'string') {\n throw new Error('Unexpected JWT data: expected object with metadata.appExtensionType string');\n }\n return decoded.data;\n },\n async process(request) {\n const servicePluginRequest = await this.parseJWT(request.body);\n return this.executeHandler(servicePluginRequest, request.url);\n },\n async parseRequest(request) {\n const body = await request.text();\n return this.parseJWT(body);\n },\n async processRequest(request) {\n const url = request.url;\n const body = await request.text();\n try {\n const implMethodResult = await this.process({ url, body });\n return Response.json(implMethodResult);\n }\n catch (err) {\n if (err.errorType === 'SPI' && err.applicationCode && err.httpCode) {\n return Response.json({ applicationError: { code: err.applicationCode, data: err.data } }, { status: err.httpCode });\n }\n throw err;\n }\n },\n async executeHandler(servicePluginRequest, url) {\n const componentType = servicePluginRequest.metadata.appExtensionType.toLowerCase();\n const implementations = servicePluginsImplementations.get(componentType) ?? [];\n if (implementations.length === 0) {\n throw new Error(`No service plugin implementations found for component type ${componentType}`);\n }\n else if (implementations.length > 1) {\n throw new Error(`Multiple service plugin implementations found for component type ${componentType}. This is currently not supported`);\n }\n const { implementation: impl, servicePluginDefinition } = implementations[0];\n const method = servicePluginDefinition.methods.find((m) => url.endsWith(m.primaryHttpMappingPath));\n if (!method) {\n throw new Error('Unexpect request: request url did not match any method: ' + url);\n }\n const implMethod = impl[method.name];\n if (!implMethod) {\n throw new Error(`Got request for service plugin method ${method.name} but no implementation was provided. Available methods: ${Object.keys(impl).join(', ')}`);\n }\n return method.transformations.toREST(await implMethod(method.transformations.fromREST(servicePluginRequest)));\n },\n };\n return {\n initModule(servicePluginDefinition) {\n return (implementation) => {\n const implementations = servicePluginsImplementations.get(servicePluginDefinition.componentType.toLowerCase()) ?? [];\n implementations.push({ servicePluginDefinition, implementation });\n servicePluginsImplementations.set(servicePluginDefinition.componentType.toLowerCase(), implementations);\n servicePluginsEmitter.emit('registered', servicePluginDefinition);\n };\n },\n client,\n };\n}\n","import { serializeError } from 'serialize-error';\nimport { getTokenInfo } from './get-token-info.js';\nexport const isWebMethodModules = (val) => val.__type === 'web-method-module';\nvar Permissions;\n(function (Permissions) {\n Permissions[\"Anyone\"] = \"anyone\";\n Permissions[\"Admin\"] = \"admin\";\n Permissions[\"SiteMember\"] = \"site-member\";\n})(Permissions || (Permissions = {}));\nasync function checkPermission(request, permission) {\n const accessToken = request.headers.get('Authorization');\n if (!accessToken) {\n throw new Error('Request is missing authentication data');\n }\n const { subjectType } = await getTokenInfo(accessToken);\n switch (permission) {\n case Permissions.Anyone: {\n if (subjectType !== 'VISITOR' &&\n subjectType !== 'MEMBER' &&\n subjectType !== 'USER') {\n throw new Error('Insufficient permissions');\n }\n break;\n }\n case Permissions.SiteMember: {\n if (subjectType !== 'MEMBER' && subjectType !== 'USER') {\n throw new Error('Insufficient permissions');\n }\n break;\n }\n case Permissions.Admin: {\n if (subjectType !== 'USER') {\n throw new Error('Insufficient permissions');\n }\n break;\n }\n }\n}\nconst urlRegex = /\\/_webMethods\\/(.+\\..+)\\/(.+\\..+)/;\n// /_webMethods/backend/my-module.web.js/multiply.ajax\nfunction extractUrlParts(url) {\n const parts = url.match(urlRegex);\n if (parts) {\n return [parts[1], parts[2].replace('.ajax', '')];\n }\n}\nfunction isRequestBodyValid(body) {\n return !!body && typeof body === 'object' && Array.isArray(body);\n}\nconst productionErrorMessage = 'Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.';\nexport function webMethodModules() {\n const webMethods = {};\n const client = {\n async processRequest(request, devMode = false) {\n const urlParts = extractUrlParts(request.url);\n if (!urlParts) {\n return new Response('invalid request', { status: 400 });\n }\n const [file, method] = urlParts;\n const body = (await request.json());\n if (!isRequestBodyValid(body)) {\n return new Response('invalid request', { status: 400 });\n }\n const loadWebMethodFile = webMethods[`/${file}`];\n try {\n if (!loadWebMethodFile) {\n throw new Error(`Error loading web module ${file}: Cannot find module '${file}'`);\n }\n const webMethodFile = await loadWebMethodFile();\n const webMethod = webMethodFile[method];\n if (!webMethod) {\n throw new Error(`Error loading function from web module ${file}: function '${method}' not found`);\n }\n await checkPermission(request, webMethod.permission);\n return Response.json({\n result: await webMethod.handler(...body),\n });\n }\n catch (error) {\n const serializedError = serializeError(error, { maxDepth: 1 });\n return Response.json({\n result: devMode || !(error instanceof Error)\n ? serializedError\n : {\n ...serializedError,\n message: productionErrorMessage,\n stack: productionErrorMessage,\n },\n exception: true,\n });\n }\n },\n };\n return {\n initModule(webMethodModule) {\n Object.assign(webMethods, webMethodModule);\n },\n client,\n };\n}\n","export async function getTokenInfo(token) {\n const tokenInfoRes = await fetch('https://www.wixapis.com/oauth2/token-info', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n token,\n }),\n });\n if (tokenInfoRes.status !== 200) {\n throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${tokenInfoRes.status}`);\n }\n return (await tokenInfoRes.json());\n}\n"],"mappings":"wEAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,qBAAAE,EAAA,8BAAAC,EAAA,4BAAAC,KACA,SAASF,EAAgBG,EAAMC,EAAgB,GAAOC,EAAmBC,GAAMA,EAAG,CAChF,MAAO,KAAO,CACZ,OAAQ,mBACR,KAAAH,EACA,cAAAC,EACA,gBAAAC,CACF,EACF,CAGA,SAASH,GAAwBK,EAAeC,EAAS,CACvD,MAAO,CACL,OAAQ,4BACR,cAAAD,EACA,QAAAC,CACF,CACF,CAjBA,IAkBIP,EAlBJQ,EAAAC,GAAA,kBAkBIT,EAA4B,kBClBhC,IAAAU,EAAAC,GAAA,CAAAC,GAAAC,IAAA,cAEA,IAAMC,EAAN,MAAMC,UAAiB,KAAM,CAC5B,YAAYC,EAAS,CACpB,MAAMD,EAAS,qBAAqBC,CAAO,CAAC,EAC5C,OAAO,eAAe,KAAM,OAAQ,CACnC,MAAO,WACP,aAAc,GACd,SAAU,EACX,CAAC,EAEG,MAAM,mBACT,MAAM,kBAAkB,KAAMD,CAAQ,CAExC,CAEA,OAAO,qBAAqBC,EAAS,CACpC,GAAI,CACH,OAAO,KAAK,UAAUA,CAAO,CAC9B,MAAQ,CACP,OAAO,OAAOA,CAAO,CACtB,CACD,CACD,EAEMC,GAAmB,CACxB,CAAC,SAAU,OAAQ,WAAY,EAAK,EACpC,CAAC,SAAU,UAAW,WAAY,EAAK,EACvC,CAAC,SAAU,QAAS,WAAY,EAAK,EACrC,CAAC,SAAU,OAAQ,WAAY,EAAI,CACpC,EAEMC,EAAW,OAAO,gBAAgB,EAElCC,GAAS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R_TYPE","ServicePluginDefinition","type","isDomainEvent","transformations","x","componentType","methods","init_browser","__esmMin","require_serialize_error","__commonJSMin","exports","module","NonError","_NonError","message","commonProperties","isCalled","toJSON","from","json","destroyCircular","seen","to_","forceEnumerable","maxDepth","depth","to","key","value","property","enumerable","serializeError","options","deserializeError","newError","init_browser","wixContext","parseMethod","method","toHTTPModule","factory","httpClient","payload","requestOptions","HTTPFactory","context","url","params","response","transformations","data","transform","e","isAmbassadorModule","module","PUBLIC_METADATA_KEY","DEFAULT_API_URL","FetchErrorResponse","message","response","__publicField","dataError","errorBuilder","code","description","details","data","getDefaultContentHeader","options","isObject","val","isHostModule","val","buildHostModule","host","WixBIHeaderName","biHeaderGenerator","apiMetadata","publicMetadata","environment","objectToKeyValue","input","_","value","key","wixContext","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext","buildRESTDescriptor","origFunc","publicMetadata","boundFetch","wixAPIFetch","getActiveToken","options","hostName","runWithoutContext","factory","requestOptions","DEFAULT_API_URL","request","url","biHeader","biHeaderGenerator","res","dataError","errorBuilder","e","code","description","details","data","init_browser","createNanoEvents","event","args","i","callbacks","length","cb","isEventHandlerModule","val","runHandler","eventDefinition","handler","payload","baseEventMetadata","envelope","domainEventPayload","deletedEvent","actionEvent","createdEvent","updatedEvent","domainEventMetadata","metadata","transformFromRESTFn","x","eventHandlersModules","authStrategy","eventHandlers","webhooksEmitter","createNanoEvents","client","jwt","opts","eventType","identity","instanceId","allExpectedEvents","type","handlers","request","body","decoded","valid","parsedDecoded","event","EventDefinition","isServicePluginModule","val","servicePluginsModules","authStrategy","servicePluginsImplementations","servicePluginsEmitter","createNanoEvents","client","jwt","decoded","valid","request","servicePluginRequest","body","url","implMethodResult","err","componentType","implementations","impl","servicePluginDefinition","method","m","implMethod","implementation","import_serialize_error","getTokenInfo","token","tokenInfoRes","isWebMethodModules","val","Permissions","checkPermission","request","permission","accessToken","subjectType","getTokenInfo","urlRegex","extractUrlParts","url","parts","isRequestBodyValid","body","productionErrorMessage","webMethodModules","webMethods","webMethodModule","devMode","urlParts","file","method","loadWebMethodFile","webMethod","error","serializedError","createClient","config","_headers","authStrategy","_","boundGetAuthHeaders","fetchWithAuth","urlOrRequest","requestInit","k","v","servicePluginsClient","initServicePluginModule","servicePluginsModules","eventHandlersClient","initEventHandlerModule","eventHandlersModules","webMethodClient","initModule","webMethodModules","boundFetch","url","options","authHeaders","defaultContentTypeHeader","getDefaultContentHeader","use","modules","metadata","isEventHandlerModule","isServicePluginModule","isHostModule","buildHostModule","isWebMethodModules","SERVICE_PLUGIN_ERROR_TYPE","apiBaseUrl","DEFAULT_API_URL","buildRESTDescriptor","runWithoutContext","isAmbassadorModule","toHTTPModule","relativeUrl","fetchOptions","finalUrl","isObject","key","value","PUBLIC_METADATA_KEY","setHeaders","headers","contextType","opts","wixContext","query","variables","res","FetchErrorResponse","data","errors"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/non-interactive/preview/index.ts","../src/non-interactive/preview/preview.ts","../src/non-interactive/preview/resolve-site.ts","../src/non-interactive/preview/dashboard-page-url.ts","../src/non-interactive/logger.ts"],"sourcesContent":["export { nonInteractivePreview } from './preview.js';\n","import { ARMClient } from '@wix/arm-client';\nimport { isLoggedInToAccount } from '@wix/cli-auth';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { addUserFields } from '@wix/cli-telemetry';\nimport { createHttpClient } from '@wix/cli-http-client';\nimport type { CommandServices } from '@wix/cli-command-contract';\nimport { isType } from 'variant';\nimport type { ProjectModel } from '../../model.js';\nimport { createPreviewTag } from '../../preview/create-preview-tag.js';\nimport { uploadApplication } from '../../hosting/upload-application.js';\nimport { resolveSite } from './resolve-site.js';\nimport { getDashboardPageUrl } from './dashboard-page-url.js';\nimport { log } from '../logger.js';\nimport { DevCenterComponent } from '../../dev-center/components/dev-center-component.js';\n\nexport async function nonInteractivePreview(\n options: { siteId?: string; baseUrl?: string },\n model: ProjectModel,\n services: CommandServices\n) {\n const authData = await isLoggedInToAccount();\n\n if (!authData) {\n throw new CliError({\n code: CliErrorCode.AuthenticationRequired(),\n cause: null,\n });\n }\n\n services.errorReporter.setUser({ id: authData.userInfo.userId });\n addUserFields(services.biLogger, authData.userInfo.userId);\n\n const httpClient = createHttpClient({\n type: 'backoffice',\n getAppToken: () => authData.getAccessToken(),\n });\n\n const site = await resolveSite(model, httpClient, options.siteId);\n const backendComponents = model.components.filter(\n (component) =>\n isType(component, DevCenterComponent.Api) ||\n isType(component, DevCenterComponent.Event) ||\n isType(component, DevCenterComponent.ServicePlugin)\n );\n\n const { serveUrl, backendServerUrl } = options.baseUrl\n ? { serveUrl: options.baseUrl, backendServerUrl: undefined }\n : await uploadApplication(\n model.config.appId,\n model.projectFolder,\n services.biLogger,\n httpClient,\n backendComponents.length > 0\n );\n\n const arm = new ARMClient(httpClient);\n\n const tag = await createPreviewTag({\n model,\n arm,\n serveUrl,\n backendServerUrl,\n });\n const dashboardPageUrl = getDashboardPageUrl({ site, model, tag });\n\n log(dashboardPageUrl);\n}\n","import { match } from 'variant';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { SiteListClient } from '@wix/site-list-client';\nimport type { HttpClient } from '@wix/cli-http-client';\nimport type { ProjectModel } from '../../model.js';\nimport { resolveConfiguredSite } from '../../site/resolve-configured-site.js';\n\nexport async function resolveSite(\n model: ProjectModel,\n httpClient: HttpClient,\n siteId?: string\n) {\n const siteListClient = new SiteListClient(httpClient);\n\n const site = await resolveConfiguredSite({\n siteId,\n projectFolder: model.projectFolder,\n siteListClient,\n });\n\n return match(site, {\n NotConfigured: () => {\n throw new CliError({\n code: CliErrorCode.SiteConfiguredRequired(),\n cause: null,\n });\n },\n NotFound: () => {\n throw new CliError({\n code: CliErrorCode.SiteConfiguredRequired(),\n cause: null,\n });\n },\n Resolved: ({ site }) => site,\n });\n}\n","import type { Site } from '@wix/site-list-client';\nimport { PlatformType } from '@wix/cli-app-definitions';\nimport { isType } from 'variant';\nimport type { ProjectModel } from '../../model.js';\nimport {\n resolvePlatformUrl,\n resolveDashboardExtensionUrl,\n} from '../../components/extensions/utils.js';\nimport { DevCenterComponent } from '../../dev-center/components/dev-center-component.js';\n\nexport const getDashboardPageUrl = ({\n model,\n site,\n tag,\n}: {\n model: ProjectModel;\n site: Site;\n tag: string;\n}) => {\n const dashboardExtensions = model.components.filter(\n (component) =>\n isType(component, DevCenterComponent.DashboardPage) ||\n isType(component, DevCenterComponent.DashboardPlugin) ||\n isType(component, DevCenterComponent.DashboardMenuPlugin)\n );\n\n const envConfig = {\n appId: model.config.appId,\n site,\n tag,\n };\n\n return dashboardExtensions[0]\n ? resolveDashboardExtensionUrl(dashboardExtensions[0], envConfig)\n : resolvePlatformUrl(PlatformType.Dashboard(), envConfig);\n};\n","export function log(message: string) {\n // eslint-disable-next-line no-console\n console.log(message);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;AAMA,IAAAA,kBAAuB;;;ACNvB;AAAA,qBAAsB;AAOtB,eAAsB,YACpB,OACA,YACA,QACA;AACA,QAAM,iBAAiB,IAAI,eAAe,UAAU;AAEpD,QAAM,OAAO,MAAM,sBAAsB;AAAA,IACvC;AAAA,IACA,eAAe,MAAM;AAAA,IACrB;AAAA,EACF,CAAC;AAED,aAAO,sBAAM,MAAM;AAAA,IACjB,eAAe,MAAM;AACnB,YAAM,IAAI,SAAS;AAAA,QACjB,MAAM,aAAa,uBAAuB;AAAA,QAC1C,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,UAAU,MAAM;AACd,YAAM,IAAI,SAAS;AAAA,QACjB,MAAM,aAAa,uBAAuB;AAAA,QAC1C,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,UAAU,CAAC,EAAE,MAAAC,MAAK,MAAMA;AAAA,EAC1B,CAAC;AACH;;;ACnCA;AAEA,IAAAC,kBAAuB;AAQhB,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA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