{"id":19888828,"url":"https://github.com/paypal/paypal-example-components","last_synced_at":"2025-05-02T17:32:32.464Z","repository":{"id":39059875,"uuid":"124156313","full_name":"paypal/paypal-example-components","owner":"paypal","description":"Example component module for a component for unified PayPal/Braintree web sdk","archived":false,"fork":false,"pushed_at":"2023-11-23T19:36:19.000Z","size":74,"stargazers_count":10,"open_issues_count":12,"forks_count":30,"subscribers_count":21,"default_branch":"main","last_synced_at":"2024-10-29T18:08:32.347Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paypal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-07T00:34:11.000Z","updated_at":"2024-03-14T04:57:52.000Z","dependencies_parsed_at":"2024-10-29T18:24:37.616Z","dependency_job_id":null,"html_url":"https://github.com/paypal/paypal-example-components","commit_stats":{"total_commits":93,"total_committers":11,"mean_commits":8.454545454545455,"dds":"0.17204301075268813","last_synced_commit":"7f563558cdf0da6f8b2b2e2cbe66fe06e2d26cf7"},"previous_names":["paypal/paypal-braintree-example-component"],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fpaypal-example-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fpaypal-example-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fpaypal-example-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fpaypal-example-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paypal","download_url":"https://codeload.github.com/paypal/paypal-example-components/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224324458,"owners_count":17292521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T18:08:23.787Z","updated_at":"2024-11-12T18:08:24.497Z","avatar_url":"https://github.com/paypal.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## PayPal/Braintree Example Component\n\n[![build status][build-badge]][build]\n[![code coverage][coverage-badge]][coverage]\n[![npm version][version-badge]][package]\n[![apache license][license-badge]][license]\n\n[build-badge]: https://img.shields.io/github/actions/workflow/status/paypal/paypal-example-components/main.yml?branch=main\u0026logo=github\u0026style=flat-square\n[build]: https://github.com/paypal/paypal-example-components/actions?query=workflow%3Abuild\n[coverage-badge]: https://img.shields.io/codecov/c/github/paypal/paypal-example-components.svg?style=flat-square\n[coverage]: https://codecov.io/github/paypal/paypal-example-components/\n[version-badge]: https://img.shields.io/npm/v/@paypal/example-components.svg?style=flat-square\n[package]: https://www.npmjs.com/package/@paypal/example-components\n[license-badge]: https://img.shields.io/npm/l/@paypal/example-components.svg?style=flat-square\n[license]: https://github.com/paypal/paypal-example-components/blob/main/LICENSE\n\nExample standalone component to be included in unified PayPal/Braintree client SDK\n\n### Quick start\n\nSee [src/index.js](./src/index.js)\n\n#### Tests\n\n- Run the tests:\n\n  ```bash\n  npm test\n  ```\n\n#### Testing with different/multiple browsers\n\n```bash\nnpm run karma -- --browser=Chrome\nnpm run karma -- --browser=Safari\nnpm run karma -- --browser=Firefox\nnpm run karma -- --browser=Chrome,Safari,Firefox\n```\n\n#### Keeping the browser open after tests\n\n```bash\nnpm run karma -- --browser=Chrome --keep-open\n```\n\n#### Releasing and Publishing\n\n- Publish your code with a patch version:\n\n```bash\nnpm run release\n```\n\n- Or `npm run release:patch`, `npm run release:minor`, `npm run release:major`\n\n### Module structure\n\n- `/src` - any code which should be transpiled, published, and end up in production\n- `/test` - karma tests for everything in `/src`\n- `__sdk__.js` - metadata for compiling and bundling the final component\n\n#### `/src/component.js`\n\nThis module exports the public interface for the component.\n\n```javascript\nexport let LebowskiPay = {\n    render(options) {\n        ...\n    }\n};\n```\n\nThen the integrating site can run:\n\n```javascript\npaypal.LebowskiPay.render({ ... });\n```\n\n#### `/__sdk__.js`\n\n`__sdk__.js` defines any metadata which helps the sdk server compile and serve up the component.\n\n```javascript\nexport default {\n  /**\n   * Define the lebowski-pay component\n   * Now developers can include paypal.com/sdk/js?components=lebowski-pay\n   */\n\n  \"lebowski-pay\": {\n    /**\n     * Entry point. Everything exported from this module will be exported\n     * in the `window.paypal` namespace.\n     */\n\n    entry: \"./src/index\",\n  },\n};\n```\n\n### FAQ\n\n- **Why is there no webpack config, dist folder, or npm build command?**\n\n  This module (and modules like it) are not intended to be built as standalone components. It will be pulled in and compiled/bundled on the server-side, then combined with other modules.\n\n- **When should I publish?**\n\n  When you publish, you're signing off on your changes being code-complete, fully tested, and ready for release. Publishing **will not immediately trigger a deploy**, but please only publish changes which are in a deployable state.\n\n- **Can I define multiple components in one repo?**\n\n  Absolutely. `__sdk__.js` allows defining multiple entry points. These should generally represent different logical ui components, with separate concerns, and loose coupling. For example:\n\n  ```javascript\n  modules: {\n    'lebowski-pay': {\n        entry: './src/components/lebowski-pay'\n    },\n    'walter-pay': {\n        entry: './src/components/walter-pay'\n    },\n    'donnie-pay': {\n        entry: './src/components/donnie-pay'\n    }\n  },\n  ```\n\n  Please bear in mind that this opens the door to any combination or permutation of these modules to be requested by the merchant -- hence the need for loose coupling. `donnie-pay` should never have a hard dependency on `lebowski-pay` being present.\n\n- **Where is all of the karma, webpack, eslint, etc. config coming from?**\n\n  This module uses `@krakenjs/grumbler-scripts` as a common source of configuration and defaults. Any of these can be overriden, either partially, or entirely, depending on the individual needs of the module. You'll notice `.eslintrc.js`, `karma.conf.js`, etc. are lightweight wrappers which only define module-specific overrides.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaypal%2Fpaypal-example-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaypal%2Fpaypal-example-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaypal%2Fpaypal-example-components/lists"}