- Create a .gitignore file in the git repository if it does not contain one
touch .gitignore
2. Open up the .gitignore and add the following line to the file
node_modules 3. Remove the node_modules folder from the git repository
| // write a function that returns a boolean indiciating | |
| // whether a whitelisted state key has a value that is different than it's // previous value | |
| const _whitelistedKeys = [ | |
| 'invoiceName', | |
| // customer details | |
| 'customersFullName', | |
| 'customersAddress', | |
| 'customersCityState', | |
| 'customersZipCode', |
| import React, { Component, PureComponent } from 'react' | |
| import { connect } from 'react-redux' | |
| import { Page, Text, View, Document, StyleSheet, PDFViewer, Image } from '@react-pdf/renderer'; | |
| // Utils | |
| import createUUID from '../util/createUUID' | |
| import agent from '../util/agent' | |
| // Images | |
| import logo from '../images/small_logo.png'; |
| async function testAA(startTest = false) { | |
| if (startTest) { | |
| const result = await new Promise((resolve, reject) => { | |
| setTimeout(() => resolve("worked"), 3000) | |
| }) | |
| startTest = result | |
| } | |
| return console.log( | |
| startTest |
| const test = { | |
| phonenumber : "hello world", | |
| email: "goodbye world" | |
| } | |
| const email = true; | |
| const phoneNumber = true; | |
| document.write(test[ | |
| (email ? 'email' : 'phonenumber') |
| // init commerce below | |
| const commerce = new window | |
| .Commerce( | |
| process.env.REACT_APP_COMMERCEJS_PUBLIC_KEY, | |
| (process.env.NODE_ENV === 'development') ? true : false | |
| ); | |
| // pass as prop to App component | |
| ReactDOM.render(<App commerce={commerce} />, document.getElementById('root')); |
| constructor(props) { | |
| super(props) | |
| this.state = { | |
| products: [], | |
| cart: null | |
| } | |
| } |
| componentDidMount() { | |
| const { | |
| commerce | |
| } = this.props | |
| if (commerce !== undefined && typeof commerce !== 'undefined') { | |
| // invoke commerce products method to get all products | |
| commerce.Products.list( | |
| (resp) => { |
| addProductToCart(productId) { | |
| this.props.commerce.Cart.add({ | |
| id: productId, | |
| }, (resp) => { | |
| // if successful update Cart | |
| if (!resp.error) { | |
| this.setState({ | |
| cart: resp.cart | |
| }) | |
| } |