Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Adding promptOptions to init shows a premature prompt #128

Open
DanyPell opened this issue Oct 12, 2023 · 3 comments
Open

[Bug]: Adding promptOptions to init shows a premature prompt #128

DanyPell opened this issue Oct 12, 2023 · 3 comments

Comments

@DanyPell
Copy link

DanyPell commented Oct 12, 2023

What happened?

Using 3.0.1.

When filling promptOptions, a prompt shows on page load (with my updated text), however, since it is only an init method, it should not do that. My config to reproduce (uncomment promptOptions).

await OneSignal.init({
    appId: oneSignalAppId,
    safari_web_id: oneSignalSafariId,
    notifyButton: { enable: false },
    allowLocalhostAsSecureOrigin: !isProduction,
    autoPrompt: false,
    autoResubscribe: true,
    // Maybe a but in the library because although it works (proper text shown in prompt), it immediately shows a prompt on page load...
    // promptOptions: {
    //     actionMessage: 'Get notified when someone accepts your friend requests and for new messages.',
    //     acceptButton: 'ALLOW',
    //     cancelButton: 'No Thanks',
    // }

});

I tried adding the promptOptions in the OneSignal.Slidedown.promptPush method but it does not accept such options. Which would be a better place to add them, by the way.

What browsers are you seeing the problem on?

Chrome (Chromium)

What operating system are you running?

Latest iOS in Mac M1 but it is likely just a library issue

Steps to reproduce?

As explained

What did you expect to happen?

A prompt should not show on page load simply because of adding promptOptions in the init method.

Relevant log output

No response

@maschtag
Copy link

maschtag commented Oct 31, 2023

I add the same issue, and I just had my Init parameters in the wrong format.

Try with something like that :
{ promptOptions: { slidedown: { prompts: [{ type: "push", autoPrompt: false, text: { actionMessage: 'Get notified when someone accepts your friend requests and for new messages.', acceptButton: 'ALLOW', cancelButton: 'No Thanks', } delay: { pageViews: 1, timeDelay: 10 }, }] } }, }

@shumkapoh
Copy link

shumkapoh commented Jul 11, 2024

I add the same issue, and I just had my Init parameters in the wrong format.

Try with something like that : { promptOptions: { slidedown: { prompts: [{ type: "push", autoPrompt: false, text: { actionMessage: 'Get notified when someone accepts your friend requests and for new messages.', acceptButton: 'ALLOW', cancelButton: 'No Thanks', } delay: { pageViews: 1, timeDelay: 10 }, }] } }, }

Does it work?

  • I've disabled the "Auto Prompt" in my OneSignal Dashboard
  • I've used this configuration below in my init().
      promptOptions: {
        slidedown: {
          prompts: [
            {
              type: "push",
              autoPrompt: false,
              delay: { pageViews: 0, timeDelay: 0 },
            },
          ],
        },
      }
    
    

But it still shows the slidedown

@shumkapoh
Copy link

I add the same issue, and I just had my Init parameters in the wrong format.
Try with something like that : { promptOptions: { slidedown: { prompts: [{ type: "push", autoPrompt: false, text: { actionMessage: 'Get notified when someone accepts your friend requests and for new messages.', acceptButton: 'ALLOW', cancelButton: 'No Thanks', } delay: { pageViews: 1, timeDelay: 10 }, }] } }, }

Does it work?

  • I've disabled the "Auto Prompt" in my OneSignal Dashboard
  • I've used this configuration below in my init().
      promptOptions: {
        slidedown: {
          prompts: [
            {
              type: "push",
              autoPrompt: false,
              delay: { pageViews: 0, timeDelay: 0 },
            },
          ],
        },
      }
    

But it still shows the slidedown

It takes time for the "Auto Prompt" changes to reflect in my website. Sorry for the false alarm. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants