Flexibelere search voor de Outlook Plugin + README.md duidelijker gemaakt

This commit is contained in:
2025-06-02 08:48:48 +02:00
parent 304217b680
commit 3c464bb401
5 changed files with 74 additions and 34 deletions

View File

@@ -9,10 +9,10 @@ import axios from "axios";
// axios conf
axios.defaults.headers.common["api-language"] = "nl";
const localApiUrl = "https://backoffice.sociale-controle.nl/api/zoek_bestelling";
const orderUrlEdit = "https://backoffice.sociale-controle.nl/bestellingen/edit/";
const orderUrlIndex = "https://backoffice.sociale-controle.nl/bestellingen";
const apiCredentialUrl = "https://backoffice.sociale-controle.nl/api/api_credentials";
const localApiUrl = "https://ewn51fphu7.sharedwithexpose.com/api/zoek_bestelling";
const orderUrlEdit = "https://ewn51fphu7.sharedwithexpose.com/bestellingen/edit/";
const orderUrlIndex = "https://ewn51fphu7.sharedwithexpose.com/bestellingen";
const apiCredentialUrl = "https://ewn51fphu7.sharedwithexpose.com/api/api_credentials";
Office.onReady((info) => {
if (info.host === Office.HostType.Outlook) {
@@ -25,20 +25,25 @@ export async function run() {
// Set load animation in button
loadAnimation(true);
// btoa(getLastName(Office.context.mailbox.item.sender.displayName))
// btoa(getInitials(Office.context.mailbox.item.sender.displayName))
// btoa(Office.context.mailbox.item.sender.emailAddress)
//senderName: btoa(Office.context.mailbox.item.sender.displayName)
let searchInfo = {
senderLastName: btoa(getLastName(Office.context.mailbox.item.sender.displayName)),
senderInitials: btoa(getInitials(Office.context.mailbox.item.sender.displayName)),
senderName: btoa(Office.context.mailbox.item.sender.displayName),
senderEmail: btoa(Office.context.mailbox.item.sender.emailAddress),
senderLastName: btoa("DIT BESTAAT SWS NIET"),
senderInitials: btoa("NAHH"),
senderName: btoa("NO WAY DAT DIT BESTAAT!"),
senderEmail: btoa("Anjameijer1958@outlook.com"),
senderSubject: btoa(Office.context.mailbox.item.subject),
postalCodes: {},
postalCodes: btoa(["1234AA, 0910AA"]),
};
searchInfo.postalCodes = await new Promise((resolve) => {
Office.context.mailbox.item.body.getAsync("text", function (async) {
resolve(getPostalCodesFromText(async.value));
});
});
// searchInfo.postalCodes = await new Promise((resolve) => {
// Office.context.mailbox.item.body.getAsync("text", function (async) {
// resolve(getPostalCodesFromText(async.value));
// });
// });
// Make API call to see if we can find an order for the e-mail.
let results;