@camstack/addon-google-services 0.1.5 → 0.1.6
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/dist/google-services.addon.js +37 -16
- package/dist/google-services.addon.mjs +36 -17
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
|
@@ -53132,40 +53132,53 @@ function needsRefresh(state, nowMs = Date.now()) {
|
|
|
53132
53132
|
* Operator-facing setup copy for Connectivity → Calendars / Email.
|
|
53133
53133
|
* Keep Connect as a same-origin relative link so the admin session cookie
|
|
53134
53134
|
* rides along (an absolute Public URL from a LAN admin tab drops the cookie).
|
|
53135
|
+
* Root-relative hrefs must survive `sanitizeInfoHtml` in ui-library.
|
|
53135
53136
|
*/
|
|
53137
|
+
/** Enable APIs library in Google Cloud Console. */
|
|
53138
|
+
var GOOGLE_CONSOLE_APIS_URL = "https://console.cloud.google.com/apis/library";
|
|
53139
|
+
/** Create / manage OAuth Web clients. */
|
|
53140
|
+
var GOOGLE_CONSOLE_CREDENTIALS_URL = "https://console.cloud.google.com/apis/credentials";
|
|
53136
53141
|
function redirectUriDisplay(publicOrigin) {
|
|
53137
53142
|
if (publicOrigin === null || publicOrigin.length === 0) return `<public-hub>${OAUTH_CALLBACK_SUFFIX}`;
|
|
53138
53143
|
return `${publicOrigin.replace(/\/$/, "")}${OAUTH_CALLBACK_SUFFIX}`;
|
|
53139
53144
|
}
|
|
53145
|
+
function consoleLinksHtml() {
|
|
53146
|
+
return [
|
|
53147
|
+
`<a href="${GOOGLE_CONSOLE_APIS_URL}">API library</a>`,
|
|
53148
|
+
` · `,
|
|
53149
|
+
`<a href="${GOOGLE_CONSOLE_CREDENTIALS_URL}">Credentials</a>`
|
|
53150
|
+
].join("");
|
|
53151
|
+
}
|
|
53140
53152
|
function introHtml(cap, publicOrigin) {
|
|
53141
53153
|
const redirect = escapeHtml$1(redirectUriDisplay(publicOrigin));
|
|
53154
|
+
const console = consoleLinksHtml();
|
|
53142
53155
|
if (cap === "smtp-provider") return [
|
|
53143
53156
|
"<ol>",
|
|
53144
|
-
|
|
53145
|
-
"<li>
|
|
53146
|
-
`<li>Add this authorized redirect URI (Network → <
|
|
53147
|
-
"<li>Paste Client ID and Client secret below, then <
|
|
53157
|
+
`<li>Open Google Cloud Console (${console}) and enable the <strong>Gmail API</strong> (and Calendar API if you also use Calendars).</li>`,
|
|
53158
|
+
"<li>Under Credentials, create an OAuth client of type <strong>Web application</strong>.</li>",
|
|
53159
|
+
`<li>Add this authorized redirect URI (Network → <strong>Public endpoint</strong>, not Internal): <code>${redirect}</code></li>`,
|
|
53160
|
+
"<li>Paste Client ID and Client secret below, then <strong>Save</strong>.</li>",
|
|
53148
53161
|
`<li>Open <a href="${OAUTH_START_PATH}">Connect Google</a> while signed in as admin (same browser tab as this hub).</li>`,
|
|
53149
|
-
"<li>Set From address (connected account or a verified send-as). Turn this integration off with the page <
|
|
53162
|
+
"<li>Set From address (connected account or a verified send-as). Turn this integration off with the page <strong>Enable</strong> toggle when you do not want Gmail send — Calendar can stay connected.</li>",
|
|
53150
53163
|
"</ol>"
|
|
53151
53164
|
].join("");
|
|
53152
53165
|
if (cap === "calendar-source") return [
|
|
53153
53166
|
"<ol>",
|
|
53154
|
-
|
|
53155
|
-
"<li>
|
|
53156
|
-
`<li>Add this authorized redirect URI (Network → <
|
|
53157
|
-
"<li>Paste Client ID and Client secret below, then <
|
|
53167
|
+
`<li>Open Google Cloud Console (${console}) and enable the <strong>Google Calendar API</strong> (and Gmail API if you also use Email).</li>`,
|
|
53168
|
+
"<li>Under Credentials, create an OAuth client of type <strong>Web application</strong>.</li>",
|
|
53169
|
+
`<li>Add this authorized redirect URI (Network → <strong>Public endpoint</strong>, not Internal): <code>${redirect}</code></li>`,
|
|
53170
|
+
"<li>Paste Client ID and Client secret below, then <strong>Save</strong>.</li>",
|
|
53158
53171
|
`<li>Open <a href="${OAUTH_START_PATH}">Connect Google</a> while signed in as admin (same browser tab as this hub).</li>`,
|
|
53159
53172
|
"<li>Optionally restrict which calendars are exposed with the filter below.</li>",
|
|
53160
53173
|
"</ol>"
|
|
53161
53174
|
].join("");
|
|
53162
53175
|
return [
|
|
53163
53176
|
"<ol>",
|
|
53164
|
-
|
|
53165
|
-
"<li>Create a <
|
|
53177
|
+
`<li>Open Google Cloud Console (${console}) and enable <strong>Google Calendar API</strong> and <strong>Gmail API</strong>.</li>`,
|
|
53178
|
+
"<li>Create a <strong>Web application</strong> OAuth client under Credentials.</li>",
|
|
53166
53179
|
`<li>Register redirect URI: <code>${redirect}</code> (Network → Public endpoint).</li>`,
|
|
53167
|
-
|
|
53168
|
-
"<li>Calendars and Email share one Google account; use each page’s <
|
|
53180
|
+
`<li>Paste Client ID / secret, Save, then <a href="${OAUTH_START_PATH}">Connect Google</a>.</li>`,
|
|
53181
|
+
"<li>Calendars and Email share one Google account; use each page’s <strong>Enable</strong> toggle to turn a capability off without revoking OAuth.</li>",
|
|
53169
53182
|
"</ol>"
|
|
53170
53183
|
].join("");
|
|
53171
53184
|
}
|
|
@@ -53175,14 +53188,20 @@ function connectHtml(cap, publicOrigin) {
|
|
|
53175
53188
|
`After Save, open <a href="${OAUTH_START_PATH}">Connect Google</a> in this hub (admin session required). `,
|
|
53176
53189
|
"Connect requests <code>gmail.send</code> (and Calendar read for the Calendars page). ",
|
|
53177
53190
|
`Google must list exactly: <code>${redirect}</code>. `,
|
|
53178
|
-
"If an older Connect predates Gmail send, revoke CamStack in Google Account → Security and Connect again."
|
|
53191
|
+
"If an older Connect predates Gmail send, revoke CamStack in Google Account → Security and Connect again. ",
|
|
53192
|
+
`Console: ${consoleLinksHtml()}.`
|
|
53179
53193
|
].join("");
|
|
53180
53194
|
if (cap === "calendar-source") return [
|
|
53181
53195
|
`After Save, open <a href="${OAUTH_START_PATH}">Connect Google</a> in this hub (admin session required). `,
|
|
53182
53196
|
"Connect requests <code>calendar.readonly</code> (and Gmail send for the Email page). ",
|
|
53183
|
-
`Google must list exactly: <code>${redirect}</code
|
|
53197
|
+
`Google must list exactly: <code>${redirect}</code>. `,
|
|
53198
|
+
`Console: ${consoleLinksHtml()}.`
|
|
53199
|
+
].join("");
|
|
53200
|
+
return [
|
|
53201
|
+
`After Save, open <a href="${OAUTH_START_PATH}">Connect Google</a>. `,
|
|
53202
|
+
`Redirect URI registered in Google Cloud must be <code>${redirect}</code>. `,
|
|
53203
|
+
`Console: ${consoleLinksHtml()}.`
|
|
53184
53204
|
].join("");
|
|
53185
|
-
return [`After Save, open <a href="${OAUTH_START_PATH}">Connect Google</a>. `, `Redirect URI registered in Google Cloud must be <code>${redirect}</code>.`].join("");
|
|
53186
53205
|
}
|
|
53187
53206
|
function escapeHtml$1(s) {
|
|
53188
53207
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -53475,6 +53494,8 @@ function escapeHtml(s) {
|
|
|
53475
53494
|
}
|
|
53476
53495
|
//#endregion
|
|
53477
53496
|
exports.DEFAULT_GOOGLE_CONFIG = DEFAULT_GOOGLE_CONFIG;
|
|
53497
|
+
exports.GOOGLE_CONSOLE_APIS_URL = GOOGLE_CONSOLE_APIS_URL;
|
|
53498
|
+
exports.GOOGLE_CONSOLE_CREDENTIALS_URL = GOOGLE_CONSOLE_CREDENTIALS_URL;
|
|
53478
53499
|
exports.GOOGLE_GMAIL_SEND_SCOPE = GOOGLE_GMAIL_SEND_SCOPE;
|
|
53479
53500
|
exports.GOOGLE_OAUTH_SCOPES = GOOGLE_OAUTH_SCOPES;
|
|
53480
53501
|
exports.GoogleServicesAddon = GoogleServicesAddon;
|
|
@@ -53128,40 +53128,53 @@ function needsRefresh(state, nowMs = Date.now()) {
|
|
|
53128
53128
|
* Operator-facing setup copy for Connectivity → Calendars / Email.
|
|
53129
53129
|
* Keep Connect as a same-origin relative link so the admin session cookie
|
|
53130
53130
|
* rides along (an absolute Public URL from a LAN admin tab drops the cookie).
|
|
53131
|
+
* Root-relative hrefs must survive `sanitizeInfoHtml` in ui-library.
|
|
53131
53132
|
*/
|
|
53133
|
+
/** Enable APIs library in Google Cloud Console. */
|
|
53134
|
+
var GOOGLE_CONSOLE_APIS_URL = "https://console.cloud.google.com/apis/library";
|
|
53135
|
+
/** Create / manage OAuth Web clients. */
|
|
53136
|
+
var GOOGLE_CONSOLE_CREDENTIALS_URL = "https://console.cloud.google.com/apis/credentials";
|
|
53132
53137
|
function redirectUriDisplay(publicOrigin) {
|
|
53133
53138
|
if (publicOrigin === null || publicOrigin.length === 0) return `<public-hub>${OAUTH_CALLBACK_SUFFIX}`;
|
|
53134
53139
|
return `${publicOrigin.replace(/\/$/, "")}${OAUTH_CALLBACK_SUFFIX}`;
|
|
53135
53140
|
}
|
|
53141
|
+
function consoleLinksHtml() {
|
|
53142
|
+
return [
|
|
53143
|
+
`<a href="${GOOGLE_CONSOLE_APIS_URL}">API library</a>`,
|
|
53144
|
+
` · `,
|
|
53145
|
+
`<a href="${GOOGLE_CONSOLE_CREDENTIALS_URL}">Credentials</a>`
|
|
53146
|
+
].join("");
|
|
53147
|
+
}
|
|
53136
53148
|
function introHtml(cap, publicOrigin) {
|
|
53137
53149
|
const redirect = escapeHtml$1(redirectUriDisplay(publicOrigin));
|
|
53150
|
+
const console = consoleLinksHtml();
|
|
53138
53151
|
if (cap === "smtp-provider") return [
|
|
53139
53152
|
"<ol>",
|
|
53140
|
-
|
|
53141
|
-
"<li>
|
|
53142
|
-
`<li>Add this authorized redirect URI (Network → <
|
|
53143
|
-
"<li>Paste Client ID and Client secret below, then <
|
|
53153
|
+
`<li>Open Google Cloud Console (${console}) and enable the <strong>Gmail API</strong> (and Calendar API if you also use Calendars).</li>`,
|
|
53154
|
+
"<li>Under Credentials, create an OAuth client of type <strong>Web application</strong>.</li>",
|
|
53155
|
+
`<li>Add this authorized redirect URI (Network → <strong>Public endpoint</strong>, not Internal): <code>${redirect}</code></li>`,
|
|
53156
|
+
"<li>Paste Client ID and Client secret below, then <strong>Save</strong>.</li>",
|
|
53144
53157
|
`<li>Open <a href="${OAUTH_START_PATH}">Connect Google</a> while signed in as admin (same browser tab as this hub).</li>`,
|
|
53145
|
-
"<li>Set From address (connected account or a verified send-as). Turn this integration off with the page <
|
|
53158
|
+
"<li>Set From address (connected account or a verified send-as). Turn this integration off with the page <strong>Enable</strong> toggle when you do not want Gmail send — Calendar can stay connected.</li>",
|
|
53146
53159
|
"</ol>"
|
|
53147
53160
|
].join("");
|
|
53148
53161
|
if (cap === "calendar-source") return [
|
|
53149
53162
|
"<ol>",
|
|
53150
|
-
|
|
53151
|
-
"<li>
|
|
53152
|
-
`<li>Add this authorized redirect URI (Network → <
|
|
53153
|
-
"<li>Paste Client ID and Client secret below, then <
|
|
53163
|
+
`<li>Open Google Cloud Console (${console}) and enable the <strong>Google Calendar API</strong> (and Gmail API if you also use Email).</li>`,
|
|
53164
|
+
"<li>Under Credentials, create an OAuth client of type <strong>Web application</strong>.</li>",
|
|
53165
|
+
`<li>Add this authorized redirect URI (Network → <strong>Public endpoint</strong>, not Internal): <code>${redirect}</code></li>`,
|
|
53166
|
+
"<li>Paste Client ID and Client secret below, then <strong>Save</strong>.</li>",
|
|
53154
53167
|
`<li>Open <a href="${OAUTH_START_PATH}">Connect Google</a> while signed in as admin (same browser tab as this hub).</li>`,
|
|
53155
53168
|
"<li>Optionally restrict which calendars are exposed with the filter below.</li>",
|
|
53156
53169
|
"</ol>"
|
|
53157
53170
|
].join("");
|
|
53158
53171
|
return [
|
|
53159
53172
|
"<ol>",
|
|
53160
|
-
|
|
53161
|
-
"<li>Create a <
|
|
53173
|
+
`<li>Open Google Cloud Console (${console}) and enable <strong>Google Calendar API</strong> and <strong>Gmail API</strong>.</li>`,
|
|
53174
|
+
"<li>Create a <strong>Web application</strong> OAuth client under Credentials.</li>",
|
|
53162
53175
|
`<li>Register redirect URI: <code>${redirect}</code> (Network → Public endpoint).</li>`,
|
|
53163
|
-
|
|
53164
|
-
"<li>Calendars and Email share one Google account; use each page’s <
|
|
53176
|
+
`<li>Paste Client ID / secret, Save, then <a href="${OAUTH_START_PATH}">Connect Google</a>.</li>`,
|
|
53177
|
+
"<li>Calendars and Email share one Google account; use each page’s <strong>Enable</strong> toggle to turn a capability off without revoking OAuth.</li>",
|
|
53165
53178
|
"</ol>"
|
|
53166
53179
|
].join("");
|
|
53167
53180
|
}
|
|
@@ -53171,14 +53184,20 @@ function connectHtml(cap, publicOrigin) {
|
|
|
53171
53184
|
`After Save, open <a href="${OAUTH_START_PATH}">Connect Google</a> in this hub (admin session required). `,
|
|
53172
53185
|
"Connect requests <code>gmail.send</code> (and Calendar read for the Calendars page). ",
|
|
53173
53186
|
`Google must list exactly: <code>${redirect}</code>. `,
|
|
53174
|
-
"If an older Connect predates Gmail send, revoke CamStack in Google Account → Security and Connect again."
|
|
53187
|
+
"If an older Connect predates Gmail send, revoke CamStack in Google Account → Security and Connect again. ",
|
|
53188
|
+
`Console: ${consoleLinksHtml()}.`
|
|
53175
53189
|
].join("");
|
|
53176
53190
|
if (cap === "calendar-source") return [
|
|
53177
53191
|
`After Save, open <a href="${OAUTH_START_PATH}">Connect Google</a> in this hub (admin session required). `,
|
|
53178
53192
|
"Connect requests <code>calendar.readonly</code> (and Gmail send for the Email page). ",
|
|
53179
|
-
`Google must list exactly: <code>${redirect}</code
|
|
53193
|
+
`Google must list exactly: <code>${redirect}</code>. `,
|
|
53194
|
+
`Console: ${consoleLinksHtml()}.`
|
|
53195
|
+
].join("");
|
|
53196
|
+
return [
|
|
53197
|
+
`After Save, open <a href="${OAUTH_START_PATH}">Connect Google</a>. `,
|
|
53198
|
+
`Redirect URI registered in Google Cloud must be <code>${redirect}</code>. `,
|
|
53199
|
+
`Console: ${consoleLinksHtml()}.`
|
|
53180
53200
|
].join("");
|
|
53181
|
-
return [`After Save, open <a href="${OAUTH_START_PATH}">Connect Google</a>. `, `Redirect URI registered in Google Cloud must be <code>${redirect}</code>.`].join("");
|
|
53182
53201
|
}
|
|
53183
53202
|
function escapeHtml$1(s) {
|
|
53184
53203
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -53470,4 +53489,4 @@ function escapeHtml(s) {
|
|
|
53470
53489
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
53471
53490
|
}
|
|
53472
53491
|
//#endregion
|
|
53473
|
-
export { GoogleServicesAddon, GoogleServicesAddon as default,
|
|
53492
|
+
export { GoogleServicesAddon, GoogleServicesAddon as default, GOOGLE_GMAIL_SEND_SCOPE as _, redirectUriDisplay as a, OAUTH_START_PATH as b, exchangeCode as c, buildRawMime as d, createGmailSmtpProvider as f, DEFAULT_GOOGLE_CONFIG as g, mapGoogleEvent as h, introHtml as i, needsRefresh as l, createGoogleCalendarSource as m, GOOGLE_CONSOLE_CREDENTIALS_URL as n, applyTokenResponse as o, createGoogleCalendarApi as p, connectHtml as r, buildAuthorizeUrl as s, GOOGLE_CONSOLE_APIS_URL as t, refreshAccessToken as u, GOOGLE_OAUTH_SCOPES as v, GoogleServicesConfigSchema as y };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,8 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
const require_google_services_addon = require("./google-services.addon.js");
|
|
6
6
|
exports.DEFAULT_GOOGLE_CONFIG = require_google_services_addon.DEFAULT_GOOGLE_CONFIG;
|
|
7
|
+
exports.GOOGLE_CONSOLE_APIS_URL = require_google_services_addon.GOOGLE_CONSOLE_APIS_URL;
|
|
8
|
+
exports.GOOGLE_CONSOLE_CREDENTIALS_URL = require_google_services_addon.GOOGLE_CONSOLE_CREDENTIALS_URL;
|
|
7
9
|
exports.GOOGLE_GMAIL_SEND_SCOPE = require_google_services_addon.GOOGLE_GMAIL_SEND_SCOPE;
|
|
8
10
|
exports.GOOGLE_OAUTH_SCOPES = require_google_services_addon.GOOGLE_OAUTH_SCOPES;
|
|
9
11
|
exports.GoogleServicesAddon = require_google_services_addon.GoogleServicesAddon;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { GoogleServicesAddon, _ as
|
|
2
|
-
export { DEFAULT_GOOGLE_CONFIG, GOOGLE_GMAIL_SEND_SCOPE, GOOGLE_OAUTH_SCOPES, GoogleServicesAddon, GoogleServicesAddon as default, GoogleServicesConfigSchema, OAUTH_START_PATH, applyTokenResponse, buildAuthorizeUrl, buildRawMime, connectHtml, createGmailSmtpProvider, createGoogleCalendarApi, createGoogleCalendarSource, exchangeCode, introHtml, mapGoogleEvent, needsRefresh, redirectUriDisplay, refreshAccessToken };
|
|
1
|
+
import { GoogleServicesAddon, _ as GOOGLE_GMAIL_SEND_SCOPE, a as redirectUriDisplay, b as OAUTH_START_PATH, c as exchangeCode, d as buildRawMime, f as createGmailSmtpProvider, g as DEFAULT_GOOGLE_CONFIG, h as mapGoogleEvent, i as introHtml, l as needsRefresh, m as createGoogleCalendarSource, n as GOOGLE_CONSOLE_CREDENTIALS_URL, o as applyTokenResponse, p as createGoogleCalendarApi, r as connectHtml, s as buildAuthorizeUrl, t as GOOGLE_CONSOLE_APIS_URL, u as refreshAccessToken, v as GOOGLE_OAUTH_SCOPES, y as GoogleServicesConfigSchema } from "./google-services.addon.mjs";
|
|
2
|
+
export { DEFAULT_GOOGLE_CONFIG, GOOGLE_CONSOLE_APIS_URL, GOOGLE_CONSOLE_CREDENTIALS_URL, GOOGLE_GMAIL_SEND_SCOPE, GOOGLE_OAUTH_SCOPES, GoogleServicesAddon, GoogleServicesAddon as default, GoogleServicesConfigSchema, OAUTH_START_PATH, applyTokenResponse, buildAuthorizeUrl, buildRawMime, connectHtml, createGmailSmtpProvider, createGoogleCalendarApi, createGoogleCalendarSource, exchangeCode, introHtml, mapGoogleEvent, needsRefresh, redirectUriDisplay, refreshAccessToken };
|
package/package.json
CHANGED