| 635 | } |
| 636 | |
| 637 | const eventSessionID = (event: { type: string; properties?: unknown }) => { |
| 638 | const properties = event.properties |
| 639 | if (!properties || typeof properties !== "object") return |
| 640 | if ("sessionID" in properties && typeof properties.sessionID === "string") return properties.sessionID |
| 641 | if ( |
| 642 | "info" in properties && |
| 643 | properties.info && |
| 644 | typeof properties.info === "object" && |
| 645 | "sessionID" in properties.info && |
| 646 | typeof properties.info.sessionID === "string" |
| 647 | ) |
| 648 | return properties.info.sessionID |
| 649 | if ( |
| 650 | "part" in properties && |
| 651 | properties.part && |
| 652 | typeof properties.part === "object" && |
| 653 | "sessionID" in properties.part && |
| 654 | typeof properties.part.sessionID === "string" |
| 655 | ) |
| 656 | return properties.part.sessionID |
| 657 | } |
| 658 | |
| 659 | const apply = (event: { type: string; properties?: unknown }) => { |
| 660 | const eventID = eventSessionID(event) |