@bigbinary/neeto-commons-frontend 2.1.36 → 2.1.38

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # neeto-commons-frontend
2
2
 
3
3
  A library that packages common boilerplate frontend code necessary for all neeto
4
- products.
4
+ products. Try out the utility functions live at [neetoCommons REPL](https://neeto-cist.neeto.com/).
5
5
 
6
6
  <table>
7
7
  <thead>
@@ -133,6 +133,14 @@ var joinHyphenCase = function joinHyphenCase() {
133
133
  }
134
134
  return args.join(" ").replace(/\s+/g, "-").toLowerCase();
135
135
  };
136
+ var hyphenize = function hyphenize(input) {
137
+ var fallbackString = "";
138
+ if (typeof input === "number") return String(input);
139
+ if (input && typeof input === "string" && input.replace) {
140
+ return input.replace(/[\s_]/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/-+/g, "-").toLowerCase();
141
+ }
142
+ return fallbackString;
143
+ };
136
144
  var initializeCredentials = function initializeCredentials(stagingData) {
137
145
  cy.task("getGlobalState").then(function (state) {
138
146
  var newState = _objectSpread$2(_objectSpread$2({}, state), {}, {
@@ -183,31 +191,43 @@ Object.defineProperty(requestApis, "allPath", {
183
191
  get: allPath
184
192
  });
185
193
 
194
+ function _taggedTemplateLiteral(strings, raw) {
195
+ if (!raw) {
196
+ raw = strings.slice(0);
197
+ }
198
+ return Object.freeze(Object.defineProperties(strings, {
199
+ raw: {
200
+ value: Object.freeze(raw)
201
+ }
202
+ }));
203
+ }
204
+
205
+ var _templateObject;
186
206
  var commonSelectors = {
187
207
  alertTitle: dataCy("alert-title"),
188
208
  alertModalMessage: dataCy("alert-message"),
189
209
  alertModalSubmitButton: dataCy("alert-submit-button"),
190
- checkbox: ".neeto-ui-checkbox",
210
+ checkbox: dataCy("nui-checkbox-input"),
191
211
  checkboxLabel: dataCy("nui-checkbox-label"),
192
212
  dropdownContainer: dataCy("nui-dropdown-container"),
193
213
  dropdownIcon: dataCy("nui-dropdown-icon"),
194
214
  heading: dataCy("main-header"),
195
- paneBody: ".neeto-ui-pane__body",
196
- paneHeader: ".neeto-ui-pane__header",
197
- profileSidebar: ".neeto-ui-profile-sidebar",
215
+ paneBody: dataCy("pane-body"),
216
+ paneHeader: dataCy("pane-header"),
217
+ profileSidebar: dataCy("profile-section"),
198
218
  selectOption: function selectOption(label) {
199
- return dataCy("".concat(joinHyphenCase(label), "-select-option"));
219
+ return dataCy("".concat(hyphenize(label), "-select-option"));
200
220
  },
201
221
  toastMessage: dataCy("toastr-message-container"),
202
- toastCloseButton: ".neeto-ui-toastr__close-button",
222
+ toastCloseButton: dataCy("toastr-close-button"),
203
223
  windowAlert: "#alert-box",
204
224
  body: "body",
205
225
  toastIcon: ".Toastify__toast-icon",
206
- paneModalCrossIcon: ".neeto-ui-pane__close",
226
+ paneModalCrossIcon: dataCy("pane-close-button"),
207
227
  inputField: dataCy("nui-input-field"),
208
228
  alertConfirmationText: dataCy("alert-confirmation-text"),
209
229
  alertCancelButton: dataCy("alert-cancel-button"),
210
- alertModalCrossIcon: ".neeto-ui-modal__close",
230
+ alertModalCrossIcon: dataCy("modal-close-button"),
211
231
  saveChangesButton: dataCy("save-changes-button"),
212
232
  cancelButton: dataCy("cancel-button"),
213
233
  inputFieldError: dataCy("nui-input-error"),
@@ -217,17 +237,41 @@ var commonSelectors = {
217
237
  },
218
238
  noDataTitle: dataCy("no-data-title"),
219
239
  noDataDescription: dataCy("no-data-description"),
220
- backDrop: "[data-testid='backdrop']",
240
+ backdrop: dataCy("neeto-backdrop"),
221
241
  menuBarHeading: dataCy("menubar-heading"),
222
- tabItem: function tabItem(index) {
242
+ nthTabItem: function nthTabItem(index) {
223
243
  return dataCy("tab-item", ":eq(".concat(index, ")"));
224
244
  },
225
245
  dropdownWrapper: function dropdownWrapper(index) {
226
246
  return dataCy("nui-select-container-wrapper", ":eq(".concat(index, ")"));
227
247
  },
228
248
  toggleButton: dataCy("menubar-toggle-button"),
229
- tooltip: ".tippy-box",
230
- articlePageTitle: ".serene-article__title"
249
+ tooltip: dataCy("tooltip-box"),
250
+ articlePageTitle: ".serene-article__title",
251
+ tabItem: dataCy("tab-item"),
252
+ labelInputError: dataCy("label-input-error"),
253
+ urlInputError: dataCy("url-input-error"),
254
+ noDataPrimaryButton: dataCy("no-data-primary-button"),
255
+ modalHeader: dataCy("modal-header"),
256
+ nameInputError: dataCy("name-input-error"),
257
+ selectContainer: dataCy("nui-select-container"),
258
+ dropdownMenu: dataCy("nui-select-menu"),
259
+ nthDropdownIcon: function nthDropdownIcon(index) {
260
+ return dataCy("nui-dropdown-icon", ":eq(".concat(index, ")"));
261
+ },
262
+ sidebarToggle: dataCy("neeto-molecules-sidebar-toggler"),
263
+ customDataCy: function customDataCy(name) {
264
+ return dataCy(name);
265
+ },
266
+ leftSubHeader: dataCy("subheader-left"),
267
+ subheader: dataCy("subheader"),
268
+ settingsLink: dataCy("Settings"),
269
+ nthInputField: function nthInputField(index) {
270
+ return dataCy("nui-input-field"(_templateObject || (_templateObject = _taggedTemplateLiteral([":eq(", ")"])), index));
271
+ },
272
+ ticketFieldTextInput: function ticketFieldTextInput(label) {
273
+ return dataCy("".concat(hyphenize(label), "-text-input"));
274
+ }
231
275
  };
232
276
  var tableSelectors = {
233
277
  nthColumn: function nthColumn(n) {
@@ -244,10 +288,12 @@ var tableSelectors = {
244
288
  var profileSelectors = {
245
289
  tab: dataCy("profile-section"),
246
290
  logoutLink: dataCy("profile-logout-button"),
247
- profileOptionsContainer: '[class="tippy-box sidebar-featured-tooltip__content"]',
248
291
  myProfileButton: dataCy("my-profile-button"),
249
292
  organizationSettingsButton: dataCy("profile-organization-settings-button"),
250
- loader: dataTestId("spinner")
293
+ loader: dataTestId("spinner"),
294
+ appSwitcherBody: dataCy("app-switcher-body-wrapper"),
295
+ sidebarInfo: dataCy("sidebar-info"),
296
+ appSwitcherBackButton: dataCy("app-switcher-back-button")
251
297
  };
252
298
 
253
299
  var commonTexts = {
@@ -274,7 +320,13 @@ var commonTexts = {
274
320
  unsavedChangesAlertTitle: "You have unsaved changes!",
275
321
  unsavedChangesAlertMessage: "Are you sure you want to continue? All of your unsaved changes will be lost.",
276
322
  clearFilters: "Clear filters",
277
- filters: "Filters"
323
+ filters: "Filters",
324
+ descriptionRequiredMessage: "Description is required.",
325
+ active: "active",
326
+ deactivated: "deactivated",
327
+ nameExistsMsg: "Name already exists",
328
+ cancel: "Cancel",
329
+ "continue": "Continue"
278
330
  };
279
331
 
280
332
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -366,7 +418,7 @@ var initCustomCommands = function initCustomCommands() {
366
418
  });
367
419
  Cypress.Commands.add("selectOption", function (containerSelector, optionText) {
368
420
  cy.get(containerSelector).click().type(optionText);
369
- cy.get(commonSelectors.selectOption(optionText.split("_").join("-").toLowerCase())).invoke("click");
421
+ cy.get(commonSelectors.selectOption(optionText)).invoke("click");
370
422
  });
371
423
  Cypress.Commands.add("clickDropdownOption", function (optionText) {
372
424
  var dropdownSelector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : commonSelectors.dropdownIcon;
@@ -558,9 +610,6 @@ var memberSelectors = {
558
610
  continueButton: dataCy("ntm-manage-member-continue-button"),
559
611
  submitButton: dataCy("ntm-manage-member-submit-button"),
560
612
  searchTextField: dataCy("ntm-search-members-input"),
561
- email: "td:nth-child(3)",
562
- name: "td:nth-child(2)",
563
- role: "td:nth-child(4)",
564
613
  deactivatedAgentsButton: dataCy("ntm-members-menubar-deactivated-block"),
565
614
  activatedMembersButton: dataCy("ntm-members-menubar-active-block"),
566
615
  columnCheckBox: dataCy("neeto-ui-columns-checkbox"),
@@ -571,7 +620,6 @@ var memberSelectors = {
571
620
  editButton: dataCy("ntm-edit-member-button"),
572
621
  menuBarHeading: dataCy("ntm-members-menubar-heading"),
573
622
  activateOrDeactivateMember: dataCy("ntm-deactivate-member-button"),
574
- subHeader: "[data-testid='subheader']",
575
623
  columnsButton: dataCy("columns-dropdown-button"),
576
624
  columnsDropdownContainer: dataCy("columns-dropdown-container"),
577
625
  emailDropdownItemLabel: dataCy("email-checkbox-label"),
@@ -586,13 +634,30 @@ var memberSelectors = {
586
634
  statusTag: dataCy("ntm-member-status-tag")
587
635
  };
588
636
  var memberFormSelectors = {
589
- emailTextField: "input.neeto-ui-react-select__input:eq(0)",
637
+ emailTextField: dataCy("email-select-input-field"),
590
638
  firstNameTextField: dataCy("ntm-edit-member-first-name-text-field"),
591
639
  lastNameTextField: dataCy("ntm-edit-member-last-name-text-field"),
592
640
  emailInput: dataCy("ntm-manage-member-email-input"),
593
641
  emailErrorField: dataCy("emails-input-error"),
594
642
  cancelButton: dataCy("ntm-manage-member-cancel-button")
595
643
  };
644
+ var neetoFiltersSelectors = {
645
+ emailSelectContainer: dataCy("email-select-container-wrapper"),
646
+ filterPaneHeading: dataCy("neeto-filters-pane-header"),
647
+ neetoFiltersEmailBlock: dataCy("neeto-filters-email-block"),
648
+ neetoFiltersRoleBlock: dataCy("neeto-filters-role-block"),
649
+ neetoFiltersBarClearButton: dataCy("neeto-filters-bar-clear-btn"),
650
+ neetoFiltersNameFilterField: dataCy("neeto-filters-name-filter"),
651
+ neetoFilterNameBlock: dataCy("neeto-filters-name-block"),
652
+ roleSelectContainer: dataCy("role-select-container-wrapper"),
653
+ filterButton: dataCy("neeto-filters-toggle-btn"),
654
+ filtersClearButton: dataCy("neeto-filters-clear-btn"),
655
+ filterDoneButton: dataCy("neeto-filters-done-btn"),
656
+ filteredMembersCount: dataCy("ntm-filtered-members-count"),
657
+ allMenubarBlock: dataCy("ntm-members-menubar-all-block"),
658
+ filtersEmailFilter: dataCy("neeto-filters-email-filter"),
659
+ paneModalCrossIcon: dataCy("neeto-filters-close-button")
660
+ };
596
661
 
597
662
  var signUpSelectors = {
598
663
  emailTextField: dataCy("signup-email-text-field"),
@@ -617,13 +682,13 @@ var helpIconSelectors = {
617
682
  whatsNewButton: dataCy("help-link-changelog-button"),
618
683
  whatsNewWidgetInfo: "h1",
619
684
  whatsNewWidgetCloseButton: ".nc-widget-header__btn",
620
- keyboardShortcutPaneHeading: ".h-full > .neeto-ui-border-gray-300",
621
- keyboardShortcutPaneCrossIcon: ".neeto-ui-border-gray-300 > .neeto-ui-btn"
685
+ keyboardShortcutPaneHeading: dataCy("keyboard-shortcuts-pane-title"),
686
+ keyboardShortcutPaneCrossIcon: dataCy("keyboard-shortcuts-pane-close-button")
622
687
  };
623
688
  var chatWidgetSelectors = {
624
689
  chatWidgetHomeCard: ".neeto-chat-widget-home__card-content",
625
- widgetSubmitButton: ".neeto-chat-widget-button",
626
- chatBubbleMessage: ".neeto-chat-widget-chat-bubble__message",
690
+ widgetSubmitButton: dataCy("neeto-chat-widget-pre-chat-submit-btn"),
691
+ chatBubbleMessage: dataCy("neeto-chat-widget-chat-message-bubble"),
627
692
  chatCloseButton: ".neeto-chat-widget-icon--close",
628
693
  widgetIframe: "#neetochat-iframe"
629
694
  };
@@ -1243,11 +1308,11 @@ var verifyMemberDetails = function verifyMemberDetails(_ref3) {
1243
1308
  });
1244
1309
  !skipSearchRequest && cy.wait("@searchMember");
1245
1310
  return cy.contains(tableSelectors.tableRow, email).within(function () {
1246
- cy.get(memberSelectors.email).should("have.text", email);
1247
- cy.get(memberSelectors.name).within(function () {
1311
+ cy.get(tableSelectors.nthColumn(3)).should("have.text", email);
1312
+ cy.get(tableSelectors.nthColumn(2)).within(function () {
1248
1313
  name && cy.get("p").should("have.text", name);
1249
1314
  });
1250
- role && cy.get(memberSelectors.role).should("have.text", role);
1315
+ role && cy.get(tableSelectors.nthColumn(4)).should("have.text", role);
1251
1316
  statusTag && cy.get(memberSelectors.statusTag).should("have.text", statusTag);
1252
1317
  });
1253
1318
  };
@@ -1442,7 +1507,7 @@ var deactivateMemberViaRequest = function deactivateMemberViaRequest(email) {
1442
1507
  cy.reloadAndWait(requestCount);
1443
1508
  };
1444
1509
  var clickOnColumnIcon = function clickOnColumnIcon() {
1445
- cy.get(memberSelectors.subHeader).should("exist").within(function () {
1510
+ cy.get(commonSelectors.subheader).should("exist").within(function () {
1446
1511
  cy.get(memberSelectors.columnsButton).click();
1447
1512
  });
1448
1513
  };
@@ -1739,6 +1804,7 @@ exports.getTestTitle = getTestTitle;
1739
1804
  exports.getUrl = getUrl;
1740
1805
  exports.helpIconSelectors = helpIconSelectors;
1741
1806
  exports.helpIconTexts = helpIconTexts;
1807
+ exports.hyphenize = hyphenize;
1742
1808
  exports.initCustomCommands = initCustomCommands;
1743
1809
  exports.initializeCredentials = initializeCredentials;
1744
1810
  exports.isStagingEnv = isStagingEnv;
@@ -1751,6 +1817,7 @@ exports.memberTableTexts = memberTableTexts;
1751
1817
  exports.memberTexts = memberTexts;
1752
1818
  exports.memberUtils = memberUtils;
1753
1819
  exports.navigationUtils = navigationUtils;
1820
+ exports.neetoFiltersSelectors = neetoFiltersSelectors;
1754
1821
  exports.profileSelectors = profileSelectors;
1755
1822
  exports.profileTexts = profileTexts;
1756
1823
  exports.sendEmail = sendEmail;