strapi-plugin-bulk-updater 1.6.9 → 1.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/_chunks/{BulkUpdater-CKDhgvZ6.js → BulkUpdater-BSlEEUTV.js} +294 -116
  2. package/dist/_chunks/BulkUpdater-BSlEEUTV.js.map +1 -0
  3. package/dist/_chunks/{BulkUpdater-4E6M5K8J.mjs → BulkUpdater-CFStXO-q.mjs} +296 -118
  4. package/dist/_chunks/BulkUpdater-CFStXO-q.mjs.map +1 -0
  5. package/dist/_chunks/{ScopedQuotaSelectInput-BsBpmwun.js → ScopedQuotaSelectInput-BC2Ge-Iv.js} +9 -4
  6. package/dist/_chunks/ScopedQuotaSelectInput-BC2Ge-Iv.js.map +1 -0
  7. package/dist/_chunks/{ScopedQuotaSelectInput-YKdQgrPt.mjs → ScopedQuotaSelectInput-DPIIa3XO.mjs} +9 -4
  8. package/dist/_chunks/ScopedQuotaSelectInput-DPIIa3XO.mjs.map +1 -0
  9. package/dist/_chunks/{SettingsPage-Crh2syU4.js → SettingsPage-BgEO2BNP.js} +2 -2
  10. package/dist/_chunks/{SettingsPage-Crh2syU4.js.map → SettingsPage-BgEO2BNP.js.map} +1 -1
  11. package/dist/_chunks/{SettingsPage-BX9sCRmw.mjs → SettingsPage-BrfS4_qy.mjs} +2 -2
  12. package/dist/_chunks/{SettingsPage-BX9sCRmw.mjs.map → SettingsPage-BrfS4_qy.mjs.map} +1 -1
  13. package/dist/_chunks/{ValidationRulesTab-BqbENLpg.mjs → ValidationRulesTab-BslJyrBj.mjs} +146 -80
  14. package/dist/_chunks/ValidationRulesTab-BslJyrBj.mjs.map +1 -0
  15. package/dist/_chunks/{ValidationRulesTab-R1vlW2wY.js → ValidationRulesTab-Cs0YDlMx.js} +145 -79
  16. package/dist/_chunks/ValidationRulesTab-Cs0YDlMx.js.map +1 -0
  17. package/dist/_chunks/index-4eNIGyGu.mjs +229 -0
  18. package/dist/_chunks/index-4eNIGyGu.mjs.map +1 -0
  19. package/dist/_chunks/index-CjR6IZqM.js +230 -0
  20. package/dist/_chunks/index-CjR6IZqM.js.map +1 -0
  21. package/dist/admin/index.js +4 -196
  22. package/dist/admin/index.js.map +1 -1
  23. package/dist/admin/index.mjs +4 -194
  24. package/dist/admin/index.mjs.map +1 -1
  25. package/dist/server/index.js +215 -21
  26. package/dist/server/index.js.map +1 -1
  27. package/dist/server/index.mjs +215 -21
  28. package/dist/server/index.mjs.map +1 -1
  29. package/package.json +1 -1
  30. package/dist/_chunks/BulkUpdater-4E6M5K8J.mjs.map +0 -1
  31. package/dist/_chunks/BulkUpdater-CKDhgvZ6.js.map +0 -1
  32. package/dist/_chunks/ScopedQuotaSelectInput-BsBpmwun.js.map +0 -1
  33. package/dist/_chunks/ScopedQuotaSelectInput-YKdQgrPt.mjs.map +0 -1
  34. package/dist/_chunks/ValidationRulesTab-BqbENLpg.mjs.map +0 -1
  35. package/dist/_chunks/ValidationRulesTab-R1vlW2wY.js.map +0 -1
