@mxenabled/connect-widget 2.16.2 → 2.17.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/dist/index.es.js CHANGED
@@ -5099,39 +5099,23 @@ function baseFindIndex$2(array, predicate, fromIndex, fromRight) {
5099
5099
  }
5100
5100
  var _baseFindIndex = baseFindIndex$2;
5101
5101
 
5102
- var _trimmedEndIndex;
5103
- var hasRequired_trimmedEndIndex;
5104
-
5105
- function require_trimmedEndIndex () {
5106
- if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
5107
- hasRequired_trimmedEndIndex = 1;
5108
- var reWhitespace = /\s/;
5109
- function trimmedEndIndex(string) {
5110
- var index = string.length;
5111
- while (index-- && reWhitespace.test(string.charAt(index))) {
5112
- }
5113
- return index;
5114
- }
5115
- _trimmedEndIndex = trimmedEndIndex;
5116
- return _trimmedEndIndex;
5102
+ var reWhitespace = /\s/;
5103
+ function trimmedEndIndex$1(string) {
5104
+ var index = string.length;
5105
+ while (index-- && reWhitespace.test(string.charAt(index))) {
5106
+ }
5107
+ return index;
5117
5108
  }
5109
+ var _trimmedEndIndex = trimmedEndIndex$1;
5118
5110
 
5119
- var _baseTrim;
5120
- var hasRequired_baseTrim;
5121
-
5122
- function require_baseTrim () {
5123
- if (hasRequired_baseTrim) return _baseTrim;
5124
- hasRequired_baseTrim = 1;
5125
- var trimmedEndIndex = require_trimmedEndIndex();
5126
- var reTrimStart = /^\s+/;
5127
- function baseTrim(string) {
5128
- return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
5129
- }
5130
- _baseTrim = baseTrim;
5131
- return _baseTrim;
5111
+ var trimmedEndIndex = _trimmedEndIndex;
5112
+ var reTrimStart = /^\s+/;
5113
+ function baseTrim$1(string) {
5114
+ return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
5132
5115
  }
5116
+ var _baseTrim = baseTrim$1;
5133
5117
 
5134
- var baseTrim = require_baseTrim(), isObject$7 = isObject_1, isSymbol$1 = isSymbol_1;
5118
+ var baseTrim = _baseTrim, isObject$7 = isObject_1, isSymbol$1 = isSymbol_1;
5135
5119
  var NAN = 0 / 0;
5136
5120
  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
5137
5121
  var reIsBinary = /^0b[01]+$/i;
@@ -8613,7 +8597,7 @@ var hasRequiredTrim;
8613
8597
  function requireTrim () {
8614
8598
  if (hasRequiredTrim) return trim_1;
8615
8599
  hasRequiredTrim = 1;
8616
- var baseToString = _baseToString, baseTrim = require_baseTrim(), castSlice = require_castSlice(), charsEndIndex = require_charsEndIndex(), charsStartIndex = require_charsStartIndex(), stringToArray = require_stringToArray(), toString = toString_1;
8600
+ var baseToString = _baseToString, baseTrim = _baseTrim, castSlice = require_castSlice(), charsEndIndex = require_charsEndIndex(), charsStartIndex = require_charsStartIndex(), stringToArray = require_stringToArray(), toString = toString_1;
8617
8601
  function trim(string, chars, guard) {
8618
8602
  string = toString(string);
8619
8603
  if (string && (guard || chars === void 0)) {
@@ -75126,58 +75110,109 @@ ExampleCheckbox.propTypes = {
75126
75110
  id: PropTypes$1.string
75127
75111
  };
75128
75112
 
75129
- const WELLS_FARGO_INSTRUCTIONS_FEATURE_NAME = "WELLS_FARGO_INSTRUCTIONS";
75113
+ function isWellsFargoInstitution(institution) {
75114
+ const wellsFargoGuids = [
75115
+ "INS-6073ad01-da9e-f6ba-dfdf-5f1500d8e867",
75116
+ // Wells Fargo PROD guid
75117
+ "INS-f9e8d5f6-b953-da63-32e4-6e88fbe8b250"
75118
+ // Wells Fargo SAND guid for testing
75119
+ ];
75120
+ return wellsFargoGuids.includes(institution.guid) || institution.name === "Wells Fargo";
75121
+ }
75122
+ function getInstitutionBrandColor(institution, defaultColor) {
75123
+ const rawColor = institution?.brand_color_hex_code;
75124
+ const configuredInstitutionColor = rawColor && /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(rawColor) ? rawColor : null;
75125
+ if (isWellsFargoInstitution(institution)) {
75126
+ return configuredInstitutionColor || "#B22222";
75127
+ }
75128
+ return configuredInstitutionColor || defaultColor;
75129
+ }
75130
+ const OAUTH_PREDIRECT_INSTRUCTION = {
75131
+ ACCOUNT_AND_TRANSACTIONS_INSTRUCTION: 0,
75132
+ ACCOUNT_NUMBERS_INSTRUCTION: 1,
75133
+ PROFILE_INFORMATION_INSTRUCTION: 2,
75134
+ STATEMENTS_INSTRUCTION: 3,
75135
+ TAX_INSTRUCTION: 4
75136
+ };
75137
+
75138
+ const DEFAULT_HEADER_HEX_COLOR = "#444444";
75130
75139
  function PredirectInstructions(props) {
75131
- const config = useSelector(selectConnectConfig);
75132
- const products = config?.data_request?.products || [];
75133
- const showProfileSelection = products.includes("account_verification") || products.includes("identity_verification");
75134
- const institutionColor = "#d9181f";
75140
+ const configuredPredirectInstructions = Array.isArray(
75141
+ props.institution?.oauth_predirect_instructions
75142
+ ) ? [...props.institution.oauth_predirect_instructions].filter(
75143
+ (instruction) => Object.values(OAUTH_PREDIRECT_INSTRUCTION).includes(instruction)
75144
+ ) : [];
75145
+ if (isWellsFargoInstitution(props.institution) && configuredPredirectInstructions.length === 0) {
75146
+ configuredPredirectInstructions.push(
75147
+ OAUTH_PREDIRECT_INSTRUCTION.ACCOUNT_AND_TRANSACTIONS_INSTRUCTION
75148
+ );
75149
+ configuredPredirectInstructions.push(
75150
+ OAUTH_PREDIRECT_INSTRUCTION.PROFILE_INFORMATION_INSTRUCTION
75151
+ );
75152
+ }
75153
+ if (configuredPredirectInstructions.length === 0) {
75154
+ configuredPredirectInstructions.push(
75155
+ OAUTH_PREDIRECT_INSTRUCTION.ACCOUNT_AND_TRANSACTIONS_INSTRUCTION
75156
+ );
75157
+ }
75158
+ const institutionColor = getInstitutionBrandColor(props.institution, DEFAULT_HEADER_HEX_COLOR);
75135
75159
  const uiElementTypes = {
75136
- CHECKING_OR_SAVINGS_ACCOUNT: "checking-or-savings-account",
75137
- DIVIDER: "divider",
75138
- PROFILE_INFORMATION: "profile"
75160
+ [OAUTH_PREDIRECT_INSTRUCTION.ACCOUNT_AND_TRANSACTIONS_INSTRUCTION]: "checking-or-savings-account",
75161
+ [OAUTH_PREDIRECT_INSTRUCTION.ACCOUNT_NUMBERS_INSTRUCTION]: "account-numbers",
75162
+ [OAUTH_PREDIRECT_INSTRUCTION.PROFILE_INFORMATION_INSTRUCTION]: "profile",
75163
+ [OAUTH_PREDIRECT_INSTRUCTION.STATEMENTS_INSTRUCTION]: "statements",
75164
+ [OAUTH_PREDIRECT_INSTRUCTION.TAX_INSTRUCTION]: "tax"
75139
75165
  };
75140
- const checkboxItems = [uiElementTypes.CHECKING_OR_SAVINGS_ACCOUNT];
75141
- if (showProfileSelection) {
75142
- checkboxItems.push(uiElementTypes.DIVIDER);
75143
- checkboxItems.push(uiElementTypes.PROFILE_INFORMATION);
75144
- }
75145
- const instructionText = showProfileSelection ? __(
75146
- "After logging in, share at least one account and %1profile information%2.",
75166
+ const checkboxItems = [];
75167
+ configuredPredirectInstructions.forEach((instruction) => {
75168
+ const uiElementType = uiElementTypes[instruction];
75169
+ if (uiElementType) {
75170
+ checkboxItems.push(uiElementType);
75171
+ }
75172
+ });
75173
+ const instructionText = __(
75174
+ "To complete your connection, please %1share%2 the following after signing in:",
75147
75175
  "<strong style='font-weight: bold;'>",
75148
75176
  "</strong>"
75149
- ) : __("After logging in, share at least one account.");
75177
+ );
75150
75178
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
75151
- /* @__PURE__ */ jsxRuntimeExports.jsx(D, { bold: true, component: "h2", sx: { mb: 12 }, truncate: false, variant: "H2", children: __("Log in at %1", props.institutionName) }),
75152
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "predirect-instruction-text-wrapper", children: [
75153
- /* @__PURE__ */ jsxRuntimeExports.jsx(
75154
- D,
75155
- {
75156
- className: "predirect-instruction-text",
75157
- color: "textSecondary",
75158
- dangerouslySetInnerHTML: {
75159
- __html: instructionText
75160
- },
75161
- truncate: false,
75162
- variant: "body1"
75163
- }
75164
- ),
75165
- showProfileSelection && /* @__PURE__ */ jsxRuntimeExports.jsx(M, { color: "secondary", name: "info", size: 20, weight: Fe.Dark })
75166
- ] }),
75179
+ /* @__PURE__ */ jsxRuntimeExports.jsx(D, { bold: true, component: "h2", sx: { mb: 12 }, truncate: false, variant: "H2", children: __("Log in at %1", props.institution.name) }),
75180
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "predirect-instruction-text-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
75181
+ D,
75182
+ {
75183
+ className: "predirect-instruction-text",
75184
+ color: "textSecondary",
75185
+ dangerouslySetInnerHTML: {
75186
+ __html: instructionText
75187
+ },
75188
+ truncate: false,
75189
+ variant: "body1"
75190
+ }
75191
+ ) }),
75167
75192
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "institution-panel-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Paper$1, { className: "institution-panel", elevation: 2, children: [
75168
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "institution-panel-header", style: { backgroundColor: institutionColor }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "aria-hidden": "true", sx: { fontWeight: 600, color: "white" }, uppercase: true, children: props.institutionName }) }),
75169
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "institution-panel-body", children: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { "aria-label": __("Information to select on the %1 site", props.institutionName), children: checkboxItems.map((item, index) => {
75170
- if (item === uiElementTypes.DIVIDER) {
75171
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}, `divider-${index}`);
75172
- } else {
75173
- let text = "";
75174
- if (item === uiElementTypes.CHECKING_OR_SAVINGS_ACCOUNT) {
75193
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "institution-panel-header", style: { backgroundColor: institutionColor }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "aria-hidden": "true", sx: { fontWeight: 600, color: "white" }, uppercase: true, children: props.institution.name }) }),
75194
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "institution-panel-body", children: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { "aria-label": __("Information to select on the %1 site", props.institution.name), children: checkboxItems.map((item, index) => {
75195
+ let text = "";
75196
+ switch (item) {
75197
+ case uiElementTypes[OAUTH_PREDIRECT_INSTRUCTION.ACCOUNT_AND_TRANSACTIONS_INSTRUCTION]:
75175
75198
  text = __("Checking or savings account");
75176
- } else if (item === uiElementTypes.PROFILE_INFORMATION) {
75199
+ break;
75200
+ case uiElementTypes[OAUTH_PREDIRECT_INSTRUCTION.ACCOUNT_NUMBERS_INSTRUCTION]:
75201
+ text = __("Account numbers");
75202
+ break;
75203
+ case uiElementTypes[OAUTH_PREDIRECT_INSTRUCTION.PROFILE_INFORMATION_INSTRUCTION]:
75177
75204
  text = __("Profile information");
75178
- }
75179
- const isLastItem = index === checkboxItems.length - 1;
75180
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
75205
+ break;
75206
+ case uiElementTypes[OAUTH_PREDIRECT_INSTRUCTION.STATEMENTS_INSTRUCTION]:
75207
+ text = __("Statements");
75208
+ break;
75209
+ case uiElementTypes[OAUTH_PREDIRECT_INSTRUCTION.TAX_INSTRUCTION]:
75210
+ text = __("Tax documents");
75211
+ break;
75212
+ }
75213
+ const isLastItem = index === checkboxItems.length - 1;
75214
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
75215
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
75181
75216
  /* @__PURE__ */ jsxRuntimeExports.jsx(
75182
75217
  ExampleCheckbox,
75183
75218
  {
@@ -75187,8 +75222,9 @@ function PredirectInstructions(props) {
75187
75222
  }
75188
75223
  ),
75189
75224
  /* @__PURE__ */ jsxRuntimeExports.jsx(D, { className: "psuedo-checkbox-label", variant: "body1", children: text })
75190
- ] }, item);
75191
- }
75225
+ ] }, item),
75226
+ !isLastItem && /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}, `divider-${index}`)
75227
+ ] });
75192
75228
  }) }) })
