@saooti/octopus-sdk 31.0.12 → 31.0.15

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/README.md CHANGED
@@ -587,3 +587,6 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
587
587
  * 31.0.10 Sécurisation
588
588
  * 31.0.11 Sécurisation
589
589
  * 31.0.12 Commentaires Events
590
+ * 31.0.13 Update/delete Libraries
591
+ * 31.0.14 Lazy loading lang
592
+ * 31.0.15 Error select productor filter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "31.0.12",
3
+ "version": "31.0.15",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -14,51 +14,45 @@
14
14
  },
15
15
  "main": "./dist/octopus.common.js",
16
16
  "dependencies": {
17
- "@popperjs/core": "^2.11.0",
18
17
  "@saooti/octopus-api": "^0.31.2",
19
- "@vue/cli": "^5.0.0-rc.1",
20
- "@vue/compat": "^3.2.26",
18
+ "@vue/cli": "^5.0.4",
19
+ "@vue/compat": "^3.2.31",
21
20
  "axios": "^0.24.0",
22
21
  "bootstrap": "^5.1.3",
23
- "core-js": "^3.19.01",
24
- "hls.js": "^1.0.12",
25
- "humanize-duration": "^3.27.0",
26
- "jquery": "^3.6.0",
27
- "luxon": "^2.1.0",
28
- "moment": "^2.29.1",
22
+ "core-js": "^3.21.1",
23
+ "hls.js": "^1.1.5",
24
+ "humanize-duration": "^3.27.1",
25
+ "jquery": "^3.5.14",
26
+ "moment": "^2.29.2",
29
27
  "moment-locales-webpack-plugin": "^1.2.0",
30
- "popper.js": "^1.16.1",
31
28
  "qrcode.vue": "^3.3.3",
32
- "sass": "^1.43.4",
33
- "sass-loader": "^12.3.0",
34
- "v-calendar": "^3.0.0-alpha.6",
35
- "vue": "^3.2.21",
36
- "vue-i18n": "^9.2.0-beta.17",
29
+ "sass": "^1.49.11",
30
+ "sass-loader": "^12.6.0",
31
+ "v-calendar": "^3.0.0-alpha.8",
32
+ "vue": "^3.2.31",
33
+ "vue-i18n": "^9.2.0-beta.34",
37
34
  "vue-multiselect": "^3.0.0-alpha.2",
38
35
  "vue-recaptcha-v3": "^2.0.1",
39
- "vue-router": "^4.0.12",
36
+ "vue-router": "^4.0.14",
40
37
  "vue3-lazyload": "^0.2.5-beta",
41
- "vue3-swatches": "^1.0.5",
38
+ "vue3-swatches": "^1.0.7",
42
39
  "vuex": "^4.0.2",
43
- "webpack": "^5.66.0"
40
+ "webpack": "^5.71.0"
44
41
  },
45
42
  "devDependencies": {
46
43
  "@types/bootstrap": "^5.1.8",
47
- "@types/hls.js": "^1.0.0",
48
- "@types/jquery": "^3.5.11",
49
- "@types/vue-datetime": "^1.0.1",
50
- "@typescript-eslint/eslint-plugin": "^5.8.1",
51
- "@typescript-eslint/parser": "^5.8.1",
52
- "@vue/cli-plugin-babel": "^5.0.0-rc.1",
53
- "@vue/cli-plugin-eslint": "^5.0.0-rc.1",
54
- "@vue/cli-plugin-typescript": "^5.0.0-rc.1",
55
- "@vue/cli-service": "^5.0.0-rc.1",
56
- "@vue/compiler-sfc": "^3.2.26",
44
+ "@types/jquery": "^3.5.14",
45
+ "@typescript-eslint/eslint-plugin": "^5.17.0",
46
+ "@typescript-eslint/parser": "^5.17.0",
47
+ "@vue/cli-plugin-babel": "^5.0.4",
48
+ "@vue/cli-plugin-eslint": "^5.0.4",
49
+ "@vue/cli-plugin-typescript": "^5.0.4",
50
+ "@vue/cli-service": "^5.0.4",
51
+ "@vue/compiler-sfc": "^3.2.31",
57
52
  "@vue/eslint-config-typescript": "^8.0.0",
58
- "babel-eslint": "^10.1.0",
59
- "eslint": "^8.2.0",
53
+ "eslint": "^8.12.0",
60
54
  "eslint-plugin-vue": "^7.20.0",
61
- "typescript": "^4.5.4"
55
+ "typescript": "^4.6.3"
62
56
  },
