@abpjs/text-template-management 2.7.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.
package/dist/index.mjs ADDED
@@ -0,0 +1,794 @@
1
+ // src/enums/components.ts
2
+ var eTextTemplateManagementComponents = {
3
+ /**
4
+ * Key for the TextTemplates component.
5
+ * Use this to replace the default TextTemplates list with a custom implementation.
6
+ */
7
+ TextTemplates: "TextTemplateManagement.TextTemplates",
8
+ /**
9
+ * Key for the TemplateContents component.
10
+ * Use this to replace the default template content editor.
11
+ */
12
+ TemplateContents: "TextTemplateManagement.TemplateContents",
13
+ /**
14
+ * Key for the InlineTemplateContent component.
15
+ * Use this to replace the inline template content editor.
16
+ */
17
+ InlineTemplateContent: "TextTemplateManagement.InlineTemplateContent"
18
+ };
19
+
20
+ // src/enums/route-names.ts
21
+ var eTextTemplateManagementRouteNames = {
22
+ /**
23
+ * Administration route name key.
24
+ * Used for the administration menu group.
25
+ */
26
+ Administration: "AbpUiNavigation::Menu:Administration",
27
+ /**
28
+ * Text Templates route name key.
29
+ * Used for the text templates management route.
30
+ */
31
+ TextTemplates: "TextTemplateManagement::Menu:TextTemplates"
32
+ };
33
+
34
+ // src/constants/routes.ts
35
+ var TEXT_TEMPLATE_MANAGEMENT_ROUTES = {
36
+ routes: [
37
+ {
38
+ name: "TextTemplateManagement::Menu:TextTemplates",
39
+ path: "text-template-management",
40
+ layout: "application",
41
+ order: 100,
42
+ parentName: "AbpUiNavigation::Menu:Administration"
43
+ }
44
+ ]
45
+ };
46
+
47
+ // src/services/template-definition.service.ts
48
+ var TemplateDefinitionService = class {
49
+ constructor(restService) {
50
+ this.restService = restService;
51
+ /**
52
+ * API name for multi-API configurations
53
+ * @since 2.7.0
54
+ */
55
+ this.apiName = "default";
56
+ }
57
+ /**
58
+ * Get list of template definitions
59
+ * @param params Query parameters for filtering and pagination
60
+ * @returns Promise with list of template definitions
61
+ */
62
+ async getList(params = {}) {
63
+ return this.restService.request({
64
+ method: "GET",
65
+ url: "/api/text-template-management/template-definitions",
66
+ params
67
+ });
68
+ }
69
+ };
70
+
71
+ // src/services/template-content.service.ts
72
+ var TemplateContentService = class {
73
+ constructor(restService) {
74
+ this.restService = restService;
75
+ /**
76
+ * API name for multi-API configurations
77
+ * @since 2.7.0
78
+ */
79
+ this.apiName = "default";
80
+ }
81
+ /**
82
+ * Get template content by input parameters
83
+ * @param params Input parameters containing template name and optional culture name
84
+ * @returns Promise with template content
85
+ */
86
+ async getByInput(params) {
87
+ return this.restService.request({
88
+ method: "GET",
89
+ url: "/api/text-template-management/template-contents",
90
+ params
91
+ });
92
+ }
93
+ /**
94
+ * Restore template content to default
95
+ * @param body Input containing template name and culture name to restore
96
+ * @returns Promise that resolves when restore is complete
97
+ */
98
+ async restoreToDefaultByInput(body) {
99
+ return this.restService.request({
100
+ method: "PUT",
101
+ url: "/api/text-template-management/template-contents/restore-to-default",
102
+ body
103
+ });
104
+ }
105
+ /**
106
+ * Update template content
107
+ * @param body DTO containing template name, culture name, and new content
108
+ * @returns Promise with updated template content
109
+ */
110
+ async updateByInput(body) {
111
+ return this.restService.request({
112
+ method: "PUT",
113
+ url: "/api/text-template-management/template-contents",
114
+ body
115
+ });
116
+ }
117
+ };
118
+
119
+ // src/services/text-template-management-state.service.ts
120
+ var TextTemplateManagementStateService = class {
121
+ constructor(restService) {
122
+ this._state = {
123
+ templateDefinitions: [],
124
+ totalCount: 0,
125
+ selectedTemplate: null,
126
+ templateContent: null
127
+ };
128
+ this.templateDefinitionService = new TemplateDefinitionService(restService);
129
+ this.templateContentService = new TemplateContentService(restService);
130
+ }
131
+ // ==================== Getters ====================
132
+ /**
133
+ * Get template definitions from state
134
+ * @returns Array of template definitions
135
+ */
136
+ getTemplateDefinitions() {
137
+ return this._state.templateDefinitions;
138
+ }
139
+ /**
140
+ * Get total count of template definitions
141
+ * @returns Total count
142
+ */
143
+ getTotalCount() {
144
+ return this._state.totalCount;
145
+ }
146
+ /**
147
+ * Get the currently selected template
148
+ * @returns Selected template or null
149
+ */
150
+ getSelectedTemplate() {
151
+ return this._state.selectedTemplate;
152
+ }
153
+ /**
154
+ * Get template content from state
155
+ * @returns Template content or null
156
+ */
157
+ getTemplateContent() {
158
+ return this._state.templateContent;
159
+ }
160
+ // ==================== Dispatch Methods ====================
161
+ /**
162
+ * Dispatch action to fetch template definitions
163
+ * @param params Query parameters for filtering and pagination
164
+ * @returns Promise with list result
165
+ */
166
+ async dispatchGetTemplateDefinitions(params = {}) {
167
+ const result = await this.templateDefinitionService.getList(params);
168
+ this._state.templateDefinitions = result.items || [];
169
+ this._state.totalCount = this._state.templateDefinitions.length;
170
+ return result;
171
+ }
172
+ /**
173
+ * Dispatch action to get template content
174
+ * @param params Input containing template name and optional culture name
175
+ * @returns Promise with template content
176
+ */
177
+ async dispatchGetTemplateContent(params) {
178
+ const result = await this.templateContentService.getByInput(params);
179
+ this._state.templateContent = result;
180
+ return result;
181
+ }
182
+ /**
183
+ * Dispatch action to update template content
184
+ * @param body DTO containing template name, culture name, and content
185
+ * @returns Promise with updated template content
186
+ */
187
+ async dispatchUpdateTemplateContent(body) {
188
+ const result = await this.templateContentService.updateByInput(body);
189
+ this._state.templateContent = result;
190
+ return result;
191
+ }
192
+ /**
193
+ * Dispatch action to restore template content to default
194
+ * @param body Input containing template name and culture name
195
+ * @returns Promise that resolves when restore is complete
196
+ */
197
+ async dispatchRestoreToDefault(body) {
198
+ await this.templateContentService.restoreToDefaultByInput(body);
199
+ if (body.cultureName) {
200
+ await this.dispatchGetTemplateContent(body);
201
+ }
202
+ }
203
+ /**
204
+ * Set the selected template
205
+ * @param template Template to select or null to clear
206
+ */
207
+ setSelectedTemplate(template) {
208
+ this._state.selectedTemplate = template;
209
+ }
210
+ /**
211
+ * Clear all state
212
+ */
213
+ reset() {
214
+ this._state = {
215
+ templateDefinitions: [],
216
+ totalCount: 0,
217
+ selectedTemplate: null,
218
+ templateContent: null
219
+ };
220
+ }
221
+ };
222
+
223
+ // src/hooks/useTextTemplates.ts
224
+ import { useState, useCallback, useMemo } from "react";
225
+ import { useRestService } from "@abpjs/core";
226
+ function useTextTemplates() {
227
+ const restService = useRestService();
228
+ const templateDefinitionService = useMemo(
229
+ () => new TemplateDefinitionService(restService),
230
+ [restService]
231
+ );
232
+ const templateContentService = useMemo(
233
+ () => new TemplateContentService(restService),
234
+ [restService]
235
+ );
236
+ const [templateDefinitions, setTemplateDefinitions] = useState([]);
237
+ const [totalCount, setTotalCount] = useState(0);
238
+ const [selectedTemplate, setSelectedTemplate] = useState(null);
239
+ const [templateContent, setTemplateContent] = useState(null);
240
+ const [isLoading, setIsLoading] = useState(false);
241
+ const [error, setError] = useState(null);
242
+ const fetchTemplateDefinitions = useCallback(
243
+ async (params = {}) => {
244
+ setIsLoading(true);
245
+ setError(null);
246
+ try {
247
+ const result = await templateDefinitionService.getList(params);
248
+ const items = result.items || [];
249
+ setTemplateDefinitions(items);
250
+ setTotalCount(items.length);
251
+ } catch (err) {
252
+ const message = err instanceof Error ? err.message : "Failed to fetch template definitions";
253
+ setError(message);
254
+ } finally {
255
+ setIsLoading(false);
256
+ }
257
+ },
258
+ [templateDefinitionService]
259
+ );
260
+ const getTemplateContent = useCallback(
261
+ async (params) => {
262
+ setIsLoading(true);
263
+ setError(null);
264
+ try {
265
+ const result = await templateContentService.getByInput(params);
266
+ setTemplateContent(result);
267
+ } catch (err) {
268
+ const message = err instanceof Error ? err.message : "Failed to fetch template content";
269
+ setError(message);
270
+ } finally {
271
+ setIsLoading(false);
272
+ }
273
+ },
274
+ [templateContentService]
275
+ );
276
+ const updateTemplateContent = useCallback(
277
+ async (body) => {
278
+ setIsLoading(true);
279
+ setError(null);
280
+ try {
281
+ const result = await templateContentService.updateByInput(body);
282
+ setTemplateContent(result);
283
+ return { success: true };
284
+ } catch (err) {
285
+ const message = err instanceof Error ? err.message : "Failed to update template content";
286
+ setError(message);
287
+ return { success: false, error: message };
288
+ } finally {
289
+ setIsLoading(false);
290
+ }
291
+ },
292
+ [templateContentService]
293
+ );
294
+ const restoreToDefault = useCallback(
295
+ async (params) => {
296
+ setIsLoading(true);
297
+ setError(null);
298
+ try {
299
+ await templateContentService.restoreToDefaultByInput(params);
300
+ if (params.cultureName) {
301
+ const result = await templateContentService.getByInput(params);
302
+ setTemplateContent(result);
303
+ }
304
+ return { success: true };
305
+ } catch (err) {
306
+ const message = err instanceof Error ? err.message : "Failed to restore template to default";
307
+ setError(message);
308
+ return { success: false, error: message };
309
+ } finally {
310
+ setIsLoading(false);
311
+ }
312
+ },
313
+ [templateContentService]
314
+ );
315
+ const reset = useCallback(() => {
316
+ setTemplateDefinitions([]);
317
+ setTotalCount(0);
318
+ setSelectedTemplate(null);
319
+ setTemplateContent(null);
320
+ setError(null);
321
+ }, []);
322
+ return {
323
+ templateDefinitions,
324
+ totalCount,
325
+ selectedTemplate,
326
+ templateContent,
327
+ isLoading,
328
+ error,
329
+ fetchTemplateDefinitions,
330
+ getTemplateContent,
331
+ updateTemplateContent,
332
+ restoreToDefault,
333
+ setSelectedTemplate,
334
+ reset
335
+ };
336
+ }
337
+
338
+ // src/components/TextTemplatesComponent/TextTemplatesComponent.tsx
339
+ import { useEffect, useState as useState2 } from "react";
340
+ import { jsx, jsxs } from "react/jsx-runtime";
341
+ function TextTemplatesComponent({
342
+ onEditContents,
343
+ className = "",
344
+ pageSize = 10
345
+ }) {
346
+ const {
347
+ templateDefinitions,
348
+ isLoading,
349
+ error,
350
+ fetchTemplateDefinitions,
351
+ setSelectedTemplate
352
+ } = useTextTemplates();
353
+ const [currentPage, setCurrentPage] = useState2(1);
354
+ useEffect(() => {
355
+ fetchTemplateDefinitions({
356
+ skipCount: (currentPage - 1) * pageSize,
357
+ maxResultCount: pageSize
358
+ });
359
+ }, [fetchTemplateDefinitions, currentPage, pageSize]);
360
+ const handleEditContents = (template) => {
361
+ setSelectedTemplate(template);
362
+ onEditContents?.(template);
363
+ };
364
+ const handlePageChange = (page) => {
365
+ setCurrentPage(page);
366
+ };
367
+ if (error) {
368
+ return /* @__PURE__ */ jsxs("div", { className: `text-templates-error ${className}`, style: styles.error, children: [
369
+ /* @__PURE__ */ jsxs("p", { children: [
370
+ "Error loading templates: ",
371
+ error
372
+ ] }),
373
+ /* @__PURE__ */ jsx(
374
+ "button",
375
+ {
376
+ type: "button",
377
+ onClick: () => fetchTemplateDefinitions(),
378
+ style: styles.retryButton,
379
+ children: "Retry"
380
+ }
381
+ )
382
+ ] });
383
+ }
384
+ return /* @__PURE__ */ jsxs("div", { className: `text-templates-component ${className}`, style: styles.container, children: [
385
+ /* @__PURE__ */ jsx("div", { className: "text-templates-header", style: styles.header, children: /* @__PURE__ */ jsx("h2", { style: styles.title, children: "Text Templates" }) }),
386
+ isLoading ? /* @__PURE__ */ jsx("div", { style: styles.loading, children: "Loading..." }) : templateDefinitions.length === 0 ? /* @__PURE__ */ jsx("div", { style: styles.empty, children: "No text templates found." }) : /* @__PURE__ */ jsx("div", { style: styles.tableWrapper, children: /* @__PURE__ */ jsxs("table", { style: styles.table, children: [
387
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
388
+ /* @__PURE__ */ jsx("th", { style: styles.th, children: "Name" }),
389
+ /* @__PURE__ */ jsx("th", { style: styles.th, children: "Display Name" }),
390
+ /* @__PURE__ */ jsx("th", { style: styles.th, children: "Is Layout" }),
391
+ /* @__PURE__ */ jsx("th", { style: styles.th, children: "Layout" }),
392
+ /* @__PURE__ */ jsx("th", { style: styles.th, children: "Default Culture" }),
393
+ /* @__PURE__ */ jsx("th", { style: styles.th, children: "Inline Localized" }),
394
+ /* @__PURE__ */ jsx("th", { style: styles.th, children: "Actions" })
395
+ ] }) }),
396
+ /* @__PURE__ */ jsx("tbody", { children: templateDefinitions.map((template) => /* @__PURE__ */ jsxs("tr", { style: styles.tr, children: [
397
+ /* @__PURE__ */ jsx("td", { style: styles.td, children: template.name }),
398
+ /* @__PURE__ */ jsx("td", { style: styles.td, children: template.displayName }),
399
+ /* @__PURE__ */ jsx("td", { style: styles.td, children: template.isLayout ? "Yes" : "No" }),
400
+ /* @__PURE__ */ jsx("td", { style: styles.td, children: template.layout || "-" }),
401
+ /* @__PURE__ */ jsx("td", { style: styles.td, children: template.defaultCultureName || "-" }),
402
+ /* @__PURE__ */ jsx("td", { style: styles.td, children: template.isInlineLocalized ? "Yes" : "No" }),
403
+ /* @__PURE__ */ jsx("td", { style: styles.td, children: /* @__PURE__ */ jsx(
404
+ "button",
405
+ {
406
+ type: "button",
407
+ onClick: () => handleEditContents(template),
408
+ style: styles.actionButton,
409
+ children: "Edit Contents"
410
+ }
411
+ ) })
412
+ ] }, template.name)) })
413
+ ] }) }),
414
+ templateDefinitions.length > 0 && /* @__PURE__ */ jsxs("div", { style: styles.pagination, children: [
415
+ /* @__PURE__ */ jsx(
416
+ "button",
417
+ {
418
+ type: "button",
419
+ onClick: () => handlePageChange(currentPage - 1),
420
+ disabled: currentPage === 1,
421
+ style: styles.pageButton,
422
+ children: "Previous"
423
+ }
424
+ ),
425
+ /* @__PURE__ */ jsxs("span", { style: styles.pageInfo, children: [
426
+ "Page ",
427
+ currentPage
428
+ ] }),
429
+ /* @__PURE__ */ jsx(
430
+ "button",
431
+ {
432
+ type: "button",
433
+ onClick: () => handlePageChange(currentPage + 1),
434
+ disabled: templateDefinitions.length < pageSize,
435
+ style: styles.pageButton,
436
+ children: "Next"
437
+ }
438
+ )
439
+ ] })
440
+ ] });
441
+ }
442
+ var styles = {
443
+ container: {
444
+ padding: "16px"
445
+ },
446
+ header: {
447
+ display: "flex",
448
+ justifyContent: "space-between",
449
+ alignItems: "center",
450
+ marginBottom: "16px"
451
+ },
452
+ title: {
453
+ margin: 0,
454
+ fontSize: "24px",
455
+ fontWeight: 600
456
+ },
457
+ loading: {
458
+ padding: "32px",
459
+ textAlign: "center",
460
+ color: "#666"
461
+ },
462
+ empty: {
463
+ padding: "32px",
464
+ textAlign: "center",
465
+ color: "#666"
466
+ },
467
+ error: {
468
+ padding: "32px",
469
+ textAlign: "center",
470
+ color: "#dc2626"
471
+ },
472
+ retryButton: {
473
+ marginTop: "8px",
474
+ padding: "8px 16px",
475
+ border: "none",
476
+ borderRadius: "4px",
477
+ backgroundColor: "#3b82f6",
478
+ color: "white",
479
+ cursor: "pointer"
480
+ },
481
+ tableWrapper: {
482
+ overflowX: "auto"
483
+ },
484
+ table: {
485
+ width: "100%",
486
+ borderCollapse: "collapse",
487
+ fontSize: "14px"
488
+ },
489
+ th: {
490
+ padding: "12px 8px",
491
+ textAlign: "left",
492
+ borderBottom: "2px solid #e5e7eb",
493
+ fontWeight: 600,
494
+ color: "#374151"
495
+ },
496
+ tr: {
497
+ borderBottom: "1px solid #e5e7eb"
498
+ },
499
+ td: {
500
+ padding: "12px 8px",
501
+ color: "#4b5563"
502
+ },
503
+ actionButton: {
504
+ padding: "6px 12px",
505
+ border: "none",
506
+ borderRadius: "4px",
507
+ backgroundColor: "#3b82f6",
508
+ color: "white",
509
+ fontSize: "12px",
510
+ cursor: "pointer"
511
+ },
512
+ pagination: {
513
+ display: "flex",
514
+ justifyContent: "center",
515
+ alignItems: "center",
516
+ gap: "16px",
517
+ marginTop: "16px"
518
+ },
519
+ pageButton: {
520
+ padding: "8px 16px",
521
+ border: "1px solid #e5e7eb",
522
+ borderRadius: "4px",
523
+ backgroundColor: "white",
524
+ cursor: "pointer"
525
+ },
526
+ pageInfo: {
527
+ color: "#6b7280"
528
+ }
529
+ };
530
+
531
+ // src/components/TemplateContentsComponent/TemplateContentsComponent.tsx
532
+ import { useEffect as useEffect2, useState as useState3, useCallback as useCallback2 } from "react";
533
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
534
+ function TemplateContentsComponent({
535
+ templateName,
536
+ cultures = [],
537
+ defaultCultureName,
538
+ onSave,
539
+ onRestore,
540
+ className = ""
541
+ }) {
542
+ const {
543
+ templateContent,
544
+ isLoading,
545
+ error,
546
+ getTemplateContent,
547
+ updateTemplateContent,
548
+ restoreToDefault
549
+ } = useTextTemplates();
550
+ const [selectedCulture, setSelectedCulture] = useState3(defaultCultureName || "");
551
+ const [content, setContent] = useState3("");
552
+ const [referenceContent, setReferenceContent] = useState3("");
553
+ const [isSaving, setIsSaving] = useState3(false);
554
+ useEffect2(() => {
555
+ if (templateName && selectedCulture) {
556
+ getTemplateContent({
557
+ templateName,
558
+ cultureName: selectedCulture
559
+ });
560
+ }
561
+ }, [templateName, selectedCulture, getTemplateContent]);
562
+ useEffect2(() => {
563
+ if (templateName && defaultCultureName && defaultCultureName !== selectedCulture) {
564
+ setReferenceContent("Reference content would be loaded here");
565
+ }
566
+ }, [templateName, defaultCultureName, selectedCulture]);
567
+ useEffect2(() => {
568
+ if (templateContent) {
569
+ setContent(templateContent.content || "");
570
+ }
571
+ }, [templateContent]);
572
+ const handleCultureChange = useCallback2((e) => {
573
+ setSelectedCulture(e.target.value);
574
+ }, []);
575
+ const handleContentChange = useCallback2((e) => {
576
+ setContent(e.target.value);
577
+ }, []);
578
+ const handleSave = useCallback2(async () => {
579
+ if (!templateName || !selectedCulture) return;
580
+ setIsSaving(true);
581
+ const result = await updateTemplateContent({
582
+ templateName,
583
+ cultureName: selectedCulture,
584
+ content
585
+ });
586
+ setIsSaving(false);
587
+ if (result.success && templateContent) {
588
+ onSave?.(templateContent);
589
+ }
590
+ }, [templateName, selectedCulture, content, updateTemplateContent, templateContent, onSave]);
591
+ const handleRestoreToDefault = useCallback2(async () => {
592
+ if (!templateName || !selectedCulture) return;
593
+ const confirmed = window.confirm(
594
+ "Are you sure you want to restore this template to its default content?"
595
+ );
596
+ if (!confirmed) return;
597
+ setIsSaving(true);
598
+ const result = await restoreToDefault({
599
+ templateName,
600
+ cultureName: selectedCulture
601
+ });
602
+ setIsSaving(false);
603
+ if (result.success) {
604
+ onRestore?.();
605
+ }
606
+ }, [templateName, selectedCulture, restoreToDefault, onRestore]);
607
+ if (error) {
608
+ return /* @__PURE__ */ jsx2("div", { className: `template-contents-error ${className}`, style: styles2.error, children: /* @__PURE__ */ jsxs2("p", { children: [
609
+ "Error: ",
610
+ error
611
+ ] }) });
612
+ }
613
+ return /* @__PURE__ */ jsxs2("div", { className: `template-contents-component ${className}`, style: styles2.container, children: [
614
+ /* @__PURE__ */ jsx2("div", { style: styles2.header, children: /* @__PURE__ */ jsxs2("h2", { style: styles2.title, children: [
615
+ "Edit Template: ",
616
+ templateName
617
+ ] }) }),
618
+ /* @__PURE__ */ jsxs2("div", { style: styles2.cultureSelector, children: [
619
+ /* @__PURE__ */ jsx2("label", { htmlFor: "culture-select", style: styles2.label, children: "Culture:" }),
620
+ /* @__PURE__ */ jsxs2(
621
+ "select",
622
+ {
623
+ id: "culture-select",
624
+ value: selectedCulture,
625
+ onChange: handleCultureChange,
626
+ style: styles2.select,
627
+ children: [
628
+ /* @__PURE__ */ jsx2("option", { value: "", children: "Select a culture" }),
629
+ cultures.map((culture) => /* @__PURE__ */ jsx2("option", { value: culture.name, children: culture.displayName }, culture.name))
630
+ ]
631
+ }
632
+ )
633
+ ] }),
634
+ isLoading ? /* @__PURE__ */ jsx2("div", { style: styles2.loading, children: "Loading template content..." }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
635
+ referenceContent && defaultCultureName !== selectedCulture && /* @__PURE__ */ jsxs2("div", { style: styles2.referenceSection, children: [
636
+ /* @__PURE__ */ jsxs2("h4", { style: styles2.sectionTitle, children: [
637
+ "Reference Content (",
638
+ defaultCultureName,
639
+ ")"
640
+ ] }),
641
+ /* @__PURE__ */ jsx2("pre", { style: styles2.referenceContent, children: referenceContent })
642
+ ] }),
643
+ /* @__PURE__ */ jsxs2("div", { style: styles2.editorSection, children: [
644
+ /* @__PURE__ */ jsxs2("h4", { style: styles2.sectionTitle, children: [
645
+ "Content ",
646
+ selectedCulture ? `(${selectedCulture})` : ""
647
+ ] }),
648
+ /* @__PURE__ */ jsx2(
649
+ "textarea",
650
+ {
651
+ value: content,
652
+ onChange: handleContentChange,
653
+ style: styles2.textarea,
654
+ rows: 15,
655
+ placeholder: "Enter template content...",
656
+ disabled: !selectedCulture
657
+ }
658
+ )
659
+ ] }),
660
+ /* @__PURE__ */ jsxs2("div", { style: styles2.actions, children: [
661
+ /* @__PURE__ */ jsx2(
662
+ "button",
663
+ {
664
+ type: "button",
665
+ onClick: handleRestoreToDefault,
666
+ disabled: isSaving || !selectedCulture,
667
+ style: styles2.restoreButton,
668
+ children: "Restore to Default"
669
+ }
670
+ ),
671
+ /* @__PURE__ */ jsx2(
672
+ "button",
673
+ {
674
+ type: "button",
675
+ onClick: handleSave,
676
+ disabled: isSaving || !selectedCulture,
677
+ style: styles2.saveButton,
678
+ children: isSaving ? "Saving..." : "Save"
679
+ }
680
+ )
681
+ ] })
682
+ ] })
683
+ ] });
684
+ }
685
+ var styles2 = {
686
+ container: {
687
+ padding: "16px"
688
+ },
689
+ header: {
690
+ marginBottom: "16px"
691
+ },
692
+ title: {
693
+ margin: 0,
694
+ fontSize: "20px",
695
+ fontWeight: 600
696
+ },
697
+ cultureSelector: {
698
+ marginBottom: "16px",
699
+ display: "flex",
700
+ alignItems: "center",
701
+ gap: "8px"
702
+ },
703
+ label: {
704
+ fontWeight: 500,
705
+ color: "#374151"
706
+ },
707
+ select: {
708
+ padding: "8px 12px",
709
+ borderRadius: "4px",
710
+ border: "1px solid #d1d5db",
711
+ fontSize: "14px",
712
+ minWidth: "200px"
713
+ },
714
+ loading: {
715
+ padding: "32px",
716
+ textAlign: "center",
717
+ color: "#666"
718
+ },
719
+ error: {
720
+ padding: "32px",
721
+ textAlign: "center",
722
+ color: "#dc2626"
723
+ },
724
+ referenceSection: {
725
+ marginBottom: "16px",
726
+ padding: "12px",
727
+ backgroundColor: "#f9fafb",
728
+ borderRadius: "4px"
729
+ },
730
+ sectionTitle: {
731
+ margin: "0 0 8px 0",
732
+ fontSize: "14px",
733
+ fontWeight: 500,
734
+ color: "#6b7280"
735
+ },
736
+ referenceContent: {
737
+ margin: 0,
738
+ padding: "8px",
739
+ backgroundColor: "#f3f4f6",
740
+ borderRadius: "4px",
741
+ fontSize: "13px",
742
+ fontFamily: "monospace",
743
+ whiteSpace: "pre-wrap",
744
+ maxHeight: "200px",
745
+ overflow: "auto"
746
+ },
747
+ editorSection: {
748
+ marginBottom: "16px"
749
+ },
750
+ textarea: {
751
+ width: "100%",
752
+ padding: "12px",
753
+ borderRadius: "4px",
754
+ border: "1px solid #d1d5db",
755
+ fontSize: "14px",
756
+ fontFamily: "monospace",
757
+ resize: "vertical",
758
+ minHeight: "200px"
759
+ },
760
+ actions: {
761
+ display: "flex",
762
+ justifyContent: "flex-end",
763
+ gap: "8px"
764
+ },
765
+ restoreButton: {
766
+ padding: "10px 20px",
767
+ border: "1px solid #d1d5db",
768
+ borderRadius: "4px",
769
+ backgroundColor: "white",
770
+ color: "#374151",
771
+ fontSize: "14px",
772
+ cursor: "pointer"
773
+ },
774
+ saveButton: {
775
+ padding: "10px 20px",
776
+ border: "none",
777
+ borderRadius: "4px",
778
+ backgroundColor: "#3b82f6",
779
+ color: "white",
780
+ fontSize: "14px",
781
+ cursor: "pointer"
782
+ }
783
+ };
784
+ export {
785
+ TEXT_TEMPLATE_MANAGEMENT_ROUTES,
786
+ TemplateContentService,
787
+ TemplateContentsComponent,
788
+ TemplateDefinitionService,
789
+ TextTemplateManagementStateService,
790
+ TextTemplatesComponent,
791
+ eTextTemplateManagementComponents,
792
+ eTextTemplateManagementRouteNames,
793
+ useTextTemplates
794
+ };