Commit 99042a30 authored by Nicolas Mérigot's avatar Nicolas Mérigot Committed by Jean-Baptiste

Feature/cicd

parent 8a4044a0
node_modules/*
!node_modules/conversejs
stamp-npm
---
image: node
stages:
- test
- release
test:
stage: test
script:
- echo 'Make your tests here !'
except:
- master
tags:
- sib
publish:
stage: release
before_script:
- npm install -g semantic-release @semantic-release/gitlab
script:
- semantic-release
only:
- master
tags:
- sib
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
{
"name": "chat.component.dev",
"version": "1.0.0",
"name": "@startinblox/component-chat",
"version": "0.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@startinblox/core": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/@startinblox/core/-/core-0.5.4.tgz",
"integrity": "sha512-S+N11kLQscFC4ms1rCT0Z3s3oT+uzIxZCXz8THtvQIrZNS0LOfCoiwLbcjezP7fLMQ3pAxt/GSdiCLCwC8RNZw=="
},
"@startinblox/oidc": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/@startinblox/oidc/-/oidc-0.5.1.tgz",
"integrity": "sha512-0laMDJ//g+BPBBJCydIVazqWDJpP8fAK6TdnLFCUpUBk3tywuXxgg5vhn0wizKrkQYW2nofmtoJOpia1qzrARg==",
"requires": {
"oidc-client": "^1.6.1"
},
"dependencies": {
"oidc-client": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.6.1.tgz",
"integrity": "sha512-buA9G0hlFjUwxoL/xuHunBtTgoICtJSojnZtATqMliUTKxPYAzHprOQ85Lj0hgF+Zv8lI/ViqaNFDG0Z5KCUKA==",
"requires": {
"babel-polyfill": ">=6.9.1",
"jsrsasign": "^8.0.12"
}
}
}
},
"@webcomponents/webcomponentsjs": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@webcomponents/webcomponentsjs/-/webcomponentsjs-1.2.2.tgz",
......@@ -21,9 +45,9 @@
"integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=",
"optional": true,
"requires": {
"babel-runtime": "6.26.0",
"core-js": "2.5.7",
"regenerator-runtime": "0.10.5"
"babel-runtime": "^6.26.0",
"core-js": "^2.5.0",
"regenerator-runtime": "^0.10.5"
}
},
"babel-runtime": {
......@@ -32,8 +56,8 @@
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"optional": true,
"requires": {
"core-js": "2.5.7",
"regenerator-runtime": "0.11.1"
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
},
"dependencies": {
"regenerator-runtime": {
......@@ -50,6 +74,14 @@
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=",
"dev": true
},
"converse.js": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/converse.js/-/converse.js-4.1.0.tgz",
"integrity": "sha512-Efhp4cn6LjDqyG8y/BAyQxgIiQA9dx48DArsYc4cKqzj3yxD0VjFrXlxUeFqU/y5HGMNHYjkA7CPauNXG8WYsg==",
"requires": {
"fast-text-encoding": "^1.0.0"
}
},
"core-js": {
"version": "2.5.7",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz",
......@@ -76,10 +108,10 @@
"integrity": "sha512-Goilx/2cfU9vvfQjgtNgc2VmJAD8CasQ6rZDqCd2u4Hsyd/qFET6nBf60jiHodevR3nl3IGzNKtrzPXWP88utQ==",
"dev": true,
"requires": {
"he": "1.1.1",
"mime": "1.6.0",
"minimist": "1.2.0",
"url-join": "2.0.5"
"he": "^1.1.1",
"mime": "^1.4.1",
"minimist": "^1.1.0",
"url-join": "^2.0.2"
}
},
"eventemitter3": {
......@@ -88,13 +120,18 @@
"integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==",
"dev": true
},
"fast-text-encoding": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.0.tgz",
"integrity": "sha512-R9bHCvweUxxwkDwhjav5vxpFvdPGlVngtqmx4pIZfSUhM/Q4NiIUHB456BAf+Q1Nwu3HEZYONtu+Rya+af4jiQ=="
},
"follow-redirects": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.0.tgz",
"integrity": "sha512-fdrt472/9qQ6Kgjvb935ig6vJCuofpBUD14f9Vb+SLlm7xIe4Qva5gey8EKtv8lp7ahE1wilg3xL1znpVGtZIA==",
"dev": true,
"requires": {
"debug": "3.1.0"
"debug": "^3.1.0"
}
},
"he": {
......@@ -109,9 +146,9 @@
"integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==",
"dev": true,
"requires": {
"eventemitter3": "3.1.0",
"follow-redirects": "1.5.0",
"requires-port": "1.0.0"
"eventemitter3": "^3.0.0",
"follow-redirects": "^1.0.0",
"requires-port": "^1.0.0"
}
},
"http-server": {
......@@ -121,13 +158,13 @@
"dev": true,
"requires": {
"colors": "1.0.3",
"corser": "2.0.1",
"ecstatic": "3.2.0",
"http-proxy": "1.17.0",
"opener": "1.4.3",
"optimist": "0.6.1",
"portfinder": "1.0.13",
"union": "0.4.6"
"corser": "~2.0.0",
"ecstatic": "^3.0.0",
"http-proxy": "^1.8.1",
"opener": "~1.4.0",
"optimist": "0.6.x",
"portfinder": "^1.0.13",
"union": "~0.4.3"
}
},
"jsrsasign": {
......@@ -170,15 +207,6 @@
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"oidc-client": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/oidc-client/-/oidc-client-1.5.1.tgz",
"integrity": "sha512-zYVzVPUEXIDHc1dCf+ETC2PGQ6PK6l0H+YRfogz2gD2dq+JdXcZFnfdWTyExjMgJJ/bHrvkfLjk8g5+9B/QrtA==",
"requires": {
"babel-polyfill": "6.26.0",
"jsrsasign": "8.0.12"
}
},
"opener": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz",
......@@ -191,8 +219,8 @@
"integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
"dev": true,
"requires": {
"minimist": "0.0.10",
"wordwrap": "0.0.3"
"minimist": "~0.0.1",
"wordwrap": "~0.0.2"
},
"dependencies": {
"minimist": {
......@@ -209,9 +237,9 @@
"integrity": "sha1-uzLs2HwnEErm7kS1o8y/Drsa7ek=",
"dev": true,
"requires": {
"async": "1.5.2",
"debug": "2.6.9",
"mkdirp": "0.5.1"
"async": "^1.5.2",
"debug": "^2.2.0",
"mkdirp": "0.5.x"
},
"dependencies": {
"debug": {
......@@ -249,7 +277,7 @@
"integrity": "sha1-GY+9rrolTniLDvy2MLwR8kopWeA=",
"dev": true,
"requires": {
"qs": "2.3.3"
"qs": "~2.3.3"
}
},
"url-join": {
......
{
"name": "chat.component.dev",
"version": "1.0.0",
"name": "@startinblox/component-chat",
"version": "0.0.0",
"description": "XMPP Chat Web Component",
"main": "index.html",
"main": "sib-chat.js",
"repository": {
"type": "git",
"url": "git@git.happy-dev.fr:startinblox/components/sib-chat.git"
},
"author": "Alexandre Bourlier",
"license": "MIT",
"release": {
"branch": "master",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{
"type": "major",
"release": "major"
},
{
"type": "minor",
"release": "minor"
},
{
"type": "/.*/",
"release": "patch"
}
]
}
],
"@semantic-release/gitlab",
"@semantic-release/npm"
]
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@webcomponents/webcomponentsjs": "^1.2.0",
"oidc-client": "^1.5.1"
"@startinblox/oidc": "^0.5.0",
"@startinblox/core": "^0.5.0",
"converse.js": "^4.1.0"
},
"devDependencies": {
"http-server": "^0.11.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Alexandre Bourlier",
"license": "MIT"
}
}
import './3rdparty/converse.js';
import { importCSS } from 'https://cdn.happy-dev.fr/sib-core/helpers.js';
import { SIBBase } from "https://cdn.happy-dev.fr/sib-core/sib-base.js"
import { store } from "https://cdn.happy-dev.fr/sib-core/store.js"
import 'https://unpkg.com/converse.js@4.1/dist/converse.min.js';
import { importCSS } from 'https://unpkg.com/@startinblox/core@0.5.7/src/helpers/index.js';
import SIBBase from 'https://unpkg.com/@startinblox/core@0.5.7/src/parents/sib-base.js';
import { store } from 'https://unpkg.com/@startinblox/core@0.5.7/src/store.js';
const base_url = import.meta.url.replace(/\/[^\/]*$/, '');
importCSS(
`${base_url}/3rdparty/converse-font-awesome.css`,
);
class ConversePlugin {
export class ConversePlugin {
changeChat(jid, is_groupchat = false, root) {
if (!jid) {
return;
......@@ -32,12 +28,19 @@ class ConversePlugin {
}
}
class ChatWindow extends SIBBase {
export class ChatWindow extends SIBBase {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.shadowRoot.append(
...importCSS(`${base_url}/3rdparty/converse.css`, `${base_url}/converse-embed.css`),
...importCSS(
'https://unpkg.com/converse.js@4.1.0/css/converse.min.css',
`${base_url}/converse-embed.css`,
),
);
// Dirty fix. @see https://stackoverflow.com/questions/33696169/chrome-extension-font-awesome-wont-display-in-shadow-root
importCSS(
'https://unpkg.com/converse.js@4.1.0/css/fonts.css'
);
if (typeof window.converse === 'undefined') {
window.converseLoaded = new Promise((resolve, reject) =>
......@@ -93,6 +96,7 @@ class ChatWindow extends SIBBase {
locales_url: this.dataset.localesUrl,
whitelisted_plugins: ['sib-chat'],
view_mode: 'embedded',
sounds_path: 'https://unpkg.com/converse.js@4.1.0/sounds/',
});
window.converseInitialized.resolve();
}
......@@ -102,8 +106,7 @@ class ChatWindow extends SIBBase {
}
}
String.prototype.wasRegistered = function() {
// https://stackoverflow.com/questions/27334365/how-to-get-list-of-registered-custom-elements
export function customElementIsRegistered(name) {
switch (document.createElement(this).constructor) {
case HTMLElement:
return false;
......@@ -111,8 +114,8 @@ String.prototype.wasRegistered = function() {
return undefined;
}
return true;
};
}
if (!'sib-chat'.wasRegistered()) {
if (!customElementIsRegistered('sib-chat')) {
window.customElements.define('sib-chat', ChatWindow);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment