Skip to content

Commit dbf4055

Browse files
committed
use CommerceEvent type from event-models
1 parent 725c520 commit dbf4055

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/Rokt-Kit.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Batch, KitInterface, IMParticleUser, SDKEvent } from '@mparticle/web-sd
2020
import type { IUserIdentities } from '@mparticle/web-sdk';
2121

2222
// BaseEvent not re-exported from @mparticle/web-sdk/internal, so we import directly from @mparticle/event-models.
23-
import { BaseEvent } from '@mparticle/event-models';
23+
import { BaseEvent, CommerceEvent } from '@mparticle/event-models';
2424

2525
interface RoktKitSettings {
2626
accountId: string;
@@ -933,12 +933,12 @@ class RoktKit implements KitInterface {
933933
for (const event of batch.events) {
934934
if (event.event_type !== 'commerce_event') continue;
935935

936-
const data = event.data as Record<string, unknown> | undefined;
936+
const { data } = event as CommerceEvent;
937937
if (!data) continue;
938938

939-
const commerceType = (data.custom_flags as Record<string, string> | undefined)?.['Rokt.CommerceEventType'];
939+
const commerceType = data.custom_flags?.['Rokt.CommerceEventType'];
940940
if (commerceType && isObject(data.product_action)) {
941-
(data.product_action as Record<string, unknown>).action = commerceType;
941+
(data.product_action as { action: string }).action = commerceType;
942942
}
943943
}
944944
return batch;

0 commit comments

Comments
 (0)