OneSignal-Website-SDK icon indicating copy to clipboard operation
OneSignal-Website-SDK copied to clipboard

[Bug]: `actionMessage` doesn't appear to work in the initialization

Open Kikketer opened this issue 5 months ago • 2 comments

What happened?

I'm setting the actionMessage during initialization but it continues to show the default message.

SDK: https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js

Code:

window.OneSignalDeferred.push(async (OneSignal) => {
    await OneSignal.init({
      appId: import.meta.env.VITE_PUBLIC_PUSH_APP_ID,
      safari_web_id: import.meta.env.VITE_PUBLIC_PUSH_SAFARI_ID,
      allowLocalhostAsSecureOrigin: location.hostname === 'localhost',
      promptOptions: {
        actionMessage:
          'Would you like to be notified this is a test',
        acceptButton: 'Sure',
        slidedown: {
          prompts: [
            {
              type: 'push',
              autoPrompt: true,
              delay: { timeDelay: 5 },
            },
          ],
        },
      },
      welcomeNotification: {
        disable: true,
      },
    })
  })

The slidedown (which waits the proper 5 seconds) shows as: image

Other adjustments I make to this initialize work properly (add/remove the notifyButton, alter the time delay, etc). I've tried placing the actionMessage in promptOptions, promptOptions.slidedown and promptOptions.slidedown.prompts[0] (the documentation isn't entirely clear where this should be placed). None of these seem to work.

What browsers are you seeing the problem on?

Chrome (Chromium)

What operating system are you running?

macOS Catalina + Chrome Version 120.0.6099.199 (Official Build) (x86_64)

Steps to reproduce?

See description.
The application is a SolidJS and it's initialized in a Provider using the code above.  Changes to that initialization object apply properly except the actionMessage.

What did you expect to happen?

The actionMessage (and button text) to be updated properly.

Relevant log output

N/A

Kikketer avatar Jan 11 '24 17:01 Kikketer