@socotra/ec-react-utils 2.2.5-alpha.2 → 2.2.5
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.d.ts +13 -5
- package/dist/index.es.js +283 -305
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,120 +1,120 @@
|
|
|
1
1
|
const q = (t) => {
|
|
2
|
-
const { data: e, scope:
|
|
3
|
-
let
|
|
4
|
-
const
|
|
5
|
-
Object.entries(e ?? {}).filter(([,
|
|
6
|
-
var
|
|
7
|
-
const r = (
|
|
8
|
-
return !!(!r ||
|
|
9
|
-
}).map(([
|
|
10
|
-
var H, z, u,
|
|
11
|
-
let
|
|
12
|
-
const
|
|
13
|
-
let
|
|
2
|
+
const { data: e, scope: a, dataTypes: f, rootDisplayName: b, account: d, quote: g, element: p } = t, M = [];
|
|
3
|
+
let P = {};
|
|
4
|
+
const C = Object.fromEntries(
|
|
5
|
+
Object.entries(e ?? {}).filter(([, h]) => {
|
|
6
|
+
var O;
|
|
7
|
+
const r = (O = h.scope) == null ? void 0 : O.split(",").map((Y) => Y.trim());
|
|
8
|
+
return !!(!r || a === "P" && (r != null && r.includes("P")) || r != null && r.includes("Q") || a === "Q" && (r != null && r.includes("Q")));
|
|
9
|
+
}).map(([h, r]) => {
|
|
10
|
+
var H, z, u, i, n, c, s, o, l, y, D, x, T, S, N, I, A;
|
|
11
|
+
let O = !1, Y = !1, W = !1;
|
|
12
|
+
const R = r.displayName ?? h, Z = (H = r.type) == null ? void 0 : H.slice(-1), V = r.maxLength, B = r.minLength, _ = r.max, j = r.min, F = r.regex;
|
|
13
|
+
let m = r.type ?? "", L;
|
|
14
14
|
switch (Z) {
|
|
15
15
|
case "*":
|
|
16
|
-
Y = !0,
|
|
16
|
+
Y = !0, O = !0, m = m == null ? void 0 : m.split("*")[0];
|
|
17
17
|
break;
|
|
18
18
|
case "?":
|
|
19
|
-
|
|
19
|
+
m = m == null ? void 0 : m.split("?")[0], O = !0;
|
|
20
20
|
break;
|
|
21
21
|
case "+":
|
|
22
|
-
Y = !0,
|
|
22
|
+
Y = !0, m = m == null ? void 0 : m.split("+")[0];
|
|
23
23
|
break;
|
|
24
24
|
case "!":
|
|
25
|
-
|
|
25
|
+
m = m == null ? void 0 : m.split("!")[0];
|
|
26
26
|
break;
|
|
27
27
|
}
|
|
28
|
-
switch (
|
|
28
|
+
switch (m) {
|
|
29
29
|
case "string":
|
|
30
|
-
|
|
30
|
+
m = "string";
|
|
31
31
|
break;
|
|
32
32
|
case "int":
|
|
33
33
|
case "long":
|
|
34
|
-
|
|
34
|
+
m = "integer";
|
|
35
35
|
break;
|
|
36
36
|
case "decimal":
|
|
37
|
-
|
|
37
|
+
m = "number";
|
|
38
38
|
break;
|
|
39
39
|
case "dateTime":
|
|
40
40
|
case "datetime":
|
|
41
|
-
|
|
41
|
+
m = "string", L = "date-time";
|
|
42
42
|
break;
|
|
43
43
|
case "date":
|
|
44
|
-
|
|
44
|
+
m = "string", L = "date";
|
|
45
45
|
break;
|
|
46
46
|
case "boolean":
|
|
47
47
|
case "bool":
|
|
48
|
-
|
|
48
|
+
m = "boolean";
|
|
49
49
|
break;
|
|
50
50
|
default:
|
|
51
51
|
W = !0;
|
|
52
52
|
break;
|
|
53
53
|
}
|
|
54
|
-
if (!
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
54
|
+
if (!O && !W && !Y && M.push(h), W) {
|
|
55
|
+
const k = f == null ? void 0 : f[m];
|
|
56
|
+
if (k) {
|
|
57
57
|
let w = Y ? [] : {};
|
|
58
|
-
const
|
|
59
|
-
data:
|
|
60
|
-
scope:
|
|
58
|
+
const Q = q({
|
|
59
|
+
data: k.data ?? {},
|
|
60
|
+
scope: a,
|
|
61
61
|
dataTypes: f,
|
|
62
|
-
rootDisplayName:
|
|
62
|
+
rootDisplayName: k.displayName ?? h
|
|
63
63
|
});
|
|
64
|
-
return
|
|
65
|
-
...
|
|
66
|
-
[`${
|
|
64
|
+
return g && (u = (z = g.element) == null ? void 0 : z.data) != null && u[h] && (w = (n = (i = g.element) == null ? void 0 : i.data) == null ? void 0 : n[h]), p && (c = p == null ? void 0 : p.data) != null && c[h] && (w = (s = p == null ? void 0 : p.data) == null ? void 0 : s[h]), d && (o = d == null ? void 0 : d.data) != null && o[h] && (w = (l = d == null ? void 0 : d.data) == null ? void 0 : l[h]), P = {
|
|
65
|
+
...P,
|
|
66
|
+
[`${m}`]: Q
|
|
67
67
|
}, Y ? [
|
|
68
|
-
|
|
68
|
+
h,
|
|
69
69
|
{
|
|
70
|
-
title:
|
|
70
|
+
title: k.displayName ?? h,
|
|
71
71
|
type: "array",
|
|
72
72
|
default: w,
|
|
73
73
|
items: {
|
|
74
|
-
$ref: `#/definitions/${
|
|
74
|
+
$ref: `#/definitions/${m}`
|
|
75
75
|
},
|
|
76
|
-
...!
|
|
76
|
+
...!O && { minItems: 1 }
|
|
77
77
|
}
|
|
78
78
|
] : [
|
|
79
|
-
|
|
79
|
+
h,
|
|
80
80
|
{
|
|
81
|
-
title:
|
|
81
|
+
title: k.displayName ?? h,
|
|
82
82
|
default: w,
|
|
83
|
-
$ref: `#/definitions/${
|
|
83
|
+
$ref: `#/definitions/${m}`
|
|
84
84
|
}
|
|
85
85
|
];
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
let
|
|
88
|
+
let v = "";
|
|
89
89
|
if (d) {
|
|
90
|
-
const
|
|
91
|
-
|
|
90
|
+
const k = (d == null ? void 0 : d.state) === "validated" ? h.charAt(0).toLowerCase() + h.slice(1) : h;
|
|
91
|
+
v = (y = d == null ? void 0 : d.data) != null && y[k] ? (D = d == null ? void 0 : d.data) == null ? void 0 : D[k] : m === "boolean" ? !!r.defaultValue : r.defaultValue;
|
|
92
92
|
}
|
|
93
|
-
return
|
|
94
|
-
|
|
93
|
+
return g && (v = (T = (x = g.element) == null ? void 0 : x.data) != null && T[h] ? (N = (S = g.element) == null ? void 0 : S.data) == null ? void 0 : N[h] : m === "boolean" ? !!r.defaultValue : r.defaultValue), p && (v = (I = p == null ? void 0 : p.data) != null && I[h] ? (A = p == null ? void 0 : p.data) == null ? void 0 : A[h] : m === "boolean" ? !!r.defaultValue : r.defaultValue), Y ? [
|
|
94
|
+
h,
|
|
95
95
|
{
|
|
96
|
-
title:
|
|
96
|
+
title: R,
|
|
97
97
|
type: "array",
|
|
98
|
-
default:
|
|
98
|
+
default: v,
|
|
99
99
|
items: {
|
|
100
|
-
type:
|
|
101
|
-
...
|
|
100
|
+
type: m,
|
|
101
|
+
...V && { maxLength: V },
|
|
102
102
|
...B && { minLength: B },
|
|
103
103
|
...j && { min: j },
|
|
104
104
|
..._ && { max: _ },
|
|
105
105
|
...L && { format: L },
|
|
106
106
|
...F && { pattern: r.regex }
|
|
107
107
|
},
|
|
108
|
-
...!
|
|
108
|
+
...!O && { minItems: 1 }
|
|
109
109
|
}
|
|
110
110
|
] : [
|
|
111
|
-
|
|
111
|
+
h,
|
|
112
112
|
{
|
|
113
|
-
title:
|
|
114
|
-
type:
|
|
115
|
-
...
|
|
113
|
+
title: R,
|
|
114
|
+
type: m,
|
|
115
|
+
...v && { default: v },
|
|
116
116
|
...B && { minLength: B },
|
|
117
|
-
...
|
|
117
|
+
...V && { maxLength: V },
|
|
118
118
|
...j && { minimum: parseInt(j) },
|
|
119
119
|
..._ && { maximum: parseInt(_) },
|
|
120
120
|
...L && { format: L },
|
|
@@ -125,24 +125,13 @@ const q = (t) => {
|
|
|
125
125
|
})
|
|
126
126
|
);
|
|
127
127
|
return {
|
|
128
|
-
title:
|
|
128
|
+
title: b,
|
|
129
129
|
type: "object",
|
|
130
|
-
definitions:
|
|
130
|
+
definitions: P,
|
|
131
131
|
required: M,
|
|
132
|
-
properties:
|
|
132
|
+
properties: C
|
|
133
133
|
};
|
|
134
|
-
}, oe = (
|
|
135
|
-
const e = t.autoValidate, i = t.delinquencyPlanName, f = t.accountType, v = Object.keys(t).reduce(
|
|
136
|
-
($, m) => (m !== "accountType" && m !== "autoValidate" && m !== "delinquencyPlanName" && ($[m] = t[m]), $),
|
|
137
|
-
{}
|
|
138
|
-
);
|
|
139
|
-
return {
|
|
140
|
-
autoValidate: e,
|
|
141
|
-
delinquencyPlanName: i,
|
|
142
|
-
type: f,
|
|
143
|
-
data: v
|
|
144
|
-
};
|
|
145
|
-
}, le = ({
|
|
134
|
+
}, oe = ({
|
|
146
135
|
formData: t,
|
|
147
136
|
locator: e
|
|
148
137
|
}) => ({
|
|
@@ -157,335 +146,321 @@ function te(t) {
|
|
|
157
146
|
}
|
|
158
147
|
var K = { exports: {} };
|
|
159
148
|
(function(t, e) {
|
|
160
|
-
(function(
|
|
149
|
+
(function(a, f) {
|
|
161
150
|
t.exports = f();
|
|
162
151
|
})(ee, function() {
|
|
163
|
-
var
|
|
164
|
-
var
|
|
165
|
-
return "[" + u + (
|
|
166
|
-
} },
|
|
152
|
+
var a = 1e3, f = 6e4, b = 36e5, d = "millisecond", g = "second", p = "minute", M = "hour", P = "day", C = "week", E = "month", h = "quarter", r = "year", O = "date", Y = "Invalid Date", W = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, R = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, Z = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(u) {
|
|
153
|
+
var i = ["th", "st", "nd", "rd"], n = u % 100;
|
|
154
|
+
return "[" + u + (i[(n - 20) % 10] || i[n] || i[0]) + "]";
|
|
155
|
+
} }, V = function(u, i, n) {
|
|
167
156
|
var c = String(u);
|
|
168
|
-
return !c || c.length >=
|
|
169
|
-
}, B = { s:
|
|
170
|
-
var
|
|
171
|
-
return (
|
|
172
|
-
}, m: function u(
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
var c = 12 * (n.year() - a.year()) + (n.month() - a.month()), s = a.clone().add(c, E), o = n - s < 0, l = a.clone().add(c + (o ? -1 : 1), E);
|
|
157
|
+
return !c || c.length >= i ? u : "" + Array(i + 1 - c.length).join(n) + u;
|
|
158
|
+
}, B = { s: V, z: function(u) {
|
|
159
|
+
var i = -u.utcOffset(), n = Math.abs(i), c = Math.floor(n / 60), s = n % 60;
|
|
160
|
+
return (i <= 0 ? "+" : "-") + V(c, 2, "0") + ":" + V(s, 2, "0");
|
|
161
|
+
}, m: function u(i, n) {
|
|
162
|
+
if (i.date() < n.date()) return -u(n, i);
|
|
163
|
+
var c = 12 * (n.year() - i.year()) + (n.month() - i.month()), s = i.clone().add(c, E), o = n - s < 0, l = i.clone().add(c + (o ? -1 : 1), E);
|
|
176
164
|
return +(-(c + (n - s) / (o ? s - l : l - s)) || 0);
|
|
177
165
|
}, a: function(u) {
|
|
178
166
|
return u < 0 ? Math.ceil(u) || 0 : Math.floor(u);
|
|
179
167
|
}, p: function(u) {
|
|
180
|
-
return { M: E, y: r, w:
|
|
168
|
+
return { M: E, y: r, w: C, d: P, D: O, h: M, m: p, s: g, ms: d, Q: h }[u] || String(u || "").toLowerCase().replace(/s$/, "");
|
|
181
169
|
}, u: function(u) {
|
|
182
170
|
return u === void 0;
|
|
183
171
|
} }, _ = "en", j = {};
|
|
184
172
|
j[_] = Z;
|
|
185
|
-
var F = "$isDayjsObject",
|
|
173
|
+
var F = "$isDayjsObject", m = function(u) {
|
|
186
174
|
return u instanceof H || !(!u || !u[F]);
|
|
187
|
-
}, L = function u(
|
|
175
|
+
}, L = function u(i, n, c) {
|
|
188
176
|
var s;
|
|
189
|
-
if (!
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
var o = a.toLowerCase();
|
|
177
|
+
if (!i) return _;
|
|
178
|
+
if (typeof i == "string") {
|
|
179
|
+
var o = i.toLowerCase();
|
|
193
180
|
j[o] && (s = o), n && (j[o] = n, s = o);
|
|
194
|
-
var l =
|
|
195
|
-
if (!s && l.length > 1)
|
|
196
|
-
return u(l[0]);
|
|
181
|
+
var l = i.split("-");
|
|
182
|
+
if (!s && l.length > 1) return u(l[0]);
|
|
197
183
|
} else {
|
|
198
|
-
var
|
|
199
|
-
j[
|
|
184
|
+
var y = i.name;
|
|
185
|
+
j[y] = i, s = y;
|
|
200
186
|
}
|
|
201
187
|
return !c && s && (_ = s), s || !c && _;
|
|
202
|
-
},
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
var n = typeof a == "object" ? a : {};
|
|
188
|
+
}, v = function(u, i) {
|
|
189
|
+
if (m(u)) return u.clone();
|
|
190
|
+
var n = typeof i == "object" ? i : {};
|
|
206
191
|
return n.date = u, n.args = arguments, new H(n);
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
return
|
|
192
|
+
}, $ = B;
|
|
193
|
+
$.l = L, $.i = m, $.w = function(u, i) {
|
|
194
|
+
return v(u, { locale: i.$L, utc: i.$u, x: i.$x, $offset: i.$offset });
|
|
210
195
|
};
|
|
211
196
|
var H = function() {
|
|
212
197
|
function u(n) {
|
|
213
198
|
this.$L = L(n.locale, null, !0), this.parse(n), this.$x = this.$x || n.x || {}, this[F] = !0;
|
|
214
199
|
}
|
|
215
|
-
var
|
|
216
|
-
return
|
|
200
|
+
var i = u.prototype;
|
|
201
|
+
return i.parse = function(n) {
|
|
217
202
|
this.$d = function(c) {
|
|
218
203
|
var s = c.date, o = c.utc;
|
|
219
|
-
if (s === null)
|
|
220
|
-
|
|
221
|
-
if (
|
|
222
|
-
return /* @__PURE__ */ new Date();
|
|
223
|
-
if (s instanceof Date)
|
|
224
|
-
return new Date(s);
|
|
204
|
+
if (s === null) return /* @__PURE__ */ new Date(NaN);
|
|
205
|
+
if ($.u(s)) return /* @__PURE__ */ new Date();
|
|
206
|
+
if (s instanceof Date) return new Date(s);
|
|
225
207
|
if (typeof s == "string" && !/Z$/i.test(s)) {
|
|
226
208
|
var l = s.match(W);
|
|
227
209
|
if (l) {
|
|
228
|
-
var
|
|
229
|
-
return o ? new Date(Date.UTC(l[1],
|
|
210
|
+
var y = l[2] - 1 || 0, D = (l[7] || "0").substring(0, 3);
|
|
211
|
+
return o ? new Date(Date.UTC(l[1], y, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, D)) : new Date(l[1], y, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, D);
|
|
230
212
|
}
|
|
231
213
|
}
|
|
232
214
|
return new Date(s);
|
|
233
215
|
}(n), this.init();
|
|
234
|
-
},
|
|
216
|
+
}, i.init = function() {
|
|
235
217
|
var n = this.$d;
|
|
236
218
|
this.$y = n.getFullYear(), this.$M = n.getMonth(), this.$D = n.getDate(), this.$W = n.getDay(), this.$H = n.getHours(), this.$m = n.getMinutes(), this.$s = n.getSeconds(), this.$ms = n.getMilliseconds();
|
|
237
|
-
},
|
|
238
|
-
return
|
|
239
|
-
},
|
|
219
|
+
}, i.$utils = function() {
|
|
220
|
+
return $;
|
|
221
|
+
}, i.isValid = function() {
|
|
240
222
|
return this.$d.toString() !== Y;
|
|
241
|
-
},
|
|
242
|
-
var s =
|
|
223
|
+
}, i.isSame = function(n, c) {
|
|
224
|
+
var s = v(n);
|
|
243
225
|
return this.startOf(c) <= s && s <= this.endOf(c);
|
|
244
|
-
},
|
|
245
|
-
return
|
|
246
|
-
},
|
|
247
|
-
return this.endOf(c) <
|
|
248
|
-
},
|
|
249
|
-
return
|
|
250
|
-
},
|
|
226
|
+
}, i.isAfter = function(n, c) {
|
|
227
|
+
return v(n) < this.startOf(c);
|
|
228
|
+
}, i.isBefore = function(n, c) {
|
|
229
|
+
return this.endOf(c) < v(n);
|
|
230
|
+
}, i.$g = function(n, c, s) {
|
|
231
|
+
return $.u(n) ? this[c] : this.set(s, n);
|
|
232
|
+
}, i.unix = function() {
|
|
251
233
|
return Math.floor(this.valueOf() / 1e3);
|
|
252
|
-
},
|
|
234
|
+
}, i.valueOf = function() {
|
|
253
235
|
return this.$d.getTime();
|
|
254
|
-
},
|
|
255
|
-
var s = this, o =
|
|
256
|
-
var
|
|
257
|
-
return o ?
|
|
258
|
-
}, D = function(
|
|
259
|
-
return
|
|
260
|
-
}, x = this.$W,
|
|
236
|
+
}, i.startOf = function(n, c) {
|
|
237
|
+
var s = this, o = !!$.u(c) || c, l = $.p(n), y = function(k, w) {
|
|
238
|
+
var Q = $.w(s.$u ? Date.UTC(s.$y, w, k) : new Date(s.$y, w, k), s);
|
|
239
|
+
return o ? Q : Q.endOf(P);
|
|
240
|
+
}, D = function(k, w) {
|
|
241
|
+
return $.w(s.toDate()[k].apply(s.toDate("s"), (o ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(w)), s);
|
|
242
|
+
}, x = this.$W, T = this.$M, S = this.$D, N = "set" + (this.$u ? "UTC" : "");
|
|
261
243
|
switch (l) {
|
|
262
244
|
case r:
|
|
263
|
-
return o ?
|
|
245
|
+
return o ? y(1, 0) : y(31, 11);
|
|
264
246
|
case E:
|
|
265
|
-
return o ?
|
|
266
|
-
case
|
|
267
|
-
var
|
|
268
|
-
return
|
|
269
|
-
case
|
|
270
|
-
case
|
|
271
|
-
return D(
|
|
247
|
+
return o ? y(1, T) : y(0, T + 1);
|
|
248
|
+
case C:
|
|
249
|
+
var I = this.$locale().weekStart || 0, A = (x < I ? x + 7 : x) - I;
|
|
250
|
+
return y(o ? S - A : S + (6 - A), T);
|
|
251
|
+
case P:
|
|
252
|
+
case O:
|
|
253
|
+
return D(N + "Hours", 0);
|
|
272
254
|
case M:
|
|
273
|
-
return D(
|
|
274
|
-
case
|
|
275
|
-
return D(
|
|
276
|
-
case
|
|
277
|
-
return D(
|
|
255
|
+
return D(N + "Minutes", 1);
|
|
256
|
+
case p:
|
|
257
|
+
return D(N + "Seconds", 2);
|
|
258
|
+
case g:
|
|
259
|
+
return D(N + "Milliseconds", 3);
|
|
278
260
|
default:
|
|
279
261
|
return this.clone();
|
|
280
262
|
}
|
|
281
|
-
},
|
|
263
|
+
}, i.endOf = function(n) {
|
|
282
264
|
return this.startOf(n, !1);
|
|
283
|
-
},
|
|
284
|
-
var s, o =
|
|
265
|
+
}, i.$set = function(n, c) {
|
|
266
|
+
var s, o = $.p(n), l = "set" + (this.$u ? "UTC" : ""), y = (s = {}, s[P] = l + "Date", s[O] = l + "Date", s[E] = l + "Month", s[r] = l + "FullYear", s[M] = l + "Hours", s[p] = l + "Minutes", s[g] = l + "Seconds", s[d] = l + "Milliseconds", s)[o], D = o === P ? this.$D + (c - this.$W) : c;
|
|
285
267
|
if (o === E || o === r) {
|
|
286
|
-
var x = this.clone().set(
|
|
287
|
-
x.$d[
|
|
288
|
-
} else
|
|
289
|
-
g && this.$d[g](D);
|
|
268
|
+
var x = this.clone().set(O, 1);
|
|
269
|
+
x.$d[y](D), x.init(), this.$d = x.set(O, Math.min(this.$D, x.daysInMonth())).$d;
|
|
270
|
+
} else y && this.$d[y](D);
|
|
290
271
|
return this.init(), this;
|
|
291
|
-
},
|
|
272
|
+
}, i.set = function(n, c) {
|
|
292
273
|
return this.clone().$set(n, c);
|
|
293
|
-
},
|
|
294
|
-
return this[
|
|
295
|
-
},
|
|
274
|
+
}, i.get = function(n) {
|
|
275
|
+
return this[$.p(n)]();
|
|
276
|
+
}, i.add = function(n, c) {
|
|
296
277
|
var s, o = this;
|
|
297
278
|
n = Number(n);
|
|
298
|
-
var l =
|
|
299
|
-
var S =
|
|
300
|
-
return
|
|
279
|
+
var l = $.p(c), y = function(T) {
|
|
280
|
+
var S = v(o);
|
|
281
|
+
return $.w(S.date(S.date() + Math.round(T * n)), o);
|
|
301
282
|
};
|
|
302
|
-
if (l === E)
|
|
303
|
-
|
|
304
|
-
if (l ===
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
return g(7);
|
|
310
|
-
var D = (s = {}, s[m] = f, s[M] = v, s[$] = i, s)[l] || 1, x = this.$d.getTime() + n * D;
|
|
311
|
-
return y.w(x, this);
|
|
312
|
-
}, a.subtract = function(n, c) {
|
|
283
|
+
if (l === E) return this.set(E, this.$M + n);
|
|
284
|
+
if (l === r) return this.set(r, this.$y + n);
|
|
285
|
+
if (l === P) return y(1);
|
|
286
|
+
if (l === C) return y(7);
|
|
287
|
+
var D = (s = {}, s[p] = f, s[M] = b, s[g] = a, s)[l] || 1, x = this.$d.getTime() + n * D;
|
|
288
|
+
return $.w(x, this);
|
|
289
|
+
}, i.subtract = function(n, c) {
|
|
313
290
|
return this.add(-1 * n, c);
|
|
314
|
-
},
|
|
291
|
+
}, i.format = function(n) {
|
|
315
292
|
var c = this, s = this.$locale();
|
|
316
|
-
if (!this.isValid())
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}, P = Q || function(w, I, R) {
|
|
293
|
+
if (!this.isValid()) return s.invalidDate || Y;
|
|
294
|
+
var o = n || "YYYY-MM-DDTHH:mm:ssZ", l = $.z(this), y = this.$H, D = this.$m, x = this.$M, T = s.weekdays, S = s.months, N = s.meridiem, I = function(w, Q, J, U) {
|
|
295
|
+
return w && (w[Q] || w(c, o)) || J[Q].slice(0, U);
|
|
296
|
+
}, A = function(w) {
|
|
297
|
+
return $.s(y % 12 || 12, w, "0");
|
|
298
|
+
}, k = N || function(w, Q, J) {
|
|
323
299
|
var U = w < 12 ? "AM" : "PM";
|
|
324
|
-
return
|
|
300
|
+
return J ? U.toLowerCase() : U;
|
|
325
301
|
};
|
|
326
|
-
return o.replace(
|
|
327
|
-
return
|
|
328
|
-
switch (
|
|
302
|
+
return o.replace(R, function(w, Q) {
|
|
303
|
+
return Q || function(J) {
|
|
304
|
+
switch (J) {
|
|
329
305
|
case "YY":
|
|
330
306
|
return String(c.$y).slice(-2);
|
|
331
307
|
case "YYYY":
|
|
332
|
-
return
|
|
308
|
+
return $.s(c.$y, 4, "0");
|
|
333
309
|
case "M":
|
|
334
310
|
return x + 1;
|
|
335
311
|
case "MM":
|
|
336
|
-
return
|
|
312
|
+
return $.s(x + 1, 2, "0");
|
|
337
313
|
case "MMM":
|
|
338
|
-
return
|
|
314
|
+
return I(s.monthsShort, x, S, 3);
|
|
339
315
|
case "MMMM":
|
|
340
|
-
return
|
|
316
|
+
return I(S, x);
|
|
341
317
|
case "D":
|
|
342
318
|
return c.$D;
|
|
343
319
|
case "DD":
|
|
344
|
-
return
|
|
320
|
+
return $.s(c.$D, 2, "0");
|
|
345
321
|
case "d":
|
|
346
322
|
return String(c.$W);
|
|
347
323
|
case "dd":
|
|
348
|
-
return
|
|
324
|
+
return I(s.weekdaysMin, c.$W, T, 2);
|
|
349
325
|
case "ddd":
|
|
350
|
-
return
|
|
326
|
+
return I(s.weekdaysShort, c.$W, T, 3);
|
|
351
327
|
case "dddd":
|
|
352
|
-
return
|
|
328
|
+
return T[c.$W];
|
|
353
329
|
case "H":
|
|
354
|
-
return String(
|
|
330
|
+
return String(y);
|
|
355
331
|
case "HH":
|
|
356
|
-
return
|
|
332
|
+
return $.s(y, 2, "0");
|
|
357
333
|
case "h":
|
|
358
|
-
return
|
|
334
|
+
return A(1);
|
|
359
335
|
case "hh":
|
|
360
|
-
return
|
|
336
|
+
return A(2);
|
|
361
337
|
case "a":
|
|
362
|
-
return
|
|
338
|
+
return k(y, D, !0);
|
|
363
339
|
case "A":
|
|
364
|
-
return
|
|
340
|
+
return k(y, D, !1);
|
|
365
341
|
case "m":
|
|
366
342
|
return String(D);
|
|
367
343
|
case "mm":
|
|
368
|
-
return
|
|
344
|
+
return $.s(D, 2, "0");
|
|
369
345
|
case "s":
|
|
370
346
|
return String(c.$s);
|
|
371
347
|
case "ss":
|
|
372
|
-
return
|
|
348
|
+
return $.s(c.$s, 2, "0");
|
|
373
349
|
case "SSS":
|
|
374
|
-
return
|
|
350
|
+
return $.s(c.$ms, 3, "0");
|
|
375
351
|
case "Z":
|
|
376
352
|
return l;
|
|
377
353
|
}
|
|
378
354
|
return null;
|
|
379
355
|
}(w) || l.replace(":", "");
|
|
380
356
|
});
|
|
381
|
-
},
|
|
357
|
+
}, i.utcOffset = function() {
|
|
382
358
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
383
|
-
},
|
|
384
|
-
var o, l = this,
|
|
385
|
-
return
|
|
359
|
+
}, i.diff = function(n, c, s) {
|
|
360
|
+
var o, l = this, y = $.p(c), D = v(n), x = (D.utcOffset() - this.utcOffset()) * f, T = this - D, S = function() {
|
|
361
|
+
return $.m(l, D);
|
|
386
362
|
};
|
|
387
|
-
switch (
|
|
363
|
+
switch (y) {
|
|
388
364
|
case r:
|
|
389
365
|
o = S() / 12;
|
|
390
366
|
break;
|
|
391
367
|
case E:
|
|
392
368
|
o = S();
|
|
393
369
|
break;
|
|
394
|
-
case
|
|
370
|
+
case h:
|
|
395
371
|
o = S() / 3;
|
|
396
372
|
break;
|
|
397
|
-
case
|
|
398
|
-
o = (
|
|
373
|
+
case C:
|
|
374
|
+
o = (T - x) / 6048e5;
|
|
399
375
|
break;
|
|
400
|
-
case
|
|
401
|
-
o = (
|
|
376
|
+
case P:
|
|
377
|
+
o = (T - x) / 864e5;
|
|
402
378
|
break;
|
|
403
379
|
case M:
|
|
404
|
-
o =
|
|
380
|
+
o = T / b;
|
|
405
381
|
break;
|
|
406
|
-
case
|
|
407
|
-
o =
|
|
382
|
+
case p:
|
|
383
|
+
o = T / f;
|
|
408
384
|
break;
|
|
409
|
-
case
|
|
410
|
-
o =
|
|
385
|
+
case g:
|
|
386
|
+
o = T / a;
|
|
411
387
|
break;
|
|
412
388
|
default:
|
|
413
|
-
o =
|
|
389
|
+
o = T;
|
|
414
390
|
}
|
|
415
|
-
return s ? o :
|
|
416
|
-
},
|
|
391
|
+
return s ? o : $.a(o);
|
|
392
|
+
}, i.daysInMonth = function() {
|
|
417
393
|
return this.endOf(E).$D;
|
|
418
|
-
},
|
|
394
|
+
}, i.$locale = function() {
|
|
419
395
|
return j[this.$L];
|
|
420
|
-
},
|
|
421
|
-
if (!n)
|
|
422
|
-
return this.$L;
|
|
396
|
+
}, i.locale = function(n, c) {
|
|
397
|
+
if (!n) return this.$L;
|
|
423
398
|
var s = this.clone(), o = L(n, c, !0);
|
|
424
399
|
return o && (s.$L = o), s;
|
|
425
|
-
},
|
|
426
|
-
return
|
|
427
|
-
},
|
|
400
|
+
}, i.clone = function() {
|
|
401
|
+
return $.w(this.$d, this);
|
|
402
|
+
}, i.toDate = function() {
|
|
428
403
|
return new Date(this.valueOf());
|
|
429
|
-
},
|
|
404
|
+
}, i.toJSON = function() {
|
|
430
405
|
return this.isValid() ? this.toISOString() : null;
|
|
431
|
-
},
|
|
406
|
+
}, i.toISOString = function() {
|
|
432
407
|
return this.$d.toISOString();
|
|
433
|
-
},
|
|
408
|
+
}, i.toString = function() {
|
|
434
409
|
return this.$d.toUTCString();
|
|
435
410
|
}, u;
|
|
436
411
|
}(), z = H.prototype;
|
|
437
|
-
return
|
|
438
|
-
z[u[1]] = function(
|
|
439
|
-
return this.$g(
|
|
412
|
+
return v.prototype = z, [["$ms", d], ["$s", g], ["$m", p], ["$H", M], ["$W", P], ["$M", E], ["$y", r], ["$D", O]].forEach(function(u) {
|
|
413
|
+
z[u[1]] = function(i) {
|
|
414
|
+
return this.$g(i, u[0], u[1]);
|
|
440
415
|
};
|
|
441
|
-
}),
|
|
442
|
-
return u.$i || (u(
|
|
443
|
-
},
|
|
444
|
-
return
|
|
445
|
-
},
|
|
416
|
+
}), v.extend = function(u, i) {
|
|
417
|
+
return u.$i || (u(i, H, v), u.$i = !0), v;
|
|
418
|
+
}, v.locale = L, v.isDayjs = m, v.unix = function(u) {
|
|
419
|
+
return v(1e3 * u);
|
|
420
|
+
}, v.en = j[_], v.Ls = j, v.p = {}, v;
|
|
446
421
|
});
|
|
447
422
|
})(K);
|
|
448
423
|
var ne = K.exports;
|
|
449
|
-
const G = /* @__PURE__ */ te(ne),
|
|
450
|
-
const e = {},
|
|
451
|
-
return
|
|
424
|
+
const G = /* @__PURE__ */ te(ne), le = ({ data: t }) => {
|
|
425
|
+
const e = {}, a = { ...t };
|
|
426
|
+
return a.default && (a.default.startTime && (e.startTime = G(a.default.startTime).format()), a.default.endTime && (e.endTime = G(a.default.endTime).format()), a.default.expirationTime && (e.expirationTime = G(a.default.expirationTime).format())), a.advanced && (a.advanced.currency && (e.currency = a.advanced.currency), a.advanced.timezone && (e.timezone = a.advanced.timezone), a.advanced.billingPlan && (e.billingPlan = a.advanced.billingPlan), a.advanced.defaultTermDuration && (e.defaultTermDuration = a.advanced.defaultTermDuration), a.advanced.installmentPlan && (e.installmentPlan = a.advanced.installmentPlan), a.advanced.durationBasis && (e.durationBasis = a.advanced.durationBasis), a.advanced.delinquencyPlanName && (e.delinquencyPlanName = a.advanced.delinquencyPlanName)), delete a.default, delete a.advanced, e.setData = a, e;
|
|
452
427
|
}, se = (t) => {
|
|
453
|
-
const e = /^(.*?)(Quote|QuickQuote|Policy)$/,
|
|
454
|
-
return
|
|
428
|
+
const e = /^(.*?)(Quote|QuickQuote|Policy)$/, a = t.match(e);
|
|
429
|
+
return a && (a[2] === "Quote" || a[2] === "QuickQuote" || a[2] === "Policy") ? [a[1], a[2]] : [t, null];
|
|
455
430
|
};
|
|
456
431
|
function ie(t, e) {
|
|
457
432
|
if (t.locator === e)
|
|
458
433
|
return t;
|
|
459
434
|
if (t.elements)
|
|
460
|
-
for (const
|
|
461
|
-
const f = ie(
|
|
435
|
+
for (const a of t.elements) {
|
|
436
|
+
const f = ie(a, e);
|
|
462
437
|
if (f)
|
|
463
438
|
return f;
|
|
464
439
|
}
|
|
465
440
|
}
|
|
466
|
-
function
|
|
467
|
-
const [
|
|
441
|
+
function fe(t, e) {
|
|
442
|
+
const [a] = se(
|
|
468
443
|
t.type ?? ""
|
|
469
444
|
);
|
|
470
445
|
let f = {};
|
|
471
|
-
return e.exposures && Object.keys(e.exposures).forEach((
|
|
472
|
-
|
|
473
|
-
}), e.coverages && Object.keys(e.coverages).forEach((
|
|
474
|
-
|
|
475
|
-
}), e.policyLines && Object.keys(e.policyLines).forEach((
|
|
476
|
-
|
|
477
|
-
}), e.exposureGroups && Object.keys(e.exposureGroups).forEach((
|
|
478
|
-
|
|
446
|
+
return e.exposures && Object.keys(e.exposures).forEach((b) => {
|
|
447
|
+
b === a && e.exposures && (f = e.exposures[b]);
|
|
448
|
+
}), e.coverages && Object.keys(e.coverages).forEach((b) => {
|
|
449
|
+
b === a && e.coverages && (f = e.coverages[b]);
|
|
450
|
+
}), e.policyLines && Object.keys(e.policyLines).forEach((b) => {
|
|
451
|
+
b === a && e.policyLines && (f = e.policyLines[b]);
|
|
452
|
+
}), e.exposureGroups && Object.keys(e.exposureGroups).forEach((b) => {
|
|
453
|
+
b === a && e.exposureGroups && (f = e.exposureGroups[b]);
|
|
479
454
|
}), f;
|
|
480
455
|
}
|
|
481
|
-
function
|
|
456
|
+
function de(t) {
|
|
482
457
|
return t == null ? void 0 : t.map((e) => (e.keyword === "pattern" && (e.message = `Invalid format, must match pattern ${e.params.pattern}`), e.keyword === "format" && (e.message = "Invalid format"), e.keyword === "required" && (e.message = "Required"), e.keyword === "minItems" && (e.message = `Must have at least ${e.params.limit} item${e.params.limit !== 1 ? "s" : ""}`), e.keyword === "maxItems" && (e.message = `Must have at most ${e.params.limit} item${e.params.limit !== 1 ? "s" : ""}`), e.keyword === "type" && (e.message = "Invalid format"), e.keyword === "maxLength" && (e.message = `Must be at most ${e.params.limit} character${e.params.limit !== 1 ? "s" : ""}`), e.keyword === "minLength" && (e.message = `Must be at least ${e.params.limit} character${e.params.limit !== 1 ? "s" : ""}`), e.keyword === "minimum" && (e.message = `Must be greater than or equal to ${e.params.limit}`), e.keyword === "maximum" && (e.message = `Must be less than or equal to ${e.params.limit}`), e.keyword === "enum" && (e.message = "Invalid value"), e));
|
|
483
458
|
}
|
|
484
|
-
const
|
|
485
|
-
var e,
|
|
459
|
+
const me = (t) => {
|
|
460
|
+
var e, a, f, b, d, g;
|
|
486
461
|
return {
|
|
487
462
|
...((e = t == null ? void 0 : t.element) == null ? void 0 : e.data) && {
|
|
488
|
-
...(
|
|
463
|
+
...(a = t == null ? void 0 : t.element) == null ? void 0 : a.data
|
|
489
464
|
},
|
|
490
465
|
default: {
|
|
491
466
|
// set date to yyyy-MM-dd format if it exists
|
|
@@ -502,18 +477,21 @@ const he = (t) => {
|
|
|
502
477
|
advanced: {
|
|
503
478
|
currency: (t == null ? void 0 : t.currency) ?? void 0,
|
|
504
479
|
timezone: (t == null ? void 0 : t.timezone) ?? void 0,
|
|
505
|
-
billingPlan: ((
|
|
506
|
-
installmentPlan: ((
|
|
480
|
+
billingPlan: ((b = (f = t == null ? void 0 : t.preferences) == null ? void 0 : f.billingPreferences) == null ? void 0 : b.billingPlanName) ?? void 0,
|
|
481
|
+
installmentPlan: ((g = (d = t == null ? void 0 : t.preferences) == null ? void 0 : d.installmentPreferences) == null ? void 0 : g.installmentPlanName) ?? void 0,
|
|
507
482
|
durationBasis: (t == null ? void 0 : t.durationBasis) ?? void 0,
|
|
508
483
|
delinquencyPlanName: (t == null ? void 0 : t.delinquencyPlanName) ?? void 0
|
|
509
484
|
}
|
|
510
485
|
};
|
|
511
|
-
},
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
486
|
+
}, he = (t) => ({
|
|
487
|
+
...t.data,
|
|
488
|
+
coverageTerms: t.coverageTerms ?? {}
|
|
489
|
+
}), X = (t, e) => {
|
|
490
|
+
for (const a of t) {
|
|
491
|
+
if (a.locator === e)
|
|
492
|
+
return a;
|
|
515
493
|
const f = X(
|
|
516
|
-
|
|
494
|
+
a.elements ?? [],
|
|
517
495
|
e
|
|
518
496
|
);
|
|
519
497
|
if (f)
|
|
@@ -521,8 +499,8 @@ const he = (t) => {
|
|
|
521
499
|
}
|
|
522
500
|
return !1;
|
|
523
501
|
}, ae = (t, e) => {
|
|
524
|
-
var
|
|
525
|
-
return ((
|
|
502
|
+
var a, f;
|
|
503
|
+
return ((a = t.element) == null ? void 0 : a.locator) === e ? t.element : X(
|
|
526
504
|
((f = t.element) == null ? void 0 : f.elements) ?? [],
|
|
527
505
|
e
|
|
528
506
|
);
|
|
@@ -532,67 +510,67 @@ const he = (t) => {
|
|
|
532
510
|
}) => t.products[e] ?? {}, ce = (t) => {
|
|
533
511
|
var f;
|
|
534
512
|
t = t ?? "";
|
|
535
|
-
const e = t.replace(/\?|\*|!|\+/g, ""),
|
|
513
|
+
const e = t.replace(/\?|\*|!|\+/g, ""), a = (f = t.match(/\?|\*|!|\+/g)) == null ? void 0 : f.pop();
|
|
536
514
|
return {
|
|
537
515
|
name: e,
|
|
538
|
-
quantifier:
|
|
516
|
+
quantifier: a ?? ""
|
|
539
517
|
};
|
|
540
518
|
}, ue = ({
|
|
541
519
|
dataModel: t,
|
|
542
520
|
productDataModel: e
|
|
543
521
|
}) => {
|
|
544
|
-
const
|
|
545
|
-
const { name:
|
|
546
|
-
return
|
|
547
|
-
}), M = Object.keys(
|
|
548
|
-
(r) =>
|
|
549
|
-
),
|
|
550
|
-
(r) =>
|
|
551
|
-
),
|
|
552
|
-
(r) =>
|
|
522
|
+
const a = t.exposures ?? {}, f = t.coverages ?? {}, b = t.policyLines ?? {}, d = t.exposureGroups ?? {}, p = (e.contents ?? []).map((r) => {
|
|
523
|
+
const { name: O } = ce(r);
|
|
524
|
+
return O;
|
|
525
|
+
}), M = Object.keys(a).filter(
|
|
526
|
+
(r) => p.includes(r)
|
|
527
|
+
), P = Object.keys(f).filter(
|
|
528
|
+
(r) => p.includes(r)
|
|
529
|
+
), C = Object.keys(b).filter(
|
|
530
|
+
(r) => p.includes(r)
|
|
553
531
|
), E = Object.keys(
|
|
554
532
|
d
|
|
555
|
-
).filter((r) =>
|
|
533
|
+
).filter((r) => p.includes(r)), h = {
|
|
556
534
|
coverages: {},
|
|
557
535
|
exposures: {},
|
|
558
536
|
policyLines: {},
|
|
559
537
|
exposureGroups: {}
|
|
560
538
|
};
|
|
561
539
|
for (const r of M)
|
|
562
|
-
|
|
563
|
-
for (const r of
|
|
564
|
-
|
|
565
|
-
for (const r of
|
|
566
|
-
|
|
540
|
+
h.exposures[r] = a[r];
|
|
541
|
+
for (const r of P)
|
|
542
|
+
h.coverages[r] = f[r];
|
|
543
|
+
for (const r of C)
|
|
544
|
+
h.policyLines[r] = b[r];
|
|
567
545
|
for (const r of E)
|
|
568
|
-
|
|
569
|
-
return
|
|
546
|
+
h.exposureGroups[r] = d[r];
|
|
547
|
+
return h;
|
|
570
548
|
}, pe = ({
|
|
571
549
|
dataModel: t,
|
|
572
550
|
quote: e,
|
|
573
|
-
elementLocator:
|
|
551
|
+
elementLocator: a
|
|
574
552
|
}) => {
|
|
575
|
-
const f = ae(e,
|
|
553
|
+
const f = ae(e, a);
|
|
576
554
|
if (!f)
|
|
577
555
|
return {};
|
|
578
|
-
const
|
|
556
|
+
const b = re({
|
|
579
557
|
element: e,
|
|
580
558
|
dataModel: t
|
|
581
559
|
}), d = ue({
|
|
582
560
|
dataModel: t,
|
|
583
|
-
productDataModel:
|
|
561
|
+
productDataModel: b
|
|
584
562
|
});
|
|
585
|
-
let
|
|
586
|
-
const
|
|
563
|
+
let g = !1;
|
|
564
|
+
const p = f.type.split("Quote")[0];
|
|
587
565
|
return Object.keys(d.exposures).forEach((M) => {
|
|
588
|
-
M ===
|
|
589
|
-
}),
|
|
590
|
-
M ===
|
|
591
|
-
}),
|
|
592
|
-
M ===
|
|
593
|
-
}),
|
|
594
|
-
M ===
|
|
595
|
-
}),
|
|
566
|
+
M === p && (g = d.exposures[M]);
|
|
567
|
+
}), g || Object.keys(d.coverages).forEach((M) => {
|
|
568
|
+
M === p && (g = d.coverages[M]);
|
|
569
|
+
}), g || Object.keys(d.policyLines).forEach((M) => {
|
|
570
|
+
M === p && (g = d.policyLines[M]);
|
|
571
|
+
}), g || Object.keys(d.exposureGroups).forEach((M) => {
|
|
572
|
+
M === p && (g = d.exposureGroups[M]);
|
|
573
|
+
}), g;
|
|
596
574
|
};
|
|
597
575
|
export {
|
|
598
576
|
q as dataModelToJSONSchema,
|
|
@@ -600,14 +578,14 @@ export {
|
|
|
600
578
|
ae as extractElementFromQuote,
|
|
601
579
|
re as extractProductDataModel,
|
|
602
580
|
ue as extractProductElements,
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
581
|
+
he as getDefaultElementValues,
|
|
582
|
+
me as getDefaultQuoteValues,
|
|
583
|
+
oe as getQuoteElementRequest,
|
|
584
|
+
le as getQuoteRequest,
|
|
607
585
|
se as parseElementTypeAndScopeByElementType,
|
|
608
|
-
|
|
586
|
+
fe as retrieveDataModelFromElement,
|
|
609
587
|
ie as retrieveElementFromQuoteByLocator,
|
|
610
588
|
ce as splitInputAndQuantifier,
|
|
611
|
-
|
|
589
|
+
de as transformErrors
|
|
612
590
|
};
|
|
613
591
|
//# sourceMappingURL=index.es.js.map
|