@sampleapp.ai/sdk 1.0.35 → 1.0.37

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 (96) hide show
  1. package/dist/components/sandbox/Sandbox.js +20 -8
  2. package/dist/components/sandbox/api.js +3 -2
  3. package/dist/components/sandbox/guardian/ask-ai-view.js +4 -4
  4. package/dist/components/sandbox/guardian/default-guide-view.js +1 -1
  5. package/dist/components/sandbox/guardian/demo/left-view.js +2 -2
  6. package/dist/components/sandbox/guardian/guardian-component.js +7 -38
  7. package/dist/components/sandbox/guardian/guardian-playground.js +3 -3
  8. package/dist/components/sandbox/guardian/guardian-style-wrapper.js +21 -2
  9. package/dist/components/sandbox/guardian/hooks/use-sandbox-url-loader.js +12 -10
  10. package/dist/components/sandbox/guardian/ide/browser.js +30 -30
  11. package/dist/components/sandbox/guardian/index.js +1 -1
  12. package/dist/components/sandbox/guardian/right-view/preview-control-bar.js +3 -3
  13. package/dist/components/sandbox/guardian/right-view/right-top-down-view.js +2 -2
  14. package/dist/components/sandbox/guardian/ui/download-and-open-buttons.js +1 -1
  15. package/dist/components/sandbox/guardian/ui/markdown/code-group/code-block.js +48 -11
  16. package/dist/components/sandbox/guardian/ui/markdown.js +3 -3
  17. package/dist/components/sandbox/guardian/utils.js +0 -18
  18. package/dist/components/sandbox/index.js +1 -1
  19. package/dist/components/sandbox/sandbox-home/SandboxCard.js +4 -4
  20. package/dist/components/sandbox/sandbox-home/SandboxHome.js +14 -9
  21. package/dist/components/sandbox/sandbox-home/SearchBar.js +2 -2
  22. package/dist/index.d.ts +29 -42
  23. package/dist/index.es.js +8208 -7715
  24. package/dist/index.js +1 -1
  25. package/dist/index.standalone.umd.js +1 -1
  26. package/dist/lib/api-client.js +9 -26
  27. package/dist/lib/generated-css.js +1 -1
  28. package/dist/sdk.css +1 -1
  29. package/dist/tailwind.css +1 -1
  30. package/package.json +1 -1
  31. package/dist/components/guardian/app-layout-no-sidebar.js +0 -8
  32. package/dist/components/guardian/ask-ai-view.js +0 -249
  33. package/dist/components/guardian/code-focus-section.d.ts +0 -41
  34. package/dist/components/guardian/code-focus-section.js +0 -174
  35. package/dist/components/guardian/context/guardian-context.js +0 -94
  36. package/dist/components/guardian/context/vm-context.js +0 -28
  37. package/dist/components/guardian/default-guide-view.js +0 -34
  38. package/dist/components/guardian/demo/guardian-demo.js +0 -35
  39. package/dist/components/guardian/demo/left-view/toggle.js +0 -28
  40. package/dist/components/guardian/demo/left-view.js +0 -49
  41. package/dist/components/guardian/guardian-component.js +0 -79
  42. package/dist/components/guardian/guardian-demo.js +0 -35
  43. package/dist/components/guardian/guardian-home.d.ts +0 -4
  44. package/dist/components/guardian/guardian-home.js +0 -61
  45. package/dist/components/guardian/guardian-playground.js +0 -45
  46. package/dist/components/guardian/guardian-style-wrapper.js +0 -29
  47. package/dist/components/guardian/guardian-upload-spec.d.ts +0 -14
  48. package/dist/components/guardian/guardian-upload-spec.js +0 -160
  49. package/dist/components/guardian/header/glassmorphic-combobox.d.ts +0 -15
  50. package/dist/components/guardian/header/glassmorphic-combobox.js +0 -30
  51. package/dist/components/guardian/header.js +0 -61
  52. package/dist/components/guardian/hooks/use-frame-messages.js +0 -65
  53. package/dist/components/guardian/hooks/use-frame-params.js +0 -44
  54. package/dist/components/guardian/hooks/use-sandbox-url-loader.js +0 -101
  55. package/dist/components/guardian/ide/browser.js +0 -538
  56. package/dist/components/guardian/index.js +0 -8
  57. package/dist/components/guardian/layout/app-layout-no-sidebar.js +0 -8
  58. package/dist/components/guardian/layout/header/glassmorphic-combobox.js +0 -48
  59. package/dist/components/guardian/layout/header.js +0 -63
  60. package/dist/components/guardian/right-view/code-view.js +0 -56
  61. package/dist/components/guardian/right-view/pill-file-selector.js +0 -233
  62. package/dist/components/guardian/right-view/preview-control-bar.js +0 -25
  63. package/dist/components/guardian/right-view/right-panel-view.js +0 -38
  64. package/dist/components/guardian/right-view/right-top-down-view.js +0 -289
  65. package/dist/components/guardian/right-view/right-view.js +0 -28
  66. package/dist/components/guardian/right-view/simplified-editor.js +0 -234
  67. package/dist/components/guardian/types/ide-types.js +0 -162
  68. package/dist/components/guardian/types.js +0 -3
  69. package/dist/components/guardian/ui/ai-loader.js +0 -48
  70. package/dist/components/guardian/ui/badge.js +0 -24
  71. package/dist/components/guardian/ui/button.js +0 -45
  72. package/dist/components/guardian/ui/command.js +0 -63
  73. package/dist/components/guardian/ui/console-with-app.js +0 -17
  74. package/dist/components/guardian/ui/dialog.js +0 -57
  75. package/dist/components/guardian/ui/dropdown-menu.js +0 -82
  76. package/dist/components/guardian/ui/markdown.js +0 -57
  77. package/dist/components/guardian/ui/popover.js +0 -25
  78. package/dist/components/guardian/ui/tooltip.js +0 -25
  79. package/dist/components/guardian/utils.js +0 -88
  80. package/dist/components/guardian/zip-to-codebase.js +0 -246
  81. package/dist/components/guardian/zip-to-filetree.js +0 -284
  82. package/dist/components/sandbox/SandboxHome.js +0 -141
  83. package/dist/components/sandbox/guardian/guardian-demo.js +0 -35
  84. package/dist/components/sandbox/guardian/guardian-home.d.ts +0 -4
  85. package/dist/components/sandbox/guardian/guardian-home.js +0 -61
  86. package/dist/components/sandbox/guardian/guardian-upload-spec.d.ts +0 -14
  87. package/dist/components/sandbox/guardian/guardian-upload-spec.js +0 -160
  88. package/dist/components/sandbox/guardian/ui/theme-color-context.d.ts +0 -6
  89. package/dist/components/sandbox/sandbox-control-bar.js +0 -91
  90. package/dist/components/sandbox/sandbox-header.js +0 -52
  91. package/dist/components/sandbox/sandbox-left-panel.js +0 -248
  92. package/dist/components/sandbox/sandbox-loading.js +0 -48
  93. package/dist/components/sandbox/sandbox-right-panel.js +0 -247
  94. package/dist/components/sandbox.js +0 -32
  95. package/dist/lib/api-client.example.js +0 -60
  96. package/dist/lib/ssr-safe-decode-entity.js +0 -16
