Scenarios

Scenario 1: Shared Web Component Displayed Inline

If you want the shared web component to display inside of your web page, then you will want to use the inline method.

To use the inline method you will need to set the method to ‘inline’ and set the target to the id of div that the content should be inserted into.

Web Page HTML:

            <div id="inlineIntentDiv"></div>
            

Web Page Script:

            function launchInline(){
                var intent = new window.ShopIntegration.Intent(
                    'mitchell1.intent.action.view',
                    'vendor/vnd.m1.sampleintent.view.v1',
                    '{"message": "Hello World"}', {
                    target: 'inlineIntentDiv',
                    method: 'inline',
                    width: width || '100%',
                    height: height || '100%'
                };
                window.IntegrationManager.start(intent, token);
            }
            

Scenario 2: Shared Web Component Displayed in a New Window

If you want the shared web component to display in its own window, then you will want to use the new method.

To use the new method you will need to set the method to ‘new’.

Web Page Script:

            function launchNewWindow(){
                var intent = new window.ShopIntegration.Intent(
                    'mitchell1.intent.action.view',
                    'vendor/vnd.m1.sampleintent.view.v1',
                    '{"message": "Hello World"}', {
                    method: 'new',
                    width: width || '100%',
                    height: height || '100%'
                };
                window.IntegrationManager.start(intent, token);
            }