@sumit_yewale/angular2 1.0.4 → 1.0.6

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.
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { SecurityContext, Component, Input } from '@angular/core';
3
- import { generateUuid, buildImportUrl, classifyStructuredMessage, buildInitPayload } from '@sumit_yewale/adapter-core';
3
+ import { createFileSender, classifyLegacyMessage, classifyStructuredMessage, generateUuid, buildImportUrl, buildInitPayload } from '@sumit_yewale/adapter-core';
4
4
  import * as i1 from '@angular/platform-browser';
5
5
 
6
6
  let styleElement;
@@ -35,10 +35,59 @@ const insertCSS = () => {
35
35
  styleElement.textContent = GLOBAL_CSS;
36
36
  };
37
37
 
38
+ // How long we wait for the importer to confirm a file it was sent before giving up on it.
39
+ const FILE_ACK_TIMEOUT_MS = 8000;
40
+ const OPEN_IMPORTERS_KEY = '__csvboxOpenImporters';
41
+ const TOP_Z_INDEX = 2147483647;
42
+ function openImporters() {
43
+ const w = window;
44
+ if (!w[OPEN_IMPORTERS_KEY])
45
+ w[OPEN_IMPORTERS_KEY] = { open: [], listeners: [] };
46
+ return w[OPEN_IMPORTERS_KEY];
47
+ }
48
+ function restackOpenImporters(reg) {
49
+ reg.open.forEach((entry, i) => {
50
+ const holder = entry.getHolder();
51
+ if (holder)
52
+ holder.style.zIndex = String(TOP_Z_INDEX - (reg.open.length - 1 - i));
53
+ });
54
+ }
55
+ function registerOpenImporter(entry) {
56
+ const reg = openImporters();
57
+ if (reg.open.indexOf(entry) >= 0)
58
+ return;
59
+ reg.open.push(entry);
60
+ restackOpenImporters(reg);
61
+ reg.listeners.slice().forEach(fn => fn());
62
+ }
63
+ function unregisterOpenImporter(entry) {
64
+ const reg = openImporters();
65
+ const i = reg.open.indexOf(entry);
66
+ if (i < 0)
67
+ return;
68
+ reg.open.splice(i, 1);
69
+ restackOpenImporters(reg);
70
+ reg.listeners.slice().forEach(fn => fn());
71
+ }
72
+ function isBlockedByOpenImporter(entry) {
73
+ const reg = openImporters();
74
+ return reg.open.length > 0 && reg.open.indexOf(entry) < 0;
75
+ }
76
+ function subscribeOpenImporters(fn) {
77
+ const reg = openImporters();
78
+ reg.listeners.push(fn);
79
+ return () => {
80
+ const i = reg.listeners.indexOf(fn);
81
+ if (i >= 0)
82
+ reg.listeners.splice(i, 1);
83
+ };
84
+ }
38
85
  const appVersion = '1.1.16';
