@amos.com/amos-js 0.10.3 → 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/jwt.d.ts CHANGED
@@ -12,9 +12,5 @@ export declare function decodeJwt(token: string | undefined): {
12
12
  /**
13
13
  * Resolve the Amos embed origin (production vs. sandbox) from a render
14
14
  * token's decoded payload.
15
- *
16
- * When the parent page is on localhost / *.localhost, always target the
17
- * local embed app (https://embed.localhost) so dashboard + embed can be
18
- * developed together without pointing at sandbox/production iframes.
19
15
  */
20
16
  export declare function getEmbedOrigin(renderToken: string): string;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amos.com/amos-js",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",
package/src/jwt.ts CHANGED
@@ -25,35 +25,11 @@ export function decodeJwt(token: string | undefined): {
25
25
  };
26
26
  }
27
27
 
28
- // --- BEGIN amos-ui sdk:link localhost embed origin ---
29
- /**
30
- * True when the parent page is running on localhost / *.localhost
31
- * (e.g. https://dashboard.localhost via portless).
32
- *
33
- * Injected by amos-ui `pnpm sdk:link`; removed by `pnpm sdk:unlink`.
34
- * Do not commit this block to amos-js.
35
- */
36
- function isLocalhostParent(): boolean {
37
- if (typeof window === "undefined") {
38
- return false;
39
- }
40
- const { hostname } = window.location;
41
- return hostname === "localhost" || hostname.endsWith(".localhost");
42
- }
43
-
44
28
  /**
45
29
  * Resolve the Amos embed origin (production vs. sandbox) from a render
46
30
  * token's decoded payload.
47
- *
48
- * When the parent page is on localhost / *.localhost, always target the
49
- * local embed app (https://embed.localhost) so dashboard + embed can be
50
- * developed together without pointing at sandbox/production iframes.
51
31
  */
52
32
  export function getEmbedOrigin(renderToken: string): string {
53
- if (isLocalhostParent()) {
54
- return "https://embed.localhost";
55
- }
56
-
57
33
  const { env = "sandbox" }: components["schemas"]["RenderTokenJwt"] =
58
34
  decodeJwt(renderToken).payload;
59
35
 
@@ -66,4 +42,3 @@ export function getEmbedOrigin(renderToken: string): string {
66
42
  return "https://embed-sandbox.amos.com";
67
43
  }
68
44
  }
69
- // --- END amos-ui sdk:link localhost embed origin ---
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,
@@ -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
- }