Skip to content

Commit

Permalink
chore: update amazon-quicksight-embedding-sdk to version 2.5.0
Browse files Browse the repository at this point in the history
closes #2
  • Loading branch information
d-koppenhagen committed Nov 18, 2023
1 parent 86aaf46 commit 8706271
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 50 deletions.
25 changes: 21 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"not dead"
],
"dependencies": {
"amazon-quicksight-embedding-sdk": "2.3.1",
"amazon-quicksight-embedding-sdk": "2.5.0",
"nanoid": "5.0.3",
"vue": "3.3.8"
},
Expand Down
14 changes: 7 additions & 7 deletions src/components/VQuicksight.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup lang="ts">
import { createEmbeddingContext } from 'amazon-quicksight-embedding-sdk'
import type {
EmbeddingContext,
ExperienceFrameMetadata,
SimpleChangeEvent
} from 'amazon-quicksight-embedding-sdk/dist/types'
import {
createEmbeddingContext,
type EmbeddingContext,
type ExperienceFrameMetadata,
type EmbeddingEvents
} from 'amazon-quicksight-embedding-sdk'
import { onBeforeMount, provide, ref } from 'vue'
import { EmbeddingContextInjectionKey } from '../symbols'
Expand All @@ -18,7 +18,7 @@ withDefaults(
)
const emit = defineEmits<{
(e: 'change', data: { changeEvent: SimpleChangeEvent; metadata?: ExperienceFrameMetadata }): void
(e: 'change', data: { changeEvent: EmbeddingEvents; metadata?: ExperienceFrameMetadata }): void
}>()
const embeddingContext = ref<EmbeddingContext>()
Expand Down
13 changes: 6 additions & 7 deletions src/components/VQuicksightConsole.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
import type { VQuicksightConsoleContentOptions, VQuicksightFrameOptions } from '../types'
import type {
ConsoleContentOptions,
ConsoleFrame,
ConsoleExperience,
EmbeddingContext,
ExperienceFrameMetadata,
FrameOptions,
SimpleChangeEvent,
SimpleMessageEvent
} from 'amazon-quicksight-embedding-sdk/dist/types'
EmbeddingEvents
} from 'amazon-quicksight-embedding-sdk'
import { nanoid } from 'nanoid'
import type { Ref } from 'vue'
import { computed, inject, ref, watch } from 'vue'
Expand All @@ -30,16 +29,16 @@ const props = withDefaults(
)
const emit = defineEmits<{
(e: 'change', data: { changeEvent: SimpleChangeEvent; metadata?: ExperienceFrameMetadata }): void
(e: 'change', data: { changeEvent: EmbeddingEvents; metadata?: ExperienceFrameMetadata }): void
(
e: 'message',
data: { messageEvent: SimpleMessageEvent; experienceMetadata?: ExperienceFrameMetadata }
data: { messageEvent: EmbeddingEvents; experienceMetadata?: ExperienceFrameMetadata }
): void
}>()
const embeddingContext = inject<Ref<EmbeddingContext>>(EmbeddingContextInjectionKey)
const consoleFrame = ref<ConsoleFrame>()
const consoleFrame = ref<ConsoleExperience>()
const containerId = computed(() => props.id || `v-quicksight-console-${nanoid(6)}`)
const frameOptions = computed<FrameOptions>(() => {
Expand Down
17 changes: 8 additions & 9 deletions src/components/VQuicksightDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
import type { VQuicksightDashboardContentOptions, VQuicksightFrameOptions } from '../types'
import type {
DashboardContentOptions,
DashboardFrame,
DashboardExperience,
EmbeddingContext,
ExperienceFrameMetadata,
FrameOptions,
Parameter,
SimpleChangeEvent,
SimpleMessageEvent
} from 'amazon-quicksight-embedding-sdk/dist/types'
EmbeddingEvents
} from 'amazon-quicksight-embedding-sdk'
import { nanoid } from 'nanoid'
import type { Ref } from 'vue'
import { computed, inject, ref, watch } from 'vue'
Expand Down Expand Up @@ -37,16 +36,16 @@ const props = withDefaults(
)
const emit = defineEmits<{
(e: 'change', data: { changeEvent: SimpleChangeEvent; metadata?: ExperienceFrameMetadata }): void
(e: 'change', data: { changeEvent: EmbeddingEvents; metadata?: ExperienceFrameMetadata }): void
(
e: 'message',
data: { messageEvent: SimpleMessageEvent; experienceMetadata?: ExperienceFrameMetadata }
data: { messageEvent: EmbeddingEvents; experienceMetadata?: ExperienceFrameMetadata }
): void
}>()
const embeddingContext = inject<Ref<EmbeddingContext>>(EmbeddingContextInjectionKey)
const dashboardFrame = ref<DashboardFrame>()
const dashboardFrame = ref<DashboardExperience>()
const changedDashboard = ref<string>()
const containerId = computed(() => props.id || `v-quicksight-dashboard-${nanoid(6)}`)
Expand Down Expand Up @@ -84,13 +83,13 @@ async function embedDashboard(ctx: EmbeddingContext, dashboard?: string) {
}
}
async function navigateToDashboard(frame: DashboardFrame, dashboard: string) {
async function navigateToDashboard(frame: DashboardExperience, dashboard: string) {
await frame.navigateToDashboard(dashboard, {
parameters: props.parameters
})
}
async function setParameters(frame: DashboardFrame, parameters: Parameter[]) {
async function setParameters(frame: DashboardExperience, parameters: Parameter[]) {
return await frame.setParameters(parameters)
}
Expand Down
15 changes: 7 additions & 8 deletions src/components/VQuicksightSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
import type { VQuicksightSearchContentOptions, VQuicksightFrameOptions } from '../types'
import type {
QSearchContentOptions,
QSearchFrame,
QSearchExperience,
EmbeddingContext,
ExperienceFrameMetadata,
FrameOptions,
SimpleChangeEvent,
SimpleMessageEvent
} from 'amazon-quicksight-embedding-sdk/dist/types'
EmbeddingEvents
} from 'amazon-quicksight-embedding-sdk'
import { nanoid } from 'nanoid'
import type { Ref } from 'vue'
import { computed, inject, ref, watch } from 'vue'
Expand All @@ -33,16 +32,16 @@ const props = withDefaults(
)
const emit = defineEmits<{
(e: 'change', data: { changeEvent: SimpleChangeEvent; metadata?: ExperienceFrameMetadata }): void
(e: 'change', data: { changeEvent: EmbeddingEvents; metadata?: ExperienceFrameMetadata }): void
(
e: 'message',
data: { messageEvent: SimpleMessageEvent; experienceMetadata?: ExperienceFrameMetadata }
data: { messageEvent: EmbeddingEvents; experienceMetadata?: ExperienceFrameMetadata }
): void
}>()
const embeddingContext = inject<Ref<EmbeddingContext>>(EmbeddingContextInjectionKey)
const searchFrame = ref<QSearchFrame>()
const searchFrame = ref<QSearchExperience>()
const containerId = computed(() => props.id || `v-quicksight-search-${nanoid(6)}`)
const frameOptions = computed<FrameOptions>(() => {
Expand Down Expand Up @@ -73,7 +72,7 @@ async function embedSearch(ctx: EmbeddingContext) {
searchFrame.value = await ctx.embedQSearchBar(frameOptions.value, contentOptions.value)
}
async function setQuestion(frame: QSearchFrame, question?: string) {
async function setQuestion(frame: QSearchExperience, question?: string) {
if (question) {
return await frame.setQuestion(question)
} else {
Expand Down
15 changes: 7 additions & 8 deletions src/components/VQuicksightVisual.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import type {
ExperienceFrameMetadata,
FrameOptions,
Parameter,
SimpleChangeEvent,
SimpleMessageEvent,
EmbeddingEvents,
VisualContentOptions,
VisualFrame
} from 'amazon-quicksight-embedding-sdk/dist/types'
VisualExperience
} from 'amazon-quicksight-embedding-sdk'
import { nanoid } from 'nanoid'
import type { Ref } from 'vue'
import { computed, inject, ref, watch } from 'vue'
Expand All @@ -33,16 +32,16 @@ const props = withDefaults(
)
const emit = defineEmits<{
(e: 'change', data: { changeEvent: SimpleChangeEvent; metadata?: ExperienceFrameMetadata }): void
(e: 'change', data: { changeEvent: EmbeddingEvents; metadata?: ExperienceFrameMetadata }): void
(
e: 'message',
data: { messageEvent: SimpleMessageEvent; experienceMetadata?: ExperienceFrameMetadata }
data: { messageEvent: EmbeddingEvents; experienceMetadata?: ExperienceFrameMetadata }
): void
}>()
const embeddingContext = inject<Ref<EmbeddingContext>>(EmbeddingContextInjectionKey)
const visualFrame = ref<VisualFrame>()
const visualFrame = ref<VisualExperience>()
const containerId = computed(() => props.id || `v-quicksight-visual-${nanoid(6)}`)
const frameOptions = computed<FrameOptions>(() => {
Expand Down Expand Up @@ -74,7 +73,7 @@ async function embedVisual(ctx: EmbeddingContext) {
visualFrame.value = await ctx.embedVisual(frameOptions.value, contentOptions.value)
}
async function setParameters(frame: VisualFrame, parameters: Parameter[]) {
async function setParameters(frame: VisualExperience, parameters: Parameter[]) {
return await frame.setParameters(parameters)
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/__tests__/VQuicksightDashboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('VQuicksightDashboard', () => {
it('should call navigateToDashboard when the passed dashboard name changes', async () => {
const { dashboardFrame, component } = setupComponent()
await nextTick() // wait until first setup is finished
await component.setProps({ dashboard: 'another-dashboard' })
await component.setProps({ url: '', dashboard: 'another-dashboard' })
expect(dashboardFrame.navigateToDashboard).toHaveBeenCalledOnce()
expect(dashboardFrame.navigateToDashboard).toHaveBeenCalledWith('another-dashboard', {
parameters: []
Expand All @@ -120,7 +120,7 @@ describe('VQuicksightDashboard', () => {
it('should call setParameters when the passed parameters are changing', async () => {
const { dashboardFrame, component } = setupComponent()
await nextTick() // wait until first setup is finished
await component.setProps({ parameters: contentOptions.parameters })
await component.setProps({ url: '', parameters: contentOptions.parameters })
expect(dashboardFrame.setParameters).toHaveBeenCalledOnce()
expect(dashboardFrame.setParameters).toHaveBeenCalledWith(contentOptions.parameters)
})
Expand All @@ -129,6 +129,7 @@ describe('VQuicksightDashboard', () => {
const { dashboardFrame, component } = setupComponent()
await nextTick() // wait until first setup is finished
await component.setProps({
url: '',
dashboard: 'another-dashboard',
parameters: contentOptions.parameters
})
Expand Down
4 changes: 2 additions & 2 deletions src/components/__tests__/VQuicksightSearch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ describe('VQuicksightSearch', () => {
it('should call setQuestion when the passed question name changes', async () => {
const { searchFrame, component } = setupComponent()
await nextTick() // wait until first setup is finished
await component.setProps({ question: 'How many apples were sold?' })
await component.setProps({ url: '', question: 'How many apples were sold?' })
expect(searchFrame.setQuestion).toHaveBeenCalledOnce()
expect(searchFrame.setQuestion).toHaveBeenCalledWith('How many apples were sold?')
})

it('should call close when the question changes to a nullish value', async () => {
const { searchFrame, component } = setupComponent({ question: 'How many apples were sold?' })
await nextTick() // wait until first setup is finished
await component.setProps({ question: '' })
await component.setProps({ url: '', question: '' })
expect(searchFrame.close).toHaveBeenCalled()
})
})
2 changes: 1 addition & 1 deletion src/components/__tests__/VQuicksightVisual.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('VQuicksightVisual', () => {
it('should call setParameters when the passed parameters are changing', async () => {
const { visualFrame, component } = setupComponent()
await nextTick() // wait until first setup is finished
await component.setProps({ parameters: contentOptions.parameters })
await component.setProps({ url: '', parameters: contentOptions.parameters })
expect(visualFrame.setParameters).toHaveBeenCalledOnce()
expect(visualFrame.setParameters).toHaveBeenCalledWith(contentOptions.parameters)
})
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
VisualContentOptions,
ConsoleContentOptions,
QSearchContentOptions
} from 'amazon-quicksight-embedding-sdk/dist/types'
} from 'amazon-quicksight-embedding-sdk'

export type VQuicksightFrameOptions = Omit<FrameOptions, 'onChange' | 'container'>
export type VQuicksightDashboardContentOptions = Omit<DashboardContentOptions, 'onMessage'>
Expand Down

0 comments on commit 8706271

Please sign in to comment.