39
86
  class CSVBoxButtonComponent {
40
- constructor(sanitizer) {
87
+ constructor(sanitizer, cdr, zone) {
41
88
  this.sanitizer = sanitizer;
89
+ this.cdr = cdr;
90
+ this.zone = zone;
42
91
  this.isModalShown = false;
43
92
  this.user = null;
44
93
  this.dynamicColumns = null;
@@ -56,35 +105,94 @@ class CSVBoxButtonComponent {
56
105
  this.safeUrl = null;
57
106
  this.iframe = null;
58
107
  this.disabled = true;
108
+ // True while a different importer on the page is open: the button stays disabled.
109
+ this.blockedByOther = false;
110
+ this.registryEntry = { getHolder: () => this.holder };
111
+ this.fileSender = createFileSender({
112
+ getIframe: () => this.iframe,
113
+ getToken: () => this.uuid,
114
+ getTargetOrigin: () => this.targetOrigin,
115
+ getBaseDomain: () => this.baseDomain,
116
+ takeFile: () => {
117
+ const file = this.pendingFile;
118
+ this.pendingFile = null;
119
+ return file;
120
+ },
121
+ onSent: () => this.startFileAckTimer()
122
+ });
123
+ this.unsubscribeOpenImporters = null;
59
124
  this.holder = null;
60
- }
61
- ngOnInit() {
62
- this.uuid = generateUuid();
63
- const iframeUrl = buildImportUrl({
64
- licenseKey: this.licenseKey,
65
- customDomain: this.customDomain,
66
- dataLocation: this.dataLocation,
67
- language: this.language,
68
- theme: this.theme,
69
- environment: this.environment
70
- }, "angular", appVersion);
71
- this.safeUrl = this.sanitizer.sanitize(SecurityContext.RESOURCE_URL, this.sanitizer.bypassSecurityTrustResourceUrl(iframeUrl));
72
- }
73
- ngOnChanges(changes) {
74
- if (changes['user'] && changes['user'].currentValue !== changes['user'].previousValue) {
75
- this.updateUserVariable(changes['user'].currentValue);
76
- }
77
- }
78
- updateUserVariable(data) {
79
- this.user = data;
80
- if (this.iframe && this.iframe.contentWindow) {
81
- this.iframe.contentWindow.postMessage({
82
- "customer": data
83
- }, "*");
84
- }
85
- }
86
- ngAfterContentInit() {
87
- window.addEventListener("message", (event) => {
125
+ this.pendingFile = null;
126
+ // Data-location sheets redirect to another host, so the iframe origin can differ from
127
+ // targetOrigin. baseDomain is used to check the real origin before trusting it.
128
+ this.baseDomain = "app.csvbox.io";
129
+ this.fileAckTimer = null;
130
+ this.messageListener = (event) => {
131
+ // Older importers send these as bare strings, without a token.
132
+ const legacy = classifyLegacyMessage(event.data);
133
+ if (legacy) {
134
+ // Legacy messages carry no token, so the only way to tell which importer sent one is its
135
+ // window. Ignore those that came from another instance's iframe (or anywhere else).
136
+ if (!this.iframe || event.source !== this.iframe.contentWindow) {
137
+ return;
138
+ }
139
+ if (legacy.type === "mainModalHidden") {
140
+ this.handleModalClosed();
141
+ }
142
+ else if (legacy.type === "uploadSuccessful") {
143
+ if (this.onImport)
144
+ this.onImport(true);
145
+ if (this.isImported)
146
+ this.isImported(true);
147
+ if (this.imported)
148
+ this.imported(true);
149
+ }
150
+ else if (legacy.type === "uploadFailed") {
151
+ if (this.onImport)
152
+ this.onImport(false);
153
+ if (this.isImported)
154
+ this.isImported(false);
155
+ if (this.imported)
156
+ this.imported(false);
157
+ }
158
+ return;
159
+ }
160
+ // Set-file handshake messages. The shared core does not classify these, so they are
161
+ // read here, behind the same unique_token check the core applies.
162
+ const raw = event.data;
163
+ if (raw && typeof raw === "object" && raw.data && raw.data.unique_token == this.uuid) {
164
+ this.fileSender.learnOrigin(event);
165
+ if (raw.type === "csvbox-set-file-rejected" && raw.data.reason === "not-a-file") {
166
+ // Reply to our probe (it has no file). It only tells us the origin, so do nothing.
167
+ return;
168
+ }
169
+ if (raw.type === "csvbox-modal-shown") {
170
+ this.clearFileAckTimer();
171
+ registerOpenImporter(this.registryEntry);
172
+ // What the file path in openModal() is waiting for. display as well as
173
+ // pointer-events: a second file declined while the first was still opening the
174
+ // modal has put the holder away in the meantime.
175
+ this.isModalShown = true;
176
+ if (this.holder) {
177
+ this.holder.style.display = 'block';
178
+ this.holder.style.pointerEvents = 'auto';
179
+ }
180
+ return;
181
+ }
182
+ if (raw.type === "csvbox-set-file-rejected") {
183
+ this.clearFileAckTimer();
184
+ // The importer has the file and will not take it. Put the holder away only if the
185
+ // modal was never confirmed up: a file declined while it is open leaves that modal
186
+ // where it is, and its own 'csvbox-modal-hidden' will put the holder away.
187
+ if (!this.isModalShown && this.holder) {
188
+ this.holder.style.display = 'none';
189
+ this.holder.style.pointerEvents = 'auto';
190
+ unregisterOpenImporter(this.registryEntry);
191
+ }
192
+ console.warn("[csvbox] importer declined the supplied file: " + raw.data.reason);
193
+ return;
194
+ }
195
+ }
88
196
  const message = classifyStructuredMessage(event.data, this.uuid);
89
197
  if (!message) {
90
198
  return;
@@ -127,7 +235,40 @@ class CSVBoxButtonComponent {
127
235
  if (this.imported)
128
236
  this.imported(false);
129
237
  }
130
- }, false);
238
+ };
239
+ }
240
+ ngOnInit() {
241
+ this.uuid = generateUuid();
242
+ const iframeUrl = buildImportUrl({
243
+ licenseKey: this.licenseKey,
244
+ customDomain: this.customDomain,
245
+ dataLocation: this.dataLocation,
246
+ language: this.language,
247
+ theme: this.theme,
248
+ environment: this.environment
249
+ }, "angular", appVersion);
250
+ // Default place to send the file. A file is only ever sent to a named origin, never "*".
251
+ this.targetOrigin = new URL(iframeUrl).origin;
252
+ this.baseDomain = this.customDomain || "app.csvbox.io";
253
+ this.safeUrl = this.sanitizer.sanitize(SecurityContext.RESOURCE_URL, this.sanitizer.bypassSecurityTrustResourceUrl(iframeUrl));
254
+ }
255
+ ngOnChanges(changes) {
256
+ if (changes['user'] && changes['user'].currentValue !== changes['user'].previousValue) {
257
+ this.updateUserVariable(changes['user'].currentValue);
258
+ }
259
+ }
260
+ updateUserVariable(data) {
261
+ this.user = data;
262
+ if (this.iframe && this.iframe.contentWindow) {
263
+ this.iframe.contentWindow.postMessage({
264
+ "customer": data
265
+ }, "*");
266
+ }
267
+ }
268
+ ngAfterContentInit() {
269
+ window.addEventListener("message", this.messageListener, false);
270
+ this.syncBlocked();
271
+ this.unsubscribeOpenImporters = subscribeOpenImporters(() => this.syncBlocked());
131
272
  if (this.lazy) {
132
273
  this.disabled = false;
133
274
  }
@@ -136,9 +277,30 @@ class CSVBoxButtonComponent {
136
277
  this.initImporter();
137
278
  }
138
279
  }
280
+ syncBlocked() {
281
+ const blocked = isBlockedByOpenImporter(this.registryEntry);
282
+ if (blocked !== this.blockedByOther) {
283
+ // The registry can call back from outside Angular's zone (another instance, another app).
284
+ this.zone.run(() => {
285
+ this.blockedByOther = blocked;
286
+ this.cdr.markForCheck();
287
+ });
288
+ }
289
+ }
290
+ ngOnDestroy() {
291
+ this.clearProbeTimer();
292
+ window.removeEventListener("message", this.messageListener);
293
+ unregisterOpenImporter(this.registryEntry);
294
+ if (this.unsubscribeOpenImporters) {
295
+ this.unsubscribeOpenImporters();
296
+ this.unsubscribeOpenImporters = null;
297
+ }
298
+ }
139
299
  handleModalClosed() {
140
- if (this.holder)
300
+ if (this.holder) {
141
301
  this.holder.style.display = 'none';
302
+ this.holder.style.pointerEvents = 'auto';
303
+ }
142
304
  this.isModalShown = false;
143
305
  this.isIframeLoaded = false;
144
306
  this.openModalOnIframeLoad = false;
@@ -146,6 +308,9 @@ class CSVBoxButtonComponent {
146
308
  this.holder.remove();
147
309
  this.holder = null;
148
310
  this.iframe = null;
311
+ // A new iframe is built on the next open, so the origin is learned again.
312
+ this.clearProbeTimer();
313
+ unregisterOpenImporter(this.registryEntry);
149
314
  if (this.onClose)
150
315
  this.onClose();
151
316
  if (this.isClosed)
@@ -162,22 +327,22 @@ class CSVBoxButtonComponent {
162
327
  const iframe = document.createElement("iframe");
163
328
  this.iframe = iframe;
164
329
  iframe.setAttribute("src", ((_a = this.safeUrl) === null || _a === void 0 ? void 0 : _a.toString()) || '');
330
+ iframe.setAttribute("allow", "clipboard-read; clipboard-write *");
165
331
  iframe.frameBorder = "0";
166
- const self = this;
167
- iframe.onload = function () {
168
- if (self.onReady)
169
- self.onReady();
170
- if (self.isReady)
171
- self.isReady();
172
- if (self.importerReady)
173
- self.importerReady();
174
- self.disabled = false;
175
- self.isIframeLoaded = true;
176
- if (self.iframe && self.iframe.contentWindow) {
177
- self.iframe.contentWindow.postMessage(buildInitPayload(self.user, self.dynamicColumns, self.options, self.uuid), "*");
332
+ iframe.onload = () => {
333
+ if (this.onReady)
334
+ this.onReady();
335
+ if (this.isReady)
336
+ this.isReady();
337
+ if (this.importerReady)
338
+ this.importerReady();
339
+ this.disabled = false;
340
+ this.isIframeLoaded = true;
341
+ if (this.iframe && this.iframe.contentWindow) {
342
+ this.iframe.contentWindow.postMessage(buildInitPayload(this.user, this.dynamicColumns, this.options, this.uuid), "*");
178
343
  }
179
- if (self.openModalOnIframeLoad) {
180
- self.openModal();
344
+ if (this.openModalOnIframeLoad) {
345
+ this.openModal();
181
346
  }
182
347
  };
183
348
  this.holder = document.createElement('div');
@@ -185,8 +350,13 @@ class CSVBoxButtonComponent {
185
350
  this.holder.setAttribute('id', `csvbox-embed-${this.uuid}`);
186
351
  this.holder.appendChild(iframe);
187
352
  document.body.insertAdjacentElement('beforeend', this.holder);
353
+ // The holder did not exist yet if openModal() asked for the importer before it was built.
354
+ restackOpenImporters(openImporters());
188
355
  }
189
356
  openModal() {
357
+ // Counts as open from the moment it is requested, so the other buttons are disabled while
358
+ // this importer is still loading, and so it is stacked above any importer opened earlier.
359
+ registerOpenImporter(this.registryEntry);
190
360
  if (!this.iframe) {
191
361
  this.openModalOnIframeLoad = true;
192
362
  this.initImporter();
@@ -194,11 +364,36 @@ class CSVBoxButtonComponent {
194
364
  }
195
365
  if (!this.isModalShown) {
196
366
  if (this.isIframeLoaded) {
197
- this.isModalShown = true;
198
- if (this.holder)
199
- this.holder.style.display = 'block';
200
- if (this.iframe && this.iframe.contentWindow) {
201
- this.iframe.contentWindow.postMessage('openModal', '*');
367
+ if (this.pendingFile) {
368
+ // The importer opens its own modal once it has the file, so that it can inject on
369
+ // 'shown.bs.modal'. Sending 'openModal' as well would race that.
370
+ //
371
+ // It can also decline: wrong step, an import file URL configured on the sheet, or
372
+ // an importer too old to know the message at all. So the holder goes up
373
+ // click-through and stays that way until 'csvbox-modal-shown' confirms the modal
374
+ // is really up. It covers the viewport at z-index 2147483647 and the importer
375
+ // renders transparent with its modal closed, so arming it on an unanswered message
376
+ // leaves an invisible sheet over the host page eating every click.
377
+ //
378
+ // display:block regardless, so the iframe lays out and animates normally; only
379
+ // pointer-events is held back. isModalShown likewise waits for the confirmation,
380
+ // or a declined file would latch the importer shut for good.
381
+ if (this.holder) {
382
+ this.holder.style.pointerEvents = 'none';
383
+ this.holder.style.display = 'block';
384
+ }
385
+ this.fileSender.send();
386
+ }
387
+ else {
388
+ this.isModalShown = true;
389
+ if (this.holder) {
390
+ // Explicit: a previously declined file leaves the holder click-through.
391
+ this.holder.style.pointerEvents = 'auto';
392
+ this.holder.style.display = 'block';
393
+ }
394
+ if (this.iframe && this.iframe.contentWindow) {
395
+ this.iframe.contentWindow.postMessage('openModal', '*');
396
+ }
202
397
  }
203
398
  }
204
399
  else {
@@ -206,11 +401,68 @@ class CSVBoxButtonComponent {
206
401
  }
207
402
  }
208
403
  }
404
+ /**
405
+ * Open the importer on a File the host page already has, instead of the file picker.
406
+ *
407
+ * Reachable through a template reference (`#importer` then `importer.openModalWithFile(file)`)
408
+ * or `@ViewChild(CSVBoxButtonComponent)`.
409
+ *
410
+ * The File crosses to the iframe by structured clone, so the importer receives the real
411
+ * object and applies its own extension, worksheet and size rules to it -- this does not
412
+ * bypass any of them. Pass a File; a Blob has no name for the importer to read an
413
+ * extension from.
414
+ */
415
+ openModalWithFile(file) {
416
+ if (typeof File === 'undefined' || !(file instanceof File)) {
417
+ return;
418
+ }
419
+ this.pendingFile = file;
420
+ // Already open: hand it over now rather than holding it for the next open. The importer
421
+ // takes it only while it is still on the upload step, and ignores it once the user has a
422
+ // dataset and a mapping in progress.
423
+ if (this.isModalShown && this.iframe && this.isIframeLoaded) {
424
+ this.fileSender.send();
425
+ return;
426
+ }
427
+ this.openModal();
428
+ }
429
+ clearProbeTimer() {
430
+ this.clearFileAckTimer();
431
+ this.fileSender.reset();
432
+ }
433
+ startFileAckTimer() {
434
+ this.clearFileAckTimer();
435
+ this.fileAckTimer = setTimeout(() => {
436
+ this.fileAckTimer = null;
437
+ this.giveUpOnFile();
438
+ }, FILE_ACK_TIMEOUT_MS);
439
+ }
440
+ clearFileAckTimer() {
441
+ if (this.fileAckTimer) {
442
+ clearTimeout(this.fileAckTimer);
443
+ this.fileAckTimer = null;
444
+ }
445
+ }
446
+ // The importer never confirmed the file it was sent (an origin we do not trust, or an importer too
447
+ // old to know the message). Without this the holder would stay up, invisible and click-through,
448
+ // and the other instances' buttons would stay disabled for good.
449
+ giveUpOnFile() {
450
+ if (this.isModalShown) {
451
+ return;
452
+ }
453
+ const holder = this.holder;
454
+ if (holder) {
455
+ holder.style.display = 'none';
456
+ holder.style.pointerEvents = 'auto';
457
+ }
458
+ unregisterOpenImporter(this.registryEntry);
459
+ console.warn("[csvbox] the importer did not respond to the supplied file");
460
+ }
209
461
  }
210
- CSVBoxButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CSVBoxButtonComponent, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
462
+ CSVBoxButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CSVBoxButtonComponent, deps: [{ token: i1.DomSanitizer }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
211
463
  CSVBoxButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: CSVBoxButtonComponent, isStandalone: true, selector: "csvbox-button", inputs: { onImport: "onImport", onReady: "onReady", onClose: "onClose", onSubmit: "onSubmit", isImported: "isImported", isReady: "isReady", isClosed: "isClosed", isSubmitted: "isSubmitted", importerReady: "importerReady", closed: "closed", submitted: "submitted", imported: "imported", loadStarted: "loadStarted", user: "user", dynamicColumns: "dynamicColumns", licenseKey: "licenseKey", options: "options", uuid: "uuid", customDomain: "customDomain", dataLocation: "dataLocation", language: "language", environment: "environment", theme: "theme", isIframeLoaded: "isIframeLoaded", openModalOnIframeLoad: "openModalOnIframeLoad", lazy: "lazy", disabled: "disabled" }, usesOnChanges: true, ngImport: i0, template: `
212
464
  <div>
213
- <button [disabled]="disabled" (click)="openModal()" [attr.data-csvbox-token]="uuid">
465
+ <button [disabled]="disabled || blockedByOther" (click)="openModal()" [attr.data-csvbox-token]="uuid">
214
466
  <ng-content></ng-content>
215
467
  </button>
216
468
  </div>
@@ -222,13 +474,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
222
474
  standalone: true,
223
475
  template: `
224
476
  <div>
225
- <button [disabled]="disabled" (click)="openModal()" [attr.data-csvbox-token]="uuid">
477
+ <button [disabled]="disabled || blockedByOther" (click)="openModal()" [attr.data-csvbox-token]="uuid">
226
478
  <ng-content></ng-content>
227
479
  </button>
228
480
  </div>
229
481
  `
230
482
  }]
231
- }], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; }, propDecorators: { onImport: [{
483
+ }], ctorParameters: function () { return [{ type: i1.DomSanitizer }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { onImport: [{
232
484
  type: Input
233
485
  }], onReady: [{
234
486
  type: Input
@@ -1 +1 @@
1
- {"version":3,"file":"sumit_yewale-angular2.mjs","sources":["../../../projects/angular-adapter/src/lib/utils/insertCSS.ts","../../../projects/angular-adapter/src/lib/angular-adapter.component.ts","../../../projects/angular-adapter/src/public-api.ts","../../../projects/angular-adapter/src/sumit_yewale-angular2.ts"],"sourcesContent":["let styleElement: HTMLStyleElement\n\nconst GLOBAL_CSS = `\n.csvbox-holder {\n z-index: 2147483647;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n}\n.csvbox-holder iframe {\n height: 100%;\n width: 100%;\n position: absolute;\n top: 0px;\n left: 0px;\n}\n`\n\nexport const insertCSS = (): void => {\n if (styleElement) {\n return\n }\n\n styleElement = document.createElement('style')\n styleElement.setAttribute('type', 'text/css')\n const head = document.querySelector('head');\n if (head) {\n head.appendChild(styleElement);\n }\n\n styleElement.textContent = GLOBAL_CSS\n}\n","import {\n Component,\n OnInit,\n Input,\n OnChanges,\n SimpleChanges,\n SecurityContext,\n AfterContentInit\n} from '@angular/core';\n\nimport { DomSanitizer, SafeUrl } from '@angular/platform-browser';\nimport { insertCSS } from './utils/insertCSS';\nimport { buildImportUrl, generateUuid, buildInitPayload, classifyStructuredMessage } from '@sumit_yewale/adapter-core';\n\nconst appVersion = '1.1.16';\n\n@Component({\n selector: 'csvbox-button',\n standalone: true,\n template: `\n <div>\n <button [disabled]=\"disabled\" (click)=\"openModal()\" [attr.data-csvbox-token]=\"uuid\">\n <ng-content></ng-content>\n </button>\n </div>\n `\n})\n\nexport class CSVBoxButtonComponent implements OnInit, OnChanges, AfterContentInit {\n\n isModalShown = false;\n\n @Input() onImport?: (success: boolean, metadata?: any) => void;\n @Input() onReady?: () => void;\n @Input() onClose?: () => void;\n @Input() onSubmit?: (metadata: any) => void;\n\n @Input() isImported?: (success: boolean, metadata?: any) => void;\n @Input() isReady?: () => void;\n @Input() isClosed?: () => void;\n @Input() isSubmitted?: (metadata: any) => void;\n\n @Input() importerReady?: () => void;\n @Input() closed?: () => void;\n @Input() submitted?: () => void;\n @Input() imported?: (success: boolean, metadata?: any) => void;\n @Input() loadStarted?: () => void;\n\n @Input() user: { [key: string]: any } | null = null;\n @Input() dynamicColumns: { [key: string]: any } | null = null;\n @Input() licenseKey: string | null = null;\n @Input() options: { [key: string]: any } | null = null;\n @Input() uuid: string = '';\n @Input() customDomain: string | null = null;\n @Input() dataLocation: string | null = null;\n @Input() language: string | null = null;\n @Input() environment: { [key: string]: any } | null = null;\n\n @Input() theme: string | null = null;\n\n @Input() isIframeLoaded: boolean = false;\n @Input() openModalOnIframeLoad: boolean = false;\n\n @Input() lazy: boolean = false;\n\n safeUrl: SafeUrl | null = null;\n\n iframe: HTMLIFrameElement | null = null;\n\n @Input() disabled: boolean = true;\n\n constructor(public sanitizer: DomSanitizer) {}\n\n holder: HTMLDivElement | null = null;\n\n ngOnInit(): void {\n this.uuid = generateUuid();\n const iframeUrl = buildImportUrl(\n {\n licenseKey: this.licenseKey,\n customDomain: this.customDomain,\n dataLocation: this.dataLocation,\n language: this.language,\n theme: this.theme,\n environment: this.environment\n },\n \"angular\",\n appVersion\n );\n this.safeUrl = this.sanitizer.sanitize(SecurityContext.RESOURCE_URL, this.sanitizer.bypassSecurityTrustResourceUrl(iframeUrl));\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['user'] && changes['user'].currentValue !== changes['user'].previousValue) {\n this.updateUserVariable(changes['user'].currentValue);\n }\n }\n\n updateUserVariable(data: { [key: string]: any }): void {\n this.user = data;\n if (this.iframe && this.iframe.contentWindow) {\n this.iframe.contentWindow.postMessage({\n \"customer\": data\n }, \"*\");\n }\n }\n\n ngAfterContentInit(): void {\n window.addEventListener(\"message\", (event: MessageEvent) => {\n const message = classifyStructuredMessage(event.data, this.uuid);\n if (!message) {\n return;\n }\n\n if (message.type === \"data-on-submit\") {\n if (this.onSubmit) this.onSubmit(message.metadata);\n if (this.isSubmitted) this.isSubmitted(message.metadata);\n if (this.submitted) this.submitted();\n } else if (message.type === \"data-push-status\") {\n if (!message.success) {\n delete message.metadata[\"unique_token\"];\n }\n if (this.onImport) this.onImport(message.success, message.metadata);\n if (this.isImported) this.isImported(message.success, message.metadata);\n if (this.imported) this.imported(message.success, message.metadata);\n } else if (message.type === \"csvbox-modal-hidden\") {\n this.handleModalClosed();\n } else if (message.type === \"csvbox-upload-successful\") {\n if (this.onImport) this.onImport(true);\n if (this.isImported) this.isImported(true);\n if (this.imported) this.imported(true);\n } else if (message.type === \"csvbox-upload-failed\") {\n if (this.onImport) this.onImport(false);\n if (this.isImported) this.isImported(false);\n if (this.imported) this.imported(false);\n }\n }, false);\n\n if (this.lazy) {\n this.disabled = false;\n } else {\n this.disabled = true;\n this.initImporter();\n }\n }\n\n handleModalClosed(): void {\n if (this.holder) this.holder.style.display = 'none';\n this.isModalShown = false;\n this.isIframeLoaded = false;\n this.openModalOnIframeLoad = false;\n if (this.holder) this.holder.remove();\n this.holder = null;\n this.iframe = null;\n if (this.onClose) this.onClose();\n if (this.isClosed) this.isClosed();\n if (this.closed) this.closed();\n }\n\n initImporter(): void {\n if (this.loadStarted) this.loadStarted();\n\n this.uuid = generateUuid();\n\n insertCSS();\n\n const iframe = document.createElement(\"iframe\");\n this.iframe = iframe;\n iframe.setAttribute(\"src\", this.safeUrl?.toString() || '');\n iframe.frameBorder = \"0\";\n\n const self = this;\n iframe.onload = function () {\n if (self.onReady) self.onReady();\n if (self.isReady) self.isReady();\n if (self.importerReady) self.importerReady();\n\n self.disabled = false;\n self.isIframeLoaded = true;\n if (self.iframe && self.iframe.contentWindow) {\n self.iframe.contentWindow.postMessage(buildInitPayload(self.user, self.dynamicColumns, self.options, self.uuid), \"*\");\n }\n if (self.openModalOnIframeLoad) {\n self.openModal();\n }\n }\n\n this.holder = document.createElement('div');\n this.holder.classList.add('csvbox-holder');\n this.holder.setAttribute('id', `csvbox-embed-${this.uuid}`);\n this.holder.appendChild(iframe);\n\n document.body.insertAdjacentElement(\n 'beforeend', this.holder\n );\n }\n\n openModal(): void {\n if (!this.iframe) {\n this.openModalOnIframeLoad = true;\n this.initImporter();\n return;\n }\n if (!this.isModalShown) {\n if (this.isIframeLoaded) {\n this.isModalShown = true;\n if (this.holder) this.holder.style.display = 'block';\n if (this.iframe && this.iframe.contentWindow) {\n this.iframe.contentWindow.postMessage('openModal', '*');\n }\n } else {\n this.openModalOnIframeLoad = true;\n }\n }\n }\n}\n","/*\n * Public API Surface of angular-adapter\n */\n\n\nexport * from './lib/angular-adapter.component';\nexport * from './lib/interface';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA,IAAI,YAA8B,CAAA;AAElC,MAAM,UAAU,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiBlB,CAAA;AAEM,MAAM,SAAS,GAAG,MAAW;AAClC,IAAA,IAAI,YAAY,EAAE;QAChB,OAAM;AACP,KAAA;AAED,IAAA,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;AAC9C,IAAA,YAAY,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AAC5C,IAAA,IAAI,IAAI,EAAE;AACR,QAAA,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAChC,KAAA;AAED,IAAA,YAAY,CAAC,WAAW,GAAG,UAAU,CAAA;AACvC,CAAC;;ACpBD,MAAM,UAAU,GAAG,QAAQ,CAAC;MAcf,qBAAqB,CAAA;AA2ChC,IAAA,WAAA,CAAmB,SAAuB,EAAA;AAAvB,QAAA,IAAS,CAAA,SAAA,GAAT,SAAS,CAAc;AAzC1C,QAAA,IAAY,CAAA,YAAA,GAAG,KAAK,CAAC;AAkBZ,QAAA,IAAI,CAAA,IAAA,GAAkC,IAAI,CAAC;AAC3C,QAAA,IAAc,CAAA,cAAA,GAAkC,IAAI,CAAC;AACrD,QAAA,IAAU,CAAA,UAAA,GAAkB,IAAI,CAAC;AACjC,QAAA,IAAO,CAAA,OAAA,GAAkC,IAAI,CAAC;AAC9C,QAAA,IAAI,CAAA,IAAA,GAAW,EAAE,CAAC;AAClB,QAAA,IAAY,CAAA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QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACG,WAAW,EAAA,CAAA;sBAAnB,KAAK;gBAEG,IAAI,EAAA,CAAA;sBAAZ,KAAK;gBACG,cAAc,EAAA,CAAA;sBAAtB,KAAK;gBACG,UAAU,EAAA,CAAA;sBAAlB,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,IAAI,EAAA,CAAA;sBAAZ,KAAK;gBACG,YAAY,EAAA,CAAA;sBAApB,KAAK;gBACG,YAAY,EAAA,CAAA;sBAApB,KAAK;gBACG,QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACG,WAAW,EAAA,CAAA;sBAAnB,KAAK;gBAEG,KAAK,EAAA,CAAA;sBAAb,KAAK;gBAEG,cAAc,EAAA,CAAA;sBAAtB,KAAK;gBACG,qBAAqB,EAAA,CAAA;sBAA7B,KAAK;gBAEG,IAAI,EAAA,CAAA;sBAAZ,KAAK;gBAMG,QAAQ,EAAA,CAAA;sBAAhB,KAAK;;;ACrER;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"sumit_yewale-angular2.mjs","sources":["../../../projects/angular-adapter/src/lib/utils/insertCSS.ts","../../../projects/angular-adapter/src/lib/angular-adapter.component.ts","../../../projects/angular-adapter/src/public-api.ts","../../../projects/angular-adapter/src/sumit_yewale-angular2.ts"],"sourcesContent":["let styleElement: HTMLStyleElement\n\nconst GLOBAL_CSS = `\n.csvbox-holder {\n z-index: 2147483647;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n}\n.csvbox-holder iframe {\n height: 100%;\n width: 100%;\n position: absolute;\n top: 0px;\n left: 0px;\n}\n`\n\nexport const insertCSS = (): void => {\n if (styleElement) {\n return\n }\n\n styleElement = document.createElement('style')\n styleElement.setAttribute('type', 'text/css')\n const head = document.querySelector('head');\n if (head) {\n head.appendChild(styleElement);\n }\n\n styleElement.textContent = GLOBAL_CSS\n}\n","import {\n Component,\n OnInit,\n Input,\n OnChanges,\n SimpleChanges,\n SecurityContext,\n AfterContentInit,\n OnDestroy,\n ChangeDetectorRef,\n NgZone\n} from '@angular/core';\n\nimport { DomSanitizer, SafeUrl } from '@angular/platform-browser';\nimport { insertCSS } from './utils/insertCSS';\nimport { buildImportUrl, generateUuid, buildInitPayload, createFileSender, classifyStructuredMessage, classifyLegacyMessage } from '@sumit_yewale/adapter-core';\n\n// How long we wait for the importer to confirm a file it was sent before giving up on it.\nconst FILE_ACK_TIMEOUT_MS = 8000;\n\n// Page-wide record of the importers that are open or opening, shared by every CSVBox adapter\n// on the page (it lives on window so separate copies of an adapter see the same list). It does\n// two things: the newest importer is stacked on top (every holder is fixed, full screen and\n// z-index 2147483647, so equal z-indexes would leave the one that comes first in the DOM on\n// top), and the other instances learn that an importer is open so they can disable their button.\ninterface OpenImporterEntry { getHolder: () => HTMLElement | null; }\ninterface OpenImporters { open: OpenImporterEntry[]; listeners: Array<() => void>; }\nconst OPEN_IMPORTERS_KEY = '__csvboxOpenImporters';\nconst TOP_Z_INDEX = 2147483647;\n\nfunction openImporters(): OpenImporters {\n const w = window as any;\n if (!w[OPEN_IMPORTERS_KEY]) w[OPEN_IMPORTERS_KEY] = { open: [], listeners: [] };\n return w[OPEN_IMPORTERS_KEY];\n}\n\nfunction restackOpenImporters(reg: OpenImporters): void {\n reg.open.forEach((entry, i) => {\n const holder = entry.getHolder();\n if (holder) holder.style.zIndex = String(TOP_Z_INDEX - (reg.open.length - 1 - i));\n });\n}\n\nfunction registerOpenImporter(entry: OpenImporterEntry): void {\n const reg = openImporters();\n if (reg.open.indexOf(entry) >= 0) return;\n reg.open.push(entry);\n restackOpenImporters(reg);\n reg.listeners.slice().forEach(fn => fn());\n}\n\nfunction unregisterOpenImporter(entry: OpenImporterEntry): void {\n const reg = openImporters();\n const i = reg.open.indexOf(entry);\n if (i < 0) return;\n reg.open.splice(i, 1);\n restackOpenImporters(reg);\n reg.listeners.slice().forEach(fn => fn());\n}\n\nfunction isBlockedByOpenImporter(entry: OpenImporterEntry): boolean {\n const reg = openImporters();\n return reg.open.length > 0 && reg.open.indexOf(entry) < 0;\n}\n\nfunction subscribeOpenImporters(fn: () => void): () => void {\n const reg = openImporters();\n reg.listeners.push(fn);\n return () => {\n const i = reg.listeners.indexOf(fn);\n if (i >= 0) reg.listeners.splice(i, 1);\n };\n}\n\nconst appVersion = '1.1.16';\n\n@Component({\n selector: 'csvbox-button',\n standalone: true,\n template: `\n <div>\n <button [disabled]=\"disabled || blockedByOther\" (click)=\"openModal()\" [attr.data-csvbox-token]=\"uuid\">\n <ng-content></ng-content>\n </button>\n </div>\n `\n})\n\nexport class CSVBoxButtonComponent implements OnInit, OnChanges, AfterContentInit, OnDestroy {\n\n isModalShown = false;\n\n @Input() onImport?: (success: boolean, metadata?: any) => void;\n @Input() onReady?: () => void;\n @Input() onClose?: () => void;\n @Input() onSubmit?: (metadata: any) => void;\n\n @Input() isImported?: (success: boolean, metadata?: any) => void;\n @Input() isReady?: () => void;\n @Input() isClosed?: () => void;\n @Input() isSubmitted?: (metadata: any) => void;\n\n @Input() importerReady?: () => void;\n @Input() closed?: () => void;\n @Input() submitted?: () => void;\n @Input() imported?: (success: boolean, metadata?: any) => void;\n @Input() loadStarted?: () => void;\n\n @Input() user: { [key: string]: any } | null = null;\n @Input() dynamicColumns: { [key: string]: any } | null = null;\n @Input() licenseKey: string | null = null;\n @Input() options: { [key: string]: any } | null = null;\n @Input() uuid: string = '';\n @Input() customDomain: string | null = null;\n @Input() dataLocation: string | null = null;\n @Input() language: string | null = null;\n @Input() environment: { [key: string]: any } | null = null;\n\n @Input() theme: string | null = null;\n\n @Input() isIframeLoaded: boolean = false;\n @Input() openModalOnIframeLoad: boolean = false;\n\n @Input() lazy: boolean = false;\n\n safeUrl: SafeUrl | null = null;\n\n iframe: HTMLIFrameElement | null = null;\n\n @Input() disabled: boolean = true;\n\n constructor(public sanitizer: DomSanitizer, private cdr: ChangeDetectorRef, private zone: NgZone) {}\n\n // True while a different importer on the page is open: the button stays disabled.\n blockedByOther: boolean = false;\n\n private registryEntry: OpenImporterEntry = { getHolder: () => this.holder };\n\n private fileSender = createFileSender({\n getIframe: () => this.iframe,\n getToken: () => this.uuid as string,\n getTargetOrigin: () => this.targetOrigin as string,\n getBaseDomain: () => this.baseDomain,\n takeFile: () => {\n const file = this.pendingFile;\n this.pendingFile = null;\n return file;\n },\n onSent: () => this.startFileAckTimer()\n });\n\n private unsubscribeOpenImporters: (() => void) | null = null;\n\n holder: HTMLDivElement | null = null;\n\n pendingFile: File | null = null;\n\n targetOrigin: string | undefined;\n\n // Data-location sheets redirect to another host, so the iframe origin can differ from\n // targetOrigin. baseDomain is used to check the real origin before trusting it.\n baseDomain: string = \"app.csvbox.io\";\n\n private fileAckTimer: any = null;\n\n ngOnInit(): void {\n this.uuid = generateUuid();\n const iframeUrl = buildImportUrl(\n {\n licenseKey: this.licenseKey,\n customDomain: this.customDomain,\n dataLocation: this.dataLocation,\n language: this.language,\n theme: this.theme,\n environment: this.environment\n },\n \"angular\",\n appVersion\n );\n // Default place to send the file. A file is only ever sent to a named origin, never \"*\".\n this.targetOrigin = new URL(iframeUrl).origin;\n this.baseDomain = this.customDomain || \"app.csvbox.io\";\n this.safeUrl = this.sanitizer.sanitize(SecurityContext.RESOURCE_URL, this.sanitizer.bypassSecurityTrustResourceUrl(iframeUrl));\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['user'] && changes['user'].currentValue !== changes['user'].previousValue) {\n this.updateUserVariable(changes['user'].currentValue);\n }\n }\n\n updateUserVariable(data: { [key: string]: any }): void {\n this.user = data;\n if (this.iframe && this.iframe.contentWindow) {\n this.iframe.contentWindow.postMessage({\n \"customer\": data\n }, \"*\");\n }\n }\n\n private messageListener = (event: MessageEvent) => {\n // Older importers send these as bare strings, without a token.\n const legacy = classifyLegacyMessage(event.data);\n if (legacy) {\n // Legacy messages carry no token, so the only way to tell which importer sent one is its\n // window. Ignore those that came from another instance's iframe (or anywhere else).\n if (!this.iframe || event.source !== this.iframe.contentWindow) {\n return;\n }\n if (legacy.type === \"mainModalHidden\") {\n this.handleModalClosed();\n } else if (legacy.type === \"uploadSuccessful\") {\n if (this.onImport) this.onImport(true);\n if (this.isImported) this.isImported(true);\n if (this.imported) this.imported(true);\n } else if (legacy.type === \"uploadFailed\") {\n if (this.onImport) this.onImport(false);\n if (this.isImported) this.isImported(false);\n if (this.imported) this.imported(false);\n }\n return;\n }\n\n // Set-file handshake messages. The shared core does not classify these, so they are\n // read here, behind the same unique_token check the core applies.\n const raw = event.data;\n if (raw && typeof raw === \"object\" && raw.data && raw.data.unique_token == this.uuid) {\n this.fileSender.learnOrigin(event);\n\n if (raw.type === \"csvbox-set-file-rejected\" && raw.data.reason === \"not-a-file\") {\n // Reply to our probe (it has no file). It only tells us the origin, so do nothing.\n return;\n }\n if (raw.type === \"csvbox-modal-shown\") {\n this.clearFileAckTimer();\n registerOpenImporter(this.registryEntry);\n // What the file path in openModal() is waiting for. display as well as\n // pointer-events: a second file declined while the first was still opening the\n // modal has put the holder away in the meantime.\n this.isModalShown = true;\n if (this.holder) {\n this.holder.style.display = 'block';\n this.holder.style.pointerEvents = 'auto';\n }\n return;\n }\n if (raw.type === \"csvbox-set-file-rejected\") {\n this.clearFileAckTimer();\n // The importer has the file and will not take it. Put the holder away only if the\n // modal was never confirmed up: a file declined while it is open leaves that modal\n // where it is, and its own 'csvbox-modal-hidden' will put the holder away.\n if (!this.isModalShown && this.holder) {\n this.holder.style.display = 'none';\n this.holder.style.pointerEvents = 'auto';\n unregisterOpenImporter(this.registryEntry);\n }\n console.warn(\"[csvbox] importer declined the supplied file: \" + raw.data.reason);\n return;\n }\n }\n\n const message = classifyStructuredMessage(event.data, this.uuid);\n if (!message) {\n return;\n }\n\n if (message.type === \"data-on-submit\") {\n if (this.onSubmit) this.onSubmit(message.metadata);\n if (this.isSubmitted) this.isSubmitted(message.metadata);\n if (this.submitted) this.submitted();\n } else if (message.type === \"data-push-status\") {\n if (!message.success) {\n delete message.metadata[\"unique_token\"];\n }\n if (this.onImport) this.onImport(message.success, message.metadata);\n if (this.isImported) this.isImported(message.success, message.metadata);\n if (this.imported) this.imported(message.success, message.metadata);\n } else if (message.type === \"csvbox-modal-hidden\") {\n this.handleModalClosed();\n } else if (message.type === \"csvbox-upload-successful\") {\n if (this.onImport) this.onImport(true);\n if (this.isImported) this.isImported(true);\n if (this.imported) this.imported(true);\n } else if (message.type === \"csvbox-upload-failed\") {\n if (this.onImport) this.onImport(false);\n if (this.isImported) this.isImported(false);\n if (this.imported) this.imported(false);\n }\n };\n\n ngAfterContentInit(): void {\n window.addEventListener(\"message\", this.messageListener, false);\n this.syncBlocked();\n this.unsubscribeOpenImporters = subscribeOpenImporters(() => this.syncBlocked());\n\n if (this.lazy) {\n this.disabled = false;\n } else {\n this.disabled = true;\n this.initImporter();\n }\n }\n\n private syncBlocked(): void {\n const blocked = isBlockedByOpenImporter(this.registryEntry);\n if (blocked !== this.blockedByOther) {\n // The registry can call back from outside Angular's zone (another instance, another app).\n this.zone.run(() => {\n this.blockedByOther = blocked;\n this.cdr.markForCheck();\n });\n }\n }\n\n ngOnDestroy(): void {\n this.clearProbeTimer();\n window.removeEventListener(\"message\", this.messageListener);\n unregisterOpenImporter(this.registryEntry);\n if (this.unsubscribeOpenImporters) {\n this.unsubscribeOpenImporters();\n this.unsubscribeOpenImporters = null;\n }\n }\n\n handleModalClosed(): void {\n if (this.holder) {\n this.holder.style.display = 'none';\n this.holder.style.pointerEvents = 'auto';\n }\n this.isModalShown = false;\n this.isIframeLoaded = false;\n this.openModalOnIframeLoad = false;\n if (this.holder) this.holder.remove();\n this.holder = null;\n this.iframe = null;\n // A new iframe is built on the next open, so the origin is learned again.\n this.clearProbeTimer();\n unregisterOpenImporter(this.registryEntry);\n if (this.onClose) this.onClose();\n if (this.isClosed) this.isClosed();\n if (this.closed) this.closed();\n }\n\n initImporter(): void {\n if (this.loadStarted) this.loadStarted();\n\n this.uuid = generateUuid();\n\n insertCSS();\n\n const iframe = document.createElement(\"iframe\");\n this.iframe = iframe;\n iframe.setAttribute(\"src\", this.safeUrl?.toString() || '');\n iframe.setAttribute(\"allow\", \"clipboard-read; clipboard-write *\");\n iframe.frameBorder = \"0\";\n\n iframe.onload = () => {\n if (this.onReady) this.onReady();\n if (this.isReady) this.isReady();\n if (this.importerReady) this.importerReady();\n\n this.disabled = false;\n this.isIframeLoaded = true;\n if (this.iframe && this.iframe.contentWindow) {\n this.iframe.contentWindow.postMessage(buildInitPayload(this.user, this.dynamicColumns, this.options, this.uuid), \"*\");\n }\n if (this.openModalOnIframeLoad) {\n this.openModal();\n }\n };\n\n this.holder = document.createElement('div');\n this.holder.classList.add('csvbox-holder');\n this.holder.setAttribute('id', `csvbox-embed-${this.uuid}`);\n this.holder.appendChild(iframe);\n\n document.body.insertAdjacentElement(\n 'beforeend', this.holder\n );\n // The holder did not exist yet if openModal() asked for the importer before it was built.\n restackOpenImporters(openImporters());\n }\n\n openModal(): void {\n // Counts as open from the moment it is requested, so the other buttons are disabled while\n // this importer is still loading, and so it is stacked above any importer opened earlier.\n registerOpenImporter(this.registryEntry);\n if(!this.iframe) {\n this.openModalOnIframeLoad = true;\n this.initImporter();\n return;\n }\n if(!this.isModalShown) {\n if(this.isIframeLoaded) {\n if(this.pendingFile) {\n // The importer opens its own modal once it has the file, so that it can inject on\n // 'shown.bs.modal'. Sending 'openModal' as well would race that.\n //\n // It can also decline: wrong step, an import file URL configured on the sheet, or\n // an importer too old to know the message at all. So the holder goes up\n // click-through and stays that way until 'csvbox-modal-shown' confirms the modal\n // is really up. It covers the viewport at z-index 2147483647 and the importer\n // renders transparent with its modal closed, so arming it on an unanswered message\n // leaves an invisible sheet over the host page eating every click.\n //\n // display:block regardless, so the iframe lays out and animates normally; only\n // pointer-events is held back. isModalShown likewise waits for the confirmation,\n // or a declined file would latch the importer shut for good.\n if(this.holder) {\n this.holder.style.pointerEvents = 'none';\n this.holder.style.display = 'block';\n }\n this.fileSender.send();\n } else {\n this.isModalShown = true;\n if(this.holder) {\n // Explicit: a previously declined file leaves the holder click-through.\n this.holder.style.pointerEvents = 'auto';\n this.holder.style.display = 'block';\n }\n if(this.iframe && this.iframe.contentWindow) {\n this.iframe.contentWindow.postMessage('openModal', '*');\n }\n }\n } else {\n this.openModalOnIframeLoad = true;\n }\n }\n }\n\n /**\n * Open the importer on a File the host page already has, instead of the file picker.\n *\n * Reachable through a template reference (`#importer` then `importer.openModalWithFile(file)`)\n * or `@ViewChild(CSVBoxButtonComponent)`.\n *\n * The File crosses to the iframe by structured clone, so the importer receives the real\n * object and applies its own extension, worksheet and size rules to it -- this does not\n * bypass any of them. Pass a File; a Blob has no name for the importer to read an\n * extension from.\n */\n openModalWithFile(file: File): void {\n if(typeof File === 'undefined' || !(file instanceof File)) {\n return;\n }\n\n this.pendingFile = file;\n\n // Already open: hand it over now rather than holding it for the next open. The importer\n // takes it only while it is still on the upload step, and ignores it once the user has a\n // dataset and a mapping in progress.\n if(this.isModalShown && this.iframe && this.isIframeLoaded) {\n this.fileSender.send();\n return;\n }\n\n this.openModal();\n }\n\n clearProbeTimer(): void {\n this.clearFileAckTimer();\n this.fileSender.reset();\n }\n\n startFileAckTimer(): void {\n this.clearFileAckTimer();\n this.fileAckTimer = setTimeout(() => {\n this.fileAckTimer = null;\n this.giveUpOnFile();\n }, FILE_ACK_TIMEOUT_MS);\n }\n\n clearFileAckTimer(): void {\n if (this.fileAckTimer) {\n clearTimeout(this.fileAckTimer);\n this.fileAckTimer = null;\n }\n }\n\n // The importer never confirmed the file it was sent (an origin we do not trust, or an importer too\n // old to know the message). Without this the holder would stay up, invisible and click-through,\n // and the other instances' buttons would stay disabled for good.\n giveUpOnFile(): void {\n if (this.isModalShown) {\n return;\n }\n const holder = this.holder;\n if (holder) {\n holder.style.display = 'none';\n holder.style.pointerEvents = 'auto';\n }\n unregisterOpenImporter(this.registryEntry);\n console.warn(\"[csvbox] the importer did not respond to the supplied file\");\n }\n}\n","/*\n * Public API Surface of angular-adapter\n */\n\n\nexport * from './lib/angular-adapter.component';\nexport * from './lib/interface';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA,IAAI,YAA8B,CAAA;AAElC,MAAM,UAAU,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiBlB,CAAA;AAEM,MAAM,SAAS,GAAG,MAAW;AAClC,IAAA,IAAI,YAAY,EAAE;QAChB,OAAM;AACP,KAAA;AAED,IAAA,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;AAC9C,IAAA,YAAY,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AAC5C,IAAA,IAAI,IAAI,EAAE;AACR,QAAA,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAChC,KAAA;AAED,IAAA,YAAY,CAAC,WAAW,GAAG,UAAU,CAAA;AACvC,CAAC;;ACjBD;AACA,MAAM,mBAAmB,GAAG,IAAI,CAAC;AASjC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AACnD,MAAM,WAAW,GAAG,UAAU,CAAC;AAE/B,SAAS,aAAa,GAAA;IACpB,MAAM,CAAC,GAAG,MAAa,CAAC;AACxB,IAAA,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC;AAAE,QAAA,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAChF,IAAA,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAkB,EAAA;IAC9C,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,KAAI;AAC5B,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;AACjC,QAAA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