@saooti/octopus-sdk 39.0.30 → 39.0.32

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": "@saooti/octopus-sdk",
3
- "version": "39.0.30",
3
+ "version": "39.0.32",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -42,6 +42,7 @@ export default defineComponent({
42
42
  icon: { default: undefined, type: String },
43
43
  imageUrl: { default: undefined, type: String },
44
44
  displayAccordion: { default: true, type: Boolean },
45
+ initOpen: { default: false, type: Boolean },
45
46
  },
46
47
  emits: ["open"],
47
48
  data() {
@@ -54,6 +55,9 @@ export default defineComponent({
54
55
  this.$emit("open");
55
56
  },
56
57
  },
58
+ created(){
59
+ this.isOpen= this.initOpen;
60
+ }
57
61
  });
58
62
  </script>
59
63
  <style lang="scss">
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  ref="targetEl"
4
- :style="`min-height:${fixedMinHeight ? fixedMinHeight : minHeight}px`"
4
+ :style="`min-height:${minHeight}px`"
5
5
  >
6
6
  <slot v-if="shouldRender" />
7
7
  <slot v-else name="preview" />
@@ -9,7 +9,7 @@
9
9
  </template>
10
10
  <script lang="ts">
11
11
  import { useIntersectionObserver } from "@vueuse/core";
12
- import { ref, nextTick } from "vue";
12
+ import { ref, nextTick, watch } from "vue";
13
13
 
14
14
  function onIdle(cb = () => {}) {
15
15
  if ("requestIdleCallback" in window) {
@@ -38,17 +38,18 @@ export default {
38
38
  default: 10000,
39
39
  },
40
40
  },
41
- setup(props) {
41
+ emits:['isRender'],
42
+ setup(props, context) {
42
43
  const waitBeforeInit = ref(true);
43
44
  const shouldRender = ref(false);
44
45
  const targetEl = ref();
45
- const fixedMinHeight = ref(0);
46
+ //const fixedMinHeight = ref(0);
46
47
  let unrenderTimer: ReturnType<typeof setTimeout> | undefined;
47
48
  let renderTimer: ReturnType<typeof setTimeout> | undefined;
48
49
  setTimeout(() => {
49
50
  waitBeforeInit.value = false;
50
51
  }, props.initRenderDelay);
51
- const { stop } = useIntersectionObserver(
52
+ const { isActive, pause, resume } = useIntersectionObserver(
52
53
  targetEl,
53
54
  ([{ isIntersecting }]) => {
54
55
  if (waitBeforeInit.value) {
@@ -62,19 +63,20 @@ export default {
62
63
  renderTimer = setTimeout(
63
64
  () => {
64
65
  shouldRender.value = true;
66
+ context.emit('isRender', true);
65
67
  },
66
68
  props.unrender ? 200 : 0,
67
69
  );
68
- //shouldRender.value = true;
69
70
  if (!props.unrender) {
70
- stop();
71
+ pause();
71
72
  }
72
73
  } else if (props.unrender) {
73
74
  // if the component was set to render, cancel that
74
75
  clearTimeout(renderTimer);
75
76
  unrenderTimer = setTimeout(() => {
76
- fixedMinHeight.value = targetEl.value?.clientHeight ?? 0;
77
+ //fixedMinHeight.value = targetEl.value?.clientHeight ?? 0;
77
78
  shouldRender.value = false;
79
+ context.emit('isRender', false);
78
80
  }, props.unrenderDelay);
79
81
  }
80
82
  },
@@ -86,13 +88,24 @@ export default {
86
88
  if (props.renderOnIdle) {
87
89
  onIdle(() => {
88
90
  shouldRender.value = true;
91
+ context.emit('isRender', true);
89
92
  if (!props.unrender) {
90
- stop();
93
+ pause();
91
94
  }
92
95
  });
93
96
  }
97
+ watch(() => props.unrender, (newValue, oldValue) => {
98
+ if (newValue) {
99
+ clearTimeout(renderTimer);
100
+ unrenderTimer = setTimeout(() => {
101
+ shouldRender.value = false;
102
+ context.emit('isRender', false);
103
+ resume();
104
+ }, props.unrenderDelay);
105
+ }
106
+ });
94
107
 
95
- return { targetEl, shouldRender, fixedMinHeight };
108
+ return { targetEl, shouldRender/* , fixedMinHeight */};
96
109
  },
97
110
  };
98
111
  </script>
@@ -41,6 +41,7 @@ export const playerTranscript = defineComponent({
41
41
  11,
42
42
  `response/${this.playerPodcast.podcastId}`,
43
43
  );
44
+
44
45
  const arrayTranscript = this.parseSrt(result);
45
46
  const actualText =
46
47
  arrayTranscript?.[0]?.startTime === 0 ? arrayTranscript[0].text : "";
@@ -61,9 +62,11 @@ export const playerTranscript = defineComponent({
61
62
  if (transcript == null) {
62
63
  return;
63
64
  }
65
+ const pattern =
66
+ /(\d+)\n([\d:,]+)\s+-{2}>\s+([\d:,]+)\n([\s\S]*?(?=\n{2}|$))/gm;
64
67
  transcript = transcript.replace(/\r\n|\r|\n|\t/g, "\n");
65
68
  let matches;
66
- while ((matches = /(\d+)\n([\d:,]+)\s+-{2}>\s+([\d:,]+)\n([\s\S]*?(?=\n{2}|$))/gm.exec(transcript)) != null) {
69
+ while ((matches = pattern.exec(transcript)) != null) {
67
70
  result.push({
68
71
  startTime: this.srtTimeToSeconds(matches[2]),
69
72
  endTime: this.srtTimeToSeconds(matches[3]),
package/src/main.ts CHANGED
@@ -54,4 +54,22 @@ const pinia = createPinia();
54
54
  const app = createApp(App);
55
55
  // Initialisation store
56
56
  app.use(i18n).use(pinia).use(router).use(VueLazyLoad);
57
- app.mount("#app");
57
+ router.isReady().then(() => {
58
+ /* app.mixin({
59
+ beforeCreate() {
60
+ if (this.$options.watch) {
61
+ Object.entries(this.$options.watch).forEach(([watcherKey, func]) => {
62
+ // @ts-ignore
63
+ this.$options.watch[watcherKey] = new Proxy(func, {
64
+ apply(target, thisArg) {
65
+ let targetAny : any= target;
66
+ console.log(`Called watcher ${targetAny.name} on component ${thisArg.$options.name}`);
67
+ },
68
+ });
69
+ });
70
+ }
71
+ },
72
+ }); */
73
+ app.mount('#app');
74
+ })
75
+ //app.mount("#app");