@solidpepper/solidpepper-soliddesigner 0.3.1 → 0.3.3

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 (18) hide show
  1. package/fesm2022/solidpepper-solidpepper-soliddesigner-confirm-save-before-pdf-modal.component-dmrHYZ_G.mjs +165 -0
  2. package/fesm2022/solidpepper-solidpepper-soliddesigner-confirm-save-before-pdf-modal.component-dmrHYZ_G.mjs.map +1 -0
  3. package/fesm2022/solidpepper-solidpepper-soliddesigner-iframe-modal.component-D-ajn-z9.mjs +871 -0
  4. package/fesm2022/solidpepper-solidpepper-soliddesigner-iframe-modal.component-D-ajn-z9.mjs.map +1 -0
  5. package/fesm2022/{solidpepper-solidpepper-soliddesigner-image-utils-BZ877qA2.mjs → solidpepper-solidpepper-soliddesigner-image-utils-S3Asxx7t.mjs} +2 -2
  6. package/fesm2022/{solidpepper-solidpepper-soliddesigner-image-utils-BZ877qA2.mjs.map → solidpepper-solidpepper-soliddesigner-image-utils-S3Asxx7t.mjs.map} +1 -1
  7. package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-BFBuR2rJ.mjs +1306 -0
  8. package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-BFBuR2rJ.mjs.map +1 -0
  9. package/fesm2022/{solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DNuvMIlh.mjs → solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-Dg1wqw7b.mjs} +7254 -2408
  10. package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-Dg1wqw7b.mjs.map +1 -0
  11. package/fesm2022/solidpepper-solidpepper-soliddesigner.mjs +1 -1
  12. package/index.d.ts +101 -28
  13. package/package.json +8 -9
  14. package/fesm2022/solidpepper-solidpepper-soliddesigner-iframe-modal.component-CJ4Uve9q.mjs +0 -152
  15. package/fesm2022/solidpepper-solidpepper-soliddesigner-iframe-modal.component-CJ4Uve9q.mjs.map +0 -1
  16. package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CSVxODUW.mjs +0 -771
  17. package/fesm2022/solidpepper-solidpepper-soliddesigner-page-grid-modal.component-CSVxODUW.mjs.map +0 -1
  18. package/fesm2022/solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-DNuvMIlh.mjs.map +0 -1
