@getopenpay/openpay-js-react 0.0.24 → 0.1.6-alpha.720e7c5

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.
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@getopenpay/openpay-js-react",
3
- "version": "0.0.24",
3
+ "version": "0.1.6-alpha.720e7c5",
4
4
  "description": "Accept payments through OpenPay, right on your site",
5
5
  "author": "OpenPay <info@getopenpay.com> (https://getopenpay.com)",
6
+ "private": false,
7
+ "license": "ISC",
6
8
  "type": "module",
7
9
  "main": "dist/index.js",
8
10
  "types": "dist/index.d.ts",
9
- "license": "ISC",
10
11
  "files": [
11
12
  "dist"
12
13
  ],
@@ -17,32 +18,28 @@
17
18
  ],
18
19
  "scripts": {
19
20
  "build": "tsc -p tsconfig.build.json && vite build",
20
- "build:alpha": "npm run build -- --mode staging",
21
- "build:dev": "tsc -p tsconfig.build.json && NODE_ENV=development vite build --mode development --watch",
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",
24
- "test": "NODE_ENV=development npm run build -- --mode development && playwright test",
25
- "prepare": "husky"
21
+ "dev": "vite build --watch",
22
+ "lint": "eslint . --report-unused-disable-directives --max-warnings 0",
23
+ "lint:fix": "eslint . --fix --report-unused-disable-directives --max-warnings 0"
26
24
  },
27
25
  "dependencies": {
28
- "penpal": "^6.2.2",
29
26
  "use-async-effect": "^2.2.7",
30
27
  "uuid": "^10.0.0",
31
- "zod": "^3.23.8"
28
+ "zod": "^3.23.8",
29
+ "chalk": "^5.3.0",
30
+ "penpal": "^6.2.2"
32
31
  },
33
32
  "peerDependencies": {
34
33
  "react": "^16.x || ^17.x || ^18.x",
35
34
  "react-dom": "^16.x || ^17.x || ^18.x"
36
35
  },
