payload-wordpress-migrator 0.0.22
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/LICENSE +21 -0
- package/README.md +586 -0
- package/dist/components/BeforeDashboardClient.d.ts +14 -0
- package/dist/components/BeforeDashboardClient.js +225 -0
- package/dist/components/BeforeDashboardClient.js.map +1 -0
- package/dist/components/BeforeDashboardClient.module.css +175 -0
- package/dist/components/BeforeDashboardServer.d.ts +1 -0
- package/dist/components/BeforeDashboardServer.js +29 -0
- package/dist/components/BeforeDashboardServer.js.map +1 -0
- package/dist/components/ContentTypeSelect.d.ts +4 -0
- package/dist/components/ContentTypeSelect.js +147 -0
- package/dist/components/ContentTypeSelect.js.map +1 -0
- package/dist/components/FieldMappingConfiguration.d.ts +5 -0
- package/dist/components/FieldMappingConfiguration.js +361 -0
- package/dist/components/FieldMappingConfiguration.js.map +1 -0
- package/dist/components/FieldMappingConfiguration.module.css +75 -0
- package/dist/components/MigrationDashboardClient.d.ts +6 -0
- package/dist/components/MigrationDashboardClient.js +49 -0
- package/dist/components/MigrationDashboardClient.js.map +1 -0
- package/dist/components/MigrationDashboardClient.module.css +749 -0
- package/dist/components/SimpleFieldMapping.d.ts +5 -0
- package/dist/components/SimpleFieldMapping.js +437 -0
- package/dist/components/SimpleFieldMapping.js.map +1 -0
- package/dist/components/dashboard/JobActionButtons.d.ts +8 -0
- package/dist/components/dashboard/JobActionButtons.js +91 -0
- package/dist/components/dashboard/JobActionButtons.js.map +1 -0
- package/dist/components/dashboard/JobsTable.d.ts +6 -0
- package/dist/components/dashboard/JobsTable.js +86 -0
- package/dist/components/dashboard/JobsTable.js.map +1 -0
- package/dist/components/dashboard/LogViewer.d.ts +3 -0
- package/dist/components/dashboard/LogViewer.js +35 -0
- package/dist/components/dashboard/LogViewer.js.map +1 -0
- package/dist/components/dashboard/SiteConfigPanel.d.ts +12 -0
- package/dist/components/dashboard/SiteConfigPanel.js +205 -0
- package/dist/components/dashboard/SiteConfigPanel.js.map +1 -0
- package/dist/components/dashboard/StatsOverview.d.ts +5 -0
- package/dist/components/dashboard/StatsOverview.js +72 -0
- package/dist/components/dashboard/StatsOverview.js.map +1 -0
- package/dist/components/dashboard/index.d.ts +7 -0
- package/dist/components/dashboard/index.js +7 -0
- package/dist/components/dashboard/index.js.map +1 -0
- package/dist/components/dashboard/types.d.ts +46 -0
- package/dist/components/dashboard/types.js +2 -0
- package/dist/components/dashboard/types.js.map +1 -0
- package/dist/components/dashboard/useMigrationDashboard.d.ts +15 -0
- package/dist/components/dashboard/useMigrationDashboard.js +584 -0
- package/dist/components/dashboard/useMigrationDashboard.js.map +1 -0
- package/dist/exports/client.d.ts +4 -0
- package/dist/exports/client.js +5 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +2 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +443 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/content/blocks.d.ts +6 -0
- package/dist/utils/content/blocks.js +93 -0
- package/dist/utils/content/blocks.js.map +1 -0
- package/dist/utils/content/fieldMapping.d.ts +9 -0
- package/dist/utils/content/fieldMapping.js +218 -0
- package/dist/utils/content/fieldMapping.js.map +1 -0
- package/dist/utils/content/index.d.ts +4 -0
- package/dist/utils/content/index.js +4 -0
- package/dist/utils/content/index.js.map +1 -0
- package/dist/utils/content/transformer.d.ts +5 -0
- package/dist/utils/content/transformer.js +323 -0
- package/dist/utils/content/transformer.js.map +1 -0
- package/dist/utils/endpoints/handlers.d.ts +9 -0
- package/dist/utils/endpoints/handlers.js +201 -0
- package/dist/utils/endpoints/handlers.js.map +1 -0
- package/dist/utils/endpoints/index.d.ts +2 -0
- package/dist/utils/endpoints/index.js +2 -0
- package/dist/utils/endpoints/index.js.map +1 -0
- package/dist/utils/fields/analyzer.d.ts +7 -0
- package/dist/utils/fields/analyzer.js +502 -0
- package/dist/utils/fields/analyzer.js.map +1 -0
- package/dist/utils/fields/index.d.ts +2 -0
- package/dist/utils/fields/index.js +2 -0
- package/dist/utils/fields/index.js.map +1 -0
- package/dist/utils/helpers/auth.d.ts +9 -0
- package/dist/utils/helpers/auth.js +50 -0
- package/dist/utils/helpers/auth.js.map +1 -0
- package/dist/utils/helpers/cache.d.ts +11 -0
- package/dist/utils/helpers/cache.js +47 -0
- package/dist/utils/helpers/cache.js.map +1 -0
- package/dist/utils/helpers/concurrency.d.ts +2 -0
- package/dist/utils/helpers/concurrency.js +26 -0
- package/dist/utils/helpers/concurrency.js.map +1 -0
- package/dist/utils/helpers/index.d.ts +8 -0
- package/dist/utils/helpers/index.js +8 -0
- package/dist/utils/helpers/index.js.map +1 -0
- package/dist/utils/helpers/objectHelpers.d.ts +3 -0
- package/dist/utils/helpers/objectHelpers.js +22 -0
- package/dist/utils/helpers/objectHelpers.js.map +1 -0
- package/dist/utils/helpers/rateLimiter.d.ts +10 -0
- package/dist/utils/helpers/rateLimiter.js +29 -0
- package/dist/utils/helpers/rateLimiter.js.map +1 -0
- package/dist/utils/helpers/responses.d.ts +3 -0
- package/dist/utils/helpers/responses.js +23 -0
- package/dist/utils/helpers/responses.js.map +1 -0
- package/dist/utils/helpers/wpHelpers.d.ts +6 -0
- package/dist/utils/helpers/wpHelpers.js +29 -0
- package/dist/utils/helpers/wpHelpers.js.map +1 -0
- package/dist/utils/lexical/constants.d.ts +37 -0
- package/dist/utils/lexical/constants.js +58 -0
- package/dist/utils/lexical/constants.js.map +1 -0
- package/dist/utils/lexical/htmlParser.d.ts +20 -0
- package/dist/utils/lexical/htmlParser.js +253 -0
- package/dist/utils/lexical/htmlParser.js.map +1 -0
- package/dist/utils/lexical/htmlToLexicalConverter.d.ts +55 -0
- package/dist/utils/lexical/htmlToLexicalConverter.js +999 -0
- package/dist/utils/lexical/htmlToLexicalConverter.js.map +1 -0
- package/dist/utils/lexical/index.d.ts +5 -0
- package/dist/utils/lexical/index.js +4 -0
- package/dist/utils/lexical/index.js.map +1 -0
- package/dist/utils/lexical/nodeFactories.d.ts +21 -0
- package/dist/utils/lexical/nodeFactories.js +91 -0
- package/dist/utils/lexical/nodeFactories.js.map +1 -0
- package/dist/utils/lexical/preprocessor.d.ts +4 -0
- package/dist/utils/lexical/preprocessor.js +302 -0
- package/dist/utils/lexical/preprocessor.js.map +1 -0
- package/dist/utils/media/download.d.ts +7 -0
- package/dist/utils/media/download.js +85 -0
- package/dist/utils/media/download.js.map +1 -0
- package/dist/utils/media/extraction.d.ts +12 -0
- package/dist/utils/media/extraction.js +58 -0
- package/dist/utils/media/extraction.js.map +1 -0
- package/dist/utils/media/import.d.ts +7 -0
- package/dist/utils/media/import.js +146 -0
- package/dist/utils/media/import.js.map +1 -0
- package/dist/utils/media/index.d.ts +6 -0
- package/dist/utils/media/index.js +6 -0
- package/dist/utils/media/index.js.map +1 -0
- package/dist/utils/media/upload.d.ts +4 -0
- package/dist/utils/media/upload.js +46 -0
- package/dist/utils/media/upload.js.map +1 -0
- package/dist/utils/media/validation.d.ts +8 -0
- package/dist/utils/media/validation.js +60 -0
- package/dist/utils/media/validation.js.map +1 -0
- package/dist/utils/migration/index.d.ts +3 -0
- package/dist/utils/migration/index.js +3 -0
- package/dist/utils/migration/index.js.map +1 -0
- package/dist/utils/migration/jobCrud.d.ts +4 -0
- package/dist/utils/migration/jobCrud.js +380 -0
- package/dist/utils/migration/jobCrud.js.map +1 -0
- package/dist/utils/migration/orchestrator.d.ts +5 -0
- package/dist/utils/migration/orchestrator.js +756 -0
- package/dist/utils/migration/orchestrator.js.map +1 -0
- package/dist/utils/types.d.ts +201 -0
- package/dist/utils/types.js +14 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/wordpress/client.d.ts +61 -0
- package/dist/utils/wordpress/client.js +365 -0
- package/dist/utils/wordpress/client.js.map +1 -0
- package/dist/utils/wordpress/index.d.ts +2 -0
- package/dist/utils/wordpress/index.js +2 -0
- package/dist/utils/wordpress/index.js.map +1 -0
- package/dist/utils/wordpressApi.d.ts +11 -0
- package/dist/utils/wordpressApi.js +25 -0
- package/dist/utils/wordpressApi.js.map +1 -0
- package/package.json +155 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import styles from './BeforeDashboardClient.module.css';
|
|
5
|
+
|
|
6
|
+
const BeforeDashboardClient = ({ forms: initialForms })=>{
|
|
7
|
+
const [loading, setLoading] = useState(false);
|
|
8
|
+
const [copiedId, setCopiedId] = useState(null);
|
|
9
|
+
const [forms, setForms] = useState(initialForms || []);
|
|
10
|
+
if (!forms || !Array.isArray(forms)) {
|
|
11
|
+
return /*#__PURE__*/ jsx("div", {
|
|
12
|
+
children: "No HubSpot forms available"
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const totalSubmissions = forms.reduce((sum, form)=>sum + form.stats.submissions, 0);
|
|
16
|
+
const totalViews = forms.reduce((sum, form)=>sum + form.stats.views, 0);
|
|
17
|
+
const validConversionRates = forms.filter((form)=>form.stats.conversionRate !== undefined);
|
|
18
|
+
const averageConversionRate = validConversionRates.length > 0 ? validConversionRates.reduce((sum, form)=>sum + form.stats.conversionRate, 0) / validConversionRates.length : undefined;
|
|
19
|
+
const copyToClipboard = (text)=>{
|
|
20
|
+
void navigator.clipboard.writeText(text);
|
|
21
|
+
setCopiedId(text);
|
|
22
|
+
setTimeout(()=>setCopiedId(null), 2000);
|
|
23
|
+
};
|
|
24
|
+
if (loading) {
|
|
25
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
26
|
+
className: styles.hubspotDashboard,
|
|
27
|
+
children: [
|
|
28
|
+
/*#__PURE__*/ jsx("div", {
|
|
29
|
+
className: styles.loadingSpinner
|
|
30
|
+
}),
|
|
31
|
+
"Loading HubSpot dashboard..."
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
36
|
+
className: "gutter--left gutter--right collection-list__wrap",
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ jsxs("div", {
|
|
39
|
+
className: styles.hubspotDashboardHeader,
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ jsx("h1", {
|
|
42
|
+
children: "HubSpot Forms Overview"
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsx("button", {
|
|
45
|
+
className: styles.refreshButton,
|
|
46
|
+
onClick: async ()=>{
|
|
47
|
+
try {
|
|
48
|
+
setLoading(true);
|
|
49
|
+
const response = await fetch('/api/hubspot/forms?refresh=true');
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
throw new Error('Failed to refresh forms');
|
|
52
|
+
}
|
|
53
|
+
const newForms = await response.json();
|
|
54
|
+
setForms(newForms);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error('Error refreshing forms:', error);
|
|
57
|
+
} finally{
|
|
58
|
+
setLoading(false);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
type: "button",
|
|
62
|
+
children: "Refresh Data"
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
}),
|
|
66
|
+
/*#__PURE__*/ jsxs("div", {
|
|
67
|
+
className: styles.hubspotDashboardStats,
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ jsxs("div", {
|
|
70
|
+
className: styles.statCard,
|
|
71
|
+
children: [
|
|
72
|
+
/*#__PURE__*/ jsx("h3", {
|
|
73
|
+
children: "Total Forms"
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ jsx("p", {
|
|
76
|
+
children: forms.length
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
}),
|
|
80
|
+
/*#__PURE__*/ jsxs("div", {
|
|
81
|
+
className: styles.statCard,
|
|
82
|
+
children: [
|
|
83
|
+
/*#__PURE__*/ jsx("h3", {
|
|
84
|
+
children: "Total Views"
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ jsx("p", {
|
|
87
|
+
children: totalViews
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ jsxs("div", {
|
|
92
|
+
className: styles.statCard,
|
|
93
|
+
children: [
|
|
94
|
+
/*#__PURE__*/ jsx("h3", {
|
|
95
|
+
children: "Total Submissions"
|
|
96
|
+
}),
|
|
97
|
+
/*#__PURE__*/ jsx("p", {
|
|
98
|
+
children: totalSubmissions
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
}),
|
|
102
|
+
/*#__PURE__*/ jsxs("div", {
|
|
103
|
+
className: styles.statCard,
|
|
104
|
+
children: [
|
|
105
|
+
/*#__PURE__*/ jsx("h3", {
|
|
106
|
+
children: "Avg. Conversion Rate"
|
|
107
|
+
}),
|
|
108
|
+
/*#__PURE__*/ jsx("p", {
|
|
109
|
+
children: averageConversionRate ? `${(averageConversionRate * 100).toFixed(1)}%` : 'N/A'
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ jsxs("div", {
|
|
116
|
+
className: styles.hubspotDashboardRecent,
|
|
117
|
+
children: [
|
|
118
|
+
/*#__PURE__*/ jsx("h3", {
|
|
119
|
+
children: "All Available Forms"
|
|
120
|
+
}),
|
|
121
|
+
/*#__PURE__*/ jsx("div", {
|
|
122
|
+
className: styles.tableContainer,
|
|
123
|
+
children: /*#__PURE__*/ jsxs("table", {
|
|
124
|
+
children: [
|
|
125
|
+
/*#__PURE__*/ jsx("thead", {
|
|
126
|
+
children: /*#__PURE__*/ jsxs("tr", {
|
|
127
|
+
children: [
|
|
128
|
+
/*#__PURE__*/ jsx("th", {
|
|
129
|
+
children: "Form Name"
|
|
130
|
+
}),
|
|
131
|
+
/*#__PURE__*/ jsx("th", {
|
|
132
|
+
children: "Form ID"
|
|
133
|
+
}),
|
|
134
|
+
/*#__PURE__*/ jsx("th", {
|
|
135
|
+
children: "Views"
|
|
136
|
+
}),
|
|
137
|
+
/*#__PURE__*/ jsx("th", {
|
|
138
|
+
children: "Submissions"
|
|
139
|
+
}),
|
|
140
|
+
/*#__PURE__*/ jsx("th", {
|
|
141
|
+
children: "Conversion Rate"
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
})
|
|
145
|
+
}),
|
|
146
|
+
/*#__PURE__*/ jsx("tbody", {
|
|
147
|
+
children: forms.sort((a, b)=>b.stats.views - a.stats.views).map((form)=>/*#__PURE__*/ jsxs("tr", {
|
|
148
|
+
children: [
|
|
149
|
+
/*#__PURE__*/ jsx("td", {
|
|
150
|
+
children: form.name
|
|
151
|
+
}),
|
|
152
|
+
/*#__PURE__*/ jsx("td", {
|
|
153
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
154
|
+
className: styles.copyContainer,
|
|
155
|
+
children: [
|
|
156
|
+
form.guid,
|
|
157
|
+
/*#__PURE__*/ jsx("button", {
|
|
158
|
+
className: styles.copyButton,
|
|
159
|
+
onClick: ()=>copyToClipboard(form.guid),
|
|
160
|
+
title: "Copy to clipboard",
|
|
161
|
+
type: "button",
|
|
162
|
+
children: copiedId === form.guid ? /*#__PURE__*/ jsx("svg", {
|
|
163
|
+
fill: "none",
|
|
164
|
+
height: "16",
|
|
165
|
+
stroke: "currentColor",
|
|
166
|
+
strokeLinecap: "round",
|
|
167
|
+
strokeLinejoin: "round",
|
|
168
|
+
strokeWidth: "2",
|
|
169
|
+
viewBox: "0 0 24 24",
|
|
170
|
+
width: "16",
|
|
171
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
172
|
+
children: /*#__PURE__*/ jsx("polyline", {
|
|
173
|
+
points: "20 6 9 17 4 12"
|
|
174
|
+
})
|
|
175
|
+
}) : /*#__PURE__*/ jsxs("svg", {
|
|
176
|
+
fill: "none",
|
|
177
|
+
height: "16",
|
|
178
|
+
stroke: "currentColor",
|
|
179
|
+
strokeLinecap: "round",
|
|
180
|
+
strokeLinejoin: "round",
|
|
181
|
+
strokeWidth: "2",
|
|
182
|
+
viewBox: "0 0 24 24",
|
|
183
|
+
width: "16",
|
|
184
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
185
|
+
children: [
|
|
186
|
+
/*#__PURE__*/ jsx("rect", {
|
|
187
|
+
height: "13",
|
|
188
|
+
rx: "2",
|
|
189
|
+
ry: "2",
|
|
190
|
+
width: "13",
|
|
191
|
+
x: "9",
|
|
192
|
+
y: "9"
|
|
193
|
+
}),
|
|
194
|
+
/*#__PURE__*/ jsx("path", {
|
|
195
|
+
d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
]
|
|
201
|
+
})
|
|
202
|
+
}),
|
|
203
|
+
/*#__PURE__*/ jsx("td", {
|
|
204
|
+
children: form.stats.views
|
|
205
|
+
}),
|
|
206
|
+
/*#__PURE__*/ jsx("td", {
|
|
207
|
+
children: form.stats.submissions
|
|
208
|
+
}),
|
|
209
|
+
/*#__PURE__*/ jsx("td", {
|
|
210
|
+
children: form.stats.conversionRate === undefined ? 'N/A' : `${(form.stats.conversionRate * 100).toFixed(1)}%`
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
}, form.guid))
|
|
214
|
+
})
|
|
215
|
+
]
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export { BeforeDashboardClient };
|
|
225
|
+
//# sourceMappingURL=BeforeDashboardClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BeforeDashboardClient.js","sources":["../../src/components/BeforeDashboardClient.tsx"],"sourcesContent":["'use client'\n\nimport React, { useState } from 'react'\n\nimport styles from './BeforeDashboardClient.module.css'\n\ntype HubSpotForm = {\n guid: string\n name: string\n stats: {\n conversionRate: number\n submissions: number\n views: number\n }\n}\n\ntype BeforeDashboardClientProps = {\n forms: HubSpotForm[]\n}\n\nexport const BeforeDashboardClient = ({ forms: initialForms }: BeforeDashboardClientProps) => {\n const [loading, setLoading] = useState(false)\n const [copiedId, setCopiedId] = useState<null | string>(null)\n const [forms, setForms] = useState<HubSpotForm[]>(initialForms || [])\n\n if (!forms || !Array.isArray(forms)) {\n return <div>No HubSpot forms available</div>\n }\n\n const totalSubmissions = forms.reduce((sum, form) => sum + form.stats.submissions, 0)\n const totalViews = forms.reduce((sum, form) => sum + form.stats.views, 0)\n const validConversionRates = forms.filter(form => form.stats.conversionRate !== undefined)\n const averageConversionRate = validConversionRates.length > 0\n ? validConversionRates.reduce((sum, form) => sum + form.stats.conversionRate, 0) / validConversionRates.length\n : undefined\n\n const copyToClipboard = (text: string) => {\n void navigator.clipboard.writeText(text)\n setCopiedId(text)\n setTimeout(() => setCopiedId(null), 2000)\n }\n\n if (loading) {\n return (\n <div className={styles.hubspotDashboard}>\n <div className={styles.loadingSpinner} />\n Loading HubSpot dashboard...\n </div>\n )\n }\n\n return (\n <div className=\"gutter--left gutter--right collection-list__wrap\">\n <div className={styles.hubspotDashboardHeader}>\n <h1>HubSpot Forms Overview</h1>\n <button\n className={styles.refreshButton}\n onClick={async () => {\n try {\n setLoading(true)\n const response = await fetch('/api/hubspot/forms?refresh=true')\n if (!response.ok) {\n throw new Error('Failed to refresh forms')\n }\n const newForms = await response.json()\n setForms(newForms)\n } catch (error) {\n console.error('Error refreshing forms:', error)\n } finally {\n setLoading(false)\n }\n }}\n type=\"button\"\n >\n Refresh Data\n </button>\n </div>\n\n <div className={styles.hubspotDashboardStats}>\n <div className={styles.statCard}>\n <h3>Total Forms</h3>\n <p>{forms.length}</p>\n </div>\n <div className={styles.statCard}>\n <h3>Total Views</h3>\n <p>{totalViews}</p>\n </div>\n <div className={styles.statCard}>\n <h3>Total Submissions</h3>\n <p>{totalSubmissions}</p>\n </div>\n <div className={styles.statCard}>\n <h3>Avg. Conversion Rate</h3>\n <p>{averageConversionRate ? `${(averageConversionRate * 100).toFixed(1)}%` : 'N/A'}</p>\n </div>\n </div>\n\n <div className={styles.hubspotDashboardRecent}>\n <h3>All Available Forms</h3>\n <div className={styles.tableContainer}>\n <table>\n <thead>\n <tr>\n <th>Form Name</th>\n <th>Form ID</th>\n <th>Views</th>\n <th>Submissions</th>\n <th>Conversion Rate</th>\n </tr>\n </thead>\n <tbody>\n {forms\n .sort((a, b) => b.stats.views - a.stats.views)\n .map((form) => (\n <tr key={form.guid}>\n <td>{form.name}</td>\n <td>\n <div className={styles.copyContainer}>\n {form.guid}\n <button\n className={styles.copyButton}\n onClick={() => copyToClipboard(form.guid)}\n title=\"Copy to clipboard\"\n type=\"button\"\n >\n {copiedId === form.guid ? (\n <svg\n fill=\"none\"\n height=\"16\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <polyline points=\"20 6 9 17 4 12\"></polyline>\n </svg>\n ) : (\n <svg\n fill=\"none\"\n height=\"16\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <rect height=\"13\" rx=\"2\" ry=\"2\" width=\"13\" x=\"9\" y=\"9\"></rect>\n <path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"></path>\n </svg>\n )}\n </button>\n </div>\n </td>\n <td>{form.stats.views}</td>\n <td>{form.stats.submissions}</td>\n <td>{form.stats.conversionRate === undefined ? 'N/A' : `${(form.stats.conversionRate * 100).toFixed(1)}%`}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n </div>\n )\n}\n"],"names":["className","forms","totalViews","totalSubmissions","form"],"mappings":";;;;;;AAqBE;AACA;AACA;AAEA;AACE;AAAY;;AACd;AAEA;AACA;;;AAMA;AACE;;;AAGF;AAEA;AACE;AACOA;;;AACEA;;AAAoC;;;AAI/C;AAEA;;;;AAESA;;;AACC;;;AAEFA;;;;;;AAMM;AACF;;;AAGF;;;;AAIA;AACF;;AAED;;;;;AAKEA;;;AACEA;;;AACC;;;AACAC;;;;;AAEDD;;;AACC;;;AACAE;;;;;AAEDF;;;AACC;;;AACAG;;;;;AAEDH;;;AACC;;;;;;;;;;AAKHA;;;AACC;;;AACCA;AACH;;;AAEI;;;AACM;;;AACA;;;AACA;;;AACA;;;AACA;;;;;;AAILC;;;AAIUG;;;AAEH;AAAKJ;;AACFI;;AAECJ;;;;;;;;;;;;;;AAiBI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAvBHI;;;;;;;;;AAuD3B;;"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
.hubspotDashboard {
|
|
2
|
+
padding: 20px 60px;
|
|
3
|
+
background: var(--theme-elevation-0);
|
|
4
|
+
border-radius: 8px;
|
|
5
|
+
margin-bottom: 2rem;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.hubspotDashboardLoading {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 1rem;
|
|
12
|
+
color: var(--theme-elevation-400);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.errorMessage {
|
|
16
|
+
color: var(--theme-error-500);
|
|
17
|
+
background: var(--theme-error-100);
|
|
18
|
+
padding: 1rem;
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
border: 1px solid var(--theme-error-200);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.errorMessage h3 {
|
|
24
|
+
margin: 0 0 0.5rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.errorMessage p {
|
|
28
|
+
margin: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.hubspotDashboardHeader {
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
align-items: center;
|
|
35
|
+
margin-bottom: 2rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.hubspotDashboardHeader h2 {
|
|
39
|
+
margin: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.refreshButton {
|
|
43
|
+
padding: 0.5rem 1rem;
|
|
44
|
+
background: var(--theme-elevation-100);
|
|
45
|
+
border: 1px solid var(--theme-elevation-200);
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
transition: all 0.2s ease;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.refreshButton:hover {
|
|
52
|
+
background: var(--theme-elevation-200);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.hubspotDashboardStats {
|
|
56
|
+
display: grid;
|
|
57
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
58
|
+
gap: 1rem;
|
|
59
|
+
margin-bottom: 2rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.statCard {
|
|
63
|
+
padding: 1.5rem;
|
|
64
|
+
background: var(--theme-elevation-50);
|
|
65
|
+
border: 1px solid var(--theme-elevation-100);
|
|
66
|
+
border-radius: 6px;
|
|
67
|
+
text-align: center;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.statCard h3 {
|
|
71
|
+
margin: 0;
|
|
72
|
+
color: var(--theme-elevation-400);
|
|
73
|
+
font-size: 0.875rem;
|
|
74
|
+
font-weight: 500;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.statCard p {
|
|
78
|
+
margin: 0.5rem 0 0;
|
|
79
|
+
font-size: 1.5rem;
|
|
80
|
+
font-weight: 600;
|
|
81
|
+
color: var(--theme-elevation-800);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.hubspotDashboardRecent h3 {
|
|
85
|
+
margin: 0 0 1rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.tableContainer {
|
|
89
|
+
overflow-x: auto;
|
|
90
|
+
border: 1px solid var(--theme-elevation-100);
|
|
91
|
+
border-radius: 6px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tableContainer table {
|
|
95
|
+
width: 100%;
|
|
96
|
+
border-collapse: collapse;
|
|
97
|
+
font-size: 0.875rem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.tableContainer th,
|
|
101
|
+
.tableContainer td {
|
|
102
|
+
padding: 0.75rem 1rem;
|
|
103
|
+
text-align: left;
|
|
104
|
+
border-bottom: 1px solid var(--theme-elevation-100);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.tableContainer th {
|
|
108
|
+
background: var(--theme-elevation-50);
|
|
109
|
+
font-weight: 500;
|
|
110
|
+
color: var(--theme-elevation-600);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.tableContainer tr:last-child td {
|
|
114
|
+
border-bottom: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.statusBadge {
|
|
118
|
+
display: inline-block;
|
|
119
|
+
padding: 0.25rem 0.5rem;
|
|
120
|
+
border-radius: 999px;
|
|
121
|
+
font-size: 0.75rem;
|
|
122
|
+
font-weight: 500;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.published {
|
|
126
|
+
background: var(--theme-success-100);
|
|
127
|
+
color: var(--theme-success-700);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.draft {
|
|
131
|
+
background: var(--theme-warning-100);
|
|
132
|
+
color: var(--theme-warning-700);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.loadingSpinner {
|
|
136
|
+
width: 20px;
|
|
137
|
+
height: 20px;
|
|
138
|
+
border: 2px solid var(--theme-elevation-100);
|
|
139
|
+
border-top-color: var(--theme-elevation-400);
|
|
140
|
+
border-radius: 50%;
|
|
141
|
+
animation: spin 1s linear infinite;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@keyframes spin {
|
|
145
|
+
to {
|
|
146
|
+
transform: rotate(360deg);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.copyContainer {
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
gap: 8px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.copyButton {
|
|
157
|
+
background: none;
|
|
158
|
+
border: none;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
padding: 4px;
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
color: #666;
|
|
165
|
+
transition: color 0.2s;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.copyButton:hover {
|
|
169
|
+
color: #333;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.copyButton svg {
|
|
173
|
+
width: 16px;
|
|
174
|
+
height: 16px;
|
|
175
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MigrationDashboardServer: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { getPluginOptions } from '../index.js';
|
|
3
|
+
import { MigrationDashboardClient } from './MigrationDashboardClient.js';
|
|
4
|
+
|
|
5
|
+
const MigrationDashboardServer = ()=>{
|
|
6
|
+
const pluginOptions = getPluginOptions();
|
|
7
|
+
if (!pluginOptions || pluginOptions.disabled) {
|
|
8
|
+
return /*#__PURE__*/ jsx("div", {
|
|
9
|
+
children: "WordPress Migration plugin is disabled"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
// Server-side data fetching in plugin components has limitations
|
|
13
|
+
// The client component will handle data fetching via API endpoints
|
|
14
|
+
// This provides better error handling and real-time updates
|
|
15
|
+
const initialSummary = {
|
|
16
|
+
activeJobs: 0,
|
|
17
|
+
completedJobs: 0,
|
|
18
|
+
recentJobs: [],
|
|
19
|
+
totalItemsMigrated: 0,
|
|
20
|
+
totalJobs: 0,
|
|
21
|
+
totalSites: 0
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/ jsx(MigrationDashboardClient, {
|
|
24
|
+
summary: initialSummary
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { MigrationDashboardServer };
|
|
29
|
+
//# sourceMappingURL=BeforeDashboardServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BeforeDashboardServer.js","sources":["../../src/components/BeforeDashboardServer.tsx"],"sourcesContent":["import { getPluginOptions } from '../index.js'\nimport { MigrationDashboardClient } from './MigrationDashboardClient.js'\n\nexport const MigrationDashboardServer = () => {\n const pluginOptions = getPluginOptions()\n\n if (!pluginOptions || pluginOptions.disabled) {\n return <div>WordPress Migration plugin is disabled</div>\n }\n\n // Server-side data fetching in plugin components has limitations\n // The client component will handle data fetching via API endpoints\n // This provides better error handling and real-time updates\n const initialSummary = {\n activeJobs: 0,\n completedJobs: 0,\n recentJobs: [],\n totalItemsMigrated: 0,\n totalJobs: 0,\n totalSites: 0,\n }\n\n return <MigrationDashboardClient summary={initialSummary} />\n}\n"],"names":["MigrationDashboardServer","pluginOptions","getPluginOptions","disabled","_jsx","div","initialSummary","activeJobs","completedJobs","recentJobs","totalItemsMigrated","totalJobs","totalSites","MigrationDashboardClient","summary"],"mappings":";;;;MAGaA,wBAAAA,GAA2B,IAAA;AACtC,IAAA,MAAMC,aAAAA,GAAgBC,gBAAAA,EAAAA;AAEtB,IAAA,IAAI,CAACD,aAAAA,IAAiBA,aAAAA,CAAcE,QAAQ,EAAE;AAC5C,QAAA,qBAAOC,GAAA,CAACC,KAAAA,EAAAA;AAAI,YAAA,QAAA,EAAA;;AACd,IAAA;;;;AAKA,IAAA,MAAMC,cAAAA,GAAiB;QACrBC,UAAAA,EAAY,CAAA;QACZC,aAAAA,EAAe,CAAA;AACfC,QAAAA,UAAAA,EAAY,EAAE;QACdC,kBAAAA,EAAoB,CAAA;QACpBC,SAAAA,EAAW,CAAA;QACXC,UAAAA,EAAY;AACd,KAAA;AAEA,IAAA,qBAAOR,GAAA,CAACS,wBAAAA,EAAAA;QAAyBC,OAAAA,EAASR;;AAC5C;;;;"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { useField, ReactSelect } from '@payloadcms/ui';
|
|
5
|
+
|
|
6
|
+
const ContentTypeSelect = ({ field, path })=>{
|
|
7
|
+
const { value, setValue } = useField({
|
|
8
|
+
path: path || field?.name
|
|
9
|
+
});
|
|
10
|
+
const [availableTypes, setAvailableTypes] = useState([]);
|
|
11
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
12
|
+
useEffect(()=>{
|
|
13
|
+
const loadDiscoveredContent = ()=>{
|
|
14
|
+
try {
|
|
15
|
+
const savedConfig = localStorage.getItem('wp-site-config');
|
|
16
|
+
if (savedConfig) {
|
|
17
|
+
const config = JSON.parse(savedConfig);
|
|
18
|
+
if (config.connectionStatus === 'scanned' && config.discoveredContent) {
|
|
19
|
+
// Convert discovered content to select options, filtering out empty content types
|
|
20
|
+
const options = config.discoveredContent.filter((content)=>content.count > 0 && content.available).map((content)=>({
|
|
21
|
+
label: `${content.label} (${content.count} items)${content.custom ? ' - Custom' : ''}`,
|
|
22
|
+
value: content.type
|
|
23
|
+
}));
|
|
24
|
+
setAvailableTypes(options);
|
|
25
|
+
setIsLoaded(true);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Fallback to default options if no discovered content
|
|
30
|
+
const defaultOptions = [
|
|
31
|
+
{
|
|
32
|
+
label: 'Posts',
|
|
33
|
+
value: 'posts'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'Pages',
|
|
37
|
+
value: 'pages'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'Media',
|
|
41
|
+
value: 'media'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'Users',
|
|
45
|
+
value: 'users'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: 'Categories',
|
|
49
|
+
value: 'categories'
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
setAvailableTypes(defaultOptions);
|
|
53
|
+
setIsLoaded(true);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error('Failed to load discovered content:', error);
|
|
56
|
+
// Fallback to default options
|
|
57
|
+
const defaultOptions = [
|
|
58
|
+
{
|
|
59
|
+
label: 'Posts',
|
|
60
|
+
value: 'posts'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: 'Pages',
|
|
64
|
+
value: 'pages'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: 'Media',
|
|
68
|
+
value: 'media'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: 'Users',
|
|
72
|
+
value: 'users'
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: 'Categories',
|
|
76
|
+
value: 'categories'
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
setAvailableTypes(defaultOptions);
|
|
80
|
+
setIsLoaded(true);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
loadDiscoveredContent();
|
|
84
|
+
// Listen for storage changes to update when WordPress config changes
|
|
85
|
+
const handleStorageChange = (e)=>{
|
|
86
|
+
if (e.key === 'wp-site-config') {
|
|
87
|
+
loadDiscoveredContent();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
window.addEventListener('storage', handleStorageChange);
|
|
91
|
+
return ()=>window.removeEventListener('storage', handleStorageChange);
|
|
92
|
+
}, []);
|
|
93
|
+
if (!isLoaded) {
|
|
94
|
+
return /*#__PURE__*/ jsx("div", {
|
|
95
|
+
children: "Loading content types..."
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
99
|
+
className: "field-type select",
|
|
100
|
+
id: "field-contentType",
|
|
101
|
+
style: {
|
|
102
|
+
flex: '1 1 auto'
|
|
103
|
+
},
|
|
104
|
+
children: [
|
|
105
|
+
/*#__PURE__*/ jsxs("label", {
|
|
106
|
+
className: "field-label",
|
|
107
|
+
htmlFor: "field-contentType",
|
|
108
|
+
children: [
|
|
109
|
+
"Content Type to Migrate",
|
|
110
|
+
/*#__PURE__*/ jsx("span", {
|
|
111
|
+
className: "required",
|
|
112
|
+
children: "*"
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
116
|
+
availableTypes.length === 0 ? /*#__PURE__*/ jsx("div", {
|
|
117
|
+
className: "field-error",
|
|
118
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
119
|
+
className: "field-error__message",
|
|
120
|
+
children: "No content types available. Please configure and scan your WordPress site first."
|
|
121
|
+
})
|
|
122
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
123
|
+
className: "field-type__wrap",
|
|
124
|
+
children: [
|
|
125
|
+
/*#__PURE__*/ jsx(ReactSelect, {
|
|
126
|
+
value: availableTypes.find((option)=>option.value === value),
|
|
127
|
+
onChange: (selectedOption)=>setValue(selectedOption?.value || ''),
|
|
128
|
+
options: availableTypes,
|
|
129
|
+
placeholder: "Select a content type...",
|
|
130
|
+
isClearable: true
|
|
131
|
+
}),
|
|
132
|
+
availableTypes.length > 0 && /*#__PURE__*/ jsxs("div", {
|
|
133
|
+
className: "field-description field-description-contentType",
|
|
134
|
+
children: [
|
|
135
|
+
"Showing ",
|
|
136
|
+
String(availableTypes.length || ''),
|
|
137
|
+
" content types discovered from your WordPress site. To update this list, reconfigure and scan your WordPress site in the migration dashboard."
|
|
138
|
+
]
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export { ContentTypeSelect as default };
|
|
147
|
+
//# sourceMappingURL=ContentTypeSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentTypeSelect.js","sources":["../../src/components/ContentTypeSelect.tsx"],"sourcesContent":["'use client'\n\nimport React, { useEffect, useState } from 'react'\nimport { useField, ReactSelect } from '@payloadcms/ui'\nimport type { TextFieldClientProps } from 'payload'\n\ntype ContentType = {\n type: string\n label: string\n count: number\n available: boolean\n custom?: boolean\n restBase?: string\n}\n\ntype WordPressSiteConfig = {\n discoveredContent?: ContentType[]\n connectionStatus?: string\n}\n\nconst ContentTypeSelect: React.FC<TextFieldClientProps> = ({ field, path }: any) => {\n const { value, setValue } = useField<string>({ path: path || field?.name })\n const [availableTypes, setAvailableTypes] = useState<Array<{ label: string; value: string }>>([])\n const [isLoaded, setIsLoaded] = useState(false)\n\n useEffect(() => {\n const loadDiscoveredContent = () => {\n try {\n const savedConfig = localStorage.getItem('wp-site-config')\n if (savedConfig) {\n const config: WordPressSiteConfig = JSON.parse(savedConfig)\n\n if (config.connectionStatus === 'scanned' && config.discoveredContent) {\n // Convert discovered content to select options, filtering out empty content types\n const options = config.discoveredContent\n .filter((content) => content.count > 0 && content.available)\n .map((content) => ({\n label: `${content.label} (${content.count} items)${content.custom ? ' - Custom' : ''}`,\n value: content.type,\n }))\n\n setAvailableTypes(options)\n setIsLoaded(true)\n return\n }\n }\n\n // Fallback to default options if no discovered content\n const defaultOptions = [\n { label: 'Posts', value: 'posts' },\n { label: 'Pages', value: 'pages' },\n { label: 'Media', value: 'media' },\n { label: 'Users', value: 'users' },\n { label: 'Categories', value: 'categories' },\n ]\n\n setAvailableTypes(defaultOptions)\n setIsLoaded(true)\n } catch (error) {\n console.error('Failed to load discovered content:', error)\n\n // Fallback to default options\n const defaultOptions = [\n { label: 'Posts', value: 'posts' },\n { label: 'Pages', value: 'pages' },\n { label: 'Media', value: 'media' },\n { label: 'Users', value: 'users' },\n { label: 'Categories', value: 'categories' },\n ]\n\n setAvailableTypes(defaultOptions)\n setIsLoaded(true)\n }\n }\n\n loadDiscoveredContent()\n\n // Listen for storage changes to update when WordPress config changes\n const handleStorageChange = (e: StorageEvent) => {\n if (e.key === 'wp-site-config') {\n loadDiscoveredContent()\n }\n }\n\n window.addEventListener('storage', handleStorageChange)\n return () => window.removeEventListener('storage', handleStorageChange)\n }, [])\n\n if (!isLoaded) {\n return <div>Loading content types...</div>\n }\n\n return (\n <div className=\"field-type select\" id=\"field-contentType\" style={{ flex: '1 1 auto' }}>\n <label className=\"field-label\" htmlFor=\"field-contentType\">\n Content Type to Migrate\n <span className=\"required\">*</span>\n </label>\n\n {availableTypes.length === 0 ? (\n <div className=\"field-error\">\n <div className=\"field-error__message\">\n No content types available. Please configure and scan your WordPress site first.\n </div>\n </div>\n ) : (\n <div className=\"field-type__wrap\">\n <ReactSelect\n value={availableTypes.find((option) => option.value === value)}\n onChange={(selectedOption: any) => setValue(selectedOption?.value || '')}\n options={availableTypes}\n placeholder=\"Select a content type...\"\n isClearable\n />\n\n {availableTypes.length > 0 && (\n <div className=\"field-description field-description-contentType\">\n Showing {String(availableTypes.length || '')} content types discovered from your\n WordPress site. To update this list, reconfigure and scan your WordPress site in the\n migration dashboard.\n </div>\n )}\n </div>\n )}\n </div>\n )\n}\n\nexport default ContentTypeSelect\n"],"names":["path","label","value","loadDiscoveredContent","onChange"],"mappings":";;;;;AAoBA;AACE;AAA+CA;AAA0B;AACzE;AACA;;AAGE;;;AAGI;;AAGE;;AAEE;AAGIC;AACAC;;;;AAKJ;AACF;AACF;;AAGA;AACE;;;AAAiC;AACjC;;;AAAiC;AACjC;;;AAAiC;AACjC;;;AAAiC;AACjC;;;AAA2C;AAC5C;;;AAIH;;;AAIE;AACE;;;AAAiC;AACjC;;;AAAiC;AACjC;;;AAAiC;AACjC;;;AAAiC;AACjC;;;AAA2C;AAC5C;;;AAIH;AACF;AAEAC;;AAGA;;AAEIA;AACF;AACF;;AAGA;AACF;AAEA;AACE;AAAY;;AACd;AAEA;;;;;AACsF;;;;;;AACvB;;;AAE9B;;;;;;AAKzB;;AAAsC;;;;;;AAOpCD;AACAE;;;;;;;;AAOiE;;AAClB;;;;;;;AAS3D;;"}
|