@wix/astro 2.24.0 → 2.26.0

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 (31) hide show
  1. package/build/dependencies/astro-translations/{chunk-YRKN4TFH.js → backend-runtime/middleware/static-translations.js} +33 -1
  2. package/build/dependencies/astro-translations/backend-runtime/runtime/i18n.d.ts +4 -0
  3. package/build/dependencies/astro-translations/backend-runtime/runtime/i18n.js +42 -0
  4. package/build/dependencies/astro-translations/integration/index.js +296 -0
  5. package/build/dependencies/astro-translations/types/wix-astro-i18n.d.ts +18 -0
  6. package/build/dependencies/astro-trusted-backoffice-extensions/types/index.d.ts +11 -0
  7. package/build/dependencies/astro-viewer-services-extensions/browser-runtime/sdk.js +21 -0
  8. package/build/dependencies/astro-viewer-services-extensions/types/index.d.ts +27 -0
  9. package/build/integration/builders-experimental.js +1 -1
  10. package/build/integration/builders-trusted.d.ts +11 -0
  11. package/build/integration/builders-trusted.js +2 -2
  12. package/build/integration/builders.d.ts +27 -4
  13. package/build/integration/builders.js +2 -2
  14. package/build/integration/{chunk-S5CQHYTB.js → chunk-CBVCNKLN.js} +437 -13
  15. package/build/integration/chunk-CBVCNKLN.js.map +1 -0
  16. package/build/integration/{chunk-CTGNWVC3.js → chunk-E42TF2A2.js} +3 -5
  17. package/build/integration/chunk-E42TF2A2.js.map +1 -0
  18. package/build/integration/{chunk-5BEUYVXR.js → chunk-KCOYXYJL.js} +8 -17
  19. package/build/integration/chunk-KCOYXYJL.js.map +1 -0
  20. package/build/integration/{chunk-XF55M5AE.js → chunk-MNQWQ2MC.js} +2 -2
  21. package/build/integration/{chunk-XF55M5AE.js.map → chunk-MNQWQ2MC.js.map} +1 -1
  22. package/build/integration/index.js +78 -29
  23. package/build/integration/index.js.map +1 -1
  24. package/package.json +6 -4
  25. package/build/dependencies/astro-translations/index.js +0 -133
  26. package/build/dependencies/astro-translations/middleware/static-translations.js +0 -58
  27. package/build/integration/chunk-5BEUYVXR.js.map +0 -1
  28. package/build/integration/chunk-CTGNWVC3.js.map +0 -1
  29. package/build/integration/chunk-S5CQHYTB.js.map +0 -1
  30. /package/build/dependencies/astro-translations/{middleware → backend-runtime/middleware}/static-translations.d.ts +0 -0
  31. /package/build/dependencies/astro-translations/{index.d.ts → integration/index.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../../astro-auth/src/index.ts","../../../astro-auth/src/plugins/patchAstroInlineScripts.ts","../../../astro-auth/src/plugins/setupContentCollectionContext.ts","../../../astro-html-embeds/src/index.ts","../../../astro-payment-links/src/index.ts","../../../astro-robots/src/index.ts","../../../astro-translations/src/index.ts","../../../astro-translations/src/utils/loadTranslations.ts","../../../astro-translations/src/constants.ts","../../../astro-translations/src/utils/errorMessages.ts","../../../astro-viewer-api/src/index.ts","../../../astro-viewer-api/src/integration.ts"],"sourcesContent":["import type { AstroIntegration } from 'astro';\nimport auth from '@wix/astro-auth';\nimport backend from '@wix/astro-backend-extensions';\nimport backoffice from '@wix/astro-backoffice-extensions';\nimport contextProviders from '@wix/astro-context-providers-extensions';\nimport core from '@wix/astro-core';\nimport customElements from '@wix/astro-custom-elements-extensions';\nimport embeddedScripts from '@wix/astro-embedded-scripts-extensions';\nimport functionLibraries from '@wix/astro-function-libraries-extensions';\nimport htmlEmbeds from '@wix/astro-html-embeds';\nimport paymentLinks from '@wix/astro-payment-links';\nimport robots from '@wix/astro-robots';\nimport siteComponentPanels from '@wix/astro-site-component-panels-extensions';\nimport siteComponents from '@wix/astro-site-components-extensions';\nimport translations from '@wix/astro-translations';\nimport internalBackoffice from '@wix/astro-trusted-backoffice-extensions';\nimport viewerApi from '@wix/astro-viewer-api';\n\nexport { extensions } from './builders.js';\n\ninterface WixAstroConfig {\n auth?: boolean | { enable?: boolean };\n backendExtensions?: boolean | { enable?: boolean };\n backofficeExtensions?: boolean | { enable?: boolean };\n essentials?: boolean | { enable?: boolean };\n htmlEmbeds?: boolean | { enable?: boolean };\n robots?: boolean | { enable?: boolean };\n translations?: boolean | { enable?: boolean };\n wixSitePages?: boolean | { enable?: boolean };\n}\n\nfunction isEnabled(\n value?: boolean | { enable?: boolean },\n defaultValue = true\n): boolean {\n if (typeof value === 'boolean') {\n return value;\n }\n return value?.enable ?? defaultValue;\n}\n\nconst createIntegration = (config?: WixAstroConfig): AstroIntegration[] => {\n const enableAuthRoutes = isEnabled(config?.auth);\n const enableHtmlEmbeds = isEnabled(config?.htmlEmbeds);\n const enableRobots = isEnabled(config?.robots);\n const enableBackendExtensions = isEnabled(config?.backendExtensions);\n const enableBackofficeExtensions = isEnabled(config?.backofficeExtensions);\n const enableWixSitePages = isEnabled(config?.wixSitePages);\n const enableWixEssentials = isEnabled(config?.essentials, false);\n const enableTranslations = isEnabled(config?.translations, false);\n\n const integrations = [\n auth({ enableAuthRoutes, enableWixEssentials }),\n ...(enableTranslations && enableWixEssentials ? [translations()] : []),\n ...(enableBackendExtensions ? [backend()] : []),\n ...(enableBackofficeExtensions ? [backoffice(), internalBackoffice()] : []),\n customElements(),\n ...(enableHtmlEmbeds ? [htmlEmbeds()] : []),\n ...(enableWixSitePages ? [paymentLinks(), viewerApi()] : []),\n embeddedScripts(),\n siteComponents(),\n siteComponentPanels(),\n functionLibraries(),\n contextProviders(),\n ...(enableRobots ? [robots()] : []),\n ];\n\n return [core({ integrations }), ...integrations];\n};\n\nexport default createIntegration;\n","import { fileURLToPath } from 'node:url';\nimport type { WixIntegration } from '@wix/astro-core';\nimport { normalizePath } from '@wix/vite-utils';\nimport { outdent } from 'outdent';\nimport { patchAstroInlineScripts } from './plugins/patchAstroInlineScripts.js';\nimport { setupContentCollectionContext } from './plugins/setupContentCollectionContext.js';\n\nconst setupContextUrl = new URL(\n '../dependencies/astro-auth/browser-runtime/setup.js',\n import.meta.url\n);\n\nconst createIntegration = ({\n enableAuthRoutes,\n enableWixEssentials,\n}: {\n enableAuthRoutes: boolean;\n enableWixEssentials: boolean;\n}): WixIntegration => {\n return {\n name: '@wix/astro/auth',\n hooks: {\n 'astro:config:setup'({\n addMiddleware,\n config,\n injectRoute,\n injectScript,\n updateConfig,\n }) {\n const srcDir = fileURLToPath(config.srcDir);\n\n updateConfig({\n vite: {\n plugins: [\n setupContentCollectionContext(srcDir),\n patchAstroInlineScripts(),\n ],\n },\n });\n\n const setupContextCode = outdent`\n import { WIX_CLIENT_ID } from 'astro:env/client';\n import { setup } from '${normalizePath(setupContextUrl)}';\n\n setup({ clientId: WIX_CLIENT_ID });\n `;\n\n // support client-side context calls\n injectScript('before-hydration', setupContextCode);\n injectScript('page', setupContextCode);\n\n // support server side context calls\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/middleware/auth.js',\n import.meta.url\n ),\n order: 'pre',\n });\n\n // support localization\n if (enableWixEssentials) {\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/middleware/localization.js',\n import.meta.url\n ),\n order: 'pre',\n });\n }\n\n // support built-in auth routes\n if (enableAuthRoutes) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/login.js',\n import.meta.url\n ),\n pattern: '/api/auth/login',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/logout.js',\n import.meta.url\n ),\n pattern: '/api/auth/logout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/callback.js',\n import.meta.url\n ),\n pattern: '/api/auth/callback',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/logout-callback.js',\n import.meta.url\n ),\n pattern: '/api/auth/logout-callback',\n prerender: false,\n });\n }\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { PluginOption } from 'vite';\nimport { outdent } from 'outdent';\n\nexport function patchAstroInlineScripts(): PluginOption {\n return {\n name: 'patch-astro-inline-scripts',\n transform(code, id) {\n const [_filename, rawQuery] = id.split(`?`, 2);\n const query = Object.fromEntries(new URLSearchParams(rawQuery).entries());\n\n if (\n query.astro == null ||\n query.type !== 'script' ||\n query['lang.ts'] == null ||\n code === ''\n ) {\n return null;\n }\n\n return outdent`\n import 'astro:scripts/page.js';\n\n ${code}\n `;\n },\n };\n}\n","import { relative } from 'node:path';\nimport type { PluginOption } from 'vite';\nimport { normalizePath } from '@wix/vite-utils';\nimport { outdent } from 'outdent';\n\n// https://github.com/withastro/astro/blob/e0c4460c5b6cc0c19b705d81820809aef0544100/packages/astro/src/content/utils.ts#L748-L763\nconst contentCollectionFilePaths = [\n 'content.config.mjs',\n 'content.config.js',\n 'content.config.mts',\n 'content.config.ts',\n 'content/config.mjs',\n 'content/config.js',\n 'content/config.mts',\n 'content/config.ts',\n];\n\nconst setupContextualClientUrl = new URL(\n '../dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.js',\n import.meta.url\n);\n\nexport function setupContentCollectionContext(srcDir: string): PluginOption {\n return {\n name: 'setup-content-collection-context',\n applyToEnvironment(environment) {\n return environment.name === 'ssr';\n },\n transform(code, id) {\n const relativeId = relative(srcDir, id);\n\n const isContentCollectionFile =\n contentCollectionFilePaths.includes(relativeId);\n\n if (isContentCollectionFile) {\n return outdent`\n import '${normalizePath(setupContextualClientUrl)}';\n\n ${code}\n `;\n }\n\n return null;\n },\n };\n}\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/html-embeds',\n hooks: {\n 'astro:config:setup'({ addMiddleware }) {\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-html-embeds/backend-runtime/html-embeds.js',\n import.meta.url\n ),\n order: 'post',\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/payment-links',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n /*\n 1. A user generates a paylink -> https://mysite.com/_paylink/[id]\n 2. When accessing the paylink, our route redirects them to the Wix Payments link\n 3. Wix Payments then redirects the user to Wix Checkout,\n which may resolve to either https://mysite.com/checkout/... or https://mysite.com/__ecom/checkout/...,\n depending on the flow within Wix.\n */\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-link.js',\n import.meta.url\n ),\n pattern: '/_paylink/[id]',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-checkout.js',\n import.meta.url\n ),\n pattern: '/checkout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-checkout.js',\n import.meta.url\n ),\n pattern: '/__ecom/checkout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/proposal.js',\n import.meta.url\n ),\n pattern: '/_proposal',\n prerender: false,\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/robots',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-robots/backend-runtime/robots.js',\n import.meta.url\n ),\n pattern: '/robots.txt',\n prerender: false,\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { WixIntegration } from '@wix/astro-core';\nimport { loadAllTranslations } from './utils/loadTranslations.js';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/static-translations',\n hooks: {\n 'astro:config:setup': async ({\n addMiddleware,\n config: astroConfig,\n updateConfig,\n }) => {\n const translations = await loadAllTranslations(astroConfig);\n\n updateConfig({\n vite: {\n define: {\n __WIX_TRANSLATIONS__: JSON.stringify(translations),\n },\n },\n });\n\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-translations/middleware/static-translations.js',\n import.meta.url\n ),\n order: 'pre',\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import { readdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AstroConfig } from 'astro';\nimport { readJson } from '@wix/fs-utils';\nimport { toNamespaceDictionary } from '@wix/headless-localization-utils';\nimport type { Translations, TranslationsMetadata } from '../types.js';\nimport {\n TRANSLATIONS_FILENAME,\n TRANSLATIONS_METADATA_FILENAME,\n} from '../constants.js';\nimport { createTranslationFilesError } from './errorMessages.js';\n\nasync function loadTranslationFile(filePath: string) {\n return readJson(filePath).then((data) =>\n toNamespaceDictionary(data as Record<string, unknown>)\n );\n}\n\n/**\n * Load the primary translation from `src/translations.json` and the other translation files from `.wix/multilingual/translations`.\n * Merges translations with `src/translations.json` taking priority over `.wix/multilingual/translations`.\n */\nexport async function loadAllTranslations(astroConfig: AstroConfig) {\n const srcDir = fileURLToPath(astroConfig.srcDir);\n const rootDir = fileURLToPath(astroConfig.root);\n\n const tempDir = join(rootDir, '.wix');\n const multilingualDir = join(tempDir, 'multilingual');\n const primaryTranslationPath = join(srcDir, TRANSLATIONS_FILENAME);\n const pulledTranslationsDir = join(multilingualDir, 'translations');\n\n let metadata;\n let primaryTranslation;\n\n try {\n metadata = await loadMetadata(multilingualDir);\n primaryTranslation = await loadPrimaryTranslation(\n primaryTranslationPath,\n metadata\n );\n } catch {\n throw createTranslationFilesError(srcDir);\n }\n\n const wixTranslations = await loadTranslations(pulledTranslationsDir);\n\n return { ...wixTranslations, ...primaryTranslation };\n}\n\nasync function loadMetadata(translationsMetadataDir: string) {\n const metadataPath = join(\n translationsMetadataDir,\n TRANSLATIONS_METADATA_FILENAME\n );\n return (await readJson(metadataPath)) as TranslationsMetadata;\n}\n\nasync function loadPrimaryTranslation(\n primaryTranslationPath: string,\n metadata: TranslationsMetadata\n) {\n const translationContent = await loadTranslationFile(primaryTranslationPath);\n\n return {\n [metadata.primaryLanguageCode]: translationContent,\n };\n}\n\nasync function loadTranslations(translationsDir: string) {\n const files = await readdir(translationsDir);\n const jsonFiles = files.filter((file) => file.endsWith('.json'));\n\n const translations: Translations = {};\n\n for (const file of jsonFiles) {\n const languageCode = file.replace('.json', '');\n const filePath = join(translationsDir, file);\n translations[languageCode] = await loadTranslationFile(filePath);\n }\n\n return translations;\n}\n","export const TRANSLATIONS_METADATA_FILENAME = 'metadata.json';\nexport const TRANSLATIONS_FILENAME = 'translations.json';\n","import { outdent } from 'outdent';\n\nexport function createTranslationFilesError(translationsDir: string): Error {\n return new Error(outdent`\n Failed to load translation file(s).\n 💡 Tip: create a file '${translationsDir}/translations.json' in your project, then use the Wix CLI to push these keys.\n\n Example translation file structure:\n {\n \"hello\": \"Hello\",\n \"goodbye\": \"Goodbye\"\n }\n\n 🔍 Need Help?\n - Visit our docs: https://dev.wix.com/docs/go-headless\n `);\n}\n","export { createIntegration as default } from './integration.js';\n","import type { WixIntegration } from '@wix/astro-core';\n\nexport const createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/viewer-api',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-viewer-api/backend-runtime/api.js',\n import.meta.url\n ),\n pattern: '/_api/[...path]',\n prerender: false,\n });\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;AAAA,SAAS,qBAAqB;;;ACA9B;AAGO,SAAS,0BAAwC;AACtD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,UAAU,MAAM,IAAI;AAClB,YAAM,CAAC,WAAW,QAAQ,IAAI,GAAG,MAAM,KAAK,CAAC;AAC7C,YAAM,QAAQ,OAAO,YAAY,IAAI,gBAAgB,QAAQ,EAAE,QAAQ,CAAC;AAExE,UACE,MAAM,SAAS,QACf,MAAM,SAAS,YACf,MAAM,SAAS,KAAK,QACpB,SAAS,IACT;AACA,eAAO;AAAA,MACT;AAEA,aAAO;AAAA;AAAA;AAAA,UAGH,IAAI;AAAA;AAAA,IAEV;A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K,EAAE,kBAAkB,oBAAoB,CAAC;AAAA,IAC9C,GAAI,sBAAsB,sBAAsB,CAACC,aAAa,CAAC,IAAI,CAAC;AAAA,IACpE,GAAI,0BAA0B,CAACD,mBAAQ,CAAC,IAAI,CAAC;AAAA,IAC7C,GAAI,6BAA6B,CAACA,oBAAW,GAAGA,mBAAmB,CAAC,IAAI,CAAC;AAAA,IACzEA,mBAAe;AAAA,IACf,GAAI,mBAAmB,CAACC,aAAW,CAAC,IAAI,CAAC;AAAA,IACzC,GAAI,qBAAqB,CAACA,aAAa,GAAGD,oBAAU,CAAC,IAAI,CAAC;AAAA,IAC1DA,mBAAgB;AAAA,IAChBA,mBAAe;AAAA,IACfA,mBAAoB;AAAA,IACpBA,mBAAkB;AAAA,IAClB,kBAAiB;AAAA,IACjB,GAAI,eAAe,CAACC,aAAO,CAAC,IAAI,CAAC;AAAA,EACnC;AAEA,SAAO,CAACD,mBAAK,EAAE,aAAa,CAAC,GAAG,GAAG,YAAY;AACjD;AAEA,IAAO,gBAAQA;","names":["createIntegration","createIntegration","src_default","createIntegration","src_default","createIntegration","src_default","fileURLToPath","fileURLToPath","createIntegration","src_default","createIntegration","createIntegration","src_default"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../../astro-auth/src/index.ts","../../../astro-auth/src/plugins/patchAstroInlineScripts.ts","../../../astro-auth/src/plugins/setupContentCollectionContext.ts","../../../astro-html-embeds/src/index.ts","../../../astro-payment-links/src/index.ts","../../../astro-robots/src/index.ts","../../../astro-translations/src/index.ts","../../../astro-translations/src/utils/loadTranslations.ts","../../../astro-translations/src/constants.ts","../../../astro-translations/src/utils/errorMessages.ts","../../../astro-translations/src/vite/wix-astro-i18n-plugin.ts","../../../astro-viewer-api/src/index.ts","../../../astro-viewer-api/src/integration.ts"],"sourcesContent":["import type { AstroIntegration } from 'astro';\nimport auth from '@wix/astro-auth';\nimport backend from '@wix/astro-backend-extensions';\nimport backoffice from '@wix/astro-backoffice-extensions';\nimport contextProviders from '@wix/astro-context-providers-extensions';\nimport core from '@wix/astro-core';\nimport customElements from '@wix/astro-custom-elements-extensions';\nimport embeddedScripts from '@wix/astro-embedded-scripts-extensions';\nimport functionLibraries from '@wix/astro-function-libraries-extensions';\nimport htmlEmbeds from '@wix/astro-html-embeds';\nimport paymentLinks from '@wix/astro-payment-links';\nimport robots from '@wix/astro-robots';\nimport siteComponentPanels from '@wix/astro-site-component-panels-extensions';\nimport siteComponents from '@wix/astro-site-components-extensions';\nimport translations from '@wix/astro-translations';\nimport internalBackoffice from '@wix/astro-trusted-backoffice-extensions';\nimport viewerApi from '@wix/astro-viewer-api';\nimport viewerServices from '@wix/astro-viewer-services-extensions';\n\nexport { extensions } from './builders.js';\n\ninterface WixAstroConfig {\n auth?: boolean | { enable?: boolean };\n backendExtensions?: boolean | { enable?: boolean };\n backofficeExtensions?: boolean | { enable?: boolean };\n essentials?: boolean | { enable?: boolean };\n htmlEmbeds?: boolean | { enable?: boolean };\n robots?: boolean | { enable?: boolean };\n translations?: boolean | { enable?: boolean };\n wixSitePages?: boolean | { enable?: boolean };\n}\n\nfunction isEnabled(\n value?: boolean | { enable?: boolean },\n defaultValue = true\n): boolean {\n if (typeof value === 'boolean') {\n return value;\n }\n return value?.enable ?? defaultValue;\n}\n\nconst createIntegration = (config?: WixAstroConfig): AstroIntegration[] => {\n const enableAuthRoutes = isEnabled(config?.auth);\n const enableHtmlEmbeds = isEnabled(config?.htmlEmbeds);\n const enableRobots = isEnabled(config?.robots);\n const enableBackendExtensions = isEnabled(config?.backendExtensions);\n const enableBackofficeExtensions = isEnabled(config?.backofficeExtensions);\n const enableWixSitePages = isEnabled(config?.wixSitePages);\n const enableWixEssentials = isEnabled(config?.essentials, false);\n const enableTranslations = isEnabled(config?.translations, false);\n\n const integrations = [\n auth({ enableAuthRoutes, enableWixEssentials }),\n ...(enableTranslations && enableWixEssentials ? [translations()] : []),\n ...(enableBackendExtensions ? [backend()] : []),\n ...(enableBackofficeExtensions ? [backoffice(), internalBackoffice()] : []),\n customElements(),\n ...(enableHtmlEmbeds ? [htmlEmbeds()] : []),\n ...(enableWixSitePages ? [paymentLinks(), viewerApi()] : []),\n embeddedScripts(),\n siteComponents(),\n siteComponentPanels(),\n viewerServices(),\n functionLibraries(),\n contextProviders(),\n ...(enableRobots ? [robots()] : []),\n ];\n\n return [core({ integrations }), ...integrations];\n};\n\nexport default createIntegration;\n","import { fileURLToPath } from 'node:url';\nimport type { WixIntegration } from '@wix/astro-core';\nimport { normalizePath } from '@wix/vite-utils';\nimport { outdent } from 'outdent';\nimport { patchAstroInlineScripts } from './plugins/patchAstroInlineScripts.js';\nimport { setupContentCollectionContext } from './plugins/setupContentCollectionContext.js';\n\nconst setupContextUrl = new URL(\n '../dependencies/astro-auth/browser-runtime/setup.js',\n import.meta.url\n);\n\nconst createIntegration = ({\n enableAuthRoutes,\n enableWixEssentials,\n}: {\n enableAuthRoutes: boolean;\n enableWixEssentials: boolean;\n}): WixIntegration => {\n return {\n name: '@wix/astro/auth',\n hooks: {\n 'astro:config:setup'({\n addMiddleware,\n config,\n injectRoute,\n injectScript,\n updateConfig,\n }) {\n const srcDir = fileURLToPath(config.srcDir);\n\n updateConfig({\n vite: {\n plugins: [\n setupContentCollectionContext(srcDir),\n patchAstroInlineScripts(),\n ],\n },\n });\n\n const setupContextCode = outdent`\n import { WIX_CLIENT_ID } from 'astro:env/client';\n import { setup } from '${normalizePath(setupContextUrl)}';\n\n setup({ clientId: WIX_CLIENT_ID });\n `;\n\n // support client-side context calls\n injectScript('before-hydration', setupContextCode);\n injectScript('page', setupContextCode);\n\n // support server side context calls\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/middleware/auth.js',\n import.meta.url\n ),\n order: 'pre',\n });\n\n // support localization\n if (enableWixEssentials) {\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/middleware/localization.js',\n import.meta.url\n ),\n order: 'pre',\n });\n }\n\n // support built-in auth routes\n if (enableAuthRoutes) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/login.js',\n import.meta.url\n ),\n pattern: '/api/auth/login',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/logout.js',\n import.meta.url\n ),\n pattern: '/api/auth/logout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/callback.js',\n import.meta.url\n ),\n pattern: '/api/auth/callback',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-auth/backend-runtime/routes/logout-callback.js',\n import.meta.url\n ),\n pattern: '/api/auth/logout-callback',\n prerender: false,\n });\n }\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { PluginOption } from 'vite';\nimport { outdent } from 'outdent';\n\nexport function patchAstroInlineScripts(): PluginOption {\n return {\n name: 'patch-astro-inline-scripts',\n transform(code, id) {\n const [_filename, rawQuery] = id.split(`?`, 2);\n const query = Object.fromEntries(new URLSearchParams(rawQuery).entries());\n\n if (\n query.astro == null ||\n query.type !== 'script' ||\n query['lang.ts'] == null ||\n code === ''\n ) {\n return null;\n }\n\n return outdent`\n import 'astro:scripts/page.js';\n\n ${code}\n `;\n },\n };\n}\n","import { relative } from 'node:path';\nimport type { PluginOption } from 'vite';\nimport { normalizePath } from '@wix/vite-utils';\nimport { outdent } from 'outdent';\n\n// https://github.com/withastro/astro/blob/e0c4460c5b6cc0c19b705d81820809aef0544100/packages/astro/src/content/utils.ts#L748-L763\nconst contentCollectionFilePaths = [\n 'content.config.mjs',\n 'content.config.js',\n 'content.config.mts',\n 'content.config.ts',\n 'content/config.mjs',\n 'content/config.js',\n 'content/config.mts',\n 'content/config.ts',\n];\n\nconst setupContextualClientUrl = new URL(\n '../dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.js',\n import.meta.url\n);\n\nexport function setupContentCollectionContext(srcDir: string): PluginOption {\n return {\n name: 'setup-content-collection-context',\n applyToEnvironment(environment) {\n return environment.name === 'ssr';\n },\n transform(code, id) {\n const relativeId = relative(srcDir, id);\n\n const isContentCollectionFile =\n contentCollectionFilePaths.includes(relativeId);\n\n if (isContentCollectionFile) {\n return outdent`\n import '${normalizePath(setupContextualClientUrl)}';\n\n ${code}\n `;\n }\n\n return null;\n },\n };\n}\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/html-embeds',\n hooks: {\n 'astro:config:setup'({ addMiddleware }) {\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-html-embeds/backend-runtime/html-embeds.js',\n import.meta.url\n ),\n order: 'post',\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/payment-links',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n /*\n 1. A user generates a paylink -> https://mysite.com/_paylink/[id]\n 2. When accessing the paylink, our route redirects them to the Wix Payments link\n 3. Wix Payments then redirects the user to Wix Checkout,\n which may resolve to either https://mysite.com/checkout/... or https://mysite.com/__ecom/checkout/...,\n depending on the flow within Wix.\n */\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-link.js',\n import.meta.url\n ),\n pattern: '/_paylink/[id]',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-checkout.js',\n import.meta.url\n ),\n pattern: '/checkout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/payment-checkout.js',\n import.meta.url\n ),\n pattern: '/__ecom/checkout',\n prerender: false,\n });\n\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-payment-links/backend-runtime/proposal.js',\n import.meta.url\n ),\n pattern: '/_proposal',\n prerender: false,\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import type { WixIntegration } from '@wix/astro-core';\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/robots',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-robots/backend-runtime/robots.js',\n import.meta.url\n ),\n pattern: '/robots.txt',\n prerender: false,\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import { readFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport type { WixIntegration } from '@wix/astro-core';\nimport { loadAllTranslations } from './utils/loadTranslations.js';\nimport { wixAstroI18nPlugin } from './vite/wix-astro-i18n-plugin.js';\n\nconst i18nTypesPath = fileURLToPath(\n new URL(\n '../dependencies/astro-translations/types/wix-astro-i18n.d.ts',\n import.meta.url\n )\n);\n\nconst createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/static-translations',\n hooks: {\n 'astro:config:setup': async ({\n addMiddleware,\n config: astroConfig,\n updateConfig,\n }) => {\n const translations = await loadAllTranslations(astroConfig);\n\n updateConfig({\n vite: {\n define: {\n __WIX_ASTRO_I18N__: JSON.stringify({\n base: astroConfig.base,\n siteUrl: astroConfig.site ?? null,\n translations,\n }),\n },\n plugins: [wixAstroI18nPlugin()],\n },\n });\n\n addMiddleware({\n entrypoint: new URL(\n '../dependencies/astro-translations/backend-runtime/middleware/static-translations.js',\n import.meta.url\n ),\n order: 'pre',\n });\n },\n\n 'astro:config:done': async ({ injectTypes }) => {\n injectTypes({\n content: readFileSync(i18nTypesPath, 'utf-8'),\n filename: 'wix-astro-i18n.d.ts',\n });\n },\n },\n };\n};\n\nexport default createIntegration;\n","import { readdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AstroConfig } from 'astro';\nimport { readJson } from '@wix/fs-utils';\nimport { toNamespaceDictionary } from '@wix/headless-localization-utils';\nimport type { Translations, TranslationsMetadata } from '../types.js';\nimport {\n TRANSLATIONS_FILENAME,\n TRANSLATIONS_METADATA_FILENAME,\n} from '../constants.js';\nimport { createTranslationFilesError } from './errorMessages.js';\n\nasync function loadTranslationFile(filePath: string) {\n return readJson(filePath).then((data) =>\n toNamespaceDictionary(data as Record<string, unknown>)\n );\n}\n\n/**\n * Load the primary translation from `src/translations.json` and the other translation files from `.wix/multilingual/translations`.\n * Merges translations with `src/translations.json` taking priority over `.wix/multilingual/translations`.\n */\nexport async function loadAllTranslations(astroConfig: AstroConfig) {\n const srcDir = fileURLToPath(astroConfig.srcDir);\n const rootDir = fileURLToPath(astroConfig.root);\n\n const tempDir = join(rootDir, '.wix');\n const multilingualDir = join(tempDir, 'multilingual');\n const primaryTranslationPath = join(srcDir, TRANSLATIONS_FILENAME);\n const pulledTranslationsDir = join(multilingualDir, 'translations');\n\n let metadata;\n let primaryTranslation;\n\n try {\n metadata = await loadMetadata(multilingualDir);\n primaryTranslation = await loadPrimaryTranslation(\n primaryTranslationPath,\n metadata\n );\n } catch {\n throw createTranslationFilesError(srcDir);\n }\n\n const wixTranslations = await loadTranslations(pulledTranslationsDir);\n\n return { ...wixTranslations, ...primaryTranslation };\n}\n\nasync function loadMetadata(translationsMetadataDir: string) {\n const metadataPath = join(\n translationsMetadataDir,\n TRANSLATIONS_METADATA_FILENAME\n );\n return (await readJson(metadataPath)) as TranslationsMetadata;\n}\n\nasync function loadPrimaryTranslation(\n primaryTranslationPath: string,\n metadata: TranslationsMetadata\n) {\n const translationContent = await loadTranslationFile(primaryTranslationPath);\n\n return {\n [metadata.primaryLanguageCode]: translationContent,\n };\n}\n\nasync function loadTranslations(translationsDir: string) {\n const files = await readdir(translationsDir);\n\n const jsonFiles = files.filter((file) => file.endsWith('.json'));\n\n const translations: Translations = {};\n\n for (const file of jsonFiles) {\n const languageCode = file.replace('.json', '');\n const filePath = join(translationsDir, file);\n translations[languageCode] = await loadTranslationFile(filePath);\n }\n\n return translations;\n}\n","export const TRANSLATIONS_METADATA_FILENAME = 'metadata.json';\nexport const TRANSLATIONS_FILENAME = 'translations.json';\n","import { join } from 'node:path';\nimport { outdent } from 'outdent';\n\nexport function createTranslationFilesError(translationsDir: string): Error {\n return new Error(outdent`\n Failed to load translation file(s).\n 💡 Tip: create a file '${join(translationsDir, 'translations.json')}' in your project, then use the Wix CLI to push these keys.\n\n Example translation file structure:\n {\n \"hello\": \"Hello\",\n \"goodbye\": \"Goodbye\"\n }\n\n 🔍 Need Help?\n - Visit our docs: https://dev.wix.com/docs/go-headless\n `);\n}\n","import { fileURLToPath } from 'node:url';\nimport type { PluginOption } from 'vite';\n\nconst VIRTUAL_MODULE_ID = 'wix:astro:i18n';\nconst RESOLVED_VIRTUAL_MODULE_ID = `\\0${VIRTUAL_MODULE_ID}`;\n\nconst i18nRuntimePath = fileURLToPath(\n new URL(\n '../dependencies/astro-translations/backend-runtime/runtime/i18n.js',\n import.meta.url\n )\n);\n\nexport const wixAstroI18nPlugin = (): PluginOption => {\n return {\n name: 'vite-plugin-wix-astro-i18n',\n\n enforce: 'pre',\n\n load(id) {\n if (id !== RESOLVED_VIRTUAL_MODULE_ID) {\n return;\n }\n\n return `export * from '${i18nRuntimePath}';`;\n },\n\n resolveId(id) {\n return id === VIRTUAL_MODULE_ID ? RESOLVED_VIRTUAL_MODULE_ID : undefined;\n },\n };\n};\n","export { createIntegration as default } from './integration.js';\n","import type { WixIntegration } from '@wix/astro-core';\n\nexport const createIntegration = (): WixIntegration => {\n return {\n name: '@wix/astro/viewer-api',\n hooks: {\n 'astro:config:setup'({ injectRoute }) {\n injectRoute({\n entrypoint: new URL(\n '../dependencies/astro-viewer-api/backend-runtime/api.js',\n import.meta.url\n ),\n pattern: '/_api/[...path]',\n prerender: false,\n });\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;AAAA,SAAS,qBAAqB;;;ACA9B;AAGO,SAAS,0BAAwC;AACtD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,UAAU,MAAM,IAAI;AAClB,YAAM,CAAC,WAAW,QAAQ,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CAACC,aAAa,CAAC,IAAI,CAAC;AAAA,IACpE,GAAI,0BAA0B,CAACD,mBAAQ,CAAC,IAAI,CAAC;AAAA,IAC7C,GAAI,6BAA6B,CAACA,oBAAW,GAAGA,mBAAmB,CAAC,IAAI,CAAC;AAAA,IACzEA,mBAAe;AAAA,IACf,GAAI,mBAAmB,CAACC,aAAW,CAAC,IAAI,CAAC;AAAA,IACzC,GAAI,qBAAqB,CAACA,aAAa,GAAGD,oBAAU,CAAC,IAAI,CAAC;AAAA,IAC1DA,mBAAgB;AAAA,IAChBA,mBAAe;AAAA,IACfA,mBAAoB;AAAA,IACpBA,oBAAe;AAAA,IACfA,mBAAkB;AAAA,IAClB,kBAAiB;AAAA,IACjB,GAAI,eAAe,CAACC,aAAO,CAAC,IAAI,CAAC;AAAA,EACnC;AAEA,SAAO,CAACD,mBAAK,EAAE,aAAa,CAAC,GAAG,GAAG,YAAY;AACjD;AAEA,IAAO,gBAAQA;","names":["createIntegration","createIntegration","src_default","createIntegration","src_default","createIntegration","src_default","fileURLToPath","join","fileURLToPath","fileURLToPath","join","fileURLToPath","fileURLToPath","createIntegration","src_default","createIntegration","createIntegration","src_default"]}
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@wix/astro",
3
- "version": "2.24.0",
3
+ "version": "2.26.0",
4
4
  "dependencies": {
5
5
  "@wix/auth-management": "^1.0.71",
6
6
  "@wix/dashboard": "^1.3.40",
7
7
  "@wix/editor": "^1.403.0",
8
- "@wix/essentials": "^1.0.1",
8
+ "@wix/essentials": "^1.0.4",
9
9
  "@wix/headless-localization-utils": "^1.0.13",
10
10
  "@wix/headless-node": "^1.28.0",
11
11
  "@wix/headless-site": "^1.28.0",
12
12
  "@wix/headless-site-assets": "^1.0.9",
13
+ "@wix/multilingual-manager": "^1.5.0",
13
14
  "@wix/sdk": "^1.21.2",
14
15
  "@wix/sdk-runtime": "^1.0.0",
15
16
  "@wix/sdk-types": "^1.17.1",
16
- "@wix/site": "^1.39.0"
17
+ "@wix/site": "^1.40.0"
17
18
  },
18
19
  "devDependencies": {
19
20
  "@wix/astro-auth": "0.0.0",
@@ -32,6 +33,7 @@
32
33
  "@wix/astro-translations": "0.0.0",
33
34
  "@wix/astro-trusted-backoffice-extensions": "0.0.0",
34
35
  "@wix/astro-viewer-api": "0.0.0",
36
+ "@wix/astro-viewer-services-extensions": "0.0.0",
35
37
  "astro": "^5.16.6",
36
38
  "is-ci": "^4.1.0",
37
39
  "outdent": "^0.8.0",
@@ -74,5 +76,5 @@
74
76
  ]
75
77
  }
76
78
  },
77
- "falconPackageHash": "fa8fdf74d8eb5169dc6ac5c60418edd6e7b74ec8210a52787c34fb25"
79
+ "falconPackageHash": "a2418dd4b826be28d2e5185ab31e528f884ea4a02020421efedd3b91"
78
80
  }
@@ -1,133 +0,0 @@
1
- import {
2
- defaultOutdent
3
- } from "./chunk-YRKN4TFH.js";
4
-
5
- // src/utils/loadTranslations.ts
6
- import { readdir } from "fs/promises";
7
- import { join as join2 } from "path";
8
- import { fileURLToPath } from "url";
9
-
10
- // ../fs-utils/src/index.ts
11
- import { randomBytes } from "crypto";
12
- import {
13
- access,
14
- readFile as fsReadFile,
15
- writeFile as fsWriteFile,
16
- mkdir,
17
- rm
18
- } from "fs/promises";
19
- import { EOL, tmpdir } from "os";
20
- import { dirname, join } from "path";
21
- async function readJson(file) {
22
- return JSON.parse(await fsReadFile(file, "utf-8"));
23
- }
24
-
25
- // src/utils/loadTranslations.ts
26
- import { toNamespaceDictionary } from "@wix/headless-localization-utils";
27
-
28
- // src/constants.ts
29
- var TRANSLATIONS_METADATA_FILENAME = "metadata.json";
30
- var TRANSLATIONS_FILENAME = "translations.json";
31
-
32
- // src/utils/errorMessages.ts
33
- function createTranslationFilesError(translationsDir) {
34
- return new Error(defaultOutdent`
35
- Failed to load translation file(s).
36
- 💡 Tip: create a file '${translationsDir}/translations.json' in your project, then use the Wix CLI to push these keys.
37
-
38
- Example translation file structure:
39
- {
40
- "hello": "Hello",
41
- "goodbye": "Goodbye"
42
- }
43
-
44
- 🔍 Need Help?
45
- - Visit our docs: https://dev.wix.com/docs/go-headless
46
- `);
47
- }
48
-
49
- // src/utils/loadTranslations.ts
50
- async function loadTranslationFile(filePath) {
51
- return readJson(filePath).then(
52
- (data) => toNamespaceDictionary(data)
53
- );
54
- }
55
- async function loadAllTranslations(astroConfig) {
56
- const srcDir = fileURLToPath(astroConfig.srcDir);
57
- const rootDir = fileURLToPath(astroConfig.root);
58
- const tempDir = join2(rootDir, ".wix");
59
- const multilingualDir = join2(tempDir, "multilingual");
60
- const primaryTranslationPath = join2(srcDir, TRANSLATIONS_FILENAME);
61
- const pulledTranslationsDir = join2(multilingualDir, "translations");
62
- let metadata;
63
- let primaryTranslation;
64
- try {
65
- metadata = await loadMetadata(multilingualDir);
66
- primaryTranslation = await loadPrimaryTranslation(
67
- primaryTranslationPath,
68
- metadata
69
- );
70
- } catch {
71
- throw createTranslationFilesError(srcDir);
72
- }
73
- const wixTranslations = await loadTranslations(pulledTranslationsDir);
74
- return { ...wixTranslations, ...primaryTranslation };
75
- }
76
- async function loadMetadata(translationsMetadataDir) {
77
- const metadataPath = join2(
78
- translationsMetadataDir,
79
- TRANSLATIONS_METADATA_FILENAME
80
- );
81
- return await readJson(metadataPath);
82
- }
83
- async function loadPrimaryTranslation(primaryTranslationPath, metadata) {
84
- const translationContent = await loadTranslationFile(primaryTranslationPath);
85
- return {
86
- [metadata.primaryLanguageCode]: translationContent
87
- };
88
- }
89
- async function loadTranslations(translationsDir) {
90
- const files = await readdir(translationsDir);
91
- const jsonFiles = files.filter((file) => file.endsWith(".json"));
92
- const translations = {};
93
- for (const file of jsonFiles) {
94
- const languageCode = file.replace(".json", "");
95
- const filePath = join2(translationsDir, file);
96
- translations[languageCode] = await loadTranslationFile(filePath);
97
- }
98
- return translations;
99
- }
100
-
101
- // src/index.ts
102
- var createIntegration = () => {
103
- return {
104
- name: "@wix/astro/static-translations",
105
- hooks: {
106
- "astro:config:setup": async ({
107
- addMiddleware,
108
- config: astroConfig,
109
- updateConfig
110
- }) => {
111
- const translations = await loadAllTranslations(astroConfig);
112
- updateConfig({
113
- vite: {
114
- define: {
115
- __WIX_TRANSLATIONS__: JSON.stringify(translations)
116
- }
117
- }
118
- });
119
- addMiddleware({
120
- entrypoint: new URL(
121
- "../dependencies/astro-translations/middleware/static-translations.js",
122
- import.meta.url
123
- ),
124
- order: "pre"
125
- });
126
- }
127
- }
128
- };
129
- };
130
- var index_default = createIntegration;
131
- export {
132
- index_default as default
133
- };
@@ -1,58 +0,0 @@
1
- import {
2
- defaultOutdent
3
- } from "../chunk-YRKN4TFH.js";
4
-
5
- // src/middleware/static-translations.ts
6
- import { i18n } from "@wix/essentials";
7
-
8
- // ../request-transform-utils/src/transformStreamUtils.ts
9
- function injectBeforeTransformStream(predicate, htmlToInject) {
10
- let hasInjected = false;
11
- return new TransformStream({
12
- transform: (chunk, controller) => {
13
- if (!hasInjected) {
14
- const index = chunk.indexOf(predicate);
15
- if (index > -1) {
16
- chunk = chunk.slice(0, index) + htmlToInject + chunk.slice(index);
17
- hasInjected = true;
18
- }
19
- }
20
- controller.enqueue(chunk);
21
- }
22
- });
23
- }
24
-
25
- // ../request-transform-utils/src/index.ts
26
- var headTransformStream = (htmlToInject) => injectBeforeTransformStream("</head>", htmlToInject);
27
-
28
- // src/middleware/static-translations.ts
29
- import { multilingual } from "@wix/site";
30
- globalThis.__wix_translations__ = __WIX_TRANSLATIONS__;
31
- var onRequest = async (context, next) => {
32
- const response = await next();
33
- const contentType = response.headers.get("Content-Type");
34
- if (contentType !== "text/html" || context.url.pathname.startsWith("/_wix") || !response.body) {
35
- return response;
36
- }
37
- const filteredTranslations = getFilteredTranslations();
38
- const translationsScript = defaultOutdent`
39
- <script>window.__wix_translations__ = ${JSON.stringify(filteredTranslations)};</script>
40
- `;
41
- return new Response(
42
- response.body.pipeThrough(new TextDecoderStream()).pipeThrough(headTransformStream(translationsScript)).pipeThrough(new TextEncoderStream()),
43
- response
44
- );
45
- };
46
- function getFilteredTranslations() {
47
- const allTranslations = globalThis.__wix_translations__ ?? {};
48
- const pickLanguage = (lang) => lang != null && allTranslations[lang] ? { [lang]: allTranslations[lang] } : {};
49
- const currentLanguage = i18n.getLanguage();
50
- const primaryLanguage = multilingual.listSupportedLanguages().find((language) => language.primary)?.id;
51
- return {
52
- ...pickLanguage(currentLanguage),
53
- ...pickLanguage(primaryLanguage)
54
- };
55
- }
56
- export {
57
- onRequest
58
- };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../astro-trusted-backoffice-extensions/src/integration.ts","../../../astro-trusted-backoffice-extensions/src/utils/getAssetUrl.ts","../../../astro-trusted-backoffice-extensions/src/utils/getSupportedExtensions.ts","../../../astro-trusted-backoffice-extensions/src/vite/getViteConfig.ts","../../../astro-trusted-backoffice-extensions/src/vite/registerComponentEntryVirtualRoute.ts","../../../astro-trusted-backoffice-extensions/src/utils/getTrustedBackofficeComponent.ts","../../../astro-trusted-backoffice-extensions/src/vite/registerComponentWrapperVirtualRoute.ts","../../../astro-trusted-backoffice-extensions/src/vite/virtualModulesPlugin.ts","../../../astro-trusted-backoffice-extensions/src/builders/trustedBackofficePage.ts","../../../astro-trusted-backoffice-extensions/src/builders/trustedBackofficeWidget.ts","../../../astro-trusted-backoffice-extensions/src/index.ts"],"sourcesContent":["import { ok } from 'node:assert';\nimport type { Model, WixIntegration } from '@wix/astro-core';\nimport type {\n DevCenterBackofficePage,\n DevCenterBackofficeScriptAsset,\n DevCenterBackofficeWidget,\n} from '@wix/dev-center-schemas';\nimport type { RollupBuildOutput } from '@wix/vite-utils';\nimport type { ViteDevServer } from 'vite';\nimport { build } from '@wix/vite-utils';\nimport { createServer } from 'vite';\nimport { getAssetUrl } from './utils/getAssetUrl.js';\nimport { getSupportedExtensions } from './utils/getSupportedExtensions.js';\nimport { getViteConfig } from './vite/getViteConfig.js';\nimport { getVirtualModuleIdForComponentEntry } from './vite/registerComponentEntryVirtualRoute.js';\n\nexport const createIntegration = (): WixIntegration => {\n let model: Model | null = null;\n let customBuildOutput: null | RollupBuildOutput = null;\n let customDevServer: null | ViteDevServer = null;\n\n return {\n name: '@wix/astro/trusted-backoffice-extensions',\n hooks: {\n 'wix:model:setup'({ model: newModel }) {\n model = newModel;\n },\n async 'wix:server:start'({\n createExtensionViteConfig,\n setupExtensionProxy,\n }) {\n ok(model);\n customDevServer = await createServer(\n getViteConfig({ createExtensionViteConfig, model })\n );\n\n await customDevServer.listen();\n\n setupExtensionProxy(customDevServer);\n },\n async 'astro:server:done'() {\n ok(customDevServer);\n await customDevServer.close();\n },\n async 'wix:build:setup'({ createExtensionViteConfig, target }) {\n if (target === 'server') {\n return;\n }\n\n ok(model);\n const extensions = getSupportedExtensions(model);\n\n if (extensions.length === 0) {\n return;\n }\n\n customBuildOutput = await build(\n getViteConfig({\n createExtensionViteConfig,\n model,\n })\n );\n },\n async 'wix:app-manifest:setup'({\n staticsUrlPlaceholder,\n updateAppManifest,\n }) {\n ok(model);\n\n const components: Array<\n DevCenterBackofficePage | DevCenterBackofficeWidget\n > = [];\n\n for (const extension of getSupportedExtensions(model)) {\n const virtualModuleId = getVirtualModuleIdForComponentEntry(\n extension.options.id\n );\n\n const scriptAsset = {\n containerId: model.appId,\n exportedName: extension.options.id,\n scriptType: 'MODULE',\n url: getAssetUrl({\n baseUrl: staticsUrlPlaceholder,\n buildOutput: customBuildOutput,\n fileName: virtualModuleId,\n viteDevServer: customDevServer,\n }),\n } satisfies DevCenterBackofficeScriptAsset;\n\n switch (extension.type) {\n case 'TrustedBackofficePage': {\n components.push({\n compId: extension.options.id,\n compType: 'BACK_OFFICE_PAGE',\n compData: {\n backOfficePage: {\n activeSidebarPageId: extension.options.activeSidebarPageId,\n fullPage: extension.options.fullPage,\n hideInSidebar: extension.options.hideInSidebar,\n hostingPlatform: 'BUSINESS_MANAGER',\n pageCategoryId: extension.options.pageCategoryId,\n previousRoutePaths: extension.options.previousRoutePaths,\n priority: extension.options.priority,\n requiredPermission: extension.options.requiredPermission,\n routePath: extension.options.routePath,\n scriptAsset,\n title: extension.options.title,\n },\n },\n });\n break;\n }\n case 'TrustedBackofficeWidget': {\n components.push({\n compId: extension.options.id,\n compType: 'BACK_OFFICE_WIDGET',\n compData: {\n backOfficeWidget: {\n height: extension.options.height,\n hostingPlatform: 'BUSINESS_MANAGER',\n requiredPermission: extension.options.requiredPermission,\n scriptAsset,\n slotIds: extension.options.slotIds,\n title: extension.options.title,\n },\n },\n });\n break;\n }\n }\n }\n\n updateAppManifest({\n components,\n });\n },\n },\n };\n};\n","import type { RollupBuildOutput } from '@wix/vite-utils';\nimport type { ViteDevServer } from 'vite';\nimport {\n appendToDevServerUrl,\n getAssetUrlForModuleId,\n getChunkForModuleId,\n} from '@wix/vite-utils';\n\nexport function getAssetUrl({\n baseUrl,\n buildOutput,\n fileName,\n viteDevServer,\n}: {\n baseUrl: string;\n buildOutput: null | RollupBuildOutput;\n fileName: string;\n viteDevServer: null | ViteDevServer;\n}) {\n if (buildOutput) {\n const chunk = getChunkForModuleId({\n buildOutput,\n moduleId: `\\0${fileName}`,\n });\n\n return appendToDevServerUrl(baseUrl, chunk.fileName);\n }\n\n if (viteDevServer) {\n return getAssetUrlForModuleId({\n baseUrl,\n devServer: viteDevServer,\n moduleId: fileName,\n });\n }\n\n throw new Error('Unknown error: no build output or vite dev server');\n}\n","import type { BaseExtension, Model } from '@wix/astro-core';\nimport type { SupportedExtension } from '../types.js';\n\nexport function getSupportedExtensions(model: Model) {\n return model.extensions.filter(isSupportedExtensions);\n}\n\nfunction isSupportedExtensions(\n extension: BaseExtension\n): extension is SupportedExtension {\n return (\n extension.type === 'TrustedBackofficePage' ||\n extension.type === 'TrustedBackofficeWidget'\n );\n}\n","import type { CreateExtensionViteConfig, Model } from '@wix/astro-core';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\nimport { getSupportedExtensions } from '../utils/getSupportedExtensions.js';\nimport {\n getVirtualModuleIdForComponentEntry,\n wrapComponentRuntimePath,\n} from './registerComponentEntryVirtualRoute.js';\nimport { hmrRuntimePath } from './registerComponentWrapperVirtualRoute.js';\nimport { virtualModulesPlugin } from './virtualModulesPlugin.js';\n\nexport function getViteConfig({\n createExtensionViteConfig,\n model,\n}: {\n createExtensionViteConfig: CreateExtensionViteConfig;\n model: Model;\n}) {\n const componentEntries = getSupportedExtensions(model).map((x) =>\n getVirtualModuleIdForComponentEntry(x.options.id)\n );\n\n return createExtensionViteConfig({\n name: 'trusted-backoffice',\n config: {\n build: {\n rollupOptions: {\n input: componentEntries,\n },\n },\n experimental: {\n renderBuiltUrl(filename, { hostId, hostType }) {\n if (hostType !== 'js') {\n return { relative: true };\n }\n\n return {\n runtime: `import.meta.url.replace(\"${hostId}\", \"${filename}\")`,\n };\n },\n },\n optimizeDeps: {\n entries: [\n wrapComponentRuntimePath,\n hmrRuntimePath,\n ...componentEntries,\n ],\n },\n plugins: [\n virtualModulesPlugin({ model }),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n },\n });\n}\n","import type { Model } from '@wix/astro-core';\nimport type { ParamData, VirtualRouter } from '@wix/vite-virtual-router-plugin';\nimport { normalizePath } from '@wix/vite-utils';\nimport { outdent } from 'outdent';\nimport { getTrustedBackofficeComponent } from '../utils/getTrustedBackofficeComponent.js';\nimport { getVirtualModuleIdForComponentWrapper } from './registerComponentWrapperVirtualRoute.js';\n\ninterface Params extends ParamData {\n id: string;\n}\n\nexport const wrapComponentRuntimePath = normalizePath(\n new URL(\n '../dependencies/astro-trusted-backoffice-extensions/browser-runtime/wrapComponent.js',\n import.meta.url\n )\n);\n\nexport function getVirtualModuleIdForComponentEntry(componentId: string) {\n return `wix/component/backoffice/entries/${componentId}`;\n}\n\nexport function registerComponentEntryVirtualRoute({\n model,\n router,\n}: {\n model: Model;\n router: VirtualRouter;\n}) {\n router.route<Params>(\n getVirtualModuleIdForComponentEntry(':id'),\n ({ id }, { command }) => {\n const extension = getTrustedBackofficeComponent(model, id);\n\n if (extension) {\n const componentPath = getVirtualModuleIdForComponentWrapper(\n extension.options.id\n );\n\n if (command === 'build') {\n return getComponentBuildTemplate({\n componentId: extension.options.id,\n componentPath,\n });\n }\n\n return getComponentServeTemplate({\n componentId: extension.options.id,\n componentPath,\n });\n }\n\n return null;\n }\n );\n}\n\nfunction getComponentBuildTemplate({\n componentId,\n componentPath,\n}: {\n componentId: string;\n componentPath: string;\n}) {\n return outdent`\n import { wrapComponent } from '${wrapComponentRuntimePath}'\n\n wrapComponent({\n componentId: '${componentId}',\n loadComponent: () => import('${componentPath}'),\n });\n `;\n}\n\nfunction getComponentServeTemplate({\n componentId,\n componentPath,\n}: {\n componentId: string;\n componentPath: string;\n}) {\n return outdent`\n import { wrapComponent } from '${wrapComponentRuntimePath}'\n\n wrapComponent({\n componentId: '${componentId}',\n loadComponent: () => import('${componentPath}'),\n });\n `;\n}\n","import type { Model } from '@wix/astro-core';\nimport { getSupportedExtensions } from './getSupportedExtensions.js';\n\nexport function getTrustedBackofficeComponent(model: Model, id: string) {\n return getSupportedExtensions(model).find((ext) => ext.options.id === id);\n}\n","import { join } from 'node:path';\nimport type { Model } from '@wix/astro-core';\nimport type { ParamData, VirtualRouter } from '@wix/vite-virtual-router-plugin';\nimport { normalizePath } from '@wix/vite-utils';\nimport { outdent } from 'outdent';\nimport { getTrustedBackofficeComponent } from '../utils/getTrustedBackofficeComponent.js';\n\ninterface Params extends ParamData {\n id: string;\n}\n\nexport const hmrRuntimePath = normalizePath(\n new URL(\n '../dependencies/astro-trusted-backoffice-extensions/browser-runtime/hmr.js',\n import.meta.url\n )\n);\n\nexport function getVirtualModuleIdForComponentWrapper(componentId: string) {\n return `wix/component/backoffice/wrappers/${componentId}`;\n}\n\nexport function registerComponentWrapperVirtualRoute({\n model,\n router,\n}: {\n model: Model;\n router: VirtualRouter;\n}) {\n router.route<Params>(\n getVirtualModuleIdForComponentWrapper(':id'),\n ({ id }, { command }) => {\n const extension = getTrustedBackofficeComponent(model, id);\n\n if (extension) {\n const componentPath = normalizePath(\n join(model.srcDir, extension.options.component)\n );\n\n if (command === 'build') {\n return getComponentBuildTemplate({\n componentPath,\n });\n }\n\n return getComponentServeTemplate({\n componentPath,\n });\n }\n\n return null;\n }\n );\n}\n\nfunction getComponentBuildTemplate({\n componentPath,\n}: {\n componentPath: string;\n}) {\n return outdent`\n export { default } from '${componentPath}';\n `;\n}\n\nfunction getComponentServeTemplate({\n componentPath,\n}: {\n componentPath: string;\n}) {\n return outdent`\n import { createComponentHmrWrapper } from '${hmrRuntimePath}';\n import OriginalComponent from '${componentPath}';\n\n let WrappedComponent = OriginalComponent;\n\n if (import.meta.hot) {\n import.meta.hot.accept('${componentPath}', (newModule) => {\n if (newModule?.default) {\n import.meta.hot.data.setComponent?.(newModule?.default);\n }\n });\n\n WrappedComponent = createComponentHmrWrapper(OriginalComponent, import.meta.hot.data);\n }\n\n export default WrappedComponent;\n `;\n}\n","import type { Model } from '@wix/astro-core';\nimport {\n createVirtualRouter,\n viteVirtualRouterPlugin,\n} from '@wix/vite-virtual-router-plugin';\nimport { registerComponentEntryVirtualRoute } from './registerComponentEntryVirtualRoute.js';\nimport { registerComponentWrapperVirtualRoute } from './registerComponentWrapperVirtualRoute.js';\n\nexport function virtualModulesPlugin({ model }: { model: Model }) {\n const router = createVirtualRouter();\n\n registerComponentEntryVirtualRoute({ model, router });\n registerComponentWrapperVirtualRoute({ model, router });\n\n return viteVirtualRouterPlugin({\n name: 'wix:trusted-backoffice-virtual-modules-plugin',\n router,\n });\n}\n","export interface TrustedBackofficePage {\n type: 'TrustedBackofficePage';\n options: Options;\n}\n\ninterface Options {\n id: string;\n activeSidebarPageId?: string;\n component: string;\n fullPage?: boolean;\n hideInSidebar?: boolean;\n pageCategoryId?: string;\n previousRoutePaths?: string[];\n priority?: number;\n requiredPermission?: string;\n routePath: string;\n title: string;\n}\n\nexport function trustedBackofficePage(options: Options): TrustedBackofficePage {\n return {\n type: 'TrustedBackofficePage',\n options,\n };\n}\n","export interface TrustedBackofficeWidget {\n type: 'TrustedBackofficeWidget';\n options: Options;\n}\n\ninterface Options {\n id: string;\n component: string;\n height?: number;\n requiredPermission?: string;\n slotIds?: string[];\n title: string;\n width?: number;\n}\n\nexport function trustedBackofficeWidget(\n options: Options\n): TrustedBackofficeWidget {\n return {\n type: 'TrustedBackofficeWidget',\n options,\n };\n}\n","export { createIntegration as default } from './integration.js';\n\n// builders\nexport { trustedBackofficePage } from './builders/trustedBackofficePage.js';\nexport { trustedBackofficeWidget } from './builders/trustedBackofficeWidget.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAS,UAAU;AAUnB,SAAS,oBAAoB;;;ACV7B;AAQO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,MAAI,aAAa;AACf,UAAM,QAAQ,oBAAoB;AAAA,MAChC;AAAA,MACA,UAAU,KAAK,QAAQ;AAAA,IACzB,CAAC;AAED,WAAO,qBAAqB,SAAS,MAAM,QAAQ;AAAA,EACrD;AAEA,MAAI,eAAe;AACjB,WAAO,uBAAuB;AAAA,MAC5B;AAAA,MACA,WAAW;AAAA,MACX,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AAEA,QAAM,IAAI,MAAM,mDAAmD;AACrE;;;ACrCA;AAGO,SAAS,uBAAuB,OAAc;AACnD,SAAO,MAAM,WAAW,OAAO,qBAAqB;AACtD;AAEA,SAAS,sBACP,WACiC;AACjC,SACE,UAAU,SAAS,2BACnB,UAAU,SAAS;AAEvB;;;ACdA;;;ACAA;;;ACAA;AAGO,SAAS,8BAA8B,OAAc,IAAY;AACtE,SAAO,uBAAuB,KAAK,EAAE,KAAK,CAAC,QAAQ,IAAI,QAAQ,OAAO,EAAE;AAC1E;;;ACLA;AAAA,SAAS,YAAY;AAWd,IAAM,iBAAiB;AAAA,EAC5B,IAAI;AAAA,IACF;AAAA,IACA,YAAY;AAAA,EACd;AACF;AAEO,SAA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