Skip to content

Commit

Permalink
Implement new methods in all widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
SamborGornicz committed Aug 28, 2024
1 parent 51ad4f4 commit e3331c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 46 deletions.
18 changes: 4 additions & 14 deletions packages/agent-app-sdk/src/widgets/details/details-widget.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
import {
createWidget,
withAmplitude,
createConnection,
IConnection
} from '@livechat/widget-core-sdk';
import { createConnection, createWidget, IConnection, withAmplitude } from '@livechat/widget-core-sdk';
import { withCustomerProfile } from '../shared/customer-profile';
import { withRichMessages } from '../shared/rich-messages';
import { withTransactions } from '../shared/transactions';
import assertSection from './custom-sections';
import {
IDetailsWidgetEvents,
IDetailsWidgetApi,
ISection
} from './interfaces';
import { IDetailsWidgetApi, IDetailsWidgetEvents, ISection } from './interfaces';

export function DetailsWidget(connection: IConnection<IDetailsWidgetEvents>) {
const base = createWidget<IDetailsWidgetApi, IDetailsWidgetEvents>(
Expand All @@ -33,9 +25,7 @@ export function DetailsWidget(connection: IConnection<IDetailsWidgetEvents>) {
}
);

const widget = withAmplitude(withRichMessages(withCustomerProfile(base)));

return widget;
return withAmplitude(withTransactions(withRichMessages(withCustomerProfile(base))));
}

export type IDetailsWidget = ReturnType<typeof DetailsWidget>;
Expand Down
16 changes: 4 additions & 12 deletions packages/agent-app-sdk/src/widgets/fullscreen/fullscreen-widget.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import {
createWidget,
withAmplitude,
createConnection,
IConnection
} from '@livechat/widget-core-sdk';
import {
IFullscreenWidgetApi,
IFullscreenWidgetEvents,
ReportsFilters
} from './interfaces';
import { createConnection, createWidget, IConnection, withAmplitude } from '@livechat/widget-core-sdk';
import { withTransactions } from '../shared/transactions';
import { IFullscreenWidgetApi, IFullscreenWidgetEvents, ReportsFilters } from './interfaces';

export { ReportsFilters } from './interfaces';

Expand All @@ -35,7 +27,7 @@ export function FullscreenWidget(
}
}
);
return withAmplitude(base);
return withAmplitude(withTransactions(base));
}

export type IFullscreenWidget = ReturnType<typeof FullscreenWidget>;
Expand Down
16 changes: 4 additions & 12 deletions packages/agent-app-sdk/src/widgets/messagebox/messagebox-widget.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import {
createWidget,
withAmplitude,
createConnection,
IConnection
} from '@livechat/widget-core-sdk';
import { createConnection, createWidget, IConnection, withAmplitude } from '@livechat/widget-core-sdk';
import { withCustomerProfile } from '../shared/customer-profile';
import { withRichMessages } from '../shared/rich-messages';
import {
IMessageBoxWidgetApi,
IMessageBoxWidgetEvents,
IRichMessage
} from './interfaces';
import { withTransactions } from '../shared/transactions';
import { IMessageBoxWidgetApi, IMessageBoxWidgetEvents, IRichMessage } from './interfaces';

export function MessageBoxWidget(
connection: IConnection<IMessageBoxWidgetEvents>
Expand All @@ -30,7 +22,7 @@ export function MessageBoxWidget(
}
);

const widget = withAmplitude(withRichMessages(withCustomerProfile(base)));
const widget = withAmplitude(withRichMessages(withCustomerProfile(withTransactions(base))));

return widget;
}
Expand Down
12 changes: 4 additions & 8 deletions packages/agent-app-sdk/src/widgets/settings/settings-widget.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import {
createWidget,
withAmplitude,
createConnection,
IConnection
} from '@livechat/widget-core-sdk';
import { ISettingsWidgetApi, ISettingsWidgetEvents } from './interfaces';
import { createConnection, createWidget, IConnection, withAmplitude } from '@livechat/widget-core-sdk';
import { withPageData } from '../shared/page-data';
import { withTransactions } from '../shared/transactions';
import { ISettingsWidgetApi, ISettingsWidgetEvents } from './interfaces';

export function SettingsWidget(connection: IConnection<ISettingsWidgetEvents>) {
const base = createWidget<ISettingsWidgetApi, ISettingsWidgetEvents>(
Expand All @@ -16,7 +12,7 @@ export function SettingsWidget(connection: IConnection<ISettingsWidgetEvents>) {
}
}
);
return withAmplitude(withPageData(base));
return withAmplitude(withPageData(withTransactions(base)));
}

export type ISettingsWidget = ReturnType<typeof SettingsWidget>;
Expand Down

0 comments on commit e3331c9

Please sign in to comment.