@bigbinary/neeto-playwright-commons 3.0.5 → 3.0.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/index.cjs.js +32 -17
- package/index.cjs.js.map +1 -1
- package/index.d.ts +53 -48
- package/index.js +32 -17
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -340,23 +340,6 @@ class MemberApis {
|
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
const NEETO_EMAIL_DELIVERY_TESTING_BASE_URL = "/neeto_email_delivery/api/v1/testing";
|
|
344
|
-
class NeetoEmailDeliveryApi {
|
|
345
|
-
neetoPlaywrightUtilities;
|
|
346
|
-
constructor(neetoPlaywrightUtilities) {
|
|
347
|
-
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
348
|
-
}
|
|
349
|
-
connect = ({ ownerId, ...payload }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
350
|
-
method: "post",
|
|
351
|
-
url: `${NEETO_EMAIL_DELIVERY_TESTING_BASE_URL}/connect`,
|
|
352
|
-
body: neetoCist.keysToSnakeCase({ ownerId, connect: payload }),
|
|
353
|
-
});
|
|
354
|
-
verifyEmail = (params) => this.neetoPlaywrightUtilities.apiRequest({
|
|
355
|
-
url: `${NEETO_EMAIL_DELIVERY_TESTING_BASE_URL}/verify_email`,
|
|
356
|
-
params: neetoCist.keysToSnakeCase(params),
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
|
|
360
343
|
class RailsEmailApiClient {
|
|
361
344
|
port = process.env.RAILS_SERVER_PORT;
|
|
362
345
|
subdomain = process.env.SUBDOMAIN ?? "spinkart";
|
|
@@ -125297,6 +125280,23 @@ class NeetoAuthServer {
|
|
|
125297
125280
|
};
|
|
125298
125281
|
}
|
|
125299
125282
|
|
|
125283
|
+
const NEETO_EMAIL_DELIVERY_TESTING_BASE_URL = "/neeto_email_delivery/api/v1/testing";
|
|
125284
|
+
class NeetoEmailDeliveryApi {
|
|
125285
|
+
neetoPlaywrightUtilities;
|
|
125286
|
+
constructor(neetoPlaywrightUtilities) {
|
|
125287
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
125288
|
+
}
|
|
125289
|
+
connect = ({ ownerId, ...payload }) => this.neetoPlaywrightUtilities.apiRequest({
|
|
125290
|
+
method: "post",
|
|
125291
|
+
url: `${NEETO_EMAIL_DELIVERY_TESTING_BASE_URL}/connect`,
|
|
125292
|
+
body: neetoCist.keysToSnakeCase({ ownerId, connect: payload }),
|
|
125293
|
+
});
|
|
125294
|
+
verifyEmail = (params) => this.neetoPlaywrightUtilities.apiRequest({
|
|
125295
|
+
url: `${NEETO_EMAIL_DELIVERY_TESTING_BASE_URL}/verify_email`,
|
|
125296
|
+
params: neetoCist.keysToSnakeCase(params),
|
|
125297
|
+
});
|
|
125298
|
+
}
|
|
125299
|
+
|
|
125300
125300
|
const REFRESH_TOKEN_ENV_KEYS = {
|
|
125301
125301
|
gmail: "EMAIL_DELIVERY_GMAIL_REFRESH_TOKEN",
|
|
125302
125302
|
outlook: "EMAIL_DELIVERY_OUTLOOK_REFRESH_TOKEN",
|
|
@@ -125304,6 +125304,7 @@ const REFRESH_TOKEN_ENV_KEYS = {
|
|
|
125304
125304
|
const FROM_EMAIL_ENV_KEYS = {
|
|
125305
125305
|
gmail: "EMAIL_DELIVERY_CONNECTED_GMAIL",
|
|
125306
125306
|
outlook: "EMAIL_DELIVERY_CONNECTED_OUTLOOK",
|
|
125307
|
+
sparkpost: "EMAIL_DELIVERY_CONNECTED_SPARKPOST",
|
|
125307
125308
|
};
|
|
125308
125309
|
class EmailDeliveryUtils {
|
|
125309
125310
|
neetoPlaywrightUtilities;
|
|
@@ -125313,6 +125314,20 @@ class EmailDeliveryUtils {
|
|
|
125313
125314
|
this.emailDeliveryApi = new NeetoEmailDeliveryApi(neetoPlaywrightUtilities);
|
|
125314
125315
|
}
|
|
125315
125316
|
connectViaRequest = async ({ provider, ownerId }) => {
|
|
125317
|
+
if (provider === "sparkpost") {
|
|
125318
|
+
const sparkpostEmailEnvKey = FROM_EMAIL_ENV_KEYS.sparkpost;
|
|
125319
|
+
const email = process.env[sparkpostEmailEnvKey];
|
|
125320
|
+
if (ramda.isNil(email)) {
|
|
125321
|
+
throw new Error(`ENV variable ${sparkpostEmailEnvKey} is not properly configured`);
|
|
125322
|
+
}
|
|
125323
|
+
const response = await this.emailDeliveryApi.connect({
|
|
125324
|
+
emailProvider: "sparkpost",
|
|
125325
|
+
email,
|
|
125326
|
+
ownerId,
|
|
125327
|
+
});
|
|
125328
|
+
test.expect(response?.ok()).toBeTruthy();
|
|
125329
|
+
return response;
|
|
125330
|
+
}
|
|
125316
125331
|
const refreshTokenEnvKey = REFRESH_TOKEN_ENV_KEYS[provider];
|
|
125317
125332
|
const refreshToken = process.env[refreshTokenEnvKey];
|
|
125318
125333
|
if (ramda.isNil(refreshToken)) {
|