@bigbinary/neeto-playwright-commons 1.7.1 → 1.7.2

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 CHANGED
@@ -3,6 +3,7 @@ import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWor
3
3
  import MailosaurClient from 'mailosaur';
4
4
  import { I18nPlaywrightFixture } from 'playwright-i18next-fixture';
5
5
  import { TFunction } from 'i18next';
6
+ import * as playwright_core from 'playwright-core';
6
7
 
7
8
  interface InterceptMultipleResponsesParams {
8
9
  responseUrl: string;
@@ -186,6 +187,14 @@ declare const ROUTES: {
186
187
  show: (id: string) => string;
187
188
  };
188
189
  };
190
+ declare const API_ROUTES: {
191
+ teamMembers: {
192
+ all: string;
193
+ bulkUpdate: string;
194
+ index: string;
195
+ show: (id: string) => string;
196
+ };
197
+ };
189
198
 
190
199
  declare const COMMON_SELECTORS: {
191
200
  spinner: string;
@@ -462,6 +471,32 @@ declare const login: ({ page, neetoPlaywrightUtilities, loginPath, }: LoginProps
462
471
 
463
472
  declare const extractSubdomainFromError: (errorString: string) => string;
464
473
 
474
+ interface AddMemberProps {
475
+ email: string;
476
+ role?: string;
477
+ appName: string;
478
+ requestCount?: number;
479
+ neetoPlaywrightUtilities: CustomCommands;
480
+ }
481
+ interface EditMemberProps {
482
+ email: string;
483
+ firstName?: string;
484
+ lastName?: string;
485
+ newRole?: string;
486
+ requestCount?: number;
487
+ neetoPlaywrightUtilities: CustomCommands;
488
+ }
489
+ interface DeactiveMemberProps {
490
+ email: string;
491
+ neetoPlaywrightUtilities: CustomCommands;
492
+ requestCount?: number;
493
+ }
494
+ declare const memberUtils: {
495
+ addMemberViaRequest: ({ email, role, appName, neetoPlaywrightUtilities, }: AddMemberProps) => Promise<playwright_core.APIResponse | undefined>;
496
+ editMemberViaRequest: ({ email, firstName, lastName, newRole, neetoPlaywrightUtilities, }: EditMemberProps) => Promise<void>;
497
+ deactivateMemberViaRequest: ({ email, neetoPlaywrightUtilities, }: DeactiveMemberProps) => Promise<playwright_core.APIResponse | undefined>;
498
+ };
499
+
465
500
  interface CurrentsOverrides {
466
501
  projectId: string;
467
502
  }
@@ -474,4 +509,4 @@ interface Overrides {
474
509
  }
475
510
  declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
476
511
 
477
- export { BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, IS_STAGING_ENV, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, USER_AGENTS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
512
+ export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, IS_STAGING_ENV, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, USER_AGENTS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
package/index.js CHANGED
@@ -7157,11 +7157,22 @@ const ROUTES = {
7157
7157
  show: (id) => `/team_members/teams/${id}`,
7158
7158
  },
7159
7159
  };
7160
+ const API_ROUTES = {
7161
+ teamMembers: {
7162
+ all: "/team_members*/**",
7163
+ bulkUpdate: "/team_members/teams/bulk_update",
7164
+ index: "/team_members/teams",
7165
+ show: (id) => `/team_members/teams/${id}`,
7166
+ },
7167
+ };
7160
7168
 
7161
7169
  const CHAT_WIDGET_TEXTS = {
7162
7170
  newConversation: "New Conversation",
7163
7171
  welcomeChatBubble: "Hi! I'm here to assist you with any questions you may have. What can I do for you?",
7164
7172
  };
7173
+ const MEMBER_TEXTS = {
7174
+ agent: "Agent",
7175
+ };
7165
7176
 
7166
7177
  const HELP_CENTER_SELECTORS = {
7167
7178
  helpButton: "help-button",
@@ -7708,6 +7719,52 @@ const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, loginPath = "/"
7708
7719
  const login = async ({ page, neetoPlaywrightUtilities, loginPath, }) => !IS_STAGING_ENV &&
7709
7720
  (await loginWithoutSSO({ page, neetoPlaywrightUtilities, loginPath }));
7710
7721
 
7722
+ const addMemberViaRequest = ({ email, role = MEMBER_TEXTS.agent, appName, neetoPlaywrightUtilities, }) => neetoPlaywrightUtilities.apiRequest({
7723
+ method: "post",
7724
+ url: API_ROUTES.teamMembers.index,
7725
+ body: {
7726
+ user: {
7727
+ emails: [email],
7728
+ organization_role: role,
7729
+ app_roles: [{ app_name: appName, active_role: role, is_enabled: true }],
7730
+ },
7731
+ },
7732
+ });
7733
+ const editMemberViaRequest = async ({ email, firstName, lastName, newRole, neetoPlaywrightUtilities, }) => {
7734
+ const response = await neetoPlaywrightUtilities.apiRequest({
7735
+ method: "get",
7736
+ url: API_ROUTES.teamMembers.index,
7737
+ params: { search: email },
7738
+ });
7739
+ if (response) {
7740
+ const responseBodyBuffer = await response.body();
7741
+ const responseBody = JSON.parse(responseBodyBuffer.toString());
7742
+ const memberDetails = responseBody === null || responseBody === void 0 ? void 0 : responseBody.members[0];
7743
+ await neetoPlaywrightUtilities.apiRequest({
7744
+ method: "put",
7745
+ url: API_ROUTES.teamMembers.show(memberDetails.id),
7746
+ body: {
7747
+ team: {
7748
+ active: true,
7749
+ first_name: firstName,
7750
+ last_name: lastName,
7751
+ organization_role: newRole,
7752
+ },
7753
+ },
7754
+ });
7755
+ }
7756
+ };
7757
+ const deactivateMemberViaRequest = ({ email, neetoPlaywrightUtilities, }) => neetoPlaywrightUtilities.apiRequest({
7758
+ method: "patch",
7759
+ url: API_ROUTES.teamMembers.bulkUpdate,
7760
+ body: { users: { active: false, emails: [email] } },
7761
+ });
7762
+ const memberUtils = {
7763
+ addMemberViaRequest,
7764
+ editMemberViaRequest,
7765
+ deactivateMemberViaRequest,
7766
+ };
7767
+
7711
7768
  var main$2 = {exports: {}};
7712
7769
 
7713
7770
  var name = "dotenv";
@@ -8244,5 +8301,5 @@ const definePlaywrightConfig = (overrides) => {
8244
8301
  });
8245
8302
  };
8246
8303
 
8247
- export { BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, IS_STAGING_ENV, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, USER_AGENTS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
8304
+ export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, IS_STAGING_ENV, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, TAGS_SELECTORS, USER_AGENTS, clearCredentials, commands, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, hyphenize, i18nFixture, initializeCredentials, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, readFileSyncIfExists, skipTest, updateCredentials, writeDataToFile };
8248
8305
  //# sourceMappingURL=index.js.map