@@ -72,8 +72,7 @@ class ApiClient {
72
72
  getByPlayground: async (playgroundUid, skip = 0, limit = 100) => {
73
73
  return this.request(["sandbox-content", "playground", playgroundUid, "public"], {
74
74
  method: "GET",
75
- }, false, // Public endpoint, no API key required
76
- { skip, limit });
75
+ }, { skip, limit });
77
76
  },
78
77
  };
79
78
  /**
@@ -88,7 +87,6 @@ class ApiClient {
88
87
  *
89
88
  * @param request - The start sandbox request (env and chatUid)
90
89
  * @returns The sandbox response with container URL
91
- * @throws Error if apiKey is not set in client config
92
90
  *
93
91
  * @example
94
92
  * ```typescript
@@ -100,9 +98,6 @@ class ApiClient {
100
98
  * ```
101
99
  */
102
100
  startSandbox: async (request) => {
103
- if (!this.apiKey) {
104
- throw new Error("API key is required. Set apiKey in ApiClientConfig when creating the client.");
105
- }
106
101
  return this.request(["sdk", "start-sandbox"], {
107
102
  method: "POST",
108
103
  body: JSON.stringify(request),
@@ -116,12 +111,8 @@ class ApiClient {
116
111
  *
117
112
  * @param sandboxId - The sandbox content UID
118
113
  * @returns Promise that resolves when download is initiated
119
- * @throws Error if apiKey is not set in client config
120
114
  */
121
115
  downloadCode: async (sandboxId) => {
122
- if (!this.apiKey) {
123
- throw new Error("API key is required. Set apiKey in ApiClientConfig when creating the client.");
124
- }
125
116
  const url = `${this.baseUrl}/api/v1/sdk/download-code?sandbox_id=${encodeURIComponent(sandboxId)}`;
126
117
  // Make authenticated fetch request with Authorization header
127
118
  const response = await fetch(url, {
@@ -155,7 +146,6 @@ class ApiClient {
155
146
  *
156
147
  * @param request - The start VM request with url, optional mode, and optional resolution
157
148
  * @returns The sandbox response with sandboxId and vncUrl (if mode=json)
158
- * @throws Error if apiKey is not set in client config
159
149
  *
160
150
  * @example
161
151
  * ```typescript
@@ -168,9 +158,6 @@ class ApiClient {
168
158
  * ```
169
159
  */
170
160
  startVm: async (request) => {
171
- if (!this.apiKey) {
172
- throw new Error("API key is required. Set apiKey in ApiClientConfig when creating the client.");
173
- }
174
161
  const queryParams = {
175
162
  url: request.url,
176
163
  mode: request.mode || "json",
@@ -184,19 +171,21 @@ class ApiClient {
184
171
  }
185
172
  return this.request(["sdk", "start-vm"], {
186
173
  method: "GET",
187
- }, false, // API key is sent as Bearer token in Authorization header
188
- queryParams);
174
+ }, queryParams);
189
175
  },
190
176
  };
177
+ if (!config.apiKey || config.apiKey.trim() === "") {
178
+ throw new Error("apiKey is required when creating ApiClient");
179
+ }
191
180
  const defaultBaseUrl = getBaseUrl();
192
181
  this.baseUrl = defaultBaseUrl.replace(/\/$/, ""); // Remove trailing slash
193
182
  this.apiKey = config.apiKey;
194
183
  }
195
184
  /**
196
185
  * Makes a request to the API
197
- * Automatically includes Authorization: Bearer {apiKey} header if apiKey is set in config
186
+ * Automatically includes Authorization: Bearer {apiKey} header
198
187
  */
199
- async request(endpoint, options = {}, useApiKeyHeader = false, queryParams) {
188
+ async request(endpoint, options = {}, queryParams) {
200
189
  let url = `${this.baseUrl}/api/v1/${endpoint.join("/")}`;
201
190
  if (queryParams) {
202
191
  const params = new URLSearchParams();
@@ -212,14 +201,8 @@ class ApiClient {
212
201
  }
213
202
  }
214
203
  const headers = Object.assign({ "Content-Type": "application/json" }, options.headers);
215
- if (this.apiKey) {
216
- if (useApiKeyHeader) {
217
- headers["x-api-key"] = this.apiKey;
218
- }
219
- else {
220
- headers["Authorization"] = `Bearer ${this.apiKey}`;
221
- }
222
- }
204
+ // Always add Bearer token
205
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
223
206
  const response = await fetch(url, Object.assign(Object.assign({}, options), { headers }));
224
207
  if (!response.ok) {
225
208
  const errorText = await response.text();