angular-shepherd icon indicating copy to clipboard operation
angular-shepherd copied to clipboard

Shepherd 14 no longer allows button types

Open smlombardi opened this issue 3 years ago • 6 comments

I updated my app to use Angular 14 and angular-shepherd 14.

The tour which previously worked fine now will not compile and throws errors like this in the terminal when I try to compile:

Terminal-20221004_154735

According to the docs this is still a valid type and I didn't see any specific migration notes.

smlombardi avatar Oct 04 '22 19:10 smlombardi

@smlombardi button types are a thing still. My guess is the types are wrong. I don't know where these types are coming from.

RobbieTheWagner avatar Oct 05 '22 12:10 RobbieTheWagner

with Angular Shepherd 14 installed, this block is flagged in VSCode as an error on the type: cancel line and will not compile.

Note that I can run angular shepherd 12 in angular 14 just fine, and without this error

   this.shepherdService.addSteps([
      {
        class: 'single-coach-mark',
        attachTo: {
          element: ' .pbi-apps',
          on: 'bottom'
        },

        buttons: [
          {
            classes: 'btn btn-page-primary btn-block w-100',
            text: 'Got it',
            type: 'cancel'
          }
        ],
        cancelIcon: {
          enabled: true
        },
        classes: 'bg-light coach-marks',
        highlightClass: 'highlight',
        scrollTo: false,
        text: ['Account is now in Header.']
      }
    ]);

smlombardi avatar Oct 05 '22 12:10 smlombardi

@smlombardi yes, what I said still applies. Button types are a thing still. My guess is the types are wrong. I don't know where these types are coming from.

RobbieTheWagner avatar Oct 05 '22 15:10 RobbieTheWagner

Perhaps you should change the property name from type to buttonType or something similar? It's possible Angular is now enforcing type as a reserved word.

smlombardi avatar Dec 06 '22 15:12 smlombardi

@smlombardi The error seems to state it's just not in the types for StepOptionsButton, which is correct, it should not be https://github.com/shipshapecode/shepherd/blob/e5a82cc7052a3207d7387848af95f2a3d43f077d/src/types/step.d.ts#L251

RobbieTheWagner avatar Jan 19 '23 19:01 RobbieTheWagner

So what are you supposed to do if you want to use type? When I leave it in my project does not run anymore and if I leave it out my buttons don't work anymore. And using the action attribute instead does not really work as I want to since that tour object in there does not have methods such as close() or next().

Can you please add type in there?

EDIT: Ok, nvm - it is possible to use the action to cancel or to go to the next step.. it is just confusing to understand that.

Example:

            action: function () {
              this.cancel();
            },

Alternatively: action: () => this.shepherdService.cancel()

PKHDK avatar Oct 18 '23 11:10 PKHDK