@@ -0,0 +1,871 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ViewChild, Input, Component } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
4
+ import * as i2 from '@angular/forms';
5
+ import { FormsModule } from '@angular/forms';
6
+ import * as i2$1 from '@ngx-translate/core';
7
+ import { TranslateService, TranslateModule } from '@ngx-translate/core';
8
+ import { M as ModalService, A as AppParamsService, N as NotificationService, B as BasicModalComponent } from './solidpepper-solidpepper-soliddesigner-solidpepper-solidpepper-soliddesigner-Dg1wqw7b.mjs';
9
+ import { DomSanitizer } from '@angular/platform-browser';
10
+ import { DocumentsService } from '@solidpepper/solidpepper-service';
11
+ import { SpButtonComponent } from '@solidpepper/solidpepper-component';
12
+ import { spIconBookOpen, spIconMessageSquare, spIconCopy, spIconCheck, spIconLock, spIconEye, spIconExternalLink, spIconAlert, SpIconComponent } from '@solidpepper/solidpepper-icons';
13
+ import QRCodeStyling from 'qr-code-styling';
14
+
15
+ class IframeModalComponent {
16
+ constructor() {
17
+ this.modalService = inject(ModalService);
18
+ this.appParamsService = inject(AppParamsService);
19
+ this.sanitizer = inject(DomSanitizer);
20
+ this.documentsService = inject(DocumentsService);
21
+ this.notificationService = inject(NotificationService);
22
+ this.translate = inject(TranslateService);
23
+ this.moduleType = 'flipbook';
24
+ this.isOutOfDate = false;
25
+ this.lastGeneratedAt = null;
26
+ this.activeTab = 'flipbook';
27
+ this.flipbookAccessMode = 'public';
28
+ this.flipbookIsPassword = false;
29
+ this.flipbookPassword = '';
30
+ this.showFlipbookPassword = false;
31
+ this.reviewerAccessMode = 'public';
32
+ this.reviewerIsPassword = false;
33
+ this.reviewerPassword = '';
34
+ this.showReviewerPassword = false;
35
+ this.isSavingSecurity = false;
36
+ this.copiedLink = false;
37
+ this.copiedLinkPwd = false;
38
+ this.copiedCode = false;
39
+ // Icons
40
+ this.spIconBookOpen = spIconBookOpen;
41
+ this.spIconMessageSquare = spIconMessageSquare;
42
+ this.spIconCopy = spIconCopy;
43
+ this.spIconCheck = spIconCheck;
44
+ this.spIconLock = spIconLock;
45
+ this.spIconEye = spIconEye;
46
+ this.spIconExternalLink = spIconExternalLink;
47
+ this.spIconAlert = spIconAlert;
48
+ this.cachedUrl = '';
49
+ this.cachedSafeUrl = null;
50
+ }
51
+ formatFlipbookDate(dateStr) {
52
+ if (!dateStr)
53
+ return '';
54
+ try {
55
+ const d = new Date(dateStr);
56
+ if (isNaN(d.getTime()))
57
+ return '';
58
+ return new Intl.DateTimeFormat(this.translate.currentLang || 'fr', {
59
+ day: '2-digit',
60
+ month: '2-digit',
61
+ year: 'numeric',
62
+ hour: '2-digit',
63
+ minute: '2-digit',
64
+ }).format(d);
65
+ }
66
+ catch {
67
+ return '';
68
+ }
69
+ }
70
+ ngOnInit() {
71
+ this.activeTab = this.moduleType === 'reviewer' ? 'reviewer' : 'flipbook';
72
+ this.loadSecurity();
73
+ }
74
+ ngAfterViewInit() {
75
+ setTimeout(() => this.updateQrCode(), 100);
76
+ }
77
+ get currentLink() {
78
+ return this.getModuleLink(this.activeTab, false);
79
+ }
80
+ get currentLinkWithPassword() {
81
+ return this.getModuleLink(this.activeTab, true);
82
+ }
83
+ get currentSafeUrl() {
84
+ const url = this.currentLink;
85
+ if (url !== this.cachedUrl || !this.cachedSafeUrl) {
86
+ this.cachedUrl = url;
87
+ this.cachedSafeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(url);
88
+ }
89
+ return this.cachedSafeUrl;
90
+ }
91
+ get currentIframeCode() {
92
+ return `<iframe src="${this.currentLink}" frameborder="0" style="width: 800px; height: 500px;" allowfullscreen></iframe>`;
93
+ }
94
+ setTab(tab) {
95
+ this.activeTab = tab;
96
+ setTimeout(() => this.updateQrCode(), 50);
97
+ }
98
+ updateQrCode() {
99
+ const url = this.currentLink;
100
+ if (!url)
101
+ return;
102
+ const isReviewer = this.activeTab === 'reviewer';
103
+ const size = isReviewer ? 180 : 96;
104
+ this.qrCode = new QRCodeStyling({
105
+ width: size,
106
+ height: size,
107
+ type: 'svg',
108
+ margin: 0,
109
+ data: url,
110
+ qrOptions: {
111
+ errorCorrectionLevel: 'M',
112
+ },
113
+ dotsOptions: {
114
+ color: '#1e293b',
115
+ type: 'rounded',
116
+ roundSize: false,
117
+ },
118
+ backgroundOptions: {
119
+ color: '#ffffff',
120
+ },
121
+ cornersSquareOptions: {
122
+ type: 'extra-rounded',
123
+ color: '#1e293b',
124
+ },
125
+ });
126
+ const targetContainer = isReviewer
127
+ ? this.qrContainerReviewer?.nativeElement
128
+ : this.qrContainerFlipbook?.nativeElement;
129
+ if (targetContainer) {
130
+ targetContainer.innerHTML = '';
131
+ this.qrCode.append(targetContainer);
132
+ }
133
+ }
134
+ getModuleLink(module, includePassword = false) {
135
+ const guid = this.appParamsService.guid;
136
+ const baseUrl = window.location.origin;
137
+ let url = baseUrl;
138
+ const token = this.appParamsService.token;
139
+ if (token && token.includes('.')) {
140
+ try {
141
+ const base64Payload = token.split('.')[1];
142
+ const decoded = JSON.parse(atob(base64Payload.replace(/-/g, '+').replace(/_/g, '/')));
143
+ if (!baseUrl.includes('localhost')) {
144
+ if (decoded.Alias && decoded.Alias.toLowerCase() !== 'youbooky') {
145
+ url += '/' + decoded.Alias + '/';
146
+ }
147
+ else {
148
+ url += '/';
149
+ }
150
+ }
151
+ else {
152
+ url = url.replace(':4201', ':4200') + '/';
153
+ }
154
+ }
155
+ catch (e) {
156
+ console.error('Erreur de décodage du JWT', e);
157
+ }
158
+ }
159
+ let link = `${url}iframe/module?type=${module}&nightMode=true&documentGuid=${guid}`;
160
+ const isPwd = module === 'flipbook' ? this.flipbookIsPassword : this.reviewerIsPassword;
161
+ const pwd = module === 'flipbook' ? this.flipbookPassword : this.reviewerPassword;
162
+ if (includePassword && isPwd && pwd) {
163
+ link += `&pwd=${encodeURIComponent(pwd)}`;
164
+ }
165
+ return link;
166
+ }
167
+ loadSecurity() {
168
+ const guid = this.appParamsService.guid;
169
+ if (!guid)
170
+ return;
171
+ this.documentsService.getDocumentSecurity(guid).subscribe({
172
+ next: (res) => {
173
+ if (res?.flipbook) {
174
+ this.flipbookAccessMode = res.flipbook.accessMode || 'public';
175
+ this.flipbookIsPassword = !!res.flipbook.isPasswordProtected;
176
+ this.flipbookPassword = res.flipbook.password || '';
177
+ }
178
+ if (res?.reviewer) {
179
+ this.reviewerAccessMode = res.reviewer.accessMode || 'public';
180
+ this.reviewerIsPassword = !!res.reviewer.isPasswordProtected;
181
+ this.reviewerPassword = res.reviewer.password || '';
182
+ }
183
+ },
184
+ error: (err) => console.warn('Could not load document security settings', err)
185
+ });
186
+ }
187
+ saveSecurity() {
188
+ const guid = this.appParamsService.guid;
189
+ if (!guid)
190
+ return;
191
+ this.isSavingSecurity = true;
192
+ const payload = {
193
+ flipbook: {
194
+ accessMode: this.flipbookAccessMode,
195
+ password: this.flipbookIsPassword ? this.flipbookPassword : ''
196
+ },
197
+ reviewer: {
198
+ accessMode: this.reviewerAccessMode,
199
+ password: this.reviewerIsPassword ? this.reviewerPassword : ''
200
+ }
201
+ };
202
+ this.documentsService.updateDocumentSecurity(guid, payload).subscribe({
203
+ next: () => {
204
+ this.isSavingSecurity = false;
205
+ const msg = this.translate.instant('IFRAME_MODAL.SECURITY_SAVED') || 'Paramètres de sécurité enregistrés !';
206
+ this.notificationService.success(msg);
207
+ },
208
+ error: (err) => {
209
+ this.isSavingSecurity = false;
210
+ console.error('Error saving document security', err);
211
+ this.notificationService.error('Erreur lors de la sauvegarde de la sécurité');
212
+ }
213
+ });
214
+ }
215
+ copyLink(includePassword = false) {
216
+ const text = includePassword ? this.currentLinkWithPassword : this.currentLink;
217
+ navigator.clipboard.writeText(text).then(() => {
218
+ if (includePassword) {
219
+ this.copiedLinkPwd = true;
220
+ setTimeout(() => (this.copiedLinkPwd = false), 2500);
221
+ }
222
+ else {
223
+ this.copiedLink = true;
224
+ setTimeout(() => (this.copiedLink = false), 2500);
225
+ }
226
+ this.notificationService.success(this.translate.instant('IFRAME_MODAL.COPY_LINK') + ' !');
227
+ });
228
+ }
229
+ copyCode() {
230
+ navigator.clipboard.writeText(this.currentIframeCode).then(() => {
231
+ this.copiedCode = true;
232
+ setTimeout(() => (this.copiedCode = false), 2500);
233
+ this.notificationService.success(this.translate.instant('IFRAME_MODAL.COPY_CODE') + ' !');
234
+ });
235
+ }
236
+ openInNewTab() {
237
+ window.open(this.currentLink, '_blank');
238
+ }
239
+ close() {
240
+ this.modalService.close();
241
+ }
242
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: IframeModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
243
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: IframeModalComponent, isStandalone: true, selector: "app-iframe-modal", inputs: { moduleType: "moduleType", isOutOfDate: "isOutOfDate", lastGeneratedAt: "lastGeneratedAt" }, viewQueries: [{ propertyName: "qrContainerReviewer", first: true, predicate: ["qrContainerReviewer"], descendants: true }, { propertyName: "qrContainerFlipbook", first: true, predicate: ["qrContainerFlipbook"], descendants: true }], ngImport: i0, template: `
244
+ <app-basic-modal
245
+ [title]="(activeTab === 'reviewer' ? ('IFRAME_MODAL.REVIEWER_TAB' | translate) : ('IFRAME_MODAL.FLIPBOOK_TAB' | translate)) || ('SHARE.TITLE' | translate)"
246
+ [isOpen]="true"
247
+ [showFooter]="false"
248
+ (closeEvent)="close()"
249
+ >
250
+ <div class="flex flex-col gap-4 text-base-content min-w-[700px] max-w-4xl">
251
+ <!-- Module Tabs (Flipbook / SolidReviewer) -->
252
+ <div class="tabs tabs-boxed bg-base-200 p-1 flex items-center justify-between">
253
+ <div class="flex gap-1">
254
+ <button
255
+ type="button"
256
+ class="tab text-xs font-medium transition-all"
257
+ [class.tab-active]="activeTab === 'flipbook'"
258
+ (click)="setTab('flipbook')">
259
+ <sp-icon [icon]="spIconBookOpen" [size]="14" class="mr-1.5"></sp-icon>
260
+ {{ 'IFRAME_MODAL.FLIPBOOK_TAB' | translate }}
261
+ </button>
262
+ <button
263
+ type="button"
264
+ class="tab text-xs font-medium transition-all"
265
+ [class.tab-active]="activeTab === 'reviewer'"
266
+ (click)="setTab('reviewer')">
267
+ <sp-icon [icon]="spIconMessageSquare" [size]="14" class="mr-1.5"></sp-icon>
268
+ {{ 'IFRAME_MODAL.REVIEWER_TAB' | translate }}
269
+ </button>
270
+ </div>
271
+
272
+ @if (activeTab === 'flipbook') {
273
+ <button
274
+ type="button"
275
+ class="btn btn-xs btn-ghost gap-1 text-xs"
276
+ (click)="openInNewTab()"
277
+ [title]="'IFRAME_MODAL.FULLSCREEN' | translate">
278
+ <sp-icon [icon]="spIconExternalLink" [size]="13"></sp-icon>
279
+ <span>{{ 'IFRAME_MODAL.FULLSCREEN' | translate }}</span>
280
+ </button>
281
+ }
282
+ </div>
283
+
284
+ @if (activeTab === 'flipbook' && isOutOfDate) {
285
+ <div class="flex items-center gap-2.5 p-3 bg-warning/15 border border-warning/30 rounded-xl text-xs text-warning-content">
286
+ <sp-icon [icon]="spIconAlert" [size]="16" class="text-warning shrink-0"></sp-icon>
287
+ <div class="leading-snug">
288
+ <p class="font-semibold">{{ 'SHARE.FLIPBOOK_OUT_OF_DATE' | translate }}</p>
289
+ @if (lastGeneratedAt) {
290
+ <p class="text-[11px] opacity-80">{{ 'SHARE.FLIPBOOK_LAST_UPDATE' | translate: { date: formatFlipbookDate(lastGeneratedAt) } }}</p>
291
+ }
292
+ </div>
293
+ </div>
294
+ }
295
+
296
+ @if (activeTab === 'reviewer') {
297
+ <!-- Reviewer: QR Code on Left, Link & Actions on Right -->
298
+ <div class="flex flex-col md:flex-row items-center gap-6 p-4 bg-base-100 rounded-2xl border border-base-200 shadow-sm">
299
+ <!-- Left: QR Code -->
300
+ <div class="flex flex-col items-center text-center gap-2 w-full md:w-5/12">
301
+ <div class="p-2 bg-white rounded-xl border border-base-300 shadow-sm flex items-center justify-center">
302
+ <div #qrContainerReviewer class="flex items-center justify-center"></div>
303
+ </div>
304
+ <p class="text-xs text-base-content/65 max-w-[220px] leading-tight">
305
+ {{ 'IFRAME_MODAL.QR_CODE_REVIEWER_DESC' | translate }}
306
+ </p>
307
+ </div>
308
+
309
+ <!-- Right: Link & Actions -->
310
+ <div class="flex flex-col gap-3 w-full md:w-7/12">
311
+ <div>
312
+ <label class="font-medium text-xs text-base-content/75 uppercase tracking-wider block mb-1.5">
313
+ {{ 'IFRAME_MODAL.LINK_TO_ANNOTATE' | translate }}
314
+ </label>
315
+ <div class="flex gap-2">
316
+ <input
317
+ type="text"
318
+ [value]="currentLink"
319
+ readonly
320
+ class="input input-sm input-bordered w-full font-mono text-xs bg-base-200" />
321
+ <sp-button
322
+ [variant]="copiedLink ? 'success' : 'primary'"
323
+ size="sm"
324
+ (clicked)="copyLink(false)">
325
+ <sp-icon [icon]="copiedLink ? spIconCheck : spIconCopy" [size]="12"></sp-icon>
326
+ <span>{{ (copiedLink ? 'SHARE.COPIED' : 'IFRAME_MODAL.COPY_LINK') | translate }}</span>
327
+ </sp-button>
328
+ </div>
329
+
330
+ @if (reviewerIsPassword && reviewerPassword) {
331
+ <button
332
+ type="button"
333
+ class="btn btn-xs btn-outline btn-neutral mt-2 w-full gap-1.5 justify-start text-[11px]"
334
+ (click)="copyLink(true)">
335
+ <sp-icon [icon]="spIconLock" [size]="12"></sp-icon>
336
+ <span>{{ 'IFRAME_MODAL.COPY_WITH_PASSWORD' | translate }}</span>
337
+ </button>
338
+ }
339
+ </div>
340
+
341
+ <div class="pt-1">
342
+ <sp-button
343
+ variant="primary"
344
+ size="sm"
345
+ (clicked)="openInNewTab()">
346
+ <sp-icon [icon]="spIconExternalLink" [size]="14"></sp-icon>
347
+ <span>{{ 'IFRAME_MODAL.OPEN_REVIEWER' | translate }}</span>
348
+ </sp-button>
349
+ </div>
350
+ </div>
351
+ </div>
352
+ } @else {
353
+ <!-- Flipbook: Iframe preview on Left, Link + QR + Embed on Right -->
354
+ <div class="flex flex-col md:flex-row gap-6 text-sm text-base-content min-h-[300px]">
355
+ <!-- Preview Section (Left) -->
356
+ <div class="flex-1 border border-base-300 rounded-xl overflow-hidden bg-base-200/50 flex items-center justify-center min-h-[280px]">
357
+ <iframe
358
+ [src]="currentSafeUrl"
359
+ frameborder="0"
360
+ allowfullscreen
361
+ class="w-full h-full min-h-[280px] bg-white rounded-xl shadow-inner">
362
+ </iframe>
363
+ </div>
364
+
365
+ <!-- Code & Link Section (Right) -->
366
+ <div class="w-full md:w-80 flex flex-col gap-3 justify-between">
367
+ <div class="flex flex-col gap-1.5">
368
+ <label class="font-medium text-xs text-base-content/75 uppercase tracking-wider">
369
+ {{ 'IFRAME_MODAL.LINK_LABEL' | translate }}
370
+ </label>
371
+ <div class="flex gap-2">
372
+ <input
373
+ type="text"
374
+ [value]="currentLink"
375
+ readonly
376
+ class="input input-sm input-bordered w-full font-mono text-xs bg-base-200" />
377
+ <sp-button
378
+ [variant]="copiedLink ? 'success' : 'primary'"
379
+ size="sm"
380
+ (clicked)="copyLink(false)">
381
+ <sp-icon [icon]="copiedLink ? spIconCheck : spIconCopy" [size]="12"></sp-icon>
382
+ <span>{{ (copiedLink ? 'SHARE.COPIED' : 'IFRAME_MODAL.COPY_LINK') | translate }}</span>
383
+ </sp-button>
384
+ </div>
385
+
386
+ @if (flipbookIsPassword && flipbookPassword) {
387
+ <button
388
+ type="button"
389
+ class="btn btn-xs btn-outline btn-neutral mt-1 w-full gap-1.5 justify-start text-[11px]"
390
+ (click)="copyLink(true)">
391
+ <sp-icon [icon]="spIconLock" [size]="12"></sp-icon>
392
+ <span>{{ 'IFRAME_MODAL.COPY_WITH_PASSWORD' | translate }}</span>
393
+ </button>
394
+ }
395
+ </div>
396
+
397
+ <!-- QR Code Section -->
398
+ <div class="flex items-center gap-3 p-2.5 bg-base-100 rounded-xl border border-base-200 shadow-sm">
399
+ <div class="p-1 bg-white rounded-lg border border-base-300 shrink-0 flex items-center justify-center">
400
+ <div #qrContainerFlipbook class="flex items-center justify-center"></div>
401
+ </div>
402
+ <div class="flex flex-col gap-1">
403
+ <span class="font-semibold text-xs text-base-content flex items-center gap-1.5">
404
+ <sp-icon [icon]="spIconBookOpen" [size]="13" class="text-primary"></sp-icon>
405
+ {{ 'IFRAME_MODAL.QR_CODE_TITLE' | translate }}
406
+ </span>
407
+ <p class="text-[11px] text-base-content/60 leading-tight">
408
+ {{ 'IFRAME_MODAL.QR_CODE_DESC' | translate }}
409
+ </p>
410
+ </div>
411
+ </div>
412
+
413
+ <div class="flex flex-col gap-1.5">
414
+ <label class="font-medium text-xs text-base-content/75 uppercase tracking-wider">
415
+ {{ 'IFRAME_MODAL.INTEGRATE' | translate }}
416
+ </label>
417
+ <textarea
418
+ readonly
419
+ rows="2"
420
+ class="textarea textarea-bordered font-mono text-xs bg-base-200 resize-none w-full min-h-[60px]">{{ currentIframeCode }}</textarea>
421
+ <sp-button
422
+ [variant]="copiedCode ? 'success' : 'primary'"
423
+ size="sm"
424
+ customClass="w-full"
425
+ (clicked)="copyCode()">
426
+ <sp-icon [icon]="copiedCode ? spIconCheck : spIconCopy" [size]="12"></sp-icon>
427
+ <span>{{ (copiedCode ? 'SHARE.COPIED' : 'IFRAME_MODAL.COPY_CODE') | translate }}</span>
428
+ </sp-button>
429
+ </div>
430
+ </div>
431
+ </div>
432
+ }
433
+
434
+ <!-- Security & Access Section -->
435
+ <div class="p-3.5 rounded-xl bg-base-200/60 border border-base-300">
436
+ <div class="flex items-center justify-between pb-2 mb-2.5 border-b border-base-300/80">
437
+ <div class="flex items-center gap-2">
438
+ <sp-icon [icon]="spIconLock" [size]="14" class="text-primary"></sp-icon>
439
+ <h4 class="font-bold text-xs uppercase tracking-wider">
440
+ {{ 'IFRAME_MODAL.SECURITY_TITLE' | translate }} -
441
+ <span class="text-primary font-semibold">
442
+ {{ (activeTab === 'flipbook' ? 'IFRAME_MODAL.FLIPBOOK_TAB' : 'IFRAME_MODAL.REVIEWER_TAB') | translate }}
443
+ </span>
444
+ </h4>
445
+ </div>
446
+
447
+ <sp-button
448
+ variant="primary"
449
+ size="xs"
450
+ [disabled]="isSavingSecurity"
451
+ (clicked)="saveSecurity()">
452
+ @if (isSavingSecurity) {
453
+ <span class="loading loading-spinner loading-xs"></span>
454
+ } @else {
455
+ <sp-icon [icon]="spIconCheck" [size]="12"></sp-icon>
456
+ }
457
+ <span>{{ 'IFRAME_MODAL.SAVE_SECURITY' | translate }}</span>
458
+ </sp-button>
459
+ </div>
460
+
461
+ @if (activeTab === 'flipbook') {
462
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 items-center">
463
+ <div>
464
+ <label class="label py-1">
465
+ <span class="label-text text-xs font-medium">{{ 'IFRAME_MODAL.ACCESS_MODE' | translate }}</span>
466
+ </label>
467
+ <select class="select select-bordered select-sm w-full font-medium" [(ngModel)]="flipbookAccessMode">
468
+ <option value="public">{{ 'IFRAME_MODAL.ACCESS_PUBLIC' | translate }}</option>
469
+ <option value="organization">{{ 'IFRAME_MODAL.ACCESS_ORGANIZATION' | translate }}</option>
470
+ </select>
471
+ </div>
472
+
473
+ <div class="flex flex-col gap-1.5">
474
+ <div class="flex items-center justify-between">
475
+ <label class="label cursor-pointer gap-2 py-0">
476
+ <span class="label-text text-xs font-medium">{{ 'IFRAME_MODAL.PASSWORD_PROTECT' | translate }}</span>
477
+ <input type="checkbox" class="toggle toggle-primary toggle-sm" [(ngModel)]="flipbookIsPassword" />
478
+ </label>
479
+ </div>
480
+
481
+ @if (flipbookIsPassword) {
482
+ <div class="join w-full">
483
+ <input
484
+ [type]="showFlipbookPassword ? 'text' : 'password'"
485
+ class="input input-sm input-bordered join-item w-full text-xs font-mono"
486
+ [placeholder]="'IFRAME_MODAL.PASSWORD_PLACEHOLDER' | translate"
487
+ [(ngModel)]="flipbookPassword" />
488
+ <button
489
+ type="button"
490
+ class="btn btn-sm btn-outline join-item"
491
+ (click)="showFlipbookPassword = !showFlipbookPassword">
492
+ <sp-icon [icon]="showFlipbookPassword ? spIconLock : spIconEye" [size]="14"></sp-icon>
493
+ </button>
494
+ </div>
495
+ }
496
+ </div>
497
+ </div>
498
+ }
499
+
500
+ @if (activeTab === 'reviewer') {
501
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 items-center">
502
+ <div>
503
+ <label class="label py-1">
504
+ <span class="label-text text-xs font-medium">{{ 'IFRAME_MODAL.ACCESS_MODE' | translate }}</span>
505
+ </label>
506
+ <select class="select select-bordered select-sm w-full font-medium" [(ngModel)]="reviewerAccessMode">
507
+ <option value="public">{{ 'IFRAME_MODAL.ACCESS_PUBLIC' | translate }}</option>
508
+ <option value="organization">{{ 'IFRAME_MODAL.ACCESS_ORGANIZATION' | translate }}</option>
509
+ </select>
510
+ </div>
511
+
512
+ <div class="flex flex-col gap-1.5">
513
+ <div class="flex items-center justify-between">
514
+ <label class="label cursor-pointer gap-2 py-0">
515
+ <span class="label-text text-xs font-medium">{{ 'IFRAME_MODAL.PASSWORD_PROTECT' | translate }}</span>
516
+ <input type="checkbox" class="toggle toggle-primary toggle-sm" [(ngModel)]="reviewerIsPassword" />
517
+ </label>
518
+ </div>
519
+
520
+ @if (reviewerIsPassword) {
521
+ <div class="join w-full">
522
+ <input
523
+ [type]="showReviewerPassword ? 'text' : 'password'"
524
+ class="input input-sm input-bordered join-item w-full text-xs font-mono"
525
+ [placeholder]="'IFRAME_MODAL.PASSWORD_PLACEHOLDER' | translate"
526
+ [(ngModel)]="reviewerPassword" />
527
+ <button
528
+ type="button"
529
+ class="btn btn-sm btn-outline join-item"
530
+ (click)="showReviewerPassword = !showReviewerPassword">
531
+ <sp-icon [icon]="showReviewerPassword ? spIconLock : spIconEye" [size]="14"></sp-icon>
532
+ </button>
533
+ </div>
534
+ }
535
+ </div>
536
+ </div>
537
+ }
538
+ </div>
539
+ </div>
540
+ </app-basic-modal>
541
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: BasicModalComponent, selector: "app-basic-modal", inputs: ["title", "isOpen", "showFooter", "isSubmitDisabled"], outputs: ["closeEvent", "submitEvent"] }, { kind: "component", type: SpButtonComponent, selector: "sp-button", inputs: ["variant", "size", "type", "disabled", "loading", "active", "tooltip", "customClass", "fullWidth", "showTextWhileLoading"], outputs: ["clicked", "buttonClick"] }, { kind: "component", type: SpIconComponent, selector: "sp-icon", inputs: ["icon", "name", "size", "color", "fill", "strokeWidth", "class", "ariaLabel"] }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }] }); }
542
+ }
543
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: IframeModalComponent, decorators: [{
544
+ type: Component,
545
+ args: [{
546
+ selector: 'app-iframe-modal',
547
+ standalone: true,
548
+ imports: [
549
+ CommonModule,
550
+ FormsModule,
551
+ TranslateModule,
552
+ BasicModalComponent,
553
+ SpButtonComponent,
554
+ SpIconComponent,
555
+ ],
556
+ template: `
557
+ <app-basic-modal
558
+ [title]="(activeTab === 'reviewer' ? ('IFRAME_MODAL.REVIEWER_TAB' | translate) : ('IFRAME_MODAL.FLIPBOOK_TAB' | translate)) || ('SHARE.TITLE' | translate)"
559
+ [isOpen]="true"
560
+ [showFooter]="false"
561
+ (closeEvent)="close()"
562
+ >
563
+ <div class="flex flex-col gap-4 text-base-content min-w-[700px] max-w-4xl">
564
+ <!-- Module Tabs (Flipbook / SolidReviewer) -->
565
+ <div class="tabs tabs-boxed bg-base-200 p-1 flex items-center justify-between">
566
+ <div class="flex gap-1">
567
+ <button
568
+ type="button"
569
+ class="tab text-xs font-medium transition-all"
570
+ [class.tab-active]="activeTab === 'flipbook'"
571
+ (click)="setTab('flipbook')">
572
+ <sp-icon [icon]="spIconBookOpen" [size]="14" class="mr-1.5"></sp-icon>
573
+ {{ 'IFRAME_MODAL.FLIPBOOK_TAB' | translate }}
574
+ </button>
575
+ <button
576
+ type="button"
577
+ class="tab text-xs font-medium transition-all"
578
+ [class.tab-active]="activeTab === 'reviewer'"
579
+ (click)="setTab('reviewer')">
580
+ <sp-icon [icon]="spIconMessageSquare" [size]="14" class="mr-1.5"></sp-icon>
581
+ {{ 'IFRAME_MODAL.REVIEWER_TAB' | translate }}
582
+ </button>
583
+ </div>
584
+
585
+ @if (activeTab === 'flipbook') {
586
+ <button
587
+ type="button"
588
+ class="btn btn-xs btn-ghost gap-1 text-xs"
589
+ (click)="openInNewTab()"
590
+ [title]="'IFRAME_MODAL.FULLSCREEN' | translate">
591
+ <sp-icon [icon]="spIconExternalLink" [size]="13"></sp-icon>
592
+ <span>{{ 'IFRAME_MODAL.FULLSCREEN' | translate }}</span>
593
+ </button>
594
+ }
595
+ </div>
596
+
597
+ @if (activeTab === 'flipbook' && isOutOfDate) {
598
+ <div class="flex items-center gap-2.5 p-3 bg-warning/15 border border-warning/30 rounded-xl text-xs text-warning-content">
599
+ <sp-icon [icon]="spIconAlert" [size]="16" class="text-warning shrink-0"></sp-icon>
600
+ <div class="leading-snug">
601
+ <p class="font-semibold">{{ 'SHARE.FLIPBOOK_OUT_OF_DATE' | translate }}</p>
602
+ @if (lastGeneratedAt) {
603
+ <p class="text-[11px] opacity-80">{{ 'SHARE.FLIPBOOK_LAST_UPDATE' | translate: { date: formatFlipbookDate(lastGeneratedAt) } }}</p>
604
+ }
605
+ </div>
606
+ </div>
607
+ }
608
+
609
+ @if (activeTab === 'reviewer') {
610
+ <!-- Reviewer: QR Code on Left, Link & Actions on Right -->
611
+ <div class="flex flex-col md:flex-row items-center gap-6 p-4 bg-base-100 rounded-2xl border border-base-200 shadow-sm">
612
+ <!-- Left: QR Code -->
613
+ <div class="flex flex-col items-center text-center gap-2 w-full md:w-5/12">
614
+ <div class="p-2 bg-white rounded-xl border border-base-300 shadow-sm flex items-center justify-center">
615
+ <div #qrContainerReviewer class="flex items-center justify-center"></div>
616
+ </div>
617
+ <p class="text-xs text-base-content/65 max-w-[220px] leading-tight">
618
+ {{ 'IFRAME_MODAL.QR_CODE_REVIEWER_DESC' | translate }}
619
+ </p>
620
+ </div>
621
+
622
+ <!-- Right: Link & Actions -->
623
+ <div class="flex flex-col gap-3 w-full md:w-7/12">
624
+ <div>
625
+ <label class="font-medium text-xs text-base-content/75 uppercase tracking-wider block mb-1.5">
626
+ {{ 'IFRAME_MODAL.LINK_TO_ANNOTATE' | translate }}
627
+ </label>
628
+ <div class="flex gap-2">
629
+ <input
630
+ type="text"
631
+ [value]="currentLink"
632
+ readonly
633
+ class="input input-sm input-bordered w-full font-mono text-xs bg-base-200" />
634
+ <sp-button
635
+ [variant]="copiedLink ? 'success' : 'primary'"
636
+ size="sm"
637
+ (clicked)="copyLink(false)">
638
+ <sp-icon [icon]="copiedLink ? spIconCheck : spIconCopy" [size]="12"></sp-icon>
639
+ <span>{{ (copiedLink ? 'SHARE.COPIED' : 'IFRAME_MODAL.COPY_LINK') | translate }}</span>
640
+ </sp-button>
641
+ </div>
642
+
643
+ @if (reviewerIsPassword && reviewerPassword) {
644
+ <button
645
+ type="button"
646
+ class="btn btn-xs btn-outline btn-neutral mt-2 w-full gap-1.5 justify-start text-[11px]"
647
+ (click)="copyLink(true)">
648
+ <sp-icon [icon]="spIconLock" [size]="12"></sp-icon>
649
+ <span>{{ 'IFRAME_MODAL.COPY_WITH_PASSWORD' | translate }}</span>
650
+ </button>
651
+ }
652
+ </div>
653
+
654
+ <div class="pt-1">
655
+ <sp-button
656
+ variant="primary"
657
+ size="sm"
658
+ (clicked)="openInNewTab()">
659
+ <sp-icon [icon]="spIconExternalLink" [size]="14"></sp-icon>
660
+ <span>{{ 'IFRAME_MODAL.OPEN_REVIEWER' | translate }}</span>
661
+ </sp-button>
662
+ </div>
663
+ </div>
664
+ </div>
665
+ } @else {
666
+ <!-- Flipbook: Iframe preview on Left, Link + QR + Embed on Right -->
667
+ <div class="flex flex-col md:flex-row gap-6 text-sm text-base-content min-h-[300px]">
668
+ <!-- Preview Section (Left) -->
669
+ <div class="flex-1 border border-base-300 rounded-xl overflow-hidden bg-base-200/50 flex items-center justify-center min-h-[280px]">
670
+ <iframe
671
+ [src]="currentSafeUrl"
672
+ frameborder="0"
673
+ allowfullscreen
674
+ class="w-full h-full min-h-[280px] bg-white rounded-xl shadow-inner">
675
+ </iframe>
676
+ </div>
677
+
678
+ <!-- Code & Link Section (Right) -->
679
+ <div class="w-full md:w-80 flex flex-col gap-3 justify-between">
680
+ <div class="flex flex-col gap-1.5">
681
+ <label class="font-medium text-xs text-base-content/75 uppercase tracking-wider">
682
+ {{ 'IFRAME_MODAL.LINK_LABEL' | translate }}
683
+ </label>
684
+ <div class="flex gap-2">
685
+ <input
686
+ type="text"
687
+ [value]="currentLink"
688
+ readonly
689
+ class="input input-sm input-bordered w-full font-mono text-xs bg-base-200" />
690
+ <sp-button
691
+ [variant]="copiedLink ? 'success' : 'primary'"
692
+ size="sm"
693
+ (clicked)="copyLink(false)">
694
+ <sp-icon [icon]="copiedLink ? spIconCheck : spIconCopy" [size]="12"></sp-icon>
695
+ <span>{{ (copiedLink ? 'SHARE.COPIED' : 'IFRAME_MODAL.COPY_LINK') | translate }}</span>
696
+ </sp-button>
697
+ </div>
698
+
699
+ @if (flipbookIsPassword && flipbookPassword) {
700
+ <button
701
+ type="button"
702
+ class="btn btn-xs btn-outline btn-neutral mt-1 w-full gap-1.5 justify-start text-[11px]"
703
+ (click)="copyLink(true)">
704
+ <sp-icon [icon]="spIconLock" [size]="12"></sp-icon>
705
+ <span>{{ 'IFRAME_MODAL.COPY_WITH_PASSWORD' | translate }}</span>
706
+ </button>
707
+ }
708
+ </div>
709
+
710
+ <!-- QR Code Section -->
711
+ <div class="flex items-center gap-3 p-2.5 bg-base-100 rounded-xl border border-base-200 shadow-sm">
712
+ <div class="p-1 bg-white rounded-lg border border-base-300 shrink-0 flex items-center justify-center">
713
+ <div #qrContainerFlipbook class="flex items-center justify-center"></div>
714
+ </div>
715
+ <div class="flex flex-col gap-1">
716
+ <span class="font-semibold text-xs text-base-content flex items-center gap-1.5">
717
+ <sp-icon [icon]="spIconBookOpen" [size]="13" class="text-primary"></sp-icon>
718
+ {{ 'IFRAME_MODAL.QR_CODE_TITLE' | translate }}
719
+ </span>
720
+ <p class="text-[11px] text-base-content/60 leading-tight">
721
+ {{ 'IFRAME_MODAL.QR_CODE_DESC' | translate }}
722
+ </p>
723
+ </div>
724
+ </div>
725
+
726
+ <div class="flex flex-col gap-1.5">
727
+ <label class="font-medium text-xs text-base-content/75 uppercase tracking-wider">
728
+ {{ 'IFRAME_MODAL.INTEGRATE' | translate }}
729
+ </label>
730
+ <textarea
731
+ readonly
732
+ rows="2"
733
+ class="textarea textarea-bordered font-mono text-xs bg-base-200 resize-none w-full min-h-[60px]">{{ currentIframeCode }}</textarea>
734
+ <sp-button
735
+ [variant]="copiedCode ? 'success' : 'primary'"
736
+ size="sm"
737
+ customClass="w-full"
738
+ (clicked)="copyCode()">
739
+ <sp-icon [icon]="copiedCode ? spIconCheck : spIconCopy" [size]="12"></sp-icon>
740
+ <span>{{ (copiedCode ? 'SHARE.COPIED' : 'IFRAME_MODAL.COPY_CODE') | translate }}</span>
741
+ </sp-button>
742
+ </div>
743
+ </div>
744
+ </div>
745
+ }
746
+
747
+ <!-- Security & Access Section -->
748
+ <div class="p-3.5 rounded-xl bg-base-200/60 border border-base-300">
749
+ <div class="flex items-center justify-between pb-2 mb-2.5 border-b border-base-300/80">
750
+ <div class="flex items-center gap-2">
751
+ <sp-icon [icon]="spIconLock" [size]="14" class="text-primary"></sp-icon>
752
+ <h4 class="font-bold text-xs uppercase tracking-wider">
753
+ {{ 'IFRAME_MODAL.SECURITY_TITLE' | translate }} -
754
+ <span class="text-primary font-semibold">
755
+ {{ (activeTab === 'flipbook' ? 'IFRAME_MODAL.FLIPBOOK_TAB' : 'IFRAME_MODAL.REVIEWER_TAB') | translate }}
756
+ </span>
757
+ </h4>
758
+ </div>
759
+
760
+ <sp-button
761
+ variant="primary"
762
+ size="xs"
763
+ [disabled]="isSavingSecurity"
764
+ (clicked)="saveSecurity()">
765
+ @if (isSavingSecurity) {
766
+ <span class="loading loading-spinner loading-xs"></span>
767
+ } @else {
768
+ <sp-icon [icon]="spIconCheck" [size]="12"></sp-icon>
769
+ }
770
+ <span>{{ 'IFRAME_MODAL.SAVE_SECURITY' | translate }}</span>
771
+ </sp-button>
772
+ </div>
773
+
774
+ @if (activeTab === 'flipbook') {
775
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 items-center">
776
+ <div>
777
+ <label class="label py-1">
778
+ <span class="label-text text-xs font-medium">{{ 'IFRAME_MODAL.ACCESS_MODE' | translate }}</span>
779
+ </label>
780
+ <select class="select select-bordered select-sm w-full font-medium" [(ngModel)]="flipbookAccessMode">
781
+ <option value="public">{{ 'IFRAME_MODAL.ACCESS_PUBLIC' | translate }}</option>
782
+ <option value="organization">{{ 'IFRAME_MODAL.ACCESS_ORGANIZATION' | translate }}</option>
783
+ </select>
784
+ </div>
785
+
786
+ <div class="flex flex-col gap-1.5">
787
+ <div class="flex items-center justify-between">
788
+ <label class="label cursor-pointer gap-2 py-0">
789
+ <span class="label-text text-xs font-medium">{{ 'IFRAME_MODAL.PASSWORD_PROTECT' | translate }}</span>
790
+ <input type="checkbox" class="toggle toggle-primary toggle-sm" [(ngModel)]="flipbookIsPassword" />
791
+ </label>
792
+ </div>
793
+
794
+ @if (flipbookIsPassword) {
795
+ <div class="join w-full">
796
+ <input
797
+ [type]="showFlipbookPassword ? 'text' : 'password'"
798
+ class="input input-sm input-bordered join-item w-full text-xs font-mono"
799
+ [placeholder]="'IFRAME_MODAL.PASSWORD_PLACEHOLDER' | translate"
800
+ [(ngModel)]="flipbookPassword" />
801
+ <button
802
+ type="button"
803
+ class="btn btn-sm btn-outline join-item"
804
+ (click)="showFlipbookPassword = !showFlipbookPassword">
805
+ <sp-icon [icon]="showFlipbookPassword ? spIconLock : spIconEye" [size]="14"></sp-icon>
806
+ </button>
807
+ </div>
808
+ }
809
+ </div>
810
+ </div>
811
+ }
812
+
813
+ @if (activeTab === 'reviewer') {
814
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 items-center">
815
+ <div>
816
+ <label class="label py-1">
817
+ <span class="label-text text-xs font-medium">{{ 'IFRAME_MODAL.ACCESS_MODE' | translate }}</span>
818
+ </label>
819
+ <select class="select select-bordered select-sm w-full font-medium" [(ngModel)]="reviewerAccessMode">
820
+ <option value="public">{{ 'IFRAME_MODAL.ACCESS_PUBLIC' | translate }}</option>
821
+ <option value="organization">{{ 'IFRAME_MODAL.ACCESS_ORGANIZATION' | translate }}</option>
822
+ </select>
823
+ </div>
824
+
825
+ <div class="flex flex-col gap-1.5">
826
+ <div class="flex items-center justify-between">
827
+ <label class="label cursor-pointer gap-2 py-0">
828
+ <span class="label-text text-xs font-medium">{{ 'IFRAME_MODAL.PASSWORD_PROTECT' | translate }}</span>
829
+ <input type="checkbox" class="toggle toggle-primary toggle-sm" [(ngModel)]="reviewerIsPassword" />
830
+ </label>
831
+ </div>
832
+
833
+ @if (reviewerIsPassword) {
834
+ <div class="join w-full">
835
+ <input
836
+ [type]="showReviewerPassword ? 'text' : 'password'"
837
+ class="input input-sm input-bordered join-item w-full text-xs font-mono"
838
+ [placeholder]="'IFRAME_MODAL.PASSWORD_PLACEHOLDER' | translate"
839
+ [(ngModel)]="reviewerPassword" />
840
+ <button
841
+ type="button"
842
+ class="btn btn-sm btn-outline join-item"
843
+ (click)="showReviewerPassword = !showReviewerPassword">
844
+ <sp-icon [icon]="showReviewerPassword ? spIconLock : spIconEye" [size]="14"></sp-icon>
845
+ </button>
846
+ </div>
847
+ }
848
+ </div>
849
+ </div>
850
+ }
851
+ </div>
852
+ </div>
853
+ </app-basic-modal>
854
+ `
855
+ }]
856
+ }], propDecorators: { moduleType: [{
857
+ type: Input
858
+ }], isOutOfDate: [{
859
+ type: Input
860
+ }], lastGeneratedAt: [{
861
+ type: Input
862
+ }], qrContainerReviewer: [{
863
+ type: ViewChild,
864
+ args: ['qrContainerReviewer']
865
+ }], qrContainerFlipbook: [{
866
+ type: ViewChild,
867
+ args: ['qrContainerFlipbook']
868
+ }] } });
869
+
870
+ export { IframeModalComponent };
871
+ //# sourceMappingURL=solidpepper-solidpepper-soliddesigner-iframe-modal.component-D-ajn-z9.mjs.map