@curless/hotel-storefront 0.82.1 → 0.83.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/account/index.d.ts +7 -0
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +64 -15
- package/dist/account/index.js.map +1 -1
- package/dist/account/pages.d.ts +3 -0
- package/dist/account/pages.d.ts.map +1 -1
- package/dist/account/pages.js +16 -5
- package/dist/account/pages.js.map +1 -1
- package/dist/account/wallet-pages.d.ts +20 -5
- package/dist/account/wallet-pages.d.ts.map +1 -1
- package/dist/account/wallet-pages.js +122 -52
- package/dist/account/wallet-pages.js.map +1 -1
- package/dist/card.generated.d.ts +1 -1
- package/dist/card.generated.js +2 -2
- package/dist/card.generated.js.map +1 -1
- package/dist/legal.js +1 -1
- package/dist/legal.js.map +1 -1
- package/dist/otaless/client.d.ts +4 -2
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/fake.d.ts.map +1 -1
- package/dist/otaless/fake.js +6 -6
- package/dist/otaless/fake.js.map +1 -1
- package/dist/otaless/wallet.d.ts.map +1 -1
- package/dist/otaless/wallet.js +17 -7
- package/dist/otaless/wallet.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/dist/account/index.d.ts
CHANGED
|
@@ -40,6 +40,13 @@ export type AccountConfig = {
|
|
|
40
40
|
* no page says a word of it.
|
|
41
41
|
*/
|
|
42
42
|
memberships?: AccountMembershipConfig[];
|
|
43
|
+
/**
|
|
44
|
+
* 0.82.2 (robin 11-24: 「Keep links」): the guest's own sign-out ends the sign-in HERE only - the
|
|
45
|
+
* hotel memberships and the shop stay linked at the backend (their term, 30 days) for the next
|
|
46
|
+
* sign-in. Off (the default, and the root deployment's - its tool words are frozen): signing out
|
|
47
|
+
* ends every channel of the token at the backend too, as before.
|
|
48
|
+
*/
|
|
49
|
+
keepLinksOnSignOut?: boolean;
|
|
43
50
|
};
|
|
44
51
|
export type AccountMembershipConfig = {
|
|
45
52
|
code: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI1C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI1C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAwC7C,OAAO,EAEL,KAAK,IAAI,EAMV,MAAM,eAAe,CAAC;AA8FvB;;;GAGG;AACH,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAgBlD,eAAO,MAAM,mBAAmB,GAAI,GAAG,OAAO,KAAG,OAI3B,CAAC;AAKvB,MAAM,MAAM,aAAa,GAAG;IAC1B,iFAAiF;IACjF,MAAM,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;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GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAIvC,uEAAuE;IACvE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAMxC,wGAAwG;IACxG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI;CAyB/D;AAyCD,eAAO,MAAM,WAAW,GAAI,MAAM,cAAc,KAAG,OAgtHlD,CAAC"}
|
package/dist/account/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { addonDonePage, addonPage, addonStatePage } from './addon-pages.js';
|
|
|
8
8
|
import { AccountInfos } from './info-cache.js';
|
|
9
9
|
import { maskEmail } from './mask.js';
|
|
10
10
|
import { ADDON_PATHS, LIMITS, OTA_PATHS, OtaMemberError, linkOf, makeOtaMembers, maskLabel, maskNumber, } from './ota-member.js';
|
|
11
|
-
import { PAGE_HEADERS, accountPage, linkGroupPage, linkReauthPage, linkedPage, loginPage, say, signedInPage, statePage, termsDonePage, termsPage, termsStatePage, } from './pages.js';
|
|
11
|
+
import { PAGE_HEADERS, accountPage, esc, linkGroupPage, linkReauthPage, linkedPage, loginPage, say, signedInPage, statePage, termsDonePage, termsPage, termsStatePage, } from './pages.js';
|
|
12
12
|
import { CODE, createSignIns, hashOf, same, } from './requests.js';
|
|
13
13
|
import { AccountStore, WEB_IDLE_MS, WebSessions, nameShown, nicknameOf, profileOf, profileShown, shownOf, } from './store.js';
|
|
14
14
|
import { WALLET_CSS, addCardPage, confirmPage, confirmWords, noteOf, walletBlocks, } from './wallet-pages.js';
|
|
@@ -405,7 +405,12 @@ export const makeAccount = (opts) => {
|
|
|
405
405
|
const requests = createSignIns({ now });
|
|
406
406
|
// A sign-in forgotten here - left two hours, past its session, or pushed out -
|
|
407
407
|
// is ended at the backend too (review P3-3).
|
|
408
|
-
|
|
408
|
+
// ⚠️ A SIGN-IN THAT LAPSES HERE IS FORGOTTEN HERE ONLY (0.82.2, robin 11-24: 「现在关联酒店是30天了,
|
|
409
|
+
// 我昨天关联的,今天怎么都看不到了要重新关联」): two idle hours, or its day, ended it at the backend
|
|
410
|
+
// with no providerCode - and that ends EVERY channel of the member (their document: 「无 providerCode
|
|
411
|
+
// 时:执行全局注销,级联注销该买家名下…全部…会话凭据」), so every hotel membership and the shop had
|
|
412
|
+
// to be linked again the next day, in every conversation. Ours is dropped; theirs runs its own term.
|
|
413
|
+
const store = new AccountStore(now, (s) => forgetHere(s, 'lapsed'));
|
|
409
414
|
const web = new WebSessions(now);
|
|
410
415
|
// The form's token, from a secret of this process: a restart voids open
|
|
411
416
|
// forms, as it voids the requests they post for.
|
|
@@ -827,8 +832,9 @@ export const makeAccount = (opts) => {
|
|
|
827
832
|
/** Signed in now, for this conversation: whatever was there before is ended. */
|
|
828
833
|
const signInWith = (key, shown, platform, profile) => {
|
|
829
834
|
const was = store.clear(key);
|
|
835
|
+
// Replaced by a new sign-in here: forgotten here, never signed out at the backend (0.82.2).
|
|
830
836
|
if (was)
|
|
831
|
-
|
|
837
|
+
forgetHere(was, 'replaced');
|
|
832
838
|
requests.cancelFor(key);
|
|
833
839
|
linkRequests.cancelFor(key);
|
|
834
840
|
termsRequests.cancelFor(key);
|
|
@@ -894,6 +900,18 @@ export const makeAccount = (opts) => {
|
|
|
894
900
|
* A sign-in that is over: its pages closed, its memberships forgotten, every channel
|
|
895
901
|
* of its token ended at the backend (not waited for, `signOutAll`).
|
|
896
902
|
*/
|
|
903
|
+
/**
|
|
904
|
+
* A sign-in forgotten HERE only (0.82.2): its pages closed, its links of this conversation dropped,
|
|
905
|
+
* the token let go - and nothing sent to the backend, where a sign-out with no providerCode would
|
|
906
|
+
* end every hotel membership and the shop of the member, in every conversation. For a sign-in that
|
|
907
|
+
* lapsed here (idle, or its day) or that a new sign-in in the same conversation replaces.
|
|
908
|
+
*/
|
|
909
|
+
const forgetHere = (s, why) => {
|
|
910
|
+
web.dropFor(s.sid);
|
|
911
|
+
infos.forget(s.shown.id);
|
|
912
|
+
s.links?.clear();
|
|
913
|
+
log(`[account] a sign-in ${why === 'lapsed' ? 'lapsed' : why === 'replaced' ? 'was replaced' : 'was signed out by the guest'} here - forgotten here only, not signed out at the backend (its memberships stay linked there)`);
|
|
914
|
+
};
|
|
897
915
|
const end = (s) => {
|
|
898
916
|
web.dropFor(s.sid);
|
|
899
917
|
infos.forget(s.shown.id);
|
|
@@ -909,8 +927,14 @@ export const makeAccount = (opts) => {
|
|
|
909
927
|
requests.cancelFor(key);
|
|
910
928
|
linkRequests.cancelFor(key);
|
|
911
929
|
termsRequests.cancelFor(key);
|
|
912
|
-
|
|
913
|
-
|
|
930
|
+
// The guest's own sign-out: here only where the deployment keeps links (0.82.2), else at the
|
|
931
|
+
// backend too - every channel of the token.
|
|
932
|
+
if (was) {
|
|
933
|
+
if (opts.account.keepLinksOnSignOut === true)
|
|
934
|
+
forgetHere(was, 'signed-out');
|
|
935
|
+
else
|
|
936
|
+
end(was);
|
|
937
|
+
}
|
|
914
938
|
return was;
|
|
915
939
|
};
|
|
916
940
|
// The code, and the backend's own words for it where it gave any (0.61.1,
|
|
@@ -1599,7 +1623,9 @@ export const makeAccount = (opts) => {
|
|
|
1599
1623
|
log(`[account] ${tag(key)} signed out`);
|
|
1600
1624
|
usage({ key, kind: 'account', step: 'out' });
|
|
1601
1625
|
return {
|
|
1602
|
-
text:
|
|
1626
|
+
text: opts.account.keepLinksOnSignOut === true
|
|
1627
|
+
? `Signed out of ${whoSaid(was)} in this conversation. The hotel memberships and the shop linked to the account stay linked at ${brand}, so signing in again needs no linking. The trip is left as it is.`
|
|
1628
|
+
: `Signed out of ${whoSaid(was)} in this conversation, and at ${brand}. The trip is left as it is.`,
|
|
1603
1629
|
structured: { view: 'account-signed-out', brand, signedIn: false, was: true },
|
|
1604
1630
|
};
|
|
1605
1631
|
}
|
|
@@ -1747,7 +1773,9 @@ export const makeAccount = (opts) => {
|
|
|
1747
1773
|
},
|
|
1748
1774
|
{
|
|
1749
1775
|
name: names.signOut,
|
|
1750
|
-
description:
|
|
1776
|
+
description: opts.account.keepLinksOnSignOut === true
|
|
1777
|
+
? `Signs the guest out of their ${brand} account in this conversation; the hotel memberships and the shop linked to it stay linked at ${brand} for the next sign-in. The trip is left as it is.`
|
|
1778
|
+
: `Signs the guest out of their ${brand} account in this conversation, and ends that sign-in at ${brand}. The trip is left as it is.`,
|
|
1751
1779
|
annotations: {
|
|
1752
1780
|
title: `Sign out of the ${brand} account`,
|
|
1753
1781
|
readOnlyHint: false,
|
|
@@ -2353,7 +2381,20 @@ export const makeAccount = (opts) => {
|
|
|
2353
2381
|
return st;
|
|
2354
2382
|
return store.get(r.key)?.sid === r.terms?.sid ? 'open' : 'expired';
|
|
2355
2383
|
};
|
|
2356
|
-
|
|
2384
|
+
// What a pressed agree / decline came to, by its link (0.82.2, live walkthrough 11-24: a second
|
|
2385
|
+
// press while the first was at the backend got "Working on it", which looked again and found the
|
|
2386
|
+
// link used - the outcome, an order and its payment link, went to the first request's page, which
|
|
2387
|
+
// the browser had dropped). Once done, the SAME account's browser (`ownerOf`) is shown it on the
|
|
2388
|
+
// link; in memory only, as long as the used link is kept (requests.ts: 30 minutes).
|
|
2389
|
+
const termsResults = new WeakMap();
|
|
2390
|
+
const termsResult = (r, code, lang, d) => {
|
|
2391
|
+
termsResults.set(r, { lang, d });
|
|
2392
|
+
return termsDonePage(brandPage, lang, code, d);
|
|
2393
|
+
};
|
|
2394
|
+
const termsNotOpen = (c, code, state, lang, wait, r) => {
|
|
2395
|
+
const kept = state === 'used' && r ? termsResults.get(r) : undefined;
|
|
2396
|
+
if (kept && r && ownerOf(c, r))
|
|
2397
|
+
return send(c, 200, termsDonePage(brandPage, kept.lang, code, kept.d).replace(/(<div class="brand">[\s\S]*?<\/div>)/, `$1<p class="note">${esc(say(kept.lang, 'usedAgainNote'))}</p>`));
|
|
2357
2398
|
const href = termsHrefOf(code);
|
|
2358
2399
|
if (state === 'pending')
|
|
2359
2400
|
return send(c, 202, termsStatePage(brandPage, lang, 'pending', href, href(lang)));
|
|
@@ -2423,7 +2464,7 @@ export const makeAccount = (opts) => {
|
|
|
2423
2464
|
return termsNotOpen(c, code, 'unknown', lang, false);
|
|
2424
2465
|
const state = termsState(r);
|
|
2425
2466
|
if (state !== 'open')
|
|
2426
|
-
return termsNotOpen(c, code, state, lang, false);
|
|
2467
|
+
return termsNotOpen(c, code, state, lang, false, r);
|
|
2427
2468
|
const owner = ownerOf(c, r);
|
|
2428
2469
|
if (!owner)
|
|
2429
2470
|
return termsReauth(c, code, r, lang);
|
|
@@ -2569,7 +2610,7 @@ export const makeAccount = (opts) => {
|
|
|
2569
2610
|
return termsNotOpen(c, code, 'unknown', lang, false);
|
|
2570
2611
|
const state = termsState(r);
|
|
2571
2612
|
if (state !== 'open')
|
|
2572
|
-
return termsNotOpen(c, code, state, lang, false);
|
|
2613
|
+
return termsNotOpen(c, code, state, lang, false, r);
|
|
2573
2614
|
if (!same(body.csrf, termsCsrf(r))) {
|
|
2574
2615
|
refusals.csrf++;
|
|
2575
2616
|
return send(c, 403, statePage(brandPage, lang, 'checked', termsHrefOf(code)));
|
|
@@ -2674,7 +2715,7 @@ export const makeAccount = (opts) => {
|
|
|
2674
2715
|
}
|
|
2675
2716
|
termsUsed(r);
|
|
2676
2717
|
log(`[account] terms declined k=${tag(r.key)} group=${groupCode} → ${order ? `order ${order.state}` : 'nothing ordered'}`);
|
|
2677
|
-
return send(c, 200,
|
|
2718
|
+
return send(c, 200, termsResult(r, code, lang, {
|
|
2678
2719
|
kind: 'declined',
|
|
2679
2720
|
group: groupName,
|
|
2680
2721
|
...(logo ? { logo } : {}),
|
|
@@ -2708,7 +2749,7 @@ export const makeAccount = (opts) => {
|
|
|
2708
2749
|
return termsView(c, made.code, fresh, again, lang);
|
|
2709
2750
|
}
|
|
2710
2751
|
log(`[account] terms agreed k=${tag(r.key)} group=${groupCode} → terms-lost`);
|
|
2711
|
-
return send(c, 200,
|
|
2752
|
+
return send(c, 200, termsResult(r, code, lang, termsErrorDone('terms-gone', lang, groupName, logo)));
|
|
2712
2753
|
}
|
|
2713
2754
|
const booking = asObj(st.booking);
|
|
2714
2755
|
if (view === 'booking' && asStr(booking.hotelName)) {
|
|
@@ -2735,7 +2776,7 @@ export const makeAccount = (opts) => {
|
|
|
2735
2776
|
const payHost = asStr(pay.host);
|
|
2736
2777
|
const payAmount = asStr(pay.amount);
|
|
2737
2778
|
const confirmation = asStr(booking.confirmationCode);
|
|
2738
|
-
return send(c, 200,
|
|
2779
|
+
return send(c, 200, termsResult(r, code, lang, {
|
|
2739
2780
|
kind: 'ordered',
|
|
2740
2781
|
group: groupName,
|
|
2741
2782
|
...(logo ? { logo } : {}),
|
|
@@ -2758,7 +2799,7 @@ export const makeAccount = (opts) => {
|
|
|
2758
2799
|
const named = asObj(g.names)[lang] ?? g.name;
|
|
2759
2800
|
const who = typeof named === 'string' && named ? named : groupName;
|
|
2760
2801
|
log(`[account] terms agreed k=${tag(r.key)} group=${groupCode} → ${printableCode(errorCode)}`);
|
|
2761
|
-
return send(c, 200,
|
|
2802
|
+
return send(c, 200, termsResult(r, code, lang, termsErrorDone(errorCode, lang, who, logo)));
|
|
2762
2803
|
};
|
|
2763
2804
|
app.get('/login', (c) => {
|
|
2764
2805
|
const code = c.req.query('code') ?? '';
|
|
@@ -3038,7 +3079,9 @@ export const makeAccount = (opts) => {
|
|
|
3038
3079
|
const act = formStr(body.action, 40);
|
|
3039
3080
|
const group = formStr(body.group, 32);
|
|
3040
3081
|
const ctx = walletCtx(at.s, at.ws.key, ipOf(c));
|
|
3041
|
-
|
|
3082
|
+
// Back to THIS group's wallet, open, the note in it (0.83.0) - `group` is one of the wallet's
|
|
3083
|
+
// groups by now (`offers`), its characters [A-Za-z0-9_-].
|
|
3084
|
+
const back = (code) => c.redirect(`${base}/account?lang=${lang}&wallet=${code}&group=${encodeURIComponent(group)}#wallet-${encodeURIComponent(group)}`, 303);
|
|
3042
3085
|
const nameIn = (code) => {
|
|
3043
3086
|
const meta = walletMeta(code);
|
|
3044
3087
|
return lang === 'zh' && meta.names?.zh ? meta.names.zh : meta.name;
|
|
@@ -3060,6 +3103,7 @@ export const makeAccount = (opts) => {
|
|
|
3060
3103
|
...(r.link ? { url: r.link.url } : {}),
|
|
3061
3104
|
minutes: 15,
|
|
3062
3105
|
group: nameIn(group),
|
|
3106
|
+
code: group,
|
|
3063
3107
|
}));
|
|
3064
3108
|
}
|
|
3065
3109
|
if (act === 'wallet_renew') {
|
|
@@ -3404,6 +3448,7 @@ export const makeAccount = (opts) => {
|
|
|
3404
3448
|
? {
|
|
3405
3449
|
wallet: {
|
|
3406
3450
|
css: WALLET_CSS,
|
|
3451
|
+
groups: walletCards.map((w) => w.group),
|
|
3407
3452
|
subs: walletBlocks({
|
|
3408
3453
|
b: brandPage,
|
|
3409
3454
|
lang,
|
|
@@ -3413,6 +3458,10 @@ export const makeAccount = (opts) => {
|
|
|
3413
3458
|
...(noteOf(c.req.query('wallet'))
|
|
3414
3459
|
? { note: noteOf(c.req.query('wallet')) }
|
|
3415
3460
|
: {}),
|
|
3461
|
+
// The wallet the guest came back to (0.83.0): one of these groups, or none.
|
|
3462
|
+
...(walletCards.some((w) => w.group === c.req.query('group'))
|
|
3463
|
+
? { open: c.req.query('group') }
|
|
3464
|
+
: {}),
|
|
3416
3465
|
}),
|
|
3417
3466
|
},
|
|
3418
3467
|
}
|