Skip to content
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

Merged
merged 1 commit into from Jun 8, 2023
Merged

Conversation

robinandeer
Copy link
Contributor

@robinandeer robinandeer commented Apr 11, 2023

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

  • I have performed a self-review of my code

@vercel
Copy link

vercel bot commented Apr 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hedvig-dot-com ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2023 2:49pm
onboarding ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2023 2:49pm

@robinandeer
Copy link
Contributor Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@robinandeer robinandeer force-pushed the update/insurely-blocks branch 2 times, most recently from 11dafa3 to 61c6e26 Compare June 7, 2023 12:41
@robinandeer robinandeer marked this pull request as ready for review June 7, 2023 12:41
@robinandeer robinandeer requested a review from a team as a code owner June 7, 2023 12:41
@robinandeer robinandeer changed the title Update to Insurely Blocks API [GEN-400] Update to Insurely Blocks API Jun 7, 2023
@notion-workspace
Copy link

Insurely Home + House

@@ -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,
Copy link
Contributor

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

Copy link
Contributor

@alebedev alebedev left a 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(
Copy link
Contributor

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

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants