@covalent/guided-tour 4.0.0-beta.2 → 4.1.0-develop.2

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.
@@ -119,7 +119,9 @@ class CovalentGuidedTour extends TourButtonsActions {
119
119
  let stepTotal = 0;
120
120
  const steps = originalSteps.map((step) => {
121
121
  var _a, _b, _c;
122
- let showProgress;
122
+ let showProgress = () => {
123
+ //
124
+ };
123
125
  if (((_a = step.attachToOptions) === null || _a === void 0 ? void 0 : _a.skipFromStepCount) === true) {
124
126
  showProgress = function () {
125
127
  return;
@@ -183,11 +185,15 @@ class CovalentGuidedTour extends TourButtonsActions {
183
185
  this.shepherdTour.back();
184
186
  }
185
187
  },
186
- classes: ((_a = step.advanceOnOptions) === null || _a === void 0 ? void 0 : _a.allowGoBack) === false ? MAT_BUTTON_INVISIBLE : MAT_ICON_BUTTON,
188
+ classes: ((_a = step.advanceOnOptions) === null || _a === void 0 ? void 0 : _a.allowGoBack) === false
189
+ ? MAT_BUTTON_INVISIBLE
190
+ : MAT_ICON_BUTTON,
187
191
  };
188
192
  // check if highlight was provided for the step, else fallback into shepherds usage
189
193
  step.highlightClass =
190
- step.attachToOptions && step.attachToOptions.highlight ? 'shepherd-highlight' : step.highlightClass;
194
+ step.attachToOptions && step.attachToOptions.highlight
195
+ ? 'shepherd-highlight'
196
+ : step.highlightClass;
191
197
  // Adding buttons in the steps if no buttons are defined
192
198
  if (!step.buttons || step.buttons.length === 0) {
193
199
  if (index === 0) {
@@ -207,15 +213,19 @@ class CovalentGuidedTour extends TourButtonsActions {
207
213
  // remove the shepherd "advanceOn" infavor of ours if the event is part of our list
208
214
  if ((typeof advanceOn === 'object' &&
209
215
  !Array.isArray(advanceOn) &&
216
+ advanceOn.event &&
210
217
  overriddenEvents.indexOf(advanceOn.event.split('.')[0]) > -1) ||
211
218
  advanceOn instanceof Array) {
212
219
  step.advanceOn = undefined;
213
220
  step.buttons =
214
- step.advanceOnOptions && step.advanceOnOptions.allowGoBack ? [backButton, voidButton] : [voidButton];
221
+ step.advanceOnOptions && step.advanceOnOptions.allowGoBack
222
+ ? [backButton, voidButton]
223
+ : [voidButton];
215
224
  }
216
225
  // adds a default beforeShowPromise function
217
226
  step.beforeShowPromise = () => {
218
227
  return new Promise((resolve) => {
228
+ var _a;
219
229
  const additionalCapabilitiesSetup = () => {
220
230
  if (advanceOn && !step.advanceOn) {
221
231
  if (!Array.isArray(advanceOn)) {
@@ -226,7 +236,7 @@ class CovalentGuidedTour extends TourButtonsActions {
226
236
  const advanceEvent$ = new Subject();
227
237
  advanceArr$.push(advanceEvent$);
228
238
  // we start a timer of attempts to find an element in the dom
229
- this._bindEvent(advanceOn[i], step.advanceOnOptions, advanceEvent$, destroyedEvent$);
239
+ this._bindEvent(_, step.advanceOnOptions, advanceEvent$, destroyedEvent$);
230
240
  });
231
241
  const advanceSubs = forkJoin(...advanceArr$)
232
242
  .pipe(takeUntil(merge(destroyedEvent$, backEvent$)))
@@ -266,31 +276,38 @@ class CovalentGuidedTour extends TourButtonsActions {
266
276
  if (typeof step.attachTo === 'string') {
267
277
  id = step.attachTo;
268
278
  }
269
- else if (typeof step.attachTo === 'object' && typeof step.attachTo.element === 'string') {
279
+ else if (typeof step.attachTo === 'object' &&
280
+ typeof step.attachTo.element === 'string') {
270
281
  id = step.attachTo.element;
271
282
  }
272
283
  // if we have an id as a string in either case, we use it (we ignore it if its HTMLElement)
273
284
  if (id) {
274
285
  // if current step is the first step of the tour, we set the buttons to be only "next"
275
286
  // we had to use `any` since the tour doesnt expose the steps in any fashion nor a way to check if we have modified them at all
276
- if (this.shepherdTour.getCurrentStep() === this.shepherdTour.steps[0]) {
277
- this.shepherdTour.getCurrentStep().updateStepOptions({
278
- buttons: originalSteps[index].advanceOn ? [voidButton] : [nextButton],
287
+ if (this.shepherdTour.getCurrentStep() ===
288
+ this.shepherdTour.steps[0]) {
289
+ (_a = this.shepherdTour.getCurrentStep()) === null || _a === void 0 ? void 0 : _a.updateStepOptions({
290
+ buttons: originalSteps[index].advanceOn
291
+ ? [voidButton]
292
+ : [nextButton],
279
293
  });
280
294
  }
281
295
  // register to the attempts observable to notify deeveloper when number has been reached
282
296
  _retryAttempts$
283
297
  .pipe(skip(1), takeUntil(merge(_stopTimer$.asObservable(), destroyedEvent$)), skipWhile((val) => {
284
- if (step.attachToOptions && step.attachToOptions.retries !== undefined) {
298
+ if (step.attachToOptions &&
299
+ step.attachToOptions.retries !== undefined) {
285
300
  return val < step.attachToOptions.retries;
286
301
  }
287
302
  return val < SHEPHERD_DEFAULT_FIND_ATTEMPTS;
288
303
  }))
289
304
  .subscribe((attempts) => {
290
- _retriesReached$.next();
305
+ var _a;
306
+ _retriesReached$.next(1);
291
307
  _retriesReached$.complete();
292
308
  // if attempts have been reached, we check "skipIfNotFound" to move on to the next step
293
- if (step.attachToOptions && step.attachToOptions.skipIfNotFound) {
309
+ if (step.attachToOptions &&
310
+ step.attachToOptions.skipIfNotFound) {
294
311
  // if we get to this step coming back from a step and it wasnt found
295
312
  // then we either check if its the first step and try going forward
296
313
  // or we keep going back until we find a step that actually exists
@@ -306,9 +323,9 @@ class CovalentGuidedTour extends TourButtonsActions {
306
323
  else {
307
324
  // destroys current step if we need to skip it to remove it from the tour
308
325
  const currentStep = this.shepherdTour.getCurrentStep();
309
- currentStep.destroy();
326
+ currentStep === null || currentStep === void 0 ? void 0 : currentStep.destroy();
310
327
  this.shepherdTour.next();
311
- this.shepherdTour.removeStep(currentStep.id);
328
+ this.shepherdTour.removeStep((_a = currentStep === null || currentStep === void 0 ? void 0 : currentStep.id) !== null && _a !== void 0 ? _a : '');
312
329
  }
313
330
  }
314
331
  else if (step.attachToOptions && step.attachToOptions.else) {
@@ -323,12 +340,14 @@ class CovalentGuidedTour extends TourButtonsActions {
323
340
  }
324
341
  });
325
342
  // we start a timer of attempts to find an element in the dom
326
- timer((step.attachToOptions && step.attachToOptions.timeBeforeShow) || SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW, (step.attachToOptions && step.attachToOptions.interval) || SHEPHERD_DEFAULT_FIND_INTERVAL)
343
+ timer((step.attachToOptions && step.attachToOptions.timeBeforeShow) ||
344
+ SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW, (step.attachToOptions && step.attachToOptions.interval) ||
345
+ SHEPHERD_DEFAULT_FIND_INTERVAL)
327
346
  .pipe(
328
347
  // the timer will continue either until we find the element or the number of attempts has been reached
329
348
  takeUntil(merge(_stopTimer$, _retriesReached$, destroyedEvent$)))
330
349
  .subscribe(() => {
331
- const element = document.querySelector(id);
350
+ const element = document.querySelector(id !== null && id !== void 0 ? id : '');
332
351
  // if the element has been found, we stop the timer and resolve the promise
333
352
  if (element) {
334
353
  _stopTimer$.next();
@@ -344,13 +363,14 @@ class CovalentGuidedTour extends TourButtonsActions {
344
363
  destroyedEvent$.subscribe(() => {
345
364
  _stopTimer$.next();
346
365
  _stopTimer$.complete();
347
- _retriesReached$.next();
366
+ _retriesReached$.next(1);
348
367
  _retriesReached$.complete();
349
368
  });
350
369
  }
351
370
  else {
352
371
  // resolve observable until the timeBeforeShow has passsed or use default
353
- timer((step.attachToOptions && step.attachToOptions.timeBeforeShow) || SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW)
372
+ timer((step.attachToOptions && step.attachToOptions.timeBeforeShow) ||
373
+ SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW)
354
374
  .pipe(takeUntil(merge(destroyedEvent$)))
355
375
  .subscribe(() => {
356
376
  resolve();
@@ -362,10 +382,13 @@ class CovalentGuidedTour extends TourButtonsActions {
362
382
  return steps;
363
383
  }
364
384
  _bindEvent(eventOn, eventOnOptions, event$, destroyedEvent$) {
365
- const selector = eventOn.selector;
385
+ var _a;
386
+ const selector = (_a = eventOn.selector) !== null && _a !== void 0 ? _a : '';
366
387
  const event = eventOn.event;
367
388
  // we start a timer of attempts to find an element in the dom
368
- const timerSubs = timer((eventOnOptions && eventOnOptions.timeBeforeShow) || SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW, (eventOnOptions && eventOnOptions.interval) || SHEPHERD_DEFAULT_FIND_INTERVAL)
389
+ const timerSubs = timer((eventOnOptions && eventOnOptions.timeBeforeShow) ||
390
+ SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW, (eventOnOptions && eventOnOptions.interval) ||
391
+ SHEPHERD_DEFAULT_FIND_INTERVAL)
369
392
  .pipe(takeUntil(destroyedEvent$))
370
393
  .subscribe(() => {
371
394
  const element = document.querySelector(selector);
@@ -379,10 +402,10 @@ class CovalentGuidedTour extends TourButtonsActions {
379
402
  }
380
403
  else if (event === ITourEvent.click ||
381
404
  event === ITourEvent.pointerover ||
382
- event.indexOf(ITourEvent.keyup) > -1) {
405
+ (event && event.indexOf(ITourEvent.keyup) > -1)) {
383
406
  // we use normal listeners for mouseevents
384
- const mainEvent = event.split('.')[0];
385
- const subEvent = event.split('.')[1];
407
+ const mainEvent = event === null || event === void 0 ? void 0 : event.split('.')[0];
408
+ const subEvent = event === null || event === void 0 ? void 0 : event.split('.')[1];
386
409
  fromEvent(element, mainEvent)
387
410
  .pipe(takeUntil(merge(event$.asObservable(), destroyedEvent$)), filter(($event) => {
388
411
  // only trigger if the event is a keyboard event and part of out list
@@ -415,7 +438,11 @@ class CovalentGuidedTour extends TourButtonsActions {
415
438
  observer.disconnect();
416
439
  });
417
440
  // observe for any DOM interaction in the element
418
- observer.observe(element, { childList: true, subtree: true, attributes: true });
441
+ observer.observe(element, {
442
+ childList: true,
443
+ subtree: true,
444
+ attributes: true,
445
+ });
419
446
  }
420
447
  }
421
448
  });
@@ -444,9 +471,10 @@ class CovalentGuidedTourService extends CovalentGuidedTour {
444
471
  this._toursMap = new Map();
445
472
  this._tourStepURLs = new Map();
446
473
  _router.events
447
- .pipe(filter((event) => event instanceof NavigationStart && event.navigationTrigger === 'popstate'))
448
- .subscribe((event) => {
449
- if (this.shepherdTour.isActive) {
474
+ .pipe(filter((event) => event instanceof NavigationStart &&
475
+ event.navigationTrigger === 'popstate'))
476
+ .subscribe(() => {
477
+ if (this.shepherdTour.isActive()) {
450
478
  this.shepherdTour.cancel();
451
479
  }
452
480
  });
@@ -492,6 +520,7 @@ class CovalentGuidedTourService extends CovalentGuidedTour {
492
520
  else {
493
521
  // tslint:disable-next-line:no-console
494
522
  console.warn(`Tour ${tourName} does not exist. Please try another tour.`);
523
+ return undefined;
495
524
  }
496
525
  }
497
526
  // Finds the right registered tour by using queryParams
@@ -506,7 +535,10 @@ class CovalentGuidedTourService extends CovalentGuidedTour {
506
535
  // delete tour queryParam
507
536
  searchParams.delete(queryParam);
508
537
  // build new URL string without it
509
- let url = window.location.protocol + '//' + window.location.host + window.location.pathname;
538
+ let url = window.location.protocol +
539
+ '//' +
540
+ window.location.host +
541
+ window.location.pathname;
510
542
  if (searchParams.toString()) {
511
543
  url += '?' + searchParams.toString();
512
544
  }
@@ -516,14 +548,16 @@ class CovalentGuidedTourService extends CovalentGuidedTour {
516
548
  }));
517
549
  }
518
550
  setNextBtnDisability(stepId, isDisabled) {
551
+ var _a, _b;
519
552
  if (this.shepherdTour.getById(stepId)) {
520
- const stepOptions = this.shepherdTour.getById(stepId).options;
521
- stepOptions.buttons.forEach((button) => {
553
+ const stepOptions = this.shepherdTour.getById(stepId)
554
+ .options;
555
+ (_a = stepOptions.buttons) === null || _a === void 0 ? void 0 : _a.forEach((button) => {
522
556
  if (button.text === 'chevron_right') {
523
557
  button.disabled = isDisabled;
524
558
  }
525
559
  });
526
- this.shepherdTour.getById(stepId).updateStepOptions(stepOptions);
560
+ (_b = this.shepherdTour.getById(stepId)) === null || _b === void 0 ? void 0 : _b.updateStepOptions(stepOptions);
527
561
  }
528
562
  }
529
563
  _loadTour(tourUrl) {
@@ -552,7 +586,10 @@ class CovalentGuidedTourService extends CovalentGuidedTour {
552
586
  if (step.beforeShowPromise) {
553
587
  const beforeShowPromise = step.beforeShowPromise;
554
588
  step.beforeShowPromise = () => {
555
- return this._router.navigate([route], step.routing.extras).then(() => {
589
+ var _a;
590
+ return this._router
591
+ .navigate([route], (_a = step.routing) === null || _a === void 0 ? void 0 : _a.extras)
592
+ .then(() => {
556
593
  return beforeShowPromise();
557
594
  });
558
595
  };
@@ -565,21 +602,18 @@ class CovalentGuidedTourService extends CovalentGuidedTour {
565
602
  return routedSteps;
566
603
  }
567
604
  }
568
- /** @nocollapse */ /** @nocollapse */ CovalentGuidedTourService.ɵfac = function CovalentGuidedTourService_Factory(t) { return new (t || CovalentGuidedTourService)(i0.ɵɵinject(i1.Router), i0.ɵɵinject(i1.ActivatedRoute), i0.ɵɵinject(i2.HttpClient)); };
569
- /** @nocollapse */ /** @nocollapse */ CovalentGuidedTourService.ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: CovalentGuidedTourService, factory: CovalentGuidedTourService.ɵfac });
570
- (function () {
571
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CovalentGuidedTourService, [{
605
+ CovalentGuidedTourService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentGuidedTourService, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: i2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
606
+ CovalentGuidedTourService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentGuidedTourService });
607
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentGuidedTourService, decorators: [{
572
608
  type: Injectable
573
- }], function () { return [{ type: i1.Router }, { type: i1.ActivatedRoute }, { type: i2.HttpClient }]; }, null);
574
- })();
609
+ }], ctorParameters: function () { return [{ type: i1.Router }, { type: i1.ActivatedRoute }, { type: i2.HttpClient }]; } });
575
610
 
576
611
  class CovalentGuidedTourModule {
577
612
  }
578
- /** @nocollapse */ /** @nocollapse */ CovalentGuidedTourModule.ɵfac = function CovalentGuidedTourModule_Factory(t) { return new (t || CovalentGuidedTourModule)(); };
579
- /** @nocollapse */ /** @nocollapse */ CovalentGuidedTourModule.ɵmod = /** @pureOrBreakMyCode */ i0.ɵɵdefineNgModule({ type: CovalentGuidedTourModule });
580
- /** @nocollapse */ /** @nocollapse */ CovalentGuidedTourModule.ɵinj = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjector({ providers: [CovalentGuidedTourService], imports: [[CommonModule]] });
581
- (function () {
582
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CovalentGuidedTourModule, [{
613
+ CovalentGuidedTourModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentGuidedTourModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
614
+ CovalentGuidedTourModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentGuidedTourModule, imports: [CommonModule] });
615
+ CovalentGuidedTourModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentGuidedTourModule, providers: [CovalentGuidedTourService], imports: [[CommonModule]] });
616
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentGuidedTourModule, decorators: [{
583
617
  type: NgModule,
584
618
  args: [{
585
619
  imports: [CommonModule],
@@ -587,9 +621,7 @@ class CovalentGuidedTourModule {
587
621
  declarations: [],
588
622
  exports: [],
589
623
  }]
590
- }], null, null);
591
- })();
592
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(CovalentGuidedTourModule, { imports: [CommonModule] }); })();
624
+ }] });
593
625
 
594
626
  /**
595
627
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"covalent-guided-tour.mjs","sources":["../../../../src/platform/guided-tour/guided.tour.ts","../../../../src/platform/guided-tour/guided-tour.service.ts","../../../../src/platform/guided-tour/guided-tour.module.ts","../../../../src/platform/guided-tour/covalent-guided-tour.ts"],"sourcesContent":["import Shepherd from 'shepherd.js';\nimport { timer, Subject, BehaviorSubject, merge, Subscription, fromEvent, forkJoin } from 'rxjs';\nimport { takeUntil, skipWhile, filter, skip, first } from 'rxjs/operators';\n\nexport type TourStep = Shepherd.Step.StepOptions;\nexport type TourStepButton = Shepherd.Step.StepOptionsButton;\n\nexport enum ITourEvent {\n 'click' = 'click',\n 'pointerover' = 'pointerover',\n 'keyup' = 'keyup',\n 'added' = 'added', // added to DOM\n 'removed' = 'removed', // removed from DOM\n}\n\nexport interface ITourEventOn {\n selector?: string; // css selector\n event?: keyof typeof ITourEvent; // click, pointerover, keyup, added, removed\n}\n\nexport interface ITourEventOnOptions {\n timeBeforeShow?: number; // delay before step is displayed\n interval?: number; // time between searches for element, defaults to 500ms\n}\n\nexport interface ITourAbortOn extends ITourEventOn {}\n\nexport interface ITourOptions extends Shepherd.Tour.TourOptions {\n abortOn?: ITourAbortOn[]; // events to abort on\n}\n\nexport interface ITourStepAttachToOptions extends ITourEventOnOptions {\n highlight?: boolean;\n retries?: number; // # num of attempts to find element\n skipIfNotFound?: boolean; // if element is not found after n retries, move on to next step\n else?: string; // if element is not found, go to step with this id\n goBackTo?: string; // back button goes back to step with this id\n skipFromStepCount?: boolean; // show/hide progress on step\n}\n\nexport interface ITourStepAdvanceOn extends ITourEventOn {}\n\nexport interface ITourStepAdvanceOnOptions extends ITourEventOnOptions {\n jumpTo?: string; // next button will jump to step with this id\n allowGoBack?: boolean; // allow back within this step\n}\n\nexport interface ITourStep extends TourStep {\n attachToOptions?: ITourStepAttachToOptions;\n advanceOnOptions?: ITourStepAdvanceOnOptions;\n advanceOn?: ITourStepAdvanceOn[] | ITourStepAdvanceOn | any;\n abortOn?: ITourAbortOn[];\n count?: number;\n}\n\nabstract class TourButtonsActions {\n abstract next(): void;\n\n abstract back(): void;\n\n abstract cancel(): void;\n\n abstract finish(): void;\n}\n\nconst SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW: number = 100;\nconst SHEPHERD_DEFAULT_FIND_INTERVAL: number = 500;\nconst SHEPHERD_DEFAULT_FIND_ATTEMPTS: number = 20;\n\nconst overriddenEvents: string[] = [\n ITourEvent.click,\n ITourEvent.pointerover,\n ITourEvent.removed,\n ITourEvent.added,\n ITourEvent.keyup,\n];\n\nconst keyEvents: Map<number, string> = new Map<number, string>([\n [13, 'enter'],\n [27, 'esc'],\n]);\n\nconst defaultStepOptions: TourStep = {\n scrollTo: { behavior: 'smooth', block: 'center' },\n cancelIcon: {\n enabled: true,\n },\n};\n\nconst MAT_ICON_BUTTON: string = 'mat-icon-button material-icons mat-button-base';\nconst MAT_BUTTON: string = 'mat-button-base mat-button';\nconst MAT_BUTTON_INVISIBLE: string = 'shepherd-void-button';\n\nexport class CovalentGuidedTour extends TourButtonsActions {\n private _destroyedEvent$: Subject<void>;\n\n shepherdTour: Shepherd.Tour;\n stepOptions: ITourStep;\n\n constructor(stepOptions: ITourStep = defaultStepOptions) {\n super();\n\n this.stepOptions = stepOptions;\n this.newTour();\n }\n\n newTour(opts?: ITourOptions): void {\n this.shepherdTour = new Shepherd.Tour(\n Object.assign(\n {\n defaultStepOptions: this.stepOptions,\n },\n opts,\n ),\n );\n\n this._destroyedEvent$ = new Subject<void>();\n // listen to cancel and complete to clean up abortOn events\n merge(fromEvent(this.shepherdTour, 'cancel'), fromEvent(this.shepherdTour, 'complete'))\n .pipe(first())\n .subscribe(() => {\n this._destroyedEvent$.next();\n this._destroyedEvent$.complete();\n });\n\n // if abortOn was passed, we bind the event and execute complete\n if (opts && opts.abortOn) {\n const abortArr$: Subject<void>[] = [];\n opts.abortOn.forEach((abortOn: ITourAbortOn) => {\n const abortEvent$: Subject<void> = new Subject<void>();\n abortArr$.push(abortEvent$);\n this._bindEvent(abortOn, undefined, abortEvent$, this._destroyedEvent$);\n });\n\n const abortSubs: Subscription = merge(...abortArr$)\n .pipe(takeUntil(this._destroyedEvent$))\n .subscribe(() => {\n this.shepherdTour.complete();\n abortSubs.unsubscribe();\n });\n }\n }\n\n back(): void {\n this.shepherdTour.back();\n }\n\n cancel(): void {\n this.shepherdTour.cancel();\n }\n\n next(): void {\n this.shepherdTour.next();\n }\n\n finish(): void {\n this.shepherdTour.complete();\n }\n\n addSteps(steps: ITourStep[]): void {\n this.shepherdTour.addSteps(this._prepareTour(steps));\n }\n\n start(): void {\n this.shepherdTour.start();\n }\n\n protected _prepareTour(originalSteps: ITourStep[], finishLabel: string = 'finish'): ITourStep[] {\n // create Subjects for back and forward events\n const backEvent$: Subject<void> = new Subject<void>();\n const forwardEvent$: Subject<void> = new Subject<void>();\n let _backFlow: boolean = false;\n // create Subject for your end\n const destroyedEvent$: Subject<void> = new Subject<void>();\n /**\n * This function adds the step progress in the footer of the shepherd tooltip\n */\n const appendProgressFunc: Function = function (): void {\n // get all the footers that are available in the DOM\n const footers: Element[] = Array.from<Element>(document.querySelectorAll('.shepherd-footer'));\n // get the last footer since Shepherd always puts the active one at the end\n const footer: Element = footers[footers.length - 1];\n // generate steps html element\n const progress: HTMLSpanElement = document.createElement('span');\n progress.className = 'shepherd-progress';\n progress.innerText = `${this.shepherdTour.currentStep.options.count}/${stepTotal}`;\n // insert into the footer before the first button\n footer.insertBefore(progress, footer.querySelector('.shepherd-button'));\n };\n\n let stepTotal: number = 0;\n const steps: ITourStep[] = originalSteps.map((step: ITourStep) => {\n let showProgress: Function;\n if (step.attachToOptions?.skipFromStepCount === true) {\n showProgress = function (): void {\n return;\n };\n } else if (\n step.attachToOptions?.skipFromStepCount === undefined ||\n step.attachToOptions?.skipFromStepCount === false\n ) {\n step.count = ++stepTotal;\n showProgress = appendProgressFunc.bind(this);\n }\n return Object.assign({}, step, {\n when: {\n show: showProgress,\n },\n });\n });\n\n const finishButton: TourStepButton = {\n text: finishLabel,\n action: this['finish'].bind(this),\n classes: MAT_BUTTON,\n };\n\n const voidButton: TourStepButton = {\n text: '',\n action(): void {\n return;\n },\n classes: MAT_BUTTON_INVISIBLE,\n };\n\n // listen to the destroyed event to clean up all the streams\n this._destroyedEvent$.pipe(first()).subscribe(() => {\n backEvent$.complete();\n forwardEvent$.complete();\n destroyedEvent$.next();\n destroyedEvent$.complete();\n });\n\n const totalSteps: number = steps.length;\n steps.forEach((step: ITourStep, index: number) => {\n // create buttons specific for the step\n // this is done to create more control on events\n const nextButton: TourStepButton = {\n text: 'chevron_right',\n action: () => {\n // intercept the next action and trigger event\n forwardEvent$.next();\n this.shepherdTour.next();\n },\n classes: MAT_ICON_BUTTON,\n };\n const backButton: TourStepButton = {\n text: 'chevron_left',\n action: () => {\n // intercept the back action and trigger event\n backEvent$.next();\n _backFlow = true;\n // check if 'goBackTo' is set to jump to a particular step, else just go back\n if (step.attachToOptions && step.attachToOptions.goBackTo) {\n this.shepherdTour.show(step.attachToOptions.goBackTo, false);\n } else {\n this.shepherdTour.back();\n }\n },\n classes: step.advanceOnOptions?.allowGoBack === false ? MAT_BUTTON_INVISIBLE : MAT_ICON_BUTTON,\n };\n\n // check if highlight was provided for the step, else fallback into shepherds usage\n step.highlightClass =\n step.attachToOptions && step.attachToOptions.highlight ? 'shepherd-highlight' : step.highlightClass;\n\n // Adding buttons in the steps if no buttons are defined\n if (!step.buttons || step.buttons.length === 0) {\n if (index === 0) {\n // first step\n step.buttons = [nextButton];\n } else if (index === totalSteps - 1) {\n // last step\n step.buttons = [backButton, finishButton];\n } else {\n step.buttons = [backButton, nextButton];\n }\n }\n\n // checks \"advanceOn\" to override listeners\n let advanceOn: ITourStepAdvanceOn[] | ITourStepAdvanceOn = step.advanceOn;\n // remove the shepherd \"advanceOn\" infavor of ours if the event is part of our list\n if (\n (typeof advanceOn === 'object' &&\n !Array.isArray(advanceOn) &&\n overriddenEvents.indexOf(advanceOn.event.split('.')[0]) > -1) ||\n advanceOn instanceof Array\n ) {\n step.advanceOn = undefined;\n step.buttons =\n step.advanceOnOptions && step.advanceOnOptions.allowGoBack ? [backButton, voidButton] : [voidButton];\n }\n // adds a default beforeShowPromise function\n step.beforeShowPromise = () => {\n return new Promise((resolve: (value?: any) => void) => {\n const additionalCapabilitiesSetup: Function = () => {\n if (advanceOn && !step.advanceOn) {\n if (!Array.isArray(advanceOn)) {\n advanceOn = [advanceOn];\n }\n\n const advanceArr$: Subject<void>[] = [];\n advanceOn.forEach((_: any, i: number) => {\n const advanceEvent$: Subject<void> = new Subject<void>();\n advanceArr$.push(advanceEvent$);\n // we start a timer of attempts to find an element in the dom\n this._bindEvent(advanceOn[i], step.advanceOnOptions, advanceEvent$, destroyedEvent$);\n });\n const advanceSubs: Subscription = forkJoin(...advanceArr$)\n .pipe(takeUntil(merge(destroyedEvent$, backEvent$)))\n .subscribe(() => {\n // check if we need to advance to a specific step, else advance to next step\n if (step.advanceOnOptions && step.advanceOnOptions.jumpTo) {\n this.shepherdTour.show(step.advanceOnOptions.jumpTo);\n } else {\n this.shepherdTour.next();\n }\n forwardEvent$.next();\n advanceSubs.unsubscribe();\n });\n }\n\n // if abortOn was passed on the step, we bind the event and execute complete\n if (step.abortOn) {\n const abortArr$: Subject<void>[] = [];\n step.abortOn.forEach((abortOn: ITourAbortOn) => {\n const abortEvent$: Subject<void> = new Subject<void>();\n abortArr$.push(abortEvent$);\n this._bindEvent(abortOn, undefined, abortEvent$, destroyedEvent$);\n });\n\n const abortSubs: Subscription = merge(...abortArr$)\n .pipe(takeUntil(merge(destroyedEvent$, backEvent$, forwardEvent$)))\n .subscribe(() => {\n this.shepherdTour.complete();\n abortSubs.unsubscribe();\n });\n }\n };\n\n const _stopTimer$: Subject<void> = new Subject<void>();\n const _retriesReached$: Subject<number> = new Subject<number>();\n const _retryAttempts$: BehaviorSubject<number> = new BehaviorSubject<number>(-1);\n\n let id: string;\n // checks if \"attachTo\" is a string or an object to get the id of an element\n if (typeof step.attachTo === 'string') {\n id = step.attachTo;\n } else if (typeof step.attachTo === 'object' && typeof step.attachTo.element === 'string') {\n id = step.attachTo.element;\n }\n // if we have an id as a string in either case, we use it (we ignore it if its HTMLElement)\n if (id) {\n // if current step is the first step of the tour, we set the buttons to be only \"next\"\n // we had to use `any` since the tour doesnt expose the steps in any fashion nor a way to check if we have modified them at all\n if (this.shepherdTour.getCurrentStep() === (<any>this.shepherdTour).steps[0]) {\n this.shepherdTour.getCurrentStep().updateStepOptions({\n buttons: originalSteps[index].advanceOn ? [voidButton] : [nextButton],\n });\n }\n // register to the attempts observable to notify deeveloper when number has been reached\n _retryAttempts$\n .pipe(\n skip(1),\n takeUntil(merge(_stopTimer$.asObservable(), destroyedEvent$)),\n skipWhile((val: number) => {\n if (step.attachToOptions && step.attachToOptions.retries !== undefined) {\n return val < step.attachToOptions.retries;\n }\n return val < SHEPHERD_DEFAULT_FIND_ATTEMPTS;\n }),\n )\n .subscribe((attempts: number) => {\n _retriesReached$.next();\n _retriesReached$.complete();\n // if attempts have been reached, we check \"skipIfNotFound\" to move on to the next step\n if (step.attachToOptions && step.attachToOptions.skipIfNotFound) {\n // if we get to this step coming back from a step and it wasnt found\n // then we either check if its the first step and try going forward\n // or we keep going back until we find a step that actually exists\n if (_backFlow) {\n if ((<any>this.shepherdTour).steps.indexOf(this.shepherdTour.getCurrentStep()) === 0) {\n this.shepherdTour.next();\n } else {\n this.shepherdTour.back();\n }\n _backFlow = false;\n } else {\n // destroys current step if we need to skip it to remove it from the tour\n const currentStep: Shepherd.Step = this.shepherdTour.getCurrentStep();\n currentStep.destroy();\n this.shepherdTour.next();\n this.shepherdTour.removeStep((<Shepherd.Step.StepOptions>currentStep).id);\n }\n } else if (step.attachToOptions && step.attachToOptions.else) {\n // if \"skipIfNotFound\" is not true, then we check if \"else\" has been set to jump to a specific step\n this.shepherdTour.show(step.attachToOptions.else);\n } else {\n // tslint:disable-next-line:no-console\n console.warn(`Retries reached trying to find ${id}. Retried ${attempts} times.`);\n // else we show the step regardless\n resolve();\n }\n });\n\n // we start a timer of attempts to find an element in the dom\n timer(\n (step.attachToOptions && step.attachToOptions.timeBeforeShow) || SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW,\n (step.attachToOptions && step.attachToOptions.interval) || SHEPHERD_DEFAULT_FIND_INTERVAL,\n )\n .pipe(\n // the timer will continue either until we find the element or the number of attempts has been reached\n takeUntil(merge(_stopTimer$, _retriesReached$, destroyedEvent$)),\n )\n .subscribe(() => {\n const element: HTMLElement = document.querySelector(id);\n // if the element has been found, we stop the timer and resolve the promise\n if (element) {\n _stopTimer$.next();\n _stopTimer$.complete();\n additionalCapabilitiesSetup();\n resolve();\n } else {\n _retryAttempts$.next(_retryAttempts$.value + 1);\n }\n });\n\n // stop find interval if user stops the tour\n destroyedEvent$.subscribe(() => {\n _stopTimer$.next();\n _stopTimer$.complete();\n _retriesReached$.next();\n _retriesReached$.complete();\n });\n } else {\n // resolve observable until the timeBeforeShow has passsed or use default\n timer(\n (step.attachToOptions && step.attachToOptions.timeBeforeShow) || SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW,\n )\n .pipe(takeUntil(merge(destroyedEvent$)))\n .subscribe(() => {\n resolve();\n });\n }\n });\n };\n });\n return steps;\n }\n\n private _bindEvent(\n eventOn: ITourEventOn,\n eventOnOptions: ITourEventOnOptions,\n event$: Subject<void>,\n destroyedEvent$: Subject<void>,\n ): void {\n const selector: string = eventOn.selector;\n const event: string = eventOn.event;\n // we start a timer of attempts to find an element in the dom\n const timerSubs: Subscription = timer(\n (eventOnOptions && eventOnOptions.timeBeforeShow) || SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW,\n (eventOnOptions && eventOnOptions.interval) || SHEPHERD_DEFAULT_FIND_INTERVAL,\n )\n .pipe(takeUntil(destroyedEvent$))\n .subscribe(() => {\n const element: HTMLElement = document.querySelector(selector);\n // if the element has been found, we stop the timer and resolve the promise\n if (element) {\n timerSubs.unsubscribe();\n\n if (event === ITourEvent.added) {\n // if event is \"Added\" trigger a soon as this is attached.\n event$.next();\n event$.complete();\n } else if (\n event === ITourEvent.click ||\n event === ITourEvent.pointerover ||\n event.indexOf(ITourEvent.keyup) > -1\n ) {\n // we use normal listeners for mouseevents\n const mainEvent: string = event.split('.')[0];\n const subEvent: string = event.split('.')[1];\n fromEvent(element, mainEvent)\n .pipe(\n takeUntil(merge(event$.asObservable(), destroyedEvent$)),\n filter(($event: Event) => {\n // only trigger if the event is a keyboard event and part of out list\n if ($event instanceof KeyboardEvent) {\n if (keyEvents.get($event.keyCode) === subEvent) {\n return true;\n }\n return false;\n } else {\n return true;\n }\n }),\n )\n .subscribe(() => {\n event$.next();\n event$.complete();\n });\n } else if (event === ITourEvent.removed) {\n // and we will use MutationObserver for DOM events\n const observer: MutationObserver = new MutationObserver(() => {\n if (!document.body.contains(element)) {\n event$.next();\n event$.complete();\n observer.disconnect();\n }\n });\n\n // stop listenining if tour is closed\n destroyedEvent$.subscribe(() => {\n observer.disconnect();\n });\n // observe for any DOM interaction in the element\n observer.observe(element, { childList: true, subtree: true, attributes: true });\n }\n }\n });\n }\n}\n","import { Injectable } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport {\n Router,\n ActivatedRoute,\n ParamMap,\n NavigationExtras,\n NavigationStart,\n Event as NavigationEvent,\n} from '@angular/router';\nimport Shepherd from 'shepherd.js';\nimport { tap, map, filter } from 'rxjs/operators';\nimport { Observable, fromEvent } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\nimport { CovalentGuidedTour, ITourStep, ITourOptions, TourStepButton } from './guided.tour';\n\nexport interface IGuidedTour extends ITourOptions {\n steps: IGuidedTourStep[];\n finishButtonText?: string;\n}\n\nexport interface IGuidedTourStep extends ITourStep {\n routing?: {\n route: string;\n extras?: NavigationExtras;\n };\n}\n\n/**\n * Router enabled Shepherd tour\n */\nexport enum TourEvents {\n complete = 'complete',\n cancel = 'cancel',\n hide = 'hide',\n show = 'show',\n start = 'start',\n active = 'active',\n inactive = 'inactive',\n}\n\nexport interface IGuidedTourEvent {\n step: any;\n previous: any;\n tour: any;\n}\n\n@Injectable()\nexport class CovalentGuidedTourService extends CovalentGuidedTour {\n private _toursMap: Map<string, IGuidedTour> = new Map<string, IGuidedTour>();\n private _tourStepURLs: Map<string, string> = new Map<string, string>();\n constructor(private _router: Router, private _route: ActivatedRoute, private _httpClient: HttpClient) {\n super();\n _router.events\n .pipe(\n filter((event: NavigationEvent) => event instanceof NavigationStart && event.navigationTrigger === 'popstate'),\n )\n .subscribe((event: NavigationEvent) => {\n if (this.shepherdTour.isActive) {\n this.shepherdTour.cancel();\n }\n });\n }\n\n tourEvent$(str: TourEvents): Observable<IGuidedTourEvent> {\n return fromEvent(this.shepherdTour, str);\n }\n\n async registerTour(tourName: string, tour: IGuidedTour | string): Promise<void> {\n const guidedTour: IGuidedTour = typeof tour === 'string' ? await this._loadTour(tour) : tour;\n this._toursMap.set(tourName, guidedTour);\n }\n\n startTour(tourName: string): Shepherd.Tour {\n const guidedTour: IGuidedTour = this._getTour(tourName);\n this.finish();\n if (guidedTour && guidedTour.steps && guidedTour.steps.length) {\n // remove steps from tour since we need to preprocess them first\n this.newTour(Object.assign({}, guidedTour, { steps: undefined }));\n const tourInstance: Shepherd.Tour = this.shepherdTour.addSteps(\n this._configureRoutesForSteps(this._prepareTour(guidedTour.steps, guidedTour.finishButtonText)),\n );\n // init route transition if step URL is different then the current location.\n this.tourEvent$(TourEvents.show).subscribe((tourEvent: IGuidedTourEvent) => {\n const currentURL: string = this._router.url.split(/[?#]/)[0];\n const {\n step: { id, options },\n } = tourEvent;\n if (this._tourStepURLs.has(id)) {\n const stepRoute: string = this._tourStepURLs.get(id);\n if (stepRoute !== currentURL) {\n this._router.navigate([stepRoute]);\n }\n } else {\n if (options && options.routing) {\n this._tourStepURLs.set(id, options.routing.route);\n } else {\n this._tourStepURLs.set(id, currentURL);\n }\n }\n });\n this.start();\n return tourInstance;\n } else {\n // tslint:disable-next-line:no-console\n console.warn(`Tour ${tourName} does not exist. Please try another tour.`);\n }\n }\n\n // Finds the right registered tour by using queryParams\n // finishes any other tour and starts the new one.\n initializeOnQueryParams(queryParam: string = 'tour'): Observable<ParamMap> {\n return this._route.queryParamMap.pipe(\n debounceTime(100),\n tap((params: ParamMap) => {\n const tourParam: string = params.get(queryParam);\n if (tourParam) {\n this.startTour(tourParam);\n // get current search parameters\n const searchParams: URLSearchParams = new URLSearchParams(window.location.search);\n // delete tour queryParam\n searchParams.delete(queryParam);\n // build new URL string without it\n let url: string = window.location.protocol + '//' + window.location.host + window.location.pathname;\n if (searchParams.toString()) {\n url += '?' + searchParams.toString();\n }\n // replace state in history without triggering a navigation\n window.history.replaceState({ path: url }, '', url);\n }\n }),\n );\n }\n\n setNextBtnDisability(stepId: string, isDisabled: boolean): void {\n if (this.shepherdTour.getById(stepId)) {\n const stepOptions: ITourStep = (this.shepherdTour.getById(stepId) as any).options;\n stepOptions.buttons.forEach((button: TourStepButton) => {\n if (button.text === 'chevron_right') {\n button.disabled = isDisabled;\n }\n });\n this.shepherdTour.getById(stepId).updateStepOptions(stepOptions);\n }\n }\n\n private async _loadTour(tourUrl: string): Promise<any> {\n const request: Observable<object> = this._httpClient.get(tourUrl);\n try {\n return await request\n .pipe(\n map((resultSet: any) => {\n return JSON.parse(JSON.stringify(resultSet));\n }),\n )\n .toPromise();\n } catch {\n return undefined;\n }\n }\n\n private _getTour(key: string): IGuidedTour {\n return this._toursMap.get(key);\n }\n\n private _configureRoutesForSteps(routedSteps: IGuidedTourStep[]): IGuidedTourStep[] {\n routedSteps.forEach((step: IGuidedTourStep) => {\n if (step.routing) {\n const route: string = step.routing.route;\n // if there is a beforeShowPromise, then we save it and call it after the navigation\n if (step.beforeShowPromise) {\n const beforeShowPromise: () => Promise<void> = step.beforeShowPromise;\n step.beforeShowPromise = () => {\n return this._router.navigate([route], step.routing.extras).then(() => {\n return beforeShowPromise();\n });\n };\n } else {\n step.beforeShowPromise = () => this._router.navigate([route]);\n }\n }\n });\n\n return routedSteps;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { CovalentGuidedTourService } from './guided-tour.service';\n\n@NgModule({\n imports: [CommonModule],\n providers: [CovalentGuidedTourService],\n declarations: [],\n exports: [],\n})\nexport class CovalentGuidedTourModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;IAOY;AAAZ,WAAY,UAAU;IACpB,6BAAiB,CAAA;IACjB,yCAA6B,CAAA;IAC7B,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;AACvB,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AA0CD,MAAe,kBAAkB;CAQhC;AAED,MAAM,sCAAsC,GAAW,GAAG,CAAC;AAC3D,MAAM,8BAA8B,GAAW,GAAG,CAAC;AACnD,MAAM,8BAA8B,GAAW,EAAE,CAAC;AAElD,MAAM,gBAAgB,GAAa;IACjC,UAAU,CAAC,KAAK;IAChB,UAAU,CAAC,WAAW;IACtB,UAAU,CAAC,OAAO;IAClB,UAAU,CAAC,KAAK;IAChB,UAAU,CAAC,KAAK;CACjB,CAAC;AAEF,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAiB;IAC7D,CAAC,EAAE,EAAE,OAAO,CAAC;IACb,CAAC,EAAE,EAAE,KAAK,CAAC;CACZ,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAa;IACnC,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACjD,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;KACd;CACF,CAAC;AAEF,MAAM,eAAe,GAAW,gDAAgD,CAAC;AACjF,MAAM,UAAU,GAAW,4BAA4B,CAAC;AACxD,MAAM,oBAAoB,GAAW,sBAAsB,CAAC;MAE/C,2BAA2B,kBAAkB;IAMxD,YAAY,cAAyB,kBAAkB;QACrD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,EAA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,CAAC,OAAO,CAAC,KAAK,CAAC;;gBAEzC,IAAI,IAAI,CAAC,iBAAiB,EAAE;oBAC1B,MAAM,iBAAiB,GAAwB,IAAI,CAAC,iBAAiB,CAAC;oBACtE,IAAI,CAAC,iBAAiB,GAAG;wBACvB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;4BAC9D,OAAO,iBAAiB,EAAE,CAAC;yBAC5B,CAAC,CAAC;qBACJ,CAAC;iBACH;qBAAM;oBACL,IAAI,CAAC,iBAAiB,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;iBAC/D;aACF;SACF,CAAC,CAAC;QAEH,OAAO,WAAW,CAAC;KACpB;;wIAxIU,yBAAyB;iIAAzB,yBAAyB,WAAzB,yBAAyB;;4EAAzB,yBAAyB;kBADrC,UAAU;;;;MCrCE,wBAAwB;;sIAAxB,wBAAwB;4HAAxB,wBAAwB;iIAJxB,CAAC,yBAAyB,CAAC,YAD7B,CAAC,YAAY,CAAC;;4EAKZ,wBAAwB;kBANpC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,SAAS,EAAE,CAAC,yBAAyB,CAAC;oBACtC,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,EAAE;iBACZ;;;wFACY,wBAAwB,cALzB,YAAY;;ACLxB;;;;;;"}
1
+ {"version":3,"file":"covalent-guided-tour.mjs","sources":["../../../../libs/angular-guided-tour/src/lib/guided.tour.ts","../../../../libs/angular-guided-tour/src/lib/guided-tour.service.ts","../../../../libs/angular-guided-tour/src/lib/guided-tour.module.ts","../../../../libs/angular-guided-tour/src/covalent-guided-tour.ts"],"sourcesContent":["import Shepherd from 'shepherd.js';\nimport {\n timer,\n Subject,\n BehaviorSubject,\n merge,\n Subscription,\n fromEvent,\n forkJoin,\n} from 'rxjs';\nimport { takeUntil, skipWhile, filter, skip, first } from 'rxjs/operators';\n\nexport type TourStep = Shepherd.Step.StepOptions;\nexport type TourStepButton = Shepherd.Step.StepOptionsButton;\n\nexport enum ITourEvent {\n 'click' = 'click',\n 'pointerover' = 'pointerover',\n 'keyup' = 'keyup',\n 'added' = 'added', // added to DOM\n 'removed' = 'removed', // removed from DOM\n}\n\nexport interface ITourEventOn {\n selector?: string; // css selector\n event?: keyof typeof ITourEvent; // click, pointerover, keyup, added, removed\n}\n\nexport interface ITourEventOnOptions {\n timeBeforeShow?: number; // delay before step is displayed\n interval?: number; // time between searches for element, defaults to 500ms\n}\n\nexport interface ITourOptions extends Shepherd.Tour.TourOptions {\n abortOn?: ITourEventOn[]; // events to abort on\n}\n\nexport interface ITourStepAttachToOptions extends ITourEventOnOptions {\n highlight?: boolean;\n retries?: number; // # num of attempts to find element\n skipIfNotFound?: boolean; // if element is not found after n retries, move on to next step\n else?: string; // if element is not found, go to step with this id\n goBackTo?: string; // back button goes back to step with this id\n skipFromStepCount?: boolean; // show/hide progress on step\n}\n\nexport interface ITourStepAdvanceOnOptions extends ITourEventOnOptions {\n jumpTo?: string; // next button will jump to step with this id\n allowGoBack?: boolean; // allow back within this step\n}\n\nexport interface ITourStep extends TourStep {\n attachToOptions?: ITourStepAttachToOptions;\n advanceOnOptions?: ITourStepAdvanceOnOptions;\n advanceOn?: ITourEventOn[] | ITourEventOn | any;\n abortOn?: ITourEventOn[];\n count?: number;\n}\n\nabstract class TourButtonsActions {\n abstract next(): void;\n\n abstract back(): void;\n\n abstract cancel(): void;\n\n abstract finish(): void;\n}\n\nconst SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW = 100;\nconst SHEPHERD_DEFAULT_FIND_INTERVAL = 500;\nconst SHEPHERD_DEFAULT_FIND_ATTEMPTS = 20;\n\nconst overriddenEvents: string[] = [\n ITourEvent.click,\n ITourEvent.pointerover,\n ITourEvent.removed,\n ITourEvent.added,\n ITourEvent.keyup,\n];\n\nconst keyEvents: Map<number, string> = new Map<number, string>([\n [13, 'enter'],\n [27, 'esc'],\n]);\n\nconst defaultStepOptions: TourStep = {\n scrollTo: { behavior: 'smooth', block: 'center' },\n cancelIcon: {\n enabled: true,\n },\n};\n\nconst MAT_ICON_BUTTON = 'mat-icon-button material-icons mat-button-base';\nconst MAT_BUTTON = 'mat-button-base mat-button';\nconst MAT_BUTTON_INVISIBLE = 'shepherd-void-button';\n\nexport class CovalentGuidedTour extends TourButtonsActions {\n private _destroyedEvent$!: Subject<void>;\n\n shepherdTour!: Shepherd.Tour;\n stepOptions: ITourStep;\n\n constructor(stepOptions: ITourStep = defaultStepOptions) {\n super();\n\n this.stepOptions = stepOptions;\n this.newTour();\n }\n\n newTour(opts?: ITourOptions): void {\n this.shepherdTour = new Shepherd.Tour(\n Object.assign(\n {\n defaultStepOptions: this.stepOptions,\n },\n opts\n )\n );\n\n this._destroyedEvent$ = new Subject<void>();\n // listen to cancel and complete to clean up abortOn events\n merge(\n fromEvent(this.shepherdTour, 'cancel'),\n fromEvent(this.shepherdTour, 'complete')\n )\n .pipe(first())\n .subscribe(() => {\n this._destroyedEvent$.next();\n this._destroyedEvent$.complete();\n });\n\n // if abortOn was passed, we bind the event and execute complete\n if (opts && opts.abortOn) {\n const abortArr$: Subject<void>[] = [];\n opts.abortOn.forEach((abortOn: ITourEventOn) => {\n const abortEvent$: Subject<void> = new Subject<void>();\n abortArr$.push(abortEvent$);\n this._bindEvent(abortOn, undefined, abortEvent$, this._destroyedEvent$);\n });\n\n const abortSubs: Subscription = merge(...abortArr$)\n .pipe(takeUntil(this._destroyedEvent$))\n .subscribe(() => {\n this.shepherdTour.complete();\n abortSubs.unsubscribe();\n });\n }\n }\n\n back(): void {\n this.shepherdTour.back();\n }\n\n cancel(): void {\n this.shepherdTour.cancel();\n }\n\n next(): void {\n this.shepherdTour.next();\n }\n\n finish(): void {\n this.shepherdTour.complete();\n }\n\n addSteps(steps: ITourStep[]): void {\n this.shepherdTour.addSteps(this._prepareTour(steps));\n }\n\n start(): void {\n this.shepherdTour.start();\n }\n\n protected _prepareTour(\n originalSteps: ITourStep[],\n finishLabel: string = 'finish'\n ): ITourStep[] {\n // create Subjects for back and forward events\n const backEvent$: Subject<void> = new Subject<void>();\n const forwardEvent$: Subject<void> = new Subject<void>();\n let _backFlow = false;\n // create Subject for your end\n const destroyedEvent$: Subject<void> = new Subject<void>();\n /**\n * This function adds the step progress in the footer of the shepherd tooltip\n */\n const appendProgressFunc = function (this: any): void {\n // get all the footers that are available in the DOM\n const footers: Element[] = Array.from<Element>(\n document.querySelectorAll('.shepherd-footer')\n );\n // get the last footer since Shepherd always puts the active one at the end\n const footer: Element = footers[footers.length - 1];\n // generate steps html element\n const progress: HTMLSpanElement = document.createElement('span');\n progress.className = 'shepherd-progress';\n progress.innerText = `${this.shepherdTour.currentStep.options.count}/${stepTotal}`;\n // insert into the footer before the first button\n footer.insertBefore(progress, footer.querySelector('.shepherd-button'));\n };\n\n let stepTotal = 0;\n const steps: ITourStep[] = originalSteps.map((step: ITourStep) => {\n let showProgress: () => void = () => {\n //\n };\n if (step.attachToOptions?.skipFromStepCount === true) {\n showProgress = function (): void {\n return;\n };\n } else if (\n step.attachToOptions?.skipFromStepCount === undefined ||\n step.attachToOptions?.skipFromStepCount === false\n ) {\n step.count = ++stepTotal;\n showProgress = appendProgressFunc.bind(this);\n }\n return Object.assign({}, step, {\n when: {\n show: showProgress,\n },\n });\n });\n\n const finishButton: TourStepButton = {\n text: finishLabel,\n action: this['finish'].bind(this),\n classes: MAT_BUTTON,\n };\n\n const voidButton: TourStepButton = {\n text: '',\n action(): void {\n return;\n },\n classes: MAT_BUTTON_INVISIBLE,\n };\n\n // listen to the destroyed event to clean up all the streams\n this._destroyedEvent$.pipe(first()).subscribe(() => {\n backEvent$.complete();\n forwardEvent$.complete();\n destroyedEvent$.next();\n destroyedEvent$.complete();\n });\n\n const totalSteps: number = steps.length;\n steps.forEach((step: ITourStep, index: number) => {\n // create buttons specific for the step\n // this is done to create more control on events\n const nextButton: TourStepButton = {\n text: 'chevron_right',\n action: () => {\n // intercept the next action and trigger event\n forwardEvent$.next();\n this.shepherdTour.next();\n },\n classes: MAT_ICON_BUTTON,\n };\n const backButton: TourStepButton = {\n text: 'chevron_left',\n action: () => {\n // intercept the back action and trigger event\n backEvent$.next();\n _backFlow = true;\n // check if 'goBackTo' is set to jump to a particular step, else just go back\n if (step.attachToOptions && step.attachToOptions.goBackTo) {\n this.shepherdTour.show(step.attachToOptions.goBackTo, false);\n } else {\n this.shepherdTour.back();\n }\n },\n classes:\n step.advanceOnOptions?.allowGoBack === false\n ? MAT_BUTTON_INVISIBLE\n : MAT_ICON_BUTTON,\n };\n\n // check if highlight was provided for the step, else fallback into shepherds usage\n step.highlightClass =\n step.attachToOptions && step.attachToOptions.highlight\n ? 'shepherd-highlight'\n : step.highlightClass;\n\n // Adding buttons in the steps if no buttons are defined\n if (!step.buttons || step.buttons.length === 0) {\n if (index === 0) {\n // first step\n step.buttons = [nextButton];\n } else if (index === totalSteps - 1) {\n // last step\n step.buttons = [backButton, finishButton];\n } else {\n step.buttons = [backButton, nextButton];\n }\n }\n\n // checks \"advanceOn\" to override listeners\n let advanceOn: ITourEventOn[] | ITourEventOn = step.advanceOn;\n // remove the shepherd \"advanceOn\" infavor of ours if the event is part of our list\n if (\n (typeof advanceOn === 'object' &&\n !Array.isArray(advanceOn) &&\n advanceOn.event &&\n overriddenEvents.indexOf(advanceOn.event.split('.')[0]) > -1) ||\n advanceOn instanceof Array\n ) {\n step.advanceOn = undefined;\n step.buttons =\n step.advanceOnOptions && step.advanceOnOptions.allowGoBack\n ? [backButton, voidButton]\n : [voidButton];\n }\n // adds a default beforeShowPromise function\n step.beforeShowPromise = () => {\n return new Promise((resolve: (value?: any) => void) => {\n const additionalCapabilitiesSetup: () => void = () => {\n if (advanceOn && !step.advanceOn) {\n if (!Array.isArray(advanceOn)) {\n advanceOn = [advanceOn];\n }\n\n const advanceArr$: Subject<void>[] = [];\n advanceOn.forEach((_: any, i: number) => {\n const advanceEvent$: Subject<void> = new Subject<void>();\n advanceArr$.push(advanceEvent$);\n\n // we start a timer of attempts to find an element in the dom\n this._bindEvent(\n _,\n step.advanceOnOptions,\n advanceEvent$,\n destroyedEvent$\n );\n });\n const advanceSubs: Subscription = forkJoin(...advanceArr$)\n .pipe(takeUntil(merge(destroyedEvent$, backEvent$)))\n .subscribe(() => {\n // check if we need to advance to a specific step, else advance to next step\n if (step.advanceOnOptions && step.advanceOnOptions.jumpTo) {\n this.shepherdTour.show(step.advanceOnOptions.jumpTo);\n } else {\n this.shepherdTour.next();\n }\n forwardEvent$.next();\n advanceSubs.unsubscribe();\n });\n }\n\n // if abortOn was passed on the step, we bind the event and execute complete\n if (step.abortOn) {\n const abortArr$: Subject<void>[] = [];\n step.abortOn.forEach((abortOn: ITourEventOn) => {\n const abortEvent$: Subject<void> = new Subject<void>();\n abortArr$.push(abortEvent$);\n this._bindEvent(\n abortOn,\n undefined,\n abortEvent$,\n destroyedEvent$\n );\n });\n\n const abortSubs: Subscription = merge(...abortArr$)\n .pipe(\n takeUntil(merge(destroyedEvent$, backEvent$, forwardEvent$))\n )\n .subscribe(() => {\n this.shepherdTour.complete();\n abortSubs.unsubscribe();\n });\n }\n };\n\n const _stopTimer$: Subject<void> = new Subject<void>();\n const _retriesReached$: Subject<number> = new Subject<number>();\n const _retryAttempts$: BehaviorSubject<number> =\n new BehaviorSubject<number>(-1);\n\n let id: string | undefined;\n // checks if \"attachTo\" is a string or an object to get the id of an element\n if (typeof step.attachTo === 'string') {\n id = step.attachTo;\n } else if (\n typeof step.attachTo === 'object' &&\n typeof step.attachTo.element === 'string'\n ) {\n id = step.attachTo.element;\n }\n // if we have an id as a string in either case, we use it (we ignore it if its HTMLElement)\n if (id) {\n // if current step is the first step of the tour, we set the buttons to be only \"next\"\n // we had to use `any` since the tour doesnt expose the steps in any fashion nor a way to check if we have modified them at all\n if (\n this.shepherdTour.getCurrentStep() ===\n (<any>this.shepherdTour).steps[0]\n ) {\n this.shepherdTour.getCurrentStep()?.updateStepOptions({\n buttons: originalSteps[index].advanceOn\n ? [voidButton]\n : [nextButton],\n });\n }\n // register to the attempts observable to notify deeveloper when number has been reached\n _retryAttempts$\n .pipe(\n skip(1),\n takeUntil(merge(_stopTimer$.asObservable(), destroyedEvent$)),\n skipWhile((val: number) => {\n if (\n step.attachToOptions &&\n step.attachToOptions.retries !== undefined\n ) {\n return val < step.attachToOptions.retries;\n }\n return val < SHEPHERD_DEFAULT_FIND_ATTEMPTS;\n })\n )\n .subscribe((attempts: number) => {\n _retriesReached$.next(1);\n _retriesReached$.complete();\n // if attempts have been reached, we check \"skipIfNotFound\" to move on to the next step\n if (\n step.attachToOptions &&\n step.attachToOptions.skipIfNotFound\n ) {\n // if we get to this step coming back from a step and it wasnt found\n // then we either check if its the first step and try going forward\n // or we keep going back until we find a step that actually exists\n if (_backFlow) {\n if (\n (<any>this.shepherdTour).steps.indexOf(\n this.shepherdTour.getCurrentStep()\n ) === 0\n ) {\n this.shepherdTour.next();\n } else {\n this.shepherdTour.back();\n }\n _backFlow = false;\n } else {\n // destroys current step if we need to skip it to remove it from the tour\n const currentStep = this.shepherdTour.getCurrentStep();\n currentStep?.destroy();\n this.shepherdTour.next();\n this.shepherdTour.removeStep(currentStep?.id ?? '');\n }\n } else if (step.attachToOptions && step.attachToOptions.else) {\n // if \"skipIfNotFound\" is not true, then we check if \"else\" has been set to jump to a specific step\n this.shepherdTour.show(step.attachToOptions.else);\n } else {\n // tslint:disable-next-line:no-console\n console.warn(\n `Retries reached trying to find ${id}. Retried ${attempts} times.`\n );\n // else we show the step regardless\n resolve();\n }\n });\n\n // we start a timer of attempts to find an element in the dom\n timer(\n (step.attachToOptions && step.attachToOptions.timeBeforeShow) ||\n SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW,\n (step.attachToOptions && step.attachToOptions.interval) ||\n SHEPHERD_DEFAULT_FIND_INTERVAL\n )\n .pipe(\n // the timer will continue either until we find the element or the number of attempts has been reached\n takeUntil(merge(_stopTimer$, _retriesReached$, destroyedEvent$))\n )\n .subscribe(() => {\n const element = document.querySelector(id ?? '');\n // if the element has been found, we stop the timer and resolve the promise\n if (element) {\n _stopTimer$.next();\n _stopTimer$.complete();\n additionalCapabilitiesSetup();\n resolve();\n } else {\n _retryAttempts$.next(_retryAttempts$.value + 1);\n }\n });\n\n // stop find interval if user stops the tour\n destroyedEvent$.subscribe(() => {\n _stopTimer$.next();\n _stopTimer$.complete();\n _retriesReached$.next(1);\n _retriesReached$.complete();\n });\n } else {\n // resolve observable until the timeBeforeShow has passsed or use default\n timer(\n (step.attachToOptions && step.attachToOptions.timeBeforeShow) ||\n SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW\n )\n .pipe(takeUntil(merge(destroyedEvent$)))\n .subscribe(() => {\n resolve();\n });\n }\n });\n };\n });\n return steps;\n }\n\n private _bindEvent(\n eventOn: ITourEventOn,\n eventOnOptions: ITourEventOnOptions | undefined,\n event$: Subject<void>,\n destroyedEvent$: Subject<void>\n ): void {\n const selector = eventOn.selector ?? '';\n const event = eventOn.event;\n // we start a timer of attempts to find an element in the dom\n const timerSubs: Subscription = timer(\n (eventOnOptions && eventOnOptions.timeBeforeShow) ||\n SHEPHERD_DEFAULT_FIND_TIME_BEFORE_SHOW,\n (eventOnOptions && eventOnOptions.interval) ||\n SHEPHERD_DEFAULT_FIND_INTERVAL\n )\n .pipe(takeUntil(destroyedEvent$))\n .subscribe(() => {\n const element = document.querySelector(selector);\n // if the element has been found, we stop the timer and resolve the promise\n if (element) {\n timerSubs.unsubscribe();\n\n if (event === ITourEvent.added) {\n // if event is \"Added\" trigger a soon as this is attached.\n event$.next();\n event$.complete();\n } else if (\n event === ITourEvent.click ||\n event === ITourEvent.pointerover ||\n (event && event.indexOf(ITourEvent.keyup) > -1)\n ) {\n // we use normal listeners for mouseevents\n const mainEvent = event?.split('.')[0];\n const subEvent = event?.split('.')[1];\n fromEvent(element, mainEvent)\n .pipe(\n takeUntil(merge(event$.asObservable(), destroyedEvent$)),\n filter(($event: Event) => {\n // only trigger if the event is a keyboard event and part of out list\n if ($event instanceof KeyboardEvent) {\n if (keyEvents.get($event.keyCode) === subEvent) {\n return true;\n }\n return false;\n } else {\n return true;\n }\n })\n )\n .subscribe(() => {\n event$.next();\n event$.complete();\n });\n } else if (event === ITourEvent.removed) {\n // and we will use MutationObserver for DOM events\n const observer: MutationObserver = new MutationObserver(() => {\n if (!document.body.contains(element)) {\n event$.next();\n event$.complete();\n observer.disconnect();\n }\n });\n\n // stop listenining if tour is closed\n destroyedEvent$.subscribe(() => {\n observer.disconnect();\n });\n // observe for any DOM interaction in the element\n observer.observe(element, {\n childList: true,\n subtree: true,\n attributes: true,\n });\n }\n }\n });\n }\n}\n","import { Injectable } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport {\n Router,\n ActivatedRoute,\n ParamMap,\n NavigationExtras,\n NavigationStart,\n Event as NavigationEvent,\n} from '@angular/router';\nimport Shepherd from 'shepherd.js';\nimport { tap, map, filter } from 'rxjs/operators';\nimport { Observable, fromEvent } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\nimport {\n CovalentGuidedTour,\n ITourStep,\n ITourOptions,\n TourStepButton,\n} from './guided.tour';\n\nexport interface IGuidedTour extends ITourOptions {\n steps: IGuidedTourStep[];\n finishButtonText?: string;\n}\n\nexport interface IGuidedTourStep extends ITourStep {\n routing?: {\n route: string;\n extras?: NavigationExtras;\n };\n}\n\n/**\n * Router enabled Shepherd tour\n */\nexport enum TourEvents {\n complete = 'complete',\n cancel = 'cancel',\n hide = 'hide',\n show = 'show',\n start = 'start',\n active = 'active',\n inactive = 'inactive',\n}\n\nexport interface IGuidedTourEvent {\n step: any;\n previous: any;\n tour: any;\n}\n\n@Injectable()\nexport class CovalentGuidedTourService extends CovalentGuidedTour {\n private _toursMap: Map<string, IGuidedTour> = new Map<string, IGuidedTour>();\n private _tourStepURLs: Map<string, string> = new Map<string, string>();\n constructor(\n private _router: Router,\n private _route: ActivatedRoute,\n private _httpClient: HttpClient\n ) {\n super();\n _router.events\n .pipe(\n filter(\n (event: NavigationEvent) =>\n event instanceof NavigationStart &&\n event.navigationTrigger === 'popstate'\n )\n )\n .subscribe(() => {\n if (this.shepherdTour.isActive()) {\n this.shepherdTour.cancel();\n }\n });\n }\n\n tourEvent$(str: TourEvents): Observable<IGuidedTourEvent> {\n return fromEvent(this.shepherdTour, str);\n }\n\n async registerTour(\n tourName: string,\n tour: IGuidedTour | string\n ): Promise<void> {\n const guidedTour: IGuidedTour =\n typeof tour === 'string' ? await this._loadTour(tour) : tour;\n this._toursMap.set(tourName, guidedTour);\n }\n\n startTour(tourName: string): Shepherd.Tour | undefined {\n const guidedTour = this._getTour(tourName);\n this.finish();\n if (guidedTour && guidedTour.steps && guidedTour.steps.length) {\n // remove steps from tour since we need to preprocess them first\n this.newTour(Object.assign({}, guidedTour, { steps: undefined }));\n const tourInstance: Shepherd.Tour = this.shepherdTour.addSteps(\n this._configureRoutesForSteps(\n this._prepareTour(guidedTour.steps, guidedTour.finishButtonText)\n )\n );\n // init route transition if step URL is different then the current location.\n this.tourEvent$(TourEvents.show).subscribe(\n (tourEvent: IGuidedTourEvent) => {\n const currentURL: string = this._router.url.split(/[?#]/)[0];\n const {\n step: { id, options },\n } = tourEvent;\n if (this._tourStepURLs.has(id)) {\n const stepRoute = this._tourStepURLs.get(id);\n if (stepRoute !== currentURL) {\n this._router.navigate([stepRoute]);\n }\n } else {\n if (options && options.routing) {\n this._tourStepURLs.set(id, options.routing.route);\n } else {\n this._tourStepURLs.set(id, currentURL);\n }\n }\n }\n );\n this.start();\n return tourInstance;\n } else {\n // tslint:disable-next-line:no-console\n console.warn(`Tour ${tourName} does not exist. Please try another tour.`);\n return undefined;\n }\n }\n\n // Finds the right registered tour by using queryParams\n // finishes any other tour and starts the new one.\n initializeOnQueryParams(queryParam: string = 'tour'): Observable<ParamMap> {\n return this._route.queryParamMap.pipe(\n debounceTime(100),\n tap((params: ParamMap) => {\n const tourParam = params.get(queryParam);\n if (tourParam) {\n this.startTour(tourParam);\n // get current search parameters\n const searchParams: URLSearchParams = new URLSearchParams(\n window.location.search\n );\n // delete tour queryParam\n searchParams.delete(queryParam);\n // build new URL string without it\n let url: string =\n window.location.protocol +\n '//' +\n window.location.host +\n window.location.pathname;\n if (searchParams.toString()) {\n url += '?' + searchParams.toString();\n }\n // replace state in history without triggering a navigation\n window.history.replaceState({ path: url }, '', url);\n }\n })\n );\n }\n\n setNextBtnDisability(stepId: string, isDisabled: boolean): void {\n if (this.shepherdTour.getById(stepId)) {\n const stepOptions: ITourStep = (this.shepherdTour.getById(stepId) as any)\n .options;\n stepOptions.buttons?.forEach((button: TourStepButton) => {\n if (button.text === 'chevron_right') {\n button.disabled = isDisabled;\n }\n });\n this.shepherdTour.getById(stepId)?.updateStepOptions(stepOptions);\n }\n }\n\n private async _loadTour(tourUrl: string): Promise<any> {\n const request: Observable<object> = this._httpClient.get(tourUrl);\n try {\n return await request\n .pipe(\n map((resultSet: any) => {\n return JSON.parse(JSON.stringify(resultSet));\n })\n )\n .toPromise();\n } catch {\n return undefined;\n }\n }\n\n private _getTour(key: string): IGuidedTour | undefined {\n return this._toursMap.get(key);\n }\n\n private _configureRoutesForSteps(\n routedSteps: IGuidedTourStep[]\n ): IGuidedTourStep[] {\n routedSteps.forEach((step: IGuidedTourStep) => {\n if (step.routing) {\n const route: string = step.routing.route;\n // if there is a beforeShowPromise, then we save it and call it after the navigation\n if (step.beforeShowPromise) {\n const beforeShowPromise: () => Promise<void> = step.beforeShowPromise;\n step.beforeShowPromise = () => {\n return this._router\n .navigate([route], step.routing?.extras)\n .then(() => {\n return beforeShowPromise();\n });\n };\n } else {\n step.beforeShowPromise = () => this._router.navigate([route]);\n }\n }\n });\n\n return routedSteps;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { CovalentGuidedTourService } from './guided-tour.service';\n\n@NgModule({\n imports: [CommonModule],\n providers: [CovalentGuidedTourService],\n declarations: [],\n exports: [],\n})\nexport class CovalentGuidedTourModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;IAeY;AAAZ,WAAY,UAAU;IACpB,6BAAiB,CAAA;IACjB,yCAA6B,CAAA;IAC7B,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;AACvB,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAsCD,MAAe,kBAAkB;CAQhC;AAED,MAAM,sCAAsC,GAAG,GAAG,CAAC;AACnD,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAC3C,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAE1C,MAAM,gBAAgB,GAAa;IACjC,UAAU,CAAC,KAAK;IAChB,UAAU,CAAC,WAAW;IACtB,UAAU,CAAC,OAAO;IAClB,UAAU,CAAC,KAAK;IAChB,UAAU,CAAC,KAAK;CACjB,CAAC;AAEF,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAiB;IAC7D,CAAC,EAAE,EAAE,OAAO,CAAC;IACb,CAAC,EAAE,EAAE,KAAK,CAAC;CACZ,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAa;IACnC,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACjD,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;KACd;CACF,CAAC;AAEF,MAAM,eAAe,GAAG,gDAAgD,CAAC;AACzE,MAAM,UAAU,GAAG,4BAA4B,CAAC;AAChD,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;MAEvC,2BAA2B,kBAAkB;IAMxD,YAAY,cAAyB,kBAAkB;QACrD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;KAChB;IAED,OAAO,CAAC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