@sampleapp.ai/sdk 1.0.29 → 1.0.30

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.
Files changed (143) hide show
  1. package/dist/components/guardian/app-layout-no-sidebar.js +8 -0
  2. package/dist/components/guardian/ask-ai-view.js +249 -0
  3. package/dist/components/guardian/code-focus-section.d.ts +41 -0
  4. package/dist/components/guardian/code-focus-section.js +174 -0
  5. package/dist/components/guardian/context/guardian-context.js +94 -0
  6. package/dist/components/guardian/context/vm-context.js +28 -0
  7. package/dist/components/guardian/default-guide-view.js +34 -0
  8. package/dist/components/guardian/demo/guardian-demo.js +35 -0
  9. package/dist/components/guardian/demo/left-view/toggle.js +28 -0
  10. package/dist/components/guardian/demo/left-view.js +49 -0
  11. package/dist/components/guardian/guardian-component.js +79 -0
  12. package/dist/components/guardian/guardian-demo.js +35 -0
  13. package/dist/components/guardian/guardian-home.d.ts +4 -0
  14. package/dist/components/guardian/guardian-home.js +61 -0
  15. package/dist/components/guardian/guardian-playground.js +45 -0
  16. package/dist/components/guardian/guardian-style-wrapper.js +29 -0
  17. package/dist/components/guardian/guardian-upload-spec.d.ts +14 -0
  18. package/dist/components/guardian/guardian-upload-spec.js +160 -0
  19. package/dist/components/guardian/header/glassmorphic-combobox.d.ts +15 -0
  20. package/dist/components/guardian/header/glassmorphic-combobox.js +30 -0
  21. package/dist/components/guardian/header.js +61 -0
  22. package/dist/components/guardian/hooks/use-frame-messages.js +65 -0
  23. package/dist/components/guardian/hooks/use-frame-params.js +44 -0
  24. package/dist/components/guardian/hooks/use-sandbox-url-loader.js +101 -0
  25. package/dist/components/guardian/ide/browser.js +538 -0
  26. package/dist/components/guardian/index.js +8 -0
  27. package/dist/components/guardian/layout/app-layout-no-sidebar.js +8 -0
  28. package/dist/components/guardian/layout/header/glassmorphic-combobox.js +48 -0
  29. package/dist/components/guardian/layout/header.js +63 -0
  30. package/dist/components/guardian/right-view/code-view.js +56 -0
  31. package/dist/components/guardian/right-view/pill-file-selector.js +233 -0
  32. package/dist/components/guardian/right-view/preview-control-bar.js +25 -0
  33. package/dist/components/guardian/right-view/right-panel-view.js +38 -0
  34. package/dist/components/guardian/right-view/right-top-down-view.js +289 -0
  35. package/dist/components/guardian/right-view/right-view.js +28 -0
  36. package/dist/components/guardian/right-view/simplified-editor.js +234 -0
  37. package/dist/components/guardian/types/ide-types.js +162 -0
  38. package/dist/components/guardian/types.js +3 -0
  39. package/dist/components/guardian/ui/ai-loader.js +48 -0
  40. package/dist/components/guardian/ui/badge.js +24 -0
  41. package/dist/components/guardian/ui/button.js +45 -0
  42. package/dist/components/guardian/ui/command.js +63 -0
  43. package/dist/components/guardian/ui/console-with-app.js +17 -0
  44. package/dist/components/guardian/ui/dialog.js +57 -0
  45. package/dist/components/guardian/ui/dropdown-menu.js +82 -0
  46. package/dist/components/guardian/ui/markdown.js +57 -0
  47. package/dist/components/guardian/ui/popover.js +25 -0
  48. package/dist/components/guardian/ui/tooltip.js +25 -0
  49. package/dist/components/guardian/utils.js +88 -0
  50. package/dist/components/guardian/zip-to-codebase.js +246 -0
  51. package/dist/components/guardian/zip-to-filetree.js +284 -0
  52. package/dist/components/icons.js +22 -0
  53. package/dist/components/sandbox/Sandbox.js +87 -0
  54. package/dist/components/sandbox/SandboxHome.js +141 -0
  55. package/dist/components/sandbox/api.js +108 -0
  56. package/dist/components/sandbox/guardian/app-layout-no-sidebar.js +8 -0
  57. package/dist/components/sandbox/guardian/ask-ai-view.js +249 -0
  58. package/dist/components/sandbox/guardian/code-focus-section.js +174 -0
  59. package/dist/components/sandbox/guardian/context/guardian-context.js +94 -0
  60. package/dist/components/sandbox/guardian/context/vm-context.js +28 -0
  61. package/dist/components/sandbox/guardian/default-guide-view.js +34 -0
  62. package/dist/components/sandbox/guardian/demo/guardian-demo.js +35 -0
  63. package/dist/components/sandbox/guardian/demo/left-view/toggle.js +28 -0
  64. package/dist/components/sandbox/guardian/demo/left-view.js +58 -0
  65. package/dist/components/sandbox/guardian/guardian-component.js +97 -0
  66. package/dist/components/sandbox/guardian/guardian-demo.js +35 -0
  67. package/dist/components/sandbox/guardian/guardian-home.d.ts +4 -0
  68. package/dist/components/sandbox/guardian/guardian-home.js +61 -0
  69. package/dist/components/sandbox/guardian/guardian-playground.js +45 -0
  70. package/dist/components/sandbox/guardian/guardian-style-wrapper.js +33 -0
  71. package/dist/components/sandbox/guardian/guardian-upload-spec.d.ts +14 -0
  72. package/dist/components/sandbox/guardian/guardian-upload-spec.js +160 -0
  73. package/dist/components/sandbox/guardian/header/glassmorphic-combobox.js +30 -0
  74. package/dist/components/sandbox/guardian/header.js +61 -0
  75. package/dist/components/sandbox/guardian/hooks/use-frame-messages.js +65 -0
  76. package/dist/components/sandbox/guardian/hooks/use-frame-params.js +44 -0
  77. package/dist/components/sandbox/guardian/hooks/use-sandbox-url-loader.js +145 -0
  78. package/dist/components/sandbox/guardian/ide/browser.js +538 -0
  79. package/dist/components/sandbox/guardian/index.js +8 -0
  80. package/dist/components/sandbox/guardian/right-view/code-view.js +60 -0
  81. package/dist/components/sandbox/guardian/right-view/pill-file-selector.js +233 -0
  82. package/dist/components/sandbox/guardian/right-view/preview-control-bar.js +25 -0
  83. package/dist/components/sandbox/guardian/right-view/right-panel-view.js +38 -0
  84. package/dist/components/sandbox/guardian/right-view/right-top-down-view.js +289 -0
  85. package/dist/components/sandbox/guardian/right-view/right-view.js +28 -0
  86. package/dist/components/sandbox/guardian/right-view/simplified-editor.js +234 -0
  87. package/dist/components/sandbox/guardian/types/ide-types.js +162 -0
  88. package/dist/components/sandbox/guardian/types.js +3 -0
  89. package/dist/components/sandbox/guardian/ui/ai-loader.js +48 -0
  90. package/dist/components/sandbox/guardian/ui/badge.js +24 -0
  91. package/dist/components/sandbox/guardian/ui/button.js +45 -0
  92. package/dist/components/sandbox/guardian/ui/command.js +63 -0
  93. package/dist/components/sandbox/guardian/ui/console-with-app.js +17 -0
  94. package/dist/components/sandbox/guardian/ui/dialog.js +57 -0
  95. package/dist/components/sandbox/guardian/ui/dropdown-menu.js +82 -0
  96. package/dist/components/sandbox/guardian/ui/markdown/accordion-group/accordion.js +62 -0
  97. package/dist/components/sandbox/guardian/ui/markdown/accordion-group.js +23 -0
  98. package/dist/components/sandbox/guardian/ui/markdown/callout/callout-check.js +4 -0
  99. package/dist/components/sandbox/guardian/ui/markdown/callout/callout-error.js +4 -0
  100. package/dist/components/sandbox/guardian/ui/markdown/callout/callout-info.js +4 -0
  101. package/dist/components/sandbox/guardian/ui/markdown/callout/callout-note.js +4 -0
  102. package/dist/components/sandbox/guardian/ui/markdown/callout/callout-tip.js +4 -0
  103. package/dist/components/sandbox/guardian/ui/markdown/callout/callout-warning.js +4 -0
  104. package/dist/components/sandbox/guardian/ui/markdown/callout/shared/callout.js +9 -0
  105. package/dist/components/sandbox/guardian/ui/markdown/callout/shared/types.js +1 -0
  106. package/dist/components/sandbox/guardian/ui/markdown/card-group/card.js +18 -0
  107. package/dist/components/sandbox/guardian/ui/markdown/card-group.js +25 -0
  108. package/dist/components/sandbox/guardian/ui/markdown/code-group/code-block.js +87 -0
  109. package/dist/components/sandbox/guardian/ui/markdown/code-group.js +101 -0
  110. package/dist/components/sandbox/guardian/ui/markdown/icon.js +31 -0
  111. package/dist/components/sandbox/guardian/ui/markdown.js +786 -0
  112. package/dist/components/sandbox/guardian/ui/popover.js +25 -0
  113. package/dist/components/sandbox/guardian/ui/tooltip.js +25 -0
  114. package/dist/components/sandbox/guardian/utils.js +88 -0
  115. package/dist/components/sandbox/guardian/zip-to-codebase.js +259 -0
  116. package/dist/components/sandbox/guardian/zip-to-filetree.js +284 -0
  117. package/dist/components/sandbox/index.js +4 -0
  118. package/dist/components/sandbox/sandbox-control-bar.js +91 -0
  119. package/dist/components/sandbox/sandbox-header.js +52 -0
  120. package/dist/components/sandbox/sandbox-home/SandboxCard.js +59 -0
  121. package/dist/components/sandbox/sandbox-home/SandboxHome.js +174 -0
  122. package/dist/components/sandbox/sandbox-home/SearchBar.js +12 -0
  123. package/dist/components/sandbox/sandbox-home/index.js +3 -0
  124. package/dist/components/sandbox/sandbox-left-panel.js +248 -0
  125. package/dist/components/sandbox/sandbox-loading.js +48 -0
  126. package/dist/components/sandbox/sandbox-right-panel.js +247 -0
  127. package/dist/components/sandbox/types.js +1 -0
  128. package/dist/components/sandbox.js +32 -0
  129. package/dist/components/tailwind-example.js +46 -0
  130. package/dist/index.d.ts +336 -1
  131. package/dist/index.es.js +90131 -421
  132. package/dist/index.js +13 -2
  133. package/dist/index.standalone.js +61 -53
  134. package/dist/index.standalone.umd.js +17 -24
  135. package/dist/lib/api-client.example.js +60 -0
  136. package/dist/lib/api-client.js +98 -0
  137. package/dist/lib/generated-css.js +4 -0
  138. package/dist/lib/inject-styles.js +42 -0
  139. package/dist/lib/shadow-dom-wrapper.js +42 -0
  140. package/dist/lib/utils.js +5 -0
  141. package/dist/sdk.css +1 -1
  142. package/dist/tailwind.css +1 -0
  143. package/package.json +32 -5
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Example usage of the API client
3
+ *
4
+ * This file demonstrates how to use the API client to interact with
5
+ * the SampleApp backend API.
6
+ *
7
+ * The apiKey will be passed in from SandboxProps.apiKey (from types.ts)
8
+ */
9
+ import { createApiClient } from "./api-client";
10
+ // Example: How to use the API client with apiKey from SandboxProps
11
+ function createClientFromSandboxProps(props, baseUrl = "http://127.0.0.1:8000") {
12
+ return createApiClient({
13
+ baseUrl,
14
+ apiKey: props.apiKey, // apiKey comes from SandboxProps
15
+ });
16
+ }
17
+ // Initialize the API client (example)
18
+ const client = createApiClient({
19
+ baseUrl: "http://127.0.0.1:8000", // or your production URL
20
+ apiKey: "your-api-key-here", // This will come from SandboxProps.apiKey
21
+ });
22
+ // Example 1: Get public sandbox content
23
+ // Note: sandboxId from SandboxProps maps to sandbox_content_uid
24
+ async function getSandboxContentExample(apiKey, sandboxId, baseUrl = "http://127.0.0.1:8000") {
25
+ try {
26
+ const client = createApiClient({
27
+ baseUrl,
28
+ apiKey, // apiKey from SandboxProps.apiKey
29
+ });
30
+ // sandboxId from SandboxProps maps to sandbox_content_uid
31
+ const sandboxContent = await client.sandboxContent.getPublic(sandboxId);
32
+ console.log("Sandbox content:", sandboxContent);
33
+ return sandboxContent;
34
+ }
35
+ catch (error) {
36
+ console.error("Error fetching sandbox content:", error);
37
+ throw error;
38
+ }
39
+ }
40
+ // Example 2: Start a sandbox
41
+ async function startSandboxExample() {
42
+ try {
43
+ const response = await client.sdk.startSandbox({
44
+ env: {
45
+ API_KEY: "your-api-key",
46
+ ENVIRONMENT: "production",
47
+ },
48
+ apiKey: "your-sdk-api-key",
49
+ chatUid: "your-chat-uid",
50
+ });
51
+ console.log("Container URL:", response.container_url);
52
+ return response;
53
+ }
54
+ catch (error) {
55
+ console.error("Error starting sandbox:", error);
56
+ throw error;
57
+ }
58
+ }
59
+ // Export examples for use in other files
60
+ export { getSandboxContentExample, startSandboxExample, createClientFromSandboxProps, };
@@ -0,0 +1,98 @@
1
+ /**
2
+ * SDK API Client for interacting with the SampleApp backend API
3
+ */
4
+ /**
5
+ * Main API client class
6
+ */
7
+ class ApiClient {
8
+ constructor(config) {
9
+ /**
10
+ * Sandbox content endpoints
11
+ */
12
+ this.sandboxContent = {
13
+ /**
14
+ * Get public sandbox content by UID
15
+ * @param sandboxContentUid - The UID of the sandbox content
16
+ * @returns The sandbox content data
17
+ */
18
+ getPublic: async (sandboxContentUid) => {
19
+ return this.request([
20
+ "sandbox-content",
21
+ sandboxContentUid,
22
+ "public",
23
+ ]);
24
+ },
25
+ /**
26
+ * Get all sandbox contents for a specific playground
27
+ * @param playgroundUid - The UID of the playground
28
+ * @param skip - Number of records to skip (default: 0)
29
+ * @param limit - Maximum number of records to return (default: 100)
30
+ * @returns Array of sandbox content data
31
+ */
32
+ getByPlayground: async (playgroundUid, skip = 0, limit = 100) => {
33
+ return this.request(["sandbox-content", "playground", playgroundUid], {
34
+ method: "GET",
35
+ }, true, // Use x-api-key header instead of Authorization Bearer
36
+ { skip, limit });
37
+ },
38
+ };
39
+ /**
40
+ * SDK endpoints
41
+ */
42
+ this.sdk = {
43
+ /**
44
+ * Start a sandbox
45
+ * @param request - The start sandbox request
46
+ * @returns The sandbox response with container URL
47
+ */
48
+ startSandbox: async (request) => {
49
+ return this.request(["sdk", "start-sandbox"], {
50
+ method: "POST",
51
+ body: JSON.stringify(request),
52
+ });
53
+ },
54
+ };
55
+ this.baseUrl = config.baseUrl.replace(/\/$/, ""); // Remove trailing slash
56
+ this.apiKey = config.apiKey;
57
+ }
58
+ /**
59
+ * Makes a request to the API
60
+ */
61
+ async request(endpoint, options = {}, useApiKeyHeader = false, queryParams) {
62
+ let url = `${this.baseUrl}/api/v1/${endpoint.join("/")}`;
63
+ if (queryParams) {
64
+ const params = new URLSearchParams();
65
+ Object.entries(queryParams).forEach(([key, value]) => {
66
+ params.append(key, value.toString());
67
+ });
68
+ url += `?${params.toString()}`;
69
+ }
70
+ const headers = Object.assign({ "Content-Type": "application/json" }, options.headers);
71
+ if (this.apiKey) {
72
+ if (useApiKeyHeader) {
73
+ headers["x-api-key"] = this.apiKey;
74
+ }
75
+ else {
76
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
77
+ }
78
+ }
79
+ const response = await fetch(url, Object.assign(Object.assign({}, options), { headers }));
80
+ if (!response.ok) {
81
+ const errorText = await response.text();
82
+ throw new Error(`API request failed: ${response.status} ${response.statusText}. ${errorText}`);
83
+ }
84
+ return response.json();
85
+ }
86
+ }
87
+ /**
88
+ * Create an API client instance
89
+ * @param config - Configuration for the API client
90
+ * @returns An API client instance
91
+ */
92
+ export function createApiClient(config) {
93
+ return new ApiClient(config);
94
+ }
95
+ /**
96
+ * Default export for convenience
97
+ */
98
+ export default ApiClient;