@scopieflows/app-gmail 0.11.0

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.
Files changed (63) hide show
  1. package/README.md +7 -0
  2. package/package.json +32 -0
  3. package/src/i18n/ca.json +63 -0
  4. package/src/i18n/de.json +66 -0
  5. package/src/i18n/es.json +66 -0
  6. package/src/i18n/fr.json +66 -0
  7. package/src/i18n/hi.json +63 -0
  8. package/src/i18n/id.json +63 -0
  9. package/src/i18n/ja.json +66 -0
  10. package/src/i18n/nl.json +66 -0
  11. package/src/i18n/pt.json +66 -0
  12. package/src/i18n/ru.json +63 -0
  13. package/src/i18n/translation.json +66 -0
  14. package/src/i18n/vi.json +63 -0
  15. package/src/i18n/zh.json +66 -0
  16. package/src/index.d.ts +2 -0
  17. package/src/index.js +78 -0
  18. package/src/index.js.map +1 -0
  19. package/src/lib/actions/create-draft-reply-action.d.ts +10 -0
  20. package/src/lib/actions/create-draft-reply-action.js +262 -0
  21. package/src/lib/actions/create-draft-reply-action.js.map +1 -0
  22. package/src/lib/actions/get-mail-action.d.ts +3 -0
  23. package/src/lib/actions/get-mail-action.js +37 -0
  24. package/src/lib/actions/get-mail-action.js.map +1 -0
  25. package/src/lib/actions/get-thread-action.d.ts +5 -0
  26. package/src/lib/actions/get-thread-action.js +44 -0
  27. package/src/lib/actions/get-thread-action.js.map +1 -0
  28. package/src/lib/actions/reply-to-email-action.d.ts +9 -0
  29. package/src/lib/actions/reply-to-email-action.js +195 -0
  30. package/src/lib/actions/reply-to-email-action.js.map +1 -0
  31. package/src/lib/actions/request-approval-in-email.d.ts +11 -0
  32. package/src/lib/actions/request-approval-in-email.js +176 -0
  33. package/src/lib/actions/request-approval-in-email.js.map +1 -0
  34. package/src/lib/actions/search-email-action.d.ts +15 -0
  35. package/src/lib/actions/search-email-action.js +180 -0
  36. package/src/lib/actions/search-email-action.js.map +1 -0
  37. package/src/lib/actions/send-email-action.d.ts +14 -0
  38. package/src/lib/actions/send-email-action.js +191 -0
  39. package/src/lib/actions/send-email-action.js.map +1 -0
  40. package/src/lib/common/data.d.ts +131 -0
  41. package/src/lib/common/data.js +208 -0
  42. package/src/lib/common/data.js.map +1 -0
  43. package/src/lib/common/models.d.ts +85 -0
  44. package/src/lib/common/models.js +26 -0
  45. package/src/lib/common/models.js.map +1 -0
  46. package/src/lib/common/props.d.ts +11 -0
  47. package/src/lib/common/props.js +229 -0
  48. package/src/lib/common/props.js.map +1 -0
  49. package/src/lib/triggers/new-attachment.d.ts +171 -0
  50. package/src/lib/triggers/new-attachment.js +128 -0
  51. package/src/lib/triggers/new-attachment.js.map +1 -0
  52. package/src/lib/triggers/new-conversation.d.ts +46 -0
  53. package/src/lib/triggers/new-conversation.js +310 -0
  54. package/src/lib/triggers/new-conversation.js.map +1 -0
  55. package/src/lib/triggers/new-email.d.ts +27 -0
  56. package/src/lib/triggers/new-email.js +117 -0
  57. package/src/lib/triggers/new-email.js.map +1 -0
  58. package/src/lib/triggers/new-label.d.ts +2 -0
  59. package/src/lib/triggers/new-label.js +79 -0
  60. package/src/lib/triggers/new-label.js.map +1 -0
  61. package/src/lib/triggers/new-labeled-email.d.ts +62 -0
  62. package/src/lib/triggers/new-labeled-email.js +142 -0
  63. package/src/lib/triggers/new-labeled-email.js.map +1 -0
