@adminide-stack/clock-tik-browser 12.0.30 → 12.0.32
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/lib/pages/Home/HomePage.d.ts.map +1 -1
- package/lib/pages/Home/HomePage.js +1091 -325
- package/lib/pages/Home/HomePage.js.map +1 -1
- package/lib/pages/Home/__tests__/device.test.d.ts +2 -0
- package/lib/pages/Home/__tests__/device.test.d.ts.map +1 -0
- package/lib/pages/Home/__tests__/failure.test.d.ts +2 -0
- package/lib/pages/Home/__tests__/failure.test.d.ts.map +1 -0
- package/lib/pages/Home/__tests__/qr.test.d.ts +2 -0
- package/lib/pages/Home/__tests__/qr.test.d.ts.map +1 -0
- package/lib/pages/Home/__tests__/textLink.test.d.ts +2 -0
- package/lib/pages/Home/__tests__/textLink.test.d.ts.map +1 -0
- package/lib/pages/Home/__tests__/timeBack.test.d.ts +2 -0
- package/lib/pages/Home/__tests__/timeBack.test.d.ts.map +1 -0
- package/lib/pages/Home/assets.js +0 -2
- package/lib/pages/Home/assets.js.map +1 -1
- package/lib/pages/Home/chat/ChoresChat.d.ts +3 -1
- package/lib/pages/Home/chat/ChoresChat.d.ts.map +1 -1
- package/lib/pages/Home/chat/ChoresChat.js +212 -31
- package/lib/pages/Home/chat/ChoresChat.js.map +1 -1
- package/lib/pages/Home/chat/chatTheme.d.ts +2 -1
- package/lib/pages/Home/chat/chatTheme.d.ts.map +1 -1
- package/lib/pages/Home/chat/chatTheme.js +298 -15
- package/lib/pages/Home/chat/chatTheme.js.map +1 -1
- package/lib/pages/Home/chat/failure.d.ts +8 -0
- package/lib/pages/Home/chat/failure.d.ts.map +1 -0
- package/lib/pages/Home/chat/failure.js +24 -0
- package/lib/pages/Home/chat/failure.js.map +1 -0
- package/lib/pages/Home/chat/thread.d.ts +5 -0
- package/lib/pages/Home/chat/thread.d.ts.map +1 -1
- package/lib/pages/Home/chat/thread.js +24 -1
- package/lib/pages/Home/chat/thread.js.map +1 -1
- package/lib/pages/Home/content.d.ts +38 -16
- package/lib/pages/Home/content.d.ts.map +1 -1
- package/lib/pages/Home/content.js +79 -30
- package/lib/pages/Home/content.js.map +1 -1
- package/lib/pages/Home/homeStyles.d.ts +2 -0
- package/lib/pages/Home/homeStyles.d.ts.map +1 -1
- package/lib/pages/Home/homeStyles.js +1902 -491
- package/lib/pages/Home/homeStyles.js.map +1 -1
- package/lib/pages/Home/imessage/ImessageDialog.d.ts +14 -0
- package/lib/pages/Home/imessage/ImessageDialog.d.ts.map +1 -0
- package/lib/pages/Home/imessage/ImessageDialog.js +277 -0
- package/lib/pages/Home/imessage/ImessageDialog.js.map +1 -0
- package/lib/pages/Home/imessage/ImessageIcon.d.ts +5 -0
- package/lib/pages/Home/imessage/ImessageIcon.d.ts.map +1 -0
- package/lib/pages/Home/imessage/ImessageIcon.js +42 -0
- package/lib/pages/Home/imessage/ImessageIcon.js.map +1 -0
- package/lib/pages/Home/imessage/QrCode.d.ts +6 -0
- package/lib/pages/Home/imessage/QrCode.d.ts.map +1 -0
- package/lib/pages/Home/imessage/QrCode.js +86 -0
- package/lib/pages/Home/imessage/QrCode.js.map +1 -0
- package/lib/pages/Home/imessage/device.d.ts +31 -0
- package/lib/pages/Home/imessage/device.d.ts.map +1 -0
- package/lib/pages/Home/imessage/device.js +31 -0
- package/lib/pages/Home/imessage/device.js.map +1 -0
- package/lib/pages/Home/imessage/qr.d.ts +42 -0
- package/lib/pages/Home/imessage/qr.d.ts.map +1 -0
- package/lib/pages/Home/imessage/qr.js +469 -0
- package/lib/pages/Home/imessage/qr.js.map +1 -0
- package/lib/pages/Home/imessage/textLink.d.ts +70 -0
- package/lib/pages/Home/imessage/textLink.d.ts.map +1 -0
- package/lib/pages/Home/imessage/textLink.js +224 -0
- package/lib/pages/Home/imessage/textLink.js.map +1 -0
- package/lib/pages/Home/index.d.ts +15 -0
- package/lib/pages/Home/index.d.ts.map +1 -1
- package/lib/pages/Home/index.js +23 -28
- package/lib/pages/Home/index.js.map +1 -1
- package/lib/pages/Home/platform.d.ts +5 -0
- package/lib/pages/Home/platform.d.ts.map +1 -1
- package/lib/pages/Home/platform.js +8 -1
- package/lib/pages/Home/platform.js.map +1 -1
- package/lib/pages/Home/timeBack.d.ts +10 -0
- package/lib/pages/Home/timeBack.d.ts.map +1 -0
- package/lib/pages/Home/timeBack.js +12 -0
- package/lib/pages/Home/timeBack.js.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"homeStyles.js","sources":["../../../src/pages/Home/homeStyles.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"oCAQA,MAAM,QAAQ,GAAG
|
|
1
|
+
{"version":3,"file":"homeStyles.js","sources":["../../../src/pages/Home/homeStyles.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"oCAQA;AACO,MAAM,eAAe,GACxB;AAEJ,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA80EhB;SAEe,UAAU,GAAA;;SAEfA,GAAA,CAAA,OAAA,EAAA;AACX,IAAC,qBAAA,EAAA,IAAA;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ImessageDialogProps {
|
|
2
|
+
/** Whose pairing code this is (the token's subject). */
|
|
3
|
+
account: string;
|
|
4
|
+
/** The first text; Lucy's greeting when left out. */
|
|
5
|
+
message?: string;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
/** Chat with Lucy on the page instead. */
|
|
8
|
+
onChatHere: () => void;
|
|
9
|
+
/** The platform refused the sign-in: sign in again, then come back here. */
|
|
10
|
+
onSignedOut: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function ImessageDialog({ account, message, onClose, onChatHere, onSignedOut }: ImessageDialogProps): import("react").JSX.Element;
|
|
13
|
+
export default ImessageDialog;
|
|
14
|
+
//# sourceMappingURL=ImessageDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImessageDialog.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/imessage/ImessageDialog.tsx"],"names":[],"mappings":"AAqBA,MAAM,WAAW,mBAAmB;IAChC,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,4EAA4E;IAC5E,WAAW,EAAE,MAAM,IAAI,CAAC;CAC3B;AA4BD,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,mBAAmB,+BAsPzG;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useState,useRef,useEffect,useCallback}from'react';import {X,RefreshCcw,ArrowUpRight,MessageSquareText}from'lucide-react';import {Mark}from'../Logo.js';import {currentMessagesDevice}from'./device.js';import {ImessageIcon}from'./ImessageIcon.js';import {QrCode}from'./QrCode.js';import {fetchTextLink,TextLinkError,LUCY_GREETING}from'./textLink.js';const RATE_LIMITED = 'That was a lot of tries in a minute. Give it a moment, then try again.';
|
|
2
|
+
const FAILED = 'We couldn’t get your iMessage link just now. Try again in a moment.';
|
|
3
|
+
/** Look again at most this often when the person comes back to the tab. */
|
|
4
|
+
const RECHECK_MS = 15_000;
|
|
5
|
+
/** The greeting as the dialog quotes it: never broken across two lines. */
|
|
6
|
+
const GREETING_SHOWN = `“${LUCY_GREETING.replace(/ /g, ' ')}”`;
|
|
7
|
+
function Steps({
|
|
8
|
+
phone
|
|
9
|
+
}) {
|
|
10
|
+
const steps = [phone ? 'Tap Open Messages' : 'Scan the code', `Send ${GREETING_SHOWN}`, 'Lucy texts back'];
|
|
11
|
+
return jsx("ol", {
|
|
12
|
+
className: "cbh-imsg-steps",
|
|
13
|
+
"aria-label": "How it works",
|
|
14
|
+
children: steps.map((s, i) => jsxs("li", {
|
|
15
|
+
children: [jsx("span", {
|
|
16
|
+
"aria-hidden": true,
|
|
17
|
+
children: i + 1
|
|
18
|
+
}), s]
|
|
19
|
+
}, s))
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function ImessageDialog({
|
|
23
|
+
account,
|
|
24
|
+
message,
|
|
25
|
+
onClose,
|
|
26
|
+
onChatHere,
|
|
27
|
+
onSignedOut
|
|
28
|
+
}) {
|
|
29
|
+
const [device, setDevice] = useState(null);
|
|
30
|
+
// A computer shows a QR code; which phone scans it decides the line.
|
|
31
|
+
const [scanWith, setScanWith] = useState('imessage');
|
|
32
|
+
const [state, setState] = useState({
|
|
33
|
+
status: 'loading'
|
|
34
|
+
});
|
|
35
|
+
const [attempt, setAttempt] = useState(0);
|
|
36
|
+
const dialogRef = useRef(null);
|
|
37
|
+
const closeRef = useRef(null);
|
|
38
|
+
const checkedAt = useRef(0);
|
|
39
|
+
useEffect(() => setDevice(currentMessagesDevice()), []);
|
|
40
|
+
const reach = !device ? null : device.phone || device.apple ? device.reach : scanWith;
|
|
41
|
+
const reload = useCallback(() => setAttempt(n => n + 1), []);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!reach) return undefined;
|
|
44
|
+
const controller = new AbortController();
|
|
45
|
+
// A refresh keeps the link on screen: the code just changes, no flash of a skeleton.
|
|
46
|
+
setState(s => ({
|
|
47
|
+
status: 'loading',
|
|
48
|
+
link: s.link?.reach === reach ? s.link : undefined
|
|
49
|
+
}));
|
|
50
|
+
checkedAt.current = Date.now();
|
|
51
|
+
fetchTextLink(reach, {
|
|
52
|
+
account,
|
|
53
|
+
message,
|
|
54
|
+
signal: controller.signal
|
|
55
|
+
}).then(link => {
|
|
56
|
+
if (!controller.signal.aborted) setState({
|
|
57
|
+
status: 'ready',
|
|
58
|
+
link
|
|
59
|
+
});
|
|
60
|
+
}, err => {
|
|
61
|
+
if (controller.signal.aborted) return;
|
|
62
|
+
if (err instanceof TextLinkError && err.kind === 'signed-out') {
|
|
63
|
+
onSignedOut();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const rateLimited = err instanceof TextLinkError && err.kind === 'rate-limited';
|
|
67
|
+
setState({
|
|
68
|
+
status: 'error',
|
|
69
|
+
message: rateLimited ? RATE_LIMITED : FAILED
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
return () => controller.abort();
|
|
73
|
+
}, [reach, account, message, attempt, onSignedOut]);
|
|
74
|
+
const link = state.link;
|
|
75
|
+
// A fresh code before this one lapses; and a look on coming back from Messages.
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const expiresAt = link?.expiresAt;
|
|
78
|
+
const timer = expiresAt ? window.setTimeout(reload, Math.max(10_000, expiresAt - Date.now() - 60_000)) : undefined;
|
|
79
|
+
const onVisible = () => {
|
|
80
|
+
if (document.visibilityState !== 'visible' || !link || link.linked) return;
|
|
81
|
+
if (Date.now() - checkedAt.current > RECHECK_MS) reload();
|
|
82
|
+
};
|
|
83
|
+
document.addEventListener('visibilitychange', onVisible);
|
|
84
|
+
return () => {
|
|
85
|
+
if (timer) window.clearTimeout(timer);
|
|
86
|
+
document.removeEventListener('visibilitychange', onVisible);
|
|
87
|
+
};
|
|
88
|
+
}, [link, reload]);
|
|
89
|
+
// A modal: Escape closes, Tab stays inside, and focus goes back where it came from.
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const opener = document.activeElement;
|
|
92
|
+
closeRef.current?.focus();
|
|
93
|
+
const root = document.documentElement;
|
|
94
|
+
const overflow = root.style.overflow;
|
|
95
|
+
root.style.overflow = 'hidden';
|
|
96
|
+
const onKey = e => {
|
|
97
|
+
if (e.key === 'Escape') {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
onClose();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (e.key !== 'Tab' || !dialogRef.current) return;
|
|
103
|
+
const items = dialogRef.current.querySelectorAll('a[href], button:not([disabled])');
|
|
104
|
+
if (!items.length) return;
|
|
105
|
+
const first = items[0];
|
|
106
|
+
const last = items[items.length - 1];
|
|
107
|
+
if (e.shiftKey && document.activeElement === first) {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
last.focus();
|
|
110
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
first.focus();
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
document.addEventListener('keydown', onKey);
|
|
116
|
+
return () => {
|
|
117
|
+
document.removeEventListener('keydown', onKey);
|
|
118
|
+
root.style.overflow = overflow;
|
|
119
|
+
opener?.focus?.();
|
|
120
|
+
};
|
|
121
|
+
}, [onClose]);
|
|
122
|
+
const href = link?.href ?? null;
|
|
123
|
+
const phone = Boolean(device?.phone);
|
|
124
|
+
const showButton = Boolean(href) && Boolean(device?.opensMessages) && (phone || Boolean(device?.apple));
|
|
125
|
+
const showQr = Boolean(href) && Boolean(device) && !phone;
|
|
126
|
+
const loading = !device || state.status === 'loading' && !link;
|
|
127
|
+
const unavailable = state.status === 'ready' && !href;
|
|
128
|
+
const androidPhone = phone && device?.reach === 'sms';
|
|
129
|
+
const title = androidPhone ? 'Text Lucy from Messages' : 'Text Lucy on iMessage';
|
|
130
|
+
const ready = message?.trim() ? 'your chore' : GREETING_SHOWN;
|
|
131
|
+
return jsx("div", {
|
|
132
|
+
className: "cbh-dialog-backdrop cbh-imsg-backdrop",
|
|
133
|
+
onClick: e => e.target === e.currentTarget && onClose(),
|
|
134
|
+
children: jsxs("div", {
|
|
135
|
+
ref: dialogRef,
|
|
136
|
+
className: "cbh-dialog cbh-imsg-dialog",
|
|
137
|
+
role: "dialog",
|
|
138
|
+
"aria-modal": "true",
|
|
139
|
+
"aria-labelledby": "cbh-imsg-title",
|
|
140
|
+
"aria-describedby": "cbh-imsg-sub",
|
|
141
|
+
children: [jsx("button", {
|
|
142
|
+
ref: closeRef,
|
|
143
|
+
type: "button",
|
|
144
|
+
className: "cbh-dialog-x",
|
|
145
|
+
"data-track": "imessage_close",
|
|
146
|
+
onClick: onClose,
|
|
147
|
+
"aria-label": "Close",
|
|
148
|
+
children: jsx(X, {
|
|
149
|
+
size: 18,
|
|
150
|
+
"aria-hidden": true
|
|
151
|
+
})
|
|
152
|
+
}), jsxs("div", {
|
|
153
|
+
className: "cbh-imsg-badge",
|
|
154
|
+
"aria-hidden": true,
|
|
155
|
+
children: [jsx(ImessageIcon, {
|
|
156
|
+
size: 56
|
|
157
|
+
}), jsx("span", {
|
|
158
|
+
className: "cbh-imsg-badge-mark",
|
|
159
|
+
children: jsx(Mark, {
|
|
160
|
+
size: 20
|
|
161
|
+
})
|
|
162
|
+
})]
|
|
163
|
+
}), jsx("h2", {
|
|
164
|
+
id: "cbh-imsg-title",
|
|
165
|
+
className: "cbh-dialog-title",
|
|
166
|
+
children: title
|
|
167
|
+
}), jsx("p", {
|
|
168
|
+
id: "cbh-imsg-sub",
|
|
169
|
+
className: "cbh-dialog-body",
|
|
170
|
+
children: "Lucy answers in Messages, like any other text. Hand her a chore from wherever you are."
|
|
171
|
+
}), jsx("div", {
|
|
172
|
+
className: "cbh-imsg-body",
|
|
173
|
+
"aria-live": "polite",
|
|
174
|
+
"aria-busy": loading,
|
|
175
|
+
children: state.status === 'error' ? jsxs("div", {
|
|
176
|
+
className: "cbh-imsg-note cbh-imsg-note-warn",
|
|
177
|
+
children: [jsx("p", {
|
|
178
|
+
children: state.message
|
|
179
|
+
}), jsxs("button", {
|
|
180
|
+
type: "button",
|
|
181
|
+
className: "cbh-btn cbh-btn-line cbh-btn-small",
|
|
182
|
+
"data-track": "imessage_retry",
|
|
183
|
+
onClick: reload,
|
|
184
|
+
children: [jsx(RefreshCcw, {
|
|
185
|
+
size: 15,
|
|
186
|
+
"aria-hidden": true
|
|
187
|
+
}), " Try again"]
|
|
188
|
+
})]
|
|
189
|
+
}) : loading ? jsxs("div", {
|
|
190
|
+
className: "cbh-imsg-loading",
|
|
191
|
+
children: [phone ? null : jsx("span", {
|
|
192
|
+
className: "cbh-skel cbh-skel-qr"
|
|
193
|
+
}), jsx("span", {
|
|
194
|
+
className: "cbh-skel cbh-skel-btn"
|
|
195
|
+
}), jsx("span", {
|
|
196
|
+
className: "cbh-visually-hidden",
|
|
197
|
+
children: "Getting your iMessage link\u2026"
|
|
198
|
+
})]
|
|
199
|
+
}) : unavailable ? jsxs("div", {
|
|
200
|
+
className: "cbh-imsg-note",
|
|
201
|
+
children: [jsx("p", {
|
|
202
|
+
children: link?.reach === 'sms' && !link.smsAvailable ? 'Texting Lucy from an Android phone isn’t open yet. Chat with her here instead.' : 'Lucy’s iMessage line isn’t answering right now. Try again in a minute, or chat with her here.'
|
|
203
|
+
}), jsxs("button", {
|
|
204
|
+
type: "button",
|
|
205
|
+
className: "cbh-btn cbh-btn-line cbh-btn-small",
|
|
206
|
+
"data-track": "imessage_retry",
|
|
207
|
+
onClick: reload,
|
|
208
|
+
children: [jsx(RefreshCcw, {
|
|
209
|
+
size: 15,
|
|
210
|
+
"aria-hidden": true
|
|
211
|
+
}), " Try again"]
|
|
212
|
+
})]
|
|
213
|
+
}) : jsxs(Fragment, {
|
|
214
|
+
children: [showButton && href ? jsxs("a", {
|
|
215
|
+
className: "cbh-btn cbh-btn-imsg",
|
|
216
|
+
href: href,
|
|
217
|
+
"data-track": "imessage_open_messages",
|
|
218
|
+
children: [jsx(ImessageIcon, {
|
|
219
|
+
size: 22
|
|
220
|
+
}), "Open Messages", jsx(ArrowUpRight, {
|
|
221
|
+
size: 18,
|
|
222
|
+
"aria-hidden": true
|
|
223
|
+
})]
|
|
224
|
+
}) : null, showButton ? jsx("p", {
|
|
225
|
+
className: "cbh-imsg-hint",
|
|
226
|
+
children: link?.linked ? 'Your phone already texts Lucy. Just tap send.' : `Messages opens with ${ready} ready. Tap send: that one text links your phone, and Lucy answers right there.`
|
|
227
|
+
}) : null, showQr && href ? jsxs("div", {
|
|
228
|
+
className: "cbh-imsg-qr-wrap",
|
|
229
|
+
children: [showButton ? jsx("p", {
|
|
230
|
+
className: "cbh-imsg-or",
|
|
231
|
+
children: jsx("span", {
|
|
232
|
+
children: "or scan with your iPhone"
|
|
233
|
+
})
|
|
234
|
+
}) : null, jsx("div", {
|
|
235
|
+
className: "cbh-imsg-qr",
|
|
236
|
+
children: jsx(QrCode, {
|
|
237
|
+
value: href,
|
|
238
|
+
label: "Scan with your phone to text Lucy"
|
|
239
|
+
})
|
|
240
|
+
}), showButton ? null : jsxs(Fragment, {
|
|
241
|
+
children: [jsxs("p", {
|
|
242
|
+
className: "cbh-imsg-hint",
|
|
243
|
+
children: ["Point your phone\u2019s camera here. Messages opens with ", ready, " ready to send."]
|
|
244
|
+
}), link?.smsAvailable || scanWith === 'sms' ? jsx("div", {
|
|
245
|
+
className: "cbh-seg",
|
|
246
|
+
role: "group",
|
|
247
|
+
"aria-label": "Which phone you have",
|
|
248
|
+
children: [['imessage', 'iPhone'], ['sms', 'Android']].map(([id, label]) => jsx("button", {
|
|
249
|
+
type: "button",
|
|
250
|
+
"data-track": "imessage_phone",
|
|
251
|
+
"data-track-item": label,
|
|
252
|
+
"aria-pressed": scanWith === id,
|
|
253
|
+
onClick: () => setScanWith(id),
|
|
254
|
+
children: label
|
|
255
|
+
}, id))
|
|
256
|
+
}) : null]
|
|
257
|
+
})]
|
|
258
|
+
}) : null, jsx(Steps, {
|
|
259
|
+
phone: phone
|
|
260
|
+
})]
|
|
261
|
+
})
|
|
262
|
+
}), jsxs("button", {
|
|
263
|
+
type: "button",
|
|
264
|
+
className: "cbh-btn cbh-btn-line cbh-imsg-here",
|
|
265
|
+
"data-track": "imessage_chat_here",
|
|
266
|
+
onClick: onChatHere,
|
|
267
|
+
children: [jsx(MessageSquareText, {
|
|
268
|
+
size: 17,
|
|
269
|
+
"aria-hidden": true
|
|
270
|
+
}), "Chat with Lucy here instead"]
|
|
271
|
+
}), jsx("p", {
|
|
272
|
+
className: "cbh-dialog-fine",
|
|
273
|
+
children: "Message and data rates may apply."
|
|
274
|
+
})]
|
|
275
|
+
})
|
|
276
|
+
});
|
|
277
|
+
}export{ImessageDialog,ImessageDialog as default};//# sourceMappingURL=ImessageDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImessageDialog.js","sources":["../../../../src/pages/Home/imessage/ImessageDialog.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"qZAsCA,MAAM,YAAY,GAAG,wEAAwE;AAC7F,MAAM,MAAM,GAAG,qEAAqE;AACpF;AACA,MAAM,UAAU,GAAG,MAAM;AACzB;AACA,MAAM,cAAc,GAAG,CAAI,CAAA,EAAA,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA,CAAA,CAAG;AAE9D,SAAS,KAAK,CAAC;AACX,EAAA;AACA,CAAA,EAAA;AAUJ,EAAC,MAAA,KAAA,GAAA,CAAA,KAAA,GAAA,mBAAA,GAAA,eAAA,EAAA,CAAA,KAAA,EAAA,cAAA,CAAA,CAAA,EAAA,iBAAA,CAAA;AAED,EAAA,OAAgBA,GAAA,CAAA,IAAA,EAAA;IACZ,SAAa,EAAA;IACb,YAAqE,EAAA,cAAA;IACrE,QAAe,EAAA,KAAA,CAAA,GAAa,CAAA,CAAA,CAAA,EAAA,CAAA,SAAY,CAAA,IAAA,EAAsB;AAC9D,MAAA,QAAO,EAAK,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImessageIcon.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/imessage/ImessageIcon.tsx"],"names":[],"mappings":"AAUA,wBAAgB,YAAY,CAAC,EAAE,IAAS,EAAE,SAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAe3F"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import {useId}from'react';const BUBBLE = 'M60 22C38.46 22 21 37.67 21 57C21 66.18 24.83 74.5 31.18 80.65C30.49 87.23 27.84 92.56 24 96C31.78 95.47 38.45 92.3 42.87 88.62C48.24 90.73 54.01 91.9 60 91.9C81.54 91.9 99 76.23 99 56.9C99 37.57 81.54 22 60 22Z';
|
|
2
|
+
function ImessageIcon({
|
|
3
|
+
size = 20,
|
|
4
|
+
className
|
|
5
|
+
}) {
|
|
6
|
+
// A gradient id per instance: the icon shows several times on a page.
|
|
7
|
+
const id = `cbh-imsg-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;
|
|
8
|
+
return jsxs("svg", {
|
|
9
|
+
className: className,
|
|
10
|
+
width: size,
|
|
11
|
+
height: size,
|
|
12
|
+
viewBox: "0 0 120 120",
|
|
13
|
+
"aria-hidden": true,
|
|
14
|
+
focusable: "false",
|
|
15
|
+
children: [jsx("defs", {
|
|
16
|
+
children: jsxs("linearGradient", {
|
|
17
|
+
id: id,
|
|
18
|
+
x1: "0",
|
|
19
|
+
y1: "0",
|
|
20
|
+
x2: "0",
|
|
21
|
+
y2: "1",
|
|
22
|
+
children: [jsx("stop", {
|
|
23
|
+
offset: "0",
|
|
24
|
+
stopColor: "#5ef07a"
|
|
25
|
+
}), jsx("stop", {
|
|
26
|
+
offset: "1",
|
|
27
|
+
stopColor: "#12bf38"
|
|
28
|
+
})]
|
|
29
|
+
})
|
|
30
|
+
}), jsx("rect", {
|
|
31
|
+
width: "120",
|
|
32
|
+
height: "120",
|
|
33
|
+
rx: "27",
|
|
34
|
+
fill: `url(#${id})`
|
|
35
|
+
}), jsx("path", {
|
|
36
|
+
fill: "#fff",
|
|
37
|
+
fillRule: "evenodd",
|
|
38
|
+
clipRule: "evenodd",
|
|
39
|
+
d: BUBBLE
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
42
|
+
}export{ImessageIcon};//# sourceMappingURL=ImessageIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImessageIcon.js","sources":["../../../../src/pages/Home/imessage/ImessageIcon.tsx"],"sourcesContent":[null],"names":[],"mappings":"mEAOA,MAAM,MAAM,GACR,qNAAqN;AAEnN,SAAU,YAAY,CAAC;MAC6C,GAAA,EAAA;AACtE,EAAA;;AAaJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QrCode.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/imessage/QrCode.tsx"],"names":[],"mappings":"AAwEA,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAwBvG"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useMemo}from'react';import {encodeQr}from'./qr.js';/** Light margin around the symbol, in modules: the four ISO/IEC 18004 asks for. */
|
|
2
|
+
const QUIET = 4;
|
|
3
|
+
const FINDER = 7;
|
|
4
|
+
const INK = '#111111';
|
|
5
|
+
/** Past this length the link carries a pairing code; level L keeps the symbol a few versions smaller. */
|
|
6
|
+
const LONG_LINK = 300;
|
|
7
|
+
function roundedRect(x, y, w, h, r) {
|
|
8
|
+
return `M${x + r} ${y}h${w - 2 * r}a${r} ${r} 0 0 1 ${r} ${r}v${h - 2 * r}` + `a${r} ${r} 0 0 1 ${-r} ${r}h${2 * r - w}a${r} ${r} 0 0 1 ${-r} ${-r}v${2 * r - h}` + `a${r} ${r} 0 0 1 ${r} ${-r}z`;
|
|
9
|
+
}
|
|
10
|
+
function layoutFor(value) {
|
|
11
|
+
if (!value) return null;
|
|
12
|
+
let symbol;
|
|
13
|
+
try {
|
|
14
|
+
symbol = encodeQr(value, value.length > LONG_LINK ? 'L' : 'M');
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const {
|
|
19
|
+
size,
|
|
20
|
+
dark
|
|
21
|
+
} = symbol;
|
|
22
|
+
const finderCell = (row, col) => row < FINDER && (col < FINDER || col >= size - FINDER) || row >= size - FINDER && col < FINDER;
|
|
23
|
+
const drawn = (row, col) => dark[row * size + col] === 1 && !finderCell(row, col);
|
|
24
|
+
let data = '';
|
|
25
|
+
for (let row = 0; row < size; row += 1) {
|
|
26
|
+
let col = 0;
|
|
27
|
+
while (col < size) {
|
|
28
|
+
if (!drawn(row, col)) {
|
|
29
|
+
col += 1;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
let end = col + 1;
|
|
33
|
+
while (end < size && drawn(row, end)) end += 1;
|
|
34
|
+
data += `M${col + QUIET} ${row + QUIET}h${end - col}v1h${col - end}z`;
|
|
35
|
+
col = end;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const finders = [[0, 0], [0, size - FINDER], [size - FINDER, 0]].map(([row, col]) => {
|
|
39
|
+
const x = col + QUIET;
|
|
40
|
+
const y = row + QUIET;
|
|
41
|
+
return roundedRect(x, y, 7, 7, 2) + roundedRect(x + 1, y + 1, 5, 5, 1.2) + roundedRect(x + 2, y + 2, 3, 3, 1);
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
total: size + 2 * QUIET,
|
|
45
|
+
data,
|
|
46
|
+
finders
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function QrCode({
|
|
50
|
+
value,
|
|
51
|
+
label,
|
|
52
|
+
className
|
|
53
|
+
}) {
|
|
54
|
+
const layout = useMemo(() => layoutFor(value), [value]);
|
|
55
|
+
const total = layout?.total ?? 29;
|
|
56
|
+
return jsxs("svg", {
|
|
57
|
+
role: "img",
|
|
58
|
+
"aria-label": label,
|
|
59
|
+
className: className,
|
|
60
|
+
viewBox: `0 0 ${total} ${total}`,
|
|
61
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
62
|
+
// Keep the white tile in Windows high-contrast mode too.
|
|
63
|
+
style: {
|
|
64
|
+
display: 'block',
|
|
65
|
+
width: '100%',
|
|
66
|
+
height: 'auto',
|
|
67
|
+
forcedColorAdjust: 'none'
|
|
68
|
+
},
|
|
69
|
+
children: [jsx("rect", {
|
|
70
|
+
width: total,
|
|
71
|
+
height: total,
|
|
72
|
+
rx: 2,
|
|
73
|
+
fill: "#fff"
|
|
74
|
+
}), layout ? jsxs(Fragment, {
|
|
75
|
+
children: [jsx("path", {
|
|
76
|
+
d: layout.data,
|
|
77
|
+
fill: INK,
|
|
78
|
+
shapeRendering: "crispEdges"
|
|
79
|
+
}), layout.finders.map(d => jsx("path", {
|
|
80
|
+
d: d,
|
|
81
|
+
fill: INK,
|
|
82
|
+
fillRule: "evenodd"
|
|
83
|
+
}, d.slice(0, 24)))]
|
|
84
|
+
}) : null]
|
|
85
|
+
});
|
|
86
|
+
}export{QrCode};//# sourceMappingURL=QrCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QrCode.js","sources":["../../../../src/pages/Home/imessage/QrCode.tsx"],"sourcesContent":[null],"names":["_jsxs"],"mappings":"6GAYA;AACA,MAA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A,EAAA,CAAA,CAAA,GAAA,WAAA,CAAA,CAAA,GAAA,CAAA,EAAA,CAAA,GAAA,CAAA,EAAA,CAAA,EAAA,CAAA,EAAA,GAAA,CAAA,GAAA,WAAA,CAAA,CAAA,GAAA,CAAA,EAAA,CAAA,GAAA,CAAA,EAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;AACN,GAAA,CAAA;AACA,EAAA,OAAC;SACA,EAAE,IAAI,GAAE,CAAA,GAAI,KAAI;AACjB,IAAA,IAAA;AACA,IAAA;;AAEJ;AACA,SAAS,MAAO,CAAA;AACpB,EAAC,KAAA;AAED,EAAM,KAAA;AACF,EAAA;AACA,CAAA,EAAA;QACO,uBAEK,SACQ,CAAA,KAAA,CAAA,EAAA,CAAA,KAAA,CAAA,CAAA;QAIZ,KAAyD,GAAA,MAAA,EAAA,KAAA,IAAA,EAAA;SACpDA,IAAA,CAAE,KAAS,EAAA;AAa5B,IAAC,IAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which way of texting Lucy the device this page is open on has - the way the Yantra app's own
|
|
3
|
+
* iMessage onboarding decides it (yantra-app features/channels/deviceSupport.ts, and the fitness
|
|
4
|
+
* surface's utils/device.ts):
|
|
5
|
+
*
|
|
6
|
+
* - an iPhone, iPad or Mac opens Messages at the iMessage line's iCloud handle;
|
|
7
|
+
* - an Android phone opens its own messaging app at the number of the iPhone that forwards SMS
|
|
8
|
+
* and RCS to the same Mac (an Android phone cannot text an Apple ID);
|
|
9
|
+
* - anything else shows a QR code for the phone to scan.
|
|
10
|
+
*
|
|
11
|
+
* Pure: the page reads `navigator` after hydration. The server has no user agent, and rendering
|
|
12
|
+
* from one there would paint the wrong answer and then mismatch.
|
|
13
|
+
*/
|
|
14
|
+
import type { TextReach } from './textLink';
|
|
15
|
+
export interface MessagesDevice {
|
|
16
|
+
/** A link opens the Messages app here (Apple's, or Android's own). */
|
|
17
|
+
opensMessages: boolean;
|
|
18
|
+
/** Which line this device texts. */
|
|
19
|
+
reach: TextReach;
|
|
20
|
+
/** A phone in the hand: a QR code on its own screen is no use. */
|
|
21
|
+
phone: boolean;
|
|
22
|
+
/** An iPhone, iPad or Mac, where Messages is iMessage. */
|
|
23
|
+
apple: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* `maxTouchPoints` tells an iPad from a Mac: since iPadOS 13, Safari sends the macOS user agent,
|
|
27
|
+
* and the touch screen is the one reliable difference.
|
|
28
|
+
*/
|
|
29
|
+
export declare function messagesDevice(userAgent: string | undefined | null, maxTouchPoints?: number): MessagesDevice;
|
|
30
|
+
export declare function currentMessagesDevice(): MessagesDevice;
|
|
31
|
+
//# sourceMappingURL=device.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/imessage/device.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC3B,sEAAsE;IACtE,aAAa,EAAE,OAAO,CAAC;IACvB,oCAAoC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,kEAAkE;IAClE,KAAK,EAAE,OAAO,CAAC;IACf,0DAA0D;IAC1D,KAAK,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAAE,cAAc,SAAI,GAAG,cAAc,CAYvG;AAED,wBAAgB,qBAAqB,IAAI,cAAc,CAGtD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `maxTouchPoints` tells an iPad from a Mac: since iPadOS 13, Safari sends the macOS user agent,
|
|
3
|
+
* and the touch screen is the one reliable difference.
|
|
4
|
+
*/
|
|
5
|
+
function messagesDevice(userAgent, maxTouchPoints = 0) {
|
|
6
|
+
const ua = userAgent ?? '';
|
|
7
|
+
// Checked first: an Android agent also says "Linux", and is never an Apple device.
|
|
8
|
+
if (/\bAndroid\b/i.test(ua)) {
|
|
9
|
+
// Android tablets drop "Mobile" from the agent; phones keep it.
|
|
10
|
+
return {
|
|
11
|
+
opensMessages: true,
|
|
12
|
+
reach: 'sms',
|
|
13
|
+
phone: /\bMobile\b/i.test(ua),
|
|
14
|
+
apple: false
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const ipad = /\biPad\b/i.test(ua) || /\bMacintosh\b/i.test(ua) && maxTouchPoints > 1;
|
|
18
|
+
const iphone = /\b(iPhone|iPod)\b/i.test(ua);
|
|
19
|
+
const mac = /\bMacintosh\b/i.test(ua) && !ipad;
|
|
20
|
+
const apple = iphone || ipad || mac;
|
|
21
|
+
return {
|
|
22
|
+
opensMessages: apple,
|
|
23
|
+
reach: 'imessage',
|
|
24
|
+
phone: iphone,
|
|
25
|
+
apple
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function currentMessagesDevice() {
|
|
29
|
+
if (typeof navigator === 'undefined') return messagesDevice(undefined);
|
|
30
|
+
return messagesDevice(navigator.userAgent, navigator.maxTouchPoints ?? 0);
|
|
31
|
+
}export{currentMessagesDevice,messagesDevice};//# sourceMappingURL=device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.js","sources":["../../../../src/pages/Home/imessage/device.ts"],"sourcesContent":[null],"names":[],"mappings":"AA0BA;;;AAGG;SACa,cAAc,CAAC,SAAoC,EAAE,cAAc,GAAG,CAAC,EAAA;AACnF,EAAA,MAAA,EAAM,GAAE,SAAY,IAAA,EAAI;;AAExB,EAAA,IAAA,mBAAmB,CAAA,EAAK,CAAE,EAAC;;WAEhB;MACV,aAAA,EAAA,IAAA;MACK,KAAA,EAAA,KAAkB;MAClB,KAAA,EAAA,aAA6B,CAAA,IAAA,CAAA,EAAA,CAAA;MAC7B,KAAA,EAAG;AACT,KAAA;AACA;AACJ,EAAC,MAAA,IAAA,GAAA,WAAA,CAAA,IAAA,CAAA,EAAA,CAAA,IAAA,gBAAA,CAAA,IAAA,CAAA,EAAA,CAAA,IAAA,cAAA,GAAA,CAAA;AAED,EAAA,eAAqC,oBAAA,CAAA,IAAA,CAAA,EAAA,CAAA;QAC7B,GAAA,GAAA,gBAAgC,CAAA,IAAA,CAAA,EAAA,CAAA,IAAA,CAAA,IAAA;AAAE,EAAA,MAAA,KAAA,GAAqB,MAAA,IAAA,IAAC,IAAS,GAAA;AACrE,EAAA,OAAA;AACJ,IAAC,aAAA,EAAA,KAAA;;;;;;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A QR code encoder for the iMessage hand-off. It lives here because the code it draws carries a
|
|
3
|
+
* one-time pairing code (whoever texts it first links their phone to the account): it is never
|
|
4
|
+
* sent to an image service, and this site has no QR package.
|
|
5
|
+
*
|
|
6
|
+
* ISO/IEC 18004, model 2: byte segments, plus alphanumeric segments for long runs of upper-case
|
|
7
|
+
* text. The second is what keeps the hand-off scannable: the hidden pairing code is ~900
|
|
8
|
+
* characters of percent-escapes (`%E2%80%8B…`), all in the alphanumeric set, and at 5.5 bits a
|
|
9
|
+
* character instead of 8 the symbol comes out several versions smaller - fewer, larger modules on
|
|
10
|
+
* a laptop screen.
|
|
11
|
+
*
|
|
12
|
+
* Pure and deterministic: the same text gives the same matrix on the server and in the browser.
|
|
13
|
+
*/
|
|
14
|
+
export type QrEcc = 'L' | 'M' | 'Q' | 'H';
|
|
15
|
+
export interface QrSymbol {
|
|
16
|
+
/** 1 to 40. */
|
|
17
|
+
version: number;
|
|
18
|
+
/** Modules per side: 17 + 4 per version. */
|
|
19
|
+
size: number;
|
|
20
|
+
/** The mask pattern drawn, 0 to 7. */
|
|
21
|
+
mask: number;
|
|
22
|
+
/** Row-major: `dark[row * size + col]` is 1 for a dark module. */
|
|
23
|
+
dark: Uint8Array;
|
|
24
|
+
}
|
|
25
|
+
export interface QrSegment {
|
|
26
|
+
mode: 'byte' | 'alnum';
|
|
27
|
+
text: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* How `text` is split into segments: long runs of alphanumeric characters on their own, the rest
|
|
31
|
+
* as bytes. Alphanumeric characters are all ASCII, so a split never falls inside a character.
|
|
32
|
+
*/
|
|
33
|
+
export declare function segmentsFor(text: string): QrSegment[];
|
|
34
|
+
/** A segment's data bits (without its mode and count header). */
|
|
35
|
+
export declare function segmentBits({ mode, text }: QrSegment): number[];
|
|
36
|
+
/**
|
|
37
|
+
* Encode `text` at the smallest version that holds it at `ecc`. `mask` forces a mask pattern
|
|
38
|
+
* (tests compare against another encoder with it); left out, the one the spec's penalty rules
|
|
39
|
+
* score lowest is used. Throws a RangeError for text too long for any QR code.
|
|
40
|
+
*/
|
|
41
|
+
export declare function encodeQr(text: string, ecc?: QrEcc, mask?: number): QrSymbol;
|
|
42
|
+
//# sourceMappingURL=qr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/imessage/qr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE1C,MAAM,WAAW,QAAQ;IACrB,eAAe;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,IAAI,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CAChB;AA0ED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAoBrD;AAmBD,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,SAAS,GAAG,MAAM,EAAE,CAE/D;AAwUD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,KAAW,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAwDhF"}
|