@mxenabled/connect-widget 0.18.1 → 0.18.3

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
@@ -12728,124 +12728,29 @@ function requireDist () {
12728
12728
 
12729
12729
  var distExports = requireDist();
12730
12730
 
12731
- /**
12732
- * @module constants
12733
- * @summary Useful constants
12734
- * @description
12735
- * Collection of useful date constants.
12736
- *
12737
- * The constants could be imported from `date-fns/constants`:
12738
- *
12739
- * ```ts
12740
- * import { maxTime, minTime } from "./constants/date-fns/constants";
12741
- *
12742
- * function isAllowedTime(time) {
12743
- * return time <= maxTime && time >= minTime;
12744
- * }
12745
- * ```
12746
- */
12747
-
12731
+ const millisecondsInDay = 864e5;
12732
+ const constructFromSymbol = Symbol.for("constructDateFrom");
12748
12733
 
12749
- /**
12750
- * @constant
12751
- * @name millisecondsInDay
12752
- * @summary Milliseconds in 1 day.
12753
- */
12754
- const millisecondsInDay = 86400000;
12755
-
12756
- /**
12757
- * @name toDate
12758
- * @category Common Helpers
12759
- * @summary Convert the given argument to an instance of Date.
12760
- *
12761
- * @description
12762
- * Convert the given argument to an instance of Date.
12763
- *
12764
- * If the argument is an instance of Date, the function returns its clone.
12765
- *
12766
- * If the argument is a number, it is treated as a timestamp.
12767
- *
12768
- * If the argument is none of the above, the function returns Invalid Date.
12769
- *
12770
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
12771
- *
12772
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
12773
- *
12774
- * @param argument - The value to convert
12775
- *
12776
- * @returns The parsed date in the local time zone
12777
- *
12778
- * @example
12779
- * // Clone the date:
12780
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
12781
- * //=> Tue Feb 11 2014 11:30:30
12782
- *
12783
- * @example
12784
- * // Convert the timestamp to date:
12785
- * const result = toDate(1392098430000)
12786
- * //=> Tue Feb 11 2014 11:30:30
12787
- */
12788
- function toDate(argument) {
12789
- const argStr = Object.prototype.toString.call(argument);
12734
+ function constructFrom(date, value) {
12735
+ if (typeof date === "function") return date(value);
12736
+ if (date && typeof date === "object" && constructFromSymbol in date)
12737
+ return date[constructFromSymbol](value);
12738
+ if (date instanceof Date) return new date.constructor(value);
12739
+ return new Date(value);
12740
+ }
12790
12741
 
12791
- // Clone the date
12792
- if (
12793
- argument instanceof Date ||
12794
- (typeof argument === "object" && argStr === "[object Date]")
12795
- ) {
12796
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
12797
- return new argument.constructor(+argument);
12798
- } else if (
12799
- typeof argument === "number" ||
12800
- argStr === "[object Number]" ||
12801
- typeof argument === "string" ||
12802
- argStr === "[object String]"
12803
- ) {
12804
- // TODO: Can we get rid of as?
12805
- return new Date(argument);
12806
- } else {
12807
- // TODO: Can we get rid of as?
12808
- return new Date(NaN);
12809
- }
12742
+ function normalizeDates(context, ...dates) {
12743
+ const normalize = constructFrom.bind(
12744
+ null,
12745
+ dates.find((date) => typeof date === "object")
12746
+ );
12747
+ return dates.map(normalize);
12810
12748
  }
12811
12749
 
12812
- /**
12813
- * @name startOfDay
12814
- * @category Day Helpers
12815
- * @summary Return the start of a day for the given date.
12816
- *
12817
- * @description
12818
- * Return the start of a day for the given date.
12819
- * The result will be in the local timezone.
12820
- *
12821
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
12822
- *
12823
- * @param date - The original date
12824
- *
12825
- * @returns The start of a day
12826
- *
12827
- * @example
12828
- * // The start of a day for 2 September 2014 11:55:00:
12829
- * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
12830
- * //=> Tue Sep 02 2014 00:00:00
12831
- */
12832
- function startOfDay(date) {
12833
- const _date = toDate(date);
12834
- _date.setHours(0, 0, 0, 0);
12835
- return _date;
12750
+ function toDate(argument, context) {
12751
+ return constructFrom(argument, argument);
12836
12752
  }
12837
12753
 
12838
- /**
12839
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
12840
- * They usually appear for dates that denote time before the timezones were introduced
12841
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
12842
- * and GMT+01:00:00 after that date)
12843
- *
12844
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
12845
- * which would lead to incorrect calculations.
12846
- *
12847
- * This function returns the timezone offset in milliseconds that takes seconds in account.
12848
- */
12849
12754
  function getTimezoneOffsetInMilliseconds(date) {
12850
12755
  const _date = toDate(date);
12851
12756
  const utcDate = new Date(
@@ -12856,176 +12761,58 @@ function getTimezoneOffsetInMilliseconds(date) {
12856
12761
  _date.getHours(),
12857
12762
  _date.getMinutes(),
12858
12763
  _date.getSeconds(),
12859
- _date.getMilliseconds(),
12860
- ),
12764
+ _date.getMilliseconds()
12765
+ )
12861
12766
  );
12862
12767
  utcDate.setUTCFullYear(_date.getFullYear());
12863
12768
  return +date - +utcDate;
12864
12769
  }
12865
12770
 
12866
- /**
12867
- * @name differenceInCalendarDays
12868
- * @category Day Helpers
12869
- * @summary Get the number of calendar days between the given dates.
12870
- *
12871
- * @description
12872
- * Get the number of calendar days between the given dates. This means that the times are removed
12873
- * from the dates and then the difference in days is calculated.
12874
- *
12875
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
12876
- *
12877
- * @param dateLeft - The later date
12878
- * @param dateRight - The earlier date
12879
- *
12880
- * @returns The number of calendar days
12881
- *
12882
- * @example
12883
- * // How many calendar days are between
12884
- * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
12885
- * const result = differenceInCalendarDays(
12886
- * new Date(2012, 6, 2, 0, 0),
12887
- * new Date(2011, 6, 2, 23, 0)
12888
- * )
12889
- * //=> 366
12890
- * // How many calendar days are between
12891
- * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
12892
- * const result = differenceInCalendarDays(
12893
- * new Date(2011, 6, 3, 0, 1),
12894
- * new Date(2011, 6, 2, 23, 59)
12895
- * )
12896
- * //=> 1
12897
- */
12898
- function differenceInCalendarDays(dateLeft, dateRight) {
12899
- const startOfDayLeft = startOfDay(dateLeft);
12900
- const startOfDayRight = startOfDay(dateRight);
12901
-
12902
- const timestampLeft =
12903
- +startOfDayLeft - getTimezoneOffsetInMilliseconds(startOfDayLeft);
12904
- const timestampRight =
12905
- +startOfDayRight - getTimezoneOffsetInMilliseconds(startOfDayRight);
12906
-
12907
- // Round the number of days to the nearest integer because the number of
12908
- // milliseconds in a day is not constant (e.g. it's different in the week of
12909
- // the daylight saving time clock shift).
12910
- return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
12771
+ function startOfDay(date, options) {
12772
+ const _date = toDate(date);
12773
+ _date.setHours(0, 0, 0, 0);
12774
+ return _date;
12911
12775
  }
12912
12776
 
12913
- /**
12914
- * @name differenceInDays
12915
- * @category Day Helpers
12916
- * @summary Get the number of full days between the given dates.
12917
- *
12918
- * @description
12919
- * Get the number of full day periods between two dates. Fractional days are
12920
- * truncated towards zero.
12921
- *
12922
- * One "full day" is the distance between a local time in one day to the same
12923
- * local time on the next or previous day. A full day can sometimes be less than
12924
- * or more than 24 hours if a daylight savings change happens between two dates.
12925
- *
12926
- * To ignore DST and only measure exact 24-hour periods, use this instead:
12927
- * `Math.trunc(differenceInHours(dateLeft, dateRight)/24)|0`.
12928
- *
12929
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
12930
- *
12931
- * @param dateLeft - The later date
12932
- * @param dateRight - The earlier date
12933
- *
12934
- * @returns The number of full days according to the local timezone
12935
- *
12936
- * @example
12937
- * // How many full days are between
12938
- * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
12939
- * const result = differenceInDays(
12940
- * new Date(2012, 6, 2, 0, 0),
12941
- * new Date(2011, 6, 2, 23, 0)
12942
- * )
12943
- * //=> 365
12944
- *
12945
- * @example
12946
- * // How many full days are between
12947
- * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
12948
- * const result = differenceInDays(
12949
- * new Date(2011, 6, 3, 0, 1),
12950
- * new Date(2011, 6, 2, 23, 59)
12951
- * )
12952
- * //=> 0
12953
- *
12954
- * @example
12955
- * // How many full days are between
12956
- * // 1 March 2020 0:00 and 1 June 2020 0:00 ?
12957
- * // Note: because local time is used, the
12958
- * // result will always be 92 days, even in
12959
- * // time zones where DST starts and the
12960
- * // period has only 92*24-1 hours.
12961
- * const result = differenceInDays(
12962
- * new Date(2020, 5, 1),
12963
- * new Date(2020, 2, 1)
12964
- * )
12965
- * //=> 92
12966
- */
12967
- function differenceInDays(dateLeft, dateRight) {
12968
- const _dateLeft = toDate(dateLeft);
12969
- const _dateRight = toDate(dateRight);
12970
-
12971
- const sign = compareLocalAsc(_dateLeft, _dateRight);
12972
- const difference = Math.abs(differenceInCalendarDays(_dateLeft, _dateRight));
12973
-
12974
- _dateLeft.setDate(_dateLeft.getDate() - sign * difference);
12975
-
12976
- // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full
12977
- // If so, result must be decreased by 1 in absolute value
12777
+ function differenceInCalendarDays(laterDate, earlierDate, options) {
12778
+ const [laterDate_, earlierDate_] = normalizeDates(
12779
+ options?.in,
12780
+ laterDate,
12781
+ earlierDate
12782
+ );
12783
+ const laterStartOfDay = startOfDay(laterDate_);
12784
+ const earlierStartOfDay = startOfDay(earlierDate_);
12785
+ const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
12786
+ const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
12787
+ return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
12788
+ }
12789
+
12790
+ function differenceInDays(laterDate, earlierDate, options) {
12791
+ const [laterDate_, earlierDate_] = normalizeDates(
12792
+ options?.in,
12793
+ laterDate,
12794
+ earlierDate
12795
+ );
12796
+ const sign = compareLocalAsc(laterDate_, earlierDate_);
12797
+ const difference = Math.abs(
12798
+ differenceInCalendarDays(laterDate_, earlierDate_)
12799
+ );
12800
+ laterDate_.setDate(laterDate_.getDate() - sign * difference);
12978
12801
  const isLastDayNotFull = Number(
12979
- compareLocalAsc(_dateLeft, _dateRight) === -sign,
12802
+ compareLocalAsc(laterDate_, earlierDate_) === -sign
12980
12803
  );
12981
12804
  const result = sign * (difference - isLastDayNotFull);
12982
- // Prevent negative zero
12983
12805
  return result === 0 ? 0 : result;
12984
12806
  }
12985
-
12986
- // Like `compareAsc` but uses local time not UTC, which is needed
12987
- // for accurate equality comparisons of UTC timestamps that end up
12988
- // having the same representation in local time, e.g. one hour before
12989
- // DST ends vs. the instant that DST ends.
12990
- function compareLocalAsc(dateLeft, dateRight) {
12991
- const diff =
12992
- dateLeft.getFullYear() - dateRight.getFullYear() ||
12993
- dateLeft.getMonth() - dateRight.getMonth() ||
12994
- dateLeft.getDate() - dateRight.getDate() ||
12995
- dateLeft.getHours() - dateRight.getHours() ||
12996
- dateLeft.getMinutes() - dateRight.getMinutes() ||
12997
- dateLeft.getSeconds() - dateRight.getSeconds() ||
12998
- dateLeft.getMilliseconds() - dateRight.getMilliseconds();
12999
-
13000
- if (diff < 0) {
13001
- return -1;
13002
- } else if (diff > 0) {
13003
- return 1;
13004
- // Return 0 if diff is 0; return NaN if diff is NaN
13005
- } else {
13006
- return diff;
13007
- }
12807
+ function compareLocalAsc(laterDate, earlierDate) {
12808
+ const diff = laterDate.getFullYear() - earlierDate.getFullYear() || laterDate.getMonth() - earlierDate.getMonth() || laterDate.getDate() - earlierDate.getDate() || laterDate.getHours() - earlierDate.getHours() || laterDate.getMinutes() - earlierDate.getMinutes() || laterDate.getSeconds() - earlierDate.getSeconds() || laterDate.getMilliseconds() - earlierDate.getMilliseconds();
12809
+ if (diff < 0) return -1;
12810
+ if (diff > 0) return 1;
12811
+ return diff;
13008
12812
  }
13009
12813
 
13010
- /**
13011
- * @name fromUnixTime
13012
- * @category Timestamp Helpers
13013
- * @summary Create a date from a Unix timestamp.
13014
- *
13015
- * @description
13016
- * Create a date from a Unix timestamp (in seconds). Decimal values will be discarded.
13017
- *
13018
- * @param unixTime - The given Unix timestamp (in seconds)
13019
- *
13020
- * @returns The date
13021
- *
13022
- * @example
13023
- * // Create the date 29 February 2012 11:45:05:
13024
- * const result = fromUnixTime(1330515905)
13025
- * //=> Wed Feb 29 2012 11:45:05
13026
- */
13027
- function fromUnixTime(unixTime) {
13028
- return toDate(unixTime * 1000);
12814
+ function fromUnixTime(unixTime, options) {
12815
+ return toDate(unixTime * 1e3);
13029
12816
  }
13030
12817
 
13031
12818
  const Style$1 = {
@@ -79076,11 +78863,14 @@ const DeleteMemberSurvey = (props) => {
79076
78863
  ) })
79077
78864
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(React__default.Fragment, { children: [
79078
78865
  /* @__PURE__ */ jsxRuntimeExports.jsx(x, { sx: { marginBottom: 4 }, truncate: false, variant: "H2", children: __("Disconnect institution") }),
79079
- /* @__PURE__ */ jsxRuntimeExports.jsx(x, { "data-test": "disconnect-disclaimer", truncate: false, variant: "Paragraph", children: _p(
79080
- "connect/deletesurvey/disclaimer/text",
79081
- "Why do you want to disconnect %1?",
79082
- member.name
79083
- ) }),
78866
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(FormLabel$1, { children: [
78867
+ /* @__PURE__ */ jsxRuntimeExports.jsx(x, { "data-test": "disconnect-disclaimer", truncate: false, variant: "Paragraph", children: _p(
78868
+ "connect/deletesurvey/disclaimer/text",
78869
+ "Why do you want to disconnect %1?",
78870
+ member.name
78871
+ ) }),
78872
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "#E32727", fontSize: 15 }, children: "*" })
78873
+ ] }),
79084
78874
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.reasons, children: reasonList.map((reason, i) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginBottom: 20 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
79085
78875
  ProtectedRadio,
79086
78876
  {
@@ -79094,10 +78884,16 @@ const DeleteMemberSurvey = (props) => {
79094
78884
  name: "reasons",
79095
78885
  onChange: () => {
79096
78886
  setSelectedReason(reason);
79097
- }
78887
+ },
78888
+ required: true
79098
78889
  },
79099
78890
  reason
79100
78891
  ) }, reason)) }),