@@ -0,0 +1,229 @@
1
+ import React__default from "react";
2
+ import { ClockCounterClockwise, Pencil } from "@strapi/icons";
3
+ const PLUGIN_ID$1 = "bulk-updater";
4
+ const PLUGIN_ID = "bulk-updater";
5
+ const PERMISSIONS = {
6
+ // General (support both .read and .access aliases)
7
+ read: `plugin::${PLUGIN_ID}.read`,
8
+ access: `plugin::${PLUGIN_ID}.access`,
9
+ // Workspace
10
+ workspaceView: `plugin::${PLUGIN_ID}.workspace.view`,
11
+ workspaceExecute: `plugin::${PLUGIN_ID}.workspace.execute`,
12
+ workspacePublish: `plugin::${PLUGIN_ID}.workspace.publish`,
13
+ // CSV Management
14
+ csvExport: `plugin::${PLUGIN_ID}.csv.export`,
15
+ csvImport: `plugin::${PLUGIN_ID}.csv.import`,
16
+ // Audit Trail
17
+ auditView: `plugin::${PLUGIN_ID}.audit.view`,
18
+ auditDetails: `plugin::${PLUGIN_ID}.audit.details`,
19
+ auditRollback: `plugin::${PLUGIN_ID}.audit.rollback`,
20
+ // Approvals (Maker-Checker)
21
+ approvalView: `plugin::${PLUGIN_ID}.approval.view`,
22
+ approvalApprove: `plugin::${PLUGIN_ID}.approval.approve`,
23
+ approvalReject: `plugin::${PLUGIN_ID}.approval.reject`,
24
+ // Validation Rules
25
+ validationView: `plugin::${PLUGIN_ID}.validation.view`,
26
+ validationManage: `plugin::${PLUGIN_ID}.validation.manage`,
27
+ // Settings
28
+ settingsView: `plugin::${PLUGIN_ID}.settings.view`,
29
+ settingsManage: `plugin::${PLUGIN_ID}.settings.manage`
30
+ };
31
+ const MAIN_MENU_PERMISSIONS = [
32
+ { action: PERMISSIONS.read, subject: null },
33
+ { action: PERMISSIONS.access, subject: null },
34
+ { action: PERMISSIONS.workspaceView, subject: null },
35
+ { action: PERMISSIONS.auditView, subject: null },
36
+ { action: PERMISSIONS.approvalView, subject: null },
37
+ { action: PERMISSIONS.validationView, subject: null },
38
+ { action: PERMISSIONS.csvExport, subject: null },
39
+ { action: PERMISSIONS.csvImport, subject: null }
40
+ ];
41
+ const SETTINGS_MENU_PERMISSIONS = [
42
+ { action: PERMISSIONS.settingsView, subject: null },
43
+ { action: PERMISSIONS.settingsManage, subject: null }
44
+ ];
45
+ function escapeHtml(str) {
46
+ return (str || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
47
+ }
48
+ function showQuotaErrorToast(message) {
49
+ if (typeof document === "undefined") return;
50
+ const existing = document.getElementById("strapi-quota-validation-banner");
51
+ if (existing) existing.remove();
52
+ let title = "Validation Error";
53
+ let detail = message;
54
+ const match = message.match(/^(Validation Error \([^)]+\)):\s*(.+)$/s);
55
+ if (match) {
56
+ title = match[1];
57
+ detail = match[2];
58
+ }
59
+ const banner = document.createElement("div");
60
+ banner.id = "strapi-quota-validation-banner";
61
+ banner.style.position = "fixed";
62
+ banner.style.top = "24px";
63
+ banner.style.left = "50%";
64
+ banner.style.transform = "translateX(-50%)";
65
+ banner.style.zIndex = "999999";
66
+ banner.style.minWidth = "420px";
67
+ banner.style.maxWidth = "720px";
68
+ banner.style.backgroundColor = "#D02B20";
69
+ banner.style.color = "#FFFFFF";
70
+ banner.style.padding = "14px 20px";
71
+ banner.style.borderRadius = "6px";
72
+ banner.style.boxShadow = "0 10px 25px rgba(0,0,0,0.35)";
73
+ banner.style.display = "flex";
74
+ banner.style.alignItems = "flex-start";
75
+ banner.style.gap = "12px";
76
+ banner.style.fontFamily = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
77
+ banner.style.fontSize = "14px";
78
+ banner.style.lineHeight = "1.45";
79
+ banner.style.transition = "opacity 0.2s ease-in-out";
80
+ banner.innerHTML = `
81
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink: 0; margin-top: 1px;">
82
+ <circle cx="12" cy="12" r="10"></circle>
83
+ <line x1="12" y1="8" x2="12" y2="12"></line>
84
+ <line x1="12" y1="16" x2="12.01" y2="16"></line>
85
+ </svg>
86
+ <div style="flex: 1;">
87
+ <div style="font-weight: 700; margin-bottom: 2px;">${escapeHtml(title)}</div>
88
+ <div style="opacity: 0.95;">${escapeHtml(detail)}</div>
89
+ </div>
90
+ <button style="background: none; border: none; color: #FFF; cursor: pointer; padding: 0 4px; font-size: 18px; line-height: 1; opacity: 0.8;" onclick="this.parentElement.remove()">×</button>
91
+ `;
92
+ document.body.appendChild(banner);
93
+ setTimeout(() => {
94
+ if (banner.parentElement) {
95
+ banner.style.opacity = "0";
96
+ setTimeout(() => banner.remove(), 250);
97
+ }
98
+ }, 1e4);
99
+ }
100
+ const index = {
101
+ register(app) {
102
+ app.addMenuLink({
103
+ to: `plugins/${PLUGIN_ID$1}`,
104
+ icon: Pencil,
105
+ intlLabel: {
106
+ id: `${PLUGIN_ID$1}.plugin.name`,
107
+ defaultMessage: "Bulk Attribute Updater"
108
+ },
109
+ Component: () => import("./BulkUpdater-CFStXO-q.mjs"),
110
+ permissions: MAIN_MENU_PERMISSIONS,
111
+ position: 3
112
+ });
113
+ app.addSettingsLink("global", {
114
+ id: `${PLUGIN_ID$1}-settings`,
115
+ intlLabel: {
116
+ id: `${PLUGIN_ID$1}.settings.name`,
117
+ defaultMessage: "Bulk Updater Settings"
118
+ },
119
+ to: `${PLUGIN_ID$1}`,
120
+ Component: () => import("./SettingsPage-BrfS4_qy.mjs"),
121
+ permissions: SETTINGS_MENU_PERMISSIONS
122
+ });
123
+ app.registerPlugin({
124
+ id: PLUGIN_ID$1,
125
+ name: PLUGIN_ID$1
126
+ });
127
+ app.customFields.register({
128
+ name: "scoped-select",
129
+ pluginId: PLUGIN_ID$1,
130
+ type: "string",
131
+ intlLabel: {
132
+ id: `${PLUGIN_ID$1}.scoped-select.label`,
133
+ defaultMessage: "Scoped Quota Select"
134
+ },
135
+ intlDescription: {
136
+ id: `${PLUGIN_ID$1}.scoped-select.description`,
137
+ defaultMessage: "Dropdown with dynamic cross-component usage quota enforcement"
138
+ },
139
+ components: {
140
+ Input: async () => import("./ScopedQuotaSelectInput-DPIIa3XO.mjs")
141
+ }
142
+ });
143
+ },
144
+ bootstrap(app) {
145
+ if (typeof window !== "undefined" && !window.__bulk_updater_interceptor_installed) {
146
+ window.__bulk_updater_interceptor_installed = true;
147
+ if (window.fetch) {
148
+ const origFetch = window.fetch;
149
+ window.fetch = async function(...args) {
150
+ const response = await origFetch.apply(this, args);
151
+ if (response.status === 400 || response.status === 422 || response.status === 500) {
152
+ try {
153
+ const clone = response.clone();
154
+ const data = await clone.json();
155
+ const errMsg = data?.error?.message || data?.message;
156
+ if (typeof errMsg === "string" && (errMsg.startsWith("Validation Error") || errMsg.includes("cannot appear more than"))) {
157
+ showQuotaErrorToast(errMsg);
158
+ }
159
+ } catch {
160
+ }
161
+ }
162
+ return response;
163
+ };
164
+ }
165
+ if (window.XMLHttpRequest) {
166
+ const origOpen = XMLHttpRequest.prototype.open;
167
+ XMLHttpRequest.prototype.open = function(...args) {
168
+ this.addEventListener("load", function() {
169
+ if (this.status === 400 || this.status === 422 || this.status === 500) {
170
+ try {
171
+ const data = JSON.parse(this.responseText);
172
+ const errMsg = data?.error?.message || data?.message;
173
+ if (typeof errMsg === "string" && (errMsg.startsWith("Validation Error") || errMsg.includes("cannot appear more than"))) {
174
+ showQuotaErrorToast(errMsg);
175
+ }
176
+ } catch {
177
+ }
178
+ }
179
+ });
180
+ return origOpen.apply(this, args);
181
+ };
182
+ }
183
+ }
184
+ try {
185
+ const contentManagerPlugin = app.getPlugin("content-manager");
186
+ if (contentManagerPlugin?.apis?.addDocumentAction) {
187
+ contentManagerPlugin.apis.addDocumentAction((actions) => {
188
+ if (window.strapi?.features?.isEnabled?.("cms-content-history")) {
189
+ return actions;
190
+ }
191
+ const hasHistory = actions.some((a) => a.type === "history" || a.id === "content-history");
192
+ if (hasHistory) return actions;
193
+ const customHistoryAction = ({ model, document: document2 }) => {
194
+ if (window.strapi?.features?.isEnabled?.("cms-content-history")) {
195
+ return null;
196
+ }
197
+ return {
198
+ icon: React__default.createElement(ClockCounterClockwise, {}),
199
+ label: "Content History",
200
+ onClick: () => {
201
+ const currentPath = window.location.pathname.replace(/\/$/, "");
202
+ if (!currentPath.endsWith("/history")) {
203
+ window.location.href = `${currentPath}/history${window.location.search}`;
204
+ }
205
+ },
206
+ disabled: !document2 || !document2.id || !model?.startsWith("api::"),
207
+ position: "header"
208
+ };
209
+ };
210
+ customHistoryAction.type = "history";
211
+ customHistoryAction.position = "header";
212
+ const deleteIndex = actions.findIndex((a) => a.type === "delete");
213
+ if (deleteIndex !== -1) {
214
+ actions.splice(deleteIndex, 0, customHistoryAction);
215
+ } else {
216
+ actions.push(customHistoryAction);
217
+ }
218
+ return actions;
219
+ });
220
+ }
221
+ } catch {
222
+ }
223
+ }
224
+ };
225
+ export {
226
+ PERMISSIONS as P,
227
+ index as i
228
+ };
229
+ //# sourceMappingURL=index-4eNIGyGu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-4eNIGyGu.mjs","sources":["../../admin/src/pluginId.ts","../../admin/src/constants/permissions.ts","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = 'bulk-updater';\n","export const PLUGIN_ID = 'bulk-updater';\n\nexport const PERMISSIONS = {\n // General (support both .read and .access aliases)\n read: `plugin::${PLUGIN_ID}.read`,\n access: `plugin::${PLUGIN_ID}.access`,\n\n // Workspace\n workspaceView: `plugin::${PLUGIN_ID}.workspace.view`,\n workspaceExecute: `plugin::${PLUGIN_ID}.workspace.execute`,\n workspacePublish: `plugin::${PLUGIN_ID}.workspace.publish`,\n\n // CSV Management\n csvExport: `plugin::${PLUGIN_ID}.csv.export`,\n csvImport: `plugin::${PLUGIN_ID}.csv.import`,\n\n // Audit Trail\n auditView: `plugin::${PLUGIN_ID}.audit.view`,\n auditDetails: `plugin::${PLUGIN_ID}.audit.details`,\n auditRollback: `plugin::${PLUGIN_ID}.audit.rollback`,\n\n // Approvals (Maker-Checker)\n approvalView: `plugin::${PLUGIN_ID}.approval.view`,\n approvalApprove: `plugin::${PLUGIN_ID}.approval.approve`,\n approvalReject: `plugin::${PLUGIN_ID}.approval.reject`,\n\n // Validation Rules\n validationView: `plugin::${PLUGIN_ID}.validation.view`,\n validationManage: `plugin::${PLUGIN_ID}.validation.manage`,\n\n // Settings\n settingsView: `plugin::${PLUGIN_ID}.settings.view`,\n settingsManage: `plugin::${PLUGIN_ID}.settings.manage`,\n} as const;\n\n/**\n * Menu link permission guards:\n * If the user has ANY of the main functional permissions or the general access permission,\n * the main menu link will be displayed in Strapi's navigation bar.\n */\nexport const MAIN_MENU_PERMISSIONS = [\n { action: PERMISSIONS.read, subject: null },\n { action: PERMISSIONS.access, subject: null },\n { action: PERMISSIONS.workspaceView, subject: null },\n { action: PERMISSIONS.auditView, subject: null },\n { action: PERMISSIONS.approvalView, subject: null },\n { action: PERMISSIONS.validationView, subject: null },\n { action: PERMISSIONS.csvExport, subject: null },\n { action: PERMISSIONS.csvImport, subject: null },\n];\n\nexport const SETTINGS_MENU_PERMISSIONS = [\n { action: PERMISSIONS.settingsView, subject: null },\n { action: PERMISSIONS.settingsManage, subject: null },\n];\n","import React from 'react';\nimport { PLUGIN_ID } from './pluginId';\nimport { Pencil, ClockCounterClockwise } from '@strapi/icons';\nimport { MAIN_MENU_PERMISSIONS, SETTINGS_MENU_PERMISSIONS } from './constants/permissions';\n\nfunction escapeHtml(str: string): string {\n return (str || '')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;');\n}\n\nfunction showQuotaErrorToast(message: string) {\n if (typeof document === 'undefined') return;\n const existing = document.getElementById('strapi-quota-validation-banner');\n if (existing) existing.remove();\n\n let title = 'Validation Error';\n let detail = message;\n const match = message.match(/^(Validation Error \\([^)]+\\)):\\s*(.+)$/s);\n if (match) {\n title = match[1];\n detail = match[2];\n }\n\n const banner = document.createElement('div');\n banner.id = 'strapi-quota-validation-banner';\n banner.style.position = 'fixed';\n banner.style.top = '24px';\n banner.style.left = '50%';\n banner.style.transform = 'translateX(-50%)';\n banner.style.zIndex = '999999';\n banner.style.minWidth = '420px';\n banner.style.maxWidth = '720px';\n banner.style.backgroundColor = '#D02B20';\n banner.style.color = '#FFFFFF';\n banner.style.padding = '14px 20px';\n banner.style.borderRadius = '6px';\n banner.style.boxShadow = '0 10px 25px rgba(0,0,0,0.35)';\n banner.style.display = 'flex';\n banner.style.alignItems = 'flex-start';\n banner.style.gap = '12px';\n banner.style.fontFamily = '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif';\n banner.style.fontSize = '14px';\n banner.style.lineHeight = '1.45';\n banner.style.transition = 'opacity 0.2s ease-in-out';\n\n banner.innerHTML = `\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"flex-shrink: 0; margin-top: 1px;\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line>\n <line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>\n </svg>\n <div style=\"flex: 1;\">\n <div style=\"font-weight: 700; margin-bottom: 2px;\">${escapeHtml(title)}</div>\n <div style=\"opacity: 0.95;\">${escapeHtml(detail)}</div>\n </div>\n <button style=\"background: none; border: none; color: #FFF; cursor: pointer; padding: 0 4px; font-size: 18px; line-height: 1; opacity: 0.8;\" onclick=\"this.parentElement.remove()\">×</button>\n `;\n\n document.body.appendChild(banner);\n\n setTimeout(() => {\n if (banner.parentElement) {\n banner.style.opacity = '0';\n setTimeout(() => banner.remove(), 250);\n }\n }, 10000);\n}\n\nexport default {\n register(app: any) {\n app.addMenuLink({\n to: `plugins/${PLUGIN_ID}`,\n icon: Pencil,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: 'Bulk Attribute Updater',\n },\n Component: () => import('./pages/BulkUpdater'),\n permissions: MAIN_MENU_PERMISSIONS,\n position: 3,\n });\n\n app.addSettingsLink('global', {\n id: `${PLUGIN_ID}-settings`,\n intlLabel: {\n id: `${PLUGIN_ID}.settings.name`,\n defaultMessage: 'Bulk Updater Settings',\n },\n to: `${PLUGIN_ID}`,\n Component: () => import('./pages/SettingsPage'),\n permissions: SETTINGS_MENU_PERMISSIONS,\n });\n\n app.registerPlugin({\n id: PLUGIN_ID,\n name: PLUGIN_ID,\n });\n\n app.customFields.register({\n name: 'scoped-select',\n pluginId: PLUGIN_ID,\n type: 'string',\n intlLabel: {\n id: `${PLUGIN_ID}.scoped-select.label`,\n defaultMessage: 'Scoped Quota Select',\n },\n intlDescription: {\n id: `${PLUGIN_ID}.scoped-select.description`,\n defaultMessage: 'Dropdown with dynamic cross-component usage quota enforcement',\n },\n components: {\n Input: async () => import('./components/ScopedQuotaSelectInput'),\n },\n });\n },\n bootstrap(app: any) {\n // Install global response interceptor for quota validation rule error banners\n if (typeof window !== 'undefined' && !(window as any).__bulk_updater_interceptor_installed) {\n (window as any).__bulk_updater_interceptor_installed = true;\n\n if (window.fetch) {\n const origFetch = window.fetch;\n window.fetch = async function (...args) {\n const response = await origFetch.apply(this, args);\n if (response.status === 400 || response.status === 422 || response.status === 500) {\n try {\n const clone = response.clone();\n const data = await clone.json();\n const errMsg = data?.error?.message || data?.message;\n if (\n typeof errMsg === 'string' &&\n (errMsg.startsWith('Validation Error') || errMsg.includes('cannot appear more than'))\n ) {\n showQuotaErrorToast(errMsg);\n }\n } catch {}\n }\n return response;\n };\n }\n\n if ((window as any).XMLHttpRequest) {\n const origOpen = XMLHttpRequest.prototype.open;\n XMLHttpRequest.prototype.open = function (...args: any[]) {\n this.addEventListener('load', function () {\n if (this.status === 400 || this.status === 422 || this.status === 500) {\n try {\n const data = JSON.parse(this.responseText);\n const errMsg = data?.error?.message || data?.message;\n if (\n typeof errMsg === 'string' &&\n (errMsg.startsWith('Validation Error') || errMsg.includes('cannot appear more than'))\n ) {\n showQuotaErrorToast(errMsg);\n }\n } catch {}\n }\n });\n return origOpen.apply(this, args as any);\n };\n }\n }\n try {\n const contentManagerPlugin = app.getPlugin('content-manager');\n if (contentManagerPlugin?.apis?.addDocumentAction) {\n contentManagerPlugin.apis.addDocumentAction((actions: any[]) => {\n if (window.strapi?.features?.isEnabled?.('cms-content-history')) {\n return actions;\n }\n\n const hasHistory = actions.some((a: any) => a.type === 'history' || a.id === 'content-history');\n if (hasHistory) return actions;\n\n const customHistoryAction = ({ model, document }: any) => {\n if (window.strapi?.features?.isEnabled?.('cms-content-history')) {\n return null;\n }\n\n return {\n icon: React.createElement(ClockCounterClockwise, {}),\n label: 'Content History',\n onClick: () => {\n const currentPath = window.location.pathname.replace(/\\/$/, '');\n if (!currentPath.endsWith('/history')) {\n window.location.href = `${currentPath}/history${window.location.search}`;\n }\n },\n disabled: !document || !document.id || !model?.startsWith('api::'),\n position: 'header',\n };\n };\n customHistoryAction.type = 'history';\n customHistoryAction.position = 'header';\n\n const deleteIndex = actions.findIndex((a: any) => a.type === 'delete');\n if (deleteIndex !== -1) {\n actions.splice(deleteIndex, 0, customHistoryAction);\n } else {\n actions.push(customHistoryAction);\n }\n return actions;\n });\n }\n } catch {}\n },\n};\n"],"names":["PLUGIN_ID","document","React"],"mappings":";;AAAO,MAAMA,cAAY;ACAlB,MAAM,YAAY;AAElB,MAAM,cAAc;AAAA;AAAA,EAEzB,MAAM,WAAW,SAAS;AAAA,EAC1B,QAAQ,WAAW,SAAS;AAAA;AAAA,EAG5B,eAAe,WAAW,SAAS;AAAA,EACnC,kBAAkB,WAAW,SAAS;AAAA,EACtC,kBAAkB,WAAW,SAAS;AAAA;AAAA,EAGtC,WAAW,WAAW,SAAS;AAAA,EAC/B,WAAW,WAAW,SAAS;AAAA;AAAA,EAG/B,WAAW,WAAW,SAAS;AAAA,EAC/B,cAAc,WAAW,SAAS;AAAA,EAClC,eAAe,WAAW,SAAS;AAAA;AAAA,EAGnC,cAAc,WAAW,SAAS;AAAA,EAClC,iBAAiB,WAAW,SAAS;AAAA,EACrC,gBAAgB,WAAW,SAAS;AAAA;AAAA,EAGpC,gBAAgB,WAAW,SAAS;AAAA,EACpC,kBAAkB,WAAW,SAAS;AAAA;AAAA,EAGtC,cAAc,WAAW,SAAS;AAAA,EAClC,gBAAgB,WAAW,SAAS;AACtC;AAOO,MAAM,wBAAwB;AAAA,EACnC,EAAE,QAAQ,YAAY,MAAM,SAAS,KAAA;AAAA,EACrC,EAAE,QAAQ,YAAY,QAAQ,SAAS,KAAA;AAAA,EACvC,EAAE,QAAQ,YAAY,eAAe,SAAS,KAAA;AAAA,EAC9C,EAAE,QAAQ,YAAY,WAAW,SAAS,KAAA;AAAA,EAC1C,EAAE,QAAQ,YAAY,cAAc,SAAS,KAAA;A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
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
5
+ const React__default = /* @__PURE__ */ _interopDefault(React);
6
+ const PLUGIN_ID$1 = "bulk-updater";
7
+ const PLUGIN_ID = "bulk-updater";
8
+ const PERMISSIONS = {
9
+ // General (support both .read and .access aliases)
10
+ read: `plugin::${PLUGIN_ID}.read`,
11
+ access: `plugin::${PLUGIN_ID}.access`,
12
+ // Workspace
13
+ workspaceView: `plugin::${PLUGIN_ID}.workspace.view`,
14
+ workspaceExecute: `plugin::${PLUGIN_ID}.workspace.execute`,
15
+ workspacePublish: `plugin::${PLUGIN_ID}.workspace.publish`,
16
+ // CSV Management
17
+ csvExport: `plugin::${PLUGIN_ID}.csv.export`,
18
+ csvImport: `plugin::${PLUGIN_ID}.csv.import`,
19
+ // Audit Trail
20
+ auditView: `plugin::${PLUGIN_ID}.audit.view`,
21
+ auditDetails: `plugin::${PLUGIN_ID}.audit.details`,
22
+ auditRollback: `plugin::${PLUGIN_ID}.audit.rollback`,
23
+ // Approvals (Maker-Checker)
24
+ approvalView: `plugin::${PLUGIN_ID}.approval.view`,
25
+ approvalApprove: `plugin::${PLUGIN_ID}.approval.approve`,
26
+ approvalReject: `plugin::${PLUGIN_ID}.approval.reject`,
27
+ // Validation Rules
28
+ validationView: `plugin::${PLUGIN_ID}.validation.view`,
29
+ validationManage: `plugin::${PLUGIN_ID}.validation.manage`,
30
+ // Settings
31
+ settingsView: `plugin::${PLUGIN_ID}.settings.view`,
32
+ settingsManage: `plugin::${PLUGIN_ID}.settings.manage`
33
+ };
34
+ const MAIN_MENU_PERMISSIONS = [
35
+ { action: PERMISSIONS.read, subject: null },
36
+ { action: PERMISSIONS.access, subject: null },
37
+ { action: PERMISSIONS.workspaceView, subject: null },
38
+ { action: PERMISSIONS.auditView, subject: null },
39
+ { action: PERMISSIONS.approvalView, subject: null },
40
+ { action: PERMISSIONS.validationView, subject: null },
41
+ { action: PERMISSIONS.csvExport, subject: null },
42
+ { action: PERMISSIONS.csvImport, subject: null }
43
+ ];
44
+ const SETTINGS_MENU_PERMISSIONS = [
45
+ { action: PERMISSIONS.settingsView, subject: null },
46
+ { action: PERMISSIONS.settingsManage, subject: null }
47
+ ];
48
+ function escapeHtml(str) {
49
+ return (str || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
50
+ }
51
+ function showQuotaErrorToast(message) {
52
+ if (typeof document === "undefined") return;
53
+ const existing = document.getElementById("strapi-quota-validation-banner");
54
+ if (existing) existing.remove();
55
+ let title = "Validation Error";
56
+ let detail = message;
57
+ const match = message.match(/^(Validation Error \([^)]+\)):\s*(.+)$/s);
58
+ if (match) {
59
+ title = match[1];
60
+ detail = match[2];
61
+ }
62
+ const banner = document.createElement("div");
63
+ banner.id = "strapi-quota-validation-banner";
64
+ banner.style.position = "fixed";
65
+ banner.style.top = "24px";
66
+ banner.style.left = "50%";
67
+ banner.style.transform = "translateX(-50%)";
68
+ banner.style.zIndex = "999999";
69
+ banner.style.minWidth = "420px";
70
+ banner.style.maxWidth = "720px";
71
+ banner.style.backgroundColor = "#D02B20";
72
+ banner.style.color = "#FFFFFF";
73
+ banner.style.padding = "14px 20px";
74
+ banner.style.borderRadius = "6px";
75
+ banner.style.boxShadow = "0 10px 25px rgba(0,0,0,0.35)";
76
+ banner.style.display = "flex";
77
+ banner.style.alignItems = "flex-start";
78
+ banner.style.gap = "12px";
79
+ banner.style.fontFamily = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
80
+ banner.style.fontSize = "14px";
81
+ banner.style.lineHeight = "1.45";
82
+ banner.style.transition = "opacity 0.2s ease-in-out";
83
+ banner.innerHTML = `
84
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink: 0; margin-top: 1px;">
85
+ <circle cx="12" cy="12" r="10"></circle>
86
+ <line x1="12" y1="8" x2="12" y2="12"></line>
87
+ <line x1="12" y1="16" x2="12.01" y2="16"></line>
88
+ </svg>
89
+ <div style="flex: 1;">
90
+ <div style="font-weight: 700; margin-bottom: 2px;">${escapeHtml(title)}</div>
91
+ <div style="opacity: 0.95;">${escapeHtml(detail)}</div>
92
+ </div>
93
+ <button style="background: none; border: none; color: #FFF; cursor: pointer; padding: 0 4px; font-size: 18px; line-height: 1; opacity: 0.8;" onclick="this.parentElement.remove()">×</button>
94
+ `;
95
+ document.body.appendChild(banner);
96
+ setTimeout(() => {
97
+ if (banner.parentElement) {
98
+ banner.style.opacity = "0";
99
+ setTimeout(() => banner.remove(), 250);
100
+ }
101
+ }, 1e4);
102
+ }
103
+ const index = {
104
+ register(app) {
105
+ app.addMenuLink({
106
+ to: `plugins/${PLUGIN_ID$1}`,
107
+ icon: icons.Pencil,
108
+ intlLabel: {
109
+ id: `${PLUGIN_ID$1}.plugin.name`,
110
+ defaultMessage: "Bulk Attribute Updater"
111
+ },
112
+ Component: () => Promise.resolve().then(() => require("./BulkUpdater-BSlEEUTV.js")),
113
+ permissions: MAIN_MENU_PERMISSIONS,
114
+ position: 3
115
+ });
116
+ app.addSettingsLink("global", {
117
+ id: `${PLUGIN_ID$1}-settings`,
118
+ intlLabel: {
119
+ id: `${PLUGIN_ID$1}.settings.name`,
120
+ defaultMessage: "Bulk Updater Settings"
121
+ },
122
+ to: `${PLUGIN_ID$1}`,
123
+ Component: () => Promise.resolve().then(() => require("./SettingsPage-BgEO2BNP.js")),
124
+ permissions: SETTINGS_MENU_PERMISSIONS
125
+ });
126
+ app.registerPlugin({
127
+ id: PLUGIN_ID$1,
128
+ name: PLUGIN_ID$1
129
+ });
130
+ app.customFields.register({
131
+ name: "scoped-select",
132
+ pluginId: PLUGIN_ID$1,
133
+ type: "string",
134
+ intlLabel: {
135
+ id: `${PLUGIN_ID$1}.scoped-select.label`,
136
+ defaultMessage: "Scoped Quota Select"
137
+ },
138
+ intlDescription: {
139
+ id: `${PLUGIN_ID$1}.scoped-select.description`,
140
+ defaultMessage: "Dropdown with dynamic cross-component usage quota enforcement"
141
+ },
142
+ components: {
143
+ Input: async () => Promise.resolve().then(() => require("./ScopedQuotaSelectInput-BC2Ge-Iv.js"))
144
+ }
145
+ });
146
+ },
147
+ bootstrap(app) {
148
+ if (typeof window !== "undefined" && !window.__bulk_updater_interceptor_installed) {
149
+ window.__bulk_updater_interceptor_installed = true;
150
+ if (window.fetch) {
151
+ const origFetch = window.fetch;
152
+ window.fetch = async function(...args) {
153
+ const response = await origFetch.apply(this, args);
154
+ if (response.status === 400 || response.status === 422 || response.status === 500) {
155
+ try {
156
+ const clone = response.clone();
157
+ const data = await clone.json();
158
+ const errMsg = data?.error?.message || data?.message;
159
+ if (typeof errMsg === "string" && (errMsg.startsWith("Validation Error") || errMsg.includes("cannot appear more than"))) {
160
+ showQuotaErrorToast(errMsg);
161
+ }
162
+ } catch {
163
+ }
164
+ }
165
+ return response;
166
+ };
167
+ }
168
+ if (window.XMLHttpRequest) {
169
+ const origOpen = XMLHttpRequest.prototype.open;
170
+ XMLHttpRequest.prototype.open = function(...args) {
171
+ this.addEventListener("load", function() {
172
+ if (this.status === 400 || this.status === 422 || this.status === 500) {
173
+ try {
174
+ const data = JSON.parse(this.responseText);
175
+ const errMsg = data?.error?.message || data?.message;
176
+ if (typeof errMsg === "string" && (errMsg.startsWith("Validation Error") || errMsg.includes("cannot appear more than"))) {
177
+ showQuotaErrorToast(errMsg);
178
+ }
179
+ } catch {
180
+ }
181
+ }
182
+ });
183
+ return origOpen.apply(this, args);
184
+ };
185
+ }
186
+ }
187
+ try {
188
+ const contentManagerPlugin = app.getPlugin("content-manager");
189
+ if (contentManagerPlugin?.apis?.addDocumentAction) {
190
+ contentManagerPlugin.apis.addDocumentAction((actions) => {
191
+ if (window.strapi?.features?.isEnabled?.("cms-content-history")) {
192
+ return actions;
193
+ }
194
+ const hasHistory = actions.some((a) => a.type === "history" || a.id === "content-history");
195
+ if (hasHistory) return actions;
196
+ const customHistoryAction = ({ model, document: document2 }) => {
197
+ if (window.strapi?.features?.isEnabled?.("cms-content-history")) {
198
+ return null;
199
+ }
200
+ return {
201
+ icon: React__default.default.createElement(icons.ClockCounterClockwise, {}),
202
+ label: "Content History",
203
+ onClick: () => {
204
+ const currentPath = window.location.pathname.replace(/\/$/, "");
205
+ if (!currentPath.endsWith("/history")) {
206
+ window.location.href = `${currentPath}/history${window.location.search}`;
207
+ }
208
+ },
209
+ disabled: !document2 || !document2.id || !model?.startsWith("api::"),
210
+ position: "header"
211
+ };
212
+ };
213
+ customHistoryAction.type = "history";
214
+ customHistoryAction.position = "header";
215
+ const deleteIndex = actions.findIndex((a) => a.type === "delete");
216
+ if (deleteIndex !== -1) {
217
+ actions.splice(deleteIndex, 0, customHistoryAction);
218
+ } else {
219
+ actions.push(customHistoryAction);
220
+ }
221
+ return actions;
222
+ });
223
+ }
224
+ } catch {
225
+ }
226
+ }
227
+ };
228
+ exports.PERMISSIONS = PERMISSIONS;
229
+ exports.index = index;
230
+ //# sourceMappingURL=index-CjR6IZqM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CjR6IZqM.js","sources":["../../admin/src/pluginId.ts","../../admin/src/constants/permissions.ts","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = 'bulk-updater';\n","export const PLUGIN_ID = 'bulk-updater';\n\nexport const PERMISSIONS = {\n // General (support both .read and .access aliases)\n read: `plugin::${PLUGIN_ID}.read`,\n access: `plugin::${PLUGIN_ID}.access`,\n\n // Workspace\n workspaceView: `plugin::${PLUGIN_ID}.workspace.view`,\n workspaceExecute: `plugin::${PLUGIN_ID}.workspace.execute`,\n workspacePublish: `plugin::${PLUGIN_ID}.workspace.publish`,\n\n // CSV Management\n csvExport: `plugin::${PLUGIN_ID}.csv.export`,\n csvImport: `plugin::${PLUGIN_ID}.csv.import`,\n\n // Audit Trail\n auditView: `plugin::${PLUGIN_ID}.audit.view`,\n auditDetails: `plugin::${PLUGIN_ID}.audit.details`,\n auditRollback: `plugin::${PLUGIN_ID}.audit.rollback`,\n\n // Approvals (Maker-Checker)\n approvalView: `plugin::${PLUGIN_ID}.approval.view`,\n approvalApprove: `plugin::${PLUGIN_ID}.approval.approve`,\n approvalReject: `plugin::${PLUGIN_ID}.approval.reject`,\n\n // Validation Rules\n validationView: `plugin::${PLUGIN_ID}.validation.view`,\n validationManage: `plugin::${PLUGIN_ID}.validation.manage`,\n\n // Settings\n settingsView: `plugin::${PLUGIN_ID}.settings.view`,\n settingsManage: `plugin::${PLUGIN_ID}.settings.manage`,\n} as const;\n\n/**\n * Menu link permission guards:\n * If the user has ANY of the main functional permissions or the general access permission,\n * the main menu link will be displayed in Strapi's navigation bar.\n */\nexport const MAIN_MENU_PERMISSIONS = [\n { action: PERMISSIONS.read, subject: null },\n { action: PERMISSIONS.access, subject: null },\n { action: PERMISSIONS.workspaceView, subject: null },\n { action: PERMISSIONS.auditView, subject: null },\n { action: PERMISSIONS.approvalView, subject: null },\n { action: PERMISSIONS.validationView, subject: null },\n { action: PERMISSIONS.csvExport, subject: null },\n { action: PERMISSIONS.csvImport, subject: null },\n];\n\nexport const SETTINGS_MENU_PERMISSIONS = [\n { action: PERMISSIONS.settingsView, subject: null },\n { action: PERMISSIONS.settingsManage, subject: null },\n];\n","import React from 'react';\nimport { PLUGIN_ID } from './pluginId';\nimport { Pencil, ClockCounterClockwise } from '@strapi/icons';\nimport { MAIN_MENU_PERMISSIONS, SETTINGS_MENU_PERMISSIONS } from './constants/permissions';\n\nfunction escapeHtml(str: string): string {\n return (str || '')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;');\n}\n\nfunction showQuotaErrorToast(message: string) {\n if (typeof document === 'undefined') return;\n const existing = document.getElementById('strapi-quota-validation-banner');\n if (existing) existing.remove();\n\n let title = 'Validation Error';\n let detail = message;\n const match = message.match(/^(Validation Error \\([^)]+\\)):\\s*(.+)$/s);\n if (match) {\n title = match[1];\n detail = match[2];\n }\n\n const banner = document.createElement('div');\n banner.id = 'strapi-quota-validation-banner';\n banner.style.position = 'fixed';\n banner.style.top = '24px';\n banner.style.left = '50%';\n banner.style.transform = 'translateX(-50%)';\n banner.style.zIndex = '999999';\n banner.style.minWidth = '420px';\n banner.style.maxWidth = '720px';\n banner.style.backgroundColor = '#D02B20';\n banner.style.color = '#FFFFFF';\n banner.style.padding = '14px 20px';\n banner.style.borderRadius = '6px';\n banner.style.boxShadow = '0 10px 25px rgba(0,0,0,0.35)';\n banner.style.display = 'flex';\n banner.style.alignItems = 'flex-start';\n banner.style.gap = '12px';\n banner.style.fontFamily = '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif';\n banner.style.fontSize = '14px';\n banner.style.lineHeight = '1.45';\n banner.style.transition = 'opacity 0.2s ease-in-out';\n\n banner.innerHTML = `\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"flex-shrink: 0; margin-top: 1px;\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line>\n <line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>\n </svg>\n <div style=\"flex: 1;\">\n <div style=\"font-weight: 700; margin-bottom: 2px;\">${escapeHtml(title)}</div>\n <div style=\"opacity: 0.95;\">${escapeHtml(detail)}</div>\n </div>\n <button style=\"background: none; border: none; color: #FFF; cursor: pointer; padding: 0 4px; font-size: 18px; line-height: 1; opacity: 0.8;\" onclick=\"this.parentElement.remove()\">×</button>\n `;\n\n document.body.appendChild(banner);\n\n setTimeout(() => {\n if (banner.parentElement) {\n banner.style.opacity = '0';\n setTimeout(() => banner.remove(), 250);\n }\n }, 10000);\n}\n\nexport default {\n register(app: any) {\n app.addMenuLink({\n to: `plugins/${PLUGIN_ID}`,\n icon: Pencil,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: 'Bulk Attribute Updater',\n },\n Component: () => import('./pages/BulkUpdater'),\n permissions: MAIN_MENU_PERMISSIONS,\n position: 3,\n });\n\n app.addSettingsLink('global', {\n id: `${PLUGIN_ID}-settings`,\n intlLabel: {\n id: `${PLUGIN_ID}.settings.name`,\n defaultMessage: 'Bulk Updater Settings',\n },\n to: `${PLUGIN_ID}`,\n Component: () => import('./pages/SettingsPage'),\n permissions: SETTINGS_MENU_PERMISSIONS,\n });\n\n app.registerPlugin({\n id: PLUGIN_ID,\n name: PLUGIN_ID,\n });\n\n app.customFields.register({\n name: 'scoped-select',\n pluginId: PLUGIN_ID,\n type: 'string',\n intlLabel: {\n id: `${PLUGIN_ID}.scoped-select.label`,\n defaultMessage: 'Scoped Quota Select',\n },\n intlDescription: {\n id: `${PLUGIN_ID}.scoped-select.description`,\n defaultMessage: 'Dropdown with dynamic cross-component usage quota enforcement',\n },\n components: {\n Input: async () => import('./components/ScopedQuotaSelectInput'),\n },\n });\n },\n bootstrap(app: any) {\n // Install global response interceptor for quota validation rule error banners\n if (typeof window !== 'undefined' && !(window as any).__bulk_updater_interceptor_installed) {\n (window as any).__bulk_updater_interceptor_installed = true;\n\n if (window.fetch) {\n const origFetch = window.fetch;\n window.fetch = async function (...args) {\n const response = await origFetch.apply(this, args);\n if (response.status === 400 || response.status === 422 || response.status === 500) {\n try {\n const clone = response.clone();\n const data = await clone.json();\n const errMsg = data?.error?.message || data?.message;\n if (\n typeof errMsg === 'string' &&\n (errMsg.startsWith('Validation Error') || errMsg.includes('cannot appear more than'))\n ) {\n showQuotaErrorToast(errMsg);\n }\n } catch {}\n }\n return response;\n };\n }\n\n if ((window as any).XMLHttpRequest) {\n const origOpen = XMLHttpRequest.prototype.open;\n XMLHttpRequest.prototype.open = function (...args: any[]) {\n this.addEventListener('load', function () {\n if (this.status === 400 || this.status === 422 || this.status === 500) {\n try {\n const data = JSON.parse(this.responseText);\n const errMsg = data?.error?.message || data?.message;\n if (\n typeof errMsg === 'string' &&\n (errMsg.startsWith('Validation Error') || errMsg.includes('cannot appear more than'))\n ) {\n showQuotaErrorToast(errMsg);\n }\n } catch {}\n }\n });\n return origOpen.apply(this, args as any);\n };\n }\n }\n try {\n const contentManagerPlugin = app.getPlugin('content-manager');\n if (contentManagerPlugin?.apis?.addDocumentAction) {\n contentManagerPlugin.apis.addDocumentAction((actions: any[]) => {\n if (window.strapi?.features?.isEnabled?.('cms-content-history')) {\n return actions;\n }\n\n const hasHistory = actions.some((a: any) => a.type === 'history' || a.id === 'content-history');\n if (hasHistory) return actions;\n\n const customHistoryAction = ({ model, document }: any) => {\n if (window.strapi?.features?.isEnabled?.('cms-content-history')) {\n return null;\n }\n\n return {\n icon: React.createElement(ClockCounterClockwise, {}),\n label: 'Content History',\n onClick: () => {\n const currentPath = window.location.pathname.replace(/\\/$/, '');\n if (!currentPath.endsWith('/history')) {\n window.location.href = `${currentPath}/history${window.location.search}`;\n }\n },\n disabled: !document || !document.id || !model?.startsWith('api::'),\n position: 'header',\n };\n };\n customHistoryAction.type = 'history';\n customHistoryAction.position = 'header';\n\n const deleteIndex = actions.findIndex((a: any) => a.type === 'delete');\n if (deleteIndex !== -1) {\n actions.splice(deleteIndex, 0, customHistoryAction);\n } else {\n actions.push(customHistoryAction);\n }\n return actions;\n });\n }\n } catch {}\n },\n};\n"],"names":["PLUGIN_ID","Pencil","document","React","ClockCounterClockwise"],"mappings":";;;;;AAAO,MAAMA,cAAY;ACAlB,MAAM,YAAY;AAElB,MAAM,cAAc;AAAA;AAAA,EAEzB,MAAM,WAAW,SAAS;AAAA,EAC1B,QAAQ,WAAW,SAAS;AAAA;AAAA,EAG5B,eAAe,WAAW,SAAS;AAAA,EACnC,kBAAkB,WAAW,SAAS;AAAA,EACtC,kBAAkB,WAAW,SAAS;AAAA;AAAA,EAGtC,WAAW,WAAW,SAAS;AAAA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