@finema/finework-layer 2.0.63 → 2.0.64

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.64](https://gitlab.finema.co/finema/internal/finework/compare/2.0.63...2.0.64) (2026-09-15)
4
+
5
+ ### Bug Fixes
6
+
7
+ * fetch PDF as blob to bypass X-Frame-Options restrictions and add loading states ([4584b67](https://gitlab.finema.co/finema/internal/finework/commit/4584b67b555b19a3d2f10a25f1d89f9340dec134))
8
+
3
9
  ## [2.0.63](https://gitlab.finema.co/finema/internal/finework/compare/2.0.62...2.0.63) (2026-09-15)
4
10
 
5
11
  ## [2.0.62](https://gitlab.finema.co/finema/internal/finework/compare/2.0.61...2.0.62) (2026-09-15)
@@ -246,9 +246,9 @@
246
246
  class="relative flex-1 overflow-hidden bg-gray-600"
247
247
  >
248
248
  <iframe
249
- v-if="current?.file"
250
- :key="current.file.url"
251
- :src="`${current.file.url}#view=FitH`"
249
+ v-if="viewerBlobUrl"
250
+ :key="viewerBlobUrl"
251
+ :src="`${viewerBlobUrl}#view=FitH`"
252
252
  title="User manual"
253
253
  class="size-full border-0"
254
254
  />
@@ -256,7 +256,7 @@
256
256
  v-else
257
257
  class="flex h-full items-center justify-center bg-white text-sm text-gray-500"
258
258
  >
259
- ไม่พบไฟล์คู่มือ
259
+ {{ viewerError ? 'ไม่สามารถโหลดไฟล์ได้' : (current?.file ? 'กำลังโหลด...' : 'ไม่พบไฟล์คู่มือ') }}
260
260
  </div>
261
261
  </div>
262
262
  </div>
@@ -333,6 +333,41 @@ const current = computed<IManual | null>(
333
333
  () => props.manuals.find((m) => m.id === selectedId.value) ?? null,
334
334
  )
335
335
 
336
+ // The API sets X-Frame-Options/CSP frame-ancestors that block embedding the
337
+ // PDF URL directly in an <iframe> across subdomains. Fetching the bytes and
338
+ // rendering via a blob: URL sidesteps that, since it isn't a framed request.
339
+ const viewerBlobUrl = ref<string | null>(null)
340
+ const viewerError = ref(false)
341
+
342
+ const revokeViewerBlobUrl = () => {
343
+ if (viewerBlobUrl.value) {
344
+ URL.revokeObjectURL(viewerBlobUrl.value)
345
+ viewerBlobUrl.value = null
346
+ }
347
+ }
348
+
349
+ watch(() => current.value?.file?.url, async (url) => {
350
+ revokeViewerBlobUrl()
351
+ viewerError.value = false
352
+
353
+ if (!url) return
354
+
355
+ try {
356
+ const res = await fetch(url)
357
+ if (!res.ok) throw new Error(`HTTP ${res.status}`)
358
+
359
+ const blob = await res.blob()
360
+
361
+ viewerBlobUrl.value = URL.createObjectURL(blob)
362
+ } catch {
363
+ viewerError.value = true
364
+ }
365
+ }, {
366
+ immediate: true,
367
+ })
368
+
369
+ onBeforeUnmount(revokeViewerBlobUrl)
370
+
336
371
  const canManage = (app: string) =>
337
372
  auth.isSuperAdmin.value || auth.hasPermission(app as UserModule, Permission.SUPER)
338
373
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@finema/finework-layer",
3
3
  "type": "module",
4
- "version": "2.0.63",
4
+ "version": "2.0.64",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground -o",