@reachfive/identity-ui 1.21.0 → 1.22.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/CHANGELOG.md +13 -1
- package/cjs/identity-ui.js +233 -268
- package/es/identity-ui.js +241 -276
- package/package.json +2 -2
- package/umd/identity-ui.js +248 -318
- package/umd/identity-ui.min.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.22.0] - 2023-11-09
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- User interface enhancement on date type field.
|
|
15
|
+
|
|
16
|
+
### Fixes
|
|
17
|
+
|
|
18
|
+
- AccessToken is no more required in passwordless code verification workflow.
|
|
19
|
+
|
|
10
20
|
## [1.21.0] - 2023-10-12
|
|
11
21
|
|
|
12
22
|
### Added
|
|
@@ -365,7 +375,9 @@ The eye icon is now correctly displayed in the Auth widget.
|
|
|
365
375
|
|
|
366
376
|
First version of the SDK Web UI.
|
|
367
377
|
|
|
368
|
-
[Unreleased]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.
|
|
378
|
+
[Unreleased]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.22.0...HEAD
|
|
379
|
+
|
|
380
|
+
[1.22.0]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.21.0...v1.22.0
|
|
369
381
|
|
|
370
382
|
[1.21.0]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.20.2...v1.21.0
|
|
371
383
|
|
package/cjs/identity-ui.js
CHANGED
|
@@ -7327,12 +7327,6 @@ function isValued(v) {
|
|
|
7327
7327
|
var unwrap = isObject(v) ? v[rawProperty] : v;
|
|
7328
7328
|
return unwrap !== null && unwrap !== undefined && unwrap !== '' && !Number.isNaN(unwrap) && (Array.isArray(unwrap) ? unwrap.length > 0 : true);
|
|
7329
7329
|
}
|
|
7330
|
-
function formatISO8601Date(year, month, day) {
|
|
7331
|
-
if (isValued(year) && isValued(month) && isValued(day)) {
|
|
7332
|
-
return "".concat(year, "-").concat(month.toString().padStart(2, '0'), "-").concat(day.toString().padStart(2, '0'));
|
|
7333
|
-
}
|
|
7334
|
-
return null;
|
|
7335
|
-
}
|
|
7336
7330
|
function specializeIdentifierData(data) {
|
|
7337
7331
|
return data.identifier ? _objectSpread2(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
7338
7332
|
identifier: undefined
|
|
@@ -9624,275 +9618,248 @@ function selectField(_ref) {
|
|
|
9624
9618
|
}));
|
|
9625
9619
|
}
|
|
9626
9620
|
|
|
9627
|
-
var
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9621
|
+
var useDebounce = function useDebounce(value, milliSeconds) {
|
|
9622
|
+
var _useState = React.useState(value),
|
|
9623
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9624
|
+
debouncedValue = _useState2[0],
|
|
9625
|
+
setDebouncedValue = _useState2[1];
|
|
9626
|
+
React.useEffect(function () {
|
|
9627
|
+
var handler = setTimeout(function () {
|
|
9628
|
+
setDebouncedValue(value);
|
|
9629
|
+
}, milliSeconds);
|
|
9630
|
+
return function () {
|
|
9631
|
+
clearTimeout(handler);
|
|
9632
|
+
};
|
|
9633
|
+
}, [value, milliSeconds]);
|
|
9634
|
+
return debouncedValue;
|
|
9639
9635
|
};
|
|
9640
|
-
function dateField(config) {
|
|
9641
|
-
return simpleField(_objectSpread2(_objectSpread2({
|
|
9642
|
-
placeholder: 'mm/dd/yyyy'
|
|
9643
|
-
}, config), {}, {
|
|
9644
|
-
type: 'text',
|
|
9645
|
-
format: {
|
|
9646
|
-
bind: function bind(modelValue) {
|
|
9647
|
-
if (modelValue && modelValue.length) {
|
|
9648
|
-
var _modelValue$split = modelValue.split('-'),
|
|
9649
|
-
_modelValue$split2 = _slicedToArray(_modelValue$split, 3),
|
|
9650
|
-
_modelValue$split2$ = _modelValue$split2[0],
|
|
9651
|
-
year = _modelValue$split2$ === void 0 ? '' : _modelValue$split2$,
|
|
9652
|
-
_modelValue$split2$2 = _modelValue$split2[1],
|
|
9653
|
-
month = _modelValue$split2$2 === void 0 ? '' : _modelValue$split2$2,
|
|
9654
|
-
_modelValue$split2$3 = _modelValue$split2[2],
|
|
9655
|
-
day = _modelValue$split2$3 === void 0 ? '' : _modelValue$split2$3;
|
|
9656
|
-
return "".concat(month, "/").concat(day, "/").concat(year);
|
|
9657
|
-
}
|
|
9658
|
-
},
|
|
9659
|
-
unbind: formatDate
|
|
9660
|
-
},
|
|
9661
|
-
validator: new Validator({
|
|
9662
|
-
rule: function rule(value) {
|
|
9663
|
-
var date = formatDate(value);
|
|
9664
|
-
return !date || validator.isISO8601(date);
|
|
9665
|
-
},
|
|
9666
|
-
hint: 'date'
|
|
9667
|
-
})
|
|
9668
|
-
}));
|
|
9669
|
-
}
|
|
9670
9636
|
|
|
9671
|
-
var _excluded$6 = ["state"];
|
|
9672
9637
|
var _templateObject$a, _templateObject2$5;
|
|
9673
|
-
var BIRTHDAY_PATH = 'birthdate';
|
|
9674
|
-
var months = function months(i18n) {
|
|
9675
|
-
return ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].map(function (m, i) {
|
|
9676
|
-
return {
|
|
9677
|
-
value: i + 1,
|
|
9678
|
-
label: i18n(m)
|
|
9679
|
-
};
|
|
9680
|
-
});
|
|
9681
|
-
};
|
|
9682
9638
|
var inputRowGutter = 10;
|
|
9683
|
-
var InputRow = styled__default.div(_templateObject$a || (_templateObject$a = _taggedTemplateLiteral(["\n
|
|
9684
|
-
var InputCol = styled__default.div(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["\n
|
|
9639
|
+
var InputRow = styled__default.div(_templateObject$a || (_templateObject$a = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n gap: ", "px;\n"])), inputRowGutter);
|
|
9640
|
+
var InputCol = styled__default.div(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["\n flex-basis: ", "%;\n"])), function (props) {
|
|
9685
9641
|
return props.width;
|
|
9686
9642
|
});
|
|
9687
|
-
var
|
|
9688
|
-
var
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9643
|
+
var DateField = function DateField(_ref) {
|
|
9644
|
+
var i18n = _ref.i18n,
|
|
9645
|
+
inputId = _ref.inputId,
|
|
9646
|
+
label = _ref.label,
|
|
9647
|
+
locale = _ref.locale,
|
|
9648
|
+
onChange = _ref.onChange,
|
|
9649
|
+
path = _ref.path,
|
|
9650
|
+
required = _ref.required,
|
|
9651
|
+
showLabel = _ref.showLabel,
|
|
9652
|
+
validation = _ref.validation,
|
|
9653
|
+
value = _ref.value;
|
|
9654
|
+
var _useState = React.useState(isValued(value) ? value.raw.day : undefined),
|
|
9655
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9656
|
+
day = _useState2[0],
|
|
9657
|
+
setDay = _useState2[1];
|
|
9658
|
+
var _useState3 = React.useState(isValued(value) ? value.raw.month : undefined),
|
|
9659
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
9660
|
+
month = _useState4[0],
|
|
9661
|
+
setMonth = _useState4[1];
|
|
9662
|
+
var _useState5 = React.useState(isValued(value) ? value.raw.year : undefined),
|
|
9663
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
9664
|
+
year = _useState6[0],
|
|
9665
|
+
setYear = _useState6[1];
|
|
9666
|
+
|
|
9667
|
+
// debounce year value to delay value update when user is currently editing it
|
|
9668
|
+
var debouncedYear = useDebounce(year, 1000);
|
|
9669
|
+
var setDatePart = function setDatePart(setter, value) {
|
|
9670
|
+
if (Number.isNaN(Number(value))) return; // only accept number value
|
|
9671
|
+
setter(Number(value));
|
|
9710
9672
|
};
|
|
9711
|
-
var
|
|
9712
|
-
return
|
|
9713
|
-
|
|
9714
|
-
|
|
9673
|
+
var handleDayChange = function handleDayChange(event) {
|
|
9674
|
+
return setDatePart(setDay, event.target.value);
|
|
9675
|
+
};
|
|
9676
|
+
var handleMonthChange = function handleMonthChange(event) {
|
|
9677
|
+
return setDatePart(setMonth, event.target.value);
|
|
9678
|
+
};
|
|
9679
|
+
var handleYearChange = function handleYearChange(event) {
|
|
9680
|
+
return setDatePart(setYear, event.target.value);
|
|
9681
|
+
};
|
|
9682
|
+
React.useEffect(function () {
|
|
9683
|
+
if (day && month && debouncedYear) {
|
|
9684
|
+
onChange(function () {
|
|
9685
|
+
return {
|
|
9686
|
+
value: {
|
|
9687
|
+
raw: luxon.DateTime.fromObject({
|
|
9688
|
+
year: debouncedYear,
|
|
9689
|
+
month: month,
|
|
9690
|
+
day: day
|
|
9691
|
+
})
|
|
9692
|
+
},
|
|
9715
9693
|
isDirty: true
|
|
9716
|
-
}
|
|
9694
|
+
};
|
|
9717
9695
|
});
|
|
9718
|
-
}
|
|
9696
|
+
}
|
|
9697
|
+
}, [debouncedYear, month, day]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
9698
|
+
|
|
9699
|
+
var months = React.useMemo(function () {
|
|
9700
|
+
return luxon.Info.months("long", {
|
|
9701
|
+
locale: locale
|
|
9702
|
+
});
|
|
9703
|
+
}, [locale]);
|
|
9704
|
+
var daysInMonth = React.useMemo(function () {
|
|
9705
|
+
return Array.from({
|
|
9706
|
+
length: luxon.DateTime.fromObject({
|
|
9707
|
+
year: debouncedYear,
|
|
9708
|
+
month: month
|
|
9709
|
+
}).daysInMonth
|
|
9710
|
+
}, function (_value, index) {
|
|
9711
|
+
return index + 1;
|
|
9712
|
+
});
|
|
9713
|
+
}, [debouncedYear, month]);
|
|
9714
|
+
|
|
9715
|
+
// reset day if current value is out of range
|
|
9716
|
+
if (day && !daysInMonth.includes(day)) {
|
|
9717
|
+
setDay(undefined);
|
|
9718
|
+
}
|
|
9719
|
+
var parts = React.useMemo(function () {
|
|
9720
|
+
return luxon.DateTime.now().setLocale(locale).toLocaleParts().map(function (part) {
|
|
9721
|
+
return part.type;
|
|
9722
|
+
}).filter(function (type) {
|
|
9723
|
+
return type !== 'literal';
|
|
9724
|
+
});
|
|
9725
|
+
}, [locale]);
|
|
9726
|
+
var error = _typeof(validation) === 'object' && 'error' in validation ? validation.error : null;
|
|
9727
|
+
var fields = {
|
|
9728
|
+
day: /*#__PURE__*/React__default.createElement(InputCol, {
|
|
9729
|
+
key: "day",
|
|
9730
|
+
width: 20
|
|
9731
|
+
}, /*#__PURE__*/React__default.createElement(Select, {
|
|
9732
|
+
name: "".concat(path, ".day"),
|
|
9733
|
+
value: day || '',
|
|
9734
|
+
hasError: error,
|
|
9735
|
+
required: required,
|
|
9736
|
+
onChange: handleDayChange,
|
|
9737
|
+
placeholder: i18n('day'),
|
|
9738
|
+
options: daysInMonth.map(function (day) {
|
|
9739
|
+
return {
|
|
9740
|
+
value: day,
|
|
9741
|
+
label: day
|
|
9742
|
+
};
|
|
9743
|
+
}),
|
|
9744
|
+
"data-testid": "".concat(path, ".day"),
|
|
9745
|
+
"aria-label": i18n('day')
|
|
9746
|
+
})),
|
|
9747
|
+
month: /*#__PURE__*/React__default.createElement(InputCol, {
|
|
9748
|
+
key: "month",
|
|
9749
|
+
width: 50
|
|
9750
|
+
}, /*#__PURE__*/React__default.createElement(Select, {
|
|
9751
|
+
name: "".concat(path, ".month"),
|
|
9752
|
+
value: month || '',
|
|
9753
|
+
hasError: error,
|
|
9754
|
+
required: required,
|
|
9755
|
+
onChange: handleMonthChange,
|
|
9756
|
+
placeholder: i18n('month'),
|
|
9757
|
+
options: months.map(function (month, index) {
|
|
9758
|
+
return {
|
|
9759
|
+
value: index + 1,
|
|
9760
|
+
label: month
|
|
9761
|
+
};
|
|
9762
|
+
}),
|
|
9763
|
+
"data-testid": "".concat(path, ".month"),
|
|
9764
|
+
"aria-label": i18n('month')
|
|
9765
|
+
})),
|
|
9766
|
+
year: /*#__PURE__*/React__default.createElement(InputCol, {
|
|
9767
|
+
key: "year",
|
|
9768
|
+
width: 30
|
|
9769
|
+
}, /*#__PURE__*/React__default.createElement(Input, {
|
|
9770
|
+
type: "number",
|
|
9771
|
+
maxlength: "4",
|
|
9772
|
+
inputmode: "numeric",
|
|
9773
|
+
name: "".concat(path, ".year"),
|
|
9774
|
+
value: year || '',
|
|
9775
|
+
hasError: error,
|
|
9776
|
+
required: required,
|
|
9777
|
+
onChange: handleYearChange,
|
|
9778
|
+
placeholder: i18n('year'),
|
|
9779
|
+
"data-testid": "".concat(path, ".year"),
|
|
9780
|
+
"aria-label": i18n('year')
|
|
9781
|
+
}))
|
|
9719
9782
|
};
|
|
9720
|
-
return /*#__PURE__*/React__default.createElement(FormGroup,
|
|
9783
|
+
return /*#__PURE__*/React__default.createElement(FormGroup, {
|
|
9721
9784
|
inputId: inputId,
|
|
9722
|
-
labelText: label
|
|
9723
|
-
|
|
9785
|
+
labelText: label,
|
|
9786
|
+
error: error,
|
|
9724
9787
|
showLabel: showLabel
|
|
9725
|
-
}
|
|
9726
|
-
|
|
9727
|
-
}
|
|
9728
|
-
type: "text",
|
|
9729
|
-
id: inputId,
|
|
9730
|
-
name: "".concat(BIRTHDAY_PATH, ".day"),
|
|
9731
|
-
maxlength: "2",
|
|
9732
|
-
inputmode: "numeric",
|
|
9733
|
-
value: day.value,
|
|
9734
|
-
hasError: !!validation.day,
|
|
9735
|
-
required: required,
|
|
9736
|
-
placeholder: i18n('day'),
|
|
9737
|
-
onChange: handleFieldChange('day'),
|
|
9738
|
-
onBlur: handleFieldBlur('day'),
|
|
9739
|
-
"data-testid": "".concat(BIRTHDAY_PATH, ".day")
|
|
9740
|
-
})), /*#__PURE__*/React__default.createElement(InputCol, {
|
|
9741
|
-
width: 50
|
|
9742
|
-
}, /*#__PURE__*/React__default.createElement(Select, {
|
|
9743
|
-
name: "".concat(BIRTHDAY_PATH, ".month"),
|
|
9744
|
-
value: month.value || '',
|
|
9745
|
-
hasError: !!validation.month,
|
|
9746
|
-
required: required,
|
|
9747
|
-
onChange: handleFieldChange('month'),
|
|
9748
|
-
onBlur: handleFieldBlur('month'),
|
|
9749
|
-
placeholder: i18n('month'),
|
|
9750
|
-
options: months,
|
|
9751
|
-
"data-testid": "".concat(BIRTHDAY_PATH, ".month")
|
|
9752
|
-
})), /*#__PURE__*/React__default.createElement(InputCol, {
|
|
9753
|
-
width: 30
|
|
9754
|
-
}, /*#__PURE__*/React__default.createElement(Input, {
|
|
9755
|
-
type: "text",
|
|
9756
|
-
name: "".concat(BIRTHDAY_PATH, ".year"),
|
|
9757
|
-
maxlength: "4",
|
|
9758
|
-
inputmode: "numeric",
|
|
9759
|
-
value: year.value,
|
|
9760
|
-
hasError: !!validation.year,
|
|
9761
|
-
required: required,
|
|
9762
|
-
placeholder: i18n('year'),
|
|
9763
|
-
onChange: handleFieldChange('year'),
|
|
9764
|
-
onBlur: handleFieldBlur('year'),
|
|
9765
|
-
"data-testid": "".concat(BIRTHDAY_PATH, ".year")
|
|
9766
|
-
}))));
|
|
9788
|
+
}, /*#__PURE__*/React__default.createElement(InputRow, null, parts.map(function (part) {
|
|
9789
|
+
return fields[part];
|
|
9790
|
+
})));
|
|
9767
9791
|
};
|
|
9768
|
-
var
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9792
|
+
var dateFormat = function dateFormat(locale) {
|
|
9793
|
+
return luxon.DateTime.now().setLocale(locale).toLocaleParts().map(function (part) {
|
|
9794
|
+
switch (part.type) {
|
|
9795
|
+
case 'day':
|
|
9796
|
+
return 'dd';
|
|
9797
|
+
case 'month':
|
|
9798
|
+
return 'mm';
|
|
9799
|
+
case 'year':
|
|
9800
|
+
return 'yyyy';
|
|
9801
|
+
case 'literal':
|
|
9802
|
+
return part.value;
|
|
9803
|
+
}
|
|
9804
|
+
}).join('');
|
|
9777
9805
|
};
|
|
9778
|
-
var
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9806
|
+
var datetimeValidator = function datetimeValidator(locale) {
|
|
9807
|
+
return new Validator({
|
|
9808
|
+
rule: function rule(value) {
|
|
9809
|
+
return isValued(value) && value.raw.isValid;
|
|
9810
|
+
},
|
|
9811
|
+
hint: 'date',
|
|
9812
|
+
parameters: {
|
|
9813
|
+
format: dateFormat(locale)
|
|
9814
|
+
}
|
|
9815
|
+
});
|
|
9783
9816
|
};
|
|
9784
|
-
function
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
};
|
|
9802
|
-
return {
|
|
9803
|
-
key: BIRTHDAY_PATH,
|
|
9804
|
-
modelPath: BIRTHDAY_PATH,
|
|
9805
|
-
render: function render(_ref6) {
|
|
9806
|
-
var state = _ref6.state,
|
|
9807
|
-
props = _objectWithoutProperties(_ref6, _excluded$6);
|
|
9808
|
-
return /*#__PURE__*/React__default.createElement(BirthdateField, _extends({
|
|
9809
|
-
key: BIRTHDAY_PATH
|
|
9810
|
-
}, state, props, staticProps));
|
|
9811
|
-
},
|
|
9812
|
-
initialize: function initialize(model) {
|
|
9813
|
-
var modelValue = model.birthdate || defaultValue;
|
|
9814
|
-
var _ref7 = modelValue ? modelValue.split('-') : [],
|
|
9815
|
-
_ref8 = _slicedToArray(_ref7, 3),
|
|
9816
|
-
_ref8$ = _ref8[0],
|
|
9817
|
-
year = _ref8$ === void 0 ? '' : _ref8$,
|
|
9818
|
-
_ref8$2 = _ref8[1],
|
|
9819
|
-
month = _ref8$2 === void 0 ? '' : _ref8$2,
|
|
9820
|
-
_ref8$3 = _ref8[2],
|
|
9821
|
-
day = _ref8$3 === void 0 ? '' : _ref8$3;
|
|
9822
|
-
return {
|
|
9823
|
-
day: {
|
|
9824
|
-
value: day,
|
|
9825
|
-
isDirty: false
|
|
9826
|
-
},
|
|
9827
|
-
month: {
|
|
9828
|
-
value: parseInt(month),
|
|
9829
|
-
isDirty: false
|
|
9830
|
-
},
|
|
9831
|
-
year: {
|
|
9832
|
-
value: year,
|
|
9833
|
-
isDirty: false
|
|
9834
|
-
}
|
|
9835
|
-
};
|
|
9836
|
-
},
|
|
9837
|
-
unbind: function unbind(model, state) {
|
|
9838
|
-
return _objectSpread2(_objectSpread2({}, model), {}, {
|
|
9839
|
-
birthdate: format(state)
|
|
9840
|
-
});
|
|
9841
|
-
},
|
|
9842
|
-
validate: function validate(state, _ref9) {
|
|
9843
|
-
var isSubmitted = _ref9.isSubmitted;
|
|
9844
|
-
var required = staticProps.required;
|
|
9845
|
-
var day = state.day,
|
|
9846
|
-
month = state.month,
|
|
9847
|
-
year = state.year;
|
|
9848
|
-
var missingFields = ['day', 'month', 'year'].filter(function (field) {
|
|
9849
|
-
return (isSubmitted || state[field].isDirty) && !isValued(state[field].value);
|
|
9850
|
-
});
|
|
9851
|
-
if (missingFields.length) {
|
|
9852
|
-
return required || missingFields.length < 3 ? _objectSpread2({
|
|
9853
|
-
error: i18n('validation.required')
|
|
9854
|
-
}, missingFields.reduce(function (acc, field) {
|
|
9855
|
-
return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, field, true));
|
|
9856
|
-
}, {})) : {};
|
|
9857
|
-
}
|
|
9858
|
-
if (isSubmitted || day.isDirty || month.isDirty || year.isDirty) {
|
|
9859
|
-
if (!validator.isNumeric(year.value.toString()) || !luxon.DateTime.fromObject({
|
|
9860
|
-
year: parseInt(year.value, 10)
|
|
9861
|
-
}).isValid) {
|
|
9862
|
-
return {
|
|
9863
|
-
error: i18n("validation.birthdate.year"),
|
|
9864
|
-
year: true
|
|
9865
|
-
};
|
|
9866
|
-
}
|
|
9867
|
-
var birthdate = format(state);
|
|
9868
|
-
if (!birthdate || !validator.isISO8601(birthdate)) {
|
|
9869
|
-
return {
|
|
9870
|
-
error: i18n('validation.birthdate.dayOfMonth'),
|
|
9871
|
-
day: true
|
|
9872
|
-
};
|
|
9873
|
-
}
|
|
9874
|
-
if (!(validator.isNumeric(month.value.toString()) && validator.isNumeric(day.value.toString())) || !luxon.DateTime.fromObject({
|
|
9875
|
-
year: year.value,
|
|
9876
|
-
month: month.value,
|
|
9877
|
-
day: day.value
|
|
9878
|
-
}).isValid) {
|
|
9879
|
-
return {
|
|
9880
|
-
error: i18n("validation.birthdate.dayOfMonth"),
|
|
9881
|
-
day: true
|
|
9882
|
-
};
|
|
9883
|
-
}
|
|
9884
|
-
var limitAge = validateLimitAge(day.value, month.value, year.value);
|
|
9885
|
-
if (limitAge) {
|
|
9886
|
-
return {
|
|
9887
|
-
error: i18n("validation.".concat(limitAge))
|
|
9888
|
-
};
|
|
9889
|
-
}
|
|
9890
|
-
}
|
|
9891
|
-
return {};
|
|
9892
|
-
}
|
|
9893
|
-
};
|
|
9817
|
+
function dateField(props, config) {
|
|
9818
|
+
return createField(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
9819
|
+
format: {
|
|
9820
|
+
bind: function bind(value) {
|
|
9821
|
+
var dt = value ? luxon.DateTime.fromISO(value) : luxon.DateTime.invalid('empty value');
|
|
9822
|
+
return dt.isValid ? {
|
|
9823
|
+
raw: dt
|
|
9824
|
+
} : undefined;
|
|
9825
|
+
},
|
|
9826
|
+
unbind: function unbind(value) {
|
|
9827
|
+
return value.raw.toISODate();
|
|
9828
|
+
}
|
|
9829
|
+
},
|
|
9830
|
+
validator: props.validator ? datetimeValidator(config.language).and(props.validator) : datetimeValidator(config.language),
|
|
9831
|
+
component: DateField,
|
|
9832
|
+
extendedParams: {
|
|
9833
|
+
locale: config.language
|
|
9894
9834
|
}
|
|
9895
|
-
};
|
|
9835
|
+
}));
|
|
9836
|
+
}
|
|
9837
|
+
|
|
9838
|
+
var _excluded$6 = ["min", "max", "label"];
|
|
9839
|
+
var ageLimitValidator = function ageLimitValidator() {
|
|
9840
|
+
var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6;
|
|
9841
|
+
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 129;
|
|
9842
|
+
return new Validator({
|
|
9843
|
+
rule: function rule(value) {
|
|
9844
|
+
var age = luxon.DateTime.now().diff(value.raw, 'years').years;
|
|
9845
|
+
return min < age && age < max;
|
|
9846
|
+
},
|
|
9847
|
+
hint: 'birthdate.yearLimit',
|
|
9848
|
+
parameters: {
|
|
9849
|
+
min: min,
|
|
9850
|
+
max: max
|
|
9851
|
+
}
|
|
9852
|
+
});
|
|
9853
|
+
};
|
|
9854
|
+
function birthdateField(_ref, config) {
|
|
9855
|
+
var min = _ref.min,
|
|
9856
|
+
max = _ref.max,
|
|
9857
|
+
label = _ref.label,
|
|
9858
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
9859
|
+
return dateField(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
9860
|
+
label: label || 'birthdate',
|
|
9861
|
+
validator: ageLimitValidator(min, max)
|
|
9862
|
+
}), config);
|
|
9896
9863
|
}
|
|
9897
9864
|
|
|
9898
9865
|
var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
@@ -10513,7 +10480,7 @@ var predefinedFields = {
|
|
|
10513
10480
|
}, cfg));
|
|
10514
10481
|
}
|
|
10515
10482
|
};
|
|
10516
|
-
function customFieldComponent(customField, cfg) {
|
|
10483
|
+
function customFieldComponent(customField, cfg, config) {
|
|
10517
10484
|
var baseConfig = _objectSpread2(_objectSpread2({
|
|
10518
10485
|
label: customField.name
|
|
10519
10486
|
}, cfg), {}, {
|
|
@@ -10525,7 +10492,7 @@ function customFieldComponent(customField, cfg) {
|
|
|
10525
10492
|
}) : _objectSpread2({}, baseConfig);
|
|
10526
10493
|
return checkboxField(checkboxConfig);
|
|
10527
10494
|
} else if (customField.dataType === 'date') {
|
|
10528
|
-
return dateField(baseConfig);
|
|
10495
|
+
return dateField(baseConfig, config);
|
|
10529
10496
|
} else if (customField.dataType === 'integer') {
|
|
10530
10497
|
return simpleField(_objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
10531
10498
|
type: 'number',
|
|
@@ -10620,7 +10587,7 @@ var resolveField = function resolveField(fieldConfig, config) {
|
|
|
10620
10587
|
}
|
|
10621
10588
|
var customField = findCustomField(config, camelPath);
|
|
10622
10589
|
if (customField) {
|
|
10623
|
-
return customFieldComponent(customField, fieldConfig);
|
|
10590
|
+
return customFieldComponent(customField, fieldConfig, config);
|
|
10624
10591
|
}
|
|
10625
10592
|
var camelPathSplit = camelPath.split('.v'); // TODO What if consent start with a `v`?
|
|
10626
10593
|
var consentField = findConsentField(config, camelPathSplit[0]);
|
|
@@ -11241,12 +11208,10 @@ var VerificationCodeView = /*#__PURE__*/function (_React$Component3) {
|
|
|
11241
11208
|
var _this5$props = _this5.props,
|
|
11242
11209
|
apiClient = _this5$props.apiClient,
|
|
11243
11210
|
auth = _this5$props.auth,
|
|
11244
|
-
challengeId = _this5$props.challengeId
|
|
11245
|
-
accessToken = _this5$props.accessToken;
|
|
11211
|
+
challengeId = _this5$props.challengeId;
|
|
11246
11212
|
return apiClient.verifyMfaPasswordless({
|
|
11247
11213
|
challengeId: challengeId,
|
|
11248
|
-
verificationCode: data.verificationCode
|
|
11249
|
-
accessToken: accessToken
|
|
11214
|
+
verificationCode: data.verificationCode
|
|
11250
11215
|
}).then(function (resp) {
|
|
11251
11216
|
return window.location.replace(auth.redirectUri + "?" + toQueryString(resp));
|
|
11252
11217
|
});
|
|
@@ -12549,7 +12514,7 @@ var Credential = withTheme(styled__default(Card)(_templateObject3$6 || (_templat
|
|
|
12549
12514
|
var CardContent = withTheme(styled__default.div(_templateObject4$4 || (_templateObject4$4 = _taggedTemplateLiteral(["\n margin-left: ", "px;\n white-space: initial;\n"])), function (props) {
|
|
12550
12515
|
return props.theme.get('_blockInnerHeight');
|
|
12551
12516
|
}));
|
|
12552
|
-
var dateFormat = function dateFormat(dateString, locales) {
|
|
12517
|
+
var dateFormat$1 = function dateFormat(dateString, locales) {
|
|
12553
12518
|
return new Date(dateString).toLocaleDateString(locales, {
|
|
12554
12519
|
timeZone: 'UTC'
|
|
12555
12520
|
});
|
|
@@ -12572,7 +12537,7 @@ var MfaList = compose(withI18n, withConfig)(function (_ref) {
|
|
|
12572
12537
|
}
|
|
12573
12538
|
}, friendlyName), /*#__PURE__*/React__default.createElement("div", null, email || phoneNumber), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("span", null, i18n('mfaList.createdAt'), "\xA0: "), /*#__PURE__*/React__default.createElement("time", {
|
|
12574
12539
|
dateTime: createdAt
|
|
12575
|
-
}, dateFormat(createdAt, config.language)))));
|
|
12540
|
+
}, dateFormat$1(createdAt, config.language)))));
|
|
12576
12541
|
}));
|
|
12577
12542
|
});
|
|
12578
12543
|
var mfaListWidget = createWidget({
|