@msm-platform/customer-react 0.4.2 → 0.4.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/CHANGELOG.md +26 -0
- package/README.md +32 -20
- package/dist/account.d.ts +3 -0
- package/dist/booking-flow.d.ts +20 -0
- package/dist/booking.d.ts +9 -0
- package/dist/client.d.ts +7 -3
- package/dist/context.d.ts +2 -0
- package/dist/formats.d.ts +17 -0
- package/dist/i18n.d.ts +90 -20
- package/dist/i18n.is.d.ts +2 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +2337 -1079
- package/dist/pay.d.ts +125 -0
- package/dist/payment-tab.d.ts +22 -0
- package/dist/portal.d.ts +8 -2
- package/dist/refusals.d.ts +14 -0
- package/dist/screens/business.d.ts +48 -1
- package/dist/screens/shop.d.ts +14 -0
- package/dist/server/index.d.ts +15 -0
- package/dist/server/session.d.ts +24 -0
- package/dist/server.js +139 -106
- package/dist/sign-in-standalone.d.ts +3 -0
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/pay.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type paths } from "@msm-platform/customer-sdk";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type MessageKey, type MsmLocale } from "./i18n";
|
|
4
|
+
/** #544: a payment method the business shows online, in its order. */
|
|
5
|
+
export type MsmPaymentMethod = paths["/web/businesses/{businessId}/payment-methods"]["get"]["responses"][200]["content"]["application/json"]["items"][number];
|
|
6
|
+
/**
|
|
7
|
+
* How paying for a held reservation ended: booked, the hold released
|
|
8
|
+
* unpaid (or lapsed), or paid after the time was taken, for the business
|
|
9
|
+
* to settle with the customer.
|
|
10
|
+
*/
|
|
11
|
+
export type MsmPayResult = {
|
|
12
|
+
status: "confirmed";
|
|
13
|
+
bookingId: string;
|
|
14
|
+
} | {
|
|
15
|
+
status: "released";
|
|
16
|
+
} | {
|
|
17
|
+
status: "unconfirmed_paid";
|
|
18
|
+
};
|
|
19
|
+
export interface MsmPayButtonsProps {
|
|
20
|
+
/** Where the server half is mounted, as for MsmCustomer. */
|
|
21
|
+
basePath: string;
|
|
22
|
+
businessId: string;
|
|
23
|
+
/** The signed-in customer's held reservation of a priced time. */
|
|
24
|
+
reservationId: string;
|
|
25
|
+
/** Called once with how paying ended. */
|
|
26
|
+
onResult: (result: MsmPayResult) => void;
|
|
27
|
+
/**
|
|
28
|
+
* #228: called just before this page goes to the provider's page. Keep
|
|
29
|
+
* what you need to show this reservation's pay piece again: the provider
|
|
30
|
+
* sends the customer back to this page with `msmCheckout` in its query,
|
|
31
|
+
* which the piece removes, and it resumes the checkout from there.
|
|
32
|
+
*/
|
|
33
|
+
onLeave?: (() => void) | undefined;
|
|
34
|
+
/** MsmPayButtons' language, as for MsmCustomer; `useMsmPayment` has no copy. */
|
|
35
|
+
locale?: MsmLocale;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* What the pay piece shows: the methods to pay with, the wait while a
|
|
39
|
+
* payment is read, a payment left unfinished, a refusal, or how it ended.
|
|
40
|
+
* `tab` is a payment tab the provider sent back, which only says to go
|
|
41
|
+
* back (`pay.tabDone`).
|
|
42
|
+
*/
|
|
43
|
+
export type MsmPaymentState = {
|
|
44
|
+
phase: "loading";
|
|
45
|
+
} | {
|
|
46
|
+
phase: "choose";
|
|
47
|
+
methods: MsmPaymentMethod[];
|
|
48
|
+
/** While a payment page is being opened. */
|
|
49
|
+
paying: boolean;
|
|
50
|
+
notice?: MessageKey | undefined;
|
|
51
|
+
} | {
|
|
52
|
+
phase: "checking";
|
|
53
|
+
} | {
|
|
54
|
+
/** #333: paying in a tab of its own while this page reads the payment. */
|
|
55
|
+
phase: "away";
|
|
56
|
+
holdUntil: string;
|
|
57
|
+
redirectUrl: string;
|
|
58
|
+
/** Whether the tab opened; else the customer opens `redirectUrl`. */
|
|
59
|
+
opened: boolean;
|
|
60
|
+
} | {
|
|
61
|
+
phase: "unfinished";
|
|
62
|
+
holdUntil: string;
|
|
63
|
+
redirectUrl: string | null;
|
|
64
|
+
/** Whether `redirectUrl` opens in a tab of its own. */
|
|
65
|
+
newTab: boolean;
|
|
66
|
+
} | {
|
|
67
|
+
phase: "refused";
|
|
68
|
+
message: MessageKey;
|
|
69
|
+
/** When a ban ends, as an instant: the message's `{date}`. */
|
|
70
|
+
until?: string;
|
|
71
|
+
} | {
|
|
72
|
+
phase: "done";
|
|
73
|
+
result: MsmPayResult;
|
|
74
|
+
message: MessageKey;
|
|
75
|
+
} | {
|
|
76
|
+
phase: "tab";
|
|
77
|
+
};
|
|
78
|
+
export interface MsmPayment {
|
|
79
|
+
state: MsmPaymentState;
|
|
80
|
+
/**
|
|
81
|
+
* Pays the reservation through `method`, leaving for its provider's page
|
|
82
|
+
* or opening it in a tab of its own; without a method, a time with no
|
|
83
|
+
* advance is confirmed at once.
|
|
84
|
+
*/
|
|
85
|
+
pay: (method?: MsmPaymentMethod) => void;
|
|
86
|
+
/** Call on a click of an unfinished payment's `redirectUrl`. */
|
|
87
|
+
payAgain: () => void;
|
|
88
|
+
}
|
|
89
|
+
/** Whether this page came back from a provider's payment page. */
|
|
90
|
+
export declare function cameBackFromCheckout(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Pays for a held reservation: lists the business's online payment methods,
|
|
93
|
+
* starts the checkout, and reads it until it ends, back from the provider's
|
|
94
|
+
* page or, with a session in this page's memory, while the customer pays in
|
|
95
|
+
* a tab of its own. Reports how it ended once. A new reservation starts
|
|
96
|
+
* over. Inside one of the package's components it uses that component's
|
|
97
|
+
* client; on its own, the session on `basePath`.
|
|
98
|
+
*/
|
|
99
|
+
export declare function useMsmPayment(props: MsmPayButtonsProps): MsmPayment;
|
|
100
|
+
/**
|
|
101
|
+
* The pay piece inside the package's components: `useMsmPayment`'s state
|
|
102
|
+
* in the package's words, with the host step's `terms` above the methods,
|
|
103
|
+
* its `actions` beside them, and `free` for a time with no advance, which
|
|
104
|
+
* books with Confirm booking.
|
|
105
|
+
*/
|
|
106
|
+
export declare function PayButtons(props: {
|
|
107
|
+
businessId: string;
|
|
108
|
+
reservationId: string;
|
|
109
|
+
onResult: (result: MsmPayResult) => void;
|
|
110
|
+
onLeave?: (() => void) | undefined;
|
|
111
|
+
/** The business's timezone, when the host step knows it. */
|
|
112
|
+
timeZone?: string | undefined;
|
|
113
|
+
free?: boolean | undefined;
|
|
114
|
+
terms?: ReactNode;
|
|
115
|
+
actions?: ReactNode;
|
|
116
|
+
}): import("react").JSX.Element;
|
|
117
|
+
/**
|
|
118
|
+
* The "Pay with …" buttons for a reservation the host already holds for
|
|
119
|
+
* the signed-in customer, such as from its own class panel: the business's
|
|
120
|
+
* online payment methods in its order, then the provider's page and the
|
|
121
|
+
* result, as MsmBooking pays. With a cookieless server half the provider's
|
|
122
|
+
* page opens in a tab of its own; the provider sends that tab back to this
|
|
123
|
+
* page with `msmTab`, where the package's components only say to go back.
|
|
124
|
+
*/
|
|
125
|
+
export declare function MsmPayButtons(props: MsmPayButtonsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tab, opened at once on the customer's click so no popup blocker
|
|
3
|
+
* stops it, with `window` null when the browser refused one anyway; or
|
|
4
|
+
* undefined when this page itself may go to the provider.
|
|
5
|
+
*/
|
|
6
|
+
export type PaymentTab = {
|
|
7
|
+
window: Window | null;
|
|
8
|
+
} | undefined;
|
|
9
|
+
export declare function openPaymentTab(basePath: string): PaymentTab;
|
|
10
|
+
/** Sends the tab, or without one this page, to the provider's page. */
|
|
11
|
+
export declare function goToProvider(tab: PaymentTab, redirect: string): void;
|
|
12
|
+
/** Closes a tab that will not go to a provider after all. */
|
|
13
|
+
export declare function closePaymentTab(tab: PaymentTab): void;
|
|
14
|
+
/** This page's URL with the return marker, for the provider to send the customer back to. */
|
|
15
|
+
export declare function returnUrl(param: string, outcome: string, tab: PaymentTab): string;
|
|
16
|
+
/** Whether this page is a payment tab the provider sent back. */
|
|
17
|
+
export declare function isPaymentTabReturn(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Waits `ms`, or less when the page is shown again, as when the customer
|
|
20
|
+
* comes back from the payment tab to a page whose timers the browser slowed.
|
|
21
|
+
*/
|
|
22
|
+
export declare function pause(ms: number): Promise<void>;
|
package/dist/portal.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type CustomerScreen, type Portal } from "./context";
|
|
3
|
+
import { type MsmLocale } from "./i18n";
|
|
3
4
|
/**
|
|
4
5
|
* What every screen component shares: the session on `basePath`, the
|
|
5
6
|
* client, the partner's public businesses and sign-out, as the `Portal`
|
|
@@ -14,13 +15,18 @@ export declare function useCustomerPortal(options: {
|
|
|
14
15
|
}): {
|
|
15
16
|
basePath: string;
|
|
16
17
|
sessionKey: import("./session").SessionState;
|
|
17
|
-
notice: "app.loading" | "app.loadFailed" | "app.retry" | "app.signedOut" | "app.signedOutEverywhere" | "image.logo" | "nav.label" | "nav.book" | "nav.signIn" | "nav.bookings" | "nav.passes" | "nav.details" | "nav.signOut" | "signIn.heading" | "signIn.intro" | "register.intro" | "register.name" | "signIn.phone" | "signIn.codeSent" | "signIn.code" | "signIn.sendCode" | "signIn.submit" | "register.submit" | "signIn.wait" | "signIn.differentNumber" | "signIn.cancel" | "signIn.error.tooMany" | "signIn.error.tooManyLater" | "signIn.error.paused" | "signIn.error.pausedLater" | "signIn.error.destination" | "signIn.error.badCode" | "register.error.expired" | "register.error.name" | "signIn.error.invalid" | "signIn.error.refused" | "signIn.error.unreachable" | "signIn.error.failed" | "signIn.error.botCheck" | "signIn.error.botCheckUnavailable" | "signIn.error.notConfigured" | "wait.seconds.one" | "wait.seconds.other" | "wait.minutes.one" | "wait.minutes.other" | "wait.hours.one" | "wait.hours.other" | "bookings.heading" | "bookings.period" | "bookings.upcoming" | "bookings.past" | "bookings.emptyUpcoming" | "bookings.emptyPast" | "bookings.more" | "bookings.when" | "bookings.cancelled" | "bookings.cancelledLate" | "bookings.attended" | "bookings.noShow" | "bookings.lateFrom" | "bookings.started" | "bookings.cancel" | "bookings.confirmHeading" | "bookings.confirmLate" | "bookings.confirmCredit" | "bookings.confirm" | "bookings.keep" | "bookings.cancelling" | "bookings.doneOnTime" | "bookings.doneLate" | "bookings.cancelFailed" | "bookings.gone" | "businesses.heading" | "businesses.intro" | "businesses.empty" | "businesses.open" | "business.all" | "business.notFound" | "business.types" | "business.allTypes" | "business.resources" | "business.anyResource" | "business.typeMissing" | "business.minutes" | "business.week" | "business.previousWeek" | "business.nextWeek" | "business.weekOf" | "business.empty" | "business.seatsLeft.one" | "business.seatsLeft.other" | "business.full" | "business.openTime" | "business.with" | "business.book" | "book.heading" | "book.signInFirst" | "book.back" | "book.reserving" | "book.heldUntil" | "book.confirm" | "book.confirming" | "book.booked" | "book.toBookings" | "book.done" | "book.close" | "book.chooseType" | "book.noTypes" | "book.seeAll" | "book.chooseResource" | "book.anyResource" | "book.anyResourceHint" | "book.toTypes" | "book.otherResource" | "book.reserveAgain" | "book.full" | "book.slotTaken" | "book.limit" | "book.expired" | "book.notAllowed" | "book.unavailable" | "book.banned" | "book.banned.undated" | "book.refused" | "book.failed" | "passes.heading" | "passes.empty" | "passes.unlimited" | "passes.credits" | "passes.validFrom" | "passes.validRange" | "passes.expired" | "details.heading" | "details.name" | "details.phone" | "details.email" | "details.none" | "details.readOnly" | "details.save" | "details.saving" | "details.saved" | "details.saveFailed" | "details.signOutEverywhere" | "details.signOutEverywhereHint" | "details.signOutEverywhereFailed" | undefined;
|
|
18
|
+
notice: "app.loading" | "app.loadFailed" | "app.retry" | "app.signedOut" | "app.signedOutEverywhere" | "image.logo" | "nav.label" | "nav.book" | "nav.signIn" | "nav.bookings" | "nav.passes" | "nav.details" | "nav.signOut" | "signIn.heading" | "signIn.intro" | "register.intro" | "register.name" | "signIn.phone" | "signIn.codeSent" | "signIn.code" | "signIn.sendCode" | "signIn.submit" | "register.submit" | "signIn.wait" | "signIn.differentNumber" | "signIn.cancel" | "signIn.error.tooMany" | "signIn.error.tooManyLater" | "signIn.error.paused" | "signIn.error.pausedLater" | "signIn.error.destination" | "signIn.error.badCode" | "register.error.expired" | "register.error.name" | "signIn.error.invalid" | "signIn.error.refused" | "signIn.error.unreachable" | "signIn.error.failed" | "signIn.error.botCheck" | "signIn.error.botCheckUnavailable" | "signIn.error.notConfigured" | "wait.seconds.one" | "wait.seconds.other" | "wait.minutes.one" | "wait.minutes.other" | "wait.hours.one" | "wait.hours.other" | "bookings.heading" | "bookings.period" | "bookings.upcoming" | "bookings.past" | "bookings.emptyUpcoming" | "bookings.emptyPast" | "bookings.more" | "bookings.when" | "bookings.cancelled" | "bookings.cancelledLate" | "bookings.attended" | "bookings.noShow" | "bookings.lateFrom" | "bookings.started" | "bookings.cancel" | "bookings.confirmHeading" | "bookings.confirmLate" | "bookings.confirmCredit" | "bookings.confirm" | "bookings.keep" | "bookings.cancelling" | "bookings.doneOnTime" | "bookings.doneLate" | "bookings.cancelFailed" | "bookings.gone" | "businesses.heading" | "businesses.intro" | "businesses.empty" | "businesses.open" | "business.all" | "business.notFound" | "business.types" | "business.allTypes" | "business.resources" | "business.anyResource" | "business.typeMissing" | "business.minutes" | "business.week" | "business.previousWeek" | "business.nextWeek" | "business.weekOf" | "business.empty" | "business.seatsLeft.one" | "business.seatsLeft.other" | "business.full" | "business.openTime" | "business.with" | "business.book" | "book.heading" | "book.signInFirst" | "book.back" | "book.reserving" | "book.heldUntil" | "book.confirm" | "book.confirming" | "book.booked" | "book.toBookings" | "book.done" | "book.close" | "book.chooseType" | "book.noTypes" | "book.seeAll" | "book.chooseResource" | "book.anyResource" | "book.anyResourceHint" | "book.toTypes" | "book.toStep" | "book.otherResource" | "book.reserveAgain" | "book.full" | "book.slotTaken" | "book.limit" | "book.expired" | "book.notAllowed" | "book.unavailable" | "book.banned" | "book.banned.undated" | "book.refused" | "book.failed" | "pay.price" | "pay.advance" | "pay.whole" | "pay.later" | "pay.with" | "pay.none" | "pay.redirecting" | "pay.checking" | "pay.away" | "pay.awayBlocked" | "pay.open" | "pay.tabDone" | "pay.notFinished" | "pay.again" | "pay.released" | "pay.paidUnbooked" | "pay.slow" | "pay.unavailable" | "pay.notOffered" | "passes.heading" | "passes.empty" | "passes.unlimited" | "passes.credits" | "passes.validFrom" | "passes.validRange" | "passes.expired" | "shop.heading" | "shop.buy" | "shop.paid" | "shop.notPaid" | "shop.notFinished" | "shop.away" | "shop.slow" | "shop.outside" | "shop.gone" | "details.heading" | "details.name" | "details.phone" | "details.email" | "details.none" | "details.readOnly" | "details.save" | "details.saving" | "details.saved" | "details.saveFailed" | "details.signOutEverywhere" | "details.signOutEverywhereHint" | "details.signOutEverywhereFailed" | undefined;
|
|
18
19
|
portal: Portal;
|
|
19
20
|
signedInAs: (next: string) => void;
|
|
20
21
|
};
|
|
21
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* The scoped root every screen component renders, "Loading…" until the
|
|
24
|
+
* session is known. #333: a payment tab the provider sent back
|
|
25
|
+
* (`payment-tab.ts`) closes, or says the page it came from has the result.
|
|
26
|
+
*/
|
|
22
27
|
export declare function CustomerRoot(props: {
|
|
23
28
|
portal: Portal;
|
|
24
29
|
loading: boolean;
|
|
30
|
+
locale: MsmLocale | undefined;
|
|
25
31
|
children: ReactNode;
|
|
26
32
|
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MessageKey } from "./i18n";
|
|
2
|
+
/**
|
|
3
|
+
* The copy for a refused hold, confirmation or checkout: a ban gives when
|
|
4
|
+
* it ends (`until`), for the message's `{date}`, and every other refusal is
|
|
5
|
+
* picked by its code.
|
|
6
|
+
*/
|
|
7
|
+
export declare function refusalOf(refusal: {
|
|
8
|
+
code: string | undefined;
|
|
9
|
+
body: unknown;
|
|
10
|
+
} | undefined, byCode: (code: string | undefined) => MessageKey): {
|
|
11
|
+
message: MessageKey;
|
|
12
|
+
until?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function confirmRefusal(code: string | undefined): MessageKey;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { Business as BusinessDto, Candidate, EventType } from "../client";
|
|
3
|
+
import { type I18n } from "../i18n";
|
|
3
4
|
/** The date of `at` in `timeZone`, as YYYY-MM-DD; today by default. */
|
|
4
5
|
export declare function localDate(timeZone: string, at?: Date): string;
|
|
5
6
|
/** The calendar date `count` days after `date` (YYYY-MM-DD). */
|
|
@@ -24,6 +25,7 @@ export declare function useCatalog(businessId: string): {
|
|
|
24
25
|
displayName: string;
|
|
25
26
|
email: string | null;
|
|
26
27
|
id: string;
|
|
28
|
+
kind: "organization" | "contractor";
|
|
27
29
|
latitude: number | null;
|
|
28
30
|
logo: {
|
|
29
31
|
height: number;
|
|
@@ -36,7 +38,37 @@ export declare function useCatalog(businessId: string): {
|
|
|
36
38
|
width: number;
|
|
37
39
|
} | null;
|
|
38
40
|
longitude: number | null;
|
|
41
|
+
person: {
|
|
42
|
+
displayName: string;
|
|
43
|
+
image: {
|
|
44
|
+
height: number;
|
|
45
|
+
small: {
|
|
46
|
+
height: number;
|
|
47
|
+
url: string;
|
|
48
|
+
width: number;
|
|
49
|
+
};
|
|
50
|
+
url: string;
|
|
51
|
+
width: number;
|
|
52
|
+
} | null;
|
|
53
|
+
resourceId: string;
|
|
54
|
+
} | null;
|
|
39
55
|
phone: string | null;
|
|
56
|
+
slug: string;
|
|
57
|
+
teachesAt: {
|
|
58
|
+
displayName: string;
|
|
59
|
+
id: string;
|
|
60
|
+
logo: {
|
|
61
|
+
height: number;
|
|
62
|
+
small: {
|
|
63
|
+
height: number;
|
|
64
|
+
url: string;
|
|
65
|
+
width: number;
|
|
66
|
+
};
|
|
67
|
+
url: string;
|
|
68
|
+
width: number;
|
|
69
|
+
} | null;
|
|
70
|
+
slug: string;
|
|
71
|
+
}[];
|
|
40
72
|
timezone: string;
|
|
41
73
|
} | null | undefined;
|
|
42
74
|
types: {
|
|
@@ -55,6 +87,17 @@ export declare function useCatalog(businessId: string): {
|
|
|
55
87
|
url: string;
|
|
56
88
|
width: number;
|
|
57
89
|
} | null;
|
|
90
|
+
noShowFee: {
|
|
91
|
+
amount: number;
|
|
92
|
+
currency: string;
|
|
93
|
+
vatRateBp: number;
|
|
94
|
+
} | null;
|
|
95
|
+
price: {
|
|
96
|
+
advanceAmount: number;
|
|
97
|
+
amount: number;
|
|
98
|
+
currency: string;
|
|
99
|
+
vatRateBp: number;
|
|
100
|
+
} | null;
|
|
58
101
|
requiresAccess: boolean;
|
|
59
102
|
resources: {
|
|
60
103
|
description: string | null;
|
|
@@ -73,6 +116,10 @@ export declare function useCatalog(businessId: string): {
|
|
|
73
116
|
}[];
|
|
74
117
|
tags: {
|
|
75
118
|
colour: "red" | "orange" | "amber" | "lime" | "green" | "teal" | "cyan" | "blue" | "indigo" | "purple" | "pink" | "slate";
|
|
119
|
+
group: {
|
|
120
|
+
name: string;
|
|
121
|
+
slug: string;
|
|
122
|
+
} | null;
|
|
76
123
|
id: string;
|
|
77
124
|
name: string;
|
|
78
125
|
slug: string;
|
|
@@ -86,7 +133,7 @@ export declare function useCatalog(businessId: string): {
|
|
|
86
133
|
* The screen for a catalog that has not loaded: it failed, the business is
|
|
87
134
|
* not public here, or it is still loading. Undefined once it has loaded.
|
|
88
135
|
*/
|
|
89
|
-
export declare function pendingCatalog(catalog: Catalog, back: ReactNode): import("react").JSX.Element | undefined;
|
|
136
|
+
export declare function pendingCatalog(catalog: Catalog, back: ReactNode, t: I18n["t"]): import("react").JSX.Element | undefined;
|
|
90
137
|
/** The resources that provide `types`, each once, in the order they appear. */
|
|
91
138
|
export declare function resourcesOf(types: EventType[]): {
|
|
92
139
|
description: string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CustomerScreen } from "../context";
|
|
2
|
+
/**
|
|
3
|
+
* #520: back from the provider's page on another screen, such as the
|
|
4
|
+
* business list a package that switches screens itself opens on, the
|
|
5
|
+
* customer is shown the passes screen, which reads the purchase.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useReturnToPasses(screen: CustomerScreen, navigate: (screen: "passes") => void): void;
|
|
8
|
+
/**
|
|
9
|
+
* #520: the products of the partner's businesses that take payments
|
|
10
|
+
* online, each bought through one of the business's payment methods: the
|
|
11
|
+
* customer pays on the provider's page and comes back here to the result.
|
|
12
|
+
* The provider's receipt is theirs; the package shows none.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Shop(): import("react").JSX.Element | null;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -21,6 +21,21 @@ export interface CustomerHandlerOptions {
|
|
|
21
21
|
* when it is unknown, which refuses code requests.
|
|
22
22
|
*/
|
|
23
23
|
clientIp: (request: Request) => string | null | undefined | Promise<string | null | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Keeps sessions without cookies, for screens in a cross-site iframe, where
|
|
26
|
+
* browsers block or partition cookies; mount a handler with it on its own
|
|
27
|
+
* `basePath` for those screens, which need no setting of their own.
|
|
28
|
+
* Instead of the two cookies, the screens get the encrypted session and a
|
|
29
|
+
* pending registration's ticket in the `X-MSM-Session` and
|
|
30
|
+
* `X-MSM-Registration` response headers, keep them in the page's memory
|
|
31
|
+
* only, and send them back in the same request headers, so a reload signs
|
|
32
|
+
* the customer out. Each opens only on requests from the page origin it
|
|
33
|
+
* was issued to, as the browser's `Origin` and `Sec-Fetch-Site` headers
|
|
34
|
+
* say; a request the browser marks as another origin's, or a write
|
|
35
|
+
* without `Origin`, is refused. The engine token stays on this server
|
|
36
|
+
* either way. The default is cookies, unchanged.
|
|
37
|
+
*/
|
|
38
|
+
cookieless?: boolean;
|
|
24
39
|
fetch?: typeof globalThis.fetch;
|
|
25
40
|
}
|
|
26
41
|
/**
|
package/dist/server/session.d.ts
CHANGED
|
@@ -23,6 +23,18 @@ export interface PendingRegistration {
|
|
|
23
23
|
/** When the engine stops accepting the ticket (ISO 8601). */
|
|
24
24
|
expiresAt: string;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Cookieless, for screens in a cross-site iframe: the headers that hand the
|
|
28
|
+
* page its session and pending registration and bring them back, in place of
|
|
29
|
+
* the two cookies. Each carries the same kind of ciphertext as its cookie,
|
|
30
|
+
* with the origin it was issued to.
|
|
31
|
+
*/
|
|
32
|
+
export declare const customerSessionHeader = "x-msm-session";
|
|
33
|
+
export declare const customerRegistrationHeader = "x-msm-registration";
|
|
34
|
+
/** A cookieless handle's value: what its cookie would hold, and the page's origin. */
|
|
35
|
+
export type Bound<T> = T & {
|
|
36
|
+
origin: string;
|
|
37
|
+
};
|
|
26
38
|
/** The session cookie's cipher. */
|
|
27
39
|
export declare function sessionCipher(keys: readonly string[]): {
|
|
28
40
|
seal(value: CustomerSession): Promise<string>;
|
|
@@ -35,6 +47,18 @@ export declare function registrationCipher(keys: readonly string[]): {
|
|
|
35
47
|
/** The cookie's value, or null when no key opens it or it has expired. */
|
|
36
48
|
open(cookie: string | undefined): Promise<PendingRegistration | null>;
|
|
37
49
|
};
|
|
50
|
+
/** The cookieless session header's cipher. */
|
|
51
|
+
export declare function sessionHeaderCipher(keys: readonly string[]): {
|
|
52
|
+
seal(value: Bound<CustomerSession>): Promise<string>;
|
|
53
|
+
/** The cookie's value, or null when no key opens it or it has expired. */
|
|
54
|
+
open(cookie: string | undefined): Promise<Bound<CustomerSession> | null>;
|
|
55
|
+
};
|
|
56
|
+
/** The cookieless pending registration header's cipher. */
|
|
57
|
+
export declare function registrationHeaderCipher(keys: readonly string[]): {
|
|
58
|
+
seal(value: Bound<PendingRegistration>): Promise<string>;
|
|
59
|
+
/** The cookie's value, or null when no key opens it or it has expired. */
|
|
60
|
+
open(cookie: string | undefined): Promise<Bound<PendingRegistration> | null>;
|
|
61
|
+
};
|
|
38
62
|
/**
|
|
39
63
|
* The signed-in customer's session for the partner's own server code, such as
|
|
40
64
|
* a page that books through the customer SDK with `sessionHeaders`. It shares
|