-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: refactor interceptDispatch and add remaining profile properties
- Loading branch information
1 parent
cc52eb5
commit b683cec
Showing
30 changed files
with
748 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...personafisica-webapp/src/utility/MixpanelUtils/Strategies/SendAcceptDelegationStrategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { EventPropertyType, EventStrategy, TrackedEvent } from '@pagopa-pn/pn-commons'; | ||
|
||
type SendAcceptDelegation = { | ||
SEND_HAS_MANDATE: 'yes'; | ||
}; | ||
|
||
export class SendAcceptDelegationStrategy implements EventStrategy { | ||
performComputations(): TrackedEvent<SendAcceptDelegation> { | ||
return { | ||
[EventPropertyType.PROFILE]: { | ||
SEND_HAS_MANDATE: 'yes', | ||
}, | ||
}; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...rsonafisica-webapp/src/utility/MixpanelUtils/Strategies/SendAddCourtesyAddressStrategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { EventPropertyType, EventStrategy, TrackedEvent } from '@pagopa-pn/pn-commons'; | ||
|
||
import { CourtesyChannelType, DigitalAddress } from '../../../models/contacts'; | ||
import { SaveDigitalAddressParams } from '../../../redux/contact/types'; | ||
|
||
type SendAddCourtesyAddressReturn = | ||
| { | ||
SEND_HAS_EMAIL: 'yes'; | ||
} | ||
| { | ||
SEND_HAS_SMS: 'yes'; | ||
}; | ||
|
||
type SendAddCourtesyAddressData = { | ||
payload: DigitalAddress | void; | ||
params: SaveDigitalAddressParams; | ||
}; | ||
|
||
export class SendAddCourtesyAddressStrategy implements EventStrategy { | ||
performComputations({ | ||
payload, | ||
params, | ||
}: SendAddCourtesyAddressData): TrackedEvent<SendAddCourtesyAddressReturn> { | ||
// Check payload to distinguish between the action called before PIN validation and after | ||
// We have to track only the action after the PIN validation | ||
if (!payload) { | ||
return {}; | ||
} | ||
|
||
if (params.channelType === CourtesyChannelType.EMAIL) { | ||
return { | ||
[EventPropertyType.PROFILE]: { | ||
SEND_HAS_EMAIL: 'yes', | ||
}, | ||
}; | ||
} | ||
|
||
return { | ||
[EventPropertyType.PROFILE]: { | ||
SEND_HAS_SMS: 'yes', | ||
}, | ||
}; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...-personafisica-webapp/src/utility/MixpanelUtils/Strategies/SendAddLegalAddressStrategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { EventPropertyType, EventStrategy, TrackedEvent } from '@pagopa-pn/pn-commons'; | ||
|
||
import { DigitalAddress } from '../../../models/contacts'; | ||
|
||
type SendAddLegalAddress = { | ||
SEND_HAS_PEC: 'yes'; | ||
}; | ||
|
||
type SendAddLegalAddressData = { | ||
payload: DigitalAddress | void; | ||
}; | ||
|
||
export class SendAddLegalAddressStrategy implements EventStrategy { | ||
performComputations({ payload }: SendAddLegalAddressData): TrackedEvent<SendAddLegalAddress> { | ||
if (!(payload && payload.pecValid)) { | ||
return {}; | ||
} | ||
|
||
return { | ||
[EventPropertyType.PROFILE]: { SEND_HAS_PEC: 'yes' }, | ||
}; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ges/pn-personafisica-webapp/src/utility/MixpanelUtils/Strategies/SendDisableIOStrategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { EventPropertyType, EventStrategy, TrackedEvent } from '@pagopa-pn/pn-commons'; | ||
|
||
type SendDisableIO = { | ||
SEND_APPIO_STATUS: 'deactivated'; | ||
}; | ||
|
||
export class SendDisableIOStrategy implements EventStrategy { | ||
performComputations(): TrackedEvent<SendDisableIO> { | ||
return { | ||
[EventPropertyType.PROFILE]: { | ||
SEND_APPIO_STATUS: 'deactivated', | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...ages/pn-personafisica-webapp/src/utility/MixpanelUtils/Strategies/SendEnableIOStrategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { EventPropertyType, EventStrategy, TrackedEvent } from '@pagopa-pn/pn-commons'; | ||
|
||
type SendEnableIO = { | ||
SEND_APPIO_STATUS: 'activated'; | ||
}; | ||
|
||
export class SendEnableIOStrategy implements EventStrategy { | ||
performComputations(): TrackedEvent<SendEnableIO> { | ||
return { | ||
[EventPropertyType.PROFILE]: { | ||
SEND_APPIO_STATUS: 'activated', | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...personafisica-webapp/src/utility/MixpanelUtils/Strategies/SendHasMandateGivensStrategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { EventPropertyType, EventStrategy, TrackedEvent } from '@pagopa-pn/pn-commons'; | ||
|
||
import { Delegation } from '../../../redux/delegation/types'; | ||
import { DelegationStatus } from '../../status.utility'; | ||
|
||
type SendHasMandateGiven = { | ||
SEND_MANDATE_GIVEN: 'yes' | 'no'; | ||
}; | ||
|
||
type SendHasMandateGivenData = { | ||
payload: Array<Delegation>; | ||
}; | ||
|
||
export class SendHasMandateGivenStrategy implements EventStrategy { | ||
performComputations({ payload }: SendHasMandateGivenData): TrackedEvent<SendHasMandateGiven> { | ||
const hasDelegates = payload?.filter( | ||
(delegation) => delegation.status === DelegationStatus.ACTIVE | ||
); | ||
|
||
return { | ||
[EventPropertyType.PROFILE]: { | ||
SEND_MANDATE_GIVEN: hasDelegates?.length > 0 ? 'yes' : 'no', | ||
}, | ||
}; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...-personafisica-webapp/src/utility/MixpanelUtils/Strategies/SendHasMandateLoginStrategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { EventPropertyType, EventStrategy, TrackedEvent } from '@pagopa-pn/pn-commons'; | ||
|
||
import { Delegator } from '../../../redux/delegation/types'; | ||
|
||
type SendHasMandateLogin = { | ||
SEND_HAS_MANDATE: 'yes' | 'no'; | ||
}; | ||
|
||
type SendHasMandateLoginData = { | ||
payload: Array<Delegator>; | ||
}; | ||
|
||
export class SendHasMandateLoginStrategy implements EventStrategy { | ||
performComputations({ payload }: SendHasMandateLoginData): TrackedEvent<SendHasMandateLogin> { | ||
return { | ||
[EventPropertyType.PROFILE]: { | ||
SEND_HAS_MANDATE: payload.length > 0 ? 'yes' : 'no', | ||
}, | ||
}; | ||
} | ||
} |
Oops, something went wrong.