@blinkk/root-cms 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +1 -1
- package/dist/{chunk-GXV4UQ6Z.js → chunk-X5CNR4CK.js} +2 -2
- package/dist/core/plugin.d.ts +1 -1
- package/dist/core/translations.d.ts +19 -4
- package/dist/plugin.js +34 -4
- package/dist/shared/translation-languages.d.ts +67 -0
- package/dist/ui/AIPage-2N5UYBRX.js +1 -0
- package/dist/ui/{AssetsPage-5S6PNMF6.js → AssetsPage-KLGNE6D6.js} +1 -1
- package/dist/ui/{CollectionPage-CU3VDEXA.js → CollectionPage-D7IG6526.js} +1 -1
- package/dist/ui/ComparePage-726NIJW5.js +1 -0
- package/dist/ui/{DataPage-XIXFKXDN.js → DataPage-YMSQCIVK.js} +1 -1
- package/dist/ui/{DataSourcePage-ORIEQH3Y.js → DataSourcePage-7VPFUG3K.js} +1 -1
- package/dist/ui/DocTranslationsPage-FO7O76VK.js +1 -0
- package/dist/ui/DocumentPage-M7SJ4ITQ.js +1 -0
- package/dist/ui/{EditDataSourcePage-HIGZZQJC.js → EditDataSourcePage-Y7YK6IWT.js} +1 -1
- package/dist/ui/{EditReleasePage-KUHBU2HQ.js → EditReleasePage-XZ4RHHRT.js} +1 -1
- package/dist/ui/{EmbeddedAIPage-CJWZE5FC.js → EmbeddedAIPage-RJOUIPF2.js} +1 -1
- package/dist/ui/EmbeddedDocumentPage-4TLMCDSO.js +1 -0
- package/dist/ui/LogsPage-IGDDZGEI.js +1 -0
- package/dist/ui/{NewDataSourcePage-7TUUE6ZL.js → NewDataSourcePage-YUPRHL7F.js} +1 -1
- package/dist/ui/NewReleasePage-6HHLYOQP.js +1 -0
- package/dist/ui/{NotFoundPage-AW6UC6II.js → NotFoundPage-A6OCYREA.js} +1 -1
- package/dist/ui/ProjectPage-UHRXNN7O.js +1 -0
- package/dist/ui/{ReleasePage-W2R3DIFX.js → ReleasePage-V2JMPWX7.js} +1 -1
- package/dist/ui/{ReleasesPage-HBBUGE7D.js → ReleasesPage-SCR4SVKN.js} +1 -1
- package/dist/ui/SettingsPage-5XKHPG6K.js +1 -0
- package/dist/ui/SidebarToolsPage-VXVRZ2C3.js +1 -0
- package/dist/ui/{TaskPage-JYUQEGRB.js → TaskPage-LDPRN3G6.js} +1 -1
- package/dist/ui/TasksPage-DIXUWYXM.js +1 -0
- package/dist/ui/{TranslationsArbPage-AJLM5VSD.js → TranslationsArbPage-QPD3ZBT4.js} +1 -1
- package/dist/ui/TranslationsEditPage-475Z7UPC.js +1 -0
- package/dist/ui/{TranslationsPage-HPYAJQ4Q.js → TranslationsPage-674JU6L4.js} +32 -32
- package/dist/ui/{chunk-3T4ZWQR4.js → chunk-2EPQJUGM.js} +1 -1
- package/dist/ui/{chunk-2KSMCQ6H.js → chunk-2RAVKX2Z.js} +1 -1
- package/dist/ui/{chunk-AZCGXQTL.js → chunk-2S5HMST6.js} +1 -1
- package/dist/ui/chunk-4ALFT4ES.js +141 -0
- package/dist/ui/{chunk-B6M55OFE.js → chunk-4FGASIIX.js} +1 -1
- package/dist/ui/chunk-AAHM6RYJ.js +1 -0
- package/dist/ui/chunk-AGFPVTBA.js +1 -0
- package/dist/ui/chunk-BUNR5EU3.js +1 -0
- package/dist/ui/{chunk-O5P3CPJ4.js → chunk-BW2MKGNP.js} +1 -1
- package/dist/ui/{chunk-MZTOPPWQ.js → chunk-ENQKSLGJ.js} +1 -1
- package/dist/ui/{chunk-76ZGLKLT.js → chunk-GT5EQSEX.js} +1 -1
- package/dist/ui/{chunk-OXVYTSIZ.js → chunk-JBHRZ4EX.js} +1 -1
- package/dist/ui/{chunk-XT5FNJCX.js → chunk-MSYTAJBV.js} +1 -1
- package/dist/ui/{chunk-E76ECIOX.js → chunk-NJMNOITA.js} +1 -1
- package/dist/ui/chunk-NWHGT476.js +1 -0
- package/dist/ui/{chunk-R6B3W5AJ.js → chunk-PTPYMVFW.js} +1 -1
- package/dist/ui/{chunk-TDUBSLEC.js → chunk-Q7IU4QCY.js} +1 -1
- package/dist/ui/{chunk-WKF7CSWS.js → chunk-QF3GPZTI.js} +1 -1
- package/dist/ui/{chunk-GU24U5RM.js → chunk-RHAJNURN.js} +1 -1
- package/dist/ui/{chunk-764W6634.js → chunk-SENZVSVZ.js} +1 -1
- package/dist/ui/chunk-SKQECSUR.js +1 -0
- package/dist/ui/chunk-TOGLZDK3.js +1 -0
- package/dist/ui/{chunk-V4CTOC6E.js → chunk-TPJCPCRR.js} +1 -1
- package/dist/ui/{chunk-GQ5IRK43.js → chunk-TVYAZN2Q.js} +1 -1
- package/dist/ui/{chunk-WXT7LTQM.js → chunk-VJUMFJIX.js} +1 -1
- package/dist/ui/{chunk-U7PWJV6F.js → chunk-W6LP22IK.js} +1 -1
- package/dist/ui/chunk-WMICEDOT.js +1 -0
- package/dist/ui/{chunk-5AVRMJVW.js → chunk-XMESZUC5.js} +1 -1
- package/dist/ui/{chunk-RAXWL656.js → chunk-XWX2622O.js} +1 -1
- package/dist/ui/chunk-YMBBWVBB.js +3 -0
- package/dist/ui/{chunk-OWQL5DVE.js → chunk-YXSXWFLZ.js} +1 -1
- package/dist/ui/chunk-ZMS6NIGG.js +1 -0
- package/dist/ui/ui.css +1 -1
- package/dist/ui/ui.js +1 -1
- package/package.json +3 -3
- package/dist/ui/AIPage-EL6DQYII.js +0 -1
- package/dist/ui/ComparePage-FTZLYO2O.js +0 -1
- package/dist/ui/DocTranslationsPage-4OVBIPSG.js +0 -1
- package/dist/ui/DocumentPage-3JPFJF3E.js +0 -1
- package/dist/ui/EmbeddedDocumentPage-6XQHYIAO.js +0 -1
- package/dist/ui/LogsPage-4DVGYXZY.js +0 -1
- package/dist/ui/NewReleasePage-6UT36HDW.js +0 -1
- package/dist/ui/ProjectPage-US5FJGFK.js +0 -1
- package/dist/ui/SettingsPage-7JQQILUV.js +0 -1
- package/dist/ui/SidebarToolsPage-MIYXKHF2.js +0 -1
- package/dist/ui/TasksPage-4VFQF243.js +0 -1
- package/dist/ui/TranslationsEditPage-RTTGTIGI.js +0 -1
- package/dist/ui/chunk-FFHV5S6A.js +0 -1
- package/dist/ui/chunk-FSVNOZ6F.js +0 -1
- package/dist/ui/chunk-GDXNSFLE.js +0 -1
- package/dist/ui/chunk-M3T56ZRP.js +0 -1
- package/dist/ui/chunk-MXGHX55S.js +0 -141
- package/dist/ui/chunk-QEE7XS6O.js +0 -1
- package/dist/ui/chunk-SRX7EWL4.js +0 -1
- package/dist/ui/chunk-TFB3VGWP.js +0 -1
- package/dist/ui/chunk-YLSRRNSE.js +0 -1
- package/dist/ui/chunk-ZN2Y5OUF.js +0 -3
- /package/dist/ui/{chunk-MXGHX55S.js.LEGAL.txt → chunk-4ALFT4ES.js.LEGAL.txt} +0 -0
- /package/dist/ui/{chunk-E76ECIOX.js.LEGAL.txt → chunk-NJMNOITA.js.LEGAL.txt} +0 -0
package/dist/app.js
CHANGED
|
@@ -1198,7 +1198,7 @@ function extractJsonFromResponse(responseText) {
|
|
|
1198
1198
|
// package.json
|
|
1199
1199
|
var package_default = {
|
|
1200
1200
|
name: "@blinkk/root-cms",
|
|
1201
|
-
version: "3.1.
|
|
1201
|
+
version: "3.1.2",
|
|
1202
1202
|
author: "s@blinkk.com",
|
|
1203
1203
|
license: "MIT",
|
|
1204
1204
|
engines: {
|
|
@@ -1373,7 +1373,7 @@ var package_default = {
|
|
|
1373
1373
|
yjs: "13.6.27"
|
|
1374
1374
|
},
|
|
1375
1375
|
peerDependencies: {
|
|
1376
|
-
"@blinkk/root": "3.1.
|
|
1376
|
+
"@blinkk/root": "3.1.2",
|
|
1377
1377
|
"firebase-admin": ">=11",
|
|
1378
1378
|
"firebase-functions": ">=4"
|
|
1379
1379
|
},
|
package/dist/core/plugin.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { translationsCheck } from './checks-translations.js';
|
|
|
12
12
|
export type { TranslationsCheckOptions } from './checks-translations.js';
|
|
13
13
|
export type { CMSService, CMSServiceContext } from './services.js';
|
|
14
14
|
export type { CMSNotificationService, NotificationResult, NotificationServiceContext, } from './services-notifications.js';
|
|
15
|
-
export type { CMSTranslationService, TranslationExportResult, TranslationImportResult, TranslationRow, TranslationServiceContext, } from './translations.js';
|
|
15
|
+
export type { CMSTranslationService, RootLocale, TranslationExportResult, TranslationImportResult, TranslationLanguage, TranslationRow, TranslationServiceContext, } from './translations.js';
|
|
16
16
|
/**
|
|
17
17
|
* Built-in sidebar tools that can be toggled on/off in the CMS UI.
|
|
18
18
|
*/
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import type { RootLocale, TranslationLanguage } from '../shared/translation-languages.js';
|
|
1
2
|
import type { CMSService, CMSServiceContext } from './services.js';
|
|
2
|
-
|
|
3
|
+
export type { RootLocale, TranslationLanguage };
|
|
4
|
+
/** A row of translation data keyed by translation language. */
|
|
3
5
|
export interface TranslationRow {
|
|
4
6
|
/** The source string. */
|
|
5
7
|
source: string;
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Map of translation language to translated string. Translation languages
|
|
10
|
+
* are derived from the project's locales via the `i18n.translationLanguages`
|
|
11
|
+
* config in root.config.ts; when no mapping is configured, the keys are the
|
|
12
|
+
* locale ids themselves.
|
|
13
|
+
*/
|
|
14
|
+
translations: Record<TranslationLanguage, string>;
|
|
8
15
|
/** Optional translator notes/context for the source string. */
|
|
9
16
|
description?: string;
|
|
10
17
|
}
|
|
@@ -17,7 +24,15 @@ export interface TranslationServiceContext extends CMSServiceContext {
|
|
|
17
24
|
/** The slug, e.g. `index`. */
|
|
18
25
|
slug: string;
|
|
19
26
|
/** The locales configured for the project. */
|
|
20
|
-
locales:
|
|
27
|
+
locales: RootLocale[];
|
|
28
|
+
/**
|
|
29
|
+
* The translation languages for the project, derived from `locales` via the
|
|
30
|
+
* `i18n.translationLanguages` config in root.config.ts (deduped, since
|
|
31
|
+
* multiple locales may share a translation language). Equal to `locales`
|
|
32
|
+
* when no mapping is configured. The `translations` keys in
|
|
33
|
+
* `TranslationRow` data use these languages.
|
|
34
|
+
*/
|
|
35
|
+
translationLanguages: TranslationLanguage[];
|
|
21
36
|
/** The email of the user performing the action. */
|
|
22
37
|
user: {
|
|
23
38
|
email: string;
|
package/dist/plugin.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
serializeAiConfig,
|
|
14
14
|
summarizeDiff,
|
|
15
15
|
translateString
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-X5CNR4CK.js";
|
|
17
17
|
import {
|
|
18
18
|
runCronJobs
|
|
19
19
|
} from "./chunk-AJDMNTZQ.js";
|
|
@@ -61,6 +61,28 @@ import { promises as fs } from "node:fs";
|
|
|
61
61
|
import path from "node:path";
|
|
62
62
|
import { multipartMiddleware } from "@blinkk/root/middleware";
|
|
63
63
|
|
|
64
|
+
// shared/translation-languages.ts
|
|
65
|
+
function getTranslationLanguage(i18nConfig, locale) {
|
|
66
|
+
const mapping = i18nConfig.translationLanguages || {};
|
|
67
|
+
const localeLower = String(locale).toLowerCase();
|
|
68
|
+
for (const [key, lang] of Object.entries(mapping)) {
|
|
69
|
+
if (key.toLowerCase() === localeLower) {
|
|
70
|
+
return lang;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return locale;
|
|
74
|
+
}
|
|
75
|
+
function toTranslationLanguages(i18nConfig, locales) {
|
|
76
|
+
const languages = [];
|
|
77
|
+
for (const locale of locales) {
|
|
78
|
+
const lang = getTranslationLanguage(i18nConfig, locale);
|
|
79
|
+
if (!languages.includes(lang)) {
|
|
80
|
+
languages.push(lang);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return languages;
|
|
84
|
+
}
|
|
85
|
+
|
|
64
86
|
// core/csv.ts
|
|
65
87
|
import { parse as csvParse } from "csv-parse/sync";
|
|
66
88
|
import { stringify as csvStringify } from "csv-stringify/sync";
|
|
@@ -1051,7 +1073,9 @@ function api(server, options) {
|
|
|
1051
1073
|
}
|
|
1052
1074
|
try {
|
|
1053
1075
|
const cmsClient = new RootCMSClient(req.rootConfig);
|
|
1054
|
-
const
|
|
1076
|
+
const i18nConfig = req.rootConfig?.i18n || {};
|
|
1077
|
+
const locales = i18nConfig.locales || [];
|
|
1078
|
+
const translationLanguages = toTranslationLanguages(i18nConfig, locales);
|
|
1055
1079
|
const result = await handler(
|
|
1056
1080
|
{
|
|
1057
1081
|
rootConfig: req.rootConfig,
|
|
@@ -1060,6 +1084,7 @@ function api(server, options) {
|
|
|
1060
1084
|
collectionId,
|
|
1061
1085
|
slug,
|
|
1062
1086
|
locales,
|
|
1087
|
+
translationLanguages,
|
|
1063
1088
|
user: { email: req.user.email }
|
|
1064
1089
|
},
|
|
1065
1090
|
data
|
|
@@ -1092,8 +1117,13 @@ function sse(server) {
|
|
|
1092
1117
|
}
|
|
1093
1118
|
res.writeHead(200, {
|
|
1094
1119
|
"Content-Type": "text/event-stream",
|
|
1095
|
-
|
|
1096
|
-
|
|
1120
|
+
// `no-transform` opts out of the `compression()` middleware (used by
|
|
1121
|
+
// `root start` / `root preview`), which would otherwise hold SSE chunks
|
|
1122
|
+
// in a gzip/brotli window and never deliver them incrementally.
|
|
1123
|
+
"Cache-Control": "no-cache, no-transform",
|
|
1124
|
+
Connection: "keep-alive",
|
|
1125
|
+
// Disable buffering in nginx-style reverse proxies.
|
|
1126
|
+
"X-Accel-Buffering": "no"
|
|
1097
1127
|
});
|
|
1098
1128
|
sseClients.add(res);
|
|
1099
1129
|
const connectedMessage = formatMessage(
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for converting between a "root locale" and a "translation
|
|
3
|
+
* language".
|
|
4
|
+
*
|
|
5
|
+
* Translation systems often use different language identifiers than root
|
|
6
|
+
* locales, and multiple root locales may share the same translations. The
|
|
7
|
+
* `i18n.translationLanguages` config in root.config.ts maps a root locale to
|
|
8
|
+
* the language identifier used wherever translations are imported, exported,
|
|
9
|
+
* or edited (CSV, Google Sheets, translation services, and the CMS
|
|
10
|
+
* translations pages). For example:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* i18n: {
|
|
14
|
+
* locales: ['en', 'es_mx', 'es_co', 'en_gb', 'en_ca', 'fr_ca'],
|
|
15
|
+
* translationLanguages: {
|
|
16
|
+
* es_mx: 'es-419',
|
|
17
|
+
* es_co: 'es-419',
|
|
18
|
+
* en_gb: 'en-GB',
|
|
19
|
+
* en_ca: 'en-GB',
|
|
20
|
+
* fr_ca: 'fr-CA',
|
|
21
|
+
* },
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Locales not listed in the mapping use the locale id as the translation
|
|
26
|
+
* language. All matching is case-insensitive.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* A site-defined locale identifier, as configured in `i18n.locales`.
|
|
30
|
+
* Root is agnostic to its format.
|
|
31
|
+
*/
|
|
32
|
+
export type RootLocale = string;
|
|
33
|
+
/**
|
|
34
|
+
* The language identifier used by translation systems (CSV/Sheets columns,
|
|
35
|
+
* translation services, CMS translations pages), mapped from a root locale
|
|
36
|
+
* via `i18n.translationLanguages`. Defaults to the root locale id.
|
|
37
|
+
*/
|
|
38
|
+
export type TranslationLanguage = string;
|
|
39
|
+
export interface TranslationLanguagesI18nConfig {
|
|
40
|
+
locales?: RootLocale[];
|
|
41
|
+
translationLanguages?: Record<RootLocale, TranslationLanguage>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns the translation language for a root locale, e.g. `es-419` for the
|
|
45
|
+
* `es_mx` locale. Returns the locale itself if no mapping is configured.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getTranslationLanguage(i18nConfig: TranslationLanguagesI18nConfig, locale: RootLocale): TranslationLanguage;
|
|
48
|
+
/**
|
|
49
|
+
* Converts a list of root locales to translation languages, removing
|
|
50
|
+
* duplicates (multiple root locales may share a translation language) while
|
|
51
|
+
* preserving order.
|
|
52
|
+
*/
|
|
53
|
+
export declare function toTranslationLanguages(i18nConfig: TranslationLanguagesI18nConfig, locales: RootLocale[]): TranslationLanguage[];
|
|
54
|
+
/**
|
|
55
|
+
* Expands a translation language (or root locale) to the root locales it
|
|
56
|
+
* covers. A value matches a root locale directly or via its configured
|
|
57
|
+
* translation language, e.g. `es-419` returns both `es_mx` and `es_co` with
|
|
58
|
+
* the example config above. Returns an empty array if the
|
|
59
|
+
* value doesn't match any configured locale.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getLocalesForTranslationLanguage(i18nConfig: TranslationLanguagesI18nConfig, lang: TranslationLanguage | RootLocale): RootLocale[];
|
|
62
|
+
/**
|
|
63
|
+
* Reads the translation for a translation language (or root locale) from a
|
|
64
|
+
* map keyed by root locale, checking all root locales that share the
|
|
65
|
+
* language and returning the first non-empty value.
|
|
66
|
+
*/
|
|
67
|
+
export declare function getTranslationForLanguage(i18nConfig: TranslationLanguagesI18nConfig, translations: Record<RootLocale, unknown>, lang: TranslationLanguage | RootLocale): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-2RAVKX2Z.js";import"./chunk-HO3W4RVG.js";import"./chunk-2EPQJUGM.js";import"./chunk-NJMNOITA.js";import"./chunk-344GZOGG.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{a as i}from"./chunk-P2Z66DHV.js";import{b as o}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import"./chunk-BUNR5EU3.js";import{Ga as t}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function n(r){return i("AI"),t(o,{children:t(a,{variant:"page",initialChatId:r.chatId})})}export{n as AIPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p}from"./chunk-
|
|
1
|
+
import{a as p}from"./chunk-W6LP22IK.js";import{a as i}from"./chunk-XMESZUC5.js";import"./chunk-ENQKSLGJ.js";import"./chunk-CAY5NM4Z.js";import{a as n}from"./chunk-MSYTAJBV.js";import"./chunk-AGFPVTBA.js";import"./chunk-YMBBWVBB.js";import"./chunk-W5DOO6ID.js";import"./chunk-NSOTG64N.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import{a as d}from"./chunk-BW2MKGNP.js";import"./chunk-KRNQ6L35.js";import{a as g}from"./chunk-P2Z66DHV.js";import{b as m}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import{d as o}from"./chunk-BUNR5EU3.js";import{Ga as e,a as t,c as r,j as h}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";h();function k(){g("Asset Library");let[l,u]=p("folder",""),{query:c,route:f}=o(),[a]=t(c.asset||"");return r(()=>{if(a){let s=new URL(window.location.href);s.searchParams.delete("asset"),f(s.pathname+s.search,!0)}},[]),e(m,{children:e("div",{className:"AssetsPage","data-testid":"assets-page",children:[e("div",{className:"AssetsPage__header",children:[e(n,{size:"h1",children:"Asset Library"}),e(d,{as:"p",children:"The asset library can be used to store and organize files used throughout the project. Replacing a file in the asset library automatically updates all draft docs that use it (requires re-publishing)."})]}),e(i,{className:"AssetsPage__browser",mode:"manage",folder:l,onFolderChange:u,initialAssetId:a})]})})}export{k as AssetsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as j}from"./chunk-
|
|
1
|
+
import{a as j}from"./chunk-4FGASIIX.js";import{a as U}from"./chunk-TOGLZDK3.js";import{h as B}from"./chunk-Q7IU4QCY.js";import{a as z,e as A,j as E}from"./chunk-YXSXWFLZ.js";import"./chunk-JTIQBW33.js";import{c as O,e as I}from"./chunk-PTPYMVFW.js";import"./chunk-2S5HMST6.js";import{a as w}from"./chunk-FJLNXXE3.js";import{a as P}from"./chunk-GT5EQSEX.js";import"./chunk-D3UIZHRK.js";import"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import{b as h}from"./chunk-5MV6XVGA.js";import"./chunk-AGFPVTBA.js";import"./chunk-YMBBWVBB.js";import{b as S}from"./chunk-W5DOO6ID.js";import{a as D}from"./chunk-NSOTG64N.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-BW2MKGNP.js";import"./chunk-KRNQ6L35.js";import{a as $}from"./chunk-P2Z66DHV.js";import{b as R}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import{d as k}from"./chunk-BUNR5EU3.js";import{Ca as L,Ga as o,V as y,a as x,c as T,cb as u,da as C,j as M,za as N}from"./chunk-LROR6N3B.js";import{d as f}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";M();function p(e){let{route:i}=k(),l=window.__ROOT_CTX.rootConfig.projectId;$(e.collection?e.collection:"Content"),T(()=>{let a=window.__ROOT_CTX.collections,s=`root-cms::${l}::last_collection`;if(e.collection)window.localStorage.setItem(s,e.collection);else{let t=window.localStorage.getItem(s);if(t&&a[t]){i(`/cms/content/${t}`);return}if(window.__ROOT_CTX.collections.Pages){i("/cms/content/Pages");return}let _=Object.keys(window.__ROOT_CTX.collections)||[];if(_.length>0){let d=_[0];i(`/cms/content/${d}`);return}console.warn("no collections")}},[e.collection,l]);let n=window.__ROOT_CTX.collections;return o(R,{children:o("div",{className:"CollectionPage",children:o("div",{className:"CollectionPage__layout",children:[o("div",{className:"CollectionPage__side",children:o(j,{collections:n,activeCollectionId:e.collection,projectId:l})}),o("div",{className:"CollectionPage__main",children:e.collection&&o(p.Collection,{collection:e.collection},e.collection)})]})})})}p.Collection=e=>{let{roles:i}=D(),l=window.firebase.user.email||"",n=S(i,l),[a,s]=w(`root::CollectionPage:${e.collection}:orderBy`,"modifiedAt"),[t,_]=w(`root::CollectionPage:${e.collection}:showArchived`,!1),[d,r]=x(!1),m=window.__ROOT_CTX.collections[e.collection];if(!m)return route("/cms/content"),o(f,{});let v=[{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"},{value:"modifiedAt",label:"Last modified"},...m.sortOptions?.map(g=>({value:g.id,label:g.label}))||[]],[c,X,b]=A(e.collection,{orderBy:a,includeArchived:t});return o(f,{children:[o(E,{collection:e.collection,opened:d,onClose:()=>r(!1)}),o("div",{className:"CollectionPage__collection",children:o("div",{className:"CollectionPage__collection__docsTab",children:[!c&&o("div",{className:"CollectionPage__collection__docsTab__header",children:[o("div",{className:"CollectionPage__collection__docsTab__header__title",children:m.name||e.collection}),o("div",{className:"CollectionPage__collection__docsTab__controls",children:[o("div",{className:"CollectionPage__collection__docsTab__controls__showArchived",children:o(L,{size:"sm",color:"dark",label:"Show archived:",checked:t,onChange:g=>_(!!g.currentTarget.checked)})}),o("div",{className:"CollectionPage__collection__docsTab__controls__sort",children:[o("div",{className:"CollectionPage__collection__docsTab__controls__sort__label",children:"Sort:"}),o(N,{size:"xs",value:a,onChange:g=>s(g||"modifiedAt"),data:v})]}),o("div",{className:"CollectionPage__collection__docsTab__controls__newDoc",children:o(P,{label:"You don't have access to create new documents",condition:!n,children:o(C,{color:"dark",size:"xs",leftIcon:o(u,{size:16}),onClick:()=>r(!0),disabled:!n,children:"New"})})})]})]}),o(U,{className:"CollectionPage__collection__docsTab__content",children:c?o("div",{className:"CollectionPage__collection__docsTab__content__loading",children:o(y,{color:"gray",size:"xl"})}):b.length===0?o("div",{class:"CollectionPage__collection__docsEmpty",children:[o("div",{class:"CollectionPage__collection__docsEmpty__title",children:"Collection is empty."}),o("div",{class:"CollectionPage__collection__docsEmpty__button",children:o(P,{label:"You don't have access to create new documents",condition:!n,children:o(C,{color:"dark",size:"xs",leftIcon:o(u,{size:16}),onClick:()=>r(!0),disabled:!n,children:"New"})})})]}):o(p.DocsList,{collection:e.collection,docs:b,reloadDocs:()=>X()})})]})})]})};p.DocsList=e=>{let i=e.collection,l=window.__ROOT_CTX.collections[e.collection];if(!l)throw new Error(`could not find collection: ${i}`);let n=!!l.url,a=e.docs||[];function s(t){return n?z({collectionId:i,slug:t}):""}return o("div",{className:"CollectionPage__collection__docsList",children:a.map(t=>{let _=`/cms/content/${i}/${t.slug}`,d=s(t.slug),r=t.fields||{},m=h(r,l.preview?.title||"meta.title"),v=h(r,l.preview?.image||"meta.image")||l.preview?.defaultImage;return o("div",{className:"CollectionPage__collection__docsList__doc",children:[o("div",{className:"CollectionPage__collection__docsList__doc__image",children:o("a",{href:_,children:o(I,{file:v,width:120,height:90,withPlaceholder:!v?.src})})}),o("a",{className:"CollectionPage__collection__docsList__doc__content",href:_,children:[o("div",{className:"CollectionPage__collection__docsList__doc__content__header",children:[o("div",{className:"CollectionPage__collection__docsList__doc__content__header__docId",children:t.id}),o(O,{doc:t})]}),o("div",{className:"CollectionPage__collection__docsList__doc__content__title",children:m||"[UNTITLED]"}),n&&d&&o("div",{className:"CollectionPage__collection__docsList__doc__content__url",children:d})]}),o("div",{className:"CollectionPage__collection__docsList__doc__controls",children:o(B,{docId:t.id,data:t,onAction:c=>{(c.action==="archive"||c.action==="copy"||c.action==="unarchive"||c.action==="delete"||c.action==="unpublish"||c.action==="locked"||c.action==="unlocked")&&e.reloadDocs()}})})]},t.id)})})};export{p as CollectionPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as s}from"./chunk-SKQECSUR.js";import"./chunk-2EPQJUGM.js";import"./chunk-NJMNOITA.js";import"./chunk-5MV6XVGA.js";import"./chunk-AGFPVTBA.js";import"./chunk-YMBBWVBB.js";import"./chunk-BW2MKGNP.js";import"./chunk-KRNQ6L35.js";import{a as m}from"./chunk-P2Z66DHV.js";import{b as d}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import{d as t}from"./chunk-BUNR5EU3.js";import{Ga as a,g as i,j as p}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";p();function h(){let{query:r}=t();m("Compare");let o=i(()=>n(r.left||""),[r.left]),e=i(()=>n(r.right||""),[r.right]);return a(d,{children:a("div",{className:"ComparePage",children:o&&e?a(s,{className:"ComparePage__diff",left:o,right:e}):a("div",{className:"ComparePage__error",children:"Invalid params, double check query params."})})})}function n(r){let[o,e]=String(r).split("@");return o&&e?{docId:o,versionId:e}:null}export{h as ComparePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-TPJCPCRR.js";import"./chunk-3E6CASIN.js";import{a as y}from"./chunk-MSYTAJBV.js";import{a as k}from"./chunk-TOGLZDK3.js";import{a as x}from"./chunk-FJLNXXE3.js";import{a as w}from"./chunk-GT5EQSEX.js";import{b as v}from"./chunk-D3UIZHRK.js";import"./chunk-JS6TK4OP.js";import{b as P}from"./chunk-W5DOO6ID.js";import{a as T}from"./chunk-NSOTG64N.js";import"./chunk-QHJOTXYB.js";import{a as p}from"./chunk-BW2MKGNP.js";import{b as u}from"./chunk-KRNQ6L35.js";import{a as B}from"./chunk-P2Z66DHV.js";import{b as A}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import"./chunk-BUNR5EU3.js";import{Ca as b,Da as D,Fa as i,Ga as e,Mc as S,V as g,W as f,a as d,ba as s,c as h,da as _,g as c,j as G}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";G();var z={transition:"pop"};function O(a){let o=a.dataSource;return N(o.archivedAt)?e(i,{...z,label:`Archived ${L(o.archivedAt)} by ${o.archivedBy}`,children:e(s,{size:"xs",color:"gray",variant:"filled",children:"Archived"})}):N(o.publishedAt)?e(i,{...z,label:`Published ${L(o.publishedAt)} by ${o.publishedBy}`,children:e(s,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}):e(s,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Unpublished"})}function N(a){return!!(a&&a.toMillis)}function L(a){return a?.toMillis?u(a.toMillis()):u(new Date().getTime())}function E(){B("Data Sources");let{roles:a}=T(),o=window.firebase.user.email||"",r=P(a,o);return e(A,{children:e("div",{className:"DataPage",children:[e("div",{className:"DataPage__header",children:[e(y,{size:"h1",children:"Data Sources"}),e(p,{as:"p",children:"Add data sources to sync data from external services, like Google Sheets."}),e("div",{className:"DataPage__header__buttons",children:e(w,{label:"You don't have access to create new data sources",condition:!r,children:e(_,{component:"a",color:"blue",size:"xs",href:"/cms/data/new",disabled:!r,style:r?void 0:{pointerEvents:"none"},children:"New data source"})})})]}),e(E.DataSourcesTable,{})]})})}E.DataSourcesTable=()=>{let[a,o]=d(!0),[r,I]=d([]),[l,$]=x("root::DataPage:showArchived",!1),C=t=>!!t&&t.startsWith("https://docs.google.com/spreadsheets/");async function M(){let t=await v();I(t),o(!1)}let H=c(()=>r.some(t=>!!t.archivedAt),[r]),n=c(()=>r.filter(t=>{let U=!!t.archivedAt;return l?!0:!U}),[r,l]);return h(()=>{M()},[]),e("div",{className:"DataPage__DataSourcesTable",children:[!a&&H&&e("div",{className:"DataPage__DataSourcesTable__filters",children:e(b,{size:"sm",color:"dark",label:"Show archived",checked:l,onChange:t=>$(!!t.currentTarget.checked)})}),e(k,{children:[a&&e(g,{color:"gray",size:"xl"}),!a&&n.length>0&&e(D,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"id"}),e("th",{children:"description"}),e("th",{children:"type"}),e("th",{children:"url"}),e("th",{children:"status"}),e("th",{children:"last synced"}),e("th",{children:"last published"})]})}),e("tbody",{children:n.map(t=>e("tr",{children:[e("td",{children:e("a",{href:`/cms/data/${t.id}`,children:t.id})}),e("td",{children:t.description||""}),e("td",{children:t.type}),e("td",{children:C(t.url)?e("div",{className:"DataPage__DataSourcesTable__url",children:[e(i,{label:"Open spreadsheet",children:e(f,{component:"a",href:t.url,target:"_blank",rel:"noreferrer",variant:"filled",color:"green",size:"sm","aria-label":"Open spreadsheet",children:e(S,{size:16,stroke:"2.25"})})}),e("a",{className:"DataPage__DataSourcesTable__url__text",href:t.url,target:"_blank",rel:"noreferrer",children:t.url})]}):t.url||""}),e("td",{children:e(O,{dataSource:t})}),e("td",{children:e(m,{dataSource:t,action:"sync"})}),e("td",{children:e(m,{dataSource:t,action:"publish"})})]},t.id))})]}),!a&&n.length===0&&e(p,{as:"p",children:"No data sources found for this filter."})]})]})};export{E as DataPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-TPJCPCRR.js";import"./chunk-3E6CASIN.js";import{a as g}from"./chunk-MSYTAJBV.js";import{a as h}from"./chunk-TOGLZDK3.js";import"./chunk-GT5EQSEX.js";import{c as T,d as N}from"./chunk-D3UIZHRK.js";import"./chunk-JS6TK4OP.js";import"./chunk-W5DOO6ID.js";import"./chunk-NSOTG64N.js";import"./chunk-QHJOTXYB.js";import{a as A}from"./chunk-BW2MKGNP.js";import"./chunk-KRNQ6L35.js";import{a as H}from"./chunk-P2Z66DHV.js";import{b as W}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import"./chunk-BUNR5EU3.js";import{Da as D,Fa as p,Fc as k,Ga as a,Mc as z,V as y,W as m,a as _,c as b,ca as v,da as P,j as B,na as x,oa as w}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function r(t){H(`Data Source: ${t.id}`);let[o,l]=_(!0),[e,u]=_(null),[n,c]=_(null),i=t.id;async function d(){let s=await T(i);if(u(s),s){let I=await N(i,{mode:"draft"});c(I)}l(!1)}b(()=>{d()},[]);function S(s){s==="sync"&&d()}return a(W,{children:a("div",{className:"DataSourcePage",children:[a("div",{className:"DataSourcePage__header",children:[a(v,{className:"DataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data"}),a("div",{children:i})]}),a("div",{className:"DataSourcePage__header__titleWrap",children:[a(g,{size:"h1",children:["Data Source: ",i]}),a("div",{className:"DataSourcePage__header__controls",children:a(p,{label:"Configure",children:a(m,{component:"a",href:`/cms/data/${t.id}/edit`,children:a(k,{size:24,stroke:"1.5"})})})})]}),e?.description&&a(A,{as:"p",children:e.description})]}),e&&a(r.SyncStatus,{dataSource:e,onAction:S}),o?a(y,{color:"gray",size:"xl"}):e?a(r.DataSection,{dataSource:e,data:n}):a("div",{className:"DataSourcePage__notFound",children:"Not Found"})]})})}r.SyncStatus=t=>{let o=t.dataSource;return a("div",{className:"DataSourcePage__SyncStatus",children:[a(g,{size:"h2",children:"Status"}),a(h,{className:"DataSourcePage__SyncStatus__content",children:a(D,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[a("thead",{children:a("tr",{children:[a("th",{children:"last synced"}),a("th",{children:"last published"})]})}),a("tbody",{children:a("tr",{children:[a("td",{children:a(f,{dataSource:o,action:"sync",onAction:()=>{t.onAction&&t.onAction("sync")}})}),a("td",{children:a(f,{dataSource:o,action:"publish"})})]})})]})})]})};r.DataSection=t=>{let{data:o,headers:l}=t.data||{},e=t.dataSource;if(!o)return null;let u=e.dataFormat||"map";if(e.type==="gsheet"){let n=l,c=[];if(u==="array")c=o;else if(u==="map"){let i=o;if(!n){let d=new Set;i.forEach(S=>{for(let s in S)s&&d.add(s)}),n=Array.from(d)}i.forEach(d=>{c.push(n.map(S=>d[S]||""))})}return a(r.DataSectionWrap,{dataSource:e,children:a(r.DataTable,{headers:n,rows:c})})}return e.type==="http"?a(r.DataSectionWrap,{dataSource:e,children:a(r.DefaultDataDisplay,{data:o})}):(console.log(`unsupported data type: ${e.type}`),null)};r.DataSectionWrap=t=>a("div",{className:"DataSourcePage__DataSection",children:[a("div",{className:"DataSourcePage__DataSection__header",children:[a(g,{size:"h2",children:"Data"}),a("div",{className:"DataSourcePage__DataSection__header__actions",children:[t.dataSource.url?.startsWith("https://docs.google.com/spreadsheets/")&&a(p,{label:"Open spreadsheet",children:a(m,{component:"a",href:t.dataSource.url,target:"_blank",variant:"filled",color:"green",children:a(z,{size:16,stroke:"2.25"})})}),t.dataSource.previewUrl&&a(P,{component:"a",variant:"default",size:"xs",href:t.dataSource.previewUrl,target:"_blank",children:"Preview"})]})]}),a(h,{className:"DataSourcePage__DataSection__content",children:t.children})]});r.DataTable=t=>{let o=t.headers||[],l=t.rows||[];return a("div",{className:"DataSourcePage__DataTable",children:a(D,{className:"DataSourcePage__DataTable__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[o.length>0&&a("thead",{children:a("tr",{children:o.map(e=>a("th",{children:e},e))})}),a("tbody",{children:l.map((e,u)=>a("tr",{children:e.map((n,c)=>a("td",{children:n},c))},u))})]})})};r.DefaultDataDisplay=t=>{let o=t.data;return typeof o=="object"?a(w,{value:JSON.stringify(o,null,2),minRows:20,maxRows:100}):a(x,{value:String(o),minRows:12,maxRows:100})};export{r as DataSourcePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ta}from"./chunk-VJUMFJIX.js";import{a as na}from"./chunk-JBHRZ4EX.js";import{c as ra}from"./chunk-W6LP22IK.js";import{a as oa}from"./chunk-MSYTAJBV.js";import"./chunk-HARRKJFZ.js";import{b as U}from"./chunk-JS6TK4OP.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{Q as q,X as J}from"./chunk-AGFPVTBA.js";import{b as V,h as y,k as S,m as X}from"./chunk-YMBBWVBB.js";import{b as G}from"./chunk-J5E457OI.js";import{a as O,b as j}from"./chunk-QHJOTXYB.js";import"./chunk-BW2MKGNP.js";import"./chunk-KRNQ6L35.js";import{a as sa}from"./chunk-P2Z66DHV.js";import{b as N}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import{e as M}from"./chunk-BUNR5EU3.js";import{Bc as Z,Fa as p,Ga as a,Mc as aa,Qc as ea,V as W,W as w,a as r,c as k,ca as B,da as f,e as E,g as R,j as ma,jc as Y,qa as C,yb as K,zb as Q}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";ma();function u(e){sa(`Translations: ${e.collection}/${e.slug}`);let[g,l]=r(!0),[h,_]=r(!1),[o,t]=r([]),[s,c]=r({}),[L,ia]=r(null),[la,F]=r(!1),[I,z]=r({}),[ca,H]=r(!1),m=e.collection,b=e.slug,i=`${m}/${b}`,da=ta(),ga=window.__ROOT_CTX.rootConfig.i18n||{},x=S((ga.locales||[]).filter(n=>!y(n))),[$,A]=ra("locale",x);async function _a(){try{let[n,d,T]=await Promise.all([na(i),V(),J(i)]);t(n),c(d),ia(T),l(!1)}catch(n){console.error(n),l(!1),_(!0)}}if(k(()=>{_a()},[]),h)return a(u.NotFound,{docId:i});function Ta(n,d,T){F(!0),z(P=>{let D={...P},v=D[n]??{};return v.source=n,v[d]=T,D[n]=v,D})}async function ua(){H(!0),await G(async()=>{console.log("EditTranslationsModal.onSave()");let n=`edit-translations-${i}`;O({id:n,loading:!0,title:"Saving translations",message:`Updating for ${i}...`,autoClose:!1,disallowClose:!0});let d=Object.values(I);console.log(d),await q(i,d),j({id:n,title:"Saved translations",message:`Updated translations for ${i}!`,autoClose:!0}),z({}),F(!1)}),H(!1)}function ha(n){$.length===x.length?A([n]):A(x)}return a(N,{children:a("div",{className:"DocTranslationsPage",children:[a("div",{className:"DocTranslationsPage__header",children:[a(B,{className:"DocTranslationsPage__header__breadcrumbs",children:[a("a",{href:`/cms/content/${m}`,children:m}),a("a",{href:`/cms/content/${m}/${b}`,children:b}),a("div",{children:"translations"})]}),a("div",{className:"DocTranslationsPage__header__titleWrap",children:a(oa,{size:"h1",children:["Translations: ",i]})}),a("div",{className:"DocTranslationsPage__header__controls",children:[L&&a("div",{className:"DocTranslationsPage__header__linkedSheet",children:a("div",{className:"DocTranslationsPage__header__linkedSheet__controls",children:[a(p,{label:"Open Google Sheet",children:a(w,{component:"a",href:U(L),target:"_blank",variant:"filled",color:"green",size:"sm",children:a(aa,{size:16,strokeWidth:2.25})})}),a(f,{variant:"default",size:"xs",leftIcon:a(Q,{size:16,strokeWidth:1.75}),children:"Import from Sheet"}),a(f,{variant:"default",size:"xs",leftIcon:a(K,{size:16,strokeWidth:1.75}),children:"Export to Sheet"})]})}),a(C,{className:"DocTranslationsPage__toolsMenu",control:a(p,{label:"Tools",children:a(w,{variant:"default",children:a(ea,{size:16})})}),size:220,children:a(C.Item,{className:"DocTranslationsPage__toolsMenu__item",icon:a(Z,{size:16}),onClick:()=>da.open({docId:i,sourceStrings:o,onPruned:n=>{c(d=>{let T={...d};return n.forEach(P=>delete T[P]),T})}}),children:"Prune unused strings"})})]})]}),a("div",{className:M("DocTranslationsPage__content",g&&"DocTranslationsPage__content--loading"),children:g?a(W,{color:"gray",size:"xl"}):a(u.Table,{locales:$,sourceStrings:o,translationsMap:s,onChange:Ta,changesMap:I,onSelectLocale:n=>ha(n)})}),a("div",{className:"DocTranslationsPage__footer",children:a("div",{className:"DocTranslationsPage__footer__buttons",children:a(f,{variant:"filled",color:"dark",disabled:!la,loading:ca,onClick:()=>ua(),children:"Save"})})})]})})}u.NotFound=e=>a(N,{children:a("div",{className:"DocTranslationsPage DocTranslationsPage--error",children:a("div",{className:"DocTranslationsPage__error",children:[a("div",{className:"DocTranslationsPage__error__icon",children:a(Y,{size:60})}),a("div",{className:"DocTranslationsPage__error__title",children:["Not found: ",e.docId]})]})})});u.Table=e=>{let g=window.__ROOT_CTX.rootConfig.i18n||{},l=S((g.locales||[]).filter(o=>!y(o))),h=R(()=>{let o={};return Object.values(e.translationsMap).forEach(t=>{o[t.source]=t}),o},[e.translationsMap]);function _(o,t){let s=h[o]||{};return{translation:X(s,t),hasChanges:!1}}return a("div",{className:"DocTranslationsPage__TableWrap",children:a("table",{className:"DocTranslationsPage__Table",children:[a("thead",{children:a("tr",{children:[a("th",{className:"DocTranslationsPage__Table__sourceCellHeader",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:"source"})}),e.locales.map(o=>a("th",{onClick:()=>e.onSelectLocale(o),className:"DocTranslationsPage__Table__localeHeader",children:a(p,{className:"DocTranslationsPage__Table__headerTooltip",placement:"start",withArrow:!0,label:e.locales.length===l.length?`Show only ${o}`:"Show all locales",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:o})})},o))]})}),a("tbody",{children:e.sourceStrings.map(o=>a("tr",{children:[a("td",{className:"DocTranslationsPage__Table__sourceCellWrap",children:a("div",{className:"DocTranslationsPage__Table__sourceCell",children:o})}),e.locales.map(t=>{let s=_(o,t);return a("td",{children:a(u.Textarea,{source:o,locale:t,value:s.translation,onChange:e.onChange,changesMap:e.changesMap})},t)})]},o))})]})})};u.Textarea=e=>{let g=E(null),[l,h]=r(e.value),_=null;e.locale in(e.changesMap[e.source]||{})&&(_=e.changesMap[e.source][e.locale]);let o=_!==null&&_!==e.value;function t(){window.requestAnimationFrame(()=>{let s=g.current;s.style.minHeight="auto";let c=s.scrollHeight;s.style.minHeight=`${c}px`})}return k(()=>{t()},[l]),a("textarea",{ref:g,className:M("DocTranslationsPage__Textarea",o&&"DocTranslationsPage__Textarea--hasChanges",!l&&"DocTranslationsPage__Textarea--empty"),onFocus:()=>t(),rows:1,onChange:s=>{let c=s.target.value;h(c),e.onChange(e.source,e.locale,c)},value:l})};export{u as DocTranslationsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as Be,j as Ae,k as Oe,l as q,n as Ve,o as Ue,p as We,q as $e,s as Fe}from"./chunk-4ALFT4ES.js";import"./chunk-WFQU7V3W.js";import"./chunk-XWX2622O.js";import"./chunk-SKQECSUR.js";import"./chunk-VJUMFJIX.js";import"./chunk-JBHRZ4EX.js";import"./chunk-3E6CASIN.js";import"./chunk-FBSBL476.js";import{a as je}from"./chunk-2RAVKX2Z.js";import"./chunk-HO3W4RVG.js";import"./chunk-2EPQJUGM.js";import{c as Ne}from"./chunk-NJMNOITA.js";import"./chunk-344GZOGG.js";import{b as qe}from"./chunk-W6LP22IK.js";import"./chunk-XMESZUC5.js";import"./chunk-ENQKSLGJ.js";import"./chunk-CAY5NM4Z.js";import"./chunk-MSYTAJBV.js";import"./chunk-Q7IU4QCY.js";import{b as Le,c as ae,g as ze}from"./chunk-YXSXWFLZ.js";import"./chunk-JTIQBW33.js";import"./chunk-PTPYMVFW.js";import"./chunk-2S5HMST6.js";import{a as R}from"./chunk-FJLNXXE3.js";import{a as se}from"./chunk-GT5EQSEX.js";import"./chunk-D3UIZHRK.js";import"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-AGFPVTBA.js";import"./chunk-YMBBWVBB.js";import{b as Te}from"./chunk-W5DOO6ID.js";import{a as Re}from"./chunk-NSOTG64N.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-BW2MKGNP.js";import"./chunk-KRNQ6L35.js";import{a as Xe}from"./chunk-P2Z66DHV.js";import{b as He}from"./chunk-WMICEDOT.js";import{a as Me}from"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import{e as I}from"./chunk-BUNR5EU3.js";import{Cc as Ie,Fa as T,Ga as e,Ia as pe,Oa as ge,P as me,Qa as oe,Sa as fe,Ua as ve,W as N,Wb as De,Xb as Ce,Xc as Ee,Yc as ne,Za as Pe,a as y,ba as he,c as b,da as X,e as P,g as B,h as C,j as te,pb as we,qb as xe,rb as be,rc as Se,sb as ke,vc as ye,za as _e}from"./chunk-LROR6N3B.js";import{d as O,j as ue,k as ot}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";te();te();async function Ke(t,n){let a=await(await fetch("/cms/api/check.test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({check:t,docId:n})})).json();if(!a.success)throw new Error(a.error||"Check failed.");return a.data}function Je(t){let n=window.__ROOT_CTX.checks||[],o=t.docId.split("/")[0],a=n.filter(s=>!s.collections||s.collections.includes(o)),[i,r]=y({}),c=C(async s=>{r(m=>({...m,[s]:{loading:!0}}));try{let m=await Ke(s,t.docId);r(h=>({...h,[s]:{loading:!1,result:m}}))}catch(m){r(h=>({...h,[s]:{loading:!1,error:m.message||"Unknown error."}}))}},[t.docId]),l=C(async()=>{let s={};for(let m of a)s[m.id]={loading:!0};r(s);for(let m of a)try{let h=await Ke(m.id,t.docId);r(_=>({..._,[m.id]:{loading:!1,result:h}}))}catch(h){r(_=>({..._,[m.id]:{loading:!1,error:h.message||"Unknown error."}}))}},[t.docId,a]);return e("div",{className:"ChecksPanel",children:[e("div",{className:"ChecksPanel__header",children:[e("div",{className:"ChecksPanel__header__title",children:"Checks"}),e(X,{variant:"default",size:"xs",compact:!0,leftIcon:e(Se,{size:12}),onClick:l,children:"Run All"})]}),e("div",{className:"ChecksPanel__body",children:e("div",{className:"ChecksPanel__checks",children:a.map(s=>{let m=i[s.id];return e(nt,{check:s,state:m,onRun:()=>c(s.id)},s.id)})})})]})}function nt(t){let{check:n,state:o,onRun:a}=t;return e("div",{className:"ChecksPanel__check",children:[e("div",{className:"ChecksPanel__check__header",children:[e("div",{className:"ChecksPanel__check__label",children:[n.label,o?.result&&e(rt,{status:o.result.status})]}),e(X,{className:"ChecksPanel__check__runButton",variant:"default",size:"xs",compact:!0,loading:o?.loading,onClick:a,children:"Run"})]}),n.description&&e("div",{className:"ChecksPanel__check__description",children:n.description}),o?.result&&e("div",{className:I("ChecksPanel__check__result",`ChecksPanel__check__result--${o.result.status}`),children:e(Ne,{code:o.result.message})}),o?.error&&e("div",{className:"ChecksPanel__check__error",children:o.error})]})}var at={success:"green",warning:"yellow",error:"red"},it={success:Pe,warning:pe,error:ne};function rt(t){let n=at[t.status],o=it[t.status],a=t.status.charAt(0).toUpperCase()+t.status.slice(1);return e(he,{className:"ChecksPanel__statusBadge",color:n,size:"sm",variant:"filled",leftSection:e(o,{size:10}),children:a})}function Ye(t){let{device:n,expandVertically:o,iframeUrl:a,localeOptions:i,selectedLocale:r,onToggleDevice:c,onToggleExpandVertically:l,onReloadClick:s,onOpenNewTab:m,onLocaleChange:h}=t;return e("div",{className:"DocumentPagePreviewBar",children:[e("div",{className:"DocumentPagePreviewBar__devices",children:[e(T,{label:"Mobile",children:e(N,{className:I("DocumentPagePreviewBar__device",n==="mobile"&&"active"),onClick:()=>c("mobile"),children:e(ke,{size:16})})}),e(T,{label:"Tablet",children:e(N,{className:I("DocumentPagePreviewBar__device",n==="tablet"&&"active"),onClick:()=>c("tablet"),children:e(be,{size:16})})}),e(T,{label:"Desktop",children:e(N,{className:I("DocumentPagePreviewBar__device",n==="desktop"&&"active"),onClick:()=>c("desktop"),children:e(we,{size:16})})}),e(T,{label:"Expand",children:e(N,{className:I("DocumentPagePreviewBar__device",o&&"active"),"aria-pressed":o,disabled:n==="",onClick:l,children:e(fe,{size:16})})})]}),e("div",{className:"DocumentPagePreviewBar__navbar",children:e("div",{className:"DocumentPagePreviewBar__navbar__url",children:a})}),e("div",{className:"DocumentPagePreviewBar__locales",children:e(_e,{data:i,placeholder:"Locale",radius:"xl",size:"xs",required:!0,icon:e(Ee,{size:16,strokeWidth:1.5}),value:r,onChange:_=>{h(_)}})}),e("div",{className:"DocumentPagePreviewBar__buttons",children:[e(T,{label:"Reload",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--reload",onClick:s,children:e(ye,{size:16})})}),e(T,{label:"Open new tab",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--openNewTab",onClick:m,children:e(oe,{size:16})})})]})]})}te();function Qe(t){let n=t.docId.split("/")[0],o=ze(n),a=q(),i=P(null),[r,c]=y(""),[l,s]=y([]),[m,h]=y(!1),_=P("");_.current=r;let v=P(o.schema?.fields||[]);v.current=o.schema?.fields||[];let D=P(o.schema?.types||{});D.current=o.schema?.types||{};let x=B(()=>Ae(u=>{let k=u.trim();if(!k){s([]),h(!1);return}let S=a.controller?.getData()?.fields||{},L=$e(k,S,v.current,D.current);s(L),h(!0)},150),[a.controller]);b(()=>{x(r)},[r,x]),Ve(()=>{_.current.trim()&&x(_.current)}),b(()=>{t.autoFocus&&requestAnimationFrame(()=>{i.current?.focus(),i.current?.select()})},[t.autoFocus]),b(()=>{let u=()=>{i.current?.focus(),i.current?.select()};return window.addEventListener("root:focus-search",u),()=>window.removeEventListener("root:focus-search",u)},[]);let g=u=>{lt(u)};return e("div",{className:"SearchPanel",children:[e("div",{className:"SearchPanel__header",children:[e("div",{className:"SearchPanel__header__title",children:"Search"}),t.onClose&&e(N,{size:"xs",onClick:t.onClose,title:"Close search",children:e(ne,{size:14})})]}),e("div",{className:"SearchPanel__searchInput",children:[e("span",{className:"SearchPanel__searchInput__icon",children:e(Ie,{size:14})}),e("input",{ref:i,type:"text",className:"SearchPanel__searchInput__input",value:r,onInput:u=>c(u.currentTarget.value),onKeyDown:u=>{u.key==="Escape"&&t.onClose&&(u.preventDefault(),t.onClose())},placeholder:"Search field values\u2026",autoComplete:"off",spellcheck:!1})]}),e("div",{className:"SearchPanel__body",children:[!m&&!r.trim()&&e("div",{className:"SearchPanel__empty",children:"Type a query above to search field values in this document."}),m&&l.length===0&&e("div",{className:"SearchPanel__empty",children:["No matches for ",e("strong",{children:r}),"."]}),l.length>0&&e(O,{children:[e("div",{className:"SearchPanel__resultsCount",children:[l.length," ",l.length===1?"match":"matches"]}),e("ul",{className:"SearchPanel__results",children:l.map((u,k)=>e(ct,{result:u,onClick:()=>g(u)},`${u.deepKey}:${k}`))})]})]})]})}function ct(t){let{result:n}=t;return e("li",{className:"SearchPanel__result",children:e("button",{type:"button",className:"SearchPanel__result__button",onClick:t.onClick,children:[e("div",{className:"SearchPanel__result__label",children:n.label}),e("div",{className:"SearchPanel__result__snippet",children:st(n.snippet,n.matches)}),e("div",{className:"SearchPanel__result__meta",children:[e("span",{className:"SearchPanel__result__type",children:n.fieldType}),n.richTextBlock&&e("span",{className:"SearchPanel__result__badge",children:"in block"}),n.richTextInline&&e("span",{className:"SearchPanel__result__badge",children:"inline"})]})]})})}function st(t,n){if(!n||n.length===0)return t;let o=[],a=0;for(let i of n)i.start>a&&o.push({text:t.slice(a,i.start),match:!1}),o.push({text:t.slice(i.start,i.end),match:!0}),a=i.end;return a<t.length&&o.push({text:t.slice(a),match:!1}),o.map((i,r)=>i.match?e("mark",{children:i.text},r):e("span",{children:i.text},r))}function lt(t){if(window.postMessage({scrollToDeeplink:{deepKey:t.deepKey}},"*"),t.richTextBlock){let n=t.richTextBlock;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Ue,{detail:n}))},350)}else if(t.richTextInline){let n=t.richTextInline;setTimeout(()=>{window.dispatchEvent(new CustomEvent(We,{detail:n}))},350)}}ot();te();var dt=ue(null);function K(t){let{className:n,localStorageId:o,children:a}=t,[i,r]=R(`root::SplitPanel:${o}`,350),[c,l]=y(!1),[s,m]=y(0),h=B(()=>new Set,[]),_=P(null),v=P(null),D={onResize:g=>(h.add(g),()=>{h.delete(g)})};if(b(()=>{let g=()=>l(!1);window.addEventListener("mouseup",g);let u=_.current;return u&&m(u.getBoundingClientRect().left),()=>window.removeEventListener("mouseup",g)},[]),b(()=>{let g=u=>{let k=u.clientX-s;r(k),h.forEach(S=>S())};return c&&window.addEventListener("mousemove",g),()=>window.removeEventListener("mousemove",g)},[c]),a?.length!==2)throw new Error("SplitPanel should have two <SplitPanel.Item> children.");let x={"--panel-size":`${i}px`};return e(dt.Provider,{value:D,children:e("div",{className:I(n,"SplitPanel",c&&"dragging"),ref:_,style:x,children:[a[0],e("div",{className:"SplitPanel__divider",ref:v,onMouseDown:()=>l(!0)}),a[1]]})})}K.Item=t=>e("div",{className:I("SplitPanel__item",t.className,t.fluid?"fluid":"static"),children:t.children});function le(t,n,o=""){let a=ae({collectionId:t,slug:n}),i=new URLSearchParams(window.location.search);i.set("preview","true"),i.delete("locale"),i.delete("modal");let r=`${i.toString()}${window.location.hash}`;return o?`${ae({collectionId:t,slug:n,locale:o})}?${r}`:`${a}?${r}`}function ut(t,n){let o=new URL(n,window.location.origin);try{let a=t.contentWindow?.location.href;if(a&&!a.startsWith("about:blank")){let i=new URL(a);i.origin===o.origin&&i.pathname===o.pathname&&(i.searchParams.forEach((r,c)=>{o.searchParams.set(c,r)}),o.hash=i.hash)}}catch{}return o.searchParams.set("preview","true"),o.toString()}function Ze(t){let n=t.collection,o=t.slug,a=`${n}/${o}`,{roles:i}=Re(),r=window.firebase.user.email||"",c=Te(i,r);return e(Oe,{docId:a,readOnly:!c,children:e(mt,{...t,canEdit:c})})}function mt(t){let n=t.canEdit,o=t.collection,a=t.slug,i=`${o}/${a}`;Xe(i);let r=window.__ROOT_CTX.collections[o],c=q(),l=!!r?.url,[s,m]=R(`root::DocumentPage::previewVisible::${o}`,l),h=B(()=>(window.__ROOT_CTX.checks||[]).some(f=>!f.collections||f.collections.includes(o)),[o]),[_,v]=R("root::DocumentPage::checksVisible",!1),D=P(_);D.current=_;let[x,g]=R("root::DocumentPage::searchVisible",!1),u=P(x);u.current=x;let k=Me(),[S,L]=R("root::DocumentPage::aiVisible",!1),M=P(S);M.current=S,b(()=>{window.dispatchEvent(new CustomEvent("root:checks-visible",{detail:_}))},[_]),b(()=>{window.dispatchEvent(new CustomEvent("root:search-visible",{detail:x}))},[x]),b(()=>{window.dispatchEvent(new CustomEvent("root:ai-visible",{detail:S}))},[S]);let[U,J]=R("root::DocumentPage::searchPanelWidth",360),[W,$]=y(U),[F,H]=y(!1),Y=P(null);if(b(()=>{let p=()=>{let f=!D.current;v(()=>f),f&&(g(()=>!1),L(()=>!1))};return window.addEventListener("root:toggle-checks",p),()=>window.removeEventListener("root:toggle-checks",p)},[]),b(()=>{let p=()=>{let f=!u.current;g(()=>f),f&&(v(()=>!1),L(()=>!1),requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("root:focus-search"))}))};return window.addEventListener("root:toggle-search",p),()=>window.removeEventListener("root:toggle-search",p)},[]),b(()=>{let p=()=>{let f=!M.current;L(()=>f),f&&(v(()=>!1),g(()=>!1))};return window.addEventListener("root:toggle-ai",p),()=>window.removeEventListener("root:toggle-ai",p)},[]),b(()=>{if(!F)return;let p=A=>{let V=Y.current;if(!V)return;let re=V.getBoundingClientRect(),ce=Math.max(240,Math.min(re.right-A.clientX,800));$(ce)},f=()=>{H(!1),$(A=>(J(()=>A),A))};return window.addEventListener("mousemove",p),window.addEventListener("mouseup",f),()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",f)}},[F]),!r)return e("div",{children:"Could not find collection."});let ie=C(()=>{if(!l)return;let p=le(o,a),f=window.open(p,"_blank","noopener,noreferrer");f&&f.focus()},[l,o,a]),Q=C(()=>{n&&c.controller&&c.controller.flush()},[n,c.controller]),G=Be(),j=C(()=>{let p=c.controller?.getData()?.fields||{};G.open({data:p,onSave:f=>{c.controller&&f&&typeof f=="object"&&(c.controller.updateKey("fields",f),c.controller.flush()),G.close()}})},[c.controller]),d=C(()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},[]),w=C(()=>{k&&window.dispatchEvent(new CustomEvent("root:toggle-ai"))},[k]),E=C(()=>{L(()=>!1)},[L]);return me([["mod+S",Q],["mod+shift+F",d],["mod+I",w]]),e(He,{children:e("div",{className:I("DocumentPage__layout",F&&"DocumentPage__layout--dragging"),ref:Y,children:[e(K,{className:"DocumentPage",localStorageId:"DocumentPage",children:[e(K.Item,{className:I("DocumentPage__side",(!l||!s)&&"DocumentPage__side--expanded"),children:[e("div",{className:"DocumentPage__side__header",children:[e("div",{className:"DocumentPage__side__header__nav",children:[e("a",{href:`/cms/content/${o}`,children:e(N,{className:"DocumentPage__side__header__back",children:e(ge,{size:16})})}),e("div",{className:"DocumentPage__side__header__docId",children:i})]}),e("div",{className:"DocumentPage__side__header__buttons",children:[e(se,{label:"You don't have access to edit this document",condition:!n,children:e(X,{className:"DocumentPage__side__header__saveButton",variant:"filled",color:"dark",size:"xs",compact:!0,leftIcon:e(xe,{size:16}),onClick:()=>Q(),disabled:!n,children:"Save"})}),e(se,{label:"You don't have access to edit this document",condition:!n,children:e(T,{label:"Edit JSON",disabled:!n,children:e(N,{className:"DocumentPage__side__header__editJson",onClick:()=>j(),disabled:!n,children:e(ve,{size:14})})})}),l&&e(O,{children:[e(T,{label:s?"Hide preview":"Show preview",children:e(N,{className:"DocumentPage__side__header__previewToggle",onClick:()=>m(!s),children:s?e(De,{size:16}):e(Ce,{size:16})})}),!s&&e(T,{label:"Open preview in new tab",children:e(N,{className:"DocumentPage__side__header__openNewTab",onClick:ie,children:e(oe,{size:16})})})]})]})]}),e("div",{className:I("DocumentPage__side__editor",(!l||!s)&&!_&&!x&&!S&&"DocumentPage__side__editor--centered"),children:e(Fe,{docId:i})})]}),e(K.Item,{className:I("DocumentPage__main",(!l||!s)&&"DocumentPage__main--hidden"),fluid:!0,children:l&&s&&e(Ze.Preview,{docId:i},i)})]}),h&&_&&e(_t,{docId:i}),x&&e(O,{children:[e("div",{className:"DocumentPage__searchDivider",onMouseDown:()=>H(!0)}),e("div",{className:"DocumentPage__search",style:{flexBasis:`${W}px`},children:e(Qe,{docId:i,autoFocus:!0,onClose:()=>g(()=>!1)})})]}),k&&S&&e(ht,{docId:i,onClose:E})]})})}function ht(t){let[n,o]=R("root::DocumentPage::aiPanelWidth",420),[a,i]=y(n),r=P(null),c=P(a),l=P(),s=B(()=>e(je,{variant:"panel",docContext:{docId:t.docId},onClose:t.onClose}),[t.docId,t.onClose]),m=C(()=>{let h=r.current?.parentElement;if(!h)return;c.current=a,h.classList.add("DocumentPage__layout--dragging");let _=x=>{let g=r.current?.parentElement;if(!g)return;let u=g.getBoundingClientRect(),k=Math.max(280,Math.min(u.right-x.clientX,800));c.current=k,i(k)},v=()=>{h.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",D),l.current=void 0},D=()=>{v(),o(()=>c.current)};l.current=v,window.addEventListener("mousemove",_),window.addEventListener("mouseup",D)},[a,o]);return b(()=>()=>l.current?.(),[]),e(O,{children:[e("div",{className:"DocumentPage__aiDivider",ref:r,onMouseDown:m}),e("div",{className:"DocumentPage__ai",style:{flexBasis:`${a}px`},children:s})]})}function _t(t){let[n,o]=R("root::DocumentPage::checksPanelWidth",360),[a,i]=y(n),r=P(null),c=P(a),l=P(),s=B(()=>e(Je,{docId:t.docId}),[t.docId]),m=C(()=>{let h=r.current?.parentElement;if(!h)return;c.current=a,h.classList.add("DocumentPage__layout--dragging");let _=x=>{let g=r.current?.parentElement;if(!g)return;let u=g.getBoundingClientRect(),k=Math.max(200,Math.min(u.right-x.clientX,800));c.current=k,i(k)},v=()=>{h.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",D),l.current=void 0},D=()=>{v(),o(()=>c.current)};l.current=v,window.addEventListener("mousemove",_),window.addEventListener("mouseup",D)},[a,o]);return b(()=>()=>l.current?.(),[]),e(O,{children:[e("div",{className:"DocumentPage__checksDivider",ref:r,onMouseDown:m}),e("div",{className:"DocumentPage__checks",style:{flexBasis:`${a}px`},children:s})]})}var Ge={mobile:[430,932],tablet:[768,1024],desktop:[1440,800]};function pt(t){let n=new Intl.DisplayNames(["en"],{type:"language"}),a=t.split("_")[0];return`${n.of(a)||t} (${t})`}Ze.Preview=t=>{let n=q();if(n.loading)return null;let[o,a]=t.docId.split("/"),r=window.__ROOT_CTX.collections[o];if(!r)throw new Error(`collection not found: ${o}`);if(!r.url)return null;let c=r.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",l=Le({collectionId:o,slug:a}),s=ae({collectionId:o,slug:a}),m=`${c}${l}`,[h,_]=y(m),[v,D]=R("root::DocumentPage::preview::device",""),[x,g]=R("root::DocumentPage::preview::expandVertically",!1),[u,k]=y({"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"}),[S,L]=qe("locale",""),M=P(null),U=P(null),J=n.controller.getLocales()||[],W=le(o,a,S),$=P(W);$.current=W;let F=B(()=>[{value:"",label:"Select locale"},...J.map(d=>({value:d,label:pt(d)}))],[J]);function H(){if(document.hidden)return;let d=M.current,w=ut(d,$.current);d.src="about:blank",window.requestAnimationFrame(()=>{d.src!==w?d.src=w:d.contentWindow.location.reload()})}b(()=>{let d=M.current;function w(){let p=d.contentWindow;if(p&&s===l&&!p.location.href.startsWith("about:blank")){let f=p.location;_(`${c}${f.pathname}`)}}d.addEventListener("load",w);let E=n.controller?.onFlush(()=>{H()});return()=>{E(),d.removeEventListener("load",w)}},[]),b(()=>{let d=M.current;d.src=W},[S]);let Y=C(d=>{D(w=>{let E=w===d?"":d;return E===""&&g(!1),E})},[D,g]),ie=C(()=>{D(d=>(d&&g(w=>!w),d))},[D,g]),Q=C(()=>{n.controller&&n.controller.flush().then(()=>H())},[n.controller]),G=C(()=>{let d=le(o,a,S),w=window.open(d,"_blank","noopener,noreferrer");w&&w.focus()},[o,a,S]),j=C(()=>{if(v===""){let z={"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"};k(ee=>ee["--iframe-width"]===z["--iframe-width"]&&ee["--iframe-height"]===z["--iframe-height"]&&ee["--iframe-scale"]===z["--iframe-scale"]?ee:z);return}let d=U.current;if(!d)return;let w=d.getBoundingClientRect(),[E,p]=Ge[v],f=20,A=Math.max(w.width-2*f,0),V=Math.max(w.height-2*f,0),re=A>0&&E>0?A/E:1,ce=V>0&&p>0?V/p:1,et=Math.min(re,ce,1),de=Number(et.toFixed(4))||1,tt=x?`${Math.max(V-28,0)/de}px`:`${p}px`,Z={"--iframe-width":`${E}px`,"--iframe-height":tt,"--iframe-scale":String(de)};k(z=>z["--iframe-width"]===Z["--iframe-width"]&&z["--iframe-height"]===Z["--iframe-height"]&&z["--iframe-scale"]===Z["--iframe-scale"]?z:Z)},[v,x]);return b(()=>{j();let d=U.current;if(!d)return;let w=0,E=()=>{window.cancelAnimationFrame(w),w=window.requestAnimationFrame(j)},p=new window.ResizeObserver(E);return p.observe(d),window.addEventListener("resize",E),()=>{window.cancelAnimationFrame(w),p.disconnect(),window.removeEventListener("resize",E)}},[j]),e("div",{className:"DocumentPage__main__preview",children:[e(Ye,{device:v,expandVertically:x,iframeUrl:h,localeOptions:F,selectedLocale:S,onToggleDevice:Y,onToggleExpandVertically:ie,onReloadClick:Q,onOpenNewTab:G,onLocaleChange:L}),e("div",{className:"DocumentPage__main__previewFrame","data-device":v||"full",ref:U,style:u,children:[e("div",{className:"DocumentPage__main__previewFrame__deviceLabel",style:{display:v?void 0:"none"},children:v?`${v}: ${Ge[v].join("x")}`:""}),e("div",{className:"DocumentPage__main__previewFrame__iframeWrap",children:e("iframe",{ref:M,title:"iframe preview"})})]})]})};export{Ze as DocumentPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as H}from"./chunk-
|
|
1
|
+
import{a as H}from"./chunk-TVYAZN2Q.js";import"./chunk-3E6CASIN.js";import{a as B}from"./chunk-MSYTAJBV.js";import{a as F}from"./chunk-TOGLZDK3.js";import{a as _}from"./chunk-GT5EQSEX.js";import{c as u,f as A,g as E,j as T,l as z}from"./chunk-D3UIZHRK.js";import{a as w,c as p}from"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import{a as N}from"./chunk-W5DOO6ID.js";import{a as M}from"./chunk-NSOTG64N.js";import"./chunk-J5E457OI.js";import{a as s,b as r}from"./chunk-QHJOTXYB.js";import{a as m}from"./chunk-BW2MKGNP.js";import"./chunk-KRNQ6L35.js";import{a as L}from"./chunk-P2Z66DHV.js";import{b as O}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import{d as y}from"./chunk-BUNR5EU3.js";import{$c as $,Fa as n,Ga as e,La as I,W as l,a as D,c as x,ca as P,ib as k,j as K,wc as U}from"./chunk-LROR6N3B.js";import{d as S}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";K();function ve(a){L(`Edit Data Source: ${a.id}`);let{route:b}=y(),[v,h]=D(null),i=w(),f=p(),{roles:g}=M(),R=window.firebase.user.email||"",t=N(g,R);x(()=>{u(a.id).then(o=>{h(o)})},[a.id]);function W(){let o=`delete-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Delete data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete data source ",e("code",{children:a.id}),"? All previously synced data will be deleted. There is no undo."]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Deleting data source",message:`Deleting ${a.id} and synced data...`,loading:!0,autoClose:!1}),await z(a.id),r({id:o,title:"Deleted data source",message:`Successfully deleted ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d),b("/cms/data")}})}function Y(){let o=`archive-data-source-${a.id}`,d=!!v?.publishedAt,c=i.openConfirmModal({...f,title:"Archive data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive data source ",e("code",{children:a.id}),"? Archived data sources cannot be synced or published.",d&&e(S,{children:[" ","Note: previously published data will remain available until the data source is unpublished."]})]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Archiving data source",message:`Archiving ${a.id}...`,loading:!0,autoClose:!1}),await A(a.id);let J=await u(a.id);h(J),r({id:o,title:"Archived data source",message:`Successfully archived ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(c),b("/cms/data")}})}function j(){let o=`unarchive-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Unarchive data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive data source ",e("code",{children:a.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Unarchiving data source",message:`Unarchiving ${a.id}...`,loading:!0,autoClose:!1}),await E(a.id);let c=await u(a.id);h(c),r({id:o,title:"Unarchived data source",message:`Successfully unarchived ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d),b(`/cms/data/${a.id}`)}})}function q(){let o=`unpublish-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Unpublish data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unpublish data source ",e("code",{children:a.id}),"? The published data will be removed and will no longer be available to production. There is no undo."]}),labels:{confirm:"Unpublish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Unpublishing data source",message:`Unpublishing ${a.id}...`,loading:!0,autoClose:!1}),await T(a.id);let c=await u(a.id);h(c),r({id:o,title:"Unpublished data source",message:`Successfully unpublished ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d)}})}let G=!!v?.publishedAt,C=!!v?.archivedAt;return e(O,{children:e("div",{className:"EditDataSourcePage",children:[e("div",{className:"EditDataSourcePage__header",children:[e(P,{className:"EditDataSourcePage__header__breadcrumbs",children:[e("a",{href:"/cms/data",children:"Data Sources"}),e("a",{href:`/cms/data/${a.id}`,children:a.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditDataSourcePage__header__titleWrap",children:[e(B,{size:"h1",children:["Edit Data Source: ",a.id]}),e("div",{className:"EditDataSourcePage__header__controls",children:[G&&!C&&e(_,{label:"You don't have access to unpublish data sources",condition:!t,children:e(n,{label:"Unpublish",disabled:!t,children:e(l,{onClick:q,loading:!g,disabled:!t,children:e(k,{size:20,stroke:"1.5"})})})}),e(_,{label:"You don't have access to archive data sources",condition:!t,children:C?e(n,{label:"Unarchive",disabled:!t,children:e(l,{onClick:j,loading:!g,disabled:!t,children:e(U,{size:20,stroke:"1.5"})})}):e(n,{label:"Archive",disabled:!t,children:e(l,{onClick:Y,loading:!g,disabled:!t,children:e(I,{size:20,stroke:"1.5"})})})}),e(n,{label:"Delete",children:e(l,{onClick:W,children:e($,{size:20,stroke:"1.5"})})})]})]})]}),e(F,{className:"EditDataSourcePage__form",children:e(H,{dataSourceId:a.id})})]})})}export{ve as EditDataSourcePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-SENZVSVZ.js";import"./chunk-N3JSLTMV.js";import"./chunk-XWX2622O.js";import{a as z}from"./chunk-MSYTAJBV.js";import"./chunk-YXSXWFLZ.js";import"./chunk-JTIQBW33.js";import"./chunk-PTPYMVFW.js";import{d as s,f as E,g as w}from"./chunk-2S5HMST6.js";import"./chunk-FJLNXXE3.js";import{a as I}from"./chunk-GT5EQSEX.js";import"./chunk-D3UIZHRK.js";import{a as x,c as P}from"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-AGFPVTBA.js";import"./chunk-YMBBWVBB.js";import{a as T}from"./chunk-W5DOO6ID.js";import{a as A}from"./chunk-NSOTG64N.js";import"./chunk-J5E457OI.js";import{a as h,b as f}from"./chunk-QHJOTXYB.js";import{a as g}from"./chunk-BW2MKGNP.js";import"./chunk-KRNQ6L35.js";import{a as U}from"./chunk-P2Z66DHV.js";import{b as $}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import{d as C}from"./chunk-BUNR5EU3.js";import{Fa as m,Ga as e,La as y,W as c,a as v,c as R,ca as b,j as B,wc as p}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function se(i){U(`Edit Release: ${i.id}`);let{route:u}=C(),[N,t]=v(null),l=x(),_=P(),{roles:d}=A(),M=window.firebase.user.email||"",o=T(d,M);R(()=>{s(i.id).then(a=>{t(a)})},[i.id]);function L(){let a=`archive-release-${i.id}`,n=l.openConfirmModal({..._,title:"Archive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive release ",e("code",{children:i.id}),"?"]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:a,title:"Archiving release",message:`Archiving ${i.id}...`,loading:!0,autoClose:!1}),await E(i.id);let r=await s(i.id);t(r),f({id:a,title:"Archived release",message:`Successfully archived ${i.id}`,loading:!1,autoClose:5e3}),l.closeModal(n),u("/cms/releases")}})}function S(){let a=`unarchive-release-${i.id}`,n=l.openConfirmModal({..._,title:"Unarchive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive release ",e("code",{children:i.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:a,title:"Unarchiving release",message:`Unarchiving ${i.id}...`,loading:!0,autoClose:!1}),await w(i.id);let r=await s(i.id);t(r),f({id:a,title:"Unarchived release",message:`Successfully unarchived ${i.id}`,loading:!1,autoClose:5e3}),l.closeModal(n),u(`/cms/releases/${i.id}`)}})}return e($,{children:e("div",{className:"EditReleasePage",children:[e("div",{className:"EditReleasePage__header",children:[e(b,{className:"EditReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("a",{href:`/cms/releases/${i.id}`,children:i.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditReleasePage__header__titleWrap",children:[e(z,{size:"h1",children:["Edit Release: ",i.id]}),e("div",{className:"EditReleasePage__header__controls",children:e(I,{label:"You don't have access to archive releases",condition:!o,children:N?.archivedAt?e(m,{label:"Unarchive",disabled:!o,children:e(c,{onClick:S,loading:!d,disabled:!o,children:e(p,{size:20,stroke:"1.5"})})}):e(m,{label:"Archive",disabled:!o,children:e(c,{onClick:L,loading:!d,disabled:!o,children:e(y,{size:20,stroke:"1.5"})})})})})]})]}),e(k,{releaseId:i.id})]})})}export{se as EditReleasePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n}from"./chunk-FBSBL476.js";import{a}from"./chunk-
|
|
1
|
+
import{b as n}from"./chunk-FBSBL476.js";import{a}from"./chunk-2RAVKX2Z.js";import"./chunk-HO3W4RVG.js";import"./chunk-2EPQJUGM.js";import"./chunk-NJMNOITA.js";import"./chunk-344GZOGG.js";import{b as i}from"./chunk-W6LP22IK.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{a as f}from"./chunk-P2Z66DHV.js";import"./chunk-VD6G5NV4.js";import"./chunk-BUNR5EU3.js";import{Ga as o,c as r,e as t,j as m}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";m();function v(){f("Root AI");let[e]=i("docId"),d=t(!1);return r(()=>{d.current||(d.current=!0,n({type:"ready",docId:e||void 0}))},[e]),o("div",{className:"EmbeddedAIPage",children:o(a,{variant:"panel",docContext:e?{docId:e}:void 0})})}export{v as EmbeddedAIPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as E,l as P,m as h,s as S}from"./chunk-4ALFT4ES.js";import"./chunk-WFQU7V3W.js";import"./chunk-XWX2622O.js";import"./chunk-SKQECSUR.js";import"./chunk-VJUMFJIX.js";import"./chunk-JBHRZ4EX.js";import"./chunk-3E6CASIN.js";import{b as s}from"./chunk-FBSBL476.js";import"./chunk-HO3W4RVG.js";import"./chunk-2EPQJUGM.js";import"./chunk-NJMNOITA.js";import"./chunk-344GZOGG.js";import"./chunk-XMESZUC5.js";import"./chunk-ENQKSLGJ.js";import"./chunk-CAY5NM4Z.js";import"./chunk-MSYTAJBV.js";import"./chunk-Q7IU4QCY.js";import"./chunk-YXSXWFLZ.js";import"./chunk-JTIQBW33.js";import"./chunk-PTPYMVFW.js";import"./chunk-2S5HMST6.js";import"./chunk-FJLNXXE3.js";import"./chunk-GT5EQSEX.js";import"./chunk-D3UIZHRK.js";import"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-AGFPVTBA.js";import"./chunk-YMBBWVBB.js";import{b as p}from"./chunk-W5DOO6ID.js";import{a as D}from"./chunk-NSOTG64N.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-BW2MKGNP.js";import"./chunk-KRNQ6L35.js";import{a as x}from"./chunk-P2Z66DHV.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import{e as _}from"./chunk-BUNR5EU3.js";import{Ga as t,a as v,c as m,da as f,e as u,j as B,qb as b}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function H(e){let o=`${e.collection}/${e.slug}`,{roles:d}=D(),a=window.firebase.user.email||"",n=p(d,a);return t(E,{docId:o,readOnly:!n,autoSave:!1,flushOnStop:!1,children:t(w,{...e,canEdit:n})})}function I(e){return e&&typeof e.toMillis=="function"?e.toMillis():0}function w(e){let o=`${e.collection}/${e.slug}`;x(o);let d=P(),a=d.controller,n=d.loading,[r,y]=v("NO_CHANGES");h(y);let g=u(!1);m(()=>{n||g.current||(g.current=!0,s({type:"ready",docId:o}))},[n,o]);let c=u(0);return m(()=>{let N=[a.onFlush(()=>{s({type:"saved",docId:o,saveState:"SAVED"})}),a.onChange(l=>{let i=I(l?.sys?.publishedAt);if(c.current===0){c.current=i;return}i>c.current&&(c.current=i,s({type:"published",docId:o,publishedAt:i}))})];return()=>N.forEach(l=>l())},[a,o]),t("div",{className:"EmbeddedDocumentPage",children:[e.canEdit&&!n&&t("div",{className:"EmbeddedDocumentPage__saveBar",children:[t(f,{component:"a",className:"EmbeddedDocumentPage__saveBar__docId",href:`/cms/content/${e.collection}/${e.slug}`,target:"_blank",rel:"noreferrer noopener",title:"Open in new tab",compact:!0,size:"xs",variant:"default",children:o}),t("div",{className:"EmbeddedDocumentPage__saveBar__controls",children:[t("div",{className:"EmbeddedDocumentPage__saveBar__saveState",children:[r==="UPDATE_PENDING"&&"unsaved changes",r==="SAVED"&&"saved!",r==="ERROR"&&"error saving"]}),t(f,{color:"dark",compact:!0,size:"xs",leftIcon:t(b,{size:16}),loading:r==="SAVING",disabled:r!=="UPDATE_PENDING"&&r!=="ERROR",onClick:()=>a.flush(),children:"Save"})]})]}),t("div",{className:_("EmbeddedDocumentPage__editor","DocumentPage__side"),children:t(S,{docId:o,hideStatusBar:!0})})]})}export{H as EmbeddedDocumentPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-NWHGT476.js";import"./chunk-ENQKSLGJ.js";import"./chunk-CAY5NM4Z.js";import{a}from"./chunk-MSYTAJBV.js";import"./chunk-TOGLZDK3.js";import"./chunk-JS6TK4OP.js";import"./chunk-KRNQ6L35.js";import{a as i}from"./chunk-P2Z66DHV.js";import{b as g}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import"./chunk-BUNR5EU3.js";import{Ga as o}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function L(){return i("Action Logs"),o(g,{children:o("div",{className:"LogsPage",children:[o("div",{className:"LogsPage__header",children:o(a,{size:"h1",children:"Action Logs"})}),o(e,{})]})})}export{L as LogsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-TVYAZN2Q.js";import"./chunk-3E6CASIN.js";import{a as r}from"./chunk-MSYTAJBV.js";import"./chunk-D3UIZHRK.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-KRNQ6L35.js";import{a as o}from"./chunk-P2Z66DHV.js";import{b as t}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import"./chunk-BUNR5EU3.js";import{Ga as a,ca as e}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function n(){return o("New Data Source"),a(t,{children:a("div",{className:"NewDataSourcePage",children:[a("div",{className:"NewDataSourcePage__header",children:[a(e,{className:"NewDataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data Sources"}),a("div",{children:"New"})]}),a(r,{size:"h1",children:"Add Data Source"})]}),a(d,{buttonLabel:"Create data source"})]})})}export{n as NewDataSourcePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as m}from"./chunk-SENZVSVZ.js";import"./chunk-N3JSLTMV.js";import"./chunk-XWX2622O.js";import{a as r}from"./chunk-MSYTAJBV.js";import"./chunk-YXSXWFLZ.js";import"./chunk-JTIQBW33.js";import"./chunk-PTPYMVFW.js";import"./chunk-2S5HMST6.js";import"./chunk-FJLNXXE3.js";import"./chunk-GT5EQSEX.js";import"./chunk-D3UIZHRK.js";import"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-AGFPVTBA.js";import"./chunk-YMBBWVBB.js";import"./chunk-W5DOO6ID.js";import"./chunk-NSOTG64N.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-BW2MKGNP.js";import"./chunk-KRNQ6L35.js";import{a as d}from"./chunk-P2Z66DHV.js";import{b as s}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import"./chunk-BUNR5EU3.js";import{Ga as e,ca as a}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function w(){return d("New Release"),e(s,{children:e("div",{className:"NewReleasePage",children:[e("div",{className:"NewReleasePage__header",children:[e(a,{className:"NewReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:"New"})]}),e(r,{size:"h1",children:"Add Release"})]}),e(m,{buttonLabel:"Create release"})]})})}export{w as NewReleasePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-P2Z66DHV.js";import{b as e}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-BUNR5EU3.js";import{Ga as o,jc as t}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";function l(){return n("Not Found"),o(e,{children:o("div",{className:"NotFoundPage",children:[o("div",{className:"NotFoundPage__icon",children:o(t,{size:60})}),o("h2",{className:"NotFoundPage__title",children:"Not Found"}),o("p",{className:"NotFoundPage__body",children:["Double-check the URL and try again or ",o("a",{href:"/cms",children:"go home"}),"."]})]})})}export{l as NotFoundPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s}from"./chunk-QF3GPZTI.js";import"./chunk-4ISFTE2G.js";import{a as l}from"./chunk-NWHGT476.js";import"./chunk-ENQKSLGJ.js";import"./chunk-CAY5NM4Z.js";import{a as n}from"./chunk-4FGASIIX.js";import{a as r}from"./chunk-TOGLZDK3.js";import"./chunk-FJLNXXE3.js";import"./chunk-JS6TK4OP.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-KRNQ6L35.js";import{a as c}from"./chunk-P2Z66DHV.js";import{b as a}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import"./chunk-BUNR5EU3.js";import{Ga as e,da as i}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function o(){c("Home");let t=!!window.__ROOT_CTX.experiments?.taskManager;return e(a,{children:e("div",{className:"ProjectPage",children:e("div",{className:"ProjectPage__main",children:[t&&e(s,{}),e("div",{className:"ProjectPage__section",children:[e(o.Collections,{}),e(o.ActionLogs,{})]})]})})})}o.SectionTitle=t=>e("div",{className:"ProjectPage__sectionTitle",children:t.children});o.Collections=()=>{let t=window.__ROOT_CTX.collections,d=window.__ROOT_CTX.rootConfig.projectId;return e("div",{className:"ProjectPage__collections",children:e(n,{collections:t,projectId:d})})};o.ActionLogs=()=>e("div",{className:"ProjectPage__actionLogs",children:[e("div",{className:"ProjectPage__actionLogs__header",children:[e(o.SectionTitle,{children:"Recent actions"}),e(i,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/logs",children:"Show all"})]}),e(r,{children:e(l,{limit:10,compact:!0})})]});export{o as ProjectPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-UUVAD4U4.js";import{a as j}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-UUVAD4U4.js";import{a as j}from"./chunk-RHAJNURN.js";import{c as Y}from"./chunk-NJMNOITA.js";import{a as m}from"./chunk-MSYTAJBV.js";import{a as S}from"./chunk-TOGLZDK3.js";import{f as M}from"./chunk-PTPYMVFW.js";import{d as $,h as B,k as E}from"./chunk-2S5HMST6.js";import{a as f}from"./chunk-GT5EQSEX.js";import"./chunk-D3UIZHRK.js";import{a as T,c as k}from"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-5MV6XVGA.js";import"./chunk-AGFPVTBA.js";import"./chunk-YMBBWVBB.js";import{a as W}from"./chunk-W5DOO6ID.js";import{a as U}from"./chunk-NSOTG64N.js";import{b as v}from"./chunk-J5E457OI.js";import{a as x,b as I}from"./chunk-QHJOTXYB.js";import{a as O}from"./chunk-BW2MKGNP.js";import{c as z}from"./chunk-KRNQ6L35.js";import{a as F}from"./chunk-P2Z66DHV.js";import{b as q}from"./chunk-WMICEDOT.js";import"./chunk-AAHM6RYJ.js";import"./chunk-VD6G5NV4.js";import"./chunk-BUNR5EU3.js";import{Da as N,Fa as u,Fc as H,Ga as e,V as C,W as D,a as c,c as w,ca as A,da as r,j as V}from"./chunk-LROR6N3B.js";import{d as L}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";V();function d(t){let[o,i]=c(!0),[a,s]=c(null),[_,h]=c(0),l=t.id;F(`Release: ${l}`);async function p(){i(!0),await v(async()=>{let n=await $(l);s(n),h(z())}),i(!1)}w(()=>{p()},[]);function P(n){console.log("onAction()",n),p()}return e(q,{children:e("div",{className:"ReleasePage",children:[e("div",{className:"ReleasePage__header",children:[e(A,{className:"ReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:l})]}),e("div",{className:"ReleasePage__header__titleWrap",children:[e(m,{size:"h1",children:["Release: ",l]}),e("div",{className:"ReleasePage__header__controls",children:e(u,{label:"Configure",children:e(D,{component:"a",href:`/cms/releases/${t.id}/edit`,children:e(H,{size:24,stroke:"1.5"})})})})]}),a?.description&&e(Y,{className:"ReleasePage__header__description",code:a.description})]}),o?e(C,{color:"gray",size:"xl"}):e(L,{children:[a&&e(d.PublishStatus,{release:a,onAction:P}),a&&a.docIds&&a.docIds.length>0&&e(d.DocsList,{release:a},`docs-list-${_}`),a&&a.dataSourceIds&&a.dataSourceIds.length>0&&e(d.DataSourcesList,{release:a},`data-sources-${_}`)]})]})})}d.PublishStatus=t=>{let{roles:o}=U(),i=window.firebase.user.email||"",a=W(o,i),s=t.release,[_,h]=c(!1),l=T(),p=k(),P=j({releaseId:s.id,onScheduled:()=>{t.onAction("scheduled")}});function n(){let g=s.docIds||[],R=s.dataSourceIds||[],b=g.length+R.length;if(b===0){x({title:"Cannot publish release",message:"Error: nothing in the release to publish.",color:"red",autoClose:!1});return}l.openConfirmModal({...p,title:`Publish release: ${s.id}`,children:e(O,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to publish this release? The ",b," items in the release will go live immediately."]}),labels:{confirm:"Publish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{J()}})}async function J(){h(!0),await v(async()=>{let g=`publish-release-${s.id}`,R=s.docIds?.length||0,b=s.dataSourceIds?.length||0,y=R+b;x({id:g,title:"Publishing release",message:`Publishing ${y} items...`,loading:!0,autoClose:!1}),await B(s.id),I({id:g,title:"Published release!",message:`Successfully published ${y} items!`,loading:!1,autoClose:5e3}),t.onAction&&t.onAction("publish")}),h(!1)}function K(){P.open()}async function Q(){await E(s.id),t.onAction("cancel-schedule")}return e("div",{className:"ReleasePage__PublishStatus",children:[e(m,{size:"h2",children:"Status"}),e(S,{children:e(N,{className:"ReleasePage__PublishStatus__table",verticalSpacing:"xs",striped:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"status"}),e("th",{children:"actions"})]})}),e("tbody",{children:e("tr",{children:[e("td",{children:e(G,{release:s})}),e("td",{children:e("div",{className:"ReleasePage__PublishStatus__actions",children:[!s.archivedAt&&!s.scheduledAt&&e(f,{label:"You don't have access to publish this release",condition:!a,children:e(u,{label:"Publish the release immediately",position:"bottom",withArrow:!0,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>n(),loading:_,disabled:!a,children:s.publishedAt?"Re-publish":"Publish"})})}),!s.archivedAt&&(s.scheduledAt?e(f,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(u,{label:"Cancel the scheduled release",position:"bottom",withArrow:!0,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>Q(),disabled:!a,children:"Cancel Schedule"})})}):e(f,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(u,{label:"Schedule the release to be published at a future date",position:"bottom",withArrow:!0,wrapLines:!0,width:180,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>K(),disabled:!a,children:"Schedule"})})}))]})})]})})]})})]})};d.DocsList=t=>{let o=t.release,i=o.docIds||[];return e("div",{className:"ReleasePage__DocsList",children:[e("div",{className:"ReleasePage__DocsList__header",children:[e(m,{size:"h2",children:"Docs"}),e(r,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${o.id}/edit`,children:"Edit"})]}),e(S,{className:"ReleasePage__DocsList__cards",children:i.map(a=>e("div",{className:"ReleasePage__DocsList__card",children:e("a",{href:`/cms/content/${a}`,children:e(M,{docId:a,statusBadges:!0,hideReleases:!0})})},a))})]})};d.DataSourcesList=t=>{let o=t.release,i=o.dataSourceIds||[];return e("div",{className:"ReleasePage__DataSourcesList",children:[e("div",{className:"ReleasePage__DataSourcesList__header",children:[e(m,{size:"h2",children:"Data Sources"}),e(r,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${o.id}/edit`,children:"Edit"})]}),e("div",{className:"ReleasePage__DataSourcesList__items",children:i.map(a=>e("div",{className:"ReleasePage__DataSourcesList__item",children:e("a",{href:`/cms/data/${a}`,children:a})},a))})]})};export{d as ReleasePage};
|