@mochabug/adapt-astro 1.0.0-rc1 → 1.0.0-rc2

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/README.md CHANGED
@@ -12,16 +12,16 @@ Requires Astro 3, 4, or 5.
12
12
 
13
13
  ```astro
14
14
  ---
15
- import AdaptAutomation from '@mochabug/adapt-astro/AdaptAutomation.astro';
15
+ import Adapt from '@mochabug/adapt-astro/Adapt.astro';
16
16
  ---
17
17
 
18
- <AdaptAutomation id="auto-123" style="height: 600px;" />
18
+ <Adapt id="auto-123" style="height: 600px;" />
19
19
  ```
20
20
 
21
21
  If the automation requires authentication:
22
22
 
23
23
  ```astro
24
- <AdaptAutomation id="auto-123" authToken="your-token" style="height: 600px;" />
24
+ <Adapt id="auto-123" authToken="your-token" style="height: 600px;" />
25
25
  ```
26
26
 
27
27
  ## SSR
@@ -37,52 +37,34 @@ export default defineConfig({
37
37
 
38
38
  ```astro
39
39
  ---
40
- import AdaptAutomation from '@mochabug/adapt-astro/AdaptAutomation.astro';
40
+ import Adapt from '@mochabug/adapt-astro/Adapt.astro';
41
41
  import { startSession } from '@mochabug/adapt-core';
42
42
 
43
43
  const authToken = await getAuthTokenFromBackend();
44
44
  const { token } = await startSession({ id: 'auto-123' }, authToken);
45
45
  ---
46
46
 
47
- <AdaptAutomation
48
- id="auto-123"
49
- sessionToken={token}
50
- style="height: 600px;"
51
- />
47
+ <Adapt id="auto-123" sessionToken={token} style="height: 600px;" />
52
48
  ```
53
49
 
54
50
  ## Session inheritance
55
51
 
56
52
  ```astro
57
53
  <!-- from URL hash: example.com#mb_session=xxx -->
58
- <AdaptAutomation
59
- id="auto-123"
60
- inheritFrom={{ hash: 'mb_session' }}
61
- />
54
+ <Adapt id="auto-123" inheritFrom={{ hash: 'mb_session' }} />
62
55
 
63
56
  <!-- from URL param: example.com?token=xxx -->
64
- <AdaptAutomation
65
- id="auto-123"
66
- inheritFrom={{ param: 'token' }}
67
- />
57
+ <Adapt id="auto-123" inheritFrom={{ param: 'token' }} />
68
58
  ```
69
59
 
70
60
  ## Fork display
71
61
 
72
62
  ```astro
73
63
  <!-- side-by-side -->
74
- <AdaptAutomation
75
- id="auto-123"
76
- forkDisplayMode="side-by-side"
77
- sideBySideSplit={60}
78
- />
64
+ <Adapt id="auto-123" forkDisplayMode="side-by-side" sideBySideSplit={60} />
79
65
 
80
66
  <!-- dialog -->
81
- <AdaptAutomation
82
- id="auto-123"
83
- forkDisplayMode="dialog"
84
- dialogBackdropClose
85
- />
67
+ <Adapt id="auto-123" forkDisplayMode="dialog" dialogBackdropClose />
86
68
  ```
87
69
 
88
70
  ## Props
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mochabug/adapt-astro",
3
- "version": "1.0.0-rc1",
3
+ "version": "1.0.0-rc2",
4
4
  "description": "Astro component for Adapt automation platform",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -10,7 +10,7 @@
10
10
  "types": "./src/index.ts",
11
11
  "import": "./src/index.ts"
12
12
  },
13
- "./AdaptAutomation.astro": "./src/AdaptAutomation.astro"
13
+ "./Adapt.astro": "./src/Adapt.astro"
14
14
  },
15
15
  "files": [
16
16
  "src"
@@ -31,6 +31,6 @@
31
31
  "astro": "^3.0.0 || ^4.0.0 || ^5.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "@mochabug/adapt-web": "^1.0.0-rc22"
34
+ "@mochabug/adapt-web": "^1.0.0-rc23"
35
35
  }
36
36
  }
@@ -55,7 +55,7 @@ const containerId = `adapt-${Math.random().toString(36).slice(2, 11)}`;
55
55
  <script>
56
56
  import { AdaptWebClient } from "@mochabug/adapt-web";
57
57
 
58
- function initAdaptAutomation(container: HTMLElement) {
58
+ function initAdapt(container: HTMLElement) {
59
59
  const id = container.dataset.adaptId;
60
60
  if (!id) return;
61
61
 
@@ -79,7 +79,7 @@ const containerId = `adapt-${Math.random().toString(36).slice(2, 11)}`;
79
79
  (container as any).__adaptClient = client;
80
80
  }
81
81
 
82
- function cleanupAdaptAutomation(container: HTMLElement) {
82
+ function cleanupAdapt(container: HTMLElement) {
83
83
  const client = (container as any).__adaptClient;
84
84
  if (client) {
85
85
  client.destroy();
@@ -91,7 +91,7 @@ const containerId = `adapt-${Math.random().toString(36).slice(2, 11)}`;
91
91
  function initAll() {
92
92
  document.querySelectorAll<HTMLElement>("[data-adapt-id]").forEach((container) => {
93
93
  if (!(container as any).__adaptClient) {
94
- initAdaptAutomation(container);
94
+ initAdapt(container);
95
95
  }
96
96
  });
97
97
  }
@@ -104,6 +104,6 @@ const containerId = `adapt-${Math.random().toString(36).slice(2, 11)}`;
104
104
 
105
105
  // Cleanup before page swap (View Transitions)
106
106
  document.addEventListener("astro:before-swap", () => {
107
- document.querySelectorAll<HTMLElement>("[data-adapt-id]").forEach(cleanupAdaptAutomation);
107
+ document.querySelectorAll<HTMLElement>("[data-adapt-id]").forEach(cleanupAdapt);
108
108
  });
109
109
  </script>
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  // Import the component directly from the .astro file
2
- // Usage: import { AdaptAutomation } from '@mochabug/adapt-astro';
3
- // or: import AdaptAutomation from '@mochabug/adapt-astro/AdaptAutomation.astro';
2
+ // Usage: import Adapt from '@mochabug/adapt-astro/Adapt.astro';
4
3
 
5
4
  // Re-export types for convenience
6
5
  export type { Output, StatusJson } from "@mochabug/adapt-core";