I'm not much of a programmer but I needed a way to download the entire list of my "Hide My Email" address of which I have hundreds. This is what I came up with. It's very simple and probably needs a bit of modification to be added to the code base (if someone actually wants to do that):
diff --git a/src/pages/Popup/Popup.tsx b/src/pages/Popup/Popup.tsx
index e6fcad9..6dabba0 100644
--- a/src/pages/Popup/Popup.tsx
+++ b/src/pages/Popup/Popup.tsx
@@ -629,6 +629,33 @@ const HmeManager = (props: {
);
};
- const downloadEmailsAsCsv = () => {
- const fetchHmeList = async () => {
-
setHmeEmailsError(undefined);
-
-
-
const pms = new PremiumMailSettings(props.client);
-
const result = await pms.listHme();
-
result.hmeEmails.sort((a, b) => b.createTimestamp - a.createTimestamp)
-
const csvContent = result.hmeEmails.map(hme => `${hme.label},${hme.hme},${hme.createTimestamp}`).join('\n');
-
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
-
const url = URL.createObjectURL(blob);
-
const link = document.createElement('a');
-
link.setAttribute('href', url);
-
link.setAttribute('download', 'hide-my-emails.csv');
-
link.style.visibility = 'hidden';
-
document.body.appendChild(link);
-
-
document.body.removeChild(link);
-
-
setHmeEmailsError(e.toString());
-
-
-
- };
- fetchHmeList();
- }
const hmeListGrid = (fetchedHmeEmails: HmeEmail[]) => {
const hmeEmails =
searchHmeEmails(searchPrompt || '', fetchedHmeEmails) || fetchedHmeEmails;
@@ -742,6 +769,13 @@ const HmeManager = (props: {
icon={faPlus}
label="Generate new email"
/>
-
-
-
-
onClick={downloadEmailsAsCsv}
-
-
label="Download email list"
-
/>
</div>
<div className="text-right">
<SignOutButton {...props} />
diff --git a/src/pages/Popup/stateMachine.ts b/src/pages/Popup/stateMachine.ts
index 9a74039..388dd33 100644
--- a/src/pages/Popup/stateMachine.ts
+++ b/src/pages/Popup/stateMachine.ts
@@ -40,5 +40,6 @@ export const STATE_MACHINE_TRANSITIONS: Transitions = {
[PopupState.AuthenticatedAndManaging]: {
GENERATE: PopupState.Authenticated,
SIGN_OUT: PopupState.SignedOut,
- DOWNLOAD: PopupState.Authenticated,
},
};
I'm not much of a programmer but I needed a way to download the entire list of my "Hide My Email" address of which I have hundreds. This is what I came up with. It's very simple and probably needs a bit of modification to be added to the code base (if someone actually wants to do that):
diff --git a/src/pages/Popup/Popup.tsx b/src/pages/Popup/Popup.tsx
index e6fcad9..6dabba0 100644
--- a/src/pages/Popup/Popup.tsx
+++ b/src/pages/Popup/Popup.tsx
@@ -629,6 +629,33 @@ const HmeManager = (props: {
);
};
const hmeListGrid = (fetchedHmeEmails: HmeEmail[]) => {
const hmeEmails =
searchHmeEmails(searchPrompt || '', fetchedHmeEmails) || fetchedHmeEmails;
@@ -742,6 +769,13 @@ const HmeManager = (props: {
icon={faPlus}
label="Generate new email"
/>
diff --git a/src/pages/Popup/stateMachine.ts b/src/pages/Popup/stateMachine.ts
index 9a74039..388dd33 100644
--- a/src/pages/Popup/stateMachine.ts
+++ b/src/pages/Popup/stateMachine.ts
@@ -40,5 +40,6 @@ export const STATE_MACHINE_TRANSITIONS: Transitions = {
[PopupState.AuthenticatedAndManaging]: {
GENERATE: PopupState.Authenticated,
SIGN_OUT: PopupState.SignedOut,
},
};