75193
75229
  ] }) })
75194
75230
  ] });
@@ -75196,12 +75232,8 @@ function PredirectInstructions(props) {
75196
75232
 
75197
75233
  const OAuthDefault = (props) => {
75198
75234
  const language = window?.app?.options?.language || "en-US";
75199
- const userFeatures = useSelector(getUserFeatures);
75200
- const isWellsFargoInstructionsFeatureEnabled = userFeatures.some(
75201
- (feature) => feature.feature_name === WELLS_FARGO_INSTRUCTIONS_FEATURE_NAME && feature.is_enabled === "test"
75202
- ) && (props.institution.guid === "INS-6073ad01-da9e-f6ba-dfdf-5f1500d8e867" || // Wells Fargo PROD guid
75203
- props.institution.guid === "INS-f9e8d5f6-b953-da63-32e4-6e88fbe8b250") && // Wells Fargo SAND guid for testing
75204
- language.toLowerCase() === "en-us";
75235
+ const isWellsFargo = isWellsFargoInstitution(props.institution);
75236
+ const hasPredirectInstructions = Array.isArray(props.institution?.oauth_predirect_instructions) && props.institution?.oauth_predirect_instructions.length > 0;
75205
75237
  const { api } = useApi();
75206
75238
  useAnalyticsPath(...PageviewInfo.CONNECT_OAUTH_INSTRUCTIONS, {
75207
75239
  institution_guid: props.institution.guid,
@@ -75218,7 +75250,7 @@ const OAuthDefault = (props) => {
75218
75250
  const tokens = useTokens();
75219
75251
  const styles = getStyles$X(tokens);
75220
75252
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { role: "alert", children: [
75221
- isWellsFargoInstructionsFeatureEnabled ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(PredirectInstructions, { institutionName: props?.institution?.name }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
75253
+ isWellsFargo || hasPredirectInstructions ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(PredirectInstructions, { institution: props?.institution }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
75222
75254
  /* @__PURE__ */ jsxRuntimeExports.jsx(InstitutionBlock, { institution: props.institution }),
75223
75255
  /* @__PURE__ */ jsxRuntimeExports.jsx(
75224
75256
  ViewTitle,
@@ -87040,8 +87072,6 @@ const frCa = {
87040
87072
  "Unable to connect": "Impossible de se connecter",
87041
87073
  "Maintenance in progress": "Entretien en cours",
87042
87074
  "Deposits verified. You're almost done setting things up. Continue to your institution.": "Dépôts vérifiés. Vous avez presque terminé la configuration. Rendez-vous dans votre établissement.",
87043
- "After logging in, share at least one account and %1profile information%2.": "Après vous être connecté, partagez au moins un compte et %1informations de profil%2.",
87044
- "After logging in, share at least one account.": "Après vous être connecté, partagez au moins un compte.",
87045
87075
  "Connection not supported by %1": "Connexion non prise en charge par %1",
87046
87076
  "%1 currently limits how your data can be shared. We'll enable this connection once %1 opens access.": "%1 limite actuellement la manière dont vos données peuvent être partagées. Nous activerons cette connexion une fois que %1 ouvrira l'accès.",
87047
87077
  UNAVAILABLE: UNAVAILABLE$1,
@@ -87055,6 +87085,8 @@ const frCa = {
87055
87085
  "Information to select on the %1 site": "Informations à sélectionner sur le site %1.",
87056
87086
  "Checking or savings account": "Compte courant ou compte d'épargne",
87057
87087
  "Profile information": "Informations de profil",
87088
+ "Account numbers": "Numéros de compte",
87089
+ "To complete your connection, please %1share%2 the following after signing in:": "Pour finaliser votre connexion, veuillez %1partager%2 les informations suivantes après vous être connecté :",
87058
87090
  "connect/disclosure/policy/text\u0004By clicking Continue, you agree to the ": "En cliquant sur Continuer, vous acceptez la ",
87059
87091
  "connect/disclosure/policy/link\u0004MX Privacy Policy.": "Politique de confidentialité de MX.",
87060
87092
  "connect/disclosure/policy/link\u0004MX Privacy Policy": "Politique de confidentialité de MX.",
@@ -87553,8 +87585,6 @@ const es = {
87553
87585
  "Unable to connect": "No se puede conectar",
87554
87586
  "Maintenance in progress": "Mantenimiento en curso",
87555
87587
  "Deposits verified. You're almost done setting things up. Continue to your institution.": "Depósitos verificados. Ya casi terminas de configurar todo. Continúa con tu institución.",
87556
- "After logging in, share at least one account and %1profile information%2.": "Después de iniciar sesión, comparta al menos una cuenta y %1información de perfil%2.",
87557
- "After logging in, share at least one account.": "Después de iniciar sesión, comparta al menos una cuenta.",
87558
87588
  "Connection not supported by %1": "Conexión no compatible con %1",
87559
87589
  "%1 currently limits how your data can be shared. We'll enable this connection once %1 opens access.": "%1 actualmente limita cómo se pueden compartir sus datos. Habilitaremos esta conexión una vez que %1 abra el acceso.",
87560
87590
  UNAVAILABLE: UNAVAILABLE,
@@ -87568,6 +87598,8 @@ const es = {
87568
87598
  "Information to select on the %1 site": "Información para seleccionar en el sitio %1",
87569
87599
  "Checking or savings account": "Cuenta corriente o de ahorros",
87570
87600
  "Profile information": "Información del perfil",
87601
+ "Account numbers": "Números de cuenta",
87602
+ "To complete your connection, please %1share%2 the following after signing in:": "Para completar su conexión, por favor, %1comparta%2 lo siguiente después de iniciar sesión:",
87571
87603
  "connect/disclosure/button\u0004Continue": "Continuar",
87572
87604
  "connect/disclosure/policy/text\u0004By clicking Continue, you agree to the ": "Al hacer clic en Continuar, tu aceptas la ",
87573
87605
  "connect/disclosure/policy/link\u0004MX Privacy Policy.": "Política de privacidad de Money Experience.",