@primer-io/primer-js 0.4.0 → 0.5.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @primer-io/primer-js
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5af5a6c: sdk-core-default set to true fix
8
+
9
+ ## 0.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 791a212: BLIK support
14
+
3
15
  ## 0.4.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -1,19 +1,8 @@
1
- # Primer Composable Checkout
1
+ # Primer Checkout SDK
2
2
 
3
3
  ![Primer Logo](https://goat-assets.production.core.primer.io/brand/icon/primer.svg)
4
4
 
5
- > **BETA NOTICE**: Primer Composable Checkout is currently in beta. While the core architecture and design philosophy will remain stable, some aspects may evolve based on feedback, including variable naming, component naming, and API refinements. By using this beta version, you'll have the opportunity to influence its development before general release.
6
-
7
- Primer Composable Checkout is a web component-based SDK that enables you to build customizable, PCI-compliant checkout experiences quickly and easily. With Primer's flexible component architecture, you can create branded payment experiences that work consistently across all modern browsers.
8
-
9
- ## Features
10
-
11
- - 🧩 **Component-Based Architecture**: Modular web components built on modern web standards
12
- - 🎨 **Highly Customizable**: Extensive theming options through CSS custom properties
13
- - 🔒 **Secure by Design**: PCI-compliant payment flows with secure form handling
14
- - 📱 **Responsive**: Works seamlessly across devices and screen sizes
15
- - 🌐 **Framework Agnostic**: Integrates with any JavaScript environment or framework
16
- - 🔄 **Multiple Payment Methods**: Support for cards, digital wallets, and alternative payment methods
5
+ A modern web component-based SDK for integrating Primer's Checkout into your web application. Support for cards, digital wallets, and 100+ payment methods with minimal code.
17
6
 
18
7
  ## Installation
19
8
 
@@ -21,126 +10,119 @@ Primer Composable Checkout is a web component-based SDK that enables you to buil
21
10
  npm install @primer-io/primer-js
22
11
  ```
23
12
 
24
- Then import and initialize Primer in your application:
13
+ ## Quick Start
25
14
 
26
15
  ```javascript
27
16
  import { loadPrimer } from '@primer-io/primer-js';
28
- loadPrimer();
29
- ```
30
17
 
31
- ## Quick Start
32
-
33
- Import the css styles:
18
+ // Load the SDK
19
+ loadPrimer();
34
20
 
35
- ```html
36
- <link
37
- rel="stylesheet"
38
- href="https://sdk.primer.io/web/primer-js/v0-latest/styles.css"
39
- />
40
- <!-- The dark theme import below is optional -->
41
- <link
42
- rel="stylesheet"
43
- href="https://sdk.primer.io/web/primer-js/v0-latest/dark.css"
44
- />
21
+ // Add checkout to your page
22
+ // <primer-checkout client-token="your-client-token"></primer-checkout>
45
23
  ```
46
24
 
47
- Render the checkout:
48
-
49
25
  ```html
50
26
  <primer-checkout client-token="your-client-token"></primer-checkout>
51
27
  ```
52
28
 
53
- ## Basic Usage
29
+ That's it! The SDK handles payment method rendering, validation, and payment processing.
54
30
 
55
- ### Complete Checkout Form
31
+ ## Prerequisites
56
32
 
57
- ```html
58
- <primer-checkout client-token="your-client-token">
59
- <primer-main slot="main">
60
- <div slot="payments">
61
- <primer-payment-method type="PAYMENT_CARD"></primer-payment-method>
62
- <primer-payment-method type="PAYPAL"></primer-payment-method>
63
- <primer-payment-method type="GOOGLE_PAY"></primer-payment-method>
64
- </div>
65
- </primer-main>
66
- </primer-checkout>
67
- ```
33
+ Before using the SDK, you'll need:
68
34
 
69
- ### Custom Card Form Layout
35
+ 1. A Primer account with [Universal Checkout configuration](https://primer.io/docs/payments/universal-checkout/configure-universal-checkout-without-code)
36
+ 2. A client token from the [Client Session API](https://primer.io/docs/api/api-reference/client-session-api/create-client-side-token)
70
37
 
71
- ```html
72
- <primer-checkout client-token="your-client-token">
73
- <primer-main slot="main">
74
- <div slot="payments">
75
- <primer-payment-method type="PAYMENT_CARD">
76
- <primer-card-form>
77
- <div slot="card-form-content">
78
- <primer-input-card-number></primer-input-card-number>
79
- <div style="display: flex; gap: 8px;">
80
- <primer-input-card-expiry></primer-input-card-expiry>
81
- <primer-input-cvv></primer-input-cvv>
82
- </div>
83
- <primer-input-card-holder-name></primer-input-card-holder-name>
84
- <primer-button buttonType="submit">Pay Now</primer-button>
85
- </div>
86
- </primer-card-form>
87
- </primer-payment-method>
88
- </div>
89
- </primer-main>
90
- </primer-checkout>
91
- ```
38
+ ## Browser Support
92
39
 
93
- ## Event Handling
40
+ Works with all modern browsers (Chrome, Firefox, Safari, Edge). Internet Explorer 11 and legacy Edge are not supported.
94
41
 
95
- ```javascript
96
- const checkout = document.querySelector('primer-checkout');
42
+ ## Key Features
97
43
 
98
- // Listen for SDK state changes
99
- checkout.addEventListener('primer-state-changed', (event) => {
100
- const { isProcessing, isSuccessful, error } = event.detail;
101
- // Handle state changes
102
- });
44
+ - **Universal Checkout**: Support for 100+ payment methods with a single integration
45
+ - **Web Components**: Works with React, Vue, Svelte, Next.js, and vanilla JavaScript
46
+ - **Customizable**: Full styling control via CSS variables
47
+ - **Event-Driven**: Listen to payment lifecycle events
48
+ - **TypeScript**: Full type definitions included
49
+ - **Vault Mode**: Save payment methods for future use
103
50
 
104
- // Listen for available payment methods
105
- checkout.addEventListener('primer-payment-methods-updated', (event) => {
106
- const paymentMethods = event.detail.toArray();
107
- // Handle payment methods list
108
- });
109
- ```
51
+ ## Documentation
52
+
53
+ 📚 [Web Components Documentation](https://web-components.primer.io)
54
+
55
+ ### Quick Links
56
+
57
+ - [Getting Started Guide](https://web-components.primer.io/documentation/getting-started)
58
+ - [SDK Options Reference](https://web-components.primer.io/sdk-reference/sdk-options-reference)
59
+ - [Events Guide](https://web-components.primer.io/guides/events-guide)
60
+ - [React Integration Guide](https://web-components.primer.io/guides/react-guide)
61
+ - [Styling API Documentation](https://web-components.primer.io/sdk-reference/styling-api-docs)
62
+
63
+ ## Examples
64
+
65
+ See working examples with different frameworks and use cases:
110
66
 
111
- ## Theming
67
+ 🔗 [GitHub Examples Repository](https://github.com/primer-io/examples)
112
68
 
113
- Primer Composable Checkout supports both light and dark themes and can be easily customized to match your brand:
69
+ ### Available Examples
114
70
 
115
- ```css
116
- :root {
117
- /* Brand colors */
118
- --primer-color-brand: #663399; /* Purple brand color */
71
+ - Vanilla JavaScript + TypeScript
72
+ - React with custom layouts
73
+ - Theme customization
74
+ - Vaulted payments
75
+ - Server-side rendering
119
76
 
120
- /* Typography */
121
- --primer-typography-brand: 'Roboto', sans-serif;
77
+ ## TypeScript Support
122
78
 
123
- /* Border radius */
124
- --primer-radius-base: 8px;
79
+ TypeScript definitions are included. For JSX/TSX projects, add type declarations:
125
80
 
126
- /* Spacing */
127
- --primer-space-base: 8px;
81
+ ```typescript
82
+ import type { CheckoutElement } from '@primer-io/primer-js';
83
+
84
+ declare global {
85
+ namespace JSX {
86
+ interface IntrinsicElements {
87
+ 'primer-checkout': CheckoutElement;
88
+ }
89
+ }
128
90
  }
129
91
  ```
130
92
 
131
- ## Documentation
93
+ ## Event Handling
132
94
 
133
- For comprehensive documentation, guides, and API reference, please visit:
95
+ Listen to payment lifecycle events:
134
96
 
135
- [Primer Composable Checkout Documentation](https://composable-checkout.vercel.app)
97
+ ```javascript
98
+ const checkout = document.querySelector('primer-checkout');
136
99
 
137
- ## Supported Browsers
100
+ checkout.addEventListener('primer:ready', () => {
101
+ console.log('Checkout ready');
102
+ });
103
+
104
+ checkout.addEventListener('primer:state-change', (event) => {
105
+ const { isProcessing, isSuccessful, error } = event.detail;
106
+ // Handle payment state changes
107
+ });
108
+ ```
138
109
 
139
- - Chrome
140
- - Firefox
141
- - Safari
142
- - Edge
110
+ ## Support
111
+
112
+ - **Documentation**: [Web Components Documentation](https://web-components.primer.io)
113
+ - **API Reference**: [Primer API Docs](https://primer.io/docs/api)
114
+ - **Support**: Contact your Primer account manager
143
115
 
144
116
  ## License
145
117
 
146
- Copyright © Primer API Ltd. All rights reserved.
118
+ **BSD 3-Clause License**
119
+
120
+ Copyright (c) 2021 Primer API Ltd. All rights reserved.
121
+
122
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
123
+
124
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
125
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
126
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
127
+
128
+ > **Disclaimer**: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.