63
57
  "eslintConfig": {
64
58
  "parser": "vue-eslint-parser",
@@ -185,7 +185,6 @@ export default defineComponent({
185
185
  comItem.receiveCommentEvent(data);
186
186
  return;
187
187
  }
188
- const updatedStatus = data.comment.status;
189
188
  const index = this.findCommentIndex(data.comment.comId);
190
189
  if (-1 !== index) {
191
190
  if ((!this.editRight && 'Valid' !== data.comment.status) ||
@@ -119,7 +119,7 @@ export default defineComponent({
119
119
  this.keepOrganisation = false;
120
120
  if (organisation && organisation.id) {
121
121
  this.$emit('updateOrganisationId', organisation.id);
122
- if(organisation.privacy){
122
+ if("PUBLIC"!==organisation.privacy){
123
123
  this.$nextTick(() => {
124
124
  this.onKeepOrganisation();
125
125
  });
@@ -18,7 +18,7 @@
18
18
  frameborder="0"
19
19
  :width="iFrameWidth"
20
20
  :height="iFrameHeight"
21
- class="max-iframe"
21
+ class="max-iframe my-2"
22
22
  />
23
23
  <div class="d-flex flex-column">
24
24
  <button
@@ -26,6 +26,7 @@
26
26
  </template>
27
27
 
28
28
  <script lang="ts">
29
+ // @ts-ignore
29
30
  import VSwatches from 'vue3-swatches';
30
31
  import { defineComponent } from 'vue';
31
32
  export default defineComponent({
@@ -142,9 +142,11 @@
142
142
  </template>
143
143
 
144
144
  <script lang="ts">
145
+ import { cookies } from '../mixins/functions';
145
146
  import ClassicSelect from '../form/ClassicSelect.vue';
146
147
  import Player from './Player.vue';
147
148
  import { state } from '../../store/paramStore';
149
+ import {loadLocaleMessages} from '@/i18n';
148
150
  import octopusApi from '@saooti/octopus-api';
149
151
  import moment from 'moment';
150
152
  import { Category } from '@/store/class/general/category';
@@ -157,6 +159,8 @@ export default defineComponent({
157
159
  ClassicSelect
158
160
  },
159
161
 
162
+ mixins:[cookies],
163
+
160
164
  data() {
161
165
  return {
162
166
  language: this.$i18n.locale as string,
@@ -199,7 +203,8 @@ export default defineComponent({
199
203
  }
200
204
  },
201
205
  changeLanguage(): void{
202
- this.$i18n.locale= this.language;
206
+ this.setCookie('octopus-language', this.language);
207
+ loadLocaleMessages(this.$i18n, this.language, this.$store.state.general.isEducation);
203
208
  moment.locale(this.$i18n.locale);
204
209
  octopusApi.fetchCategories({ lang: this.$i18n.locale }).then((data: Array<Category>) => {
205
210
  this.$store.commit('categoriesSet', data);
@@ -91,6 +91,7 @@
91
91
  import ClassicCheckbox from '../../form/ClassicCheckbox.vue';
92
92
  import Snackbar from '../../misc/Snackbar.vue';
93
93
  import moment from 'moment';
94
+ // @ts-ignore
94
95
  import VSwatches from 'vue3-swatches';
95
96
  // @ts-ignore
96
97
  import humanizeDuration from 'humanize-duration';
package/src/i18n.ts ADDED
@@ -0,0 +1,36 @@
1
+
2
+ import { nextTick } from 'vue'
3
+ import { createI18n } from 'vue-i18n';
4
+
5
+
6
+ export function setupI18n(options = { locale: 'en' }, isEducation: boolean) {
7
+ const i18n = createI18n(options)
8
+ loadLocaleMessages(i18n.global, options.locale, isEducation);
9
+ return i18n;
10
+ }
11
+
12
+ export function setI18nLanguage(i18n: any, locale: string) {
13
+ i18n.locale = locale;
14
+ const html= document.querySelector('html');
15
+ if(html){
16
+ html.setAttribute('lang', locale);
17
+ }
18
+ }
19
+
20
+ export async function loadLocaleMessages(i18n: any, locale:string, isEducation: boolean) {
21
+ if(!i18n.messages[locale] || 0===Object.keys(i18n.messages[locale]).length){
22
+ let messages = await import(
23
+ `./locale/${locale}.ts`
24
+ )
25
+ messages = messages.default;
26
+ if(isEducation && ('fr'===locale || 'en'===locale)){
27
+ const messagesEdu = await import(
28
+ `./locale/education${locale}.ts`
29
+ );
30
+ messages ={...messages, ...messagesEdu.default};
31
+ }
32
+ i18n.setLocaleMessage(locale, messages);
33
+ }
34
+ setI18nLanguage(i18n, locale)
35
+ return nextTick();
36
+ }
package/src/main.ts CHANGED
@@ -2,50 +2,48 @@ import { createApp } from 'vue';
2
2
  import { VueReCaptcha } from 'vue-recaptcha-v3';
3
3
  import VueLazyLoad from 'vue3-lazyload';
4
4
  import App from './App.vue';
5
- import { createI18n, VueMessageType } from 'vue-i18n';
6
- import I18nResources from './locale/messages';
5
+ import {setupI18n} from './i18n';
7
6
  import router from '@/router/router';
8
7
  import moment from 'moment';
9
8
  import store from '@/store/AppStore';
10
9
  import paramStore from '@/store/paramStore';
11
- import { LocaleMessage } from '@intlify/core-base';
12
10
  /* import 'popper.js/dist/popper.min.js'; */
13
11
  /* import 'jquery/src/jquery.js'; */
14
12
  /* import 'jquery';
15
13
  import 'bootstrap/dist/js/bootstrap.bundle.min.js';
16
14
  */
17
15
 
16
+
18
17
  //TODO
19
- const navigatorLang = navigator.language /* || navigator.userLanguage */;
20
- let language = 'fr';
21
- if(navigatorLang.includes('en')){
22
- language = 'en';
23
- }else if(navigatorLang.includes('it')){
24
- language = 'it';
25
- }else if(navigatorLang.includes('sl')){
26
- language = 'sl';
27
- }else if(navigatorLang.includes('es')){
28
- language = 'es';
29
- }else if(navigatorLang.includes('de')){
30
- language = 'de';
18
+ const nameEQ = 'octopus-language=';
19
+ const ca = document.cookie.split(';');
20
+ let language = "";
21
+ for (let i = 0; i < ca.length; i++) {
22
+ let c = ca[i];
23
+ while (c.charAt(0) == ' ') c = c.substring(1, c.length);
24
+ if (0 === c.indexOf(nameEQ)){
25
+ language = c.substring(nameEQ.length, c.length);
26
+ break;
27
+ }
31
28
  }
32
- let messages: {[key: string]: LocaleMessage<VueMessageType>} = I18nResources;
33
- if (store.state.general.education) {
34
- messages = {
35
- fr: { ...I18nResources.fr, ...I18nResources.educationfr },
36
- en: { ...I18nResources.en, ...I18nResources.educationen },
37
- it: I18nResources.it,
38
- sl: I18nResources.it,
39
- es: I18nResources.es,
40
- de: I18nResources.de,
41
- };
29
+ if(0===language.length){
30
+ const navigatorLang = navigator.language /* || navigator.userLanguage */;
31
+ language = 'fr';
32
+ if(navigatorLang.includes('en')){
33
+ language = 'en';
34
+ }else if(navigatorLang.includes('it')){
35
+ language = 'it';
36
+ }else if(navigatorLang.includes('sl')){
37
+ language = 'sl';
38
+ }else if(navigatorLang.includes('es')){
39
+ language = 'es';
40
+ }else if(navigatorLang.includes('de')){
41
+ language = 'de';
42
+ }
42
43
  }
43
- const i18n = createI18n({
44
- locale: language,
45
- messages: messages,
46
- });
47
- moment.locale(language);
48
44
 
45
+ const i18n = setupI18n({locale: language}, store.state.general.education);
46
+ moment.locale(language);
49
47
 
50
48
  paramStore.initialize({
51
49
  generalParameters: {},