@@ -0,0 +1,3 @@
1
+ export declare const gmailGetEmailAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ message_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ }>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gmailGetEmailAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const __1 = require("../../");
7
+ const googleapis_1 = require("googleapis");
8
+ const googleapis_common_1 = require("googleapis-common");
9
+ const data_1 = require("../common/data");
10
+ exports.gmailGetEmailAction = (0, pieces_framework_1.createAction)({
11
+ auth: __1.gmailAuth,
12
+ name: 'gmail_get_mail',
13
+ description: 'Get an email via Id.',
14
+ displayName: 'Get Email',
15
+ props: {
16
+ message_id: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Message ID',
18
+ description: 'The messageId of the mail to read.',
19
+ required: true,
20
+ }),
21
+ },
22
+ run(context) {
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const authClient = new googleapis_common_1.OAuth2Client();
25
+ authClient.setCredentials(context.auth);
26
+ const gmail = googleapis_1.google.gmail({ version: 'v1', auth: authClient });
27
+ const rawMailResponse = yield gmail.users.messages.get({
28
+ userId: 'me',
29
+ id: context.propsValue.message_id,
30
+ format: 'raw',
31
+ });
32
+ const parsedMailResponse = yield (0, data_1.parseStream)(Buffer.from(rawMailResponse.data.raw, 'base64').toString('utf-8'));
33
+ return Object.assign(Object.assign({ id: context.propsValue.message_id }, parsedMailResponse), { attachments: yield (0, data_1.convertAttachment)(parsedMailResponse.attachments, context.files) });
34
+ });
35
+ },
36
+ });
37
+ //# sourceMappingURL=get-mail-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-mail-action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/gmail/src/lib/actions/get-mail-action.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8BAAmC;AACnC,2CAAoC;AACpC,yDAAiD;AACjD,yCAAgE;AAEnD,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,WAAW;IACxB,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,IAAI,gCAAY,EAAE,CAAC;YACtC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAExC,MAAM,KAAK,GAAG,mBAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAEhE,MAAM,eAAe,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;gBACrD,MAAM,EAAE,IAAI;gBACZ,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,UAAW;gBAClC,MAAM,EAAE,KAAK;aACd,CAAC,CAAC;YAEH,MAAM,kBAAkB,GAAG,MAAM,IAAA,kBAAW,EAC1C,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAa,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAChE,OAAO,CACR,CACF,CAAC;YAEF,qCACE,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,IAC9B,kBAAkB,KACrB,WAAW,EAAE,MAAM,IAAA,wBAAiB,EAClC,kBAAkB,CAAC,WAAW,EAC9B,OAAO,CAAC,KAAK,CACd,IACD;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { GmailMessageFormat } from '../common/models';
2
+ export declare const gmailGetThread: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
3
+ thread_id: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ format: import("@scopieflows/pieces-framework").StaticDropdownProperty<GmailMessageFormat, false> | import("@scopieflows/pieces-framework").StaticDropdownProperty<GmailMessageFormat, true>;
5
+ }>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gmailGetThread = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const data_1 = require("../common/data");
7
+ const models_1 = require("../common/models");
8
+ const __1 = require("../../");
9
+ exports.gmailGetThread = (0, pieces_framework_1.createAction)({
10
+ auth: __1.gmailAuth,
11
+ name: 'gmail_get_thread',
12
+ description: 'Get a thread from your Gmail account via Id',
13
+ displayName: 'Get Thread',
14
+ props: {
15
+ thread_id: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Thread ID',
17
+ description: 'The thread Id of the mail to read',
18
+ required: true,
19
+ }),
20
+ format: pieces_framework_1.Property.StaticDropdown({
21
+ displayName: 'Format',
22
+ description: 'Format of the mail',
23
+ required: false,
24
+ defaultValue: 'full',
25
+ options: {
26
+ disabled: false,
27
+ options: [
28
+ { value: models_1.GmailMessageFormat.MINIMAL, label: 'Minimal' },
29
+ { value: models_1.GmailMessageFormat.FULL, label: 'Full' },
30
+ { value: models_1.GmailMessageFormat.RAW, label: 'Raw' },
31
+ { value: models_1.GmailMessageFormat.METADATA, label: 'Metadata' },
32
+ ],
33
+ },
34
+ }),
35
+ },
36
+ run: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue: { format, thread_id } }) {
37
+ return yield data_1.GmailRequests.getThread({
38
+ access_token: auth.access_token,
39
+ thread_id,
40
+ format: format !== null && format !== void 0 ? format : models_1.GmailMessageFormat.FULL,
41
+ });
42
+ }),
43
+ });
44
+ //# sourceMappingURL=get-thread-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-thread-action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/gmail/src/lib/actions/get-thread-action.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,yCAA+C;AAC/C,6CAAsD;AACtD,8BAAmC;AAEtB,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,6CAA6C;IAC1D,WAAW,EAAE,YAAY;IACzB,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAqB;YAClD,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,2BAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;oBACvD,EAAE,KAAK,EAAE,2BAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;oBACjD,EAAE,KAAK,EAAE,2BAAkB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC/C,EAAE,KAAK,EAAE,2BAAkB,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE;iBAC1D;aACF;SACF,CAAC;KACH;IACD,GAAG,EAAE,KAAoD,EAAE,oDAA/C,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;QACrD,OAAA,MAAM,oBAAa,CAAC,SAAS,CAAC;YAC5B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS;YACT,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,2BAAkB,CAAC,IAAI;SAC1C,CAAC,CAAA;MAAA;CACL,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const gmailReplyToEmailAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ message_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ reply_type: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, true>;
4
+ body_type: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, true>;
5
+ body: import("@scopieflows/pieces-framework").LongTextProperty<true>;
6
+ sender_name: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
7
+ attachment: import("@scopieflows/pieces-framework").FileProperty<false>;
8
+ attachment_name: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
9
+ }>;
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gmailReplyToEmailAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const mime_types_1 = tslib_1.__importDefault(require("mime-types"));
7
+ const mail_composer_1 = tslib_1.__importDefault(require("nodemailer/lib/mail-composer"));
8
+ const __1 = require("../../");
9
+ const googleapis_1 = require("googleapis");
10
+ const googleapis_common_1 = require("googleapis-common");
11
+ const props_1 = require("../common/props");
12
+ exports.gmailReplyToEmailAction = (0, pieces_framework_1.createAction)({
13
+ auth: __1.gmailAuth,
14
+ name: 'reply_to_email',
15
+ displayName: 'Reply to Email',
16
+ description: 'Reply to an existing email.',
17
+ props: {
18
+ message_id: props_1.GmailProps.message,
19
+ reply_type: pieces_framework_1.Property.StaticDropdown({
20
+ displayName: 'Reply Type',
21
+ description: 'Choose whether to reply to sender only or to all recipients',
22
+ required: true,
23
+ defaultValue: 'reply',
24
+ options: {
25
+ disabled: false,
26
+ options: [
27
+ {
28
+ label: 'Reply (to sender only)',
29
+ value: 'reply',
30
+ },
31
+ {
32
+ label: 'Reply All (to all recipients)',
33
+ value: 'reply_all',
34
+ },
35
+ ],
36
+ },
37
+ }),
38
+ body_type: pieces_framework_1.Property.StaticDropdown({
39
+ displayName: 'Body Type',
40
+ required: true,
41
+ defaultValue: 'plain_text',
42
+ options: {
43
+ disabled: false,
44
+ options: [
45
+ {
46
+ label: 'Plain text',
47
+ value: 'plain_text',
48
+ },
49
+ {
50
+ label: 'HTML',
51
+ value: 'html',
52
+ },
53
+ ],
54
+ },
55
+ }),
56
+ body: pieces_framework_1.Property.LongText({
57
+ displayName: 'Reply Body',
58
+ description: 'Your reply message content',
59
+ required: true,
60
+ }),
61
+ sender_name: pieces_framework_1.Property.ShortText({
62
+ displayName: 'Sender Name',
63
+ description: 'Optional sender name to display',
64
+ required: false,
65
+ }),
66
+ attachment: pieces_framework_1.Property.File({
67
+ displayName: 'Attachment',
68
+ description: 'Optional file to attach to your reply',
69
+ required: false,
70
+ }),
71
+ attachment_name: pieces_framework_1.Property.ShortText({
72
+ displayName: 'Attachment Name',
73
+ description: 'Custom name for the attachment',
74
+ required: false,
75
+ }),
76
+ },
77
+ run(context) {
78
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
+ var _a;
80
+ const authClient = new googleapis_common_1.OAuth2Client();
81
+ authClient.setCredentials(context.auth);
82
+ const gmail = googleapis_1.google.gmail({ version: 'v1', auth: authClient });
83
+ const originalMessage = yield gmail.users.messages.get({
84
+ userId: 'me',
85
+ id: context.propsValue.message_id,
86
+ format: 'full',
87
+ });
88
+ if (!originalMessage.data || !originalMessage.data.payload) {
89
+ throw new Error('Could not fetch original message details');
90
+ }
91
+ const headers = originalMessage.data.payload.headers || [];
92
+ const headerMap = headers.reduce((acc, header) => {
93
+ if (header.name && header.value) {
94
+ acc[header.name.toLowerCase()] = header.value;
95
+ }
96
+ return acc;
97
+ }, {});
98
+ const originalSubject = headerMap['subject'] || '';
99
+ const originalFrom = headerMap['from'] || '';
100
+ const originalTo = headerMap['to'] || '';
101
+ const originalCc = headerMap['cc'] || '';
102
+ const originalReplyTo = headerMap['reply-to'] || '';
103
+ const originalMessageId = headerMap['message-id'] || '';
104
+ const originalReferences = headerMap['references'] || '';
105
+ const toRecipients = [];
106
+ const ccRecipients = [];
107
+ if (context.propsValue.reply_type === 'reply_all') {
108
+ const senderEmail = originalReplyTo || originalFrom;
109
+ if (senderEmail) {
110
+ toRecipients.push(senderEmail);
111
+ }
112
+ const currentUserEmail = (yield googleapis_1.google.oauth2({ version: 'v2', auth: authClient }).userinfo.get()).data.email;
113
+ if (originalTo) {
114
+ const toEmails = originalTo.split(',').map((email) => email.trim());
115
+ toRecipients.push(...toEmails.filter((email) => !email.includes(currentUserEmail || '')));
116
+ }
117
+ if (originalCc) {
118
+ const ccEmails = originalCc.split(',').map((email) => email.trim());
119
+ ccRecipients.push(...ccEmails.filter((email) => !email.includes(currentUserEmail || '')));
120
+ }
121
+ }
122
+ else {
123
+ const senderEmail = originalReplyTo || originalFrom;
124
+ if (senderEmail) {
125
+ toRecipients.push(senderEmail);
126
+ }
127
+ }
128
+ let replySubject = originalSubject;
129
+ if (!replySubject.toLowerCase().startsWith('re:')) {
130
+ replySubject = `Re: ${replySubject}`;
131
+ }
132
+ let referencesHeader = originalMessageId;
133
+ if (originalReferences) {
134
+ referencesHeader = `${originalReferences} ${originalMessageId}`;
135
+ }
136
+ const senderEmail = (yield googleapis_1.google.oauth2({ version: 'v2', auth: authClient }).userinfo.get()).data.email;
137
+ const subjectBase64 = Buffer.from(replySubject).toString('base64');
138
+ const mailOptions = {
139
+ to: toRecipients.join(', '),
140
+ cc: ccRecipients.length > 0 ? ccRecipients.join(', ') : undefined,
141
+ subject: `=?UTF-8?B?${subjectBase64}?=`,
142
+ text: context.propsValue.body_type === 'plain_text'
143
+ ? context.propsValue.body
144
+ : undefined,
145
+ html: context.propsValue.body_type === 'html'
146
+ ? context.propsValue.body
147
+ : undefined,
148
+ attachments: [],
149
+ headers: [
150
+ {
151
+ key: 'In-Reply-To',
152
+ value: originalMessageId,
153
+ },
154
+ {
155
+ key: 'References',
156
+ value: referencesHeader,
157
+ },
158
+ ],
159
+ };
160
+ if (senderEmail) {
161
+ mailOptions.from = context.propsValue.sender_name
162
+ ? `${context.propsValue.sender_name} <${senderEmail}>`
163
+ : senderEmail;
164
+ }
165
+ if (context.propsValue.attachment) {
166
+ const lookupResult = mime_types_1.default.lookup(context.propsValue.attachment.extension || '');
167
+ const attachmentOption = [
168
+ {
169
+ filename: (_a = context.propsValue.attachment_name) !== null && _a !== void 0 ? _a : context.propsValue.attachment.filename,
170
+ content: context.propsValue.attachment.base64,
171
+ contentType: lookupResult || undefined,
172
+ encoding: 'base64',
173
+ },
174
+ ];
175
+ mailOptions.attachments = attachmentOption;
176
+ }
177
+ const mail = new mail_composer_1.default(mailOptions).compile();
178
+ mail.keepBcc = true;
179
+ const mailBody = yield mail.build();
180
+ const encodedPayload = Buffer.from(mailBody)
181
+ .toString('base64')
182
+ .replace(/\+/g, '-')
183
+ .replace(/\//g, '_');
184
+ const response = yield gmail.users.messages.send({
185
+ userId: 'me',
186
+ requestBody: {
187
+ threadId: originalMessage.data.threadId || undefined,
188
+ raw: encodedPayload,
189
+ },
190
+ });
191
+ return response.data;
192
+ });
193
+ },
194
+ });
195
+ //# sourceMappingURL=reply-to-email-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reply-to-email-action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/gmail/src/lib/actions/reply-to-email-action.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,oEAA8B;AAC9B,yFAAwD;AAExD,8BAAmC;AACnC,2CAAoC;AACpC,yDAAiD;AACjD,2CAA6C;AAEhC,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,6BAA6B;IAC1C,KAAK,EAAE;QACL,UAAU,EAAE,kBAAU,CAAC,OAAO;QAC9B,UAAU,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAClC,WAAW,EAAE,YAAY;YACzB,WAAW,EACT,6DAA6D;YAC/D,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,OAAO;YACrB,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,OAA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,QAAQ,CAAC;iBAClB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;iBACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAEvB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC/C,MAAM,EAAE,IAAI;gBACZ,WAAW,EAAE;oBACX,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS;oBACpD,GAAG,EAAE,cAAc;iBACpB;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const requestApprovalInEmail: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ receiver: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ cc: import("@scopieflows/pieces-framework").ArrayProperty<false>;
4
+ bcc: import("@scopieflows/pieces-framework").ArrayProperty<false>;
5
+ subject: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
6
+ body: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
7
+ reply_to: import("@scopieflows/pieces-framework").ArrayProperty<false>;
8
+ sender_name: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
9
+ from: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
10
+ in_reply_to: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
11
+ }>;
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestApprovalInEmail = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const __1 = require("../..");
7
+ const googleapis_1 = require("googleapis");
8
+ const googleapis_common_1 = require("googleapis-common");
9
+ const mail_composer_1 = tslib_1.__importDefault(require("nodemailer/lib/mail-composer"));
10
+ const shared_1 = require("@scopieflows/shared");
11
+ exports.requestApprovalInEmail = (0, pieces_framework_1.createAction)({
12
+ auth: __1.gmailAuth,
13
+ name: 'request_approval_in_mail',
14
+ displayName: 'Request Approval in Email',
15
+ description: 'Send approval request email and then wait until the email is approved or disapproved',
16
+ props: {
17
+ receiver: pieces_framework_1.Property.ShortText({
18
+ displayName: 'Receiver Email (To)',
19
+ description: 'The email address of the recipient who will receive the approval request.',
20
+ required: true,
21
+ }),
22
+ cc: pieces_framework_1.Property.Array({
23
+ displayName: 'CC Email',
24
+ description: 'The email addresses of the recipients who will receive a carbon copy of the approval request.',
25
+ required: false,
26
+ }),
27
+ bcc: pieces_framework_1.Property.Array({
28
+ displayName: 'BCC Email',
29
+ description: 'The email addresses of the recipients who will receive a blind carbon copy of the approval request.',
30
+ required: false,
31
+ }),
32
+ subject: pieces_framework_1.Property.ShortText({
33
+ displayName: 'Subject',
34
+ description: 'The subject of the approval request email.',
35
+ required: true,
36
+ }),
37
+ body: pieces_framework_1.Property.ShortText({
38
+ displayName: 'Body',
39
+ description: 'Body for the email you want to send',
40
+ required: true,
41
+ }),
42
+ reply_to: pieces_framework_1.Property.Array({
43
+ displayName: 'Reply-To Email',
44
+ description: 'Email address to set as the "Reply-To" header',
45
+ required: false,
46
+ }),
47
+ sender_name: pieces_framework_1.Property.ShortText({
48
+ displayName: 'Sender Name',
49
+ required: false,
50
+ }),
51
+ from: pieces_framework_1.Property.ShortText({
52
+ displayName: 'Sender Email',
53
+ description: "The address must be listed in your GMail account's settings",
54
+ required: false,
55
+ }),
56
+ in_reply_to: pieces_framework_1.Property.ShortText({
57
+ displayName: 'In reply to',
58
+ description: 'Reply to this Message-ID',
59
+ required: false,
60
+ }),
61
+ },
62
+ run(context) {
63
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
64
+ var _a, _b, _c, _d;
65
+ if (context.executionType === shared_1.ExecutionType.BEGIN) {
66
+ try {
67
+ const token = context.auth.access_token;
68
+ const { subject, body } = context.propsValue;
69
+ (0, shared_1.assertNotNullOrUndefined)(token, 'token');
70
+ (0, shared_1.assertNotNullOrUndefined)(context.propsValue.receiver, 'receiver');
71
+ (0, shared_1.assertNotNullOrUndefined)(subject, 'subject');
72
+ (0, shared_1.assertNotNullOrUndefined)(body, 'body');
73
+ const approvalLink = context.generateResumeUrl({
74
+ queryParams: { action: 'approve' },
75
+ });
76
+ const disapprovalLink = context.generateResumeUrl({
77
+ queryParams: { action: 'disapprove' },
78
+ });
79
+ const htmlBody = `
80
+ <div>
81
+ <p>${body}</p>
82
+ <br />
83
+ <p>
84
+ <a href="${approvalLink}" style="display: inline-block; padding: 10px 20px; margin-right: 10px; background-color: #2acc50; color: white; text-decoration: none; border-radius: 4px;">Approve</a>
85
+ <a href="${disapprovalLink}" style="display: inline-block; padding: 10px 20px; background-color: #e4172b; color: white; text-decoration: none; border-radius: 4px;">Disapprove</a>
86
+ </p>
87
+ </div>
88
+ `;
89
+ const authClient = new googleapis_common_1.OAuth2Client();
90
+ authClient.setCredentials(context.auth);
91
+ const gmail = googleapis_1.google.gmail({ version: 'v1', auth: authClient });
92
+ const subjectBase64 = Buffer.from(context.propsValue['subject']).toString('base64');
93
+ const replyTo = (_a = context.propsValue['reply_to']) === null || _a === void 0 ? void 0 : _a.filter((email) => email !== '');
94
+ const receiverEmail = context.propsValue.receiver;
95
+ const cc = (_b = context.propsValue['cc']) === null || _b === void 0 ? void 0 : _b.filter((email) => email !== '');
96
+ const bcc = (_c = context.propsValue['bcc']) === null || _c === void 0 ? void 0 : _c.filter((email) => email !== '');
97
+ const mailOptions = {
98
+ to: receiverEmail,
99
+ cc: cc ? cc.join(', ') : undefined,
100
+ bcc: bcc ? bcc.join(', ') : undefined,
101
+ subject: `=?UTF-8?B?${subjectBase64}?=`,
102
+ replyTo: replyTo ? replyTo.join(', ') : '',
103
+ // text:
104
+ // context.propsValue.body_type === 'plain_text'
105
+ // ? context.propsValue['body']
106
+ // : undefined,
107
+ html: htmlBody,
108
+ attachments: [],
109
+ };
110
+ const senderEmail = context.propsValue.from ||
111
+ (yield googleapis_1.google
112
+ .oauth2({ version: 'v2', auth: authClient })
113
+ .userinfo.get()).data.email;
114
+ if (senderEmail) {
115
+ mailOptions.from = context.propsValue.sender_name
116
+ ? `${context.propsValue['sender_name']} <${senderEmail}>`
117
+ : senderEmail;
118
+ }
119
+ let threadId = undefined;
120
+ if (context.propsValue.in_reply_to) {
121
+ mailOptions.headers = [
122
+ {
123
+ key: 'References',
124
+ value: context.propsValue.in_reply_to,
125
+ },
126
+ {
127
+ key: 'In-Reply-To',
128
+ value: context.propsValue.in_reply_to,
129
+ },
130
+ ];
131
+ const messages = yield gmail.users.messages.list({
132
+ userId: 'me',
133
+ q: `Rfc822msgid:${context.propsValue.in_reply_to}`,
134
+ });
135
+ threadId = (_d = messages.data.messages) === null || _d === void 0 ? void 0 : _d[0].threadId;
136
+ }
137
+ const mail = new mail_composer_1.default(mailOptions).compile();
138
+ mail.keepBcc = true;
139
+ const mailBody = yield mail.build();
140
+ const encodedPayload = Buffer.from(mailBody)
141
+ .toString('base64')
142
+ .replace(/\+/g, '-')
143
+ .replace(/\//g, '_');
144
+ yield gmail.users.messages.send({
145
+ userId: 'me',
146
+ requestBody: {
147
+ threadId,
148
+ raw: encodedPayload,
149
+ },
150
+ });
151
+ context.run.pause({
152
+ pauseMetadata: {
153
+ type: shared_1.PauseType.WEBHOOK,
154
+ response: {},
155
+ },
156
+ });
157
+ return {
158
+ approved: false, // default approval is false
159
+ };
160
+ }
161
+ catch (error) {
162
+ console.error('[RequestApprovalEmail] Error during BEGIN execution:', error);
163
+ throw error;
164
+ }
165
+ }
166
+ else {
167
+ const action = context.resumePayload.queryParams['action'];
168
+ const approved = action === 'approve';
169
+ return {
170
+ approved,
171
+ };
172
+ }
173
+ });
174
+ },
175
+ });
176
+ //# sourceMappingURL=request-approval-in-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-approval-in-email.js","sourceRoot":"","sources":["../../../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AAE,CAAC;oBAEpC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;yBACzC,QAAQ,CAAC,QAAQ,CAAC;yBAClB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;yBACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;oBACvB,MAAM,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;wBAC9B,MAAM,EAAE,IAAI;wBACZ,WAAW,EAAE;4BACX,QAAQ;4BACR,GAAG,EAAE,cAAc;yBACpB;qBACF,CAAC,CAAC;oBACH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;wBAChB,aAAa,EAAE;4BACb,IAAI,EAAE,kBAAS,CAAC,OAAO;4BACvB,QAAQ,EAAE,EAAE;yBACb;qBACF,CAAC,CAAC;oBAEH,OAAO;wBACL,QAAQ,EAAE,KAAK,EAAE,4BAA4B;qBAC9C,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,KAAK,CACX,sDAAsD,EACtD,KAAK,CACN,CAAC;oBACF,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;gBAC3D,MAAM,QAAQ,GAAG,MAAM,KAAK,SAAS,CAAC;gBAEtC,OAAO;oBACL,QAAQ;iBACT,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { GmailLabel } from '../common/models';
2
+ export declare const gmailSearchMailAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
3
+ from: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
4
+ to: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
5
+ subject: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
6
+ content: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
7
+ has_attachment: import("@scopieflows/pieces-framework").CheckboxProperty<false>;
8
+ attachment_name: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
9
+ label: import("@scopieflows/pieces-framework").DropdownProperty<GmailLabel, false, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
10
+ category: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, false>;
11
+ after_date: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
12
+ before_date: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
13
+ include_spam_trash: import("@scopieflows/pieces-framework").CheckboxProperty<false>;
14
+ max_results: import("@scopieflows/pieces-framework").NumberProperty<false>;
15
+ }>;