@apextelemed/partner-core 0.19.0-dev.61 → 0.19.0-dev.62
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/api/index.d.ts +23 -2
- package/dist/api/index.js +4 -4
- package/dist/api/index.jsx +8 -4
- package/dist/chunk/{CDRUVUTJ.js → 22EFLJGO.js} +18 -8
- package/dist/chunk/22EFLJGO.js.map +1 -0
- package/dist/chunk/{EED3KNR7.jsx → 2Q4GK4WD.jsx} +41 -3
- package/dist/chunk/{GJSE37VN.js → BPF2SSKF.js} +3 -3
- package/dist/chunk/{GJSE37VN.js.map → BPF2SSKF.js.map} +1 -1
- package/dist/chunk/{OOMMZESR.js → CED3IYWX.js} +40 -4
- package/dist/chunk/CED3IYWX.js.map +1 -0
- package/dist/chunk/ESNAWOHG.jsx +1 -0
- package/dist/chunk/{OZHJ5IGL.jsx → FL3DS5WN.jsx} +370 -131
- package/dist/chunk/{UZ2K7HBG.js → GSYL4J57.js} +1828 -800
- package/dist/chunk/GSYL4J57.js.map +1 -0
- package/dist/chunk/{33BDC6MT.jsx → GULO22W6.jsx} +2 -2
- package/dist/chunk/{HEQLEGHI.js → GYAT2X65.js} +43 -3
- package/dist/chunk/GYAT2X65.js.map +1 -0
- package/dist/chunk/{LA6F37YV.jsx → I7L5WVA2.jsx} +20 -7
- package/dist/chunk/{X6WJQ47H.jsx → PWEK34Q4.jsx} +42 -2
- package/dist/chunk/{TFJKTKZ3.jsx → U5DE7VZP.jsx} +2350 -1670
- package/dist/chunk/{WTHAR2P2.js → UM5K75Y4.js} +3 -3
- package/dist/chunk/{WTHAR2P2.js.map → UM5K75Y4.js.map} +1 -1
- package/dist/chunk/{ZWAZNB4Y.jsx → W5QWCMTE.jsx} +2 -2
- package/dist/chunk/{VGF2LLAD.js → XPYBZU45.js} +240 -14
- package/dist/chunk/XPYBZU45.js.map +1 -0
- package/dist/chunk/XZVVZIRZ.js +3 -0
- package/dist/chunk/XZVVZIRZ.js.map +1 -0
- package/dist/{client-CMbSYUam.d.ts → client-BQ8AEx5S.d.ts} +155 -2
- package/dist/flows/index.d.ts +113 -2
- package/dist/flows/index.js +6 -6
- package/dist/flows/index.jsx +14 -6
- package/dist/index/index.d.ts +26 -5
- package/dist/index/index.js +8 -8
- package/dist/index/index.jsx +22 -8
- package/dist/pages/index.d.ts +2 -2
- package/dist/pages/index.js +5 -5
- package/dist/pages/index.jsx +5 -5
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.js +2 -2
- package/dist/stores/index.jsx +2 -2
- package/dist/theme/member-portal.css +43 -0
- package/package.json +1 -1
- package/dist/chunk/ACE7M2YA.jsx +0 -1
- package/dist/chunk/CDRUVUTJ.js.map +0 -1
- package/dist/chunk/HEQLEGHI.js.map +0 -1
- package/dist/chunk/JSHO46VZ.js +0 -3
- package/dist/chunk/JSHO46VZ.js.map +0 -1
- package/dist/chunk/OOMMZESR.js.map +0 -1
- package/dist/chunk/UZ2K7HBG.js.map +0 -1
- package/dist/chunk/VGF2LLAD.js.map +0 -1
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
readPromoCode,
|
|
9
9
|
resetCartId,
|
|
10
10
|
stripCartToken
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./GULO22W6.jsx";
|
|
12
12
|
import {
|
|
13
|
+
PHONE_ERROR,
|
|
13
14
|
bestOfferDiscount,
|
|
14
15
|
catalogUnavailableMessage,
|
|
15
16
|
firstAddressError,
|
|
@@ -17,16 +18,18 @@ import {
|
|
|
17
18
|
formatCvv,
|
|
18
19
|
formatExpiry,
|
|
19
20
|
isLive,
|
|
21
|
+
isValidUsPhone,
|
|
20
22
|
offerBeatsPromo,
|
|
21
23
|
useAddressPair,
|
|
22
24
|
useCardTokenizer,
|
|
23
25
|
useCatalogAvailability,
|
|
26
|
+
useSmsConsent,
|
|
24
27
|
validateAddress
|
|
25
|
-
} from "./
|
|
28
|
+
} from "./FL3DS5WN.jsx";
|
|
26
29
|
import {
|
|
27
30
|
auth_default,
|
|
28
31
|
cart_default
|
|
29
|
-
} from "./
|
|
32
|
+
} from "./W5QWCMTE.jsx";
|
|
30
33
|
import {
|
|
31
34
|
ApiError,
|
|
32
35
|
newIdempotencyKey,
|
|
@@ -34,7 +37,7 @@ import {
|
|
|
34
37
|
promoCodesApi,
|
|
35
38
|
subscriptionsApi,
|
|
36
39
|
usersApi
|
|
37
|
-
} from "./
|
|
40
|
+
} from "./PWEK34Q4.jsx";
|
|
38
41
|
import {
|
|
39
42
|
getConfig
|
|
40
43
|
} from "./QVZ7BRNO.jsx";
|
|
@@ -88,6 +91,7 @@ function useSubscriptionIntakeFlow(options) {
|
|
|
88
91
|
const [password, setPassword] = createSignal("");
|
|
89
92
|
const [dateOfBirth, setDateOfBirth] = createSignal(restored.dateOfBirth ?? "");
|
|
90
93
|
const [phone, setPhone] = createSignal(restored.phone ?? "");
|
|
94
|
+
const smsConsent = useSmsConsent(phone, restored.smsConsentVersion);
|
|
91
95
|
const addr = useAddressPair({
|
|
92
96
|
initialShipping: {
|
|
93
97
|
street: restored.street ?? "",
|
|
@@ -145,6 +149,7 @@ function useSubscriptionIntakeFlow(options) {
|
|
|
145
149
|
city: city(),
|
|
146
150
|
state: state(),
|
|
147
151
|
zip: zip(),
|
|
152
|
+
smsConsentVersion: smsConsent.draftVersion(),
|
|
148
153
|
idempotencyKey: idemKey() || void 0
|
|
149
154
|
});
|
|
150
155
|
});
|
|
@@ -278,6 +283,7 @@ function useSubscriptionIntakeFlow(options) {
|
|
|
278
283
|
const age = (Date.now() - dob.getTime()) / (365.25 * 24 * 3600 * 1e3);
|
|
279
284
|
if (age < 18) return "You must be at least 18 to register.";
|
|
280
285
|
if (age > 120) return "Enter a valid date of birth.";
|
|
286
|
+
if (phone().trim() && !isValidUsPhone(phone())) return PHONE_ERROR;
|
|
281
287
|
} else if (s === 1) {
|
|
282
288
|
return firstAddressError(validateAddress(addr.shipping(), "", { enforceAvailability: true }));
|
|
283
289
|
} else if (s === 2) {
|
|
@@ -358,6 +364,7 @@ function useSubscriptionIntakeFlow(options) {
|
|
|
358
364
|
}
|
|
359
365
|
try {
|
|
360
366
|
const promo = promoApplied();
|
|
367
|
+
const smsGrant = smsConsent.grant();
|
|
361
368
|
if (auth_default.isAuthenticated()) {
|
|
362
369
|
await usersApi.updateProfile({
|
|
363
370
|
firstName: firstName().trim(),
|
|
@@ -367,7 +374,11 @@ function useSubscriptionIntakeFlow(options) {
|
|
|
367
374
|
address1: street().trim(),
|
|
368
375
|
city: city().trim(),
|
|
369
376
|
state: state(),
|
|
370
|
-
zip: zip().trim()
|
|
377
|
+
zip: zip().trim(),
|
|
378
|
+
// Same PATCH as the phone, so the server applies the number first and
|
|
379
|
+
// the grant covers it. Alongside other fields a refused grant is a
|
|
380
|
+
// note in the reply, never a failed intake.
|
|
381
|
+
...smsGrant ? { smsConsent: { ...smsGrant, source: "intake" } } : {}
|
|
371
382
|
});
|
|
372
383
|
const res = await subscriptionsApi.create({
|
|
373
384
|
opaqueData: opaque,
|
|
@@ -422,7 +433,8 @@ function useSubscriptionIntakeFlow(options) {
|
|
|
422
433
|
v2SurveyResponseId: options.surveyResult.v2SurveyResponseId,
|
|
423
434
|
caseNotes: options.surveyResult.caseNotes,
|
|
424
435
|
promoCode: promo?.valid ? promo.promoCode?.code : void 0,
|
|
425
|
-
...savingsMemberId ? { savingsMemberId } : {}
|
|
436
|
+
...savingsMemberId ? { savingsMemberId } : {},
|
|
437
|
+
...smsGrant ? { smsConsent: smsGrant } : {}
|
|
426
438
|
}, { idempotencyKey });
|
|
427
439
|
}
|
|
428
440
|
clearDraft();
|
|
@@ -466,6 +478,7 @@ function useSubscriptionIntakeFlow(options) {
|
|
|
466
478
|
setDateOfBirth,
|
|
467
479
|
phone,
|
|
468
480
|
setPhone,
|
|
481
|
+
smsConsent,
|
|
469
482
|
address: addr,
|
|
470
483
|
availability,
|
|
471
484
|
cardNumber: cardNumberRaw,
|
|
@@ -648,4 +661,4 @@ export {
|
|
|
648
661
|
restoreCartFromLink,
|
|
649
662
|
startCartCapture
|
|
650
663
|
};
|
|
651
|
-
//# sourceMappingURL=
|
|
664
|
+
//# sourceMappingURL=I7L5WVA2.jsx.map
|
|
@@ -292,6 +292,9 @@ var ApiError = class extends Error {
|
|
|
292
292
|
/** The response body's `details`, untouched, for the few refusals whose
|
|
293
293
|
* specifics a caller acts on (e.g. which prices are missing). Never shown as prose. */
|
|
294
294
|
details;
|
|
295
|
+
/** The response body's `reason`, when the endpoint names why it refused (e.g.
|
|
296
|
+
* `stale_text` on a text-message consent). Branch on this, never on message. */
|
|
297
|
+
reason;
|
|
295
298
|
constructor(message, opts = {}) {
|
|
296
299
|
super(message);
|
|
297
300
|
this.name = "ApiError";
|
|
@@ -299,6 +302,7 @@ var ApiError = class extends Error {
|
|
|
299
302
|
this.ambiguous = opts.ambiguous ?? false;
|
|
300
303
|
this.code = opts.code;
|
|
301
304
|
this.details = opts.details;
|
|
305
|
+
this.reason = opts.reason;
|
|
302
306
|
if (opts.cause !== void 0) this.cause = opts.cause;
|
|
303
307
|
}
|
|
304
308
|
};
|
|
@@ -376,11 +380,13 @@ async function coreFetch(endpoint, fetchOpts, track, call = {}) {
|
|
|
376
380
|
let errorMsg = `Request failed: ${res.status}`;
|
|
377
381
|
let errorCode;
|
|
378
382
|
let errorDetails;
|
|
383
|
+
let errorReason;
|
|
379
384
|
try {
|
|
380
385
|
const body = await res.json();
|
|
381
386
|
errorMsg = body.error || body.message || errorMsg;
|
|
382
387
|
errorCode = typeof body.code === "string" ? body.code : void 0;
|
|
383
388
|
errorDetails = body.details;
|
|
389
|
+
errorReason = typeof body.reason === "string" ? body.reason : void 0;
|
|
384
390
|
if (track.enrichErrorDetails && Array.isArray(body.details) && body.details.length > 0) {
|
|
385
391
|
const lines = body.details.map(
|
|
386
392
|
(d) => typeof d === "string" ? d : d?.message
|
|
@@ -396,7 +402,8 @@ async function coreFetch(endpoint, fetchOpts, track, call = {}) {
|
|
|
396
402
|
status: res.status,
|
|
397
403
|
ambiguous: res.status >= 500,
|
|
398
404
|
code: errorCode,
|
|
399
|
-
...errorDetails !== void 0 ? { details: errorDetails } : {}
|
|
405
|
+
...errorDetails !== void 0 ? { details: errorDetails } : {},
|
|
406
|
+
...errorReason !== void 0 ? { reason: errorReason } : {}
|
|
400
407
|
});
|
|
401
408
|
}
|
|
402
409
|
if (res.status === 204) return void 0;
|
|
@@ -835,6 +842,13 @@ var usersApi = {
|
|
|
835
842
|
},
|
|
836
843
|
updateProfile(payload) {
|
|
837
844
|
return patch("/users/me", payload);
|
|
845
|
+
},
|
|
846
|
+
getSmsState() {
|
|
847
|
+
return apiFetch("/users/me/sms");
|
|
848
|
+
},
|
|
849
|
+
/** Only the named events change; the reply is the full state again. */
|
|
850
|
+
setSmsEvents(events) {
|
|
851
|
+
return put("/users/me/sms/preferences", { events });
|
|
838
852
|
}
|
|
839
853
|
};
|
|
840
854
|
var membersApi = {
|
|
@@ -1140,6 +1154,32 @@ var adminApi = {
|
|
|
1140
1154
|
note ? { note } : {}
|
|
1141
1155
|
);
|
|
1142
1156
|
},
|
|
1157
|
+
// ── Text messages (settings.write / emailTemplates.write / patient.support) ──
|
|
1158
|
+
/** Is this site set up to text customers, and from what number. Needs `settings.write`. */
|
|
1159
|
+
getSmsSettings() {
|
|
1160
|
+
return apiFetch("/admin/sms/settings");
|
|
1161
|
+
},
|
|
1162
|
+
/** Every event's text, as saved. Needs `emailTemplates.write`. */
|
|
1163
|
+
getSmsTemplates() {
|
|
1164
|
+
return apiFetch("/admin/sms/templates");
|
|
1165
|
+
},
|
|
1166
|
+
/**
|
|
1167
|
+
* Change some events' texts. Send ONLY what changed: a missing event or field
|
|
1168
|
+
* is kept, `null` resets to the default. Rejects (400) with the server's
|
|
1169
|
+
* reason when a body doesn't start with `{{siteName}}`, runs past 300
|
|
1170
|
+
* characters, or uses a token the event doesn't have. Returns the full list.
|
|
1171
|
+
*/
|
|
1172
|
+
saveSmsTemplates(templates) {
|
|
1173
|
+
return put("/admin/sms/templates", { templates });
|
|
1174
|
+
},
|
|
1175
|
+
/** Text the SAVED version of an event to the signed-in admin's own phone. */
|
|
1176
|
+
sendSmsTemplateTest(key) {
|
|
1177
|
+
return post(`/admin/sms/templates/${encodeURIComponent(key)}/test`);
|
|
1178
|
+
},
|
|
1179
|
+
/** The send log, newest first. Needs `patient.support`. Page with `nextBefore`. */
|
|
1180
|
+
listSmsMessages(params) {
|
|
1181
|
+
return apiFetch(`/admin/sms/messages${qs(params)}`);
|
|
1182
|
+
},
|
|
1143
1183
|
getEmailNotifications() {
|
|
1144
1184
|
return apiFetch("/admin/settings/email-notifications");
|
|
1145
1185
|
},
|
|
@@ -1605,4 +1645,4 @@ export {
|
|
|
1605
1645
|
clearAffiliateTokens,
|
|
1606
1646
|
affiliatePortalApi
|
|
1607
1647
|
};
|
|
1608
|
-
//# sourceMappingURL=
|
|
1648
|
+
//# sourceMappingURL=PWEK34Q4.jsx.map
|