37
36
  "devDependencies": {
38
- "@playwright/test": "^1.46.0",
37
+ "@getopenpay/config": "*",
38
+ "@getopenpay/utils": "*",
39
39
  "@stripe/stripe-js": "^4.3.0",
40
- "@types/node": "^22.0.2",
41
40
  "@types/react": "^18.2.0",
42
41
  "@types/react-dom": "^18.2.0",
43
42
  "@types/uuid": "^10.0.0",
44
- "@typescript-eslint/eslint-plugin": "^7.15.0",
45
- "@typescript-eslint/parser": "^7.15.0",
46
43
  "@vitejs/plugin-react": "^4.3.1",
47
44
  "eslint": "^8.57.0",
48
45
  "eslint-config-prettier": "^9.1.0",
package/README.md DELETED
@@ -1,152 +0,0 @@
1
- # openpay-js-react
2
-
3
- ## Installation
4
-
5
- ```shell npm
6
- npm install @getopenpay/openpay-js-react
7
- ```
8
-
9
- ```shell yarn
10
- yarn add @getopenpay/openpay-js-react
11
- ```
12
-
13
- ```shell pnpm
14
- pnpm add @getopenpay/openpay-js-react
15
- ```
16
-
17
- ## Usage
18
-
19
- See example usage here ([example usages](https://dash.readme.com/go/getopenpay?redirect=%2Fv1.0%2Fdocs%2Fexamples))
20
-
21
- ## Concepts
22
-
23
- ### Elements
24
-
25
- Elements are the embeds of secure web pages hosted on our servers. Elements must be used within the provider,`<ElementsForm />`, which provides context required by the elements.
26
-
27
- `<ElementsForm />` needs `checkoutSecureToken` which can be generated by creating a checkout session via OpenPay Python SDK. [Create Checkout Session](ref:create_checkout_session)
28
-
29
- The library provides separate card elements (Card number, expiry, CVV) and a combination these elements in a single line input field.
30
-
31
- - `<CardNumberElement />`
32
- - `<CardExpiryElement />`
33
- - `<CardCvcElement />`
34
- - `<CardElement />` (Combined)
35
-
36
- <br />
37
-
38
- ### Callbacks
39
-
40
- `ElementsForm` component, which is responsible for managing the form elements involved in the payment checkout process. This provides optional callback functions and properties that help customize the behavior of the form.
41
-
42
- `onFocus?: (elementId: string) => void`
43
- Triggered when a form element gains focus.
44
- Parameters:
45
- `elementId`: The ID of the element that gained focus.
46
-
47
- `onBlur?: (elementId: string) => void`
48
- Triggered when a form element loses focus.
49
- Parameters:
50
- `elementId`: The ID of the element that lost focus.
51
-
52
- `onChange?: (elementId: string) => void`
53
- Triggered when a form element's value changes.
54
- Parameters:
55
- `elementId`: The ID of the element whose value changed.
56
-
57
- `onLoad?: (totalAmountAtoms: number, currency?: string) => void`
58
- Triggered when the form is successfully loaded.
59
- Parameters:
60
- `totalAmountAtoms`: The total amount to be processed in atomic units (usually the smallest denomination of the currency).
61
- `currency`: (Optional) The currency code in which the transaction is being processed.
62
-
63
- `onLoadError?: (message: string) => void`
64
- Triggered if there is an error loading the form.
65
- Parameters:
66
- `message`: A string describing the error that occurred during form loading.
67
-
68
- `onValidationError?: (field: FieldNames, errors: string[], elementId?: string) => void`
69
- Triggered when there is a validation error in any of the form fields.
70
- Parameters:
71
- `field`: The name of the field that failed validation.
72
- `errors:` An array of error messages describing the validation issues.
73
- `elementId:` (Optional) The ID of the element where the validation error occurred.
74
-
75
- `onCheckoutStarted?: () => void`
76
- Triggered when the checkout process begins.
77
-
78
- `onCheckoutSuccess?: (invoiceUrls: string[], subscriptionIds: string[], customerId: string) => void`
79
- Triggered when the checkout process is successfully completed.
80
- Parameters:
81
- `invoiceUrls`: An array of URLs to the generated invoices.
82
-
83
- `onCheckoutError?: (message: string) => void`
84
- Triggered when an error occurs during the checkout process.
85
- Parameters:
86
- `message`: A string describing the error that occurred during checkout.
87
-
88
- <br />
89
-
90
- ### Billing information
91
-
92
- Customer billing information is required to proceed checkout. You can implement the input fields for billing information in your own way. Since you're in control of these fields, you can perform custom validations, custom styling and auto-fill with user account information.
93
- For OpenPay to access the input fields, please include `data-opid` attribute with predefined field names which can be accessed via `FieldName`.
94
-
95
- Fields must be rendered inside `<ElementsForm>`
96
-
97
- Available field names:
98
-
99
- - `FieldName.FIRST_NAME`
100
- - `FieldName.LAST_NAME`
101
- - `FieldName.EMAIL`
102
- - `FieldName.ZIP_CODE`
103
- - `FieldName.CITY`
104
- - `FieldName.STATE`
105
- - `FieldName.COUNTRY`
106
- - `FieldName.ADDRESS`
107
- - `FieldName.PHONE`
108
- - `FieldName.PROMOTION_CODE`
109
-
110
- <br />
111
-
112
- ### Styling
113
-
114
- By default, the elements provided are "Unstyled". They will have transparent background and text color adaptive to system's color scheme. You can wrap an element inside a container to which you can apply customized styling ([Examples](doc:examples)).
115
-
116
- If you want to customize the styling of the element itself you can apply via the optional `styles` prop. The following are supported properties. These support any valid CSS values.
117
-
118
- - `backgroundColor`
119
- - `color`
120
- - `fontFamily`
121
- - `fontSize`
122
- - `fontWeight`
123
- - `margin`
124
- - `padding`
125
-
126
- Optionally, placeholder can be configured via a property of `styles`.
127
-
128
- - `placeholder` : `string | { cardNumber: string, expiry: string, cvc: string }`
129
-
130
- For individual card elements: placeholder accepts a `string`
131
- For the combined`<CardElement>`: placeholder accepts an object `{ cardNumber: string, expiry: string, cvc: string }`
132
-
133
-
134
- ## Release | Publish
135
-
136
- ### Alpha version
137
-
138
- Default CDE environment for alpha version is `staging`
139
-
140
- A new alpha version is automatically released when a commit is pushed to main.
141
-
142
- ### Stable version
143
-
144
- Default CDE environment for stable version is `production`
145
-
146
- To release a new version:
147
- - the version in `package.json` need to be upgraded
148
- - merge the commit containing the version update to main
149
- - create a new release in github
150
- - create new tag with updated version (e.g. if version in package.json is `0.0.10`, create a tag named `v0.0.10`)
151
- - publish the release
152
- It will publish a new stable version to npm