@reachfive/identity-ui 1.12.1 → 1.15.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 +55 -17
- package/cjs/identity-ui.js +699 -110
- package/es/identity-ui.js +699 -110
- package/package.json +7 -7
- package/umd/identity-ui.js +14067 -11250
- package/umd/identity-ui.min.js +1 -1
package/cjs/identity-ui.js
CHANGED
|
@@ -18,8 +18,8 @@ var classes = _interopDefault(require('classnames'));
|
|
|
18
18
|
var remarkable = require('remarkable');
|
|
19
19
|
var validator = require('validator');
|
|
20
20
|
var validator__default = _interopDefault(validator);
|
|
21
|
-
var lodashEs = require('lodash-es');
|
|
22
21
|
var libphonenumber = require('libphonenumber-js');
|
|
22
|
+
var lodashEs = require('lodash-es');
|
|
23
23
|
var charInfo = require('char-info');
|
|
24
24
|
var zxcvbn = _interopDefault(require('@reachfive/zxcvbn'));
|
|
25
25
|
|
|
@@ -3222,6 +3222,10 @@ function baseSet(object, path, value, customizer) {
|
|
|
3222
3222
|
var key = toKey(path[index]),
|
|
3223
3223
|
newValue = value;
|
|
3224
3224
|
|
|
3225
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
3226
|
+
return object;
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3225
3229
|
if (index != lastIndex) {
|
|
3226
3230
|
var objValue = nested[key];
|
|
3227
3231
|
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
@@ -4073,10 +4077,14 @@ function multiViewWidget(_ref3) {
|
|
|
4073
4077
|
}), _temp;
|
|
4074
4078
|
}
|
|
4075
4079
|
|
|
4076
|
-
/* Returns whether a form value has been set with a valid value
|
|
4080
|
+
/* Returns whether a form value has been set with a valid value.
|
|
4081
|
+
* If the user's input has been enriched as an object, raw input is expected
|
|
4082
|
+
* to be in a `raw` field.
|
|
4083
|
+
*/
|
|
4077
4084
|
|
|
4078
4085
|
function isValued(v) {
|
|
4079
|
-
|
|
4086
|
+
var unwrap = isObject(v) ? v.raw : v;
|
|
4087
|
+
return unwrap !== null && unwrap !== undefined && unwrap !== '' && !Number.isNaN(unwrap) && (Array.isArray(unwrap) ? unwrap.length > 0 : true);
|
|
4080
4088
|
}
|
|
4081
4089
|
function formatISO8601Date(year, month, day) {
|
|
4082
4090
|
if (isValued(year) && isValued(month) && isValued(day)) {
|
|
@@ -4085,6 +4093,15 @@ function formatISO8601Date(year, month, day) {
|
|
|
4085
4093
|
|
|
4086
4094
|
return null;
|
|
4087
4095
|
}
|
|
4096
|
+
function specializeIdentifierData(data) {
|
|
4097
|
+
return !!data.identifier ? _objectSpread2(_objectSpread2({}, data), {}, {
|
|
4098
|
+
identifier: undefined
|
|
4099
|
+
}, /@/.test(data.identifier) ? {
|
|
4100
|
+
email: data.identifier
|
|
4101
|
+
} : {
|
|
4102
|
+
phoneNumber: data.identifier.replace(/\s+/g, '')
|
|
4103
|
+
}) : data;
|
|
4104
|
+
}
|
|
4088
4105
|
|
|
4089
4106
|
var CompoundValidator = /*#__PURE__*/function () {
|
|
4090
4107
|
function CompoundValidator(current, next) {
|
|
@@ -4123,7 +4140,9 @@ var Validator = /*#__PURE__*/function () {
|
|
|
4123
4140
|
_classCallCheck(this, Validator);
|
|
4124
4141
|
|
|
4125
4142
|
this.rule = rule;
|
|
4126
|
-
this.hint = hint
|
|
4143
|
+
this.hint = !isFunction(hint) ? function (_) {
|
|
4144
|
+
return hint;
|
|
4145
|
+
} : hint;
|
|
4127
4146
|
this.parameters = parameters;
|
|
4128
4147
|
}
|
|
4129
4148
|
|
|
@@ -4132,10 +4151,13 @@ var Validator = /*#__PURE__*/function () {
|
|
|
4132
4151
|
value: function create(i18n) {
|
|
4133
4152
|
var _this = this;
|
|
4134
4153
|
|
|
4135
|
-
var errorMessage =
|
|
4154
|
+
var errorMessage = function errorMessage(v) {
|
|
4155
|
+
return i18n("validation.".concat(_this.hint(v)), _this.parameters);
|
|
4156
|
+
};
|
|
4157
|
+
|
|
4136
4158
|
return function (value, ctx) {
|
|
4137
4159
|
return !_this.rule(value, ctx) && {
|
|
4138
|
-
error: errorMessage
|
|
4160
|
+
error: errorMessage(value)
|
|
4139
4161
|
};
|
|
4140
4162
|
};
|
|
4141
4163
|
}
|
|
@@ -4795,13 +4817,14 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
|
4795
4817
|
|
|
4796
4818
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
4797
4819
|
return false;
|
|
4798
|
-
} //
|
|
4820
|
+
} // Check that cyclic values are equal.
|
|
4799
4821
|
|
|
4800
4822
|
|
|
4801
|
-
var
|
|
4823
|
+
var arrStacked = stack.get(array);
|
|
4824
|
+
var othStacked = stack.get(other);
|
|
4802
4825
|
|
|
4803
|
-
if (
|
|
4804
|
-
return
|
|
4826
|
+
if (arrStacked && othStacked) {
|
|
4827
|
+
return arrStacked == other && othStacked == array;
|
|
4805
4828
|
}
|
|
4806
4829
|
|
|
4807
4830
|
var index = -1,
|
|
@@ -5422,13 +5445,14 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
5422
5445
|
if (!(isPartial ? key in other : hasOwnProperty$9.call(other, key))) {
|
|
5423
5446
|
return false;
|
|
5424
5447
|
}
|
|
5425
|
-
} //
|
|
5448
|
+
} // Check that cyclic values are equal.
|
|
5426
5449
|
|
|
5427
5450
|
|
|
5428
|
-
var
|
|
5451
|
+
var objStacked = stack.get(object);
|
|
5452
|
+
var othStacked = stack.get(other);
|
|
5429
5453
|
|
|
5430
|
-
if (
|
|
5431
|
-
return
|
|
5454
|
+
if (objStacked && othStacked) {
|
|
5455
|
+
return objStacked == other && othStacked == object;
|
|
5432
5456
|
}
|
|
5433
5457
|
|
|
5434
5458
|
var result = true;
|
|
@@ -6115,12 +6139,43 @@ var now = function now() {
|
|
|
6115
6139
|
return root.Date.now();
|
|
6116
6140
|
};
|
|
6117
6141
|
|
|
6142
|
+
/** Used to match a single whitespace character. */
|
|
6143
|
+
var reWhitespace = /\s/;
|
|
6144
|
+
/**
|
|
6145
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
6146
|
+
* character of `string`.
|
|
6147
|
+
*
|
|
6148
|
+
* @private
|
|
6149
|
+
* @param {string} string The string to inspect.
|
|
6150
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
6151
|
+
*/
|
|
6152
|
+
|
|
6153
|
+
function trimmedEndIndex(string) {
|
|
6154
|
+
var index = string.length;
|
|
6155
|
+
|
|
6156
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
6157
|
+
|
|
6158
|
+
return index;
|
|
6159
|
+
}
|
|
6160
|
+
|
|
6161
|
+
/** Used to match leading whitespace. */
|
|
6162
|
+
|
|
6163
|
+
var reTrimStart = /^\s+/;
|
|
6164
|
+
/**
|
|
6165
|
+
* The base implementation of `_.trim`.
|
|
6166
|
+
*
|
|
6167
|
+
* @private
|
|
6168
|
+
* @param {string} string The string to trim.
|
|
6169
|
+
* @returns {string} Returns the trimmed string.
|
|
6170
|
+
*/
|
|
6171
|
+
|
|
6172
|
+
function baseTrim(string) {
|
|
6173
|
+
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string;
|
|
6174
|
+
}
|
|
6175
|
+
|
|
6118
6176
|
/** Used as references for various `Number` constants. */
|
|
6119
6177
|
|
|
6120
6178
|
var NAN = 0 / 0;
|
|
6121
|
-
/** Used to match leading and trailing whitespace. */
|
|
6122
|
-
|
|
6123
|
-
var reTrim = /^\s+|\s+$/g;
|
|
6124
6179
|
/** Used to detect bad signed hexadecimal string values. */
|
|
6125
6180
|
|
|
6126
6181
|
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
@@ -6175,7 +6230,7 @@ function toNumber(value) {
|
|
|
6175
6230
|
return value === 0 ? value : +value;
|
|
6176
6231
|
}
|
|
6177
6232
|
|
|
6178
|
-
value = value
|
|
6233
|
+
value = baseTrim(value);
|
|
6179
6234
|
var isBinary = reIsBinary.test(value);
|
|
6180
6235
|
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
6181
6236
|
}
|
|
@@ -6788,7 +6843,7 @@ function baseKeysIn(object) {
|
|
|
6788
6843
|
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
6789
6844
|
*/
|
|
6790
6845
|
|
|
6791
|
-
function keysIn
|
|
6846
|
+
function keysIn(object) {
|
|
6792
6847
|
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
6793
6848
|
}
|
|
6794
6849
|
|
|
@@ -6803,7 +6858,7 @@ function keysIn$1(object) {
|
|
|
6803
6858
|
*/
|
|
6804
6859
|
|
|
6805
6860
|
function baseAssignIn(object, source) {
|
|
6806
|
-
return object && copyObject(source, keysIn
|
|
6861
|
+
return object && copyObject(source, keysIn(source), object);
|
|
6807
6862
|
}
|
|
6808
6863
|
|
|
6809
6864
|
/** Detect free variable `exports`. */
|
|
@@ -6917,7 +6972,7 @@ function copySymbolsIn(source, object) {
|
|
|
6917
6972
|
*/
|
|
6918
6973
|
|
|
6919
6974
|
function getAllKeysIn(object) {
|
|
6920
|
-
return baseGetAllKeys(object, keysIn
|
|
6975
|
+
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
|
6921
6976
|
}
|
|
6922
6977
|
|
|
6923
6978
|
/** Used for built-in method references. */
|
|
@@ -9075,6 +9130,310 @@ function checkboxField(config) {
|
|
|
9075
9130
|
}));
|
|
9076
9131
|
}
|
|
9077
9132
|
|
|
9133
|
+
/*
|
|
9134
|
+
* All possible Identifier data is in the `value` prop, they should all be preserved when the type changes.
|
|
9135
|
+
* {
|
|
9136
|
+
* raw: string,
|
|
9137
|
+
* type: 'tel' | 'email' | 'other',
|
|
9138
|
+
* country: string,
|
|
9139
|
+
* formatted: string,
|
|
9140
|
+
* isValid: boolean,
|
|
9141
|
+
* }
|
|
9142
|
+
*/
|
|
9143
|
+
|
|
9144
|
+
function specializeRawIdentifier(inputValue) {
|
|
9145
|
+
var telCall = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (_) {
|
|
9146
|
+
return undefined;
|
|
9147
|
+
};
|
|
9148
|
+
var emailCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (_) {
|
|
9149
|
+
return undefined;
|
|
9150
|
+
};
|
|
9151
|
+
var otherCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (_) {
|
|
9152
|
+
return undefined;
|
|
9153
|
+
};
|
|
9154
|
+
|
|
9155
|
+
if (/^\+?[0-9]+/.test(inputValue)) {
|
|
9156
|
+
return _objectSpread2(_objectSpread2({
|
|
9157
|
+
raw: inputValue
|
|
9158
|
+
}, telCall(inputValue)), {}, {
|
|
9159
|
+
type: 'tel'
|
|
9160
|
+
});
|
|
9161
|
+
} else if (/@/.test(inputValue)) {
|
|
9162
|
+
return _objectSpread2(_objectSpread2({
|
|
9163
|
+
raw: inputValue
|
|
9164
|
+
}, emailCall(inputValue)), {}, {
|
|
9165
|
+
type: 'email'
|
|
9166
|
+
});
|
|
9167
|
+
} else {
|
|
9168
|
+
return _objectSpread2(_objectSpread2({
|
|
9169
|
+
raw: inputValue
|
|
9170
|
+
}, otherCall(inputValue)), {}, {
|
|
9171
|
+
type: 'text'
|
|
9172
|
+
});
|
|
9173
|
+
}
|
|
9174
|
+
}
|
|
9175
|
+
|
|
9176
|
+
function specializeRefinedIdentifier(identifier) {
|
|
9177
|
+
var telCall = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (x) {
|
|
9178
|
+
return x;
|
|
9179
|
+
};
|
|
9180
|
+
var emailCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (x) {
|
|
9181
|
+
return x;
|
|
9182
|
+
};
|
|
9183
|
+
var otherCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (x) {
|
|
9184
|
+
return x;
|
|
9185
|
+
};
|
|
9186
|
+
if (identifier.type === 'tel') return telCall(identifier);else if (identifier.type === 'email') return emailCall(identifier);else return otherCall(identifier);
|
|
9187
|
+
}
|
|
9188
|
+
|
|
9189
|
+
var IdentifierField = /*#__PURE__*/function (_React$Component) {
|
|
9190
|
+
_inherits(IdentifierField, _React$Component);
|
|
9191
|
+
|
|
9192
|
+
var _super = _createSuper(IdentifierField);
|
|
9193
|
+
|
|
9194
|
+
function IdentifierField() {
|
|
9195
|
+
var _this;
|
|
9196
|
+
|
|
9197
|
+
_classCallCheck(this, IdentifierField);
|
|
9198
|
+
|
|
9199
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9200
|
+
args[_key] = arguments[_key];
|
|
9201
|
+
}
|
|
9202
|
+
|
|
9203
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
9204
|
+
|
|
9205
|
+
_defineProperty(_assertThisInitialized(_this), "asYouType", function (inputValue) {
|
|
9206
|
+
var country = _this.props.value.country;
|
|
9207
|
+
var phone = new libphonenumber.AsYouType(country).input(inputValue);
|
|
9208
|
+
var formatted = libphonenumber.format(phone, country, 'International');
|
|
9209
|
+
var isValid = libphonenumber.isValidNumber(phone, country);
|
|
9210
|
+
return {
|
|
9211
|
+
country: country,
|
|
9212
|
+
formatted: formatted,
|
|
9213
|
+
isValid: isValid,
|
|
9214
|
+
raw: phone
|
|
9215
|
+
};
|
|
9216
|
+
});
|
|
9217
|
+
|
|
9218
|
+
return _this;
|
|
9219
|
+
}
|
|
9220
|
+
|
|
9221
|
+
_createClass(IdentifierField, [{
|
|
9222
|
+
key: "componentDidMount",
|
|
9223
|
+
value: function componentDidMount() {
|
|
9224
|
+
var _this$props$value = this.props.value,
|
|
9225
|
+
userInput = _this$props$value.userInput,
|
|
9226
|
+
country = _this$props$value.country;
|
|
9227
|
+
|
|
9228
|
+
try {
|
|
9229
|
+
var parsed = libphonenumber.parse(userInput, country);
|
|
9230
|
+
var phoneValue = country === parsed.country ? libphonenumber.format(parsed, 'National') : userInput;
|
|
9231
|
+
this.asYouType(phoneValue);
|
|
9232
|
+
} catch (e) {}
|
|
9233
|
+
}
|
|
9234
|
+
}, {
|
|
9235
|
+
key: "componentWillUnmount",
|
|
9236
|
+
value: function componentWillUnmount() {
|
|
9237
|
+
this.unmounted = true;
|
|
9238
|
+
}
|
|
9239
|
+
}, {
|
|
9240
|
+
key: "render",
|
|
9241
|
+
value: function render() {
|
|
9242
|
+
var _this2 = this;
|
|
9243
|
+
|
|
9244
|
+
var _this$props = this.props,
|
|
9245
|
+
path = _this$props.path,
|
|
9246
|
+
value = _this$props.value,
|
|
9247
|
+
_this$props$validatio = _this$props.validation,
|
|
9248
|
+
validation = _this$props$validatio === void 0 ? {} : _this$props$validatio,
|
|
9249
|
+
inputId = _this$props.inputId,
|
|
9250
|
+
_this$props$required = _this$props.required,
|
|
9251
|
+
required = _this$props$required === void 0 ? true : _this$props$required,
|
|
9252
|
+
label = _this$props.label,
|
|
9253
|
+
_this$props$placehold = _this$props.placeholder,
|
|
9254
|
+
placeholder = _this$props$placehold === void 0 ? label : _this$props$placehold,
|
|
9255
|
+
readOnly = _this$props.readOnly;
|
|
9256
|
+
return /*#__PURE__*/React__default.createElement(FormGroup, _extends({
|
|
9257
|
+
inputId: inputId,
|
|
9258
|
+
labelText: label
|
|
9259
|
+
}, pick(validation, 'error'), {
|
|
9260
|
+
showLabel: this.props.showLabel
|
|
9261
|
+
}), /*#__PURE__*/React__default.createElement(Input, {
|
|
9262
|
+
id: inputId,
|
|
9263
|
+
name: path,
|
|
9264
|
+
type: value.type,
|
|
9265
|
+
value: value.raw || '',
|
|
9266
|
+
placeholder: placeholder,
|
|
9267
|
+
title: label,
|
|
9268
|
+
required: required,
|
|
9269
|
+
readOnly: readOnly,
|
|
9270
|
+
hasError: !!validation.error,
|
|
9271
|
+
onChange: function onChange(event) {
|
|
9272
|
+
return _this2.props.onChange({
|
|
9273
|
+
value: _objectSpread2(_objectSpread2({}, _this2.props.value), specializeRawIdentifier(event.target.value, _this2.asYouType))
|
|
9274
|
+
});
|
|
9275
|
+
},
|
|
9276
|
+
onBlur: function onBlur() {
|
|
9277
|
+
return _this2.props.onChange({
|
|
9278
|
+
isDirty: true
|
|
9279
|
+
});
|
|
9280
|
+
},
|
|
9281
|
+
"data-testid": path
|
|
9282
|
+
}));
|
|
9283
|
+
}
|
|
9284
|
+
}]);
|
|
9285
|
+
|
|
9286
|
+
return IdentifierField;
|
|
9287
|
+
}(React__default.Component);
|
|
9288
|
+
|
|
9289
|
+
function identifierField(props, config) {
|
|
9290
|
+
return createField(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
9291
|
+
key: 'identifier',
|
|
9292
|
+
label: 'identifier',
|
|
9293
|
+
format: {
|
|
9294
|
+
bind: function bind(x) {
|
|
9295
|
+
return specializeRawIdentifier(x, function (_) {
|
|
9296
|
+
return {
|
|
9297
|
+
country: config.countryCode,
|
|
9298
|
+
isValid: true
|
|
9299
|
+
};
|
|
9300
|
+
}, function (_) {
|
|
9301
|
+
return {
|
|
9302
|
+
country: config.countryCode,
|
|
9303
|
+
isValid: true
|
|
9304
|
+
};
|
|
9305
|
+
}, function (_) {
|
|
9306
|
+
return {
|
|
9307
|
+
country: config.countryCode,
|
|
9308
|
+
isValid: true
|
|
9309
|
+
};
|
|
9310
|
+
});
|
|
9311
|
+
},
|
|
9312
|
+
unbind: function unbind(x) {
|
|
9313
|
+
return specializeRefinedIdentifier(x, function (v) {
|
|
9314
|
+
return v.formatted || v.raw;
|
|
9315
|
+
}, function (v) {
|
|
9316
|
+
return v.raw;
|
|
9317
|
+
}, function (v) {
|
|
9318
|
+
return v.raw;
|
|
9319
|
+
});
|
|
9320
|
+
}
|
|
9321
|
+
},
|
|
9322
|
+
validator: new Validator({
|
|
9323
|
+
rule: function rule(value) {
|
|
9324
|
+
return specializeRefinedIdentifier(value, function (v) {
|
|
9325
|
+
return v.isValid;
|
|
9326
|
+
}, function (v) {
|
|
9327
|
+
return email.rule(v.raw);
|
|
9328
|
+
}, function (_) {
|
|
9329
|
+
return false;
|
|
9330
|
+
});
|
|
9331
|
+
},
|
|
9332
|
+
hint: function hint(value) {
|
|
9333
|
+
return specializeRefinedIdentifier(value, function (_) {
|
|
9334
|
+
return 'phone';
|
|
9335
|
+
}, function (_) {
|
|
9336
|
+
return 'email';
|
|
9337
|
+
}, function (_) {
|
|
9338
|
+
return 'identifier';
|
|
9339
|
+
});
|
|
9340
|
+
}
|
|
9341
|
+
}),
|
|
9342
|
+
component: IdentifierField
|
|
9343
|
+
}));
|
|
9344
|
+
}
|
|
9345
|
+
|
|
9346
|
+
var ReCaptcha = function ReCaptcha() {
|
|
9347
|
+
_classCallCheck(this, ReCaptcha);
|
|
9348
|
+
};
|
|
9349
|
+
|
|
9350
|
+
_defineProperty(ReCaptcha, "getRecaptchaToken", /*#__PURE__*/function () {
|
|
9351
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(siteKey, action) {
|
|
9352
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
9353
|
+
while (1) {
|
|
9354
|
+
switch (_context.prev = _context.next) {
|
|
9355
|
+
case 0:
|
|
9356
|
+
_context.next = 2;
|
|
9357
|
+
return window.grecaptcha.execute(siteKey, {
|
|
9358
|
+
action: action
|
|
9359
|
+
});
|
|
9360
|
+
|
|
9361
|
+
case 2:
|
|
9362
|
+
return _context.abrupt("return", _context.sent);
|
|
9363
|
+
|
|
9364
|
+
case 3:
|
|
9365
|
+
case "end":
|
|
9366
|
+
return _context.stop();
|
|
9367
|
+
}
|
|
9368
|
+
}
|
|
9369
|
+
}, _callee);
|
|
9370
|
+
}));
|
|
9371
|
+
|
|
9372
|
+
return function (_x, _x2) {
|
|
9373
|
+
return _ref.apply(this, arguments);
|
|
9374
|
+
};
|
|
9375
|
+
}());
|
|
9376
|
+
|
|
9377
|
+
_defineProperty(ReCaptcha, "handle", /*#__PURE__*/function () {
|
|
9378
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(data, conf, callback, action) {
|
|
9379
|
+
var captchaToken;
|
|
9380
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
9381
|
+
while (1) {
|
|
9382
|
+
switch (_context2.prev = _context2.next) {
|
|
9383
|
+
case 0:
|
|
9384
|
+
if (!conf.recaptcha_enabled) {
|
|
9385
|
+
_context2.next = 13;
|
|
9386
|
+
break;
|
|
9387
|
+
}
|
|
9388
|
+
|
|
9389
|
+
_context2.prev = 1;
|
|
9390
|
+
_context2.next = 4;
|
|
9391
|
+
return ReCaptcha.getRecaptchaToken(conf.recaptcha_site_key, action);
|
|
9392
|
+
|
|
9393
|
+
case 4:
|
|
9394
|
+
captchaToken = _context2.sent;
|
|
9395
|
+
return _context2.abrupt("return", callback(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
9396
|
+
captchaToken: captchaToken
|
|
9397
|
+
})));
|
|
9398
|
+
|
|
9399
|
+
case 8:
|
|
9400
|
+
_context2.prev = 8;
|
|
9401
|
+
_context2.t0 = _context2["catch"](1);
|
|
9402
|
+
return _context2.abrupt("return", Promise.reject({
|
|
9403
|
+
errorUserMsg: "Error recaptcha",
|
|
9404
|
+
errorMessageKey: "recaptcha.error"
|
|
9405
|
+
}));
|
|
9406
|
+
|
|
9407
|
+
case 11:
|
|
9408
|
+
_context2.next = 14;
|
|
9409
|
+
break;
|
|
9410
|
+
|
|
9411
|
+
case 13:
|
|
9412
|
+
return _context2.abrupt("return", callback(data));
|
|
9413
|
+
|
|
9414
|
+
case 14:
|
|
9415
|
+
case "end":
|
|
9416
|
+
return _context2.stop();
|
|
9417
|
+
}
|
|
9418
|
+
}
|
|
9419
|
+
}, _callee2, null, [[1, 8]]);
|
|
9420
|
+
}));
|
|
9421
|
+
|
|
9422
|
+
return function (_x3, _x4, _x5, _x6) {
|
|
9423
|
+
return _ref2.apply(this, arguments);
|
|
9424
|
+
};
|
|
9425
|
+
}());
|
|
9426
|
+
function importGoogleRecaptchaScript(site_key) {
|
|
9427
|
+
var script = document.createElement("script");
|
|
9428
|
+
script.src = "https://www.google.com/recaptcha/api.js?render=" + site_key;
|
|
9429
|
+
document.body.appendChild(script);
|
|
9430
|
+
}
|
|
9431
|
+
function extractCaptchaTokenFromData(data) {
|
|
9432
|
+
var token = data.captchaToken;
|
|
9433
|
+
delete data.captchaToken;
|
|
9434
|
+
return token;
|
|
9435
|
+
}
|
|
9436
|
+
|
|
9078
9437
|
function _templateObject$7() {
|
|
9079
9438
|
var data = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n text-align: right;\n ", ";\n"]);
|
|
9080
9439
|
|
|
@@ -9092,19 +9451,22 @@ var ForgotPasswordWrapper = withTheme(styled__default.div(_templateObject$7(), f
|
|
|
9092
9451
|
var LoginForm = createForm({
|
|
9093
9452
|
prefix: 'r5-login-',
|
|
9094
9453
|
fields: function fields(_ref) {
|
|
9095
|
-
var _ref$
|
|
9096
|
-
|
|
9454
|
+
var _ref$showIdentifier = _ref.showIdentifier,
|
|
9455
|
+
showIdentifier = _ref$showIdentifier === void 0 ? true : _ref$showIdentifier,
|
|
9097
9456
|
showRememberMe = _ref.showRememberMe,
|
|
9098
9457
|
canShowPassword = _ref.canShowPassword,
|
|
9099
9458
|
showForgotPassword = _ref.showForgotPassword,
|
|
9100
|
-
|
|
9101
|
-
i18n = _ref.i18n
|
|
9102
|
-
|
|
9459
|
+
defaultIdentifier = _ref.defaultIdentifier,
|
|
9460
|
+
i18n = _ref.i18n,
|
|
9461
|
+
config = _ref.config;
|
|
9462
|
+
return [showIdentifier && config.sms ? identifierField({
|
|
9463
|
+
defaultValue: defaultIdentifier
|
|
9464
|
+
}, config) : simpleField({
|
|
9103
9465
|
key: 'email',
|
|
9104
9466
|
label: 'email',
|
|
9105
9467
|
type: 'email',
|
|
9106
9468
|
autoComplete: 'email',
|
|
9107
|
-
defaultValue:
|
|
9469
|
+
defaultValue: defaultIdentifier,
|
|
9108
9470
|
validator: email
|
|
9109
9471
|
}), simplePasswordField({
|
|
9110
9472
|
key: 'password',
|
|
@@ -9143,9 +9505,11 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
|
|
|
9143
9505
|
|
|
9144
9506
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
9145
9507
|
|
|
9146
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
9147
|
-
|
|
9148
|
-
|
|
9508
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
9509
|
+
var specializedData = specializeIdentifierData(data);
|
|
9510
|
+
return _this.props.apiClient.loginWithPassword(_objectSpread2(_objectSpread2({}, specializedData), {}, {
|
|
9511
|
+
captchaToken: data.captchaToken,
|
|
9512
|
+
auth: _objectSpread2(_objectSpread2({}, specializedData.auth), _this.props.auth)
|
|
9149
9513
|
}));
|
|
9150
9514
|
});
|
|
9151
9515
|
|
|
@@ -9153,14 +9517,21 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
|
|
|
9153
9517
|
}
|
|
9154
9518
|
|
|
9155
9519
|
_createClass(LoginView, [{
|
|
9520
|
+
key: "componentDidMount",
|
|
9521
|
+
value: function componentDidMount() {
|
|
9522
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
9523
|
+
}
|
|
9524
|
+
}, {
|
|
9156
9525
|
key: "render",
|
|
9157
9526
|
value: function render() {
|
|
9527
|
+
var _this2 = this;
|
|
9528
|
+
|
|
9158
9529
|
var _this$props = this.props,
|
|
9159
9530
|
socialProviders = _this$props.socialProviders,
|
|
9160
9531
|
_this$props$session = _this$props.session,
|
|
9161
9532
|
session = _this$props$session === void 0 ? {} : _this$props$session,
|
|
9162
9533
|
i18n = _this$props.i18n;
|
|
9163
|
-
var
|
|
9534
|
+
var defaultIdentifier = session.lastLoginType === 'password' ? session.email : null;
|
|
9164
9535
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('login.title')), socialProviders && socialProviders.length > 0 && /*#__PURE__*/React__default.createElement(SocialButtons$1, {
|
|
9165
9536
|
providers: socialProviders,
|
|
9166
9537
|
auth: this.props.auth,
|
|
@@ -9172,8 +9543,11 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
|
|
|
9172
9543
|
showRememberMe: this.props.showRememberMe,
|
|
9173
9544
|
showForgotPassword: this.props.allowForgotPassword,
|
|
9174
9545
|
canShowPassword: this.props.canShowPassword,
|
|
9175
|
-
|
|
9176
|
-
handler:
|
|
9546
|
+
defaultIdentifier: defaultIdentifier,
|
|
9547
|
+
handler: function handler(data) {
|
|
9548
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "login");
|
|
9549
|
+
},
|
|
9550
|
+
config: this.props.config
|
|
9177
9551
|
}), this.props.allowSignup && /*#__PURE__*/React__default.createElement(Alternative, null, /*#__PURE__*/React__default.createElement("span", null, i18n('login.signupLinkPrefix')), "\xA0", /*#__PURE__*/React__default.createElement(Link, {
|
|
9178
9552
|
target: "signup"
|
|
9179
9553
|
}, i18n('login.signupLink'))));
|
|
@@ -9355,15 +9729,18 @@ var WebAuthnSignupViewButtons = styled__default(function (_ref3) {
|
|
|
9355
9729
|
var LoginWithWebAuthnForm = createForm({
|
|
9356
9730
|
prefix: 'r5-login-',
|
|
9357
9731
|
fields: function fields(_ref) {
|
|
9358
|
-
var _ref$
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9732
|
+
var _ref$showIdentifier = _ref.showIdentifier,
|
|
9733
|
+
showIdentifier = _ref$showIdentifier === void 0 ? true : _ref$showIdentifier,
|
|
9734
|
+
defaultIdentifier = _ref.defaultIdentifier,
|
|
9735
|
+
config = _ref.config;
|
|
9736
|
+
return [showIdentifier && config.sms ? identifierField({
|
|
9737
|
+
defaultValue: defaultIdentifier
|
|
9738
|
+
}, config) : simpleField({
|
|
9362
9739
|
key: 'email',
|
|
9363
9740
|
label: 'email',
|
|
9364
9741
|
type: 'email',
|
|
9365
9742
|
autoComplete: 'email',
|
|
9366
|
-
defaultValue:
|
|
9743
|
+
defaultValue: defaultIdentifier,
|
|
9367
9744
|
validator: email
|
|
9368
9745
|
})];
|
|
9369
9746
|
},
|
|
@@ -9387,14 +9764,17 @@ var LoginWithWebAuthnView = /*#__PURE__*/function (_React$Component) {
|
|
|
9387
9764
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
9388
9765
|
|
|
9389
9766
|
_defineProperty(_assertThisInitialized(_this), "handleWebAuthnLogin", function (data) {
|
|
9390
|
-
|
|
9391
|
-
|
|
9767
|
+
var specializedData = specializeIdentifierData(data);
|
|
9768
|
+
return _this.props.apiClient.loginWithWebAuthn(_objectSpread2(_objectSpread2({}, specializedData), {}, {
|
|
9769
|
+
auth: _objectSpread2(_objectSpread2({}, specializedData.auth), _this.props.auth)
|
|
9392
9770
|
}));
|
|
9393
9771
|
});
|
|
9394
9772
|
|
|
9395
9773
|
_defineProperty(_assertThisInitialized(_this), "redirectToPasswordLoginView", function (data) {
|
|
9774
|
+
var username = data.identifier || data.email;
|
|
9775
|
+
|
|
9396
9776
|
_this.props.goTo('login-with-password', {
|
|
9397
|
-
username:
|
|
9777
|
+
username: username
|
|
9398
9778
|
});
|
|
9399
9779
|
});
|
|
9400
9780
|
|
|
@@ -9409,7 +9789,7 @@ var LoginWithWebAuthnView = /*#__PURE__*/function (_React$Component) {
|
|
|
9409
9789
|
_this$props$session = _this$props.session,
|
|
9410
9790
|
session = _this$props$session === void 0 ? {} : _this$props$session,
|
|
9411
9791
|
i18n = _this$props.i18n;
|
|
9412
|
-
var
|
|
9792
|
+
var defaultIdentifier = session.lastLoginType === 'password' ? session.email : null;
|
|
9413
9793
|
|
|
9414
9794
|
var webAuthnButtons = function webAuthnButtons(disabled, handleClick) {
|
|
9415
9795
|
return /*#__PURE__*/React__default.createElement(WebAuthnLoginViewButtons, {
|
|
@@ -9427,10 +9807,11 @@ var LoginWithWebAuthnView = /*#__PURE__*/function (_React$Component) {
|
|
|
9427
9807
|
text: i18n('or')
|
|
9428
9808
|
}), /*#__PURE__*/React__default.createElement(LoginWithWebAuthnForm, {
|
|
9429
9809
|
showLabels: this.props.showLabels,
|
|
9430
|
-
|
|
9810
|
+
defaultIdentifier: defaultIdentifier,
|
|
9431
9811
|
handler: this.handleWebAuthnLogin,
|
|
9432
9812
|
redirect: this.redirectToPasswordLoginView,
|
|
9433
|
-
webAuthnButtons: webAuthnButtons
|
|
9813
|
+
webAuthnButtons: webAuthnButtons,
|
|
9814
|
+
config: this.props.config
|
|
9434
9815
|
}), this.props.allowSignup && /*#__PURE__*/React__default.createElement(Alternative, null, /*#__PURE__*/React__default.createElement("span", null, i18n('login.signupLinkPrefix')), "\xA0", /*#__PURE__*/React__default.createElement(Link, {
|
|
9435
9816
|
target: "signup"
|
|
9436
9817
|
}, i18n('login.signupLink'))));
|
|
@@ -9461,8 +9842,13 @@ var LoginWithPasswordForm = createForm({
|
|
|
9461
9842
|
showRememberMe = _ref.showRememberMe,
|
|
9462
9843
|
canShowPassword = _ref.canShowPassword,
|
|
9463
9844
|
showForgotPassword = _ref.showForgotPassword,
|
|
9464
|
-
i18n = _ref.i18n
|
|
9465
|
-
|
|
9845
|
+
i18n = _ref.i18n,
|
|
9846
|
+
config = _ref.config;
|
|
9847
|
+
return [config.sms ? identifierField({
|
|
9848
|
+
key: 'identifier',
|
|
9849
|
+
defaultValue: username,
|
|
9850
|
+
readOnly: true
|
|
9851
|
+
}, config) : simpleField({
|
|
9466
9852
|
key: 'email',
|
|
9467
9853
|
label: 'email',
|
|
9468
9854
|
type: 'email',
|
|
@@ -9506,9 +9892,11 @@ var LoginView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
9506
9892
|
|
|
9507
9893
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
9508
9894
|
|
|
9509
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
9510
|
-
|
|
9511
|
-
|
|
9895
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
9896
|
+
var specializedData = specializeIdentifierData(data);
|
|
9897
|
+
return _this.props.apiClient.loginWithPassword(_objectSpread2(_objectSpread2({}, specializedData), {}, {
|
|
9898
|
+
captchaToken: data.captchaToken,
|
|
9899
|
+
auth: _objectSpread2(_objectSpread2({}, specializedData.auth), _this.props.auth)
|
|
9512
9900
|
}));
|
|
9513
9901
|
});
|
|
9514
9902
|
|
|
@@ -9516,8 +9904,15 @@ var LoginView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
9516
9904
|
}
|
|
9517
9905
|
|
|
9518
9906
|
_createClass(LoginView, [{
|
|
9907
|
+
key: "componentDidMount",
|
|
9908
|
+
value: function componentDidMount() {
|
|
9909
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
9910
|
+
}
|
|
9911
|
+
}, {
|
|
9519
9912
|
key: "render",
|
|
9520
9913
|
value: function render() {
|
|
9914
|
+
var _this2 = this;
|
|
9915
|
+
|
|
9521
9916
|
var i18n = this.props.i18n;
|
|
9522
9917
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('login.title')), /*#__PURE__*/React__default.createElement(LoginWithPasswordForm, {
|
|
9523
9918
|
username: this.props.username,
|
|
@@ -9525,7 +9920,10 @@ var LoginView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
9525
9920
|
showRememberMe: this.props.showRememberMe,
|
|
9526
9921
|
showForgotPassword: this.props.allowForgotPassword,
|
|
9527
9922
|
canShowPassword: this.props.canShowPassword,
|
|
9528
|
-
handler:
|
|
9923
|
+
handler: function handler(data) {
|
|
9924
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "login");
|
|
9925
|
+
},
|
|
9926
|
+
config: this.props.config
|
|
9529
9927
|
}), /*#__PURE__*/React__default.createElement(Alternative, null, /*#__PURE__*/React__default.createElement(Link, {
|
|
9530
9928
|
target: "login-with-web-authn"
|
|
9531
9929
|
}, i18n('login.password.userAnotherIdentifier'))));
|
|
@@ -10145,7 +10543,7 @@ var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
|
10145
10543
|
_this.props.onChange({
|
|
10146
10544
|
value: {
|
|
10147
10545
|
country: country,
|
|
10148
|
-
|
|
10546
|
+
raw: phone,
|
|
10149
10547
|
formatted: formatted,
|
|
10150
10548
|
isValid: isValid
|
|
10151
10549
|
}
|
|
@@ -10159,12 +10557,12 @@ var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
|
10159
10557
|
key: "componentDidMount",
|
|
10160
10558
|
value: function componentDidMount() {
|
|
10161
10559
|
var _this$props$value = this.props.value,
|
|
10162
|
-
|
|
10560
|
+
raw = _this$props$value.raw,
|
|
10163
10561
|
country = _this$props$value.country;
|
|
10164
10562
|
|
|
10165
10563
|
try {
|
|
10166
|
-
var parsed = libphonenumber.parse(
|
|
10167
|
-
var phoneValue = country === parsed.country ? libphonenumber.format(parsed, 'National') :
|
|
10564
|
+
var parsed = libphonenumber.parse(raw, country);
|
|
10565
|
+
var phoneValue = country === parsed.country ? libphonenumber.format(parsed, 'National') : raw;
|
|
10168
10566
|
this.asYouType(phoneValue);
|
|
10169
10567
|
} catch (e) {}
|
|
10170
10568
|
}
|
|
@@ -10198,7 +10596,7 @@ var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
|
10198
10596
|
id: inputId,
|
|
10199
10597
|
name: path,
|
|
10200
10598
|
type: "tel",
|
|
10201
|
-
value: value.
|
|
10599
|
+
value: value.raw || '',
|
|
10202
10600
|
placeholder: placeholder,
|
|
10203
10601
|
title: label,
|
|
10204
10602
|
required: required,
|
|
@@ -10227,12 +10625,12 @@ function phoneNumberField(props, config) {
|
|
|
10227
10625
|
bind: function bind(x) {
|
|
10228
10626
|
return {
|
|
10229
10627
|
country: config.countryCode,
|
|
10230
|
-
|
|
10628
|
+
raw: x,
|
|
10231
10629
|
isValid: true
|
|
10232
10630
|
};
|
|
10233
10631
|
},
|
|
10234
10632
|
unbind: function unbind(x) {
|
|
10235
|
-
return x.formatted || x.
|
|
10633
|
+
return x.formatted || x.raw;
|
|
10236
10634
|
}
|
|
10237
10635
|
},
|
|
10238
10636
|
validator: new Validator({
|
|
@@ -10685,12 +11083,13 @@ var ConsentField = function ConsentField(_ref) {
|
|
|
10685
11083
|
description = _ref.description,
|
|
10686
11084
|
path = _ref.path,
|
|
10687
11085
|
required = _ref.required,
|
|
10688
|
-
validation = _ref.validation
|
|
11086
|
+
validation = _ref.validation,
|
|
11087
|
+
consentCannotBeGranted = _ref.consentCannotBeGranted;
|
|
10689
11088
|
|
|
10690
11089
|
var clickUpdate = function clickUpdate(_ref2) {
|
|
10691
11090
|
var value = _ref2.value;
|
|
10692
11091
|
return {
|
|
10693
|
-
value: !value,
|
|
11092
|
+
value: consentCannotBeGranted ? false : !value,
|
|
10694
11093
|
isDirty: true
|
|
10695
11094
|
};
|
|
10696
11095
|
};
|
|
@@ -10727,7 +11126,8 @@ function consentField(config) {
|
|
|
10727
11126
|
unbind: function unbind(x) {
|
|
10728
11127
|
return {
|
|
10729
11128
|
granted: x,
|
|
10730
|
-
consentType: config.type
|
|
11129
|
+
consentType: config.type,
|
|
11130
|
+
consentVersion: config.extendedParams.version
|
|
10731
11131
|
};
|
|
10732
11132
|
}
|
|
10733
11133
|
},
|
|
@@ -10897,14 +11297,34 @@ function customFieldComponent(customField, cfg) {
|
|
|
10897
11297
|
}
|
|
10898
11298
|
}
|
|
10899
11299
|
|
|
10900
|
-
function consentFieldComponent(consent,
|
|
10901
|
-
|
|
10902
|
-
|
|
11300
|
+
function consentFieldComponent(consent, fieldConfig, versionIdPath, language) {
|
|
11301
|
+
if (fieldConfig.errorArchivedConsents && consent.status === 'archived') {
|
|
11302
|
+
throw new UserError("The '".concat(consent.key, "' consent is archived and cannot be displayed."));
|
|
11303
|
+
} // If the version ID is not defined in the path, get the latest version ID
|
|
11304
|
+
|
|
11305
|
+
|
|
11306
|
+
var versionId = parseInt(versionIdPath || Math.max.apply(Math, _toConsumableArray(Object.values(consent.versions.map(function (v) {
|
|
11307
|
+
return v.versionId;
|
|
11308
|
+
})))));
|
|
11309
|
+
var version = consent.versions.find(function (version) {
|
|
11310
|
+
return version.versionId === versionId;
|
|
11311
|
+
});
|
|
11312
|
+
|
|
11313
|
+
if (!version) {
|
|
11314
|
+
throw new UserError("Unknown version ID n\xB0".concat(versionId, " of consent '").concat(consent.key, "'."));
|
|
11315
|
+
}
|
|
11316
|
+
|
|
11317
|
+
var baseConfig = _objectSpread2(_objectSpread2({}, fieldConfig), {}, {
|
|
11318
|
+
label: version.title,
|
|
10903
11319
|
extendedParams: {
|
|
10904
|
-
|
|
11320
|
+
version: {
|
|
11321
|
+
versionId: versionId,
|
|
11322
|
+
language: language
|
|
11323
|
+
},
|
|
11324
|
+
description: version.description,
|
|
11325
|
+
consentCannotBeGranted: !fieldConfig.errorArchivedConsents && consent.status === 'archived'
|
|
10905
11326
|
},
|
|
10906
|
-
type: consent.consentType
|
|
10907
|
-
}, cfg), {}, {
|
|
11327
|
+
type: consent.consentType,
|
|
10908
11328
|
key: "consents.".concat(consent.key)
|
|
10909
11329
|
});
|
|
10910
11330
|
|
|
@@ -10919,7 +11339,7 @@ var findCustomField = function findCustomField(config, camelPath) {
|
|
|
10919
11339
|
};
|
|
10920
11340
|
|
|
10921
11341
|
var findConsentField = function findConsentField(config, camelPath) {
|
|
10922
|
-
return find(config.
|
|
11342
|
+
return find(config.consentsVersions, function (f) {
|
|
10923
11343
|
var fieldCamelPath = camelCase(f.key);
|
|
10924
11344
|
return camelPath === fieldCamelPath || camelPath === "consents.".concat(fieldCamelPath);
|
|
10925
11345
|
});
|
|
@@ -10938,13 +11358,14 @@ var resolveField = function resolveField(fieldConfig, config) {
|
|
|
10938
11358
|
return customFieldComponent(customField, fieldConfig);
|
|
10939
11359
|
}
|
|
10940
11360
|
|
|
10941
|
-
var
|
|
11361
|
+
var camelPathSplit = camelPath.split('.v');
|
|
11362
|
+
var consentField = findConsentField(config, camelPathSplit[0]);
|
|
10942
11363
|
|
|
10943
11364
|
if (consentField) {
|
|
10944
|
-
return consentFieldComponent(consentField, fieldConfig);
|
|
11365
|
+
return consentFieldComponent(consentField, fieldConfig, camelPathSplit[1], config.language);
|
|
10945
11366
|
}
|
|
10946
11367
|
|
|
10947
|
-
throw new
|
|
11368
|
+
throw new UserError("Unknown field: ".concat(fieldConfig.key));
|
|
10948
11369
|
};
|
|
10949
11370
|
|
|
10950
11371
|
var buildFormFields = function buildFormFields() {
|
|
@@ -10952,15 +11373,18 @@ var buildFormFields = function buildFormFields() {
|
|
|
10952
11373
|
|
|
10953
11374
|
var _ref = arguments.length > 1 ? arguments[1] : undefined,
|
|
10954
11375
|
canShowPassword = _ref.canShowPassword,
|
|
10955
|
-
|
|
11376
|
+
errorArchivedConsents = _ref.errorArchivedConsents,
|
|
11377
|
+
config = _objectWithoutProperties(_ref, ["canShowPassword", "errorArchivedConsents"]);
|
|
10956
11378
|
|
|
10957
11379
|
return compact(fields).map(function (field) {
|
|
10958
11380
|
return resolveField(isString(field) ? {
|
|
10959
11381
|
key: field,
|
|
10960
|
-
canShowPassword: canShowPassword
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
11382
|
+
canShowPassword: canShowPassword,
|
|
11383
|
+
errorArchivedConsents: errorArchivedConsents
|
|
11384
|
+
} : _objectSpread2(_objectSpread2({}, field), {}, {
|
|
11385
|
+
canShowPassword: canShowPassword,
|
|
11386
|
+
errorArchivedConsents: errorArchivedConsents
|
|
11387
|
+
}), config);
|
|
10964
11388
|
});
|
|
10965
11389
|
};
|
|
10966
11390
|
var computeFieldList = function computeFieldList(fields) {
|
|
@@ -10995,8 +11419,10 @@ var PasswordSignupForm = /*#__PURE__*/function (_React$Component) {
|
|
|
10995
11419
|
blacklist: []
|
|
10996
11420
|
});
|
|
10997
11421
|
|
|
10998
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
11422
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
11423
|
+
var captchaToken = extractCaptchaTokenFromData(data);
|
|
10999
11424
|
return _this.props.apiClient.signup({
|
|
11425
|
+
captchaToken: captchaToken,
|
|
11000
11426
|
data: snakeCaseProperties(data),
|
|
11001
11427
|
auth: _this.props.auth,
|
|
11002
11428
|
redirectUrl: _this.props && _this.props.redirectUrl,
|
|
@@ -11026,8 +11452,15 @@ var PasswordSignupForm = /*#__PURE__*/function (_React$Component) {
|
|
|
11026
11452
|
}
|
|
11027
11453
|
|
|
11028
11454
|
_createClass(PasswordSignupForm, [{
|
|
11455
|
+
key: "componentDidMount",
|
|
11456
|
+
value: function componentDidMount() {
|
|
11457
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
11458
|
+
}
|
|
11459
|
+
}, {
|
|
11029
11460
|
key: "render",
|
|
11030
11461
|
value: function render() {
|
|
11462
|
+
var _this2 = this;
|
|
11463
|
+
|
|
11031
11464
|
var _this$props = this.props,
|
|
11032
11465
|
_this$props$beforeSig = _this$props.beforeSignup,
|
|
11033
11466
|
beforeSignup = _this$props$beforeSig === void 0 ? function (x) {
|
|
@@ -11039,7 +11472,8 @@ var PasswordSignupForm = /*#__PURE__*/function (_React$Component) {
|
|
|
11039
11472
|
canShowPassword = _this$props.canShowPassword,
|
|
11040
11473
|
config = _this$props.config;
|
|
11041
11474
|
var fields = buildFormFields(signupFields, _objectSpread2(_objectSpread2({}, config), {}, {
|
|
11042
|
-
canShowPassword: canShowPassword
|
|
11475
|
+
canShowPassword: canShowPassword,
|
|
11476
|
+
errorArchivedConsents: true
|
|
11043
11477
|
}));
|
|
11044
11478
|
var allFields = userAgreement ? [].concat(_toConsumableArray(fields), [{
|
|
11045
11479
|
staticContent: /*#__PURE__*/React__default.createElement(MarkdownContent, {
|
|
@@ -11057,7 +11491,9 @@ var PasswordSignupForm = /*#__PURE__*/function (_React$Component) {
|
|
|
11057
11491
|
beforeSubmit: beforeSignup,
|
|
11058
11492
|
onFieldChange: this.refreshBlacklist,
|
|
11059
11493
|
sharedProps: sharedProps,
|
|
11060
|
-
handler:
|
|
11494
|
+
handler: function handler(data) {
|
|
11495
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "signup");
|
|
11496
|
+
}
|
|
11061
11497
|
});
|
|
11062
11498
|
}
|
|
11063
11499
|
}]);
|
|
@@ -11215,10 +11651,29 @@ var skipError = function skipError(err) {
|
|
|
11215
11651
|
};
|
|
11216
11652
|
|
|
11217
11653
|
var enhance = recompose.withHandlers({
|
|
11218
|
-
|
|
11654
|
+
callback: function callback(_ref) {
|
|
11219
11655
|
var apiClient = _ref.apiClient,
|
|
11220
11656
|
redirectUrl = _ref.redirectUrl,
|
|
11221
|
-
returnToAfterPasswordReset = _ref.returnToAfterPasswordReset
|
|
11657
|
+
returnToAfterPasswordReset = _ref.returnToAfterPasswordReset,
|
|
11658
|
+
recaptcha_enabled = _ref.recaptcha_enabled,
|
|
11659
|
+
recaptcha_site_key = _ref.recaptcha_site_key;
|
|
11660
|
+
return function (data) {
|
|
11661
|
+
return ReCaptcha.handle(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
11662
|
+
redirectUrl: redirectUrl,
|
|
11663
|
+
returnToAfterPasswordReset: returnToAfterPasswordReset
|
|
11664
|
+
}), {
|
|
11665
|
+
apiClient: apiClient,
|
|
11666
|
+
redirectUrl: redirectUrl,
|
|
11667
|
+
returnToAfterPasswordReset: returnToAfterPasswordReset,
|
|
11668
|
+
recaptcha_enabled: recaptcha_enabled,
|
|
11669
|
+
recaptcha_site_key: recaptcha_site_key
|
|
11670
|
+
}, apiClient.requestPasswordReset, "forgot_password");
|
|
11671
|
+
};
|
|
11672
|
+
},
|
|
11673
|
+
handleSubmit: function handleSubmit(_ref2) {
|
|
11674
|
+
var apiClient = _ref2.apiClient,
|
|
11675
|
+
redirectUrl = _ref2.redirectUrl,
|
|
11676
|
+
returnToAfterPasswordReset = _ref2.returnToAfterPasswordReset;
|
|
11222
11677
|
return function (data) {
|
|
11223
11678
|
return apiClient.requestPasswordReset(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
11224
11679
|
redirectUrl: redirectUrl,
|
|
@@ -11227,17 +11682,18 @@ var enhance = recompose.withHandlers({
|
|
|
11227
11682
|
};
|
|
11228
11683
|
}
|
|
11229
11684
|
});
|
|
11230
|
-
var ForgotPasswordView = enhance(function (
|
|
11231
|
-
var i18n =
|
|
11232
|
-
goTo =
|
|
11233
|
-
allowLogin =
|
|
11234
|
-
|
|
11235
|
-
displaySafeErrorMessage =
|
|
11236
|
-
showLabels =
|
|
11237
|
-
allowWebAuthnLogin =
|
|
11238
|
-
|
|
11685
|
+
var ForgotPasswordView = enhance(function (_ref3) {
|
|
11686
|
+
var i18n = _ref3.i18n,
|
|
11687
|
+
goTo = _ref3.goTo,
|
|
11688
|
+
allowLogin = _ref3.allowLogin,
|
|
11689
|
+
callback = _ref3.callback,
|
|
11690
|
+
displaySafeErrorMessage = _ref3.displaySafeErrorMessage,
|
|
11691
|
+
showLabels = _ref3.showLabels,
|
|
11692
|
+
allowWebAuthnLogin = _ref3.allowWebAuthnLogin,
|
|
11693
|
+
recaptcha_site_key = _ref3.recaptcha_site_key;
|
|
11694
|
+
return /*#__PURE__*/React__default.createElement("div", null, importGoogleRecaptchaScript(recaptcha_site_key), /*#__PURE__*/React__default.createElement(Heading, null, i18n('forgotPassword.title')), /*#__PURE__*/React__default.createElement(Intro, null, i18n('forgotPassword.prompt')), /*#__PURE__*/React__default.createElement(ForgotPasswordForm, {
|
|
11239
11695
|
showLabels: showLabels,
|
|
11240
|
-
handler:
|
|
11696
|
+
handler: callback,
|
|
11241
11697
|
onSuccess: function onSuccess() {
|
|
11242
11698
|
return goTo('forgot-password-success');
|
|
11243
11699
|
},
|
|
@@ -11246,10 +11702,10 @@ var ForgotPasswordView = enhance(function (_ref2) {
|
|
|
11246
11702
|
target: allowWebAuthnLogin ? 'login-with-web-authn' : 'login'
|
|
11247
11703
|
}, i18n('forgotPassword.backToLoginLink'))));
|
|
11248
11704
|
});
|
|
11249
|
-
var ForgotPasswordSuccessView = function ForgotPasswordSuccessView(
|
|
11250
|
-
var i18n =
|
|
11251
|
-
allowLogin =
|
|
11252
|
-
allowWebAuthnLogin =
|
|
11705
|
+
var ForgotPasswordSuccessView = function ForgotPasswordSuccessView(_ref4) {
|
|
11706
|
+
var i18n = _ref4.i18n,
|
|
11707
|
+
allowLogin = _ref4.allowLogin,
|
|
11708
|
+
allowWebAuthnLogin = _ref4.allowWebAuthnLogin;
|
|
11253
11709
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('forgotPassword.title')), /*#__PURE__*/React__default.createElement(Info, null, i18n('forgotPassword.successMessage')), allowLogin && /*#__PURE__*/React__default.createElement(Alternative, null, /*#__PURE__*/React__default.createElement(Link, {
|
|
11254
11710
|
target: allowWebAuthnLogin ? 'login-with-web-authn' : 'login'
|
|
11255
11711
|
}, i18n('back'))));
|
|
@@ -11823,6 +12279,105 @@ var phoneNumberEditorWidget = createMultiViewWidget({
|
|
|
11823
12279
|
}
|
|
11824
12280
|
});
|
|
11825
12281
|
|
|
12282
|
+
/**
|
|
12283
|
+
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
12284
|
+
*
|
|
12285
|
+
* @private
|
|
12286
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
12287
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
12288
|
+
* @returns {Array} Returns the new mapped array.
|
|
12289
|
+
*/
|
|
12290
|
+
|
|
12291
|
+
function baseMap(collection, iteratee) {
|
|
12292
|
+
var index = -1,
|
|
12293
|
+
result = isArrayLike(collection) ? Array(collection.length) : [];
|
|
12294
|
+
baseEach(collection, function (value, key, collection) {
|
|
12295
|
+
result[++index] = iteratee(value, key, collection);
|
|
12296
|
+
});
|
|
12297
|
+
return result;
|
|
12298
|
+
}
|
|
12299
|
+
|
|
12300
|
+
/**
|
|
12301
|
+
* Creates an array of values by running each element in `collection` thru
|
|
12302
|
+
* `iteratee`. The iteratee is invoked with three arguments:
|
|
12303
|
+
* (value, index|key, collection).
|
|
12304
|
+
*
|
|
12305
|
+
* Many lodash methods are guarded to work as iteratees for methods like
|
|
12306
|
+
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
|
|
12307
|
+
*
|
|
12308
|
+
* The guarded methods are:
|
|
12309
|
+
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
|
|
12310
|
+
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
|
|
12311
|
+
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
|
|
12312
|
+
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
|
|
12313
|
+
*
|
|
12314
|
+
* @static
|
|
12315
|
+
* @memberOf _
|
|
12316
|
+
* @since 0.1.0
|
|
12317
|
+
* @category Collection
|
|
12318
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
12319
|
+
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
12320
|
+
* @returns {Array} Returns the new mapped array.
|
|
12321
|
+
* @example
|
|
12322
|
+
*
|
|
12323
|
+
* function square(n) {
|
|
12324
|
+
* return n * n;
|
|
12325
|
+
* }
|
|
12326
|
+
*
|
|
12327
|
+
* _.map([4, 8], square);
|
|
12328
|
+
* // => [16, 64]
|
|
12329
|
+
*
|
|
12330
|
+
* _.map({ 'a': 4, 'b': 8 }, square);
|
|
12331
|
+
* // => [16, 64] (iteration order is not guaranteed)
|
|
12332
|
+
*
|
|
12333
|
+
* var users = [
|
|
12334
|
+
* { 'user': 'barney' },
|
|
12335
|
+
* { 'user': 'fred' }
|
|
12336
|
+
* ];
|
|
12337
|
+
*
|
|
12338
|
+
* // The `_.property` iteratee shorthand.
|
|
12339
|
+
* _.map(users, 'user');
|
|
12340
|
+
* // => ['barney', 'fred']
|
|
12341
|
+
*/
|
|
12342
|
+
|
|
12343
|
+
function map(collection, iteratee) {
|
|
12344
|
+
var func = isArray(collection) ? arrayMap : baseMap;
|
|
12345
|
+
return func(collection, baseIteratee(iteratee));
|
|
12346
|
+
}
|
|
12347
|
+
|
|
12348
|
+
/**
|
|
12349
|
+
* Creates an object composed of the `object` properties `predicate` returns
|
|
12350
|
+
* truthy for. The predicate is invoked with two arguments: (value, key).
|
|
12351
|
+
*
|
|
12352
|
+
* @static
|
|
12353
|
+
* @memberOf _
|
|
12354
|
+
* @since 4.0.0
|
|
12355
|
+
* @category Object
|
|
12356
|
+
* @param {Object} object The source object.
|
|
12357
|
+
* @param {Function} [predicate=_.identity] The function invoked per property.
|
|
12358
|
+
* @returns {Object} Returns the new object.
|
|
12359
|
+
* @example
|
|
12360
|
+
*
|
|
12361
|
+
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
12362
|
+
*
|
|
12363
|
+
* _.pickBy(object, _.isNumber);
|
|
12364
|
+
* // => { 'a': 1, 'c': 3 }
|
|
12365
|
+
*/
|
|
12366
|
+
|
|
12367
|
+
function pickBy(object, predicate) {
|
|
12368
|
+
if (object == null) {
|
|
12369
|
+
return {};
|
|
12370
|
+
}
|
|
12371
|
+
|
|
12372
|
+
var props = arrayMap(getAllKeysIn(object), function (prop) {
|
|
12373
|
+
return [prop];
|
|
12374
|
+
});
|
|
12375
|
+
predicate = baseIteratee(predicate);
|
|
12376
|
+
return basePickBy(object, props, function (value, path) {
|
|
12377
|
+
return predicate(value, path[0]);
|
|
12378
|
+
});
|
|
12379
|
+
}
|
|
12380
|
+
|
|
11826
12381
|
function parseQueryString(value) {
|
|
11827
12382
|
var qs = value.split('&').reduce(function (acc, param) {
|
|
11828
12383
|
var _param$split = param.split('='),
|
|
@@ -11835,6 +12390,15 @@ function parseQueryString(value) {
|
|
|
11835
12390
|
}, {});
|
|
11836
12391
|
return camelCaseProperties(qs);
|
|
11837
12392
|
}
|
|
12393
|
+
function toQueryString(obj) {
|
|
12394
|
+
var snakeCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
12395
|
+
var params = snakeCase ? snakeCaseProperties(obj) : obj;
|
|
12396
|
+
return map(pickBy(params, function (v) {
|
|
12397
|
+
return v !== null && v !== undefined;
|
|
12398
|
+
}), function (value, key) {
|
|
12399
|
+
return value !== '' ? "".concat(key, "=").concat(encodeURIComponent(value)) : key;
|
|
12400
|
+
}).join('&');
|
|
12401
|
+
}
|
|
11838
12402
|
|
|
11839
12403
|
var MainView$2 = /*#__PURE__*/function (_React$Component) {
|
|
11840
12404
|
_inherits(MainView, _React$Component);
|
|
@@ -11957,7 +12521,7 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
|
|
|
11957
12521
|
|
|
11958
12522
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11959
12523
|
|
|
11960
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
12524
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
11961
12525
|
return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function (_) {
|
|
11962
12526
|
return data;
|
|
11963
12527
|
});
|
|
@@ -11971,8 +12535,15 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
|
|
|
11971
12535
|
}
|
|
11972
12536
|
|
|
11973
12537
|
_createClass(MainView, [{
|
|
12538
|
+
key: "componentDidMount",
|
|
12539
|
+
value: function componentDidMount() {
|
|
12540
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
12541
|
+
}
|
|
12542
|
+
}, {
|
|
11974
12543
|
key: "render",
|
|
11975
12544
|
value: function render() {
|
|
12545
|
+
var _this2 = this;
|
|
12546
|
+
|
|
11976
12547
|
var _this$props = this.props,
|
|
11977
12548
|
i18n = _this$props.i18n,
|
|
11978
12549
|
showSocialLogins = _this$props.showSocialLogins,
|
|
@@ -11987,10 +12558,14 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
|
|
|
11987
12558
|
}), showSocialLogins && socialProviders && socialProviders.length > 0 && /*#__PURE__*/React__default.createElement(Separator, {
|
|
11988
12559
|
text: i18n('or')
|
|
11989
12560
|
}), isEmail && showIntro && /*#__PURE__*/React__default.createElement(Intro, null, i18n('passwordless.intro')), isEmail && /*#__PURE__*/React__default.createElement(EmailInputForm, {
|
|
11990
|
-
handler:
|
|
12561
|
+
handler: function handler(data) {
|
|
12562
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "passwordless_email");
|
|
12563
|
+
},
|
|
11991
12564
|
onSuccess: this.handleSuccess
|
|
11992
12565
|
}), !isEmail && showIntro && /*#__PURE__*/React__default.createElement(Intro, null, i18n('passwordless.sms.intro')), !isEmail && /*#__PURE__*/React__default.createElement(PhoneNumberInputForm, {
|
|
11993
|
-
handler:
|
|
12566
|
+
handler: function handler(data) {
|
|
12567
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "passwordless_phone");
|
|
12568
|
+
},
|
|
11994
12569
|
onSuccess: this.handleSuccess
|
|
11995
12570
|
}));
|
|
11996
12571
|
}
|
|
@@ -12005,7 +12580,7 @@ var VerificationCodeView$1 = /*#__PURE__*/function (_React$Component2) {
|
|
|
12005
12580
|
var _super2 = _createSuper(VerificationCodeView);
|
|
12006
12581
|
|
|
12007
12582
|
function VerificationCodeView() {
|
|
12008
|
-
var
|
|
12583
|
+
var _this3;
|
|
12009
12584
|
|
|
12010
12585
|
_classCallCheck(this, VerificationCodeView);
|
|
12011
12586
|
|
|
@@ -12013,26 +12588,30 @@ var VerificationCodeView$1 = /*#__PURE__*/function (_React$Component2) {
|
|
|
12013
12588
|
args[_key2] = arguments[_key2];
|
|
12014
12589
|
}
|
|
12015
12590
|
|
|
12016
|
-
|
|
12591
|
+
_this3 = _super2.call.apply(_super2, [this].concat(args));
|
|
12017
12592
|
|
|
12018
|
-
_defineProperty(_assertThisInitialized(
|
|
12019
|
-
var
|
|
12020
|
-
apiClient =
|
|
12021
|
-
auth =
|
|
12022
|
-
phoneNumber =
|
|
12593
|
+
_defineProperty(_assertThisInitialized(_this3), "handleSubmit", function (data) {
|
|
12594
|
+
var _this3$props = _this3.props,
|
|
12595
|
+
apiClient = _this3$props.apiClient,
|
|
12596
|
+
auth = _this3$props.auth,
|
|
12597
|
+
phoneNumber = _this3$props.phoneNumber;
|
|
12023
12598
|
return apiClient.verifyPasswordless(_objectSpread2({
|
|
12024
12599
|
phoneNumber: phoneNumber
|
|
12025
12600
|
}, data), auth);
|
|
12026
12601
|
});
|
|
12027
12602
|
|
|
12028
|
-
return
|
|
12603
|
+
return _this3;
|
|
12029
12604
|
}
|
|
12030
12605
|
|
|
12031
12606
|
_createClass(VerificationCodeView, [{
|
|
12032
12607
|
key: "render",
|
|
12033
12608
|
value: function render() {
|
|
12609
|
+
var _this4 = this;
|
|
12610
|
+
|
|
12034
12611
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Info, null, this.props.i18n('passwordless.sms.verification.intro')), /*#__PURE__*/React__default.createElement(VerificationCodeInputForm$1, {
|
|
12035
|
-
handler:
|
|
12612
|
+
handler: function handler(data) {
|
|
12613
|
+
return ReCaptcha.handle(data, _this4.props, _this4.callback, "verify_passwordless_sms");
|
|
12614
|
+
}
|
|
12036
12615
|
}));
|
|
12037
12616
|
}
|
|
12038
12617
|
}]);
|
|
@@ -12142,7 +12721,9 @@ var profileEditorWidget = createWidget({
|
|
|
12142
12721
|
throw new UserError('These fields are not allowed: password, password_confirmation.');
|
|
12143
12722
|
}
|
|
12144
12723
|
|
|
12145
|
-
var resolvedFields = buildFormFields(fields, config)
|
|
12724
|
+
var resolvedFields = buildFormFields(fields, _objectSpread2(_objectSpread2({}, config), {}, {
|
|
12725
|
+
errorArchivedConsents: false
|
|
12726
|
+
}));
|
|
12146
12727
|
return apiClient.getUser({
|
|
12147
12728
|
accessToken: accessToken,
|
|
12148
12729
|
fields: computeFieldList(resolvedFields)
|
|
@@ -15072,10 +15653,18 @@ function createClient(creationConfig) {
|
|
|
15072
15653
|
var client = coreClient.remoteSettings.then(function (remoteSettings) {
|
|
15073
15654
|
var remoteConfig = camelCaseProperties(remoteSettings);
|
|
15074
15655
|
var language = creationConfig.language || remoteConfig.language;
|
|
15075
|
-
return fetch("".concat(
|
|
15656
|
+
return fetch("https://".concat(creationConfig.domain, "/identity/v1/config/consents?").concat(toQueryString({
|
|
15657
|
+
lang: language
|
|
15658
|
+
}))).then(function (response) {
|
|
15076
15659
|
return response.json();
|
|
15077
|
-
}).then(function (
|
|
15078
|
-
return
|
|
15660
|
+
}).then(function (consentsVersions) {
|
|
15661
|
+
return fetch("".concat(remoteSettings.resourceBaseUrl, "/").concat(language, ".json")).then(function (response) {
|
|
15662
|
+
return response.json();
|
|
15663
|
+
}).then(function (defaultI18n) {
|
|
15664
|
+
return new UiClient(_objectSpread2(_objectSpread2(_objectSpread2({}, creationConfig), remoteConfig), {}, {
|
|
15665
|
+
consentsVersions: camelCaseProperties(consentsVersions)
|
|
15666
|
+
}), urlParser, coreClient, defaultI18n);
|
|
15667
|
+
})["catch"](console.error);
|
|
15079
15668
|
})["catch"](console.error);
|
|
15080
15669
|
});
|
|
15081
15670
|
return {
|