GithubHelp home page GithubHelp logo

sebastianfdz / paypal-checkout-components Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paypal/paypal-checkout-components

0.0 0.0 0.0 352.34 MB

Javascript Integration for PayPal Button and PayPal Checkout

License: Apache License 2.0

Shell 0.39% JavaScript 98.86% HTML 0.35% SCSS 0.41%

paypal-checkout-components's Introduction

PayPal Checkout

build status code coverage npm version apache license

A set of components allowing easy integration of PayPal Buttons and PayPal Checkout into your site, powered by zoid.

Dev Docs

See developer.paypal.com/docs/checkout


Development

Please feel free to follow the Contribution Guidelines to contribute to this repository. PRs are welcome, but for major changes please raise an issue first.

Quick Setup

Set up your env:

npm install

Run tests:

npm test

Run in dev mode:

npm run dev

Testing Tasks

npm test

Runs all testing tasks lint, flow, karma, jest-ssr, jest-screenshot, & check-size.

Flags Description
--clear-cache Clear Babel Loader and PhantomJS cache
--debug Debug mode. PhantomJS, Karma, and CheckoutJS
--quick Fastest testing. Minimal output, no coverage
--browser Choose Browser

ย 

lint

npm run lint

npm run lint -- --fix
# attempt to automatically fix any problems

Runs eslint using definitions extended from Grumbler-Scripts.

flow

npm run flow

Checks for typing issues using Flow. Prior to running this task, flow-typed should be run to generate type interfaces for the various 3rd-party libraries we use.

karma

npm run karma

npm run karma -- --keep-open
# keeps the test browser window open to allow debugging
npm run karma -- --capture-console
# dumps the browser's console output into the terminal

Runs Karma tests using the Mocha framework. Responsible for running the test/e2e & test/integration directories.

jest-ssr

npm run jest-ssr

Checks for the correct rendering of components on the server-side using Jest.

jest-screenshot

npm run jest-screenshot

Uses Puppeteer & Jest to take screenshots and checks against existing views to look for discrepancies. Tests are defined in test/screenshot/config.js.

check-size

npm run check-size

Checks to make sure that the compiled & gzipped bundle doesn't exceed the recommended size limit.

Releasing

This package is published weekly, Every Wednesday. Please view our Changelog to stay updated with bug fixes and new features.

Logo Strategy with paypal-sdk-logos

Our usage of svg logos is optimized for performance. Here's how it works for the two-phased render for the Buttons component:

  • First Render - Buttons are first rendered on the client-side inside an <iframe> tag using the code bundled inside the JS SDK script. This <iframe> tag has no src attribute at this point in the rendering life cycle. We leverage the __WEB__ global variable to determine if we are rendering client-side or server-side. The __WEB__ global variable will equal true when rendering client-side. To minimize the bundle size of the JS SDK script, we load these svg logos from the www.paypalobjects.com CDN as external images (ex: <PayPalLogoExternalImage />).

  • Second Render - The second phase of rendering happens on the server-side. This <iframe> tag is fully rendered by setting the src attribute and making an http request to the server to populate the contents which are securely hosted by PayPal's servers on www.paypal.com. The same code in this repo is used to render the buttons on the server-side. To ensure there are no issues with the logos, we have decided to inline the svg code for this server-side render (ex: <PayPalLogoInlineSVG />). The __WEB__ global variable is set to false to control what code executes during the server render.

paypal-checkout-components's People

Contributors

abarco avatar aditya27marri avatar alan-bendjuya avatar amyegan avatar andyfen avatar bluepnume avatar dtjones404 avatar elizabethmv avatar erikmhummel avatar gabrielo91 avatar gregjopa avatar jianyigao avatar jplukarski avatar jscheinhorn avatar jshawl avatar khanghoang avatar leogedler avatar mcntsh avatar mnicpt avatar mstuart avatar nbierdeman avatar ravishekhar avatar renovate[bot] avatar spencersablan avatar ssono avatar tnuzzi avatar trainerbill avatar vishakha94 avatar westeezy avatar wsbrunson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.