refactor: Migrate Forwarder module to TypeScript#988
refactor: Migrate Forwarder module to TypeScript#988alexs-mparticle wants to merge 8 commits intodevelopmentfrom
Conversation
5afc5b6 to
948c6a6
Compare
948c6a6 to
9acfdc4
Compare
src/forwarders.interfaces.ts
Outdated
| // constructor?: new () => IMPForwarder; | ||
| constructor: () => any; | ||
| name: string; | ||
| getId: () => number, // Should this be optional? |
There was a problem hiding this comment.
A side loaded kit may not implement getId so at a minimum, this should be optional.
src/forwarders.interfaces.ts
Outdated
| export type Kit = Dictionary; | ||
| export interface Kit { | ||
| // constructor?: new () => IMPForwarder; | ||
| constructor: () => any; |
There was a problem hiding this comment.
revisit the constructor value?
src/forwarders.interfaces.ts
Outdated
| // suffix?: string; | ||
| name: string; | ||
| getId(): number; | ||
| filters: IKitFilterSettings; |
There was a problem hiding this comment.
is this only for sideloaded kits?
src/forwarders.interfaces.ts
Outdated
| screenAttributeFilters: number[]; | ||
|
|
||
|
|
||
| // Side loaded kit functioanlity in Forwarder methods |
There was a problem hiding this comment.
| // Side loaded kit functioanlity in Forwarder methods | |
| // Side loaded kit functionality in Forwarder methods |
|
|
||
|
|
||
| // Side loaded kit functioanlity in Forwarder methods | ||
| kitInstance: UnregisteredKit; |
There was a problem hiding this comment.
i see this as existing on the unregistered Kit, rather than IMPForwarder
src/forwarders.interfaces.ts
Outdated
| id: number; | ||
| settings: ForwarderSettings; | ||
| forwarderStatsUploader: AsyncUploader; | ||
| isInitialized: boolean; | ||
| filteringConsentRuleValues: IFilteringConsentRuleValues; | ||
| filteringUserAttributeValue: IFilteringUserAttributeValue; | ||
| filteringEventAttributeValue: IFilteringEventAttributeValue; | ||
| excludeAnonymousUser: boolean; | ||
| userIdentityFilters: UserIdentityFilters; | ||
| userAttributeFilters: UserAttributeFilters; |
There was a problem hiding this comment.
i think a lot of these settings are actually supposed to be on an IKitConfig or IForwarder, and not the IMPForwarder Class. the naming is confusing, so taht's probably why they all got combined into here. maybe this class should be named IMPForwarderClass for now even though I know that's bad practice, but at least so we don't confuse IMPForwarder for the class, which has the class methods on it, vs having properties for an actual forwarder or kit, some of which are found here
this applies to most of the items from line 118-149, but double check
| isSandbox?: boolean; | ||
| hasSandbox?: boolean; | ||
| isVisible?: boolean; |
There was a problem hiding this comment.
these are on the kitconfig and not the IMPForwarder class also
src/forwarders.interfaces.ts
Outdated
| // constructor?: new () => IMPForwarder; | ||
| constructor: () => any; | ||
| name: string; | ||
| getId: () => number, // Should this be optional? |
test/jest/sideloadedKit.spec.ts
Outdated
| // constructor: class { | ||
| // constructor() {} | ||
| // } as new () => IMPForwarder |
There was a problem hiding this comment.
flagging to make sure you address this commented code and we don't forget
test/jest/utils.ts
Outdated
| // @ts-ignore | ||
| constructor: this.constructor, | ||
| // constructor: this.constructor as { new(): IMPForwarder }, |
test/jest/utils.ts
Outdated
| }) | ||
| } | ||
|
|
||
| // TODO: Can we finally get rid of this? |
There was a problem hiding this comment.
i don't have the historical context here. is this something you did or i did?
There was a problem hiding this comment.
I think it's something you introduced but I can't recall why it wasn't ever flagged during code review: #568
test/src/tests-forwarders.ts
Outdated
| // SideloadedKit11 has received the session start event, but not the Test Event | ||
| // SideloadedKit22 will receive the Test Event | ||
|
|
||
| console.log('EventName', window.SideloadedKit11.instance.receivedEvent.EventName); |
src/apiClient.ts
Outdated
| initializeForwarderStatsUploader: () => AsyncUploader; | ||
| prepareForwardingStats: ( | ||
| forwarder: MPForwarder, | ||
| forwarder: IMPForwarder, |
There was a problem hiding this comment.
Note to self: This might need to be a RegisteredKit
src/apiClient.ts
Outdated
|
|
||
| this.prepareForwardingStats = function( | ||
| forwarder: MPForwarder, | ||
| forwarder: IMPForwarder, |
There was a problem hiding this comment.
This may need to become a RegisteredKit
5239dcd to
6cb7247
Compare
|
905641c to
b16bdd2
Compare



Instructions
developmentSummary
Testing Plan
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)