Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable react/no-unused-prop-types, react/no-multi-comp, react/no-did-mount-set-state, react/forbid-prop-types */
import React from 'react'
import PropTypes from 'prop-types'
import Spinner from 'part:@sanity/components/loading/spinner'
import sanityClient from 'part:@sanity/base/client'
import imageUrlBuilder from '@sanity/image-url'
import getIt from 'get-it'
import promise from 'get-it/lib/middleware/promise'
import styles from './BusinessCard.css'
const fileType = 'png'
const cardServiceHost = 'https://json-to-pdf.sanity-io.now.sh' // 'http://localhost:3000'
const cardServiceBaseUrl = `${cardServiceHost}/api/business-card`
const request = getIt([promise()])
const builder = imageUrlBuilder(sanityClient)
const urlFor = source => {
return builder.image(source)
}
let memoizedDocument = null
const arrayBufferToBase64 = arrbuf => {
return btoa(new Uint8Array(arrbuf).reduce((data, byte) => data + String.fromCharCode(byte), ''))
}
class BusinessCard extends React.PureComponent {
static propTypes = {
document: PropTypes.object