@rinnebr/js 0.1.0-alpha.1 → 0.1.0-alpha.9

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/README.md CHANGED
@@ -1,29 +1,19 @@
1
1
  # Rinne JS
2
2
 
3
- A modern, type-safe browser library for integrating Apple Pay and Google Pay payment elements into your web applications. Built on Rinne's secure payment infrastructure with encryption powered by Evervault.
4
-
5
- ## Overview
6
-
7
- Rinne JS provides a simple, declarative API for rendering wallet payment buttons in the browser. The library handles:
8
-
9
- - Secure payment token encryption and transmission
10
- - Wallet button rendering and styling
11
- - Payment flow orchestration
12
- - Error handling and user cancellation
13
- - Transaction management
3
+ A modern, type-safe browser library for integrating Apple Pay and Google Pay payment elements into your web applications. Built on Rinne's secure payment infrastructure. Rinne JS provides a simple, declarative API for rendering wallet payment buttons in the browser with secure payment token encryption and transmission.
14
4
 
15
5
  ## Installation
16
6
 
17
7
  ```bash
18
- npm install rinne-js
8
+ npm install @rinnebr/js
19
9
  # or
20
- yarn add rinne-js
10
+ yarn add @rinnebr/js
21
11
  ```
22
12
 
23
13
  ## Quick Start
24
14
 
25
15
  ```typescript
26
- import { Rinne } from 'rinne-js'
16
+ import { Rinne } from '@rinnebr/js'
27
17
 
28
18
  // 1. Initialize Rinne with your merchant ID
29
19
  const rinne = new Rinne({
@@ -71,7 +61,7 @@ await applePay.mount('#payment-button')
71
61
 
72
62
  ### Initialization
73
63
 
74
- The `Rinne` class is the main entry point. It handles SDK initialization, merchant configuration fetching, and Evervault setup.
64
+ The `Rinne` class is the main entry point. It handles SDK initialization and merchant configuration fetching.
75
65
 
76
66
  ```typescript
