codeapp-js 0.1.1 → 0.2.1
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/codeApp/dist/codeapp.js +317 -74
- package/codeApp/dist/index.js +1 -1
- package/codeApp/dist/power-apps-data.js +2952 -2531
- package/dev files/customConnector.js +98 -0
- package/dev files/dataverse.js +22 -7
- package/dev files/environmentVar.js +1 -1
- package/dev files/office365groups.js +1 -1
- package/dev files/office365users.js +1 -1
- package/dev files/outlook.js +1 -1
- package/dev files/power-apps-data.js +2952 -0
- package/dev files/sharepoint.js +1 -1
- package/examples/combined demo/dist/codeapp.js +1098 -0
- package/examples/combined demo/dist/index.js +470 -515
- package/examples/combined demo/dist/power-apps-data.js +3007 -2531
- package/examples/dataverse Demo/dist/codeapp.js +1085 -0
- package/examples/dataverse Demo/dist/index.js +38 -26
- package/examples/dataverse Demo/dist/power-apps-data.js +2912 -2531
- package/examples/groups Demo/dist/codeapp.js +1085 -0
- package/examples/groups Demo/dist/index.js +113 -113
- package/examples/groups Demo/dist/power-apps-data.js +2912 -2531
- package/examples/kanban/dist/power-apps-data.js +2953 -2531
- package/examples/myProfile/dist/power-apps-data.js +2953 -2531
- package/examples/outlook Demo/dist/codeapp.js +1085 -0
- package/examples/outlook Demo/dist/index.js +39 -35
- package/examples/outlook Demo/dist/power-apps-data.js +2912 -2531
- package/examples/planning Poker/dist/power-apps-data.js +2953 -2531
- package/examples/sharePoint Demo/dist/codeapp.js +1085 -0
- package/examples/sharePoint Demo/dist/index.js +262 -269
- package/examples/sharePoint Demo/dist/power-apps-data.js +2912 -2531
- package/examples/solution explorer/agent/decision-log.md +27 -0
- package/examples/solution explorer/agent/mockup-01-swiss-grid.html +452 -0
- package/examples/solution explorer/agent/mockup-02-dark-glass.html +496 -0
- package/examples/solution explorer/agent/mockup-03-paper-console.html +510 -0
- package/examples/solution explorer/agent/mockup-04-neon-noir.html +546 -0
- package/examples/solution explorer/agent/mockup-05-zen-garden.html +534 -0
- package/examples/solution explorer/dist/codeapp.js +1098 -0
- package/examples/solution explorer/dist/icon-512.png +0 -0
- package/examples/solution explorer/dist/index.html +80 -0
- package/examples/solution explorer/dist/index.js +735 -0
- package/examples/solution explorer/dist/power-apps-data.js +3007 -0
- package/examples/solution explorer/dist/styles.css +571 -0
- package/examples/solution explorer/power.config.json +151 -0
- package/examples/todo/dist/power-apps-data.js +2953 -2531
- package/package.json +1 -8
- package/.github/instructions/wyattdave.instructions.md +0 -39
- package/docs-mockups/atelier/index.html +0 -120
- package/docs-mockups/atelier/script.js +0 -23
- package/docs-mockups/atelier/styles.css +0 -361
- package/docs-mockups/field-guide/index.html +0 -112
- package/docs-mockups/field-guide/script.js +0 -20
- package/docs-mockups/field-guide/styles.css +0 -272
- package/docs-mockups/index.html +0 -80
- package/docs-mockups/maker-hub/index.html +0 -178
- package/docs-mockups/maker-hub/script.js +0 -20
- package/docs-mockups/maker-hub/styles.css +0 -404
- package/docs-mockups/script.js +0 -26
- package/docs-mockups/signal/index.html +0 -146
- package/docs-mockups/signal/script.js +0 -20
- package/docs-mockups/signal/styles.css +0 -314
- package/docs-mockups/styles.css +0 -287
- package/examples/combined demo/dist/dataverse.js +0 -86
- package/examples/combined demo/dist/environmentVar.js +0 -55
- package/examples/combined demo/dist/office365groups.js +0 -97
- package/examples/combined demo/dist/office365users.js +0 -169
- package/examples/combined demo/dist/outlook.js +0 -162
- package/examples/combined demo/dist/sharepoint.js +0 -339
- package/examples/dataverse Demo/dist/dataverse.js +0 -86
- package/examples/groups Demo/dist/dataverse.js +0 -86
- package/examples/groups Demo/dist/environmentVar.js +0 -55
- package/examples/groups Demo/dist/office365groups.js +0 -97
- package/examples/groups Demo/dist/office365users.js +0 -169
- package/examples/groups Demo/dist/outlook.js +0 -162
- package/examples/groups Demo/dist/sharepoint.js +0 -339
- package/examples/sharePoint Demo/dist/dataverse.js +0 -94
- package/examples/sharePoint Demo/dist/environmentVar.js +0 -55
- package/examples/sharePoint Demo/dist/office365groups.js +0 -97
- package/examples/sharePoint Demo/dist/office365users.js +0 -169
- package/examples/sharePoint Demo/dist/outlook.js +0 -162
- package/examples/sharePoint Demo/dist/sharepoint.js +0 -339
- package/scripts/build-power-sdk.mjs +0 -69
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { listEmails } from
|
|
1
|
+
import { listEmails } from './codeapp.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
let eLoading = document.getElementById('loading');
|
|
4
|
+
let eTable = document.getElementById('emailTable');
|
|
5
|
+
let eBody = document.getElementById('emailBody');
|
|
6
|
+
let eError = document.getElementById('error');
|
|
7
7
|
|
|
8
8
|
function parseJsonIfNeeded(oValue) {
|
|
9
|
-
if (typeof oValue !==
|
|
9
|
+
if (typeof oValue !== 'string') return oValue;
|
|
10
10
|
|
|
11
11
|
try {
|
|
12
12
|
return JSON.parse(oValue);
|
|
@@ -16,7 +16,7 @@ function parseJsonIfNeeded(oValue) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function isPlainObject(oValue) {
|
|
19
|
-
return oValue != null && typeof oValue ===
|
|
19
|
+
return oValue != null && typeof oValue === 'object' && Array.isArray(oValue) === false;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function looksLikeEmailRecord(oValue) {
|
|
@@ -67,20 +67,20 @@ function extractEmails(oResult) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
function getSenderText(oEmail) {
|
|
70
|
-
if (!oEmail) return
|
|
71
|
-
if (typeof oEmail.From ===
|
|
72
|
-
if (oEmail.From && typeof oEmail.From ===
|
|
73
|
-
return oEmail.From.Email || oEmail.From.Address || oEmail.From.Name ||
|
|
70
|
+
if (!oEmail) return '';
|
|
71
|
+
if (typeof oEmail.From === 'string') return oEmail.From;
|
|
72
|
+
if (oEmail.From && typeof oEmail.From === 'object') {
|
|
73
|
+
return oEmail.From.Email || oEmail.From.Address || oEmail.From.Name || '';
|
|
74
74
|
}
|
|
75
|
-
return oEmail.from ||
|
|
75
|
+
return oEmail.from || '';
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
function getSubjectText(oEmail) {
|
|
79
|
-
return oEmail.Subject || oEmail.subject ||
|
|
79
|
+
return oEmail.Subject || oEmail.subject || '(No Subject)';
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
function getReceivedDate(oEmail) {
|
|
83
|
-
return oEmail.DateTimeReceived || oEmail.ReceivedTime || oEmail.receivedDateTime ||
|
|
83
|
+
return oEmail.DateTimeReceived || oEmail.ReceivedTime || oEmail.receivedDateTime || '';
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function isEmailRead(oEmail) {
|
|
@@ -96,20 +96,24 @@ function formatDiagnostic(oResult) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
function formatDate(sDate) {
|
|
99
|
-
if (!sDate) return
|
|
99
|
+
if (!sDate) return '';
|
|
100
100
|
var oDate = new Date(sDate);
|
|
101
|
-
return oDate.toLocaleDateString() +
|
|
101
|
+
return oDate.toLocaleDateString() + ' ' + oDate.toLocaleTimeString();
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function escapeHtml(sText) {
|
|
105
|
-
if (!sText) return
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
if (!sText) return '';
|
|
106
|
+
let sStr = String(sText);
|
|
107
|
+
return sStr
|
|
108
|
+
.replace(new RegExp('&', 'g'), '&')
|
|
109
|
+
.replace(new RegExp('<', 'g'), '<')
|
|
110
|
+
.replace(new RegExp('>', 'g'), '>')
|
|
111
|
+
.replace(new RegExp('"', 'g'), '"')
|
|
112
|
+
.replace(new RegExp("'", 'g'), ''');
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
function renderEmails(aEmails) {
|
|
112
|
-
eBody.innerHTML =
|
|
116
|
+
eBody.innerHTML = '';
|
|
113
117
|
|
|
114
118
|
if (aEmails.length === 0) {
|
|
115
119
|
eBody.innerHTML = '<tr><td colspan="4">No emails found.</td></tr>';
|
|
@@ -120,27 +124,27 @@ function renderEmails(aEmails) {
|
|
|
120
124
|
var sSubject = escapeHtml(getSubjectText(oEmail));
|
|
121
125
|
var sReceived = formatDate(getReceivedDate(oEmail));
|
|
122
126
|
var bRead = isEmailRead(oEmail);
|
|
123
|
-
var sRow =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
var sRow = '<tr>' +
|
|
128
|
+
'<td>' + sFrom + '</td>' +
|
|
129
|
+
'<td>' + sSubject + '</td>' +
|
|
130
|
+
'<td>' + sReceived + '</td>' +
|
|
131
|
+
'<td>' + (bRead ? 'Yes' : 'No') + '</td>' +
|
|
132
|
+
'</tr>';
|
|
129
133
|
eBody.innerHTML += sRow;
|
|
130
134
|
});
|
|
131
|
-
eLoading.style.display =
|
|
132
|
-
eTable.style.display =
|
|
135
|
+
eLoading.style.display = 'none';
|
|
136
|
+
eTable.style.display = 'table';
|
|
133
137
|
}
|
|
134
138
|
|
|
135
139
|
function showError(sMessage) {
|
|
136
|
-
eLoading.style.display =
|
|
137
|
-
eError.style.display =
|
|
138
|
-
eError.textContent =
|
|
140
|
+
eLoading.style.display = 'none';
|
|
141
|
+
eError.style.display = 'block';
|
|
142
|
+
eError.textContent = 'Error: ' + sMessage;
|
|
139
143
|
}
|
|
140
144
|
|
|
141
145
|
async function boot() {
|
|
142
146
|
try {
|
|
143
|
-
var oResult = await listEmails({ folderId:
|
|
147
|
+
var oResult = await listEmails({ folderId: 'Inbox', top: 10 });
|
|
144
148
|
var aEmails = extractEmails(oResult);
|
|
145
149
|
|
|
146
150
|
if (aEmails.length === 0) {
|
|
@@ -152,14 +156,14 @@ async function boot() {
|
|
|
152
156
|
return;
|
|
153
157
|
}
|
|
154
158
|
|
|
155
|
-
showError(
|
|
159
|
+
showError('No emails extracted from Outlook response. Raw response: ' + formatDiagnostic(oResult));
|
|
156
160
|
renderEmails([]);
|
|
157
161
|
return;
|
|
158
162
|
}
|
|
159
163
|
|
|
160
164
|
renderEmails(aEmails);
|
|
161
165
|
} catch (oErr) {
|
|
162
|
-
showError(
|
|
166
|
+
showError('Outlook: ' + (oErr.message || oErr));
|
|
163
167
|
}
|
|
164
168
|
}
|
|
165
169
|
|