Skip to content

Commit

Permalink
plugin-hubtype-analytics: add an enum for webviewEndFailType (#2923)
Browse files Browse the repository at this point in the history
## Description

Add an enum for webviewEndFailType

## Testing

Fix test
  • Loading branch information
Iru89 authored Oct 9, 2024
1 parent 2c0540c commit f9d4f76
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 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 packages/botonic-plugin-hubtype-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@botonic/plugin-hubtype-analytics",
"version": "0.30.0",
"version": "0.30.1",
"description": "Plugin for tracking in the Hubtype backend to see the results in the Hubtype Dashbord",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
Expand Down
7 changes: 6 additions & 1 deletion packages/botonic-plugin-hubtype-analytics/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,15 @@ export interface EventWebviewEnd extends HtBaseEventProps {
webviewName: string
webviewStepName?: string
webviewStepNumber?: number
webviewEndFailType?: string
webviewEndFailType?: WebviewEndFailType
webviewEndFailMessage?: string
}

export enum WebviewEndFailType {
CanceledByUser = 'canceled_by_user',
ApiError = 'api_error',
}

export interface EventCustom extends HtBaseEventProps {
action: EventAction.Custom
customFields?: Record<string, any>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { createHtEvent, EventAction, EventType } from '../src'
import {
createHtEvent,
EventAction,
EventType,
WebviewEndFailType,
} from '../src'
import { getRequestData } from './helpers'

describe('Create webview events', () => {
Expand Down Expand Up @@ -34,7 +39,7 @@ describe('Create webview events', () => {
webviewName: 'ADD_A_BAG',
webviewStepName: 'summary_step',
webviewStepNumber: 3,
webviewEndFailType: 'canceled_by_user',
webviewEndFailType: WebviewEndFailType.CanceledByUser,
webviewEndFailMessage: 'Closed by user',
})

Expand All @@ -48,7 +53,7 @@ describe('Create webview events', () => {
webview_name: 'ADD_A_BAG',
webview_end_step_name: 'summary_step',
webview_end_step_n: 3,
webview_end_fail_type: 'canceled_by_user',
webview_end_fail_type: WebviewEndFailType.CanceledByUser,
webview_end_fail_message: 'Closed by user',
type: EventType.WebEvent,
bot_interaction_id: 'testInteractionId',
Expand Down

0 comments on commit f9d4f76

Please sign in to comment.