@clawcard/cli 2.1.2 → 2.1.3

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.
@@ -15,7 +15,7 @@ async function poll() {
15
15
  }
16
16
  }
17
17
  } catch {
18
- // Server not running — that's fine, CLI hasn't started a pay command
18
+ // Server not running — CLI hasn't started a pay command
19
19
  }
20
20
  setTimeout(poll, POLL_INTERVAL);
21
21
  }
@@ -32,26 +32,30 @@ async function fillActiveTab(message) {
32
32
  return;
33
33
  }
34
34
 
35
- // Try main frame first
36
- try {
37
- const response = await chrome.tabs.sendMessage(tab.id, message);
38
- if (response && response.filled && response.filled.length > 0) {
39
- await sendResult(response);
40
- return;
41
- }
42
- } catch {
43
- // Main frame didn't have fields — try subframes
44
- }
45
-
46
- // Try all subframes (where Stripe iframes live)
35
+ // Get all frames in the tab
47
36
  const frames = await chrome.webNavigation.getAllFrames({ tabId: tab.id });
48
37
  if (!frames || frames.length === 0) {
49
38
  await sendResult({ success: false, error: "No frames found" });
50
39
  return;
51
40
  }
52
41
 
42
+ // Inject content script into ALL frames first (handles dynamically added iframes)
43
+ for (const frame of frames) {
44
+ try {
45
+ await chrome.scripting.executeScript({
46
+ target: { tabId: tab.id, frameIds: [frame.frameId] },
47
+ files: ["content.js"],
48
+ });
49
+ } catch {
50
+ // Can't inject into this frame — that's fine
51
+ }
52
+ }
53
+
54
+ // Small delay to let injected scripts initialize
55
+ await new Promise((r) => setTimeout(r, 100));
56
+
57
+ // Now try sending the fill command to each frame
53
58
  for (const frame of frames) {
54
- if (frame.frameId === 0) continue;
55
59
  try {
56
60
  const response = await chrome.tabs.sendMessage(tab.id, message, {
57
61
  frameId: frame.frameId,
@@ -61,7 +65,7 @@ async function fillActiveTab(message) {
61
65
  return;
62
66
  }
63
67
  } catch {
64
- // This frame doesn't have our content script — continue
68
+ // No content script in this frame or no fields — continue
65
69
  }
66
70
  }
67
71
 
@@ -92,6 +92,13 @@ function fillField(el, value) {
92
92
  el.dispatchEvent(new Event("blur", { bubbles: true }));
93
93
  }
94
94
 
95
+ // Guard against duplicate injection
96
+ if (window.__clawcardPayInjected) {
97
+ // Already injected — just re-register listener
98
+ } else {
99
+ window.__clawcardPayInjected = true;
100
+ }
101
+
95
102
  // Listen for fill commands from background script
96
103
  chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
97
104
  if (message.action !== "fill") return;
@@ -3,7 +3,7 @@
3
3
  "name": "ClawCard Pay",
4
4
  "version": "1.0.1",
5
5
  "description": "Fills payment form fields for ClawCard agents",
6
- "permissions": ["webNavigation"],
6
+ "permissions": ["webNavigation", "scripting", "activeTab"],
7
7
  "host_permissions": ["<all_urls>"],
8
8
  "background": {
9
9
  "service_worker": "background.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawcard/cli",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "The ClawCard CLI — manage your agent keys, billing, and setup from the terminal",
5
5
  "bin": {
6
6
  "clawcard": "./bin/clawcard.mjs"