@getopenpay/openpay-js-react 0.0.1 → 0.0.2-alpha.6c3bbd9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/index.d.ts +51 -12
  2. package/dist/index.js +853 -730
  3. package/package.json +13 -3
  4. package/.env.development +0 -1
  5. package/.env.production +0 -1
  6. package/.env.staging +0 -1
  7. package/.eslintrc.cjs +0 -18
  8. package/.github/workflows/alpha-release.yml +0 -39
  9. package/.github/workflows/release.yml +0 -30
  10. package/Makefile +0 -37
  11. package/example/.eslintrc.json +0 -3
  12. package/example/Makefile +0 -10
  13. package/example/README.md +0 -36
  14. package/example/next.config.mjs +0 -4
  15. package/example/package-lock.json +0 -5283
  16. package/example/package.json +0 -27
  17. package/example/postcss.config.mjs +0 -8
  18. package/example/public/next.svg +0 -1
  19. package/example/public/vercel.svg +0 -1
  20. package/example/src/app/elements/_components/FormWrapper.tsx +0 -18
  21. package/example/src/app/elements/_components/InputField.tsx +0 -11
  22. package/example/src/app/elements/card/page.tsx +0 -54
  23. package/example/src/app/elements/card-cvc/page.tsx +0 -29
  24. package/example/src/app/elements/card-expiry/page.tsx +0 -29
  25. package/example/src/app/elements/card-number/page.tsx +0 -29
  26. package/example/src/app/favicon.ico +0 -0
  27. package/example/src/app/globals.css +0 -14
  28. package/example/src/app/layout.tsx +0 -22
  29. package/example/src/app/page.tsx +0 -119
  30. package/example/tailwind.config.ts +0 -11
  31. package/example/tsconfig.json +0 -26
  32. package/lib/components/_common/frame.tsx +0 -73
  33. package/lib/components/card-cvc.tsx +0 -11
  34. package/lib/components/card-expiry.tsx +0 -11
  35. package/lib/components/card-number.tsx +0 -11
  36. package/lib/components/card.tsx +0 -11
  37. package/lib/components/form.tsx +0 -100
  38. package/lib/hooks/context.ts +0 -17
  39. package/lib/hooks/use-openpay-elements.ts +0 -12
  40. package/lib/index.ts +0 -16
  41. package/lib/utils/constants.ts +0 -1
  42. package/lib/utils/element.ts +0 -5
  43. package/lib/utils/event.ts +0 -66
  44. package/lib/utils/style.ts +0 -17
  45. package/lib/vite-env.d.ts +0 -1
  46. package/ngrok.example.yml +0 -6
  47. package/playwright.config.ts +0 -37
  48. package/tests/card-cvc.test.ts +0 -68
  49. package/tests/card-element.test.ts +0 -113
  50. package/tests/card-expiry.test.ts +0 -61
  51. package/tests/card-number.test.ts +0 -61
  52. package/tests/constants.ts +0 -97
  53. package/tsconfig.build.json +0 -28
  54. package/tsconfig.json +0 -11
  55. package/tsconfig.node.json +0 -13
  56. package/vite.config.ts +0 -36
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@getopenpay/openpay-js-react",
3
- "version": "0.0.1",
3
+ "version": "0.0.2-alpha.6c3bbd9",
4
4
  "description": "Accept payments through OpenPay, right on your site",
5
5
  "author": "OpenPay <info@getopenpay.com> (https://getopenpay.com)",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "license": "ISC",
10
+ "files": [
11
+ "dist"
12
+ ],
10
13
  "keywords": [
11
14
  "getopenpay",
12
15
  "openpay",
@@ -14,10 +17,12 @@
14
17
  ],
15
18
  "scripts": {
16
19
  "build": "tsc -p tsconfig.build.json && vite build",
20
+ "build:alpha": "npm run build -- --mode staging",
17
21
  "build:dev": "tsc -p tsconfig.build.json && NODE_ENV=development vite build --mode development --watch",
18
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
22
+ "lint": "eslint . --ignore-path=.eslintignore --report-unused-disable-directives --max-warnings 0",
23
+ "lint:fix": "eslint . --fix --ignore-path=.eslintignore --report-unused-disable-directives --max-warnings 0",
19
24
  "test": "NODE_ENV=development npm run build -- --mode development && playwright test",
20
- "build:alpha": "NODE_ENV=development npm run build -- --mode development"
25
+ "prepare": "husky"
21
26
  },
