@sedoo/unidoo 0.1.71 → 0.1.73

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sedoo/unidoo",
3
- "version": "0.1.71",
3
+ "version": "0.1.73",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "build": "npm run build:unidoo && npm run build:auth",
@@ -33,6 +33,7 @@
33
33
  "vue-custom-element": "^3.3.0"
34
34
  },
35
35
  "devDependencies": {
36
+ "caniuse-lite": "^1.0.30001741",
36
37
  "@vue/cli-plugin-babel": "^4.5.19",
37
38
  "@vue/cli-plugin-eslint": "^4.5.19",
38
39
  "@vue/cli-service": "^4.5.19",
package/src/auth.js CHANGED
@@ -5,8 +5,10 @@ const UnidooKeycloak = {
5
5
  if (this.installed) return;
6
6
  this.installed = true;
7
7
 
8
- const Keycloak =
9
- typeof window !== "undefined" ? require("keycloak-js") : null;
8
+ let Keycloak = null;
9
+ if (typeof window !== "undefined") {
10
+ Keycloak = require("keycloak-js") || null;
11
+ }
10
12
 
11
13
  /**
12
14
  * Init keycloak with SSO parameters
@@ -20,27 +22,29 @@ const UnidooKeycloak = {
20
22
  };
21
23
  defaultOptions = { ...options };
22
24
 
23
- const keycloak = Keycloak(defaultOptions.ssoParams);
24
- Vue.prototype.$keycloak = keycloak;
25
-
26
- keycloak
27
- .init({
28
- onLoad: defaultOptions.ssoParams.onLoad,
29
- promiseType: "native",
30
- checkLoginIframe: false
31
- })
32
- .then(() => {
33
- // Intercepteur qui ajoute le token aux requêtes
34
- interceptRequests(
35
- axios,
36
- defaultOptions.ssoParams.authorizedDomains,
37
- keycloak
38
- );
39
- updateSSoToken(keycloak);
40
- })
41
- .catch((err) => {
42
- throw new Error(err);
43
- });
25
+ if (Keycloak) {
26
+ const keycloak = Keycloak(defaultOptions.ssoParams);
27
+ Vue.prototype.$keycloak = keycloak;
28
+
29
+ keycloak
30
+ .init({
31
+ onLoad: defaultOptions.ssoParams.onLoad,
32
+ promiseType: "native",
33
+ checkLoginIframe: false
34
+ })
35
+ .then(() => {
36
+ // Intercepteur qui ajoute le token aux requêtes
37
+ interceptRequests(
38
+ axios,
39
+ defaultOptions.ssoParams.authorizedDomains,
40
+ keycloak
41
+ );
42
+ updateSSoToken(keycloak);
43
+ })
44
+ .catch((err) => {
45
+ throw new Error(err);
46
+ });
47
+ }
44
48
  };
45
49
 
46
50
  /**
@@ -55,21 +59,23 @@ const UnidooKeycloak = {
55
59
  };
56
60
  defaultOptions = { ...options };
57
61
 
58
- const keycloak = Keycloak(defaultOptions.ssoParams);
59
- Vue.prototype.$keycloak = keycloak;
60
-
61
- keycloak
62
- .init({
63
- onLoad: "check-sso",
64
- promiseType: "native",
65
- checkLoginIframe: false
66
- })
67
- .then(() => {
68
- updateSSoToken(keycloak);
69
- })
70
- .catch((err) => {
71
- throw new Error(err);
72
- });
62
+ if (Keycloak) {
63
+ const keycloak = Keycloak(defaultOptions.ssoParams);
64
+ Vue.prototype.$keycloak = keycloak;
65
+
66
+ keycloak
67
+ .init({
68
+ onLoad: "check-sso",
69
+ promiseType: "native",
70
+ checkLoginIframe: false
71
+ })
72
+ .then(() => {
73
+ updateSSoToken(keycloak);
74
+ })
75
+ .catch((err) => {
76
+ throw new Error(err);
77
+ });
78
+ }
73
79
  };
74
80
  }
75
81
  };
@@ -1,39 +1,34 @@
1
1
  <template>
2
- <span >
3
- <div ref="captcha"></div>
4
- <div>
5
- <v-text-field
6
- :label="textFieldLabel"
7
- v-model ="text"
8
- ></v-text-field>
9
- <v-btn :color="color" @click="refresh">{{refreshButtonLabel}}</v-btn>
10
- </div>
2
+ <span>
3
+ <div ref="captcha"></div>
4
+ <div>
5
+ <v-text-field :label="textFieldLabel" v-model="text"></v-text-field>
6
+ <v-btn :color="color" @click="refresh">{{ refreshButtonLabel }}</v-btn>
7
+ </div>
11
8
  </span>
12
9
  </template>
13
10
 
14
11
  <script>
15
-
16
12
  export default {
17
- components: {
18
- },
19
-
13
+ components: {},
14
+
20
15
  watch: {
21
16
  valid: function (value) {
22
- this.$emit('input', value)
17
+ this.$emit("input", value);
23
18
  }
24
19
  },
25
-
26
- data () {
20
+
21
+ data() {
27
22
  return {
28
23
  captcha: [],
29
24
  width: 0,
30
25
  text: ""
31
- }
26
+ };
32
27
  },
33
28
  computed: {
34
29
  valid: function () {
35
30
  if (this.captchaText === this.text) {
36
- return true;
31
+ return true;
37
32
  }
38
33
  return false;
39
34
  },
@@ -42,72 +37,71 @@ export default {
42
37
  }
43
38
  },
44
39
  methods: {
45
-
46
40
  refresh() {
47
- this.text = ""
41
+ this.text = "";
48
42
  this.generateCaptcha();
49
43
  },
50
44
 
51
45
  generateCaptcha() {
52
- const captcha = [];
53
- const charsArray =
54
- "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*";
55
- const size = Number.parseInt(this.size)
56
- for (var i = 0; i < size; i++) {
57
- // Eviter la repetition des characters
58
- var index = Math.floor(Math.random() * charsArray.length + 1);
59
- if (captcha.indexOf(charsArray[index]) === -1) { captcha.push(charsArray[index]); } else i--;
46
+ if (typeof document !== "undefined") {
47
+ const captcha = [];
48
+ const charsArray =
49
+ "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*";
50
+ const size = Number.parseInt(this.size);
51
+ for (var i = 0; i < size; i++) {
52
+ // Eviter la repetition des characters
53
+ var index = Math.floor(Math.random() * charsArray.length + 1);
54
+ if (captcha.indexOf(charsArray[index]) === -1) {
55
+ captcha.push(charsArray[index]);
56
+ } else i--;
60
57
  }
61
58
  this.width = 20 * captcha.length;
62
59
  this.captcha = captcha;
63
60
 
64
- var canv = document.createElement("canvas");
65
- canv.id = "canvas";
66
- canv.width = this.width;
67
- canv.height = 50;
68
- var ctx = canv.getContext("2d");
69
- ctx.font = "25px Georgia";
70
- ctx.strokeText(this.captcha.join(""), 0, 30);
61
+ var canv = document.createElement("canvas");
62
+ canv.id = "canvas";
63
+ canv.width = this.width;
64
+ canv.height = 50;
65
+ var ctx = canv.getContext("2d");
66
+ ctx.font = "25px Georgia";
67
+ ctx.strokeText(this.captcha.join(""), 0, 30);
71
68
 
72
- const captchaElement = this.$refs.captcha
69
+ const captchaElement = this.$refs.captcha;
73
70
 
74
- if (captchaElement != null) {
75
- captchaElement.innerHTML = "";
76
- captchaElement.appendChild(canv);
77
- }
71
+ if (captchaElement != null) {
72
+ captchaElement.innerHTML = "";
73
+ captchaElement.appendChild(canv);
74
+ }
75
+ }
78
76
  }
79
77
  },
80
- beforeMount () {
81
- },
78
+ beforeMount() {},
82
79
  mounted() {
83
- this.generateCaptcha()
80
+ this.generateCaptcha();
84
81
  },
85
82
 
86
- props: {
87
- size: {
88
- type: String,
89
- default: "6"
90
- },
91
- color: {
92
- type: String,
93
- default: "primary"
94
- },
95
- value: {
96
- type: Boolean
97
- },
98
- textFieldLabel: {
99
- type: String,
100
- default: "Text"
101
- },
102
- refreshButtonLabel: {
103
- type: String,
104
- default: "Refresh"
105
- },
83
+ props: {
84
+ size: {
85
+ type: String,
86
+ default: "6"
106
87
  },
107
-
108
- }
88
+ color: {
89
+ type: String,
90
+ default: "primary"
91
+ },
92
+ value: {
93
+ type: Boolean
94
+ },
95
+ textFieldLabel: {
96
+ type: String,
97
+ default: "Text"
98
+ },
99
+ refreshButtonLabel: {
100
+ type: String,
101
+ default: "Refresh"
102
+ }
103
+ }
104
+ };
109
105
  </script>
110
106
 
111
- <style scoped>
112
-
113
- </style>
107
+ <style scoped></style>
@@ -117,12 +117,11 @@
117
117
  </div>
118
118
  </template>
119
119
  <script>
120
-
121
120
  export default {
122
121
  props: {
123
122
  onlyUpdate: {
124
123
  type: Boolean,
125
- default: false,
124
+ default: false
126
125
  },
127
126
  columns: {
128
127
  type: Array,
@@ -132,17 +131,17 @@ export default {
132
131
  },
133
132
  title: {
134
133
  type: String,
135
- default: "",
134
+ default: ""
136
135
  },
137
136
  url: {
138
137
  type: String,
139
- default: "",
140
- },
138
+ default: ""
139
+ }
141
140
  },
142
141
  computed: {
143
142
  titleEdit() {
144
143
  return this.editedItemIndex === -1 ? "Add new item" : "Edit item";
145
- },
144
+ }
146
145
  },
147
146
  data() {
148
147
  return {
@@ -155,7 +154,7 @@ export default {
155
154
  defaultItem: {},
156
155
  tabledata: [],
157
156
  uniquesourcevalues: [],
158
- error: false,
157
+ error: false
159
158
  };
160
159
  },
161
160
  watch: {
@@ -164,7 +163,7 @@ export default {
164
163
  },
165
164
  itemDeleteDialog(val) {
166
165
  val || this.close();
167
- },
166
+ }
168
167
  },
169
168
  created() {
170
169
  this.show();
@@ -214,7 +213,10 @@ export default {
214
213
  .then(() => {
215
214
  this.axios.get(this.url).then((res) => (this.alldata = res.data));
216
215
  })
217
- .then(() => this.close());
216
+ .then(() => this.close())
217
+ .catch((e) => {
218
+ console.error(e);
219
+ });
218
220
  },
219
221
  saveItem() {
220
222
  if (this.editedItemIndex > -1) {
@@ -223,18 +225,22 @@ export default {
223
225
  .then(() => {
224
226
  this.axios.get(this.url).then((res) => (this.alldata = res.data));
225
227
  })
226
- .then(() => this.close());
228
+ .then(() => this.close())
229
+ .catch((e) => {
230
+ console.error(e);
231
+ });
227
232
  } else {
228
233
  this.axios
229
234
  .post(this.url + "/create", this.editedItem)
230
235
  .then(() => {
231
236
  this.axios.get(this.url).then((res) => (this.alldata = res.data));
232
237
  })
233
- .then(() => this.close());
238
+ .then(() => this.close())
239
+ .catch((e) => {
240
+ console.error(e);
241
+ });
234
242
  }
235
- },
236
- },
243
+ }
244
+ }
237
245
  };
238
246
  </script>
239
- <style scoped>
240
- </style>