customerio-gist-web 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ import { UserNetworkInstance } from './network';
2
+
3
+ export async function logUserMessageView(queueId) {
4
+ try {
5
+ var response = await UserNetworkInstance().post(`/api/v1/logs/queue/${queueId}`);
6
+ return response;
7
+ } catch (error) {
8
+ return error.response;
9
+ }
10
+ }
11
+
12
+ export async function logMessageView(messageId) {
13
+ try {
14
+ var response = await UserNetworkInstance().post(`/api/v1/logs/message/${messageId}`);
15
+ return response;
16
+ } catch (error) {
17
+ return error.response;
18
+ }
19
+ }
@@ -0,0 +1,17 @@
1
+ import Gist from '../gist';
2
+ import axios from 'axios';
3
+ import { settings } from './settings';
4
+ import { getUserToken } from "../managers/user-manager";
5
+
6
+ export function UserNetworkInstance() {
7
+ var headers = { "X-CIO-Site-Id": Gist.config.siteId, "X-CIO-Datacenter": Gist.config.dataCenter };
8
+ var userToken = getUserToken();
9
+ if (userToken != null) {
10
+ headers['X-Gist-Encoded-User-Token'] = btoa(userToken);
11
+ }
12
+ return axios.create({
13
+ baseURL: settings.GIST_QUEUE_API_ENDPOINT[Gist.config.env],
14
+ timeout: 20000,
15
+ headers: headers
16
+ });
17
+ }
@@ -0,0 +1,10 @@
1
+ import { UserNetworkInstance } from './network';
2
+
3
+ export async function getUserQueue() {
4
+ try {
5
+ var response = await UserNetworkInstance().post(`/api/v1/users`, {});
6
+ return response;
7
+ } catch (error) {
8
+ return error.response;
9
+ }
10
+ }
@@ -0,0 +1,17 @@
1
+ export const settings = {
2
+ ENGINE_API_ENDPOINT: {
3
+ "prod": "https://engine.api.gist.build",
4
+ "dev": "https://engine.api.dev.gist.build",
5
+ "local": "http://engine.api.local.gist.build:82"
6
+ },
7
+ GIST_QUEUE_API_ENDPOINT: {
8
+ "prod": "https://gist-queue-consumer-api.cloud.gist.build",
9
+ "dev": "https://gist-queue-consumer-api.cloud.dev.gist.build",
10
+ "local": "http://api.local.gist.build:86"
11
+ },
12
+ GIST_VIEW_ENDPOINT: {
13
+ "prod": "https://renderer.gist.build/2.0",
14
+ "dev": "https://renderer.gist.build/2.0",
15
+ "local": "http://app.local.gist.build:8080/web"
16
+ }
17
+ }
@@ -0,0 +1,48 @@
1
+ <div id="gist-embed">
2
+ <style>
3
+ #x-gist-floating-top, #x-gist-floating-top-left, #x-gist-floating-top-right {
4
+ position: fixed;
5
+ top: 0px;
6
+ z-index: 1000000;
7
+ }
8
+ #x-gist-floating-bottom, #x-gist-floating-bottom-left, #x-gist-floating-bottom-right {
9
+ position: fixed;
10
+ bottom: 0px;
11
+ z-index: 1000000;
12
+ }
13
+ #x-gist-bottom, #x-gist-top, #x-gist-floating-top, #x-gist-floating-bottom {
14
+ left: 50%;
15
+ transform: translate(-50%, 0%);
16
+ width: '${topBottomMessageWidth}';
17
+ }
18
+ #x-gist-floating-top-left, #x-gist-floating-top-right, #x-gist-floating-bottom-left, #x-gist-floating-bottom-right {
19
+ width: '${cornersMessageWidth}';
20
+ }
21
+ #x-gist-floating-top-right, #x-gist-floating-bottom-right {
22
+ right: 0px;
23
+ }
24
+ #gist-embed {
25
+ position: relative;
26
+ height: 100%;
27
+ width: 100%;
28
+ }
29
+ #gist-embed-container {
30
+ position: relative;
31
+ height: 100%;
32
+ width: 100%;
33
+ }
34
+ #gist-embed-container .gist-frame {
35
+ height: 100%;
36
+ width: 100%;
37
+ border: none;
38
+ }
39
+ @media (max-width: '${maxWidth}') {
40
+ #x-gist-bottom, #x-gist-bottom, #x-gist-floating-top, #x-gist-floating-bottom, #x-gist-floating-top-left, #x-gist-floating-top-right, #x-gist-floating-bottom-left, #x-gist-floating-bottom-right {
41
+ width: 100%;
42
+ }
43
+ }
44
+ </style>
45
+ <div id="gist-embed-container">
46
+ <iframe class="gist-frame" src="${url}"></iframe>
47
+ </div>
48
+ </div>
@@ -0,0 +1,51 @@
1
+ <div id="gist-embed-message">
2
+ <style>
3
+ #gist-overlay.background {
4
+ position: fixed;
5
+ z-index: 9999999998;
6
+ left: 0;
7
+ top: 0;
8
+ width: 100%;
9
+ height: 100%;
10
+ background-color: '${overlayColor}';
11
+ visibility: hidden;
12
+ }
13
+ #gist-overlay.background.visible {
14
+ visibility: visible;
15
+ }
16
+ #gist-overlay.background.is-blacked-out {
17
+ display: block;
18
+ }
19
+ #gist-message {
20
+ width: '${messageWidth}';
21
+ position: absolute;
22
+ border: none;
23
+ opacity: 0;
24
+ transition: opacity 0.3s ease-in-out;
25
+ z-index: 9999999999;
26
+ left: 50%;
27
+ transform: translateX(-50%);
28
+ }
29
+ #gist-message.visible {
30
+ opacity: 1;
31
+ }
32
+ #gist-message.center {
33
+ transform: translate(-50%, -50%);
34
+ top: 50%;
35
+ }
36
+ #gist-message.bottom {
37
+ bottom: 0;
38
+ }
39
+ #gist-message.top {
40
+ top: 0;
41
+ }
42
+ @media (max-width: '${maxWidth}') {
43
+ #gist-message {
44
+ width: 100%;
45
+ }
46
+ }
47
+ </style>
48
+ <div id="gist-overlay" class="background">
49
+ <iframe id="gist-message" class="message" src="${url}"></iframe>
50
+ </div>
51
+ </div>
@@ -0,0 +1,12 @@
1
+ export default class EventEmitter {
2
+ on(name, callback) {
3
+ var callbacks = this[name];
4
+ if (!callbacks) this[name] = [callback];
5
+ else callbacks.push(callback);
6
+ }
7
+
8
+ dispatch(name, event) {
9
+ var callbacks = this[name];
10
+ if (callbacks) callbacks.forEach(callback => callback(event));
11
+ }
12
+ }
@@ -0,0 +1,26 @@
1
+ export function setKeyWithExpiryToLocalStore(key, value, ttl) {
2
+ const item = {
3
+ value: value,
4
+ expiry: ttl,
5
+ };
6
+ localStorage.setItem(key, JSON.stringify(item));
7
+ }
8
+
9
+ export function getKeyFromLocalStore(key) {
10
+ const itemStr = localStorage.getItem(key);
11
+ if (!itemStr) {
12
+ return null;
13
+ }
14
+ const item = JSON.parse(itemStr);
15
+ const now = new Date();
16
+ const itemExpiry = new Date(item.expiry);
17
+ if (now.getTime() > itemExpiry.getTime()) {
18
+ localStorage.removeItem(key);
19
+ return null;
20
+ }
21
+ return item.value;
22
+ }
23
+
24
+ export function clearKeyFromLocalStore(key) {
25
+ localStorage.removeItem(key);
26
+ }
@@ -0,0 +1,7 @@
1
+ import Gist from '../gist';
2
+
3
+ export function log(message) {
4
+ if (Gist.config.logging) {
5
+ console.log(`Gist: ${message}`);
6
+ }
7
+ }
package/test.sh ADDED
@@ -0,0 +1,4 @@
1
+ # Testing script to open an incognito window to the examples
2
+ #!/bin/bash
3
+
4
+ open -na "Google Chrome" --args -incognito "http://localhost:8080/examples/"
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ watchOptions: {
3
+ poll: 1000
4
+ },
5
+ output: {
6
+ library: 'Gist',
7
+ libraryTarget: 'umd',
8
+ filename: 'gist.js',
9
+ globalObject: 'this'
10
+ }
11
+ };