@mxenabled/connect-widget 0.0.13 → 0.0.15

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
@@ -5131,39 +5131,23 @@ function baseFindIndex$2(array, predicate, fromIndex, fromRight) {
5131
5131
  }
5132
5132
  var _baseFindIndex = baseFindIndex$2;
5133
5133
 
5134
- var _trimmedEndIndex;
5135
- var hasRequired_trimmedEndIndex;
5136
-
5137
- function require_trimmedEndIndex () {
5138
- if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
5139
- hasRequired_trimmedEndIndex = 1;
5140
- var reWhitespace = /\s/;
5141
- function trimmedEndIndex(string) {
5142
- var index = string.length;
5143
- while (index-- && reWhitespace.test(string.charAt(index))) {
5144
- }
5145
- return index;
5146
- }
5147
- _trimmedEndIndex = trimmedEndIndex;
5148
- return _trimmedEndIndex;
5134
+ var reWhitespace = /\s/;
5135
+ function trimmedEndIndex$1(string) {
5136
+ var index = string.length;
5137
+ while (index-- && reWhitespace.test(string.charAt(index))) {
5138
+ }
5139
+ return index;
5149
5140
  }
5141
+ var _trimmedEndIndex = trimmedEndIndex$1;
5150
5142
 
5151
- var _baseTrim;
5152
- var hasRequired_baseTrim;
5153
-
5154
- function require_baseTrim () {
5155
- if (hasRequired_baseTrim) return _baseTrim;
5156
- hasRequired_baseTrim = 1;
5157
- var trimmedEndIndex = require_trimmedEndIndex();
5158
- var reTrimStart = /^\s+/;
5159
- function baseTrim(string) {
5160
- return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
5161
- }
5162
- _baseTrim = baseTrim;
5163
- return _baseTrim;
5143
+ var trimmedEndIndex = _trimmedEndIndex;
5144
+ var reTrimStart = /^\s+/;
5145
+ function baseTrim$1(string) {
5146
+ return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
5164
5147
  }
5148
+ var _baseTrim = baseTrim$1;
5165
5149
 
5166
- var baseTrim = require_baseTrim(), isObject$7 = isObject_1, isSymbol$1 = isSymbol_1;
5150
+ var baseTrim = _baseTrim, isObject$7 = isObject_1, isSymbol$1 = isSymbol_1;
5167
5151
  var NAN = 0 / 0;
5168
5152
  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
5169
5153
  var reIsBinary = /^0b[01]+$/i;
@@ -8629,7 +8613,7 @@ var hasRequiredTrim;
8629
8613
  function requireTrim () {
8630
8614
  if (hasRequiredTrim) return trim_1;
8631
8615
  hasRequiredTrim = 1;
8632
- var baseToString = _baseToString, baseTrim = require_baseTrim(), castSlice = require_castSlice(), charsEndIndex = require_charsEndIndex(), charsStartIndex = require_charsStartIndex(), stringToArray = require_stringToArray(), toString = toString_1;
8616
+ var baseToString = _baseToString, baseTrim = _baseTrim, castSlice = require_castSlice(), charsEndIndex = require_charsEndIndex(), charsStartIndex = require_charsStartIndex(), stringToArray = require_stringToArray(), toString = toString_1;
8633
8617
  function trim(string, chars, guard) {
8634
8618
  string = toString(string);
8635
8619
  if (string && (guard || chars === void 0)) {
@@ -9562,9 +9546,11 @@ const configSlice = createSlice({
9562
9546
  ActionTypes$2.LOAD_CONNECT,
9563
9547
  (state, action) => {
9564
9548
  const productDetermineMode = getProductDeterminedMode(action.payload);
9549
+ const ui_message_version = typeof action.payload.ui_message_version === "string" ? parseInt(action.payload.ui_message_version, 10) : action.payload.ui_message_version || state.ui_message_version;
9565
9550
  return {
9566
9551
  ...state,
9567
9552
  ...action.payload,
9553
+ ui_message_version,
9568
9554
  mode: productDetermineMode !== null ? productDetermineMode : action.payload.mode || state.mode
9569
9555
  };
9570
9556
  }
@@ -62346,42 +62332,44 @@ var range_1 = range;
62346
62332
 
62347
62333
  const _range = /*@__PURE__*/getDefaultExportFromCjs(range_1);
62348
62334
 
62349
- const DayOfMonthPicker = (props) => {
62350
- const containerRef = useRef(null);
62351
- const tokens = useTokens();
62352
- const styles = getStyles$8(tokens);
62353
- const getNextDelay = getDelay();
62354
- const days = _range(1, 32);
62355
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
62356
- /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
62357
- GoBackButton,
62358
- {
62359
- handleGoBack: () => fadeOut(containerRef.current, "up", 300).then(props.handleClose)
62360
- }
62361
- ) }),
62362
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SlideDown, { delay: getNextDelay(), children: [
62363
- /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { "data-test": "date-picker-header", style: styles.title, tag: "h2", children: __("Payment due day") }),
62364
- /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { "data-test": "date-picker-paragraph", style: styles.body, tag: "p", children: __("Choose what day of the month your payment is due.") })
62365
- ] }),
62366
- /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "data-test": "date-picker-calendar", style: styles.buttons, children: days.map((day) => /* @__PURE__ */ jsxRuntimeExports.jsx(
62367
- Button$1,
62368
- {
62369
- autoFocus: day === 1,
62370
- "data-test": `date-picker-button-${day}`,
62371
- name: props.name || day,
62372
- onClick: (e) => {
62373
- e.persist();
62374
- fadeOut(containerRef.current, "up", 300).then(() => props.handleSelect(e));
62335
+ const DayOfMonthPicker = React__default.forwardRef(
62336
+ (props, ref) => {
62337
+ const tokens = useTokens();
62338
+ const styles = getStyles$8(tokens);
62339
+ const getNextDelay = getDelay();
62340
+ const days = _range(1, 32);
62341
+ const containerRef = ref;
62342
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
62343
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
62344
+ GoBackButton,
62345
+ {
62346
+ handleGoBack: () => fadeOut(containerRef?.current, "up", 300).then(props.handleClose)
62347
+ }
62348
+ ) }),
62349
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SlideDown, { delay: getNextDelay(), children: [
62350
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { "data-test": "date-picker-header", style: styles.title, tag: "h2", children: __("Payment due day") }),
62351
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { "data-test": "date-picker-paragraph", style: styles.body, tag: "p", children: __("Choose what day of the month your payment is due.") })
62352
+ ] }),
62353
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "data-test": "date-picker-calendar", style: styles.buttons, children: days.map((day) => /* @__PURE__ */ jsxRuntimeExports.jsx(
62354
+ Button,
62355
+ {
62356
+ autoFocus: day === 1,
62357
+ "data-test": `date-picker-button-${day}`,
62358
+ name: props.name || day,
62359
+ onClick: (e) => {
62360
+ e.persist();
62361
+ fadeOut(containerRef?.current, "up", 300).then(() => props.handleSelect(e));
62362
+ },
62363
+ style: styles.button,
62364
+ value: day,
62365
+ variant: "transparent",
62366
+ children: day
62375
62367
  },
62376
- style: styles.button,
62377
- value: day,
62378
- variant: "text",
62379
- children: day
62380
- },
62381
- day
62382
- )) }) })
62383
- ] });
62384
- };
62368
+ day
62369
+ )) }) })
62370
+ ] });
62371
+ }
62372
+ );
62385
62373
  const getStyles$8 = (tokens) => ({
62386
62374
  title: {
62387
62375
  marginBottom: tokens.Spacing.XSmall
@@ -62395,16 +62383,10 @@ const getStyles$8 = (tokens) => ({
62395
62383
  marginTop: tokens.Spacing.XSmall
62396
62384
  },
62397
62385
  button: {
62398
- width: "calc(100%/7)",
62399
- fontSize: "13px",
62400
- minWidth: "auto"
62386
+ width: "14.25%"
62401
62387
  }
62402
62388
  });
62403
- DayOfMonthPicker.propTypes = {
62404
- handleClose: PropTypes$1.func.isRequired,
62405
- handleSelect: PropTypes$1.func.isRequired,
62406
- name: PropTypes$1.string
62407
- };
62389
+ DayOfMonthPicker.displayName = "DayOfMonthPicker";
62408
62390
 
62409
62391
  const ManualAccountForm = React__default.forwardRef(
62410
62392
  (props, ref) => {
@@ -62414,7 +62396,6 @@ const ManualAccountForm = React__default.forwardRef(
62414
62396
  const members = useSelector(getMembers);
62415
62397
  const [saving, setSaving] = useState(false);
62416
62398
  const [isPersonal, setIsPersonal] = useState(true);
62417
- const [showDayPicker, setShowDayPicker] = useState(false);
62418
62399
  const [returnField, setReturnField] = useState(null);
62419
62400
  const [accountCreationError, setAccountCreationError] = useState(null);
62420
62401
  const dispatch = useDispatch();
@@ -62497,17 +62478,18 @@ const ManualAccountForm = React__default.forwardRef(
62497
62478
  return () => createManualAccount$.unsubscribe();
62498
62479
  }, [saving]);
62499
62480
  const shouldFocus = (field, returnField2, i) => returnField2 ? returnField2 === field : i === 0;
62500
- if (showDayPicker) {
62481
+ if (props.showDayPicker) {
62501
62482
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
62502
62483
  DayOfMonthPicker,
62503
62484
  {
62504
62485
  "data-test": "day-of-month-picker",
62505
- handleClose: () => setShowDayPicker(false),
62486
+ handleClose: () => props.setShowDayPicker(false),
62506
62487
  handleSelect: (e) => {
62507
62488
  handleTextInputChange(e);
62508
- setShowDayPicker(false);
62489
+ props.setShowDayPicker(false);
62509
62490
  },
62510
- name: "day_payment_is_due"
62491
+ name: "day_payment_is_due",
62492
+ ref
62511
62493
  }
62512
62494
  );
62513
62495
  }
@@ -62568,11 +62550,11 @@ const ManualAccountForm = React__default.forwardRef(
62568
62550
  name: field.name,
62569
62551
  onChange: () => {
62570
62552
  setReturnField(field.name);
62571
- setShowDayPicker(true);
62553
+ props.setShowDayPicker(true);
62572
62554
  },
62573
62555
  onClick: () => {
62574
62556
  setReturnField(field.name);
62575
- setShowDayPicker(true);
62557
+ props.setShowDayPicker(true);
62576
62558
  },
62577
62559
  value: values[field.name]
62578
62560
  }
@@ -62819,6 +62801,7 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
62819
62801
  const formRef = useRef(null);
62820
62802
  const menuRef = useRef(null);
62821
62803
  const postMessageFunctions = useContext(PostMessageContext);
62804
+ const [showDayPicker, setShowDayPicker] = useState(false);
62822
62805
  const [state, dispatch] = useReducer(reducer$1, {
62823
62806
  showForm: false,
62824
62807
  showSuccess: false,
@@ -62838,13 +62821,13 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
62838
62821
  }
62839
62822
  },
62840
62823
  showBackButton() {
62841
- if (state.showSuccess) {
62824
+ if (state.showSuccess || showDayPicker) {
62842
62825
  return false;
62843
62826
  }
62844
62827
  return menuRef.current || formRef.current;
62845
62828
  }
62846
62829
  };
62847
- }, [state]);
62830
+ }, [state, showDayPicker]);
62848
62831
  const handleAccountTypeSelect = (accountType) => {
62849
62832
  dispatch({ type: Actions.SELECT_ACCOUNT_TYPE, payload: accountType });
62850
62833
  };
@@ -62874,7 +62857,9 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
62874
62857
  handleSuccess: () => {
62875
62858
  dispatch({ type: Actions.HANDLE_SUCCESS });
62876
62859
  },
62877
- ref: formRef
62860
+ ref: formRef,
62861
+ setShowDayPicker,
62862
+ showDayPicker
62878
62863
  }
62879
62864
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
62880
62865
  ManualAccountMenu,
@@ -65092,7 +65077,7 @@ const Connect$2 = ({
65092
65077
  }) => {
65093
65078
  const connectConfig = useSelector(selectConnectConfig);
65094
65079
  const loadError = useSelector((state2) => state2.connect.loadError);
65095
- const hasAtriumAPI = useSelector((state2) => state2.profiles.client?.has_atrium_api);
65080
+ const hasAtriumAPI = useSelector((state2) => state2.profiles.client.has_atrium_api);
65096
65081
  const isLoading = useSelector((state2) => state2.connect.isComponentLoading);
65097
65082
  const isMobileWebview = useSelector(selectIsMobileWebView);
65098
65083
  const isVerificationEnabled = useSelector(