@amos.com/amos-js 0.10.4 → 0.10.5
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/index.js +3 -3
- package/dist/index.mjs +258 -319
- package/dist/types.d.ts +0 -10
- package/package.json +1 -1
- package/src/messaging.ts +0 -19
- package/src/plaid-bank-ui.ts +0 -11
- package/src/types.ts +0 -11
- package/dist/log.d.ts +0 -12
- package/src/log.ts +0 -74
package/dist/types.d.ts
CHANGED
|
@@ -267,16 +267,6 @@ export type Message = {
|
|
|
267
267
|
requestId: string;
|
|
268
268
|
link_token?: string;
|
|
269
269
|
error?: string;
|
|
270
|
-
} | {
|
|
271
|
-
/**
|
|
272
|
-
* Parent → embed: info telemetry for Rollbar. The iframe reports
|
|
273
|
-
* `message` with `endpoint`, `headers`, and `body`.
|
|
274
|
-
*/
|
|
275
|
-
type: "PARENT_INFO_LOG";
|
|
276
|
-
message: string;
|
|
277
|
-
endpoint?: string;
|
|
278
|
-
headers?: Record<string, string>;
|
|
279
|
-
body?: unknown;
|
|
280
270
|
};
|
|
281
271
|
/**
|
|
282
272
|
* Identity helper that brands an object as a typed `Message`.
|
package/package.json
CHANGED
package/src/messaging.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { components } from "@amos.com/node";
|
|
2
2
|
import { decodeJwt } from "./jwt";
|
|
3
|
-
import { reportParentInfoLog } from "./log";
|
|
4
3
|
import { getBankPlaidSession } from "./plaid-session";
|
|
5
4
|
import {
|
|
6
5
|
type Appearance,
|
|
@@ -293,24 +292,6 @@ function postConfirmIntent({
|
|
|
293
292
|
resetIframeFields(iframe);
|
|
294
293
|
}
|
|
295
294
|
|
|
296
|
-
const origin = getIframeTargetOrigin(iframe);
|
|
297
|
-
reportParentInfoLog({
|
|
298
|
-
iframe,
|
|
299
|
-
message:
|
|
300
|
-
type === "CONFIRM_PAYMENT_INTENT"
|
|
301
|
-
? "confirmPaymentIntent"
|
|
302
|
-
: "confirmSetupIntent",
|
|
303
|
-
endpoint:
|
|
304
|
-
type === "CONFIRM_PAYMENT_INTENT"
|
|
305
|
-
? "POST /embed/payment_intents/{id}/confirm_with_payment_method"
|
|
306
|
-
: "POST /embed/setup_intents/{id}/confirm_with_payment_method",
|
|
307
|
-
headers: {
|
|
308
|
-
origin: window.location.origin,
|
|
309
|
-
"iframe-origin": origin,
|
|
310
|
-
},
|
|
311
|
-
body: { id, token, ...(plaid ? { plaid } : {}) },
|
|
312
|
-
});
|
|
313
|
-
|
|
314
295
|
iframe.contentWindow?.postMessage(
|
|
315
296
|
createMessage({
|
|
316
297
|
type,
|
package/src/plaid-bank-ui.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { reportParentInfoLog } from "./log";
|
|
2
1
|
import { requestPlaidLinkToken } from "./messaging";
|
|
3
2
|
import type { PaymentMethodFormListenerOptions } from "./payment-method-form";
|
|
4
3
|
import {
|
|
@@ -310,16 +309,6 @@ export function attachPlaidBankUi({
|
|
|
310
309
|
thresholdKnown = true;
|
|
311
310
|
achThreshold = event.data.achThreshold ?? undefined;
|
|
312
311
|
requireVerification = event.data.requireVerification === true;
|
|
313
|
-
reportParentInfoLog({
|
|
314
|
-
iframe,
|
|
315
|
-
message: "merchant ach_threshold",
|
|
316
|
-
endpoint: "ACH_THRESHOLD",
|
|
317
|
-
headers: { origin: event.origin },
|
|
318
|
-
body: {
|
|
319
|
-
achThreshold,
|
|
320
|
-
requireVerification,
|
|
321
|
-
},
|
|
322
|
-
});
|
|
323
312
|
if (linked && !requiresConnect()) {
|
|
324
313
|
unlink();
|
|
325
314
|
return;
|
package/src/types.ts
CHANGED
|
@@ -557,17 +557,6 @@ export type Message =
|
|
|
557
557
|
requestId: string;
|
|
558
558
|
link_token?: string;
|
|
559
559
|
error?: string;
|
|
560
|
-
}
|
|
561
|
-
| {
|
|
562
|
-
/**
|
|
563
|
-
* Parent → embed: info telemetry for Rollbar. The iframe reports
|
|
564
|
-
* `message` with `endpoint`, `headers`, and `body`.
|
|
565
|
-
*/
|
|
566
|
-
type: "PARENT_INFO_LOG";
|
|
567
|
-
message: string;
|
|
568
|
-
endpoint?: string;
|
|
569
|
-
headers?: Record<string, string>;
|
|
570
|
-
body?: unknown;
|
|
571
560
|
};
|
|
572
561
|
|
|
573
562
|
/**
|
package/dist/log.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Forward an info log to the embed iframe so Rollbar records it with
|
|
3
|
-
* Amos credentials. Payload shape matches dashboard/embed API traces:
|
|
4
|
-
* `endpoint`, `headers`, `body`.
|
|
5
|
-
*/
|
|
6
|
-
export declare function reportParentInfoLog({ iframe, message, endpoint, headers, body, }: {
|
|
7
|
-
iframe: HTMLIFrameElement;
|
|
8
|
-
message: string;
|
|
9
|
-
endpoint: string;
|
|
10
|
-
headers?: Record<string, string>;
|
|
11
|
-
body?: unknown;
|
|
12
|
-
}): void;
|
package/src/log.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { createMessage } from "./types";
|
|
2
|
-
|
|
3
|
-
const SENSITIVE_HEADER_NAMES = new Set([
|
|
4
|
-
"authorization",
|
|
5
|
-
"cookie",
|
|
6
|
-
"set-cookie",
|
|
7
|
-
"x-api-key",
|
|
8
|
-
]);
|
|
9
|
-
|
|
10
|
-
const SENSITIVE_BODY_KEYS = new Set([
|
|
11
|
-
"authorization",
|
|
12
|
-
"encrypted_account_number",
|
|
13
|
-
"link_token",
|
|
14
|
-
"public_token",
|
|
15
|
-
"token",
|
|
16
|
-
]);
|
|
17
|
-
|
|
18
|
-
function redactHeaders(
|
|
19
|
-
headers: Record<string, string>,
|
|
20
|
-
): Record<string, string> {
|
|
21
|
-
const redacted: Record<string, string> = {};
|
|
22
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
23
|
-
redacted[key] = SENSITIVE_HEADER_NAMES.has(key.toLowerCase())
|
|
24
|
-
? "[REDACTED]"
|
|
25
|
-
: value;
|
|
26
|
-
}
|
|
27
|
-
return redacted;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function redactBody(body: unknown): unknown {
|
|
31
|
-
if (Array.isArray(body)) {
|
|
32
|
-
return body.map(redactBody);
|
|
33
|
-
}
|
|
34
|
-
if (body !== null && typeof body === "object") {
|
|
35
|
-
const redacted: Record<string, unknown> = {};
|
|
36
|
-
for (const [key, value] of Object.entries(body)) {
|
|
37
|
-
redacted[key] = SENSITIVE_BODY_KEYS.has(key)
|
|
38
|
-
? "[REDACTED]"
|
|
39
|
-
: redactBody(value);
|
|
40
|
-
}
|
|
41
|
-
return redacted;
|
|
42
|
-
}
|
|
43
|
-
return body;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Forward an info log to the embed iframe so Rollbar records it with
|
|
48
|
-
* Amos credentials. Payload shape matches dashboard/embed API traces:
|
|
49
|
-
* `endpoint`, `headers`, `body`.
|
|
50
|
-
*/
|
|
51
|
-
export function reportParentInfoLog({
|
|
52
|
-
iframe,
|
|
53
|
-
message,
|
|
54
|
-
endpoint,
|
|
55
|
-
headers = {},
|
|
56
|
-
body,
|
|
57
|
-
}: {
|
|
58
|
-
iframe: HTMLIFrameElement;
|
|
59
|
-
message: string;
|
|
60
|
-
endpoint: string;
|
|
61
|
-
headers?: Record<string, string>;
|
|
62
|
-
body?: unknown;
|
|
63
|
-
}): void {
|
|
64
|
-
iframe.contentWindow?.postMessage(
|
|
65
|
-
createMessage({
|
|
66
|
-
type: "PARENT_INFO_LOG",
|
|
67
|
-
message,
|
|
68
|
-
endpoint,
|
|
69
|
-
headers: redactHeaders(headers),
|
|
70
|
-
body: redactBody(body),
|
|
71
|
-
}),
|
|
72
|
-
new URL(iframe.src).origin,
|
|
73
|
-
);
|
|
74
|
-
}
|