diff --git a/packages/user-onboarding/projects/user-onboarding-element/package.json b/packages/user-onboarding/projects/user-onboarding-element/package.json index d8c1ce7..405fe5a 100644 --- a/packages/user-onboarding/projects/user-onboarding-element/package.json +++ b/packages/user-onboarding/projects/user-onboarding-element/package.json @@ -22,5 +22,5 @@ "access": "public", "directory": "dist" }, - "hash": "e65f7bb96c4788dba8137df5a821e2eb2d2246b7162bcef11c4e792ad3466ab2" + "hash": "03edeb8282be21019cd2abf2f0247a97fa7192cfe82ffd5228091594eb52a385" } \ No newline at end of file diff --git a/packages/user-onboarding/projects/user-onboarding-lib/src/lib/tour-service.service.ts b/packages/user-onboarding/projects/user-onboarding-lib/src/lib/tour-service.service.ts index 458d210..1d142f0 100644 --- a/packages/user-onboarding/projects/user-onboarding-lib/src/lib/tour-service.service.ts +++ b/packages/user-onboarding/projects/user-onboarding-lib/src/lib/tour-service.service.ts @@ -103,16 +103,13 @@ export class TourServiceService { props: Props, ): void { if (b.key === 'prevAction') { - // Fixed: Wrapped functions to return the action as expected by shepherd.js type definition - b.action = () => + b.action = e.prevRoute === e.currentRoute ? wrapperNormalPrev : wrapperPrev; } else if (b.key === 'nextAction') { - // Fixed: Wrapped functions to return the action as expected by shepherd.js type definition - b.action = () => + b.action = e.nextRoute === e.currentRoute ? wrapperNormalNext : wrapperNext; } else { - // Fixed: Wrapped bind result to return the action as expected by shepherd.js type definition - b.action = () => func.bind({tour: this.tour, tourId, props}); + b.action = func.bind({tour: this.tour, tourId, props}); } } @@ -182,7 +179,9 @@ export class TourServiceService { e.buttons?.forEach(b => { const key = b.key; // Fixed: Added type assertion for key and func since getFnByKey returns Function but we need () => void - const func = this.tourStoreService.getFnByKey(key as string) as () => void; + const func = this.tourStoreService.getFnByKey( + key as string, + ) as () => void; const wrapperNext = () => { this.navigateAndMoveToNextStep(e, tourInstance, tourState, index); }; @@ -237,7 +236,9 @@ export class TourServiceService { er.buttons?.forEach(br => { const k = br.key; // Fixed: Added type assertion for key and func since getFnByKey returns Function but we need () => void - const funcRemoved = this.tourStoreService.getFnByKey(k as string) as () => void; + const funcRemoved = this.tourStoreService.getFnByKey( + k as string, + ) as () => void; const wrapperNextRemoved = () => { this.navigateAndMoveToNextStepRemoved( er, diff --git a/packages/user-onboarding/projects/user-onboarding-lib/src/models/tour-button.ts b/packages/user-onboarding/projects/user-onboarding-lib/src/models/tour-button.ts index a94c809..dd879ef 100644 --- a/packages/user-onboarding/projects/user-onboarding-lib/src/models/tour-button.ts +++ b/packages/user-onboarding/projects/user-onboarding-lib/src/models/tour-button.ts @@ -5,7 +5,7 @@ import Step from 'shepherd.js/src/types/step'; export interface TourButton { - action?: () => Step.StepOptionsButton['action']; + action?: Step.StepOptionsButton['action']; classes?: string; text: string; key?: string;