1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports["default"] = exports.MapEntries = void 0;
|
7 |
|
8 | var _awsAmplify = require("aws-amplify");
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | var MapEntries = [['User does not exist', /user.*not.*exist/i], ['User already exists', /user.*already.*exist/i], ['Incorrect username or password', /incorrect.*username.*password/i], ['Invalid password format', /validation.*password/i], ['Invalid phone number format', /invalid.*phone/i, 'Invalid phone number format. Please use a phone number format of +12345678900']];
|
23 | exports.MapEntries = MapEntries;
|
24 |
|
25 | var _default = function _default(message) {
|
26 | var match = MapEntries.filter(function (entry) {
|
27 | return entry[1].test(message);
|
28 | });
|
29 |
|
30 | if (match.length === 0) {
|
31 | return message;
|
32 | }
|
33 |
|
34 | var entry = match[0];
|
35 | var msg = entry.length > 2 ? entry[2] : entry[0];
|
36 | return _awsAmplify.I18n.get(entry[0], msg);
|
37 | };
|
38 |
|
39 | exports["default"] = _default; |
\ | No newline at end of file |