In Suite Commerce Advanced, I have a new extension...
# ask-stanley-ai
m
In Suite Commerce Advanced, I have a new extension and I want to show a message after logging in. Is there an event which I can take in account ?Or how can I do it ?
c
AI generated answer (using internal Slack threads):
In Suite Commerce Advanced, you can use the
afterAppendView
event to show a message after logging in. This event is triggered after the view is rendered and appended to the DOM. You can listen to this event in your extension and then display your message. Here is a basic example of how you can do this:
Copy code
javascript
define('MyExtension'
, [
    'Header.Profile.View'
  , 'jQuery'
  ]
, function (
    HeaderProfileView
  , jQuery
  ) {
    'use strict';

    return  {
        mountToApp: function mountToApp (container) {
            var layout = container.getComponent('Layout');

            layout.addChildViews('Header.Profile.View', {
                'Header.Profile.View': {
                    'Header.Profile.View': {
                        childViewIndex: 1,
                        childViewConstructor: function () {
                            return function () {
                                this.on('afterAppendView', function (view) {
                                    if (view instanceof HeaderProfileView) {
                                        jQuery('<div>Your message here</div>').appendTo('body');
                                    }
                                });
                            };
                        }()
                    }
                }
            });
        }
    };
});
In this example, we are adding a child view to the
Header.Profile.View
which is displayed after a user logs in. The
afterAppendView
event is then used to append a message to the body of the page. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820415437
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.819117546
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.814476
Please provide your feedback on this answer.