(
envelope: EventEnvelope,
event: string,
properties: Record<string, unknown>,
)
| 103 | } |
| 104 | |
| 105 | private emit( |
| 106 | envelope: EventEnvelope, |
| 107 | event: string, |
| 108 | properties: Record<string, unknown>, |
| 109 | ): void { |
| 110 | const client = this.getClient(); |
| 111 | // The SDK requires an identity; drop anonymous-and-unidentified events. |
| 112 | if (!client || (!envelope.userId && !envelope.anonymousId)) { |
| 113 | return; |
| 114 | } |
| 115 | // The SDK's `apiObject` type does not accept `unknown`-valued property bags, |
| 116 | // so we cast at this boundary rather than constraining dynamic properties. |
| 117 | client.track({ |
| 118 | userId: envelope.userId, |
| 119 | anonymousId: envelope.anonymousId, |
| 120 | event, |
| 121 | properties: { ...envelope.baseProperties, ...properties }, |
| 122 | context: envelope.context, |
| 123 | timestamp: envelope.timestamp, |
| 124 | } as unknown as RudderAnalytics.TrackParams); |
| 125 | } |
| 126 | |
| 127 | private emitPage( |
| 128 | envelope: EventEnvelope, |
no test coverage detected