@mxenabled/connect-widget 0.19.2 → 0.19.4

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/index.es.js CHANGED
@@ -5087,23 +5087,39 @@ function baseFindIndex$2(array, predicate, fromIndex, fromRight) {
5087
5087
  }
5088
5088
  var _baseFindIndex = baseFindIndex$2;
5089
5089
 
5090
- var reWhitespace = /\s/;
5091
- function trimmedEndIndex$1(string) {
5092
- var index = string.length;
5093
- while (index-- && reWhitespace.test(string.charAt(index))) {
5094
- }
5095
- return index;
5090
+ var _trimmedEndIndex;
5091
+ var hasRequired_trimmedEndIndex;
5092
+
5093
+ function require_trimmedEndIndex () {
5094
+ if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
5095
+ hasRequired_trimmedEndIndex = 1;
5096
+ var reWhitespace = /\s/;
5097
+ function trimmedEndIndex(string) {
5098
+ var index = string.length;
5099
+ while (index-- && reWhitespace.test(string.charAt(index))) {
5100
+ }
5101
+ return index;
5102
+ }
5103
+ _trimmedEndIndex = trimmedEndIndex;
5104
+ return _trimmedEndIndex;
5096
5105
  }
5097
- var _trimmedEndIndex = trimmedEndIndex$1;
5098
5106
 
5099
- var trimmedEndIndex = _trimmedEndIndex;
5100
- var reTrimStart = /^\s+/;
5101
- function baseTrim$1(string) {
5102
- return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
5107
+ var _baseTrim;
5108
+ var hasRequired_baseTrim;
5109
+
5110
+ function require_baseTrim () {
5111
+ if (hasRequired_baseTrim) return _baseTrim;
5112
+ hasRequired_baseTrim = 1;
5113
+ var trimmedEndIndex = require_trimmedEndIndex();
5114
+ var reTrimStart = /^\s+/;
5115
+ function baseTrim(string) {
5116
+ return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
5117
+ }
5118
+ _baseTrim = baseTrim;
5119
+ return _baseTrim;
5103
5120
  }
5104
- var _baseTrim = baseTrim$1;
5105
5121
 
5106
- var baseTrim = _baseTrim, isObject$7 = isObject_1, isSymbol$1 = isSymbol_1;
5122
+ var baseTrim = require_baseTrim(), isObject$7 = isObject_1, isSymbol$1 = isSymbol_1;
5107
5123
  var NAN = 0 / 0;
5108
5124
  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
5109
5125
  var reIsBinary = /^0b[01]+$/i;
@@ -8557,7 +8573,7 @@ var hasRequiredTrim;
8557
8573
  function requireTrim () {
8558
8574
  if (hasRequiredTrim) return trim_1;
8559
8575
  hasRequiredTrim = 1;
8560
- var baseToString = _baseToString, baseTrim = _baseTrim, castSlice = require_castSlice(), charsEndIndex = require_charsEndIndex(), charsStartIndex = require_charsStartIndex(), stringToArray = require_stringToArray(), toString = toString_1;
8576
+ var baseToString = _baseToString, baseTrim = require_baseTrim(), castSlice = require_castSlice(), charsEndIndex = require_charsEndIndex(), charsStartIndex = require_charsStartIndex(), stringToArray = require_stringToArray(), toString = toString_1;
8561
8577
  function trim(string, chars, guard) {
8562
8578
  string = toString(string);
8563
8579
  if (string && (guard || chars === void 0)) {
@@ -47304,6 +47320,7 @@ const AnalyticEvents = {
47304
47320
  CREDENTIALS_CLICKED_GET_HELP: "credentials_clicked_get_help",
47305
47321
  ENTERED_LOGIN: "entered_login",
47306
47322
  ENTERED_PASSWORD: "entered_password",
47323
+ INITIAL_DATA_READY: "initial_data_ready",
47307
47324
  LOGIN_ERROR_CLICKED_GET_HELP: "login_error_clicked_get_help",
47308
47325
  MFA_CLICKED_GET_HELP: "mfa_clicked_get_help",
47309
47326
  MFA_ENTERED_INPUT: "mfa_entered_input",
@@ -68772,7 +68789,7 @@ const DEFAULT_POLLING_STATE = {
68772
68789
  userMessage: CONNECTING_MESSAGES.STARTING
68773
68790
  // message to show the end user
68774
68791
  };
68775
- function pollMember(memberGuid, api, onPostMessage) {
68792
+ function pollMember(memberGuid, api, onPostMessage, sendPosthogEvent) {
68776
68793
  return interval(3e3).pipe(
68777
68794
  switchMap(
68778
68795
  () => (
@@ -68784,6 +68801,7 @@ function pollMember(memberGuid, api, onPostMessage) {
68784
68801
  map((job) => {
68785
68802
  if (job.async_account_data_ready) {
68786
68803
  onPostMessage("connect/initialDataReady", { member_guid: member.guid });
68804
+ sendPosthogEvent(AnalyticEvents.INITIAL_DATA_READY, { member_guid: member.guid });
68787
68805
  }
68788
68806
  return member;
68789
68807
  })
@@ -70098,7 +70116,14 @@ const buildFormSchema = (loginFields) => {
70098
70116
  const CREDENTIAL_FIELD_TYPES = {
70099
70117
  PASSWORD: 1};
70100
70118
 
70119
+ const preventDefaultAndStopAllPropagation = (event) => {
70120
+ event.preventDefault();
70121
+ event.stopPropagation();
70122
+ event.nativeEvent.stopImmediatePropagation();
70123
+ };
70124
+
70101
70125
  const usePasswordInputValidation = () => {
70126
+ const showHideButtonRef = React__default.useRef(null);
70102
70127
  const [isCapsLockOn, setIsCapsLockOn] = useState(false);
70103
70128
  const handleKeyPress = (event) => "getModifierState" in event && setIsCapsLockOn(event.getModifierState("CapsLock"));
70104
70129
  const handleFocus = (event) => event.target?.addEventListener("keydown", handleKeyPress);
@@ -70107,7 +70132,11 @@ const usePasswordInputValidation = () => {
70107
70132
  setIsCapsLockOn(false);
70108
70133
  };
70109
70134
  const [showPassword, setShowPassword] = useState(false);
70110
- const handleTogglePassword = () => setShowPassword((show) => !show);
70135
+ const handleTogglePassword = (e) => {
70136
+ preventDefaultAndStopAllPropagation(e);
70137
+ setShowPassword((show) => !show);
70138
+ setTimeout(() => showHideButtonRef.current && showHideButtonRef.current.focus(), 0);
70139
+ };
70111
70140
  const [validateSpaceState, setValidateSpaceState] = useState(DEFAULT_VALIDATION_STATE);
70112
70141
  const [validateSpaceMessage, setValidateSpaceMessage] = useState("");
70113
70142
  const handleSpaceValidation = (e) => {
@@ -70164,6 +70193,7 @@ const usePasswordInputValidation = () => {
70164
70193
  "aria-label": showPassword ? __("Hide password") : __("Show password"),
70165
70194
  edge: "end",
70166
70195
  onClick: handleTogglePassword,
70196
+ ref: showHideButtonRef,
70167
70197
  children: showPassword ? /* @__PURE__ */ jsxRuntimeExports.jsx(M, { className: "material-symbols-rounded", name: "visibility_off" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(M, { className: "material-symbols-rounded", name: "visibility" })
70168
70198
  }
70169
70199
  ) })
@@ -71206,6 +71236,7 @@ const Connecting = (props) => {
71206
71236
  onUpsertMember
71207
71237
  } = props;
71208
71238
  const selectedInstitution = useSelector(getSelectedInstitution);
71239
+ const sendPosthogEvent = useAnalyticsEvent();
71209
71240
  const currentMember = useSelector(getCurrentMember);
71210
71241
  const isComboJobsEnabled = useSelector(isConnectComboJobsEnabled);
71211
71242
  const jobSchedule = useSelector((state) => state.connect.jobSchedule);
@@ -71344,7 +71375,7 @@ const Connecting = (props) => {
71344
71375
  return needsJobStarted ? startJob$ : of(currentMember);
71345
71376
  }).pipe(
71346
71377
  concatMap(
71347
- (member) => pollMember(member.guid, api, onPostMessage).pipe(
71378
+ (member) => pollMember(member.guid, api, onPostMessage, sendPosthogEvent).pipe(
71348
71379
  tap((pollingState) => handleMemberPoll(pollingState)),
71349
71380
  filter((pollingState) => pollingState.jobIsDone),
71350
71381
  pluck("currentResponse"),