78892
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { style: { color: "#666", fontSize: 13, marginBottom: 12 }, children: [
78893
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "#E32727", fontSize: 13 }, children: "*" }),
78894
+ " ",
78895
+ __("Required")
78896
+ ] }),
79101
78897
  isSubmitted && !selectedReason && /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { role: "alert", style: styles.errorContent, children: [
79102
78898
  /* @__PURE__ */ jsxRuntimeExports.jsx(AttentionFilled, { color: tokens.Color.Error300 }),
79103
78899
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { style: styles.errorMessage, children: __("Choose a reason for deleting") })
@@ -79803,6 +79599,7 @@ const Spanish$1 = "Espagnol";
79803
79599
  const French$1 = "Français";
79804
79600
  const English$1 = "Anglais";
79805
79601
  const Close$1 = "Fermer";
79602
+ const Required$1 = "Requis";
79806
79603
  const frCa = {
79807
79604
  "Add Manual Account": "Ajouter un compte manuellement",
79808
79605
  Search: Search$1,
@@ -80198,6 +79995,7 @@ const frCa = {
80198
79995
  "Send feedback": "Envoyer des commentaires",
80199
79996
  "Give feedback": "Donnez votre avis",
80200
79997
  Close: Close$1,
79998
+ "Disconnect institution": "Déconnecter l'institution",
80201
79999
  "Mode not enabled": "Mode non activé",
80202
80000
  "This mode isn’t available in your current plan. Please contact your representative to explore options.": "Ce mode n'est pas disponible avec votre forfait actuel. Veuillez contacter votre représentant pour explorer les options.",
80203
80001
  "Feature not available": "Fonctionnalité non disponible",
@@ -80206,6 +80004,7 @@ const frCa = {
80206
80004
  "Connect a different institution": "Mettre en relation un autre établissement",
80207
80005
  "No eligible accounts": "Aucun compte admissible",
80208
80006
  "Only checking or savings accounts can be used for transfers. If you have one at %1, make sure to select it when connecting. Otherwise, try connecting a different institution.": "Seuls les comptes chèques ou d’épargne peuvent être utilisés pour les transferts. Si vous en avez un à %1, assurez-vous de le sélectionner lors de la connexion. Sinon, essayez de connecter une autre institution.",
80007
+ Required: Required$1,
80209
80008
  "connect/disclosure/policy/text\u0004By clicking Continue, you agree to the ": "En cliquant sur Continuer, vous acceptez la ",
80210
80009
  "connect/disclosure/policy/link\u0004MX Privacy Policy.": "Politique de confidentialité de MX.",
80211
80010
  "connect/disclosure/policy/link\u0004MX Privacy Policy": "Politique de confidentialité de MX.",
@@ -80285,6 +80084,7 @@ const Spanish = "Español";
80285
80084
  const French = "Francés";
80286
80085
  const English = "Inglés";
80287
80086
  const Close = "Cerrar";
80087
+ const Required = "Requerido";
80288
80088
  const es = {
80289
80089
  "": {
80290
80090
  language: "es",
@@ -80641,6 +80441,7 @@ const es = {
80641
80441
  "Transaction amounts": "Montos de la transacción",
80642
80442
  "Transaction dates": "Fechas de transacción",
80643
80443
  "Transaction descriptions": "Descripciones de transacciones",
80444
+ "Disconnect institution": "Desconectar institución",
80644
80445
  "This includes:": "Esto incluye:",
80645
80446
  "Who is MX Technologies?": "¿Quién es MX Technologies?",
80646
80447
  "MX is a trusted financial data platform that securely connects your accounts. It follows strict security and privacy standards to keep your information safe.": "MX es una plataforma confiable de datos financieros que conecta tus cuentas de forma segura. Cumple con estrictos estándares de seguridad y privacidad para mantener tu información segura.",
@@ -80690,6 +80491,7 @@ const es = {
80690
80491
  "Connect a different institution": "Conecte una institución diferente",
80691
80492
  "No eligible accounts": "No hay cuentas elegibles",
80692
80493
  "Only checking or savings accounts can be used for transfers. If you have one at %1, make sure to select it when connecting. Otherwise, try connecting a different institution.": "Solo se pueden usar cuentas de control o ahorro para transferencias. Si tiene uno en %1, asegúrese de seleccionarlo al conectarlo. De lo contrario, intente conectar una institución diferente.",
80494
+ Required: Required,
80693
80495
  "connect/disclosure/button\u0004Continue": "Continuar",
80694
80496
  "connect/disclosure/policy/text\u0004By clicking Continue, you agree to the ": "Al hacer clic en Continuar, tu aceptas la ",
80695
80497
  "connect/disclosure/policy/link\u0004MX Privacy Policy.": "Política de privacidad de Money Experience.",
@@ -80942,27 +80744,8 @@ const ConnectedTokenProvider = ({ children }) => {
80942
80744
  );
80943
80745
  };
80944
80746
 
80945
- /**
80946
- * @name getUnixTime
80947
- * @category Timestamp Helpers
80948
- * @summary Get the seconds timestamp of the given date.
80949
- *
80950
- * @description
80951
- * Get the seconds timestamp of the given date.
80952
- *
80953
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
80954
- *
80955
- * @param date - The given date
80956
- *
80957
- * @returns The timestamp
80958
- *
80959
- * @example
80960
- * // Get the timestamp of 29 February 2012 11:45:05 CET:
80961
- * const result = getUnixTime(new Date(2012, 1, 29, 11, 45, 5))
80962
- * //=> 1330512305
80963
- */
80964
80747
  function getUnixTime(date) {
80965
- return Math.trunc(+toDate(date) / 1000);
80748
+ return Math.trunc(+toDate(date) / 1e3);
80966
80749
  }
80967
80750
 
80968
80751
  const APP_MIN_WIDTH = 320;