@photonhealth/client 2.0.0-rc.3 → 2.0.0-rc.4
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/README.md +3 -1
- package/dist/api/orders.d.ts +21 -0
- package/dist/api/orders.d.ts.map +1 -1
- package/dist/gql/gql.d.ts +1 -1
- package/dist/gql/gql.d.ts.map +1 -1
- package/dist/gql/gql.js +1 -1
- package/dist/gql/gql.js.map +1 -1
- package/dist/gql/graphql.d.ts +336 -1
- package/dist/gql/graphql.d.ts.map +1 -1
- package/dist/gql/graphql.js +75 -0
- package/dist/gql/graphql.js.map +1 -1
- package/dist/meta/version.js +1 -1
- package/dist/photon/map.d.ts.map +1 -1
- package/dist/photon/map.js +13 -11
- package/dist/photon/map.js.map +1 -1
- package/dist/photon/types.d.ts +10 -2
- package/dist/photon/types.d.ts.map +1 -1
- package/dist/testing/fixtures.d.ts +26 -0
- package/dist/testing/fixtures.d.ts.map +1 -1
- package/dist/testing/fixtures.js +6 -0
- package/dist/testing/fixtures.js.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/src/gql/gql.ts +3 -3
- package/src/gql/graphql.ts +523 -111
- package/src/meta/version.ts +1 -1
- package/src/operations/fragments.graphql +3 -0
- package/src/photon/map.ts +14 -11
- package/src/photon/types.ts +11 -2
- package/src/testing/fixtures.ts +12 -0
- package/src/testing.ts +1 -0
package/src/meta/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const clientVersion: string = "0.
|
|
1
|
+
export const clientVersion: string = "0.15.0";
|
package/src/photon/map.ts
CHANGED
|
@@ -38,17 +38,20 @@ import type {
|
|
|
38
38
|
* so a schema change stops here (and typecheck says where).
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
const redemptionMethod = (m: RedemptionMethodFieldsFragment): RedemptionMethod =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
/** Tagged by `type`, so a new member of the union doesn't change how callers switch. */
|
|
42
|
+
const redemptionMethod = (m: RedemptionMethodFieldsFragment): RedemptionMethod =>
|
|
43
|
+
m.__typename === "ProgramEnrollmentLink"
|
|
44
|
+
? { type: "enrollmentLink", url: m.url }
|
|
45
|
+
: {
|
|
46
|
+
type: "discountCard",
|
|
47
|
+
id: m.id,
|
|
48
|
+
prescriptionId: m.prescriptionId,
|
|
49
|
+
bin: m.bin,
|
|
50
|
+
pcn: m.pcn,
|
|
51
|
+
group: m.group,
|
|
52
|
+
memberId: m.memberId,
|
|
53
|
+
externalUrl: m.externalUrl,
|
|
54
|
+
};
|
|
52
55
|
|
|
53
56
|
const offer = (o: PharmacyOfferFieldsFragment): PharmacyOffer => ({
|
|
54
57
|
source: o.source,
|
package/src/photon/types.ts
CHANGED
|
@@ -119,8 +119,11 @@ export interface OfferDeliveryEstimate {
|
|
|
119
119
|
*/
|
|
120
120
|
export type RedemptionState = "SETTLED" | "PENDING" | "SKIPPED";
|
|
121
121
|
|
|
122
|
-
/**
|
|
123
|
-
|
|
122
|
+
/**
|
|
123
|
+
* What the patient presents or follows to redeem an offer, tagged by `type`. A PharmacyBenefitCard for the
|
|
124
|
+
* patient's own insurance is the expected next member.
|
|
125
|
+
*/
|
|
126
|
+
export type RedemptionMethod = PharmacyDiscountCard | ProgramEnrollmentLink;
|
|
124
127
|
|
|
125
128
|
/** A cash discount card — a GoodRx or RxSense coupon, read out at the counter or claimed on `externalUrl`. */
|
|
126
129
|
export interface PharmacyDiscountCard {
|
|
@@ -138,6 +141,12 @@ export interface PharmacyDiscountCard {
|
|
|
138
141
|
externalUrl: string | null;
|
|
139
142
|
}
|
|
140
143
|
|
|
144
|
+
/** A link where the patient enrolls in a partner program to get the program's offer. */
|
|
145
|
+
export interface ProgramEnrollmentLink {
|
|
146
|
+
type: "enrollmentLink";
|
|
147
|
+
url: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
141
150
|
/** An order's offers, split by whether they depend on the pharmacy it's routed to. */
|
|
142
151
|
export interface OrderOffers {
|
|
143
152
|
/** null until a pharmacy is chosen; `[]` when one is chosen but no offer applies. */
|
package/src/testing/fixtures.ts
CHANGED
|
@@ -70,6 +70,18 @@ export const discountCard = (overrides: Partial<PharmacyDiscountCard> = {}): Pha
|
|
|
70
70
|
...overrides,
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
+
type ProgramEnrollmentLink = Extract<
|
|
74
|
+
PharmacyOffer["redemptionMethods"][number],
|
|
75
|
+
{ __typename: "ProgramEnrollmentLink" }
|
|
76
|
+
>;
|
|
77
|
+
|
|
78
|
+
/** A partner program's enrollment link, as an offer's redemption method. Pair it with `redemptionState: "SETTLED"`. */
|
|
79
|
+
export const enrollmentLink = (overrides: Partial<ProgramEnrollmentLink> = {}): ProgramEnrollmentLink => ({
|
|
80
|
+
__typename: "ProgramEnrollmentLink",
|
|
81
|
+
url: "https://example.test/enroll",
|
|
82
|
+
...overrides,
|
|
83
|
+
});
|
|
84
|
+
|
|
73
85
|
export const pharmacy = (overrides: Partial<Pharmacy> = {}): Pharmacy => ({
|
|
74
86
|
__typename: "Pharmacy",
|
|
75
87
|
id: "phr_1",
|