@usebridge/sdk-react 0.5.1 → 0.6.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/dist/index.cjs +304 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +303 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -136,8 +136,8 @@ interface EligibilityInputState {
|
|
|
136
136
|
set: (lastName: string) => void;
|
|
137
137
|
};
|
|
138
138
|
dateOfBirth: {
|
|
139
|
-
value:
|
|
140
|
-
set: (dateOfBirth:
|
|
139
|
+
value: string | null;
|
|
140
|
+
set: (dateOfBirth: string | null) => void;
|
|
141
141
|
};
|
|
142
142
|
memberId: {
|
|
143
143
|
value: string;
|
|
@@ -169,4 +169,13 @@ declare function useEligibilityInputField<F extends Field, T = EligibilityInputS
|
|
|
169
169
|
*/
|
|
170
170
|
declare function useEligibilityInputIsValid(): boolean;
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Determines whether a value is a valid datestamp, "YYYY-MM-DD"
|
|
174
|
+
*
|
|
175
|
+
* @param value the value to check, null or undefined is not valid
|
|
176
|
+
* @param strict whether to reject
|
|
177
|
+
* @returns true if the value is a valid datestamp, false otherwise
|
|
178
|
+
*/
|
|
179
|
+
declare function isValidDatestamp(value: string | null): boolean;
|
|
180
|
+
|
|
181
|
+
export { BridgeSdkProvider, EligibilityInputContext, HardEligibilityContext, HardEligibilityProvider, SoftEligibilityProvider, isValidDatestamp, useBridgeSdk, useCreateHardEligibilitySession, useCreateSoftEligibilitySession, useEligibilityInputField, useEligibilityInputIsValid, useHardEligibilityState, useHardEligibilitySubmit, usePayerAutocomplete, usePayerSearch, useSoftEligibilityState, useSoftEligibilitySubmit };
|
package/dist/index.d.ts
CHANGED
|
@@ -136,8 +136,8 @@ interface EligibilityInputState {
|
|
|
136
136
|
set: (lastName: string) => void;
|
|
137
137
|
};
|
|
138
138
|
dateOfBirth: {
|
|
139
|
-
value:
|
|
140
|
-
set: (dateOfBirth:
|
|
139
|
+
value: string | null;
|
|
140
|
+
set: (dateOfBirth: string | null) => void;
|
|
141
141
|
};
|
|
142
142
|
memberId: {
|
|
143
143
|
value: string;
|
|
@@ -169,4 +169,13 @@ declare function useEligibilityInputField<F extends Field, T = EligibilityInputS
|
|
|
169
169
|
*/
|
|
170
170
|
declare function useEligibilityInputIsValid(): boolean;
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Determines whether a value is a valid datestamp, "YYYY-MM-DD"
|
|
174
|
+
*
|
|
175
|
+
* @param value the value to check, null or undefined is not valid
|
|
176
|
+
* @param strict whether to reject
|
|
177
|
+
* @returns true if the value is a valid datestamp, false otherwise
|
|
178
|
+
*/
|
|
179
|
+
declare function isValidDatestamp(value: string | null): boolean;
|
|
180
|
+
|
|
181
|
+
export { BridgeSdkProvider, EligibilityInputContext, HardEligibilityContext, HardEligibilityProvider, SoftEligibilityProvider, isValidDatestamp, useBridgeSdk, useCreateHardEligibilitySession, useCreateSoftEligibilitySession, useEligibilityInputField, useEligibilityInputIsValid, useHardEligibilityState, useHardEligibilitySubmit, usePayerAutocomplete, usePayerSearch, useSoftEligibilityState, useSoftEligibilitySubmit };
|
package/dist/index.js
CHANGED
|
@@ -158,6 +158,287 @@ var require_lodash = __commonJS({
|
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
+
// ../../node_modules/dayjs/dayjs.min.js
|
|
162
|
+
var require_dayjs_min = __commonJS({
|
|
163
|
+
"../../node_modules/dayjs/dayjs.min.js"(exports2, module2) {
|
|
164
|
+
"use strict";
|
|
165
|
+
!(function(t, e) {
|
|
166
|
+
"object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
|
|
167
|
+
})(exports2, (function() {
|
|
168
|
+
"use strict";
|
|
169
|
+
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|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, M = { 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(t2) {
|
|
170
|
+
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
|
|
171
|
+
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
|
|
172
|
+
} }, m = function(t2, e2, n2) {
|
|
173
|
+
var r2 = String(t2);
|
|
174
|
+
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
|
175
|
+
}, v = { s: m, z: function(t2) {
|
|
176
|
+
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
|
177
|
+
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
|
178
|
+
}, m: function t2(e2, n2) {
|
|
179
|
+
if (e2.date() < n2.date()) return -t2(n2, e2);
|
|
180
|
+
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
|
|
181
|
+
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
|
182
|
+
}, a: function(t2) {
|
|
183
|
+
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
|
184
|
+
}, p: function(t2) {
|
|
185
|
+
return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
|
186
|
+
}, u: function(t2) {
|
|
187
|
+
return void 0 === t2;
|
|
188
|
+
} }, g = "en", D = {};
|
|
189
|
+
D[g] = M;
|
|
190
|
+
var p = "$isDayjsObject", S = function(t2) {
|
|
191
|
+
return t2 instanceof _ || !(!t2 || !t2[p]);
|
|
192
|
+
}, w = function t2(e2, n2, r2) {
|
|
193
|
+
var i2;
|
|
194
|
+
if (!e2) return g;
|
|
195
|
+
if ("string" == typeof e2) {
|
|
196
|
+
var s2 = e2.toLowerCase();
|
|
197
|
+
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
|
|
198
|
+
var u2 = e2.split("-");
|
|
199
|
+
if (!i2 && u2.length > 1) return t2(u2[0]);
|
|
200
|
+
} else {
|
|
201
|
+
var a2 = e2.name;
|
|
202
|
+
D[a2] = e2, i2 = a2;
|
|
203
|
+
}
|
|
204
|
+
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
205
|
+
}, O = function(t2, e2) {
|
|
206
|
+
if (S(t2)) return t2.clone();
|
|
207
|
+
var n2 = "object" == typeof e2 ? e2 : {};
|
|
208
|
+
return n2.date = t2, n2.args = arguments, new _(n2);
|
|
209
|
+
}, b = v;
|
|
210
|
+
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
211
|
+
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
212
|
+
};
|
|
213
|
+
var _ = (function() {
|
|
214
|
+
function M2(t2) {
|
|
215
|
+
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
|
|
216
|
+
}
|
|
217
|
+
var m2 = M2.prototype;
|
|
218
|
+
return m2.parse = function(t2) {
|
|
219
|
+
this.$d = (function(t3) {
|
|
220
|
+
var e2 = t3.date, n2 = t3.utc;
|
|
221
|
+
if (null === e2) return /* @__PURE__ */ new Date(NaN);
|
|
222
|
+
if (b.u(e2)) return /* @__PURE__ */ new Date();
|
|
223
|
+
if (e2 instanceof Date) return new Date(e2);
|
|
224
|
+
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
|
|
225
|
+
var r2 = e2.match($);
|
|
226
|
+
if (r2) {
|
|
227
|
+
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
|
|
228
|
+
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return new Date(e2);
|
|
232
|
+
})(t2), this.init();
|
|
233
|
+
}, m2.init = function() {
|
|
234
|
+
var t2 = this.$d;
|
|
235
|
+
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
|
236
|
+
}, m2.$utils = function() {
|
|
237
|
+
return b;
|
|
238
|
+
}, m2.isValid = function() {
|
|
239
|
+
return !(this.$d.toString() === l);
|
|
240
|
+
}, m2.isSame = function(t2, e2) {
|
|
241
|
+
var n2 = O(t2);
|
|
242
|
+
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
|
243
|
+
}, m2.isAfter = function(t2, e2) {
|
|
244
|
+
return O(t2) < this.startOf(e2);
|
|
245
|
+
}, m2.isBefore = function(t2, e2) {
|
|
246
|
+
return this.endOf(e2) < O(t2);
|
|
247
|
+
}, m2.$g = function(t2, e2, n2) {
|
|
248
|
+
return b.u(t2) ? this[e2] : this.set(n2, t2);
|
|
249
|
+
}, m2.unix = function() {
|
|
250
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
251
|
+
}, m2.valueOf = function() {
|
|
252
|
+
return this.$d.getTime();
|
|
253
|
+
}, m2.startOf = function(t2, e2) {
|
|
254
|
+
var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
|
|
255
|
+
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
|
256
|
+
return r2 ? i2 : i2.endOf(a);
|
|
257
|
+
}, $2 = function(t3, e3) {
|
|
258
|
+
return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
|
259
|
+
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
260
|
+
switch (f2) {
|
|
261
|
+
case h:
|
|
262
|
+
return r2 ? l2(1, 0) : l2(31, 11);
|
|
263
|
+
case c:
|
|
264
|
+
return r2 ? l2(1, M3) : l2(0, M3 + 1);
|
|
265
|
+
case o:
|
|
266
|
+
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
|
267
|
+
return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
|
268
|
+
case a:
|
|
269
|
+
case d:
|
|
270
|
+
return $2(v2 + "Hours", 0);
|
|
271
|
+
case u:
|
|
272
|
+
return $2(v2 + "Minutes", 1);
|
|
273
|
+
case s:
|
|
274
|
+
return $2(v2 + "Seconds", 2);
|
|
275
|
+
case i:
|
|
276
|
+
return $2(v2 + "Milliseconds", 3);
|
|
277
|
+
default:
|
|
278
|
+
return this.clone();
|
|
279
|
+
}
|
|
280
|
+
}, m2.endOf = function(t2) {
|
|
281
|
+
return this.startOf(t2, false);
|
|
282
|
+
}, m2.$set = function(t2, e2) {
|
|
283
|
+
var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
|
284
|
+
if (o2 === c || o2 === h) {
|
|
285
|
+
var y2 = this.clone().set(d, 1);
|
|
286
|
+
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
287
|
+
} else l2 && this.$d[l2]($2);
|
|
288
|
+
return this.init(), this;
|
|
289
|
+
}, m2.set = function(t2, e2) {
|
|
290
|
+
return this.clone().$set(t2, e2);
|
|
291
|
+
}, m2.get = function(t2) {
|
|
292
|
+
return this[b.p(t2)]();
|
|
293
|
+
}, m2.add = function(r2, f2) {
|
|
294
|
+
var d2, l2 = this;
|
|
295
|
+
r2 = Number(r2);
|
|
296
|
+
var $2 = b.p(f2), y2 = function(t2) {
|
|
297
|
+
var e2 = O(l2);
|
|
298
|
+
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
299
|
+
};
|
|
300
|
+
if ($2 === c) return this.set(c, this.$M + r2);
|
|
301
|
+
if ($2 === h) return this.set(h, this.$y + r2);
|
|
302
|
+
if ($2 === a) return y2(1);
|
|
303
|
+
if ($2 === o) return y2(7);
|
|
304
|
+
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
305
|
+
return b.w(m3, this);
|
|
306
|
+
}, m2.subtract = function(t2, e2) {
|
|
307
|
+
return this.add(-1 * t2, e2);
|
|
308
|
+
}, m2.format = function(t2) {
|
|
309
|
+
var e2 = this, n2 = this.$locale();
|
|
310
|
+
if (!this.isValid()) return n2.invalidDate || l;
|
|
311
|
+
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
|
|
312
|
+
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
|
313
|
+
}, d2 = function(t3) {
|
|
314
|
+
return b.s(s2 % 12 || 12, t3, "0");
|
|
315
|
+
}, $2 = f2 || function(t3, e3, n3) {
|
|
316
|
+
var r3 = t3 < 12 ? "AM" : "PM";
|
|
317
|
+
return n3 ? r3.toLowerCase() : r3;
|
|
318
|
+
};
|
|
319
|
+
return r2.replace(y, (function(t3, r3) {
|
|
320
|
+
return r3 || (function(t4) {
|
|
321
|
+
switch (t4) {
|
|
322
|
+
case "YY":
|
|
323
|
+
return String(e2.$y).slice(-2);
|
|
324
|
+
case "YYYY":
|
|
325
|
+
return b.s(e2.$y, 4, "0");
|
|
326
|
+
case "M":
|
|
327
|
+
return a2 + 1;
|
|
328
|
+
case "MM":
|
|
329
|
+
return b.s(a2 + 1, 2, "0");
|
|
330
|
+
case "MMM":
|
|
331
|
+
return h2(n2.monthsShort, a2, c2, 3);
|
|
332
|
+
case "MMMM":
|
|
333
|
+
return h2(c2, a2);
|
|
334
|
+
case "D":
|
|
335
|
+
return e2.$D;
|
|
336
|
+
case "DD":
|
|
337
|
+
return b.s(e2.$D, 2, "0");
|
|
338
|
+
case "d":
|
|
339
|
+
return String(e2.$W);
|
|
340
|
+
case "dd":
|
|
341
|
+
return h2(n2.weekdaysMin, e2.$W, o2, 2);
|
|
342
|
+
case "ddd":
|
|
343
|
+
return h2(n2.weekdaysShort, e2.$W, o2, 3);
|
|
344
|
+
case "dddd":
|
|
345
|
+
return o2[e2.$W];
|
|
346
|
+
case "H":
|
|
347
|
+
return String(s2);
|
|
348
|
+
case "HH":
|
|
349
|
+
return b.s(s2, 2, "0");
|
|
350
|
+
case "h":
|
|
351
|
+
return d2(1);
|
|
352
|
+
case "hh":
|
|
353
|
+
return d2(2);
|
|
354
|
+
case "a":
|
|
355
|
+
return $2(s2, u2, true);
|
|
356
|
+
case "A":
|
|
357
|
+
return $2(s2, u2, false);
|
|
358
|
+
case "m":
|
|
359
|
+
return String(u2);
|
|
360
|
+
case "mm":
|
|
361
|
+
return b.s(u2, 2, "0");
|
|
362
|
+
case "s":
|
|
363
|
+
return String(e2.$s);
|
|
364
|
+
case "ss":
|
|
365
|
+
return b.s(e2.$s, 2, "0");
|
|
366
|
+
case "SSS":
|
|
367
|
+
return b.s(e2.$ms, 3, "0");
|
|
368
|
+
case "Z":
|
|
369
|
+
return i2;
|
|
370
|
+
}
|
|
371
|
+
return null;
|
|
372
|
+
})(t3) || i2.replace(":", "");
|
|
373
|
+
}));
|
|
374
|
+
}, m2.utcOffset = function() {
|
|
375
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
376
|
+
}, m2.diff = function(r2, d2, l2) {
|
|
377
|
+
var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
|
378
|
+
return b.m(y2, m3);
|
|
379
|
+
};
|
|
380
|
+
switch (M3) {
|
|
381
|
+
case h:
|
|
382
|
+
$2 = D2() / 12;
|
|
383
|
+
break;
|
|
384
|
+
case c:
|
|
385
|
+
$2 = D2();
|
|
386
|
+
break;
|
|
387
|
+
case f:
|
|
388
|
+
$2 = D2() / 3;
|
|
389
|
+
break;
|
|
390
|
+
case o:
|
|
391
|
+
$2 = (g2 - v2) / 6048e5;
|
|
392
|
+
break;
|
|
393
|
+
case a:
|
|
394
|
+
$2 = (g2 - v2) / 864e5;
|
|
395
|
+
break;
|
|
396
|
+
case u:
|
|
397
|
+
$2 = g2 / n;
|
|
398
|
+
break;
|
|
399
|
+
case s:
|
|
400
|
+
$2 = g2 / e;
|
|
401
|
+
break;
|
|
402
|
+
case i:
|
|
403
|
+
$2 = g2 / t;
|
|
404
|
+
break;
|
|
405
|
+
default:
|
|
406
|
+
$2 = g2;
|
|
407
|
+
}
|
|
408
|
+
return l2 ? $2 : b.a($2);
|
|
409
|
+
}, m2.daysInMonth = function() {
|
|
410
|
+
return this.endOf(c).$D;
|
|
411
|
+
}, m2.$locale = function() {
|
|
412
|
+
return D[this.$L];
|
|
413
|
+
}, m2.locale = function(t2, e2) {
|
|
414
|
+
if (!t2) return this.$L;
|
|
415
|
+
var n2 = this.clone(), r2 = w(t2, e2, true);
|
|
416
|
+
return r2 && (n2.$L = r2), n2;
|
|
417
|
+
}, m2.clone = function() {
|
|
418
|
+
return b.w(this.$d, this);
|
|
419
|
+
}, m2.toDate = function() {
|
|
420
|
+
return new Date(this.valueOf());
|
|
421
|
+
}, m2.toJSON = function() {
|
|
422
|
+
return this.isValid() ? this.toISOString() : null;
|
|
423
|
+
}, m2.toISOString = function() {
|
|
424
|
+
return this.$d.toISOString();
|
|
425
|
+
}, m2.toString = function() {
|
|
426
|
+
return this.$d.toUTCString();
|
|
427
|
+
}, M2;
|
|
428
|
+
})(), k = _.prototype;
|
|
429
|
+
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach((function(t2) {
|
|
430
|
+
k[t2[1]] = function(e2) {
|
|
431
|
+
return this.$g(e2, t2[0], t2[1]);
|
|
432
|
+
};
|
|
433
|
+
})), O.extend = function(t2, e2) {
|
|
434
|
+
return t2.$i || (t2(e2, _, O), t2.$i = true), O;
|
|
435
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
436
|
+
return O(1e3 * t2);
|
|
437
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
438
|
+
}));
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
|
|
161
442
|
// src/sdk/index.tsx
|
|
162
443
|
import { createContext, useContext, useRef as useRef2 } from "react";
|
|
163
444
|
import { BridgeSdk as BridgeSdk2 } from "@usebridge/sdk-core";
|
|
@@ -1860,6 +2141,18 @@ import "zustand";
|
|
|
1860
2141
|
|
|
1861
2142
|
// src/eligibility-input/eligibility-input-store.ts
|
|
1862
2143
|
import { createStore } from "zustand";
|
|
2144
|
+
|
|
2145
|
+
// src/lib/is-valid-datestamp.ts
|
|
2146
|
+
var import_dayjs = __toESM(require_dayjs_min(), 1);
|
|
2147
|
+
function isValidDatestamp(value) {
|
|
2148
|
+
if (!value) return false;
|
|
2149
|
+
if (typeof value !== "string") return false;
|
|
2150
|
+
const isValidFormat = /^\d{4}-\d{2}-\d{2}$/.test(value);
|
|
2151
|
+
if (!isValidFormat) return false;
|
|
2152
|
+
return (0, import_dayjs.default)(value).isValid();
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
// src/eligibility-input/eligibility-input-store.ts
|
|
1863
2156
|
function createEligibilityInputStore(requirePatient) {
|
|
1864
2157
|
return createStore()((set) => ({
|
|
1865
2158
|
requirePatient,
|
|
@@ -1881,7 +2174,12 @@ function createEligibilityInputStore(requirePatient) {
|
|
|
1881
2174
|
},
|
|
1882
2175
|
dateOfBirth: {
|
|
1883
2176
|
value: null,
|
|
1884
|
-
set: (dateOfBirth) =>
|
|
2177
|
+
set: (dateOfBirth) => {
|
|
2178
|
+
if (dateOfBirth && !isValidDatestamp(dateOfBirth)) {
|
|
2179
|
+
throw new Error('dateOfBirth must be a valid date, string value of "YYYY-MM-DD"');
|
|
2180
|
+
}
|
|
2181
|
+
set((s) => ({ ...s, dateOfBirth: { ...s.dateOfBirth, value: dateOfBirth } }));
|
|
2182
|
+
}
|
|
1885
2183
|
},
|
|
1886
2184
|
memberId: {
|
|
1887
2185
|
value: "",
|
|
@@ -2011,7 +2309,7 @@ function useEligibilityInputField(field, defaultValue) {
|
|
|
2011
2309
|
case "dateOfBirth":
|
|
2012
2310
|
isVisible = requirePatient;
|
|
2013
2311
|
isRequired = requirePatient;
|
|
2014
|
-
isValid =
|
|
2312
|
+
isValid = isValidDatestamp(input.dateOfBirth.value);
|
|
2015
2313
|
break;
|
|
2016
2314
|
case "memberId": {
|
|
2017
2315
|
const memberIdIsRequired = Boolean(
|
|
@@ -2062,6 +2360,7 @@ function useEligibilityInputIsValid() {
|
|
|
2062
2360
|
}
|
|
2063
2361
|
|
|
2064
2362
|
// src/hard-eligibility/use-hard-eligibility-submit.ts
|
|
2363
|
+
var import_dayjs2 = __toESM(require_dayjs_min(), 1);
|
|
2065
2364
|
function useHardEligibilitySubmit() {
|
|
2066
2365
|
const session = useHardEligibilitySession();
|
|
2067
2366
|
const { state, payer, firstName, lastName, dateOfBirth, memberId } = useEligibilityInput();
|
|
@@ -2084,7 +2383,7 @@ function useHardEligibilitySubmit() {
|
|
|
2084
2383
|
payerId: payer.value.id,
|
|
2085
2384
|
firstName: firstName.value.trim(),
|
|
2086
2385
|
lastName: lastName.value.trim(),
|
|
2087
|
-
dateOfBirth: dateToDateObject(dateOfBirth.value),
|
|
2386
|
+
dateOfBirth: dateToDateObject((0, import_dayjs2.default)(dateOfBirth.value).toDate()),
|
|
2088
2387
|
memberId: memberId.value?.trim() || void 0
|
|
2089
2388
|
};
|
|
2090
2389
|
}
|
|
@@ -2219,6 +2518,7 @@ export {
|
|
|
2219
2518
|
HardEligibilityContext,
|
|
2220
2519
|
HardEligibilityProvider,
|
|
2221
2520
|
SoftEligibilityProvider,
|
|
2521
|
+
isValidDatestamp,
|
|
2222
2522
|
useBridgeSdk,
|
|
2223
2523
|
useCreateHardEligibilitySession,
|
|
2224
2524
|
useCreateSoftEligibilitySession,
|