77
67
  const rinne = new Rinne({
@@ -81,7 +71,7 @@ const rinne = new Rinne({
81
71
  })
82
72
  ```
83
73
 
84
- **Lazy Initialization**: The SDK initializes asynchronously when you first create a transaction or payment element. This includes fetching merchant configuration and loading the Evervault SDK.
74
+ **Lazy Initialization**: The SDK initializes asynchronously when you first create a transaction or payment element, including fetching your merchant configuration.
85
75
 
86
76
  ### Transactions
87
77
 
@@ -132,7 +122,7 @@ new Rinne(options: Options)
132
122
 
133
123
  ### `rinne.transaction`
134
124
 
135
- #### `create(params: TransactionCreateParams): Promise<EvTransaction>`
125
+ #### `create(params: TransactionCreateParams): Promise<Transaction>`
136
126
 
137
127
  Creates a new transaction for a payment.
138
128
 
@@ -159,7 +149,7 @@ const transaction = await rinne.transaction.create({
159
149
 
160
150
  ### `rinne.elements`
161
151
 
162
- #### `applePay(transaction: EvTransaction, options: ApplePayMountOptions): Promise<ApplePayElement>`
152
+ #### `applePay(transaction: Transaction, options: ApplePayMountOptions): Promise<ApplePayElement>`
163
153
 
164
154
  Creates an Apple Pay payment element.
165
155
 
@@ -169,7 +159,7 @@ Creates an Apple Pay payment element.
169
159
 
170
160
  **Returns:** Apple Pay element with `mount()` method
171
161
 
172
- #### `googlePay(transaction: EvTransaction, options: GooglePayMountOptions): Promise<GooglePayElement>`
162
+ #### `googlePay(transaction: Transaction, options: GooglePayMountOptions): Promise<GooglePayElement>`
173
163
 
174
164
  Creates a Google Pay payment element.
175
165
 
@@ -303,7 +293,7 @@ onCapture: (payload: WalletSuccessPayload, fail: (error) => void) => void
303
293
  ```typescript
304
294
  {
305
295
  card_data: CardData // Encrypted payment token and card details
306
- transaction: EvTransaction // Original transaction object
296
+ transaction: Transaction // Original transaction object
307
297
  }
308
298
  ```
309
299
 
@@ -413,7 +403,7 @@ onCancel: () => {
413
403
  ## Complete Example
414
404
 
415
405
  ```typescript
416
- import { Rinne } from 'rinne-js'
406
+ import { Rinne } from '@rinnebr/js'
417
407
 
418
408
  const rinne = new Rinne({
419
409
  merchantId: 'merchant_abc123',
@@ -522,28 +512,82 @@ import type {
522
512
  ApplePayElement,
523
513
  GooglePayElement,
524
514
  MountedElement
525
- } from 'rinne-js'
515
+ } from '@rinnebr/js'
526
516
  ```
527
517
 
528
518
  ## Error Handling Best Practices
529
519
 
530
520
  1. **Always handle `onCapture` failures**: Call `fail()` with a useful message if backend processing fails
531
- 2. **Implement `onError`**: Handle what to do in the rare event that the wallet buttons fail to load
521
+ 2. **Implement `onError`**: Handle what to do when wallet buttons fail to load or encounter issues
532
522
  3. **Handle `onCancel`**: Clean up UI state when user cancels
533
- 4. **Network errors**: Wrap backend calls in try-catch
523
+ 4. **Network errors**: Wrap backend calls in try-catch blocks
534
524
  5. **Validation**: Validate transaction parameters before calling `transaction.create()`
535
525
 
536
526
  ## Security
537
527
 
538
- - All payment tokens are encrypted using Evervault before transmission
539
- - No sensitive card data is stored in browser memory
540
- - Source maps are disabled to protect payment flow logic
541
- - Strict Content Security Policy recommended
528
+ - **Encryption**: All payment tokens are encrypted before transmission to your backend
529
+ - **No data storage**: No sensitive card data is stored in browser memory
530
+ - **Code protection**: Minified and obfuscated code to protect payment flow logic
531
+ - **HTTPS only**: Both Apple Pay and Google Pay require secure HTTPS connections
532
+ - **CSP compliance**: See [Requirements](#requirements) section for necessary Content Security Policy directives
533
+
534
+ ## Requirements
535
+
536
+ Before integrating Rinne JS, ensure your application meets these requirements:
537
+
538
+ ### HTTPS Required
539
+
540
+ **Both Apple Pay and Google Pay require your website to be served over HTTPS.** The payment buttons will not function on insecure HTTP connections.
541
+
542
+ ### Apple Pay Domain Verification
543
+
544
+ To accept Apple Pay payments, you must verify your domain with Rinne.
545
+
546
+ ### Content Security Policy (CSP)
547
+
548
+ If your website uses Content Security Policy headers, add these directives to allow Rinne JS to function:
549
+
550
+ ```
551
+ script-src https://js.evervault.com;
552
+ connect-src https://keys.evervault.com https://api.evervault.com https://api.rinne.com.br https://api-sandbox.rinne.com.br;
553
+ frame-src https://ui-components.evervault.com;
554
+ ```
555
+
556
+ **Note**: Rinne uses secure encryption infrastructure that requires loading scripts from trusted CDNs. These domains cannot be self-hosted due to PCI compliance requirements.
557
+
558
+ ### User Requirements
559
+
560
+ For payments to work, users must:
561
+ - Have at least one card added to their Apple Wallet (Apple Pay) or Google Pay
562
+ - Use a supported browser and device
563
+ - Be located outside Mainland China (Apple Pay restriction)
564
+
565
+ ## Browser and Device Support
566
+
567
+ ### Apple Pay
568
+
569
+ **Supported Browsers:**
570
+ - Safari (iOS 10+ and macOS 10.12+)
571
+ - Chrome
572
+ - Edge
573
+
574
+ **Requirements:**
575
+ - Safari users must enable Apple Pay: **Settings > Safari > Advanced > Allow websites to check for Apple Pay**
576
+ - On laptops using Safari, Touch ID must be accessible
577
+ - HTTPS required
578
+
579
+ ### Google Pay
542
580
 
543
- ## Development
581
+ **Supported Browsers:**
582
+ - Chrome
583
+ - Firefox
584
+ - Edge
585
+ - Safari (on supported devices)
544
586
 
545
- See [CLAUDE.md](./CLAUDE.md) for development setup and tooling information.
587
+ **Requirements:**
588
+ - HTTPS required
589
+ - Users must have at least one card added to Google Pay
546
590
 
547
- ## License
591
+ ## Support
548
592
 
549
- MIT
593
+ For issues, questions, or feature requests, please contact Rinne support or visit our documentation at [https://rinne.com.br](https://rinne.com.br).
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { EvTransaction } from './evervault-types';
1
+ import { loadEvervault } from '@evervault/js';
2
2
 
3
3
  export declare interface ApplePayElement {
4
4
  mount(target: string | HTMLElement): Promise<MountedElement>;
@@ -37,7 +37,9 @@ export declare interface ElementsNamespace {
37
37
 
38
38
  export declare type Environment = 'sandbox' | 'production';
39
39
 
40
- export { EvTransaction }
40
+ declare type EvervaultInstance = Awaited<ReturnType<typeof loadEvervault>>;
41
+
42
+ export declare type EvTransaction = ReturnType<EvervaultInstance['transactions']['create']>;
41
43
 
42
44
  export declare interface GooglePayElement {
43
45
  mount(target: string | HTMLElement): Promise<MountedElement>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rinnebr/js",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.9",
4
4
  "description": "Modern payment elements library for Apple Pay, Google Pay, and other payment methods",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@4.9.1",
@@ -48,7 +48,7 @@
48
48
  "license": "MIT",
49
49
  "repository": {
50
50
  "type": "git",
51
- "url": "https://github.com/rinnebr/rinne-js.git"
51
+ "url": "git+https://github.com/rinnebr/rinne-js.git"
52
52
  },
53
53
  "bugs": {
54
54
  "url": "https://github.com/rinnebr/rinne-js/issues"