authscape 1.0.608 → 1.0.614
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/index.js +1373 -1323
- package/package.json +1 -2
- package/src/components/{OEMEditor.js → privateLabel/privateLabelEditor.js} +131 -86
package/package.json
CHANGED
|
@@ -9,16 +9,16 @@ import Box from '@mui/material/Box';
|
|
|
9
9
|
import { Grid } from "@mui/material";
|
|
10
10
|
import { DataGrid } from "@mui/x-data-grid";
|
|
11
11
|
import PublishRoundedIcon from '@mui/icons-material/PublishRounded';
|
|
12
|
-
import Image from "next/image";
|
|
13
12
|
import InputLabel from '@mui/material/InputLabel';
|
|
14
13
|
import MenuItem from '@mui/material/MenuItem';
|
|
15
14
|
import FormControl from '@mui/material/FormControl';
|
|
16
15
|
import Select from '@mui/material/Select';
|
|
17
16
|
|
|
18
17
|
// remove after NPM
|
|
19
|
-
// import {FileUploader, apiService, ColorPicker} from 'authscape';
|
|
18
|
+
// import {FileUploader, apiService, ColorPicker, Dropzone} from 'authscape';
|
|
19
|
+
// import AddDomain from "./AddDomainModal";
|
|
20
20
|
|
|
21
|
-
export function
|
|
21
|
+
export function PrivateLabelEditor({loadedUser, notification, showAllDomains = false, companyId = null, azureWebsite = "", azureTxtValue = ""}) {
|
|
22
22
|
|
|
23
23
|
const monaco = useMonaco();
|
|
24
24
|
|
|
@@ -37,6 +37,9 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
37
37
|
|
|
38
38
|
const [stateBaseUri, setBaseUri] = useState('');
|
|
39
39
|
|
|
40
|
+
const [isNewAccount, setIsNewAccount] = useState(false);
|
|
41
|
+
|
|
42
|
+
|
|
40
43
|
const handleChange = (event, newValue) => {
|
|
41
44
|
setValue(newValue);
|
|
42
45
|
};
|
|
@@ -57,7 +60,7 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
57
60
|
domain = GetBaseUrl();
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
let responseFields = await apiService().get("/
|
|
63
|
+
let responseFields = await apiService().get("/PrivateLabel/GetFields?domain=" + domain + (companyId != null ? ("&companyId=" + companyId) : ""));
|
|
61
64
|
if (responseFields != null && responseFields.status == 200)
|
|
62
65
|
{
|
|
63
66
|
setDnsFields(responseFields.data);
|
|
@@ -74,47 +77,56 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
74
77
|
}, [oEMDomain]);
|
|
75
78
|
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
const FetchOEMData = async () => {
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
let response = await apiService().get("/PrivateLabel/GetFonts");
|
|
83
|
+
if (response != null && response.status == 200)
|
|
84
|
+
{
|
|
85
|
+
setFonts(response.data);
|
|
86
|
+
}
|
|
82
87
|
|
|
83
|
-
|
|
88
|
+
if (showAllDomains)
|
|
89
|
+
{
|
|
90
|
+
let response = await apiService().get("/PrivateLabel/GetAllDomains");
|
|
84
91
|
if (response != null && response.status == 200)
|
|
85
92
|
{
|
|
86
|
-
|
|
87
|
-
}
|
|
93
|
+
setOEMDomainList(response.data);
|
|
88
94
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
setOEMDomain(response.data[0].name);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
95
|
+
if (response.data.length > 0)
|
|
96
|
+
{
|
|
97
|
+
setOEMDomain(response.data[0].name);
|
|
98
|
+
}
|
|
99
|
+
else
|
|
100
|
+
{
|
|
101
|
+
setIsNewAccount(true);
|
|
102
|
+
}
|
|
101
103
|
}
|
|
102
|
-
|
|
104
|
+
}
|
|
105
|
+
else
|
|
106
|
+
{
|
|
107
|
+
let response = await apiService().get("/PrivateLabel/GetAllDomainsUser");
|
|
108
|
+
if (response != null && response.status == 200)
|
|
103
109
|
{
|
|
104
|
-
|
|
105
|
-
if (response != null && response.status == 200)
|
|
106
|
-
{
|
|
107
|
-
setOEMDomainList(response.data);
|
|
110
|
+
setOEMDomainList(response.data);
|
|
108
111
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
if (response.data.length > 0)
|
|
113
|
+
{
|
|
114
|
+
setOEMDomain(response.data[0].name);
|
|
115
|
+
}
|
|
116
|
+
else
|
|
117
|
+
{
|
|
118
|
+
setIsNewAccount(true);
|
|
119
|
+
}
|
|
114
120
|
}
|
|
115
|
-
|
|
116
121
|
}
|
|
117
|
-
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
|
|
127
|
+
if (loadedUser)
|
|
128
|
+
{
|
|
129
|
+
FetchOEMData();
|
|
118
130
|
}
|
|
119
131
|
|
|
120
132
|
}, [loadedUser]);
|
|
@@ -122,7 +134,7 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
122
134
|
|
|
123
135
|
const [paginationModel, setPaginationModel] = React.useState({
|
|
124
136
|
page: 0,
|
|
125
|
-
pageSize:
|
|
137
|
+
pageSize: 12,
|
|
126
138
|
});
|
|
127
139
|
|
|
128
140
|
|
|
@@ -166,7 +178,7 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
166
178
|
|
|
167
179
|
setData(null);
|
|
168
180
|
|
|
169
|
-
let response = await apiService().get("/
|
|
181
|
+
let response = await apiService().get("/PrivateLabel/GetEditorData?domain=" + oEMDomain + (companyId != null ? ("&companyId=" + companyId) : ""));
|
|
170
182
|
if (response.status == 200)
|
|
171
183
|
{
|
|
172
184
|
setData(response.data);
|
|
@@ -210,8 +222,9 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
210
222
|
|
|
211
223
|
<Box sx={{ borderBottom: 1, borderColor: 'divider', paddingTop:2 }}>
|
|
212
224
|
<Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
|
|
213
|
-
<Tab label="
|
|
225
|
+
<Tab label="App Icon / Colors" />
|
|
214
226
|
<Tab label="Fonts" />
|
|
227
|
+
{/* <Tab label="Content" /> */}
|
|
215
228
|
<Tab label="Style Sheet Editor" />
|
|
216
229
|
<Tab label="HTML Import Editor" />
|
|
217
230
|
</Tabs>
|
|
@@ -223,49 +236,62 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
223
236
|
<Box>
|
|
224
237
|
{data != null &&
|
|
225
238
|
<Box>
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
<ColorPicker name={dnsField.name} defaultColor={dnsField.value} onColorChanged={async (name, hex) => {
|
|
254
|
-
|
|
255
|
-
await apiService().post("/WhiteLabel/SetFieldValue", {
|
|
256
|
-
id: dnsField.id,
|
|
257
|
-
fieldId: dnsField.fieldId,
|
|
258
|
-
value: hex
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
notification(dnsField.name + " Saved");
|
|
262
|
-
|
|
263
|
-
}} />
|
|
264
|
-
</Grid>
|
|
265
|
-
</Grid>
|
|
239
|
+
<Grid container spacing={2}>
|
|
240
|
+
<Grid item xs={4}>
|
|
241
|
+
<Box sx={{paddingBottom:4}}>
|
|
242
|
+
<Dropzone
|
|
243
|
+
image={"/DefaultNoImage.svg"}
|
|
244
|
+
text={"Drag 'n' drop your app icon here"}
|
|
245
|
+
onDrop={async (file) => {
|
|
246
|
+
const data = new FormData();
|
|
247
|
+
|
|
248
|
+
data.append("file", file);
|
|
249
|
+
data.append("domain", stateBaseUri);
|
|
250
|
+
|
|
251
|
+
let response = await apiService().post(
|
|
252
|
+
"/PrivateLabel/UploadAppIcon",
|
|
253
|
+
data
|
|
254
|
+
);
|
|
255
|
+
if (response != null && response.status == 200) {
|
|
256
|
+
window.location.reload();
|
|
257
|
+
}
|
|
258
|
+
}}
|
|
259
|
+
/>
|
|
260
|
+
</Box>
|
|
261
|
+
</Grid>
|
|
262
|
+
<Grid item xs={8}>
|
|
263
|
+
<Box sx={{paddingBottom:2, fontWeight:"bold", fontSize:16}}>
|
|
264
|
+
Adjust the colors for your site
|
|
266
265
|
</Box>
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
<Box>
|
|
267
|
+
{dnsFields != null && dnsFields.map((dnsField, index) => {
|
|
268
|
+
return (
|
|
269
|
+
<Box key={index}>
|
|
270
|
+
<Grid container spacing={2}>
|
|
271
|
+
<Grid item xs={3}>
|
|
272
|
+
{dnsField.name}
|
|
273
|
+
</Grid>
|
|
274
|
+
<Grid item xs={9}>
|
|
275
|
+
|
|
276
|
+
<ColorPicker name={dnsField.name} defaultColor={dnsField.value} onColorChanged={async (name, hex) => {
|
|
277
|
+
|
|
278
|
+
await apiService().post("/PrivateLabel/SetFieldValue", {
|
|
279
|
+
id: dnsField.id,
|
|
280
|
+
fieldId: dnsField.fieldId,
|
|
281
|
+
value: hex
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
notification(dnsField.name + " Saved");
|
|
285
|
+
|
|
286
|
+
}} />
|
|
287
|
+
</Grid>
|
|
288
|
+
</Grid>
|
|
289
|
+
</Box>
|
|
290
|
+
)
|
|
291
|
+
})}
|
|
292
|
+
</Box>
|
|
293
|
+
</Grid>
|
|
294
|
+
</Grid>
|
|
269
295
|
</Box>
|
|
270
296
|
}
|
|
271
297
|
</Box>
|
|
@@ -294,7 +320,7 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
294
320
|
// rowSelectionModel={selectedFont}
|
|
295
321
|
onRowClick={async (params) => {
|
|
296
322
|
|
|
297
|
-
let response = await apiService().post("/
|
|
323
|
+
let response = await apiService().post("/PrivateLabel/SetFont", {
|
|
298
324
|
companyId: companyId,
|
|
299
325
|
domain: oEMDomain,
|
|
300
326
|
value: params.row.label
|
|
@@ -314,7 +340,7 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
314
340
|
</Grid>
|
|
315
341
|
<Grid item xs={6} >
|
|
316
342
|
|
|
317
|
-
<FileUploader url={"/
|
|
343
|
+
<FileUploader url={"/PrivateLabel/UploadCustomFont"} accept={".otf,.ttf,.woff"} params={{
|
|
318
344
|
domain: stateBaseUri
|
|
319
345
|
}} multiple={true} variant='custom' onUploadCompleted={() => {
|
|
320
346
|
window.location.reload();
|
|
@@ -346,8 +372,22 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
346
372
|
</Box>
|
|
347
373
|
}
|
|
348
374
|
|
|
349
|
-
{value == 2 &&
|
|
375
|
+
{/* {value == 2 &&
|
|
350
376
|
<Box value={value} index={2}>
|
|
377
|
+
<Grid container spacing={2}>
|
|
378
|
+
<Grid item xs={6}>
|
|
379
|
+
<h4 style={{marginBottom:"0px"}}>Content</h4>
|
|
380
|
+
<small>You can adjust the content within your site</small>
|
|
381
|
+
</Grid>
|
|
382
|
+
</Grid>
|
|
383
|
+
<Box sx={{paddingTop:2}}>
|
|
384
|
+
<TextField id="outlined-basic" label="Outlined" variant="outlined" />
|
|
385
|
+
</Box>
|
|
386
|
+
</Box>
|
|
387
|
+
} */}
|
|
388
|
+
|
|
389
|
+
{value == 2 &&
|
|
390
|
+
<Box value={value} index={3}>
|
|
351
391
|
|
|
352
392
|
<Grid container spacing={2}>
|
|
353
393
|
<Grid item xs={6}>
|
|
@@ -357,7 +397,7 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
357
397
|
<Grid item xs={6} sx={{textAlign:"right"}}>
|
|
358
398
|
<Button startIcon={<CheckIcon/>} sx={{marginTop:4}} variant="contained" onClick={async () => {
|
|
359
399
|
|
|
360
|
-
let response = await apiService().post("/
|
|
400
|
+
let response = await apiService().post("/PrivateLabel/SetGlobalCSS", {
|
|
361
401
|
companyId: companyId,
|
|
362
402
|
domain: oEMDomain,
|
|
363
403
|
value: cssEditorRef.current.getValue()
|
|
@@ -388,7 +428,7 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
388
428
|
}
|
|
389
429
|
|
|
390
430
|
{value == 3 &&
|
|
391
|
-
<Box value={value} index={
|
|
431
|
+
<Box value={value} index={4}>
|
|
392
432
|
|
|
393
433
|
|
|
394
434
|
<Grid container spacing={2}>
|
|
@@ -399,7 +439,7 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
399
439
|
<Grid item xs={6} sx={{textAlign:"right"}}>
|
|
400
440
|
<Button startIcon={<CheckIcon/>} sx={{marginTop:4}} variant="contained" onClick={async () => {
|
|
401
441
|
|
|
402
|
-
let response = await apiService().post("/
|
|
442
|
+
let response = await apiService().post("/PrivateLabel/SetGlobalHTML", {
|
|
403
443
|
companyId: companyId,
|
|
404
444
|
domain: oEMDomain,
|
|
405
445
|
value: htmlEditorRef.current.getValue()
|
|
@@ -432,6 +472,11 @@ export function OEMEditor({loadedUser, notification, showAllDomains = false, com
|
|
|
432
472
|
</Box>
|
|
433
473
|
|
|
434
474
|
</Box>
|
|
475
|
+
|
|
476
|
+
<AddDomain open={isNewAccount} azureWebsite={azureWebsite} azureTxtValue={azureTxtValue} handleClose={async () => {
|
|
477
|
+
setIsNewAccount(false);
|
|
478
|
+
await FetchOEMData();
|
|
479
|
+
}} />
|
|
435
480
|
</Box>
|
|
436
481
|
</>
|
|
437
482
|
)
|