...
Code Block | ||
---|---|---|
| ||
// todo get api token from Wizart. const api_token = 'CLIENT_SPECIFIC_API_TOKEN'; const server_address = 'https://pim-client.wizart.tech'; // bba (back button action) param is used to add back button to wizart component const fittingRoomEndpoint = server_address + '/fitting-room' + '?api_token=' + api_token + '&bba=true' ; function openFittingRoom (searchQuery) { const componentEndpoint = searchQuery ? fittingRoomEndpoint + searchQuery : fittingRoomEndpoint; let fittingRoomObject = document.getElementById('wizart-fitting-room-object'); const fittingRoomObjectContainer = fittingRoomObject.parentElement; fittingRoomObject.setAttribute('src', componentEndpoint); // object clonning is necessary as some browsers does not render "object" twice after changing data attribute const clonnedFittingRoomObject = fittingRoomObject.cloneNode(true); fittingRoomObjectContainer.appendChild(clonnedFittingRoomObject); fittingRoomObject.remove(); clonnedFittingRoomObject.classList.add('active'); // should be added to avoid duplicating scrollbars document.getElementsByTagName('html')[0].style.overflow = 'hidden'; } // bba event - fired when back button is clicked at wizart component window.addEventListener('message', function (event) { if (~event.origin.indexOf(server_address)) { // exactly 'close_overlay' as it's sent from wizart component if (event.data === 'close_overlay') { // return overflow of target page to initial state document.getElementsByTagName('html')[0].style.overflow = 'auto'; document.getElementById('wizart-fitting-room-object').classList.remove('active'); } } }); |
43. (Optional) To change default Wizart logo to your company logo add logo_path
parameter and set value to appropriate link to logo file. Use the listing below to change the part of code specified in p.2Optional parameters:
logo_path – link to your logo. Preferably in svg format. The logo should occupy the entire height of the image without indentation above and below.
Format:logo_path=LINK_TO_YOUR_LOGO
menu_items – additional fields in the menu.
Format:menu_items=JSON.stringify([{ title: string }])
do_not_show_info_about_app – do not show the menu item “About the application“.
Format:do_not_show_info_about_app=1
original_url – link to the page. Serves for redirecting from posts on social networks.
Format:original_url=link_to_your_web_site
twitter_mention – mention your twitter account.
Format:twitter_mention=@your_twitter_mention
Integration example:
Code Block |
---|
const fittingRoomEndpoint = server_address
+ '/fitting-room'
+ '?api_token=' + api_token
+ '&bba=true'
; |
to that
Code Block |
---|
const fittingRoomEndpoint = server_address + '&logo_path=LINK_TO_YOUR_LOGO' + '/fitting-room'&menu_items=' + JSON.stringify([]) + '?api_token=' + api_token &do_not_show_info_about_app=0' + '&bba=truetwitter_mention=@your_twitter_mention' + '&logooriginal_pathurl=LINK_TO_YOUR_LOGOWEB_SITE' ; |
54. Save and move all the changes into the work environment of the client’s website.
65. Check and verify that the integration is operational.
...