npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-turborater

v0.0.5

Published

React wrapper for turbo rater iframe

Downloads

2

Readme

React TurboRater

TurboRater (https://www.turborater.com/) offers comparative insurance rating. This library is a React Wrapper for their page (wraps it in an iframe).

Introduction

First checkout the demo site provided by TurboRater: https://16703b91-3136-4582-845a-30b5365b4b91.quotes.iwantinsurance.com/welcome.aspx Feel free to click around and submit your info to test it out, hopefully you won't be quoted.

The UUID in the url is the account id for a specific TurboRater account. You should have your own account id from your account admin. To customize your own TurboRater page, you need to login to https://quotes.iwantinsurance.com/admin/login.aspx?returnurl=agencycustomize.aspx

Once you login you will be presented with a 90s themed portal that has a lot of options to customize your TurboRater page. You can change the form options, e.g. make a field required. You can also add raw CSS and Javascript under the Design tab.

Usually, you have a parent page that loads the TurboRater page as an iframe, and you change the style to match the parent account.

Limitations

  • CSS
    • If you have 2 sites that use the same TurboRater account, you can't change the style individually
    • It's inefficient to write CSS code on their admin portal
  • Can only inject 2 scripts
    • Again, you can't change what script is loaded if you use the same TurboRater account for multiple sites
  • Parent has zero visibility into the iframe
    • For example, what if you have want to track who signed up on the parent page and save it to your own system

Props

This library wraps the TurboRater page in an iframe and lets you easily add it to a React project. It addresses the limitations above, and offers additional goodies.

ReactTurboRater.propTypes = {
    accountId: PropTypes.string.isRequired,
    prefill: PropTypes.shape({
        patner: PropTypes.string,
        fname: PropTypes.string,
        lname: PropTypes.string,
        email: PropTypes.string,
        cph: PropTypes.string,
        wph: PropTypes.string,
        hph: PropTypes.string,
        ad1: PropTypes.string,
        ad2: PropTypes.string,
        city: PropTypes.string,
        st: PropTypes.string,
        zip: PropTypes.string,
        dob: PropTypes.string,
        gen: PropTypes.string,
        mstat: PropTypes.string,
        vin: PropTypes.string,
    }),
    style: PropTypes.object,
    autoResize: PropTypes.bool,
    frameCSS: PropTypes.string,
    frameScripts: PropTypes.arrayOf(PropTypes.string),
    onPageLoad: PropTypes.shape({
        welcome: PropTypes.func,
        general: PropTypes.func,
        namedInsured: PropTypes.func,
        Spouse: PropTypes.func,
        AddDrivers: PropTypes.func,
        EditCar: PropTypes.func,
        AddCars: PropTypes.func,
        LimitPackages: PropTypes.func,
        AUcomparison: PropTypes.func,
        Finished: PropTypes.func,
    }),
    development: PropTypes.bool,
};
ReactTurboRater.defaultProps = {
    prefill: {},
    style: {
        width: '100%',
        height: '100%',
        minHeight: '800px',
        border: 'solid 3px #000',
    },
    autoResize: false,
    frameCSS: '',
    frameScripts: [],
    onPageLoad: {},
    development: false,
};

accountId: Your account id

prefill: Use this to prefill the form. For more details, check out http://www.itcdataservices.com/support/ecmpfaq/afmviewfaq.aspx?faqid=357

style: Control the style of the iframe (the frame itself, not the content)

autoResize: Auto resize the iframe based it's content, uses https://github.com/davidjbradshaw/iframe-resizer

frameCSS: CSS you want to inject into the iframe. Currently you are limited to inject just 1 file. So bundle your files if you have multiple.

frameScripts: Javascript files you want to inject into the iframe.

onPageLoad: An object with keys being page names, and values being callback functions. For example, if you want to add a callback when the initial page https://16703b91-3136-4582-845a-30b5365b4b91.quotes.iwantinsurance.com/welcome.aspx loads, then you set onPageLoad to

{
	welcome: function callback(){
		console.log('welcome page loaded, do something with it');
	}
}

List of page names (case sensitive, without .aspx extention)

  • welcome
  • general
  • namedInsured
  • Spouse
  • AddDrivers
  • EditCar
  • AddCars
  • LimitPackages
  • AUcomparison
  • Finished

development: This allows you to inject a local copy of react-turborater.js into the iframe. You must run it from a browser with cross domain security disabled. I found Safari to work best for this.

Local Development

Checkout the repo and run the example app, that should be enough to get you started. Make sure you set the prop development so that you can develop your integration locally with hot-reloading.

During local development, the page may flicker, since react-turborater.js is injected after the iframe loads. This shouldn't be a problem on production since react-turborater.js is loaded in <head>

git clone [email protected]:LeaseCo/react-turborater.git
cd react-turborater
npm run dev
# open a browser with cross domain security disabled (e.g. safari), and visit https://localhost:3004

Deploy to Production

Add https://s3.amazonaws.com/leaseco-public/react-turborater.min.js on TurboRater's admin portal.

Limitations/TODOs

This library uses postMessage, however, it's not checking the parent or iframe's domain.