@easyflow/javascript-sdk 2.1.24 → 2.1.26

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,1245 +1,254 @@
1
- # Easyflow JavaScript SDK
1
+ # 🚀 Easyflow SDK - E2E Test Project
2
2
 
3
- [![Version](https://img.shields.io/badge/version-2.1.19-blue.svg)](https://easyflow-sdk.pages.dev)
4
- [![License](https://img.shields.io/badge/license-ISC-green.svg)](LICENSE)
5
- [![Tests](https://img.shields.io/badge/tests-251%20passing-brightgreen.svg)](https://easyflow-sdk.pages.dev)
6
- [![Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen.svg)](https://easyflow-sdk.pages.dev)
3
+ ## 📋 Overview
7
4
 
8
- <div align="center">
5
+ Este é um projeto **React + TypeScript** que demonstra a integração **end-to-end** do Easyflow SDK via NPM, simulando exatamente como uma plataforma como o **Lovable** faria a integração.
9
6
 
10
- ![Easyflow Logo](https://www.easyflow.digital/wp-content/uploads/2023/12/logo-easyflow.png)
7
+ ## 🎯 Objetivo
11
8
 
12
- **Freedom to sell more, better and longer**
9
+ **Provar que o SDK funciona perfeitamente** quando instalado via NPM em projetos TypeScript/React, com:
13
10
 
14
- > **Enterprise-grade JavaScript SDK** for integration with the Easyflow payment processing platform with robust
15
- > validation, comprehensive security and Brazilian compliance
11
+ - **Import direto** via NPM
12
+ - **Tipos TypeScript** funcionando
13
+ - ✅ **Build com Vite** sem erros
14
+ - ✅ **Integração simples** e direta
15
+ - ✅ **Funcionalidades completas** do SDK
16
+ - ✅ **Interface real** para testar todos os métodos
16
17
 
17
- [![Website](https://img.shields.io/badge/Website-Easyflow.digital-667eea?style=for-the-badge)](https://www.easyflow.digital/)
18
- [![Start Free](https://img.shields.io/badge/Start_Free-22c55e?style=for-the-badge&logo=rocket&logoColor=white)](https://www.easyflow.digital/)
19
- [![Documentation](https://img.shields.io/badge/Documentation-3b82f6?style=for-the-badge&logo=book&logoColor=white)](https://docs.easyflow.digital)
18
+ ## 🚀 Como Funciona
20
19
 
21
- </div>
22
-
23
- ## About Easyflow
24
-
25
- [Easyflow](https://www.easyflow.digital/) is a payment platform that **facilitates the sales process** of digital
26
- products and services in a simple and intuitive way. Our mission is to transform Digital Commerce by offering a complete
27
- sales structure to maximize your LTV.
28
-
29
- ### Why Choose Easyflow?
30
-
31
- - **Outstanding approval rate**: 95% to 98% credit card approval rate
32
- - **High conversion checkout**: Fastest loading in the market
33
- - **Simplified recurrence**: Recurring payments with your own rules
34
- - **Bank-level security**: PCI Compliance and advanced encryption
35
- - **Same-day withdrawal**: Same day, no bureaucracy
36
- - **Simple integrations**: Webhooks and API with few clicks
37
-
38
- ### Payment Methods
39
-
40
- - **Credit Card**: Highest approval rate in the market
41
- - **PIX**: Instant Brazilian payment
42
- - **Bank Billet**: For those who prefer to pay via bank
43
-
44
- ### Main Features
45
-
46
- - **Optimized checkout** for maximum conversion
47
- - **AI-powered sales recovery** (up to 40% increase)
48
- - **Upsell, downsell and cross-sell** to increase average ticket
49
- - **Automated payment splitting** for co-producers
50
- - **Smart metrics and insights** in real time
51
- - **Integration with CRM, ERPs** and third-party platforms
52
-
53
- ### Plans and Fees
54
-
55
- **Clear and fair rate: 6.99% + R$2.50**
56
-
57
- - **Revenue +100k per month?** [Click here for special conditions](https://www.easyflow.digital/)
58
- - **You only pay when you generate results**
59
- - **No hidden fees or surprises**
60
-
61
- ## Try It Now
62
-
63
- <div align="center">
64
-
65
- [![Test SDK](https://img.shields.io/badge/Test_SDK_Online-667eea?style=for-the-badge&logo=javascript&logoColor=white)](https://easyflow-sdk.pages.dev)
66
-
67
- **Experience the Easyflow SDK in action with our interactive demo**
68
-
69
- </div>
70
-
71
- ## What is the Easyflow JavaScript SDK?
72
-
73
- The **Easyflow JavaScript SDK** is the official tool for developers to integrate their applications with the Easyflow
74
- platform. With this SDK, you can:
75
-
76
- - **Process payments** securely and reliably
77
- - **Manage customers** with complete Brazilian data validation
78
- - **Create offers** and process orders automatically
79
- - **Implement recurrence** with custom rules
80
- - **Integrate with any system** via REST API
81
-
82
- ### SDK Advantages
83
-
84
- - **100% Plug & Play**: Works with any type of business
85
- - **Brazilian Compliance**: CPF/CNPJ, phone, address validation
86
- - **Enterprise Security**: Multiple layers of protection
87
- - **High Performance**: Optimized for production
88
- - **Complete Documentation**: Practical examples for all use cases
89
-
90
- ## What's New in v2.1.19
91
-
92
- ### Complete Implementation Examples
93
-
94
- - **Full Data Models**: Comprehensive examples for placeOrder, charge, createCustomer, and addCreditCard
95
- - **Real-World Scenarios**: Complete workflows with all available data fields
96
- - **Brazilian Data**: Realistic Brazilian addresses, phone numbers, and document formats
97
- - **End-to-End Workflows**: Complete customer → credit card → order examples
98
- - **Code Quality**: Improved formatting and consistency across all examples
99
-
100
- ### Credit Card Token Validation Fix
101
-
102
- - **Real Token Support**: Now accepts real encrypted/ciphered credit card tokens
103
- - **Flexible Format**: Supports Base64, URL-safe, and mixed character tokens
104
- - **Variable Length**: Accepts tokens from 16 to 2048 characters
105
- - **Enhanced Security**: Maintains security while accepting real-world tokens
106
- - **Backward Compatibility**: Works with all existing token formats
107
-
108
- ### Workflow Corrections
109
-
110
- - **GitHub Actions Fixed**: Resolved release workflow permissions and SRI hash generation
111
- - **CDN Deployment**: Automated deployment to Cloudflare Pages working correctly
112
- - **Release Automation**: GitHub releases created automatically with proper SRI hashes
113
- - **Build Process**: Streamlined build and deployment pipeline
114
-
115
- ### Hybrid Distribution Strategy
116
-
117
- - **NPM Package**: Contains only documentation and TypeScript definitions
118
- - **CDN Scripts**: Production-ready obfuscated builds via Cloudflare Pages and jsDelivr
119
- - **Enhanced Security**: Code source protected while maintaining accessibility
120
- - **Better UX**: Easy discovery via NPM, secure usage via CDN
121
-
122
- ### Security & Privacy Improvements
123
-
124
- - **README Anonymization**: Removed all personal information and sensitive data
125
- - **Privacy Protection**: No personal emails, URLs, or contact information exposed
126
- - **Professional Documentation**: Clean, business-focused documentation
127
- - **NPM Safety**: Safe for public NPM publication
128
-
129
- ### Test Suite Improvements
130
-
131
- - **Test Coverage Optimization**: Fixed all failing unit tests for complete 250 test coverage
132
- - **Mock Structure Corrections**: Updated test mocks to align with actual API response patterns
133
- - **Customer Management Tests**: Corrected mock structures for `createCustomer` and `getCustomer` methods
134
- - **Credit Card Tests**: Fixed mock data structures for `addCreditCard` and `getCreditCard` methods
135
- - **Consistent Test Patterns**: Standardized mock response structures across all endpoints
136
-
137
- ### API Response Pattern Standardization
138
-
139
- - **Customer Methods**: Properly handle `response.data.customer` structure
140
- - **Credit Card Methods**: Correctly process `response.data.creditCard` structure
141
- - **Order Methods**: Maintain existing `response.data` pattern
142
- - **Improved Reliability**: Enhanced test reliability and maintainability
143
-
144
- ### Enhanced ID Validation Support
145
-
146
- - **Multiple ID Format Support**: Now accepts UUID v4, UUID v7, and MongoDB ObjectId formats
147
- - **UUID v4**: Standard format `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx` (y = 8,9,A,B)
148
- - **UUID v7**: Modern format `xxxxxxxx-xxxx-7xxx-yxxx-xxxxxxxxxxxx` (y = 8,9,A,B)
149
- - **MongoDB ObjectId**: 24-character hexadecimal format `507f1f77bcf86cd799439011`
150
- - **Strict Validation**: Rejects any other formats for enhanced security
151
-
152
- ## Quick Start
153
-
154
- ### Installation
155
-
156
- #### Option 1: CDN Script (Recommended)
157
-
158
- Add this script tag to your HTML:
159
-
160
- ```html
161
- <!-- Latest version -->
162
- <script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>
163
-
164
- <!-- Specific version -->
165
- <script src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.19.min.js"></script>
166
- ```
167
-
168
- #### Option 2: CDN jsDelivr (Alternative)
169
-
170
- ```html
171
- <!-- Latest version -->
172
- <script src="https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@latest/dist/easyflow-sdk.min.js"></script>
173
-
174
- <!-- Specific version -->
175
- <script src="https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@2.1.20/dist/easyflow-sdk.min.js"></script>
176
- ```
177
-
178
- #### Option 3: NPM Package (Documentation Only)
20
+ ### **1. Instalação via NPM**
179
21
 
180
22
  ```bash
181
- npm install @easyflow/javascript-sdk
23
+ npm install @easyflow/javascript-sdk@latest
182
24
  ```
183
25
 
184
- **Note**: The NPM package contains only documentation. For production use, use the CDN scripts above.
185
-
186
- ### Basic Usage
187
-
188
- ```javascript
189
- // Configure the global instance
190
- easyflowSDK.configure({
191
- businessId: 'demo-business-12345',
192
- })
193
-
194
- // Process a payment
195
- easyflowSDK
196
- .placeOrder('demo-offer-67890', {
197
- customer: {
198
- name: 'João Silva',
199
- email: 'joao@exemplo.com',
200
- document: {
201
- type: 'CPF',
202
- number: '12345678901',
203
- },
204
- },
205
- payments: [
206
- {
207
- method: 'credit-card',
208
- numberInstallments: 1,
209
- },
210
- ],
211
- })
212
- .then((orderId) => {
213
- console.log('Pedido criado:', orderId)
214
- })
215
- .catch((error) => {
216
- console.error('Erro ao criar pedido:', error.message)
217
- })
218
- ```
26
+ ### **2. Import Direto**
219
27
 
220
- ## Features
221
-
222
- ### Payment Processing
223
-
224
- - **Credit Card**: Highest approval rate with advanced fraud detection
225
- - **PIX**: Instant Brazilian payment method
226
- - **Bank Billet**: Traditional bank payment option
227
- - **Recurring Payments**: Custom subscription rules
228
-
229
- ### Customer Management
230
-
231
- - **Complete Validation**: CPF/CNPJ, phone, address validation
232
- - **Data Sanitization**: XSS protection and input cleaning
233
- - **Secure Storage**: Encrypted sensitive data handling
234
-
235
- ### Security Features
236
-
237
- - **PCI Compliance**: Bank-level security standards
238
- - **Fingerprinting**: Advanced fraud detection
239
- - **Rate Limiting**: Protection against abuse
240
- - **Input Validation**: Comprehensive data validation
241
- - **Obfuscated Builds**: Production builds are obfuscated for enhanced security
242
- - **Controlled Distribution**: Secure distribution via CDN (Cloudflare Pages + jsDelivr)
243
-
244
- ## API Reference
245
-
246
- ### Core Methods
247
-
248
- #### `placeOrder(offerId, data, headers)`
249
-
250
- Creates an order using an existing offer.
251
-
252
- ```javascript
253
- const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
254
- buyer: {
255
- customerId: customer.id,
256
- name: 'E. R.',
257
- email: 'e***o@gmail.com',
258
- document: {
259
- number: '***202266**',
260
- type: 'CPF',
261
- },
262
- phone: {
263
- areaCode: '+55',
264
- ddd: '92',
265
- number: '*****2191',
266
- isMobile: true,
267
- },
268
- address: {
269
- zipCode: '37537***',
270
- street: 'Rua R. C. M. de A.',
271
- complement: '',
272
- neighborhood: 'M. do S.',
273
- city: 'Santa Rita do Sapucaí',
274
- state: 'MG',
275
- number: '***',
276
- },
277
- },
278
- payments: [
279
- {
280
- method: 'credit-card',
281
- creditCard: {
282
- token: 'valid token here',
283
- },
284
- numberInstallments: 1,
285
- },
286
- ],
287
- metadata: [],
288
- })
28
+ ```typescript
29
+ import EasyflowSDK from '@easyflow/javascript-sdk'
289
30
  ```
290
31
 
291
- #### `charge(data, headers)`
292
-
293
- Processes a direct charge without using an offer.
294
-
295
- ```javascript
296
- const orderId = await easyflowSDK.charge({
297
- buyer: {
298
- name: 'João Silva Santos',
299
- email: 'joao.silva@exemplo.com',
300
- document: {
301
- number: '12345678901',
302
- type: 'CPF',
303
- },
304
- phone: {
305
- areaCode: '+55',
306
- ddd: '11',
307
- number: '9988776655',
308
- isMobile: true,
309
- },
310
- address: {
311
- zipCode: '01234567',
312
- street: 'Rua das Flores',
313
- complement: 'Apto 101',
314
- neighborhood: 'Centro',
315
- city: 'São Paulo',
316
- state: 'SP',
317
- number: '123',
318
- },
319
- customerId: 'demo-customer-12345', // ID do cliente existente (opcional)
320
- },
321
- payments: [
322
- {
323
- method: 'credit-card',
324
- numberInstallments: 1,
325
- valueInCents: 500,
326
- creditCard: {
327
- cardId: 'demo-card-id-here', // cardId e token são opcionais, mas pelo menos 1 deve ser fornecido
328
- token: 'demo-token-credit-card-here',
329
- },
330
- },
331
- ],
332
- items: [
333
- {
334
- description: 'Carregador de celular com cabo USB-C',
335
- name: 'Carregador de Celular',
336
- quantity: 1,
337
- priceInCents: 500,
338
- },
339
- ],
340
- })
341
- ```
32
+ ### **3. Inicialização Simples**
342
33
 
343
- #### `encrypt(creditCardData, headers)`
344
-
345
- Encrypts credit card data for secure processing.
346
-
347
- ```javascript
348
- const token = await easyflowSDK.encrypt({
349
- number: '4111111111111111',
350
- holderName: 'João Silva',
351
- expirationMonth: '12',
352
- expirationYear: '2025',
353
- cvv: '123',
354
- })
34
+ ```typescript
35
+ const sdk = new EasyflowSDK('business-id')
355
36
  ```
356
37
 
357
- ### Customer Management
38
+ ### **4. Uso Direto**
358
39
 
359
- #### `createCustomer(customerData, headers)`
40
+ ```typescript
41
+ // Criar cliente
42
+ const customer = await sdk.createCustomer(customerData)
360
43
 
361
- Creates a new customer.
44
+ // Criar pedido
45
+ const order = await sdk.placeOrder(offerId, orderData)
362
46
 
363
- ```javascript
364
- const customer = await easyflowSDK.createCustomer({
365
- name: 'João Silva',
366
- email: 'joao@exemplo.com',
367
- document: { type: 'CPF', number: '12345678901' },
368
- })
369
- ```
47
+ // Processar pagamento
48
+ const charge = await sdk.charge(paymentData)
370
49
 
371
- #### `getCustomer(customerId, headers)`
50
+ // Adicionar cartão
51
+ const creditCard = await sdk.addCreditCard(cardData)
372
52
 
373
- Retrieves customer information.
374
-
375
- ```javascript
376
- const customer = await easyflowSDK.getCustomer('demo-customer-12345')
53
+ // Remover cartão
54
+ const result = await sdk.removeCreditCard(cardId)
377
55
  ```
378
56
 
379
- #### `updateCustomer(customerId, updateData, headers)`
57
+ ## 🧪 Interface de Teste Completa
380
58
 
381
- Updates existing customer information.
59
+ ### **⚙️ Configuração do SDK**
382
60
 
383
- ```javascript
384
- const result = await easyflowSDK.updateCustomer('demo-customer-12345', {
385
- name: 'João Atualizado',
386
- email: 'joao.atualizado@exemplo.com',
387
- })
388
- ```
61
+ - **Input para Business ID** - Digite seu ID da Easyflow
62
+ - **Botão de Inicialização** - Cria instância do SDK
63
+ - **Status de Configuração** - Confirma se o SDK está funcionando
389
64
 
390
- ### Credit Card Management
65
+ ### **👤 Formulário de Cliente**
391
66
 
392
- #### `addCreditCard(customerId, creditCardToken, headers)`
67
+ - **Nome completo** - Nome do cliente
68
+ - **Email** - Email do cliente
69
+ - **Tipo de documento** - CPF ou CNPJ
70
+ - **Número do documento** - CPF/CNPJ do cliente
71
+ - **DDD** - Código de área do telefone
72
+ - **Número do telefone** - Telefone do cliente
73
+ - **Botão Criar Cliente** - Chama `sdk.createCustomer()`
393
74
 
394
- Adds a credit card to a customer.
75
+ ### **💳 Formulário de Cartão de Crédito**
395
76
 
396
- ```javascript
397
- const result = await easyflowSDK.addCreditCard(
398
- 'demo-customer-12345',
399
- 'encrypted-token-demo'
400
- )
401
- ```
402
-
403
- #### `getCreditCard(customerId, creditCardId, headers)`
77
+ - **Número do cartão** - Número do cartão
78
+ - **Nome do titular** - Nome impresso no cartão
79
+ - **Mês de expiração** - MM (ex: 12)
80
+ - **Ano de expiração** - YYYY (ex: 2025)
81
+ - **CVV** - Código de segurança
82
+ - **Botão Adicionar Cartão** - Chama `sdk.addCreditCard()`
83
+ - **Botão Remover Cartão** - Chama `sdk.removeCreditCard()`
404
84
 
405
- Retrieves credit card information.
85
+ ### **📦 Formulário de Pedido**
406
86
 
407
- ```javascript
408
- const creditCard = await easyflowSDK.getCreditCard(
409
- 'demo-customer-12345',
410
- 'demo-card-67890'
411
- )
412
- ```
87
+ - **ID da Oferta** - ID da oferta no sistema
88
+ - **Número de parcelas** - Quantidade de parcelas
89
+ - **Botão Criar Pedido** - Chama `sdk.placeOrder()`
413
90
 
414
- #### `removeCreditCard(customerId, creditCardId, headers)`
91
+ ### **💳 Formulário de Pagamento**
415
92
 
416
- Removes a credit card from a customer.
93
+ - **Valor em centavos** - Valor do pagamento (ex: 10000 = R$ 100,00)
94
+ - **Número de parcelas** - Quantidade de parcelas
95
+ - **Botão Processar Pagamento** - Chama `sdk.charge()`
417
96
 
418
- ```javascript
419
- const result = await easyflowSDK.removeCreditCard(
420
- 'demo-customer-12345',
421
- 'demo-card-67890'
422
- )
423
- ```
97
+ ### **📊 Status do SDK**
424
98
 
425
- ## Validation
99
+ - **Botão Status** - Chama `sdk.getStatus()`
426
100
 
427
- ### ID Validation
101
+ ## 🔧 Tecnologias
428
102
 
429
- All entity IDs must follow specific formats:
103
+ - **React 18** + **TypeScript**
104
+ - **Vite** (build tool)
105
+ - **Easyflow SDK** (via NPM)
106
+ - **CSS Modules** com design moderno
430
107
 
431
- - **UUID v4**: `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx` (y = 8,9,A,B)
432
- - **UUID v7**: `xxxxxxxx-xxxx-7xxx-yxxx-xxxxxxxxxxxx` (y = 8,9,A,B)
433
- - **MongoDB ObjectId**: 24-character hexadecimal format
108
+ ## 📁 Estrutura
434
109
 
435
- ```javascript
436
- // Valid IDs
437
- Validator.validateOrderId('f47ac10b-58cc-4372-a567-0e02b2c3d479') // UUID v4
438
- Validator.validateOrderId('01890b24-2d7f-7c3f-8f1a-123456789abc') // UUID v7
439
- Validator.validateOrderId('507f1f77bcf86cd799439011') // MongoDB ObjectId
440
110
  ```
441
-
442
- ### Data Validation
443
-
444
- Comprehensive validation for all input data:
445
-
446
- ```javascript
447
- // Customer validation
448
- Validator.validateCustomer({
449
- name: 'John Doe',
450
- email: 'john@example.com',
451
- document: { type: 'CPF', number: '12345678901' },
452
- })
453
-
454
- // Payment validation
455
- Validator.validateOrderData({
456
- items: [{ name: 'Product', price: 1000 }],
457
- payments: [{ method: 'credit-card', numberInstallments: 1 }],
458
- })
111
+ e2e/
112
+ └── react-ts-e2e/
113
+ ├── src/
114
+ │ ├── App.tsx # Interface completa de integração
115
+ │ ├── App.css # Estilos modernos e responsivos
116
+ │ └── main.tsx # Entry point
117
+ ├── package.json # Dependências + SDK
118
+ ├── tsconfig.json # Config TypeScript
119
+ ├── vite.config.ts # Config Vite
120
+ └── README.md # Documentação do projeto E2E
459
121
  ```
460
122
 
461
- ## Events
462
-
463
- The SDK provides an event system for monitoring operations:
123
+ ## 🚀 Como Executar
464
124
 
465
- ```javascript
466
- // Listen to events
467
- easyflowSDK.on('customerCreated', (data) => {
468
- console.log('Cliente criado:', data)
469
- })
125
+ ### **1. Instalar Dependências**
470
126
 
471
- easyflowSDK.on('orderPlaced', (data) => {
472
- console.log('Pedido criado:', data)
473
- })
474
-
475
- easyflowSDK.on('paymentProcessed', (data) => {
476
- console.log('Pagamento processado:', data)
477
- })
478
-
479
- // Remove event listeners
480
- easyflowSDK.off('customerCreated', callback)
127
+ ```bash
128
+ cd e2e/react-ts-e2e
129
+ npm install
481
130
  ```
482
131
 
483
- ## Error Handling
484
-
485
- The SDK provides comprehensive error handling:
132
+ ### **2. Executar em Desenvolvimento**
486
133
 
487
- ```javascript
488
- try {
489
- const result = await easyflowSDK.placeOrder('demo-offer-67890', orderData)
490
- } catch (error) {
491
- if (error.name === 'ValidationError') {
492
- console.log('Falha na validação:', error.message)
493
- } else if (error.name === 'NetworkError') {
494
- console.log('Erro de rede:', error.message)
495
- } else if (error.name === 'SecurityError') {
496
- console.log('Violação de segurança:', error.message)
497
- }
498
- }
134
+ ```bash
135
+ npm run dev
499
136
  ```
500
137
 
501
- ## Configuration
502
-
503
- ### Business ID
504
-
505
- The `businessId` parameter is a required configuration that identifies your business within the Easyflow platform. You
506
- can find this value in your business configuration at [https://app.easyflow.digital/](https://app.easyflow.digital/).
138
+ ### **3. Build de Produção**
507
139
 
508
- **Important:** Never share your business ID publicly. Keep it secure and use it only in your application code.
509
-
510
- ### SDK Options
511
-
512
- ```javascript
513
- // Configure the global instance
514
- easyflowSDK.configure({
515
- businessId: 'demo-business-12345',
516
- environment: 'production', // 'production' or 'sandbox'
517
- debug: false, // Enable debug logging
518
- timeout: 30000, // Request timeout in milliseconds
519
- })
140
+ ```bash
141
+ npm run build
520
142
  ```
521
143
 
522
- ### Environment Variables
144
+ ### **4. Preview do Build**
523
145
 
524
146
  ```bash
525
- EASYFLOW_BUSINESS_ID=demo-business-12345
526
- EASYFLOW_ENVIRONMENT=production
527
- EASYFLOW_DEBUG=false
147
+ npm run preview
528
148
  ```
529
149
 
530
- ## Examples
531
-
532
- ### Complete Checkout Flow
533
-
534
- ```javascript
535
- // 1. Create customer
536
- const customer = await easyflowSDK.createCustomer({
537
- name: 'João Silva',
538
- email: 'joao@exemplo.com',
539
- document: { type: 'CPF', number: '12345678901' },
540
- })
541
-
542
- // 2. Encrypt credit card
543
- const token = await easyflowSDK.encrypt({
544
- number: '4111111111111111',
545
- holderName: 'João Silva',
546
- expirationMonth: '12',
547
- expirationYear: '2025',
548
- cvv: '123',
549
- })
550
-
551
- // 3. Add credit card to customer
552
- const creditCard = await easyflowSDK.addCreditCard(customer.id, token)
553
-
554
- // 4. Place order
555
- const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
556
- buyer: {
557
- customerId: customer.id,
558
- name: 'E. R.',
559
- email: 'e***o@gmail.com',
560
- document: {
561
- number: '***202266**',
562
- type: 'CPF',
563
- },
564
- phone: {
565
- areaCode: '+55',
566
- ddd: '92',
567
- number: '*****2191',
568
- isMobile: true,
569
- },
570
- address: {
571
- zipCode: '37537***',
572
- street: 'Rua R. C. M. de A.',
573
- complement: '',
574
- neighborhood: 'M. do S.',
575
- city: 'Santa Rita do Sapucaí',
576
- state: 'MG',
577
- number: '***',
578
- },
579
- },
580
- payments: [
581
- {
582
- method: 'credit-card',
583
- creditCard: {
584
- cardId: creditCard.id,
585
- },
586
- numberInstallments: 1,
587
- },
588
- ],
589
- metadata: [],
590
- })
591
- ```
150
+ ## 🔍 O que Prova
592
151
 
593
- ### PIX Payment
594
-
595
- ```javascript
596
- const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
597
- buyer: {
598
- name: 'E. R.',
599
- email: 'e***o@gmail.com',
600
- document: {
601
- number: '***202266**',
602
- type: 'CPF',
603
- },
604
- phone: {
605
- areaCode: '+55',
606
- ddd: '92',
607
- number: '*****2191',
608
- isMobile: true,
609
- },
610
- address: {
611
- zipCode: '37537***',
612
- street: 'Rua R. C. M. de A.',
613
- complement: '',
614
- neighborhood: 'M. do S.',
615
- city: 'Santa Rita do Sapucaí',
616
- state: 'MG',
617
- number: '***',
618
- },
619
- },
620
- payments: [
621
- {
622
- method: 'pix',
623
- numberInstallments: 1,
624
- },
625
- ],
626
- })
627
-
628
- // Get PIX data
629
- const pixData = await easyflowSDK.getPix(orderId)
630
- console.log('PIX QR Code:', pixData.qrCode)
631
- ```
152
+ ### **✅ Integração NPM**
632
153
 
633
- ### Bank Billet Payment
634
-
635
- ```javascript
636
- const orderId = await easyflowSDK.placeOrder('demo-offer-67890', {
637
- buyer: {
638
- name: 'E. R.',
639
- email: 'e***o@gmail.com',
640
- document: {
641
- number: '***202266**',
642
- type: 'CPF',
643
- },
644
- phone: {
645
- areaCode: '+55',
646
- ddd: '92',
647
- number: '*****2191',
648
- isMobile: true,
649
- },
650
- address: {
651
- zipCode: '37537***',
652
- street: 'Rua R. C. M. de A.',
653
- complement: '',
654
- neighborhood: 'M. do S.',
655
- city: 'Santa Rita do Sapucaí',
656
- state: 'MG',
657
- number: '***',
658
- },
659
- },
660
- metadata: [],
661
- payments: [
662
- {
663
- method: 'bank-billet',
664
- numberInstallments: 1,
665
- },
666
- ],
667
- })
668
-
669
- // Get bank billet data
670
- const bankBillet = await easyflowSDK.getBankBillet(orderId)
671
- console.log('Bank Billet Link:', bankBillet.link)
672
- ```
154
+ - SDK instalado via `npm install`
155
+ - Funciona em ambiente Node.js/npm
673
156
 
674
- ## Complete Implementation Examples
675
-
676
- ### 1. placeOrder - Complete Data Model
677
-
678
- #### placeOrder com PIX
679
-
680
- ```javascript
681
- // Configure SDK
682
- easyflowSDK.configure({
683
- businessId: 'demo-business-12345',
684
- })
685
-
686
- // Complete placeOrder example with PIX payment
687
- const orderId = await easyflowSDK.placeOrder(
688
- '3df92ac7-9d7f-4948-b54f-7e082492f6d2',
689
- {
690
- buyer: {
691
- name: 'João Silva Santos',
692
- email: 'joao.silva@exemplo.com',
693
- document: {
694
- number: '12345678901',
695
- type: 'CPF',
696
- },
697
- phone: {
698
- areaCode: '+55',
699
- ddd: '11',
700
- number: '9988776655',
701
- isMobile: true,
702
- },
703
- address: {
704
- zipCode: '01234567',
705
- street: 'Rua das Flores',
706
- complement: 'Apto 101',
707
- neighborhood: 'Centro',
708
- city: 'São Paulo',
709
- state: 'SP',
710
- number: '123',
711
- },
712
- },
713
- payments: [
714
- {
715
- method: 'pix',
716
- numberInstallments: 1,
717
- },
718
- ],
719
- metadata: [],
720
- }
721
- )
157
+ ### **✅ TypeScript**
722
158
 
723
- console.log('Order created with PIX payment:', orderId)
724
- ```
159
+ - Tipos completos disponíveis
160
+ - IntelliSense funcionando
161
+ - Compilação sem erros
725
162
 
726
- #### placeOrder com Cartão de Crédito
727
-
728
- ```javascript
729
- // Complete placeOrder example with credit card payment
730
- const orderId = await easyflowSDK.placeOrder(
731
- '3df92ac7-9d7f-4948-b54f-7e082492f6d2',
732
- {
733
- buyer: {
734
- name: 'João Silva Santos',
735
- email: 'joao.silva@exemplo.com',
736
- document: {
737
- number: '12345678901',
738
- type: 'CPF',
739
- },
740
- phone: {
741
- areaCode: '+55',
742
- ddd: '11',
743
- number: '9988776655',
744
- isMobile: true,
745
- },
746
- address: {
747
- zipCode: '01234567',
748
- street: 'Rua das Flores',
749
- complement: 'Apto 101',
750
- neighborhood: 'Centro',
751
- city: 'São Paulo',
752
- state: 'SP',
753
- number: '123',
754
- },
755
- },
756
- payments: [
757
- {
758
- method: 'credit-card',
759
- numberInstallments: 1,
760
- creditCard: {
761
- cardId: 'demo-credit-card-67890', // cardId e token são opcionais, mas pelo menos 1 deve ser fornecido
762
- token: 'demo-credit-card-token-here',
763
- last4Numbers: '1234',
764
- holderName: 'JOAO SILVA SANTOS',
765
- expiresAtMonth: '12',
766
- expiresAtYear: '2025',
767
- flag: 'visa',
768
- },
769
- },
770
- ],
771
- metadata: [],
772
- }
773
- )
163
+ ### **✅ Build Tools**
774
164
 
775
- console.log('Order created with credit card payment:', orderId)
776
- ```
165
+ - Vite compila sem problemas
166
+ - Webpack compatível
167
+ - ES Modules funcionando
777
168
 
778
- ### 2. charge - Complete Data Model
779
-
780
- #### charge com Cartão de Crédito
781
-
782
- ```javascript
783
- // Complete charge example with credit card payment
784
- const orderId = await easyflowSDK.charge({
785
- buyer: {
786
- name: 'João Silva Santos',
787
- email: 'joao.silva@exemplo.com',
788
- document: {
789
- number: '12345678901',
790
- type: 'CPF',
791
- },
792
- phone: {
793
- areaCode: '+55',
794
- ddd: '11',
795
- number: '9988776655',
796
- isMobile: true,
797
- },
798
- address: {
799
- zipCode: '01234567',
800
- street: 'Rua das Flores',
801
- complement: 'Apto 101',
802
- neighborhood: 'Centro',
803
- city: 'São Paulo',
804
- state: 'SP',
805
- number: '123',
806
- },
807
- customerId: 'demo-customer-12345', // ID do cliente existente (opcional)
808
- },
809
- payments: [
810
- {
811
- method: 'credit-card',
812
- numberInstallments: 1,
813
- valueInCents: 500,
814
- creditCard: {
815
- cardId: 'demo-card-id-here', // cardId e token são opcionais, mas pelo menos 1 deve ser fornecido
816
- token: 'demo-token-credit-card-here',
817
- },
818
- },
819
- ],
820
- items: [
821
- {
822
- description: 'Carregador de celular com cabo USB-C',
823
- name: 'Carregador de Celular',
824
- quantity: 1,
825
- priceInCents: 500,
826
- },
827
- ],
828
- })
829
-
830
- console.log('Charge processed with credit card:', orderId)
831
- ```
169
+ ### **✅ Runtime**
832
170
 
833
- #### charge com PIX
834
-
835
- ```javascript
836
- // Complete charge example with PIX payment
837
- const orderId = await easyflowSDK.charge({
838
- buyer: {
839
- name: 'João Silva Santos',
840
- email: 'joao.silva@exemplo.com',
841
- document: {
842
- number: '12345678901',
843
- type: 'CPF',
844
- },
845
- phone: {
846
- areaCode: '+55',
847
- ddd: '11',
848
- number: '9988776655',
849
- isMobile: true,
850
- },
851
- address: {
852
- zipCode: '01234567',
853
- street: 'Rua das Flores',
854
- complement: 'Apto 101',
855
- neighborhood: 'Centro',
856
- city: 'São Paulo',
857
- state: 'SP',
858
- number: '123',
859
- },
860
- customerId: 'demo-customer-12345', // ID do cliente existente (opcional)
861
- },
862
- payments: [
863
- {
864
- method: 'pix',
865
- numberInstallments: 1,
866
- valueInCents: 500,
867
- },
868
- ],
869
- items: [
870
- {
871
- description: 'Carregador de celular com cabo USB-C',
872
- name: 'Carregador de Celular',
873
- quantity: 1,
874
- priceInCents: 500,
875
- },
876
- ],
877
- businessId: 'demo-business-12345',
878
- })
879
-
880
- console.log('Charge processed with PIX:', orderId)
881
- ```
171
+ - SDK inicializa corretamente
172
+ - Métodos executam sem erros
173
+ - Tratamento de erros funcionando
882
174
 
883
- ### 3. createCustomer - Complete Data Model
884
-
885
- ```javascript
886
- // Complete createCustomer example with all available fields
887
- const customer = await easyflowSDK.createCustomer({
888
- name: 'João Silva Santos',
889
- email: 'joao.silva@exemplo.com',
890
- document: {
891
- type: 'CPF',
892
- number: '12345678901',
893
- },
894
- phone: {
895
- areaCode: '+55',
896
- ddd: '11',
897
- number: '9988776655',
898
- isMobile: true,
899
- },
900
- address: {
901
- zipCode: '01234567',
902
- street: 'Rua das Flores',
903
- complement: 'Apto 101',
904
- neighborhood: 'Centro',
905
- city: 'São Paulo',
906
- state: 'SP',
907
- number: '123',
908
- },
909
- deliveryAddress: {
910
- zipCode: '01234567',
911
- street: 'Rua das Flores',
912
- complement: 'Apto 101',
913
- neighborhood: 'Centro',
914
- city: 'São Paulo',
915
- state: 'SP',
916
- number: '123',
917
- },
918
- })
919
-
920
- console.log('Customer created with complete data:', customer)
921
- ```
175
+ ### **✅ Interface Completa**
922
176
 
923
- ### 4. addCreditCard - Complete Data Model
924
-
925
- ```javascript
926
- // First, encrypt the credit card data
927
- const encryptedToken = await easyflowSDK.encrypt({
928
- cardNumber: '4111111111111111',
929
- cvv: '123',
930
- month: '12',
931
- year: '2025',
932
- holderName: 'PEDRO OLIVEIRA LIMA',
933
- })
934
-
935
- console.log('Credit card encrypted:', encryptedToken)
936
-
937
- // Then add the encrypted token to the customer
938
- const creditCard = await easyflowSDK.addCreditCard(
939
- customer.id, // customer ID from createCustomer
940
- encryptedToken
941
- )
942
-
943
- console.log('Credit card added successfully:', creditCard)
944
-
945
- // Now you can use the credit card for payments
946
- const orderWithSavedCard = await easyflowSDK.placeOrder(
947
- '3df92ac7-9d7f-4948-b54f-7e082492f6d2',
948
- {
949
- buyer: {
950
- customerId: customer.id, // Use existing customer
951
- name: 'João Silva Santos',
952
- email: 'joao.silva@exemplo.com',
953
- document: {
954
- number: '12345678901',
955
- type: 'CPF',
956
- },
957
- },
958
- payments: [
959
- {
960
- method: 'credit-card',
961
- numberInstallments: 6,
962
- creditCard: {
963
- cardId: creditCard.id, // Use saved credit card
964
- },
965
- },
966
- ],
967
- offerItems: [
968
- {
969
- offerItemId: '3df92ac7-9d7f-4948-b54f-7e082492f6d2',
970
- quantity: 1,
971
- },
972
- ],
973
- metadata: [],
974
- }
975
- )
177
+ - Formulários funcionais
178
+ - Validação de dados
179
+ - Exibição de resultados
180
+ - Tratamento de erros
976
181
 
977
- console.log('Order with saved credit card:', orderWithSavedCard)
978
- ```
182
+ ## 🎯 Simulação Lovable
979
183
 
980
- ### 5. Complete Workflow Example
981
-
982
- ```javascript
983
- // Complete workflow: Customer → Credit Card → Order
984
- async function completeWorkflow() {
985
- try {
986
- // 1. Configure SDK
987
- easyflowSDK.configure({
988
- businessId: 'demo-business-12345',
989
- })
990
-
991
- // 2. Create customer with complete data
992
- const customer = await easyflowSDK.createCustomer({
993
- name: 'Ana Silva Costa',
994
- email: 'ana.silva@exemplo.com',
995
- document: { type: 'CPF', number: '55566677788' },
996
- phone: {
997
- areaCode: '+55',
998
- ddd: '41',
999
- number: '765432109',
1000
- isMobile: true,
1001
- },
1002
- address: {
1003
- zipCode: '80000000',
1004
- street: 'Rua das Palmeiras',
1005
- complement: 'Apto 202',
1006
- neighborhood: 'Batel',
1007
- city: 'Curitiba',
1008
- state: 'PR',
1009
- number: '321',
1010
- },
1011
- })
1012
-
1013
- // 3. Encrypt and add credit card
1014
- const token = await easyflowSDK.encrypt({
1015
- cardNumber: '5555555555554444',
1016
- cvv: '321',
1017
- month: '10',
1018
- year: '2026',
1019
- holderName: 'ANA SILVA COSTA',
1020
- })
1021
-
1022
- const creditCard = await easyflowSDK.addCreditCard(customer.id, token)
1023
-
1024
- // 4. Create order using saved customer and credit card
1025
- const orderId = await easyflowSDK.placeOrder(
1026
- '3df92ac7-9d7f-4948-b54f-7e082492f6d2',
1027
- {
1028
- buyer: {
1029
- customerId: customer.id,
1030
- name: customer.name,
1031
- email: customer.email,
1032
- document: customer.document,
1033
- },
1034
- payments: [
1035
- {
1036
- method: 'credit-card',
1037
- numberInstallments: 12,
1038
- creditCard: { cardId: creditCard.id },
1039
- },
1040
- ],
1041
- offerItems: [
1042
- {
1043
- offerItemId: '3df92ac7-9d7f-4948-b54f-7e082492f6d2',
1044
- quantity: 1,
1045
- },
1046
- ],
1047
- metadata: [],
1048
- }
1049
- )
1050
-
1051
- console.log('Complete workflow successful:', {
1052
- customer: customer.id,
1053
- creditCard: creditCard.id,
1054
- order: orderId,
1055
- })
1056
- } catch (error) {
1057
- console.error('Workflow failed:', error.message)
1058
- }
1059
- }
184
+ Este projeto simula exatamente como o **Lovable** integraria o SDK:
1060
185
 
1061
- // Execute the complete workflow
1062
- completeWorkflow()
1063
- ```
186
+ 1. **Instalação**: `npm install @easyflow/javascript-sdk`
187
+ 2. **Import**: `import EasyflowSDK from '@easyflow/javascript-sdk'`
188
+ 3. **Configuração**: `new EasyflowSDK('business-id')`
189
+ 4. **Uso**: Chamadas diretas aos métodos do SDK
190
+ 5. **Tratamento**: Gerenciamento de erros e resultados
191
+ 6. **Interface**: Formulários para testar cada método
1064
192
 
1065
- ## Distribution & Security
193
+ ## 📊 Resultados Esperados
1066
194
 
1067
- ### Why CDN Scripts?
195
+ - **SDK inicializa** sem erros
196
+ - ✅ **Tipos TypeScript** funcionando
197
+ - ✅ **Build Vite** compila sem problemas
198
+ - ✅ **Métodos do SDK** executam corretamente
199
+ - ✅ **Tratamento de erros** funcionando
200
+ - ✅ **Interface responsiva** e funcional
201
+ - ✅ **Formulários** validam e enviam dados
202
+ - ✅ **Resultados** são exibidos corretamente
1068
203
 
1069
- - **Obfuscated Builds**: Production code is obfuscated for security
1070
- - **Controlled Access**: Secure distribution via Cloudflare Pages and jsDelivr
1071
- - **Version Control**: Specific versions available for stability
1072
- - **Performance**: Global CDN for fast loading
204
+ ## 🔗 Links Relacionados
1073
205
 
1074
- ### Available CDN URLs
206
+ - **[SDK Principal](../../README.md)** - Documentação completa
207
+ - **[INDEX.md](../../INDEX.md)** - Hub de documentação
208
+ - **[PLATFORM-INTEGRATION.md](../../PLATFORM-INTEGRATION.md)** - Guia de integração
209
+ - **[NPM Package](https://www.npmjs.com/package/@easyflow/javascript-sdk)** - Package oficial
1075
210
 
1076
- #### Cloudflare Pages (Primary)
211
+ ---
1077
212
 
1078
- ```html
1079
- <!-- Latest version -->
1080
- <script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>
213
+ **Este projeto E2E prova que o Easyflow SDK funciona perfeitamente via NPM em projetos TypeScript/React com uma interface completa e funcional!** 🚀✨
1081
214
 
1082
- <!-- Versioned (recommended for production) -->
1083
- <script src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.19.min.js"></script>
215
+ ## 🚀 Quick Start
1084
216
 
1085
- <!-- With SRI (Subresource Integrity) -->
1086
- <script
1087
- src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.19.min.js"
1088
- integrity="sha384-[hash]"
1089
- crossorigin="anonymous"
1090
- ></script>
217
+ ### Via NPM
218
+
219
+ ```bash
220
+ npm install @easyflow/javascript-sdk
1091
221
  ```
1092
222
 
1093
- #### jsDelivr (Alternative)
223
+ ### Via CDN
1094
224
 
1095
225
  ```html
1096
- <!-- Latest version -->
1097
- <script src="https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@latest/dist/easyflow-sdk.min.js"></script>
1098
-
1099
- <!-- Specific version -->
1100
- <script src="https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@2.1.20/dist/easyflow-sdk.min.js"></script>
226
+ <script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>
1101
227
  ```
1102
228
 
1103
- ## Browser Support
1104
-
1105
- ## Node.js Support
1106
-
1107
- - **Node.js**: 18+
1108
- - **npm**: 8+
1109
- - **yarn**: 1.22+
1110
-
1111
- ## Contributing
1112
-
1113
- We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
1114
-
1115
- ## Support
1116
-
1117
- - **Documentation**: [https://docs.easyflow.digital](https://docs.easyflow.digital)
1118
- - **Website**: [https://www.easyflow.digital](https://www.easyflow.digital)
1119
- - **Contact**: [contato@easyflow.digital](mailto:contato@easyflow.digital)
229
+ ## 📚 TypeScript Integration
1120
230
 
1121
- ## License
231
+ Para projetos TypeScript, o SDK é exposto globalmente quando carregado via CDN. Adicione as seguintes declarações ao seu projeto:
1122
232
 
1123
- This project is licensed under the ISC License - see the [LICENSE](LICENSE) file for details.
1124
-
1125
- ## Author
1126
-
1127
- **Diego Moura** - Co-Found & CTO at Easyflow
1128
-
1129
- - **Email**: [contato@easyflow.digital](mailto:contato@easyflow.digital)
1130
- - **Website**: [https://www.easyflow.digital](https://www.easyflow.digital)
1131
-
1132
- ## Changelog
1133
-
1134
- ### v2.1.23
1135
-
1136
- - **SDK Simplification**: Removed all platform-specific integrations for cleaner, focused codebase
1137
- - **Streamlined Documentation**: Focused README on core SDK functionality and usage
1138
- - **Enhanced Security**: Maintained all security features while simplifying the codebase
1139
- - **Better Developer Experience**: Cleaner documentation focused on essential features
1140
-
1141
- ### v2.1.20
1142
-
1143
- - **jsDelivr CDN Fix**: Fixed npm package to include easyflow-sdk.min.js for proper jsDelivr CDN support
1144
- - **Package Structure**: Corrected package.json files field to include JavaScript build files
1145
- - **CDN Availability**: jsDelivr now properly serves the SDK at specific version URLs
1146
- - **Homepage Redirect**: Added automatic redirect from SDK homepage to NPM package for better discoverability
1147
-
1148
- ### v2.1.19
1149
-
1150
- - **Documentation Updates**: Removed all references to private repository
1151
- - **Business ID Information**: Added clear guidance on where to find BUSINESS_ID parameter
1152
- - **Contact Information**: Added official contact email for support
1153
- - **Author Information**: Updated author details and role information
1154
- - **Repository Cleanup**: Cleaned up all private repository references
1155
- - **CDN Options**: Added jsDelivr as alternative CDN option for installation
1156
-
1157
- ### v2.1.18
1158
-
1159
- - **Version Update**: Patch release for latest improvements
1160
- - **Documentation**: Updated version references and CDN URLs
1161
- - **Consistency**: All version references aligned to v2.1.18
1162
-
1163
- ### v2.1.17
1164
-
1165
- - **Complete Implementation Examples**: Added comprehensive examples for all major methods
1166
- - **Full Data Models**: Examples showing all available fields for placeOrder, charge, createCustomer, addCreditCard
1167
- - **Brazilian Data Examples**: Realistic Brazilian addresses, phone
1168
- - **Version Update**: Patch release for latest improvements
1169
- - **Documentation**: Updated version references and CDN URLs
1170
- - **Consistency**: All version references aligned to v2.1.17
1171
-
1172
- ### v2.1.14
1173
-
1174
- - **Version Update**: Patch release for latest improvements
1175
- - **Documentation**: Updated version references and CDN URLs
1176
- - **Consistency**: All version references aligned to v2.1.14
1177
-
1178
- ### v2.1.13
1179
-
1180
- - **Code Formatting**: Improved readability of placeOrder examples with better line breaks
1181
- - **Documentation**: Enhanced formatting for complex method calls
1182
- - **Examples**: Better visual structure for placeOrder, charge, and workflow examples
1183
- - **Consistency**: Unified formatting across all code examples
1184
-
1185
- ### v2.1.12
1186
-
1187
- - **Complete Implementation Examples**: Added comprehensive examples for all major methods
1188
- - **Full Data Models**: Examples showing all available fields for placeOrder, charge, createCustomer, addCreditCard
1189
- - **Brazilian Data Examples**: Realistic Brazilian addresses, phone numbers, and document formats
1190
- - **End-to-End Workflows**: Complete customer → credit card → order workflow examples
1191
- - **Code Quality**: Improved formatting, consistency, and readability across all examples
1192
- - **Documentation**: Fixed duplicate sections and improved overall structure
1193
-
1194
- ### v2.1.11
1195
-
1196
- - **Credit Card Token Fix**: Accepts real encrypted/ciphered tokens from vault services
1197
- - **Flexible Validation**: Supports Base64, URL-safe, and mixed character formats
1198
- - **Variable Length**: Accepts tokens from 16 to 2048 characters
1199
- - **Enhanced Security**: Maintains security while accepting real-world tokens
1200
- - **Backward Compatibility**: Works with all existing token formats
1201
-
1202
- ### v2.1.10
1203
-
1204
- - **Workflow Fixed**: Resolved GitHub Actions permissions and SRI hash generation
1205
- - **CDN Automation**: Automated deployment to Cloudflare Pages working correctly
1206
- - **Release Process**: GitHub releases created automatically with proper SRI hashes
1207
- - **Build Pipeline**: Streamlined build and deployment process
1208
-
1209
- ### v2.1.9
1210
-
1211
- - **Hybrid Distribution**: NPM for docs, CDN for secure obfuscated code
1212
- - **Enhanced Security**: Code source protected while maintaining accessibility
1213
- - **Better UX**: Easy discovery via NPM, secure usage via CDN
1214
- - **Documentation**: Complete setup and usage instructions
1215
-
1216
- ### v2.1.8
1217
-
1218
- - **Security & Privacy**: Anonymized README.md for safe NPM publication
1219
- - **Documentation**: Removed all personal information and sensitive data
1220
- - **Professional**: Clean, business-focused documentation
1221
-
1222
- ### v2.1.7
1223
-
1224
- - Fixed all failing unit tests for complete 250 test coverage
1225
- - Corrected mock structures for customer and credit card management
1226
- - Standardized API response patterns across all endpoints
1227
- - Enhanced test reliability and maintainability
1228
-
1229
- ### v2.1.6
1230
-
1231
- - Enhanced ID validation with UUID v4, UUID v7, and MongoDB ObjectId support
1232
- - Fixed iframe compatibility issues for low-code platforms
1233
- - Implemented complete event system with `on()` and `off()` methods
1234
- - Added global SDK instance for easier integration
233
+ ```typescript
234
+ // O SDK está sendo carregado via CDN e exposto globalmente como window.easyflowSDK
235
+ declare global {
236
+ interface Window {
237
+ easyflowSDK: any
238
+ EasyflowSDK: any
239
+ }
240
+ }
241
+ ```
1235
242
 
1236
- ### v2.1.5
243
+ ### Exemplo de Uso com TypeScript
1237
244
 
1238
- - Added browser fingerprinting for enhanced security
1239
- - Implemented automatic `x-fingerprint-id` header generation
1240
- - Enhanced security validation and error handling
1241
- - Improved documentation and examples
245
+ ```typescript
246
+ // Configurar o SDK
247
+ window.easyflowSDK.configure({ businessId: 'your-business-id' })
1242
248
 
1243
- ---
249
+ // Usar métodos do SDK
250
+ const customer = await window.easyflowSDK.createCustomer(customerData)
251
+ const payment = await window.easyflowSDK.charge(paymentData)
252
+ ```
1244
253
 
1245
- **Built with ❤️ by the Easyflow Team**
254
+ ## 🔧 Usage