@metaboliccode-dev/widget 0.2.20 → 0.2.22
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/MetabolicDashboard/api/index.d.ts +4 -4
- package/dist/MetabolicDashboard/api/metabolicBackendApi.d.ts +49 -1
- package/dist/MetabolicDashboard/api/metabolicStealthHealth.d.ts +6 -0
- package/dist/MetabolicDashboard/index.d.ts +2 -2
- package/dist/api.js +31 -24
- package/dist/components/MetabolicCodePatientProgress/index.d.ts +6 -0
- package/dist/components/MetabolicCodePatientProgress/index.test.d.ts +1 -0
- package/dist/components/MetabolicCodeShortReport/index.d.ts +8 -0
- package/dist/components/MetabolicCodeShortReport/index.test.d.ts +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/entry-api--UTRftOZ.js +688 -0
- package/dist/entry-api.d.ts +6 -4
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1292 -1263
- package/package.json +1 -1
- package/dist/entry-api--y5Fjh-O.js +0 -536
package/package.json
CHANGED
|
@@ -1,536 +0,0 @@
|
|
|
1
|
-
var j = Object.defineProperty;
|
|
2
|
-
var D = (t, e, n) => e in t ? j(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var m = (t, e, n) => D(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
const A = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_AG_CHARTS_LICENSE_KEY: "Using_this_{AG_Charts}_Enterprise_key_{AG-125036}_in_excess_of_the_licence_granted_is_not_permitted___Please_report_misuse_to_legal@ag-grid.com___For_help_with_changing_this_key_please_contact_info@ag-grid.com___{Metabolic_Code}_is_granted_a_{Single_Application}_Developer_License_for_the_application_{Metabolic_Code}_only_for_{1}_Front-End_JavaScript_developer___All_Front-End_JavaScript_developers_working_on_{Metabolic_Code}_need_to_be_licensed___{Metabolic_Code}_has_been_granted_a_Deployment_License_Add-on_for_{1}_Production_Environment___This_key_works_with_{AG_Charts}_Enterprise_versions_released_before_{31_March_2027}____[v3]_[02]_MTgwNjQ0NzYwMDAwMA==4e5dbf88087527cd3b1cf09b0557ec38", VITE_METABOLIC_LMS_API_BASE_URL: "https://mc-api-us.metaboliccode.com", VITE_METABOLIC_LMS_FRONTEND_BASE_URL: "https://mc-lms.metaboliccode.com", VITE_METABOLIC_REPORT_PAGES_API_BASE_URL: "https://mc-api-us.metaboliccode.com", VITE_METABOLIC_REPORT_PAGES_API_BASE_URL_CA: "https://mc-api-ca.metaboliccode.com", VITE_METABOLIC_REPORT_PAGES_API_BASE_URL_US: "https://mc-api-us.metaboliccode.com" }, F = "https://mc-api-us.metaboliccode.com", $ = "https://mc-api-ca.metaboliccode.com", V = "https://mc-api-us.metaboliccode.com", q = "https://mc-lms.metaboliccode.com";
|
|
5
|
-
function p(t) {
|
|
6
|
-
const e = t == null ? void 0 : t.trim();
|
|
7
|
-
return e || void 0;
|
|
8
|
-
}
|
|
9
|
-
function x() {
|
|
10
|
-
try {
|
|
11
|
-
return p(
|
|
12
|
-
"https://mc-api-us.metaboliccode.com"
|
|
13
|
-
);
|
|
14
|
-
} catch {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function J() {
|
|
19
|
-
try {
|
|
20
|
-
return p(
|
|
21
|
-
"https://mc-api-us.metaboliccode.com"
|
|
22
|
-
);
|
|
23
|
-
} catch {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function G() {
|
|
28
|
-
try {
|
|
29
|
-
return p(
|
|
30
|
-
"https://mc-api-ca.metaboliccode.com"
|
|
31
|
-
);
|
|
32
|
-
} catch {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function K() {
|
|
37
|
-
try {
|
|
38
|
-
return p("https://mc-api-us.metaboliccode.com");
|
|
39
|
-
} catch {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function X() {
|
|
44
|
-
try {
|
|
45
|
-
return p(
|
|
46
|
-
"https://mc-lms.metaboliccode.com"
|
|
47
|
-
);
|
|
48
|
-
} catch {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const I = x(), L = J() ?? F, v = G() ?? I ?? $, W = I ?? L, Q = K() ?? V, z = X() ?? q, Y = (() => {
|
|
53
|
-
try {
|
|
54
|
-
return A == null ? void 0 : A.VITE_METABOLIC_DASHBOARD_STUB_API_KEY;
|
|
55
|
-
} catch {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
})();
|
|
59
|
-
function Et(t) {
|
|
60
|
-
return t === Y;
|
|
61
|
-
}
|
|
62
|
-
function T(t) {
|
|
63
|
-
return t.replace(/\/+$/, "");
|
|
64
|
-
}
|
|
65
|
-
function Z(t) {
|
|
66
|
-
const e = t == null ? void 0 : t.trim().toUpperCase();
|
|
67
|
-
return e != null && e.startsWith("CA-") ? "ca" : "us";
|
|
68
|
-
}
|
|
69
|
-
function tt(t, e) {
|
|
70
|
-
return Z(t) === "ca" ? T(e.ca || e.fallback || e.us || "") : T(e.us || e.fallback || "");
|
|
71
|
-
}
|
|
72
|
-
function et(t) {
|
|
73
|
-
return tt(t, {
|
|
74
|
-
fallback: W,
|
|
75
|
-
us: L,
|
|
76
|
-
ca: v
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
const nt = {
|
|
80
|
-
stealth_health: "/api/v1/webhooks/stealth_health",
|
|
81
|
-
stealth_health_junction: "/api/v1/webhooks/stealth_health/junction"
|
|
82
|
-
};
|
|
83
|
-
function rt(t) {
|
|
84
|
-
return t.replace(/\/+$/, "");
|
|
85
|
-
}
|
|
86
|
-
function ot(t) {
|
|
87
|
-
const e = t.trim();
|
|
88
|
-
if (!e)
|
|
89
|
-
throw new Error("Metabolic Code API key is required.");
|
|
90
|
-
return e;
|
|
91
|
-
}
|
|
92
|
-
function it(t) {
|
|
93
|
-
return et(t);
|
|
94
|
-
}
|
|
95
|
-
function st({
|
|
96
|
-
apiKey: t,
|
|
97
|
-
kind: e
|
|
98
|
-
}) {
|
|
99
|
-
return `${rt(it(t))}${nt[e]}`;
|
|
100
|
-
}
|
|
101
|
-
async function R({
|
|
102
|
-
apiKey: t,
|
|
103
|
-
kind: e,
|
|
104
|
-
body: n,
|
|
105
|
-
headers: r,
|
|
106
|
-
fetchImpl: o = fetch,
|
|
107
|
-
signal: s
|
|
108
|
-
}) {
|
|
109
|
-
const i = ot(t), a = new Headers(r);
|
|
110
|
-
return a.set("Content-Type", "application/json"), a.set("X-Api-Key", i), o(st({ apiKey: i, kind: e }), {
|
|
111
|
-
method: "POST",
|
|
112
|
-
headers: a,
|
|
113
|
-
body: JSON.stringify(n),
|
|
114
|
-
cache: "no-store",
|
|
115
|
-
redirect: "manual",
|
|
116
|
-
signal: s
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function O(t) {
|
|
120
|
-
return t.replace(/\/+$/, "");
|
|
121
|
-
}
|
|
122
|
-
function l(t) {
|
|
123
|
-
if (typeof t != "string") return null;
|
|
124
|
-
const e = t.trim();
|
|
125
|
-
return e.length ? e : null;
|
|
126
|
-
}
|
|
127
|
-
function M(t) {
|
|
128
|
-
const e = t.trim();
|
|
129
|
-
if (!e)
|
|
130
|
-
throw new Error("Metabolic Code API key is required.");
|
|
131
|
-
return e;
|
|
132
|
-
}
|
|
133
|
-
function at(t) {
|
|
134
|
-
return t === "video" || t === "article" || t === "guide" || t === "webinar" ? t : "guide";
|
|
135
|
-
}
|
|
136
|
-
async function U(t) {
|
|
137
|
-
const e = await t.json().catch(() => null);
|
|
138
|
-
return e && typeof e == "object" ? e : null;
|
|
139
|
-
}
|
|
140
|
-
function P() {
|
|
141
|
-
return O(Q);
|
|
142
|
-
}
|
|
143
|
-
function ct() {
|
|
144
|
-
return O(z);
|
|
145
|
-
}
|
|
146
|
-
function lt(t) {
|
|
147
|
-
const e = l(t);
|
|
148
|
-
if (!e)
|
|
149
|
-
throw new Error("LMS launch token is required.");
|
|
150
|
-
const n = new URL("/launch", ct());
|
|
151
|
-
return n.searchParams.set("token", e), n.toString();
|
|
152
|
-
}
|
|
153
|
-
function ut(t) {
|
|
154
|
-
const e = l(t.id), n = l(t.title), r = l(t.course_slug) ?? l(t.courseSlug), o = l(t.resource_key) ?? l(t.resourceKey) ?? e;
|
|
155
|
-
return !e || !n || !r || !o ? null : {
|
|
156
|
-
id: e,
|
|
157
|
-
type: at(t.type),
|
|
158
|
-
title: n,
|
|
159
|
-
category: l(t.category) ?? "Courses",
|
|
160
|
-
categoryId: l(t.category_id) ?? l(t.categoryId) ?? "courses",
|
|
161
|
-
excerpt: l(t.excerpt),
|
|
162
|
-
thumbnailUrl: l(t.thumbnail_url) ?? l(t.thumbnailUrl),
|
|
163
|
-
imageUrl: l(t.image_url) ?? l(t.imageUrl),
|
|
164
|
-
url: null,
|
|
165
|
-
isFeatured: !!(t.is_featured ?? t.isFeatured),
|
|
166
|
-
launchType: "lms_course",
|
|
167
|
-
courseSlug: r,
|
|
168
|
-
resourceKey: o
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
function bt(t, e) {
|
|
172
|
-
const n = /* @__PURE__ */ new Set(), r = [];
|
|
173
|
-
for (const o of e)
|
|
174
|
-
n.has(o.id) || (n.add(o.id), r.push(o));
|
|
175
|
-
for (const o of t)
|
|
176
|
-
n.has(o.id) || (n.add(o.id), r.push(o));
|
|
177
|
-
return r;
|
|
178
|
-
}
|
|
179
|
-
async function gt({
|
|
180
|
-
apiKey: t,
|
|
181
|
-
fetchImpl: e = fetch,
|
|
182
|
-
signal: n
|
|
183
|
-
}) {
|
|
184
|
-
const r = M(t), o = await e(`${P()}/api/v1/lms/partner_resources`, {
|
|
185
|
-
method: "GET",
|
|
186
|
-
headers: {
|
|
187
|
-
Accept: "application/json",
|
|
188
|
-
"X-Api-Key": r
|
|
189
|
-
},
|
|
190
|
-
cache: "no-store",
|
|
191
|
-
signal: n
|
|
192
|
-
});
|
|
193
|
-
if (!o.ok) return [];
|
|
194
|
-
const s = await U(o), i = s == null ? void 0 : s.resources;
|
|
195
|
-
return Array.isArray(i) ? i.map(
|
|
196
|
-
(a) => ut(a)
|
|
197
|
-
).filter((a) => a !== null) : [];
|
|
198
|
-
}
|
|
199
|
-
async function Tt({
|
|
200
|
-
apiKey: t,
|
|
201
|
-
externalUserId: e,
|
|
202
|
-
email: n,
|
|
203
|
-
displayName: r,
|
|
204
|
-
courseSlug: o,
|
|
205
|
-
resourceKey: s,
|
|
206
|
-
fetchImpl: i = fetch,
|
|
207
|
-
signal: a
|
|
208
|
-
}) {
|
|
209
|
-
var g;
|
|
210
|
-
const _ = M(t), h = await i(`${P()}/api/v1/lms/partner_launches`, {
|
|
211
|
-
method: "POST",
|
|
212
|
-
headers: {
|
|
213
|
-
Accept: "application/json",
|
|
214
|
-
"Content-Type": "application/json",
|
|
215
|
-
"X-Api-Key": _
|
|
216
|
-
},
|
|
217
|
-
cache: "no-store",
|
|
218
|
-
signal: a,
|
|
219
|
-
body: JSON.stringify({
|
|
220
|
-
launch: {
|
|
221
|
-
external_user_id: e,
|
|
222
|
-
email: n,
|
|
223
|
-
display_name: r,
|
|
224
|
-
course_slug: o,
|
|
225
|
-
resource_key: s
|
|
226
|
-
}
|
|
227
|
-
})
|
|
228
|
-
}), c = await U(h);
|
|
229
|
-
if (!h.ok) {
|
|
230
|
-
const N = typeof (c == null ? void 0 : c.error) == "string" ? c.error : "lms_launch_failed";
|
|
231
|
-
throw new Error(N);
|
|
232
|
-
}
|
|
233
|
-
const b = l(c == null ? void 0 : c.launch_token);
|
|
234
|
-
if (!b) throw new Error("lms_launch_failed");
|
|
235
|
-
return {
|
|
236
|
-
launchUrl: lt(b),
|
|
237
|
-
expiresAt: l(c == null ? void 0 : c.expires_at),
|
|
238
|
-
courseTitle: l((g = c == null ? void 0 : c.course) == null ? void 0 : g.title)
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
const B = "enroll.questionnaire.completed", C = "enroll.junction_order.created";
|
|
242
|
-
class y extends Error {
|
|
243
|
-
constructor(n, r, o, s) {
|
|
244
|
-
super(n);
|
|
245
|
-
m(this, "status");
|
|
246
|
-
m(this, "statusText");
|
|
247
|
-
m(this, "body");
|
|
248
|
-
this.name = "MetabolicStealthHealthRequestError", this.status = r, this.statusText = o, this.body = s;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
function _t(t) {
|
|
252
|
-
return t.replace(/\/+$/, "");
|
|
253
|
-
}
|
|
254
|
-
function u(t) {
|
|
255
|
-
return typeof t == "string" ? t.trim() : "";
|
|
256
|
-
}
|
|
257
|
-
function ht(t) {
|
|
258
|
-
return Object.fromEntries(Object.entries(t).filter(([, e]) => e !== void 0));
|
|
259
|
-
}
|
|
260
|
-
function H(t, e) {
|
|
261
|
-
const n = u(t);
|
|
262
|
-
if (!n)
|
|
263
|
-
throw new Error("Stealth Health Functions base URL is required.");
|
|
264
|
-
return `${_t(n)}/${e}`;
|
|
265
|
-
}
|
|
266
|
-
function dt(t) {
|
|
267
|
-
if (!t.trim()) return null;
|
|
268
|
-
try {
|
|
269
|
-
const e = JSON.parse(t);
|
|
270
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : { raw: e };
|
|
271
|
-
} catch {
|
|
272
|
-
return null;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
async function k(t) {
|
|
276
|
-
const e = await t.text(), n = dt(e);
|
|
277
|
-
if (!n)
|
|
278
|
-
throw new y(
|
|
279
|
-
`Firebase Function error: ${t.status} ${t.statusText}`,
|
|
280
|
-
t.status || 500,
|
|
281
|
-
t.statusText,
|
|
282
|
-
e.slice(0, 200)
|
|
283
|
-
);
|
|
284
|
-
if (!t.ok) {
|
|
285
|
-
const r = typeof n.error == "string" ? n.error : `Request failed (HTTP ${t.status}).`;
|
|
286
|
-
throw new y(
|
|
287
|
-
r,
|
|
288
|
-
t.status,
|
|
289
|
-
t.statusText,
|
|
290
|
-
n
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
return n;
|
|
294
|
-
}
|
|
295
|
-
async function yt({
|
|
296
|
-
functionsBaseUrl: t,
|
|
297
|
-
questionnaireResponseId: e,
|
|
298
|
-
questionnaireId: n,
|
|
299
|
-
enrollSlug: r,
|
|
300
|
-
profileData: o,
|
|
301
|
-
selectedMedication: s,
|
|
302
|
-
partnerRef: i,
|
|
303
|
-
whiteLabelDomain: a,
|
|
304
|
-
fetchImpl: _ = fetch,
|
|
305
|
-
signal: h
|
|
306
|
-
}) {
|
|
307
|
-
const c = await _(
|
|
308
|
-
H(t, "processQuestionnaireSubmission"),
|
|
309
|
-
{
|
|
310
|
-
method: "POST",
|
|
311
|
-
headers: { "Content-Type": "application/json" },
|
|
312
|
-
body: JSON.stringify(
|
|
313
|
-
ht({
|
|
314
|
-
questionnaireResponseId: e,
|
|
315
|
-
questionnaireId: n,
|
|
316
|
-
enrollSlug: u(r) || void 0,
|
|
317
|
-
profileData: o,
|
|
318
|
-
selectedMedication: s,
|
|
319
|
-
partnerRef: i,
|
|
320
|
-
whiteLabelDomain: a
|
|
321
|
-
})
|
|
322
|
-
),
|
|
323
|
-
signal: h
|
|
324
|
-
}
|
|
325
|
-
);
|
|
326
|
-
return k(c);
|
|
327
|
-
}
|
|
328
|
-
async function It({
|
|
329
|
-
functionsBaseUrl: t,
|
|
330
|
-
body: e,
|
|
331
|
-
fetchImpl: n = fetch,
|
|
332
|
-
signal: r
|
|
333
|
-
}) {
|
|
334
|
-
const o = await n(H(t, "createPatientLabOrder"), {
|
|
335
|
-
method: "POST",
|
|
336
|
-
headers: { "Content-Type": "application/json" },
|
|
337
|
-
cache: "no-store",
|
|
338
|
-
body: e || "{}",
|
|
339
|
-
signal: r
|
|
340
|
-
});
|
|
341
|
-
return k(o);
|
|
342
|
-
}
|
|
343
|
-
function S(t) {
|
|
344
|
-
if (t == null || typeof t != "object") return t;
|
|
345
|
-
if (typeof t.toDate == "function") {
|
|
346
|
-
const e = t.toDate();
|
|
347
|
-
return Number.isNaN(e.getTime()) ? null : e.toISOString();
|
|
348
|
-
}
|
|
349
|
-
return Array.isArray(t) ? t.map(S) : Object.fromEntries(
|
|
350
|
-
Object.entries(t).map(([e, n]) => [
|
|
351
|
-
e,
|
|
352
|
-
S(n)
|
|
353
|
-
])
|
|
354
|
-
);
|
|
355
|
-
}
|
|
356
|
-
function E(t) {
|
|
357
|
-
var n;
|
|
358
|
-
if (Array.isArray(t.slugs))
|
|
359
|
-
return t.slugs.filter(
|
|
360
|
-
(r) => typeof r == "string" && !!r.trim()
|
|
361
|
-
);
|
|
362
|
-
const e = (n = t.data) == null ? void 0 : n.slugs;
|
|
363
|
-
return Array.isArray(e) ? e.filter((r) => typeof r == "string" && !!r.trim()) : [];
|
|
364
|
-
}
|
|
365
|
-
function d(t, e) {
|
|
366
|
-
return u(t.slug) || u(e) || E(t)[0] || "";
|
|
367
|
-
}
|
|
368
|
-
function pt({
|
|
369
|
-
appointmentId: t,
|
|
370
|
-
enrollPage: e,
|
|
371
|
-
enrollSlug: n,
|
|
372
|
-
questionnaireId: r,
|
|
373
|
-
questionnaireResponseId: o,
|
|
374
|
-
responseData: s,
|
|
375
|
-
user: i,
|
|
376
|
-
occurredAt: a = (/* @__PURE__ */ new Date()).toISOString()
|
|
377
|
-
}) {
|
|
378
|
-
const _ = S(s), h = _.questionnaireSnapshot && typeof _.questionnaireSnapshot == "object" && !Array.isArray(_.questionnaireSnapshot) ? _.questionnaireSnapshot : {}, c = d(e, n);
|
|
379
|
-
return {
|
|
380
|
-
event: B,
|
|
381
|
-
occurredAt: a,
|
|
382
|
-
enrollPage: {
|
|
383
|
-
id: e.id,
|
|
384
|
-
slug: c,
|
|
385
|
-
slugs: E(e)
|
|
386
|
-
},
|
|
387
|
-
appointment: { id: t },
|
|
388
|
-
appointmentId: t,
|
|
389
|
-
user: {
|
|
390
|
-
id: i.uid,
|
|
391
|
-
uid: i.uid,
|
|
392
|
-
email: i.email,
|
|
393
|
-
firstname: i.firstname,
|
|
394
|
-
lastname: i.lastname,
|
|
395
|
-
birthday: i.birthday,
|
|
396
|
-
telephone: i.telephone
|
|
397
|
-
},
|
|
398
|
-
questionnaire: {
|
|
399
|
-
id: r,
|
|
400
|
-
title: typeof h.title == "string" ? h.title : "",
|
|
401
|
-
version: typeof h.version == "number" ? h.version : null
|
|
402
|
-
},
|
|
403
|
-
response: {
|
|
404
|
-
..._,
|
|
405
|
-
id: o,
|
|
406
|
-
questionnaireId: r
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
async function Lt({
|
|
411
|
-
apiKey: t,
|
|
412
|
-
fetchImpl: e,
|
|
413
|
-
signal: n,
|
|
414
|
-
...r
|
|
415
|
-
}) {
|
|
416
|
-
const o = pt(r);
|
|
417
|
-
return R({
|
|
418
|
-
apiKey: t,
|
|
419
|
-
kind: "stealth_health",
|
|
420
|
-
body: o,
|
|
421
|
-
headers: {
|
|
422
|
-
"User-Agent": "StealthHealth-EnrollWebhook/1.0",
|
|
423
|
-
"X-StealthHealth-Event": B,
|
|
424
|
-
"X-StealthHealth-Enroll-Slug": d(
|
|
425
|
-
r.enrollPage,
|
|
426
|
-
r.enrollSlug
|
|
427
|
-
),
|
|
428
|
-
"X-StealthHealth-Appointment-Id": r.appointmentId,
|
|
429
|
-
"X-StealthHealth-Questionnaire-Id": r.questionnaireId,
|
|
430
|
-
"X-StealthHealth-Questionnaire-Response-Id": r.questionnaireResponseId
|
|
431
|
-
},
|
|
432
|
-
fetchImpl: e,
|
|
433
|
-
signal: n
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
function f(t) {
|
|
437
|
-
return t && typeof t == "object" && !Array.isArray(t) ? t : null;
|
|
438
|
-
}
|
|
439
|
-
function w(t, e) {
|
|
440
|
-
return f(t == null ? void 0 : t[e]);
|
|
441
|
-
}
|
|
442
|
-
function mt(t) {
|
|
443
|
-
const e = f(t), n = w(e, "order");
|
|
444
|
-
return u(e == null ? void 0 : e.junctionOrderId) || u(e == null ? void 0 : e.junction_order_id) || u(e == null ? void 0 : e.orderId) || u(n == null ? void 0 : n.id);
|
|
445
|
-
}
|
|
446
|
-
function ft(t) {
|
|
447
|
-
const e = f(t), n = w(e, "order");
|
|
448
|
-
return u(e == null ? void 0 : e.status) || u(e == null ? void 0 : e.junctionStatus) || u(e == null ? void 0 : e.labOrderStatus) || u(n == null ? void 0 : n.status);
|
|
449
|
-
}
|
|
450
|
-
function At({
|
|
451
|
-
enrollPage: t,
|
|
452
|
-
requestBody: e,
|
|
453
|
-
responseData: n,
|
|
454
|
-
appointmentData: r,
|
|
455
|
-
occurredAt: o = (/* @__PURE__ */ new Date()).toISOString()
|
|
456
|
-
}) {
|
|
457
|
-
const s = f(n), i = u(s == null ? void 0 : s.appointmentId) || u(e == null ? void 0 : e.appointmentId), a = mt(n);
|
|
458
|
-
if (!i || !a) return null;
|
|
459
|
-
const _ = u(e == null ? void 0 : e.questionnaireResponseId) || u(r == null ? void 0 : r.questionnaireResponseId), h = ft(n), c = d(t);
|
|
460
|
-
return {
|
|
461
|
-
event: C,
|
|
462
|
-
occurredAt: o,
|
|
463
|
-
enrollPage: {
|
|
464
|
-
id: t.id,
|
|
465
|
-
slug: c,
|
|
466
|
-
slugs: E(t)
|
|
467
|
-
},
|
|
468
|
-
appointment: { id: i },
|
|
469
|
-
appointmentId: i,
|
|
470
|
-
..._ ? { questionnaireResponseId: _ } : {},
|
|
471
|
-
junctionOrder: {
|
|
472
|
-
id: a,
|
|
473
|
-
status: h || null
|
|
474
|
-
},
|
|
475
|
-
junctionOrderId: a,
|
|
476
|
-
junctionStatus: h || null
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
async function Rt({
|
|
480
|
-
apiKey: t,
|
|
481
|
-
fetchImpl: e,
|
|
482
|
-
signal: n,
|
|
483
|
-
...r
|
|
484
|
-
}) {
|
|
485
|
-
const o = At(r);
|
|
486
|
-
if (!o) return null;
|
|
487
|
-
const s = typeof o.questionnaireResponseId == "string" ? o.questionnaireResponseId : "", i = typeof o.appointmentId == "string" ? o.appointmentId : "", a = typeof o.junctionOrderId == "string" ? o.junctionOrderId : "";
|
|
488
|
-
return R({
|
|
489
|
-
apiKey: t,
|
|
490
|
-
kind: "stealth_health_junction",
|
|
491
|
-
body: o,
|
|
492
|
-
headers: {
|
|
493
|
-
"User-Agent": "StealthHealth-EnrollWebhook/1.0",
|
|
494
|
-
"X-StealthHealth-Event": C,
|
|
495
|
-
...d(r.enrollPage) ? { "X-StealthHealth-Enroll-Slug": d(r.enrollPage) } : {},
|
|
496
|
-
"X-StealthHealth-Appointment-Id": i,
|
|
497
|
-
"X-StealthHealth-Junction-Order-Id": a,
|
|
498
|
-
...s ? { "X-StealthHealth-Questionnaire-Response-Id": s } : {}
|
|
499
|
-
},
|
|
500
|
-
fetchImpl: e,
|
|
501
|
-
signal: n
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
export {
|
|
505
|
-
ft as A,
|
|
506
|
-
It as B,
|
|
507
|
-
yt as C,
|
|
508
|
-
Y as M,
|
|
509
|
-
B as S,
|
|
510
|
-
Q as a,
|
|
511
|
-
z as b,
|
|
512
|
-
W as c,
|
|
513
|
-
v as d,
|
|
514
|
-
L as e,
|
|
515
|
-
y as f,
|
|
516
|
-
et as g,
|
|
517
|
-
C as h,
|
|
518
|
-
Et as i,
|
|
519
|
-
st as j,
|
|
520
|
-
lt as k,
|
|
521
|
-
pt as l,
|
|
522
|
-
At as m,
|
|
523
|
-
Tt as n,
|
|
524
|
-
R as o,
|
|
525
|
-
Lt as p,
|
|
526
|
-
Rt as q,
|
|
527
|
-
gt as r,
|
|
528
|
-
it as s,
|
|
529
|
-
P as t,
|
|
530
|
-
ct as u,
|
|
531
|
-
bt as v,
|
|
532
|
-
Z as w,
|
|
533
|
-
ut as x,
|
|
534
|
-
tt as y,
|
|
535
|
-
mt as z
|
|
536
|
-
};
|