@stoker-platform/web-app 0.2.10 → 0.2.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @stoker-platform/web-app
2
2
 
3
+ ## 0.2.12
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: add FullCalendar license key env var
8
+
9
+ ## 0.2.11
10
+
11
+ ### Patch Changes
12
+
13
+ - chore: support node >=22
14
+ - fix(web-app): strip server code blocks from web bundle
15
+ - Updated dependencies
16
+ - @stoker-platform/node-client@0.2.8
17
+ - @stoker-platform/web-client@0.2.9
18
+ - @stoker-platform/utils@0.2.7
19
+
3
20
  ## 0.2.10
4
21
 
5
22
  ### Patch Changes
package/bin/build.js CHANGED
@@ -241,6 +241,133 @@ try {
241
241
 
242
242
  const stripServerAccess = (code) => removePropertyBlock(code, "serverAccess")
243
243
 
244
+ // AI-generated code to strip server code from config files
245
+
246
+ const findMatchingBrace = (code, startPos) => {
247
+ let depth = 1
248
+ let inSingle = false
249
+ let inDouble = false
250
+ let inTemplate = false
251
+ let inLineComment = false
252
+ let inBlockComment = false
253
+ let prevChar = ""
254
+ let i = startPos
255
+
256
+ for (; i < code.length && depth > 0; i++) {
257
+ const ch = code[i]
258
+ const nextCh = i + 1 < code.length ? code[i + 1] : ""
259
+
260
+ if (inLineComment) {
261
+ if (ch === "\n") inLineComment = false
262
+ continue
263
+ }
264
+ if (inBlockComment) {
265
+ if (ch === "*" && nextCh === "/") {
266
+ inBlockComment = false
267
+ i++
268
+ }
269
+ continue
270
+ }
271
+ if (!inSingle && !inDouble && !inTemplate) {
272
+ if (ch === "/" && nextCh === "/") {
273
+ inLineComment = true
274
+ i++
275
+ continue
276
+ }
277
+ if (ch === "/" && nextCh === "*") {
278
+ inBlockComment = true
279
+ i++
280
+ continue
281
+ }
282
+ }
283
+ if (!inDouble && !inTemplate && ch === "'" && prevChar !== "\\") {
284
+ inSingle = !inSingle
285
+ } else if (!inSingle && !inTemplate && ch === '"' && prevChar !== "\\") {
286
+ inDouble = !inDouble
287
+ } else if (!inSingle && !inDouble && ch === "`" && prevChar !== "\\") {
288
+ inTemplate = !inTemplate
289
+ } else if (!inSingle && !inDouble && !inTemplate) {
290
+ if (ch === "{") depth++
291
+ if (ch === "}") depth--
292
+ }
293
+ prevChar = ch
294
+ }
295
+
296
+ return depth === 0 ? i - 1 : -1
297
+ }
298
+
299
+ const stripServerGuards = (code) => {
300
+ let output = code
301
+ let changed = true
302
+
303
+ // Keep processing until no more changes (handles nested cases)
304
+ while (changed) {
305
+ changed = false
306
+
307
+ // Pattern 1: Remove entire if (sdk === "node") blocks
308
+ const nodeGuardPattern = /if\s*\(\s*sdk\s*===\s*["']node["']\s*\)\s*\{/g
309
+
310
+ let match
311
+ while ((match = nodeGuardPattern.exec(output)) !== null) {
312
+ const ifStart = match.index
313
+ const braceStart = match.index + match[0].length
314
+
315
+ const braceEnd = findMatchingBrace(output, braceStart)
316
+ if (braceEnd === -1) continue // Malformed, skip
317
+
318
+ // Find the start of the if statement (may include whitespace before)
319
+ let ifStatementStart = ifStart
320
+ while (ifStatementStart > 0 && /\s/.test(output[ifStatementStart - 1])) {
321
+ ifStatementStart--
322
+ }
323
+
324
+ // Remove the entire if block
325
+ output = output.slice(0, ifStatementStart) + output.slice(braceEnd + 1)
326
+ changed = true
327
+
328
+ // Break and restart from beginning since we modified the string
329
+ break
330
+ }
331
+
332
+ if (changed) continue // Restart to handle nested cases
333
+
334
+ // Pattern 2: Remove else blocks following if (sdk === "web")
335
+ const webGuardPattern = /if\s*\(\s*sdk\s*===\s*["']web["']\s*\)\s*\{/g
336
+
337
+ while ((match = webGuardPattern.exec(output)) !== null) {
338
+ const braceStart = match.index + match[0].length
339
+
340
+ const ifBlockEnd = findMatchingBrace(output, braceStart)
341
+ if (ifBlockEnd === -1) continue // Malformed, skip
342
+
343
+ // Check if there's an else/else if after this
344
+ let j = ifBlockEnd + 1
345
+ while (j < output.length && /\s/.test(output[j])) j++
346
+
347
+ if (j >= output.length) continue
348
+
349
+ // Check for "else" or "else if"
350
+ const elseMatch = output.slice(j).match(/^\s*else\s*(if\s*\([^)]+\)\s*\{|\{)/)
351
+ if (!elseMatch) continue
352
+
353
+ const elseStart = j
354
+ const elseBlockStart = j + elseMatch[0].indexOf("{")
355
+
356
+ const elseBlockEnd = findMatchingBrace(output, elseBlockStart + 1)
357
+ if (elseBlockEnd === -1) continue // Malformed, skip
358
+
359
+ // Remove the else block (including "else" keyword and braces)
360
+ output = output.slice(0, elseStart) + output.slice(elseBlockEnd + 1)
361
+ changed = true
362
+
363
+ // Break and restart from beginning since we modified the string
364
+ break
365
+ }
366
+ }
367
+
368
+ return output
369
+ }
370
+
244
371
  const targetFiles = []
245
372
  const collectionsDir = join(systemCustomDir, "collections")
246
373
  if (existsSync(collectionsDir)) {
@@ -265,7 +392,8 @@ try {
265
392
  for (const file of targetFiles) {
266
393
  if (file.endsWith(".d.ts")) continue
267
394
  const original = readFileSync(file, "utf8")
268
- const transformed = stripServerAccess(original)
395
+ let transformed = stripServerAccess(original)
396
+ transformed = stripServerGuards(transformed)
269
397
  if (transformed !== original) {
270
398
  writeFileSync(file, transformed)
271
399
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/web-app",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
@@ -51,9 +51,9 @@
51
51
  "@radix-ui/react-tooltip": "^1.2.8",
52
52
  "@react-google-maps/api": "^2.20.7",
53
53
  "@sentry/react": "^10.29.0",
54
- "@stoker-platform/node-client": "0.2.7",
55
- "@stoker-platform/utils": "0.2.6",
56
- "@stoker-platform/web-client": "0.2.8",
54
+ "@stoker-platform/node-client": "0.2.8",
55
+ "@stoker-platform/utils": "0.2.7",
56
+ "@stoker-platform/web-client": "0.2.9",
57
57
  "@tanstack/react-table": "^8.21.3",
58
58
  "@types/react": "18.3.13",
59
59
  "@types/react-dom": "18.3.1",
@@ -95,7 +95,7 @@
95
95
  "deploy-web-app": "./bin/deploy.js"
96
96
  },
97
97
  "engines": {
98
- "node": "22",
98
+ "node": ">=22",
99
99
  "npm": "11"
100
100
  },
101
101
  "devDependencies": {
package/src/Calendar.tsx CHANGED
@@ -1004,6 +1004,7 @@ export function Calendar({
1004
1004
  <CardContent className="p-4 h-full">
1005
1005
  {currentViewLarge && (
1006
1006
  <FullCalendar
1007
+ schedulerLicenseKey={import.meta.env.STOKER_FULLCALENDAR_KEY}
1007
1008
  initialDate={currentDateLarge}
1008
1009
  initialView={currentViewLarge}
1009
1010
  headerToolbar={{
@@ -1035,6 +1036,7 @@ export function Calendar({
1035
1036
  <CardContent className="p-4 h-full">
1036
1037
  {currentViewSmall && (
1037
1038
  <FullCalendar
1039
+ schedulerLicenseKey={import.meta.env.STOKER_FULLCALENDAR_KEY}
1038
1040
  initialDate={currentDateSmall}
1039
1041
  initialView={currentViewSmall}
1040
1042
  headerToolbar={{