@bigbinary/neeto-playwright-commons 4.11.17 → 4.12.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.
- package/index.d.ts +3 -1
- package/index.js +25 -5
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -10788,7 +10788,8 @@ interface ReplyInboundEmailParams extends InboundEmailParams {
|
|
|
10788
10788
|
replyToMessageId: string;
|
|
10789
10789
|
}
|
|
10790
10790
|
/**
|
|
10791
|
-
* Injects inbound emails via the Rails ActionMailbox conductor
|
|
10791
|
+
* Injects inbound emails via the Rails ActionMailbox conductor in development
|
|
10792
|
+
* and via the signed Mailgun ingress elsewhere.
|
|
10792
10793
|
*/
|
|
10793
10794
|
declare class InboundEmailApis {
|
|
10794
10795
|
private neetoPlaywrightUtilities;
|
|
@@ -10826,6 +10827,7 @@ declare class InboundEmailApis {
|
|
|
10826
10827
|
*/
|
|
10827
10828
|
reply: (emailParams: ReplyInboundEmailParams) => Promise<playwright_core.APIResponse<any> | undefined>;
|
|
10828
10829
|
private deliverSource;
|
|
10830
|
+
private deliverViaMailgunIngress;
|
|
10829
10831
|
}
|
|
10830
10832
|
export { ACTIONS, ADMIN_PANEL_SELECTORS, ALL_RESOURCES, ANALYTICS_RESOURCES, API_KEYS_SELECTORS, API_ROUTES, APP_RESOURCES, AUDIT_LOGS_SELECTORS, ApiKeysApi, ApiKeysPage, ApiKeysPageV2, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CERTIFICATE_PROVISION_FAILED_MESSAGE, CERTIFICATE_PROVISION_FAILED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_EDGE_CERTIFICATE_SUFFIX, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, ColorPickerUtils, CustomCommands, CustomCommandsV2, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_TIMEZONE_ID, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EDITOR_VERIFY_TEXT_COLOR, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmailDeliveryUtils, EmbedBase, FILE_FORMATS, FONTS_RESOURCES, FONT_SIZE_SELECTORS, FROM_EMAIL_ENV_KEYS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, HelpAndProfilePageV2, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_CI, IS_DEV_CI, IS_DEV_ENV, IS_MAILPIT_ENABLED, IS_PLAYWRIGHT_RUN, IS_REVIEW_ENV, IS_SHADCN_UI, IS_STAGING_ENV, IS_WEBKIT, ImageUploader, InboundEmailApis, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_DEFAULTS, LOGIN_SELECTORS, LOGIN_STRATEGIES, LOGIN_TIMEOUT, MAILPIT_BASE_URL, MAILPIT_DOMAIN_NAME, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, MailpitApi, Member, MemberApis, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoAuthServer, NeetoChatWidget, NeetoEmailDeliveryApi, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OTP_FETCH_TIMEOUT, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PRODUCT_ROLES_ROUTE_MAP, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, REVIEW_APP_CUSTOM_DOMAIN_SUFFIX, ROLES_SELECTORS, ROUTES, RailsEmailApiClient, RailsEmailUtils, RoleApis, RolesPage, RolesPageV2, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STATUS_TEXTS, STORAGE_STATE, SecurityApi, SidebarSection, SlackApi, SlackPage, SmsApi, SmsUtils, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEAM_MEMBER_TEXTS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THEMES_SELECTORS, THEMES_TEXTS, THIRD_PARTY_RESOURCES, THIRD_PARTY_ROUTES, TIME_RANGES, TOASTR_MESSAGES, TWILIO_SELECTORS, TagsApi, TagsPage, TeamMembers, TeamMembersV2, ThankYouApi, ThankYouPage, TwilioApi, USER_AGENTS, WEBHOOK_SELECTORS, WebhookSiteApi, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_TEST_EMAIL_V2, ZAPIER_WEB_TEXTS, ZapierPage, authenticateUser, baseURLGenerator, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, createOrganizationViaApi, createOrganizationViaRake, currencyUtils, dataQa, decodeQRCodeFromFile, definePlaywrightConfig, exampleEmail, executeWithThrottledResources, extractSubdomainFromError, filterUtils, fixedMenuSelector, generatePhoneNumber, generatePhoneNumberDetails, generateRandomBypassEmail, generateRandomFile, generateStagingData, getByDataQA, getClipboardContent, getDirname, getFormattedPhoneNumber, getFullUrl, getGithubToken, getGlobalUserProps, getGlobalUserState, getImagePathAndName, getIsoCodeFromPhoneCode, getListCount, globalShortcuts, grantClipboardPermissions, hexToRGB, hexToRGBA, i18nFixture, imageRegex, initializeCredentials, initializeReviewAppCredentials, initializeTestData, initializeTotp, isGithubIssueOpen, isStagingOrganizationExpired, joinHyphenCase, joinString, login, loginToReviewApp, mailpitDomainName, minutesAgo, networkConditions, networkThrottlingUsingCDP, optionSelector, readFileAsBrowserFile, readFileSyncIfExists, removeCredentialFile, reviewAppBaseURL, serializeFileForBrowser, shouldSkipCustomDomainSetup, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, waitForReviewApp, warmup, withCookieCache, writeDataToFile };
|
|
10831
10833
|
export type { BaseThemeStyle, BaseThemeStyleType, ColumnMenuAction, CountryProps, CustomFixture, EmailDeliveryConnectParams, EmailDeliveryProvider, EmailDeliveryVerifiedEmail, EmailDeliveryVerifyEmailParams, EmailDeliveryVerifyEmailResponse, EmailMatchCriteria, InboundEmailParams, IntroPageThemeStyle, IntroPageThemeStyleType, LoginStrategy, OAuthEmailDeliveryProvider, ProjectName, ReplyInboundEmailParams, Sms, SmsFilters, SmsProvider, SmsSearchCriteria, SmsSearchParams, ThemeCategory, ValueOf, WaitForSmsOptions };
|
package/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import customParseFormat from 'dayjs/plugin/customParseFormat.js';
|
|
|
23
23
|
import timezone from 'dayjs/plugin/timezone.js';
|
|
24
24
|
import utc from 'dayjs/plugin/utc.js';
|
|
25
25
|
import https from 'https';
|
|
26
|
-
import { createPrivateKey } from 'node:crypto';
|
|
26
|
+
import { createPrivateKey, randomBytes, createHmac } from 'node:crypto';
|
|
27
27
|
import { countries } from 'countries-list';
|
|
28
28
|
import { parsePhoneNumberWithError } from 'libphonenumber-js';
|
|
29
29
|
import * as http from 'http';
|
|
@@ -13170,10 +13170,12 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
13170
13170
|
};
|
|
13171
13171
|
|
|
13172
13172
|
const INBOUND_EMAIL_SOURCES_URL = "/rails/conductor/action_mailbox/inbound_emails/sources";
|
|
13173
|
+
const MAILGUN_INGRESS_URL = "/rails/action_mailbox/mailgun/inbound_emails/mime";
|
|
13173
13174
|
const normalizeMessageId = (id) => id.replace(/^<|>$/g, "");
|
|
13174
13175
|
const sanitizeHeaderValue = (value) => value.replace(/[\r\n]+/g, " ");
|
|
13175
13176
|
/**
|
|
13176
|
-
* Injects inbound emails via the Rails ActionMailbox conductor
|
|
13177
|
+
* Injects inbound emails via the Rails ActionMailbox conductor in development
|
|
13178
|
+
* and via the signed Mailgun ingress elsewhere.
|
|
13177
13179
|
*/
|
|
13178
13180
|
class InboundEmailApis {
|
|
13179
13181
|
neetoPlaywrightUtilities;
|
|
@@ -13230,11 +13232,29 @@ class InboundEmailApis {
|
|
|
13230
13232
|
"",
|
|
13231
13233
|
body,
|
|
13232
13234
|
].join("\r\n");
|
|
13235
|
+
return IS_DEV_ENV
|
|
13236
|
+
? this.neetoPlaywrightUtilities.apiRequest({
|
|
13237
|
+
url: INBOUND_EMAIL_SOURCES_URL,
|
|
13238
|
+
method: "post",
|
|
13239
|
+
body: { source },
|
|
13240
|
+
headers: { accept: "text/html" },
|
|
13241
|
+
})
|
|
13242
|
+
: this.deliverViaMailgunIngress(source);
|
|
13243
|
+
};
|
|
13244
|
+
deliverViaMailgunIngress = (source) => {
|
|
13245
|
+
const signingKey = process.env.MAILGUN_INGRESS_SIGNING_KEY;
|
|
13246
|
+
if (!signingKey) {
|
|
13247
|
+
throw new Error("MAILGUN_INGRESS_SIGNING_KEY is required to inject inbound emails outside development");
|
|
13248
|
+
}
|
|
13249
|
+
const timestamp = Math.floor(Date.now() / 1000).toString();
|
|
13250
|
+
const token = randomBytes(25).toString("hex");
|
|
13251
|
+
const signature = createHmac("sha256", signingKey)
|
|
13252
|
+
.update(`${timestamp}${token}`)
|
|
13253
|
+
.digest("hex");
|
|
13233
13254
|
return this.neetoPlaywrightUtilities.apiRequest({
|
|
13234
|
-
url:
|
|
13255
|
+
url: MAILGUN_INGRESS_URL,
|
|
13235
13256
|
method: "post",
|
|
13236
|
-
|
|
13237
|
-
headers: { accept: "text/html" },
|
|
13257
|
+
form: { "body-mime": source, timestamp, token, signature },
|
|
13238
13258
|
});
|
|
13239
13259
|
};
|
|
13240
13260
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-playwright-commons",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.0",
|
|
4
4
|
"description": "A package encapsulating common playwright code across neeto projects.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
|
|
6
6
|
"license": "apache-2.0",
|