New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GEN-400] Update to Insurely Blocks API #2140
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
dac3bf1
to
b5f3650
Compare
b5f3650
to
bba9001
Compare
bba9001
to
c5820b4
Compare
c5820b4
to
ef8aada
Compare
ef8aada
to
88d3f2e
Compare
88d3f2e
to
adc52ec
Compare
adc52ec
to
b0a022d
Compare
b0a022d
to
d6a29ad
Compare
d6a29ad
to
3923673
Compare
71195dd
to
c61eeaa
Compare
c61eeaa
to
81f0d09
Compare
81f0d09
to
0320837
Compare
0320837
to
13a3df0
Compare
11dafa3
to
61c6e26
Compare
@@ -88,7 +92,7 @@ export const CurrentInsuranceField = (props: Props) => { | |||
const [updateDataCollectionId] = usePriceIntentInsurelyUpdateMutation({ | |||
onCompleted({ priceIntentInsurelyUpdate }) { | |||
datadogLogs.logger.info('Updated Insurely data collection ID', { | |||
priceIntentId, | |||
priceIntentId: props.priceIntentId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: 4 usages of props.priceIntentId
, moving it to local variable will shorten the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! See comments for future refactoring ideas
| { type: 'SUCCESS'; externalInsurer: ExternalInsurer } | ||
| { type: 'CONFIRMED'; externalInsurer: ExternalInsurer } | ||
|
||
export const CurrentInsuranceField = (props: Props) => { | ||
const { label, productName, priceIntentId, insurelyClientId, externalInsurer } = props | ||
const { t } = useTranslation('purchase-form') | ||
const { shopSession } = useShopSession() | ||
const [state, setState] = useState<State>({ type: 'IDLE' }) | ||
|
||
const compare = useCallback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This state + useCallback API looks a bit complex. Can it be improved?
Some ideas to try
- useReducer / jotai
- Separate concepts of Insurely and CurrentInsurance and move Insurely state into its own thing
This is probably for another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! We will need to do this before we can support Car with Insurely so let's dig into it then
61c6e26
to
4638a5e
Compare
Describe your changes
Use the new "Blocks API" from Insurely.
Get
insurelyConfigName
on PriceIntent.New environment variable for global Insurely customer ID
Justify why they are needed
Insurely is discontinuing the old iFrame solution so only this new one will receive updates!
Jira issue(s): []
Checklist before requesting a review