Skip to content

Commit

Permalink
method name updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mmitiche committed Apr 19, 2024
1 parent c9cd604 commit 86f4341
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 42 deletions.
24 changes: 12 additions & 12 deletions src/insight/insightClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,22 +585,22 @@ describe('InsightClient', () => {
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerShowAnswers, exampleGeneratedAnswerMetadata);
});

it('should send proper payload for #expandGeneratedAnswer', async () => {
it('should send proper payload for #generatedAnswerExpand', async () => {
const exampleGeneratedAnswerMetadata = {
generativeQuestionAnsweringId: '123',
};

await client.logExpandGeneratedAnswer(exampleGeneratedAnswerMetadata);
expectMatchCustomEventPayload(SearchPageEvents.expandGeneratedAnswer, exampleGeneratedAnswerMetadata);
await client.logGeneratedAnswerExpand(exampleGeneratedAnswerMetadata);
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerExpand, exampleGeneratedAnswerMetadata);
});

it('should send proper payload for #collapseGeneratedAnswer', async () => {
it('should send proper payload for #generatedAnswerCollapse', async () => {
const exampleGeneratedAnswerMetadata = {
generativeQuestionAnsweringId: '123',
};

await client.logCollapseGeneratedAnswer(exampleGeneratedAnswerMetadata);
expectMatchCustomEventPayload(SearchPageEvents.collapseGeneratedAnswer, exampleGeneratedAnswerMetadata);
await client.logGeneratedAnswerCollapse(exampleGeneratedAnswerMetadata);
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerCollapse, exampleGeneratedAnswerMetadata);
});

it('should send proper payload for #generatedAnswerFeedbackSubmit', async () => {
Expand Down Expand Up @@ -1358,7 +1358,7 @@ describe('InsightClient', () => {
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerShowAnswers, expectedMetadata);
});

it('should send proper payload for #expandGeneratedAnswer', async () => {
it('should send proper payload for #generatedAnswerExpand', async () => {
const exampleGeneratedAnswerMetadata = {
generativeQuestionAnsweringId: '123',
};
Expand All @@ -1367,11 +1367,11 @@ describe('InsightClient', () => {
...expectedBaseCaseMetadata,
};

await client.logExpandGeneratedAnswer(exampleGeneratedAnswerMetadata, baseCaseMetadata);
expectMatchCustomEventPayload(SearchPageEvents.expandGeneratedAnswer, expectedMetadata);
await client.logGeneratedAnswerExpand(exampleGeneratedAnswerMetadata, baseCaseMetadata);
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerExpand, expectedMetadata);
});

it('should send proper payload for #collapseGeneratedAnswer', async () => {
it('should send proper payload for #generatedAnswerCollapse', async () => {
const exampleGeneratedAnswerMetadata = {
generativeQuestionAnsweringId: '123',
};
Expand All @@ -1380,8 +1380,8 @@ describe('InsightClient', () => {
...expectedBaseCaseMetadata,
};

await client.logCollapseGeneratedAnswer(exampleGeneratedAnswerMetadata, baseCaseMetadata);
expectMatchCustomEventPayload(SearchPageEvents.collapseGeneratedAnswer, expectedMetadata);
await client.logGeneratedAnswerCollapse(exampleGeneratedAnswerMetadata, baseCaseMetadata);
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerCollapse, expectedMetadata);
});

it('should send proper payload for #generatedAnswerFeedbackSubmit', async () => {
Expand Down
8 changes: 4 additions & 4 deletions src/insight/insightClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,18 @@ export class CoveoInsightClient {
);
}

public logExpandGeneratedAnswer(generatedAnswerMetadata: GeneratedAnswerBaseMeta, metadata?: CaseMetadata) {
public logGeneratedAnswerExpand(generatedAnswerMetadata: GeneratedAnswerBaseMeta, metadata?: CaseMetadata) {
return this.logCustomEvent(
SearchPageEvents.expandGeneratedAnswer,
SearchPageEvents.generatedAnswerExpand,
metadata
? {...generateMetadataToSend(metadata, false), ...generatedAnswerMetadata}
: generatedAnswerMetadata
);
}

public logCollapseGeneratedAnswer(generatedAnswerMetadata: GeneratedAnswerBaseMeta, metadata?: CaseMetadata) {
public logGeneratedAnswerCollapse(generatedAnswerMetadata: GeneratedAnswerBaseMeta, metadata?: CaseMetadata) {
return this.logCustomEvent(
SearchPageEvents.collapseGeneratedAnswer,
SearchPageEvents.generatedAnswerCollapse,
metadata
? {...generateMetadataToSend(metadata, false), ...generatedAnswerMetadata}
: generatedAnswerMetadata
Expand Down
28 changes: 14 additions & 14 deletions src/searchPage/searchPageClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1573,32 +1573,32 @@ describe('SearchPageClient', () => {
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerShowAnswers, meta);
});

it('should send proper payload for #logExpandGeneratedAnswer', async () => {
it('should send proper payload for #logGeneratedAnswerExpand', async () => {
const meta = {generativeQuestionAnsweringId: fakeStreamId};
await client.logExpandGeneratedAnswer(meta);
expectMatchCustomEventPayload(SearchPageEvents.expandGeneratedAnswer, meta);
await client.logGeneratedAnswerExpand(meta);
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerExpand, meta);
});

it('should send proper payload for #makeExpandGeneratedAnswer', async () => {
it('should send proper payload for #makeGeneratedAnswerExpand', async () => {
const meta = {generativeQuestionAnsweringId: fakeStreamId};
const built = await client.makeExpandGeneratedAnswer(meta);
const built = await client.makeGeneratedAnswerExpand(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.expandGeneratedAnswer, meta);
expectMatchDescription(built.description, SearchPageEvents.expandGeneratedAnswer, meta);
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerExpand, meta);
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerExpand, meta);
});

it('should send proper payload for #logCollapseGeneratedAnswer', async () => {
it('should send proper payload for #logGeneratedAnswerCollapse', async () => {
const meta = {generativeQuestionAnsweringId: fakeStreamId};
await client.logCollapseGeneratedAnswer(meta);
expectMatchCustomEventPayload(SearchPageEvents.collapseGeneratedAnswer, meta);
await client.logGeneratedAnswerCollapse(meta);
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerCollapse, meta);
});

it('should send proper payload for #makeCollapseGeneratedAnswer', async () => {
it('should send proper payload for #makeGeneratedAnswerCollapse', async () => {
const meta = {generativeQuestionAnsweringId: fakeStreamId};
const built = await client.makeCollapseGeneratedAnswer(meta);
const built = await client.makeGeneratedAnswerCollapse(meta);
await built.log({searchUID: provider.getSearchUID()});
expectMatchCustomEventPayload(SearchPageEvents.collapseGeneratedAnswer, meta);
expectMatchDescription(built.description, SearchPageEvents.collapseGeneratedAnswer, meta);
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerCollapse, meta);
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerCollapse, meta);
});

it('should send proper payload for #logGeneratedAnswerFeedbackSubmit', async () => {
Expand Down
16 changes: 8 additions & 8 deletions src/searchPage/searchPageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,20 +951,20 @@ export class CoveoSearchPageClient {
});
}

public makeExpandGeneratedAnswer(metadata: GeneratedAnswerBaseMeta) {
return this.makeCustomEvent(SearchPageEvents.expandGeneratedAnswer, metadata);
public makeGeneratedAnswerExpand(metadata: GeneratedAnswerBaseMeta) {
return this.makeCustomEvent(SearchPageEvents.generatedAnswerExpand, metadata);
}

public async logExpandGeneratedAnswer(metadata: GeneratedAnswerBaseMeta) {
return (await this.makeExpandGeneratedAnswer(metadata)).log({searchUID: this.provider.getSearchUID()});
public async logGeneratedAnswerExpand(metadata: GeneratedAnswerBaseMeta) {
return (await this.makeGeneratedAnswerExpand(metadata)).log({searchUID: this.provider.getSearchUID()});
}

public makeCollapseGeneratedAnswer(metadata: GeneratedAnswerBaseMeta) {
return this.makeCustomEvent(SearchPageEvents.collapseGeneratedAnswer, metadata);
public makeGeneratedAnswerCollapse(metadata: GeneratedAnswerBaseMeta) {
return this.makeCustomEvent(SearchPageEvents.generatedAnswerCollapse, metadata);
}

public async logCollapseGeneratedAnswer(metadata: GeneratedAnswerBaseMeta) {
return (await this.makeCollapseGeneratedAnswer(metadata)).log({searchUID: this.provider.getSearchUID()});
public async logGeneratedAnswerCollapse(metadata: GeneratedAnswerBaseMeta) {
return (await this.makeGeneratedAnswerCollapse(metadata)).log({searchUID: this.provider.getSearchUID()});
}

public makeGeneratedAnswerFeedbackSubmit(meta: GeneratedAnswerFeedbackMeta) {
Expand Down
8 changes: 4 additions & 4 deletions src/searchPage/searchPageEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ export enum SearchPageEvents {
/**
* Identifies the custom event that gets logged when a user expand a generated answer.
*/
expandGeneratedAnswer = 'expandGeneratedAnswer',
generatedAnswerExpand = 'generatedAnswerExpand',
/**
* Identifies the custom event that gets logged when a user collapse a generated answer.
*/
collapseGeneratedAnswer = 'collapseGeneratedAnswer',
generatedAnswerCollapse = 'generatedAnswerCollapse',
/**
* Identifies the custom event that gets logged when a user submits a feedback of a generated answer.
*/
Expand Down Expand Up @@ -390,8 +390,8 @@ export const CustomEventsTypes: Partial<Record<SearchPageEvents | InsightEvents,
[SearchPageEvents.generatedAnswerCopyToClipboard]: 'generatedAnswer',
[SearchPageEvents.generatedAnswerHideAnswers]: 'generatedAnswer',
[SearchPageEvents.generatedAnswerShowAnswers]: 'generatedAnswer',
[SearchPageEvents.expandGeneratedAnswer]: 'generatedAnswer',
[SearchPageEvents.collapseGeneratedAnswer]: 'generatedAnswer',
[SearchPageEvents.generatedAnswerExpand]: 'generatedAnswer',
[SearchPageEvents.generatedAnswerCollapse]: 'generatedAnswer',
[SearchPageEvents.generatedAnswerFeedbackSubmit]: 'generatedAnswer',
[InsightEvents.expandToFullUI]: 'interface',
[InsightEvents.openUserActions]: 'User Actions',
Expand Down

0 comments on commit 86f4341

Please sign in to comment.