22
27
  "dependencies": {
23
28
  "react": "^18.3.1",
@@ -35,8 +40,13 @@
35
40
  "@typescript-eslint/parser": "^7.15.0",
36
41
  "@vitejs/plugin-react": "^4.3.1",
37
42
  "eslint": "^8.57.0",
43
+ "eslint-config-prettier": "^9.1.0",
44
+ "eslint-plugin-jsx-a11y": "^6.9.0",
45
+ "eslint-plugin-prettier": "^5.2.1",
46
+ "eslint-plugin-react": "^7.35.0",
38
47
  "eslint-plugin-react-hooks": "^4.6.2",
39
48
  "eslint-plugin-react-refresh": "^0.4.7",
49
+ "husky": "^9.1.4",
40
50
  "typescript": "^5.2.2",
41
51
  "vite": "^5.3.4",
42
52
  "vite-plugin-dts": "^4.0.0-beta.2"
package/.env.development DELETED
@@ -1 +0,0 @@
1
- VITE_CDE_BASE_URL = "http://localhost:3030"
package/.env.production DELETED
@@ -1 +0,0 @@
1
- VITE_CDE_BASE_URL = "https://cde.getopenpay.com"
package/.env.staging DELETED
@@ -1 +0,0 @@
1
- VITE_CDE_BASE_URL = "https://cde.openpaystaging.com"
package/.eslintrc.cjs DELETED
@@ -1,18 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: { browser: true, es2020: true },
4
- extends: [
5
- 'eslint:recommended',
6
- 'plugin:@typescript-eslint/recommended',
7
- 'plugin:react-hooks/recommended',
8
- ],
9
- ignorePatterns: ['dist', '.eslintrc.cjs'],
10
- parser: '@typescript-eslint/parser',
11
- plugins: ['react-refresh'],
12
- rules: {
13
- 'react-refresh/only-export-components': [
14
- 'warn',
15
- { allowConstantExport: true },
16
- ],
17
- },
18
- }
@@ -1,39 +0,0 @@
1
- name: 'Publish alpha release'
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
-
8
- jobs:
9
- publish:
10
- name: 🚀 Publishing to NPM
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - uses: actions/checkout@v3
15
- with:
16
- version: 8
17
- - uses: actions/setup-node@v3
18
- with:
19
- node-version: 22
20
- registry-url: https://registry.npmjs.org/
21
-
22
- - name: Set hash and version variable
23
- # To generate unique hashes for each alpha release without having to change version in package.json
24
- run: |
25
- echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
26
- echo "VERSION=$(npm view ./ version)" >> $GITHUB_ENV
27
-
28
- - name: Build package
29
- run: |
30
- npm ci
31
- npm run build:alpha
32
- # ^ For now to use localhost for cde
33
-
34
- - name: Publish package
35
- run: |
36
- npm version ${{ env.VERSION }}-alpha.${{ env.COMMIT_HASH }} --no-git-tag-version
37
- npm publish --tag alpha --access public
38
- env:
39
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
@@ -1,30 +0,0 @@
1
- name: 'Publish stable release'
2
-
3
- on:
4
- release:
5
- types: [created]
6
-
7
- jobs:
8
- publish:
9
- name: 🚀 Publishing to NPM
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - uses: actions/checkout@v3
14
- with:
15
- version: 8
16
- - uses: actions/setup-node@v3
17
- with:
18
- node-version: 22
19
- registry-url: https://registry.npmjs.org/
20
-
21
- - name: Build package
22
- run: |
23
- npm ci
24
- npm run build
25
-
26
- - name: Publish package
27
- run: |
28
- npm publish --access public
29
- env:
30
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
package/Makefile DELETED
@@ -1,37 +0,0 @@
1
- .PHONY: install dev start build publish
2
-
3
- install:
4
- npm install
5
- cd example && make install
6
- npx playwright install --with-deps chromium
7
-
8
- dev:
9
- npm run build:dev
10
-
11
- start: dev
12
-
13
- build:
14
- npm run build
15
-
16
- publish: build
17
- npm whoami || npm adduser
18
- npm publish
19
-
20
- run-example:
21
- ngrok start --all --config ngrok.yml
22
-
23
- integration-test: start-ngrok
24
- sleep 2 && \
25
- BASE_URL=$$(curl http://localhost:4040/api/tunnels | jq -r ".tunnels[0].public_url") && \
26
- export BASE_URL=$$BASE_URL && \
27
- npm run test && \
28
- make stop-ngrok
29
-
30
-
31
- start-ngrok:
32
- nohup ngrok start --all --config ngrok.yml > /dev/null &
33
-
34
- stop-ngrok:
35
- @echo "Stopping ngrok..."
36
- @pkill ngrok || true
37
- @echo "Ngrok stopped."
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "next/core-web-vitals"
3
- }
package/example/Makefile DELETED
@@ -1,10 +0,0 @@
1
- .PHONY: install dev start
2
-
3
- install:
4
- npm install
5
-
6
- dev:
7
- npm install ../
8
- npm run dev
9
-
10
- start: dev
package/example/README.md DELETED
@@ -1,36 +0,0 @@
1
- This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2
-
3
- ## Getting Started
4
-
5
- First, run the development server:
6
-
7
- ```bash
8
- npm run dev
9
- # or
10
- yarn dev
11
- # or
12
- pnpm dev
13
- # or
14
- bun dev
15
- ```
16
-
17
- Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
-
19
- You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
-
21
- This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22
-
23
- ## Learn More
24
-
25
- To learn more about Next.js, take a look at the following resources:
26
-
27
- - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
- - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
-
30
- You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31
-
32
- ## Deploy on Vercel
33
-
34
- The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
-
36
- Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
@@ -1,4 +0,0 @@
1
- /** @type {import('next').NextConfig} */
2
- const nextConfig = {};
3
-
4
- export default nextConfig;