(
userId: string,
)
| 35 | const isDevEnv = envName === 'dev' |
| 36 | |
| 37 | function flushBufferWithUser( |
| 38 | userId: string, |
| 39 | ): AnalyticsDispatchPayload[] { |
| 40 | if (!buffered.length) { |
| 41 | return [] |
| 42 | } |
| 43 | |
| 44 | const toSend: AnalyticsDispatchPayload[] = [] |
| 45 | for (const item of buffered.splice(0)) { |
| 46 | const rebuilt = toTrackableAnalyticsPayload({ |
| 47 | ...item, |
| 48 | fallbackUserId: userId, |
| 49 | }) |
| 50 | if (rebuilt) { |
| 51 | toSend.push(rebuilt) |
| 52 | } |
| 53 | } |
| 54 | return toSend |
| 55 | } |
| 56 | |
| 57 | function process( |
| 58 | input: AnalyticsDispatchInput, |
no test coverage detected