UNPKG

@gistproduct/web

Version:

Build beautiful in-app flows with no code and deliver them instantly to your app.

84 lines (75 loc) 3.96 kB
<!doctype html> <html> <head> <title>Gist for Web</title> <meta content="width=device-width, initial-scale=1" name="viewport" /> <meta charset="utf-8" /> <link href="styles.css" rel="stylesheet"> </head> <body> <div id="banner"></div> <div class="row header"> <h1>Gist for Web</h1> </div> <div class="row examples"> <a href="#" class="button" onClick="showSimpleMessage()">Show Simple Message</a> <a href="#" class="button" onClick="showMessageWithProperties()">Show Message With Properties</a> <a href="#" class="button" onClick="showComplexMessage()">Show Complex Message</a> <a href="#" class="button" onClick="embedBanner()">Embed Banner</a> <a href="#" class="button" onClick="embedFloatingMessage()">Embed Floating Message</a> </div> <div class="row docs"> <p>More information can be found on our <a target="_blank" href="https://docs.gist.build">docs</a>, if you have any question you can email us at <a target="_blank" href="mailto:support@gist.build">support@gist.build</a></p> </div> <script src="../dist/gist.js"></script> <script type="text/javascript"> /* Dev Setup Options { organizationId: "9dc356b3-ea5c-47ae-8a5c-b79617c267c9", useGuestSession: true, env: "local", logging: true, experiments: true } */ Gist.setup({ organizationId: "c6ff92b9-5607-4655-9265-f2588f7e3b58", logging: true }); Gist.subscribeToTopic("announcements"); Gist.setUserToken("BCD123"); Gist.setCurrentRoute("home"); Gist.events.on("messageShown", message => { console.log(`onMessageShown: ${message.messageId} with instanceId: ${message.instanceId}`); }); Gist.events.on("messageDismissed", message => { console.log(`onMessageDismissed: ${message.messageId} with instanceId: ${message.instanceId}`); }); Gist.events.on("messageError", message => { console.log(`onMessageError: ${message.messageId} with instanceId: ${message.instanceId}`); }); Gist.events.on("messageAction", params => { console.log(`onMessageAction, Action: ${params.action} with name ${params.name} on route: ${params.message.currentRoute} with instanceId: ${params.message.instanceId}`); }); function showComplexMessage() { Gist.showMessage({messageId: 'version-2-0', position: 'center'}); } function showSimpleMessage() { Gist.showMessage({messageId: 'welcome', position: 'center'}); } function showMessageWithProperties() { Gist.showMessage( { messageId: 'artists', position: 'center', properties: { gist: { 'scale': true }, title: 'Top Artists', list: [ { name: 'Beatles', discography: [ 'Please Please Me', 'With The Beatles', 'A Hard Day’s Night', 'Beatles For Sale', 'Help!', 'Rubber Soul', 'Revolver', 'Sgt Pepper’s Lonely Hearts Club Band', 'The Beatles', 'Yellow Submarine', 'Abbey Road', 'Let It Be' ] }, { name: 'The Doors', discography: ['The Doors', 'Strange Days', 'Waiting for the Sun', 'The Soft Parade', 'Absolutely Live', 'Morrison Hotel', 'L.A. Woman', 'Other Voices', 'Full Circle', 'An American Prayer'] }] } }); } function embedBanner() { // Loads example-banner message in element id "banner". Gist.embedMessage({ messageId: "example-banner" }, "banner"); } function embedFloatingMessage() { // Loads example-notice message in a Gist preset position. // Available positions are: "x-gist-top", "x-gist-floating-top", "x-gist-bottom", "x-gist-floating-bottom", "x-gist-floating-bottom-left", "x-gist-floating-bottom-right", "x-gist-floating-top-left", "x-gist-floating-top-right". Gist.embedMessage({ messageId: "example-notice" }, "x-gist-floating-bottom-right"); } </script> </body> </html>