blob: 60186e26948efd47196bb37d44adfb119b39a6cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
import React, { useEffect, useRef } from "react";
export const EmbeddedMigrationWizard = ({ handleAction, content }) => {
const ref = useRef();
const options = content.migration_wizard_options;
useEffect(() => {
const handleBeginMigration = () => {
handleAction({
currentTarget: { value: "migrate_start" },
source: "primary_button",
});
};
const handleClose = () => {
handleAction({ currentTarget: { value: "migrate_close" } });
};
const { current } = ref;
current?.addEventListener(
"MigrationWizard:BeginMigration",
handleBeginMigration
);
current?.addEventListener("MigrationWizard:Close", handleClose);
return () => {
current?.removeEventListener(
"MigrationWizard:BeginMigration",
handleBeginMigration
);
current?.removeEventListener("MigrationWizard:Close", handleClose);
};
}, []); // eslint-disable-line react-hooks/exhaustive-deps
return (
<migration-wizard
force-show-import-all={options?.force_show_import_all || "false"}
auto-request-state=""
ref={ref}
option-expander-title-string={options?.option_expander_title_string || ""}
hide-option-expander-subtitle={
options?.hide_option_expander_subtitle || false
}
data-import-complete-success-string={
options?.data_import_complete_success_string || ""
}
selection-header-string={options?.selection_header_string}
selection-subheader-string={options?.selection_subheader_string || ""}
hide-select-all={options?.hide_select_all || false}
checkbox-margin-inline={options?.checkbox_margin_inline || ""}
checkbox-margin-block={options?.checkbox_margin_block || ""}
import-button-string={options?.import_button_string || ""}
import-button-class={options?.import_button_class || ""}
header-font-size={options?.header_font_size || ""}
header-font-weight={options?.header_font_weight || ""}
header-margin-block={options?.header_margin_block || ""}
subheader-font-size={options?.subheader_font_size || ""}
subheader-font-weight={options?.subheader_font_weight || ""}
subheader-margin-block={options?.subheader_margin_block || ""}
></migration-wizard>
);
};
|