@easyflow/javascript-sdk 2.1.8 → 2.1.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 +71 -7
- package/dist/index.d.ts +421 -0
- package/package.json +19 -6
- package/.babelrc +0 -5
- package/.github/workflows/deploy-sdk-cf.yml +0 -49
- package/.github/workflows/release-sdk-cdn.yml +0 -144
- package/.github/workflows/release-sdk.yml +0 -112
- package/.prettierrc +0 -6
- package/CDN-DEPLOYMENT.md +0 -175
- package/DEMO.md +0 -258
- package/DEPLOYMENT.md +0 -224
- package/INTEGRATION-GUIDE.md +0 -521
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/easyflow-javascript-sdk/index.html +0 -116
- package/coverage/easyflow-javascript-sdk/libs/constants.mjs.html +0 -268
- package/coverage/easyflow-javascript-sdk/libs/errors.mjs.html +0 -271
- package/coverage/easyflow-javascript-sdk/libs/exception-handler.mjs.html +0 -148
- package/coverage/easyflow-javascript-sdk/libs/fingerprint.mjs.html +0 -895
- package/coverage/easyflow-javascript-sdk/libs/http.mjs.html +0 -502
- package/coverage/easyflow-javascript-sdk/libs/index.html +0 -266
- package/coverage/easyflow-javascript-sdk/libs/logger.mjs.html +0 -568
- package/coverage/easyflow-javascript-sdk/libs/sanitizer.mjs.html +0 -1099
- package/coverage/easyflow-javascript-sdk/libs/security.mjs.html +0 -733
- package/coverage/easyflow-javascript-sdk/libs/types.mjs.html +0 -508
- package/coverage/easyflow-javascript-sdk/libs/utils.mjs.html +0 -379
- package/coverage/easyflow-javascript-sdk/libs/validator.mjs.html +0 -2623
- package/coverage/easyflow-javascript-sdk/sdk.mjs.html +0 -2434
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -131
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/easyflow-javascript-sdk/index.html +0 -116
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/constants.mjs.html +0 -268
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/errors.mjs.html +0 -271
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/exception-handler.mjs.html +0 -148
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/fingerprint.mjs.html +0 -895
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/http.mjs.html +0 -502
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/index.html +0 -266
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/logger.mjs.html +0 -568
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/sanitizer.mjs.html +0 -1099
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/security.mjs.html +0 -733
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/types.mjs.html +0 -508
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/utils.mjs.html +0 -379
- package/coverage/lcov-report/easyflow-javascript-sdk/libs/validator.mjs.html +0 -2623
- package/coverage/lcov-report/easyflow-javascript-sdk/sdk.mjs.html +0 -2434
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -1429
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/dist/435.easyflow-sdk.min.js +0 -1
- package/dist/easyflow-sdk.min.js +0 -1
- package/dist/easyflow-sdk.min.js.LICENSE.txt +0 -1
- package/dist/index.html +0 -756
- package/docs/index.html +0 -775
- package/examples/lovable-integration.html +0 -410
- package/index.html +0 -981
- package/jest.config.js +0 -37
- package/jsdoc.json +0 -42
- package/libs/auto-integration.mjs +0 -333
- package/libs/constants.mjs +0 -61
- package/libs/constants.spec.js +0 -198
- package/libs/errors.mjs +0 -62
- package/libs/errors.spec.js +0 -178
- package/libs/exception-handler.mjs +0 -21
- package/libs/exception-handler.spec.js +0 -237
- package/libs/fingerprint.mjs +0 -270
- package/libs/http.mjs +0 -163
- package/libs/http.spec.js +0 -427
- package/libs/integration-wrapper.mjs +0 -285
- package/libs/logger.mjs +0 -161
- package/libs/logger.spec.js +0 -389
- package/libs/sanitizer.mjs +0 -340
- package/libs/sanitizer.spec.js +0 -583
- package/libs/security.mjs +0 -217
- package/libs/types.mjs +0 -141
- package/libs/utils.mjs +0 -368
- package/libs/utils.spec.js +0 -231
- package/libs/validator.mjs +0 -952
- package/libs/validator.spec.js +0 -615
- package/mocks/offer.mock.js +0 -77
- package/scripts/publish-npm.sh +0 -82
- package/sdk.mjs +0 -945
- package/sdk.spec.js +0 -796
- package/test-setup.cjs +0 -211
- package/test.html +0 -154
- package/webpack.config.cjs +0 -41
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
name: Release Easyflow SDK - Multi-CDN
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*'
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
release:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- name: Checkout do repositório
|
|
14
|
-
uses: actions/checkout@v4
|
|
15
|
-
|
|
16
|
-
- name: Instalar Node.js
|
|
17
|
-
uses: actions/setup-node@v4
|
|
18
|
-
with:
|
|
19
|
-
node-version: 20
|
|
20
|
-
cache: 'npm'
|
|
21
|
-
|
|
22
|
-
- name: Instalar dependências
|
|
23
|
-
run: npm install
|
|
24
|
-
|
|
25
|
-
- name: Gerar arquivo de versão
|
|
26
|
-
run: npm run generate-version
|
|
27
|
-
|
|
28
|
-
- name: Executar testes
|
|
29
|
-
run: npm test
|
|
30
|
-
|
|
31
|
-
- name: Build do SDK
|
|
32
|
-
run: npm run build
|
|
33
|
-
|
|
34
|
-
- name: Extrair versão do SDK
|
|
35
|
-
id: version
|
|
36
|
-
run: |
|
|
37
|
-
VERSION=$(jq -r .version package.json)
|
|
38
|
-
echo "VERSION=v$VERSION" >> "$GITHUB_ENV"
|
|
39
|
-
echo "version=v$VERSION" >> "$GITHUB_OUTPUT"
|
|
40
|
-
|
|
41
|
-
- name: Copiar arquivo com versão
|
|
42
|
-
run: |
|
|
43
|
-
cp dist/easyflow-sdk.min.js dist/easyflow-sdk.${{ env.VERSION }}.min.js
|
|
44
|
-
|
|
45
|
-
- name: Copiar interface de teste
|
|
46
|
-
run: |
|
|
47
|
-
cp index.html dist/
|
|
48
|
-
# Update the script src to use the correct path for production
|
|
49
|
-
sed -i 's|./dist/easyflow-sdk.min.js|./easyflow-sdk.min.js|g' dist/index.html
|
|
50
|
-
|
|
51
|
-
- name: Gerar hash de integridade (SRI)
|
|
52
|
-
id: sri
|
|
53
|
-
run: |
|
|
54
|
-
HASH=$(openssl dgst -sha384 -binary dist/easyflow-sdk.${{ env.VERSION }}.min.js | openssl base64 -A)
|
|
55
|
-
echo "SRI=sha384-${HASH}" >> "$GITHUB_ENV"
|
|
56
|
-
echo "sha=sha384-${HASH}" >> "$GITHUB_OUTPUT"
|
|
57
|
-
|
|
58
|
-
- name: Criar arquivo de exemplo com SRI
|
|
59
|
-
run: |
|
|
60
|
-
cat > dist/example.html << EOF
|
|
61
|
-
<!DOCTYPE html>
|
|
62
|
-
<html>
|
|
63
|
-
<head>
|
|
64
|
-
<title>Easyflow SDK Example</title>
|
|
65
|
-
</head>
|
|
66
|
-
<body>
|
|
67
|
-
<h1>Easyflow SDK v${{ env.VERSION }}</h1>
|
|
68
|
-
<script src="easyflow-sdk.${{ env.VERSION }}.min.js"
|
|
69
|
-
integrity="${{ env.SRI }}"
|
|
70
|
-
crossorigin="anonymous"></script>
|
|
71
|
-
<script>
|
|
72
|
-
console.log('EasyflowSDK version:', EasyflowSDK.version);
|
|
73
|
-
</script>
|
|
74
|
-
</body>
|
|
75
|
-
</html>
|
|
76
|
-
EOF
|
|
77
|
-
|
|
78
|
-
- name: Deploy para Cloudflare Pages
|
|
79
|
-
uses: cloudflare/pages-action@v1
|
|
80
|
-
with:
|
|
81
|
-
apiToken: ${{ secrets.CF_API_TOKEN }}
|
|
82
|
-
accountId: ${{ secrets.CF_ACCOUNT_ID }}
|
|
83
|
-
projectName: easyflow-sdk
|
|
84
|
-
directory: dist
|
|
85
|
-
|
|
86
|
-
- name: Verificar disponibilidade no jsDelivr
|
|
87
|
-
run: |
|
|
88
|
-
echo "Verificando disponibilidade no jsDelivr..."
|
|
89
|
-
echo "URL: https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@${{ env.VERSION }}/dist/easyflow-sdk.min.js"
|
|
90
|
-
echo "Note: jsDelivr pode levar alguns minutos para sincronizar com npm"
|
|
91
|
-
|
|
92
|
-
- name: Criar Release no GitHub
|
|
93
|
-
uses: actions/create-release@v1
|
|
94
|
-
env:
|
|
95
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
96
|
-
with:
|
|
97
|
-
tag_name: ${{ github.ref }}
|
|
98
|
-
release_name: Easyflow SDK ${{ env.VERSION }}
|
|
99
|
-
body: |
|
|
100
|
-
## Easyflow SDK ${{ env.VERSION }}
|
|
101
|
-
|
|
102
|
-
### CDNs Disponíveis
|
|
103
|
-
|
|
104
|
-
#### Cloudflare Pages
|
|
105
|
-
- **Latest**: `https://easyflow-sdk.pages.dev/easyflow-sdk.min.js`
|
|
106
|
-
- **Versionado**: `https://easyflow-sdk.pages.dev/easyflow-sdk.${{ env.VERSION }}.min.js`
|
|
107
|
-
|
|
108
|
-
#### jsDelivr CDN
|
|
109
|
-
- **Latest**: `https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@latest/dist/easyflow-sdk.min.js`
|
|
110
|
-
- **Versionado**: `https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@${{ env.VERSION }}/dist/easyflow-sdk.min.js`
|
|
111
|
-
|
|
112
|
-
### SRI Hash
|
|
113
|
-
```
|
|
114
|
-
sha384-${{ env.SRI }}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Exemplo de Uso
|
|
118
|
-
|
|
119
|
-
#### Cloudflare Pages
|
|
120
|
-
```html
|
|
121
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.${{ env.VERSION }}.min.js"
|
|
122
|
-
integrity="sha384-${{ env.SRI }}"
|
|
123
|
-
crossorigin="anonymous"></script>
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
#### jsDelivr CDN
|
|
127
|
-
```html
|
|
128
|
-
<script src="https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@${{ env.VERSION }}/dist/easyflow-sdk.min.js"
|
|
129
|
-
integrity="sha384-${{ env.SRI }}"
|
|
130
|
-
crossorigin="anonymous"></script>
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### Arquivos
|
|
134
|
-
- `easyflow-sdk.${{ env.VERSION }}.min.js` - SDK minificado
|
|
135
|
-
- `easyflow-sdk.min.js` - SDK minificado (sem versão)
|
|
136
|
-
- `example.html` - Exemplo de uso com SRI
|
|
137
|
-
draft: false
|
|
138
|
-
prerelease: false
|
|
139
|
-
|
|
140
|
-
- name: Publicar no NPM (se necessário)
|
|
141
|
-
run: |
|
|
142
|
-
echo "Para publicar no NPM, execute manualmente:"
|
|
143
|
-
echo "npm publish --access public"
|
|
144
|
-
echo "Isso tornará o SDK disponível no jsDelivr automaticamente"
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
name: Release Easyflow SDK
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*'
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
release:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- name: Checkout do repositório
|
|
14
|
-
uses: actions/checkout@v4
|
|
15
|
-
|
|
16
|
-
- name: Instalar Node.js
|
|
17
|
-
uses: actions/setup-node@v4
|
|
18
|
-
with:
|
|
19
|
-
node-version: 20
|
|
20
|
-
cache: 'npm'
|
|
21
|
-
|
|
22
|
-
- name: Instalar dependências
|
|
23
|
-
run: npm install
|
|
24
|
-
|
|
25
|
-
- name: Gerar arquivo de versão
|
|
26
|
-
run: npm run generate-version
|
|
27
|
-
|
|
28
|
-
- name: Executar testes
|
|
29
|
-
run: npm test
|
|
30
|
-
|
|
31
|
-
- name: Build do SDK
|
|
32
|
-
run: npm run build
|
|
33
|
-
|
|
34
|
-
- name: Extrair versão do SDK
|
|
35
|
-
id: version
|
|
36
|
-
run: |
|
|
37
|
-
VERSION=$(jq -r .version package.json)
|
|
38
|
-
echo "VERSION=v$VERSION" >> "$GITHUB_ENV"
|
|
39
|
-
echo "version=v$VERSION" >> "$GITHUB_OUTPUT"
|
|
40
|
-
|
|
41
|
-
- name: Copiar arquivo com versão
|
|
42
|
-
run: |
|
|
43
|
-
cp dist/easyflow-sdk.min.js dist/easyflow-sdk.${{ env.VERSION }}.min.js
|
|
44
|
-
|
|
45
|
-
- name: Copiar interface de teste
|
|
46
|
-
run: |
|
|
47
|
-
cp index.html dist/
|
|
48
|
-
# Update the script src to use the correct path for production
|
|
49
|
-
sed -i 's|./dist/easyflow-sdk.min.js|./easyflow-sdk.min.js|g' dist/index.html
|
|
50
|
-
|
|
51
|
-
- name: Gerar hash de integridade (SRI)
|
|
52
|
-
id: sri
|
|
53
|
-
run: |
|
|
54
|
-
HASH=$(openssl dgst -sha384 -binary dist/easyflow-sdk.${{ env.VERSION }}.min.js | openssl base64 -A)
|
|
55
|
-
echo "SRI=sha384-${HASH}" >> "$GITHUB_ENV"
|
|
56
|
-
echo "sha=sha384-${HASH}" >> "$GITHUB_OUTPUT"
|
|
57
|
-
|
|
58
|
-
- name: Criar arquivo de exemplo com SRI
|
|
59
|
-
run: |
|
|
60
|
-
cat > dist/example.html << EOF
|
|
61
|
-
<!DOCTYPE html>
|
|
62
|
-
<html>
|
|
63
|
-
<head>
|
|
64
|
-
<title>Easyflow SDK Example</title>
|
|
65
|
-
</head>
|
|
66
|
-
<body>
|
|
67
|
-
<h1>Easyflow SDK v${{ env.VERSION }}</h1>
|
|
68
|
-
<script src="easyflow-sdk.${{ env.VERSION }}.min.js"
|
|
69
|
-
integrity="${{ env.SRI }}"
|
|
70
|
-
crossorigin="anonymous"></script>
|
|
71
|
-
<script>
|
|
72
|
-
console.log('EasyflowSDK version:', EasyflowSDK.version);
|
|
73
|
-
</script>
|
|
74
|
-
</body>
|
|
75
|
-
</html>
|
|
76
|
-
EOF
|
|
77
|
-
|
|
78
|
-
- name: Deploy para Cloudflare Pages
|
|
79
|
-
uses: cloudflare/pages-action@v1
|
|
80
|
-
with:
|
|
81
|
-
apiToken: ${{ secrets.CF_API_TOKEN }}
|
|
82
|
-
accountId: ${{ secrets.CF_ACCOUNT_ID }}
|
|
83
|
-
projectName: easyflow-sdk
|
|
84
|
-
directory: dist
|
|
85
|
-
|
|
86
|
-
- name: Criar Release no GitHub
|
|
87
|
-
uses: actions/create-release@v1
|
|
88
|
-
env:
|
|
89
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
90
|
-
with:
|
|
91
|
-
tag_name: ${{ github.ref }}
|
|
92
|
-
release_name: Easyflow SDK ${{ env.VERSION }}
|
|
93
|
-
body: |
|
|
94
|
-
## Easyflow SDK ${{ env.VERSION }}
|
|
95
|
-
|
|
96
|
-
### Arquivos
|
|
97
|
-
- `easyflow-sdk.${{ env.VERSION }}.min.js` - SDK minificado
|
|
98
|
-
- `easyflow-sdk.min.js` - SDK minificado (sem versão)
|
|
99
|
-
|
|
100
|
-
### SRI Hash
|
|
101
|
-
```
|
|
102
|
-
sha384-${{ env.SRI }}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Uso
|
|
106
|
-
```html
|
|
107
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.${{ env.VERSION }}.min.js"
|
|
108
|
-
integrity="sha384-${{ env.SRI }}"
|
|
109
|
-
crossorigin="anonymous"></script>
|
|
110
|
-
```
|
|
111
|
-
draft: false
|
|
112
|
-
prerelease: false
|
package/.prettierrc
DELETED
package/CDN-DEPLOYMENT.md
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
# CDN Deployment Guide
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This guide explains how to deploy the Easyflow JavaScript SDK to CDN and make it available for public consumption.
|
|
6
|
-
|
|
7
|
-
## Prerequisites
|
|
8
|
-
|
|
9
|
-
- Node.js 18+ installed
|
|
10
|
-
- npm or yarn package manager
|
|
11
|
-
- Git repository access
|
|
12
|
-
- GitHub Pages enabled for the repository
|
|
13
|
-
|
|
14
|
-
## Build Process
|
|
15
|
-
|
|
16
|
-
### 1. Build the SDK
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm run build
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
This command will:
|
|
23
|
-
- Generate version constants
|
|
24
|
-
- Bundle the SDK using Webpack
|
|
25
|
-
- Create minified and obfuscated versions
|
|
26
|
-
- Output files to the `dist/` directory
|
|
27
|
-
|
|
28
|
-
### 2. Create Git Tag
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
git add .
|
|
32
|
-
git commit -m "Release v2.1.6"
|
|
33
|
-
git tag v2.1.6
|
|
34
|
-
git push origin v2.1.6
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### 3. Deploy to GitHub Pages
|
|
38
|
-
|
|
39
|
-
The GitHub Actions workflow will automatically:
|
|
40
|
-
- Build the SDK
|
|
41
|
-
- Deploy to GitHub Pages
|
|
42
|
-
- Make it available at `https://easyflow-sdk.pages.dev`
|
|
43
|
-
|
|
44
|
-
## CDN URLs
|
|
45
|
-
|
|
46
|
-
### GitHub Pages (Primary)
|
|
47
|
-
|
|
48
|
-
```html
|
|
49
|
-
<!-- Latest version -->
|
|
50
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>
|
|
51
|
-
|
|
52
|
-
<!-- Specific version -->
|
|
53
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.6.min.js"></script>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### NPM CDN (Alternative)
|
|
57
|
-
|
|
58
|
-
```html
|
|
59
|
-
<!-- Latest version -->
|
|
60
|
-
<script src="https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk/dist/easyflow-sdk.min.js"></script>
|
|
61
|
-
|
|
62
|
-
<!-- Specific version -->
|
|
63
|
-
<script src="https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@2.1.6/dist/easyflow-sdk.min.js"></script>
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## File Structure
|
|
67
|
-
|
|
68
|
-
After deployment, the following files will be available:
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
https://easyflow-sdk.pages.dev/
|
|
72
|
-
├── easyflow-sdk.min.js # Latest version
|
|
73
|
-
├── easyflow-sdk.v2.1.6.min.js # Versioned file
|
|
74
|
-
├── easyflow-sdk.v2.1.5.min.js # Previous version
|
|
75
|
-
└── ... # Other versions
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Usage Examples
|
|
79
|
-
|
|
80
|
-
### Basic Integration
|
|
81
|
-
|
|
82
|
-
```html
|
|
83
|
-
<!DOCTYPE html>
|
|
84
|
-
<html>
|
|
85
|
-
<head>
|
|
86
|
-
<title>Easyflow SDK Test</title>
|
|
87
|
-
</head>
|
|
88
|
-
<body>
|
|
89
|
-
<h1>Easyflow SDK Test</h1>
|
|
90
|
-
|
|
91
|
-
<!-- Load SDK from CDN -->
|
|
92
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.v2.1.6.min.js"></script>
|
|
93
|
-
|
|
94
|
-
<script>
|
|
95
|
-
// SDK is now available as window.easyflowSDK
|
|
96
|
-
console.log('SDK Version:', window.easyflowSDK.version);
|
|
97
|
-
|
|
98
|
-
// Initialize SDK
|
|
99
|
-
const sdk = new window.EasyflowSDK({
|
|
100
|
-
businessId: 'your-business-id'
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
console.log('SDK initialized:', sdk);
|
|
104
|
-
</script>
|
|
105
|
-
</body>
|
|
106
|
-
</html>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Version-Specific Loading
|
|
110
|
-
|
|
111
|
-
```html
|
|
112
|
-
<!-- Load specific version for stability -->
|
|
113
|
-
<script src="https://cdn.jsdelivr.net/npm/@easyflow/javascript-sdk@2.1.6/dist/easyflow-sdk.min.js"></script>
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## Versioning Strategy
|
|
117
|
-
|
|
118
|
-
### Semantic Versioning
|
|
119
|
-
|
|
120
|
-
- **Major** (2.x.x): Breaking changes
|
|
121
|
-
- **Minor** (2.1.x): New features, backward compatible
|
|
122
|
-
- **Patch** (2.1.6): Bug fixes, backward compatible
|
|
123
|
-
|
|
124
|
-
### Release Process
|
|
125
|
-
|
|
126
|
-
1. **Development**: Work on features/fixes
|
|
127
|
-
2. **Testing**: Run full test suite
|
|
128
|
-
3. **Build**: Create production build
|
|
129
|
-
4. **Tag**: Create git tag with version
|
|
130
|
-
5. **Deploy**: Automatic deployment via GitHub Actions
|
|
131
|
-
6. **Document**: Update documentation and examples
|
|
132
|
-
|
|
133
|
-
## Troubleshooting
|
|
134
|
-
|
|
135
|
-
### Common Issues
|
|
136
|
-
|
|
137
|
-
1. **SDK not loading**: Check CDN URL and network connectivity
|
|
138
|
-
2. **Version mismatch**: Ensure using correct version tag
|
|
139
|
-
3. **Build errors**: Check Node.js version and dependencies
|
|
140
|
-
|
|
141
|
-
### Debug Mode
|
|
142
|
-
|
|
143
|
-
For development, you can use the unminified version:
|
|
144
|
-
|
|
145
|
-
```html
|
|
146
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.js"></script>
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
## Security Considerations
|
|
150
|
-
|
|
151
|
-
- All CDN files are served over HTTPS
|
|
152
|
-
- Files are minified and obfuscated for production
|
|
153
|
-
- Source maps are not included in production builds
|
|
154
|
-
- Regular security audits are performed
|
|
155
|
-
|
|
156
|
-
## Monitoring
|
|
157
|
-
|
|
158
|
-
- GitHub Pages deployment status
|
|
159
|
-
- CDN performance metrics
|
|
160
|
-
- Error tracking and reporting
|
|
161
|
-
- Usage analytics
|
|
162
|
-
|
|
163
|
-
## Support
|
|
164
|
-
|
|
165
|
-
For issues with CDN deployment:
|
|
166
|
-
|
|
167
|
-
1. Check GitHub Actions workflow status
|
|
168
|
-
2. Verify file availability at CDN URLs
|
|
169
|
-
3. Test with different browsers/devices
|
|
170
|
-
4. Contact development team
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
**Last Updated**: v2.1.6
|
|
175
|
-
**Next Release**: v2.1.7 (patch) or v2.2.0 (minor)
|
package/DEMO.md
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
# EasyFlow JavaScript SDK - Demonstração Completa
|
|
2
|
-
|
|
3
|
-
Este arquivo demonstra como usar todas as funcionalidades implementadas no EasyFlow JavaScript SDK, incluindo as novas funcionalidades de gerenciamento de clientes e cartões de crédito.
|
|
4
|
-
|
|
5
|
-
## 🚀 Inicialização
|
|
6
|
-
|
|
7
|
-
```javascript
|
|
8
|
-
// Inicializar o SDK
|
|
9
|
-
const sdk = new EasyflowSDK('your-business-id')
|
|
10
|
-
|
|
11
|
-
// Ou com configuração completa
|
|
12
|
-
const sdk = new EasyflowSDK({
|
|
13
|
-
businessId: 'your-business-id',
|
|
14
|
-
additionalOptions: {},
|
|
15
|
-
})
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## 👥 Gerenciamento de Clientes
|
|
19
|
-
|
|
20
|
-
### 1. Criar Cliente
|
|
21
|
-
|
|
22
|
-
```javascript
|
|
23
|
-
const customer = await sdk.createCustomer({
|
|
24
|
-
name: 'Diego Moura',
|
|
25
|
-
email: 'diegomoura637+20@gmail.com',
|
|
26
|
-
deliveryAddress: {
|
|
27
|
-
zipCode: '37540114',
|
|
28
|
-
street: 'Rua Marechal Deodoro',
|
|
29
|
-
complement: 'Apt',
|
|
30
|
-
neighborhood: 'Centro',
|
|
31
|
-
city: 'Pouso Alegre',
|
|
32
|
-
state: 'MG',
|
|
33
|
-
number: '33',
|
|
34
|
-
},
|
|
35
|
-
address: {
|
|
36
|
-
zipCode: '37540114',
|
|
37
|
-
street: 'Rua Marechal Deodoro',
|
|
38
|
-
complement: 'Apt',
|
|
39
|
-
neighborhood: 'Centro',
|
|
40
|
-
city: 'Pouso Alegre',
|
|
41
|
-
state: 'MG',
|
|
42
|
-
number: '33',
|
|
43
|
-
},
|
|
44
|
-
document: {
|
|
45
|
-
type: 'CPF',
|
|
46
|
-
number: '01234567890',
|
|
47
|
-
},
|
|
48
|
-
phone: {
|
|
49
|
-
areaCode: '+55',
|
|
50
|
-
ddd: '11',
|
|
51
|
-
number: '998862782',
|
|
52
|
-
isMobile: true,
|
|
53
|
-
},
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
console.log('Cliente criado:', customer.id)
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### 2. Buscar Cliente
|
|
60
|
-
|
|
61
|
-
```javascript
|
|
62
|
-
const customerInfo = await sdk.getCustomer('customer-1234567890123456')
|
|
63
|
-
console.log('Nome:', customerInfo.name)
|
|
64
|
-
console.log('Email:', customerInfo.email)
|
|
65
|
-
console.log('Documento:', customerInfo.document)
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### 3. Atualizar Cliente
|
|
69
|
-
|
|
70
|
-
```javascript
|
|
71
|
-
const updateResult = await sdk.updateCustomer('customer-1234567890123456', {
|
|
72
|
-
name: 'Diego Moura Atualizado',
|
|
73
|
-
email: 'diegomoura637+21@gmail.com',
|
|
74
|
-
phone: {
|
|
75
|
-
areaCode: '+55',
|
|
76
|
-
ddd: '11',
|
|
77
|
-
number: '998862783',
|
|
78
|
-
isMobile: true,
|
|
79
|
-
},
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
console.log('Cliente atualizado:', updateResult.success)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### 4. Listar Clientes
|
|
86
|
-
|
|
87
|
-
```javascript
|
|
88
|
-
const customers = await sdk.listCustomers(1, 10)
|
|
89
|
-
console.log(`Página ${customers.currentPage} de ${customers.totalPages}`)
|
|
90
|
-
console.log(`Total: ${customers.totalDocs} clientes`)
|
|
91
|
-
|
|
92
|
-
customers.docs.forEach((customer) => {
|
|
93
|
-
console.log(`- ${customer.name} (${customer.email})`)
|
|
94
|
-
})
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## 💳 Gerenciamento de Cartões de Crédito
|
|
98
|
-
|
|
99
|
-
### 1. Adicionar Cartão
|
|
100
|
-
|
|
101
|
-
```javascript
|
|
102
|
-
const cardResult = await sdk.addCreditCard(
|
|
103
|
-
'customer-1234567890123456',
|
|
104
|
-
'gGAVbMqIWZD0ftaHEMYSbU+YHVyUPU67ITGsfeawLtg51e7UE/UF4rYferWVjy6OPkJ+ep1B4hDhospUPsskIsXf4i8I9BvJzgwbwPUH8ScbwwDbUIWq0H9gY/7gHrnnQ1SqgNpcrGVhe3wa3mt2ilNOO5LUuIUpo/WbRuWQQUxjibfvLrTlGqBNdUKU/83xVJTSbT4mLxzatwnFVBM7MaT4zDO2IgcRbyjX38iFslJIPP2nFfIVwuIdRbSMIqEH38SHetovGgHaQ58YA1ATN5ksxBFC4qt3jvmtz/dhol/CQhty/4o40h33eQZrJPCrMAcDcbT2obto7L8='
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
console.log('Cartão adicionado:', cardResult.creditCardId)
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### 2. Buscar Cartão
|
|
111
|
-
|
|
112
|
-
```javascript
|
|
113
|
-
const creditCard = await sdk.getCreditCard(
|
|
114
|
-
'customer-1234567890123456',
|
|
115
|
-
'201abf40-e64e-4743-88b9-b5d47830904a'
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
console.log('Bandeira:', creditCard.brand)
|
|
119
|
-
console.log('Últimos 4 dígitos:', creditCard.last4Numbers)
|
|
120
|
-
console.log(
|
|
121
|
-
'Expira:',
|
|
122
|
-
`${creditCard.expiresAtMonth}/${creditCard.expiresAtYear}`
|
|
123
|
-
)
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### 3. Atualizar Cartão
|
|
127
|
-
|
|
128
|
-
```javascript
|
|
129
|
-
const updateCardResult = await sdk.updateCreditCard(
|
|
130
|
-
'201abf40-e64e-4743-88b9-b5d47830904a',
|
|
131
|
-
'new-encrypted-token-789'
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
console.log('Cartão atualizado:', updateCardResult.success)
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### 4. Remover Cartão
|
|
138
|
-
|
|
139
|
-
```javascript
|
|
140
|
-
const removeResult = await sdk.removeCreditCard(
|
|
141
|
-
'customer-1234567890123456',
|
|
142
|
-
'201abf40-e64e-4743-88b9-b5d47830904a'
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
console.log('Cartão removido:', removeResult.success)
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### 5. Listar Cartões
|
|
149
|
-
|
|
150
|
-
```javascript
|
|
151
|
-
const creditCards = await sdk.listCreditCards('customer-1234567890123456')
|
|
152
|
-
|
|
153
|
-
creditCards.forEach((card) => {
|
|
154
|
-
console.log(`${card.brand} terminando em ${card.last4Numbers}`)
|
|
155
|
-
console.log(`Expira: ${card.expiresAtMonth}/${card.expiresAtYear}`)
|
|
156
|
-
console.log('---')
|
|
157
|
-
})
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## 🔐 Headers de Segurança
|
|
161
|
-
|
|
162
|
-
```javascript
|
|
163
|
-
const secureHeaders = {
|
|
164
|
-
'x-fingerprint-id': '12345678',
|
|
165
|
-
'x-recaptcha-token': 'your_recaptcha_token',
|
|
166
|
-
'ef-signature': 'your_hmac_signature',
|
|
167
|
-
'x-custom-header': 'custom_value',
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Usar headers em qualquer operação
|
|
171
|
-
const customer = await sdk.createCustomer(customerData, secureHeaders)
|
|
172
|
-
const creditCard = await sdk.addCreditCard(customerId, token, secureHeaders)
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Tratamento de Erros
|
|
176
|
-
|
|
177
|
-
```javascript
|
|
178
|
-
try {
|
|
179
|
-
const customer = await sdk.createCustomer(customerData)
|
|
180
|
-
console.log('Sucesso:', customer.id)
|
|
181
|
-
} catch (error) {
|
|
182
|
-
if (error instanceof ValidationError) {
|
|
183
|
-
console.error('Erro de validação:', error.message)
|
|
184
|
-
console.error('Campo:', error.field)
|
|
185
|
-
} else if (error instanceof NetworkError) {
|
|
186
|
-
console.error('Erro de rede:', error.message)
|
|
187
|
-
} else if (error instanceof SecurityError) {
|
|
188
|
-
console.error('Erro de segurança:', error.message)
|
|
189
|
-
} else {
|
|
190
|
-
console.error('Erro inesperado:', error)
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
## 📋 Validações Automáticas
|
|
196
|
-
|
|
197
|
-
O SDK valida automaticamente todos os dados:
|
|
198
|
-
|
|
199
|
-
- **Email**: Formato válido e segurança
|
|
200
|
-
- **CPF/CNPJ**: Algoritmo oficial brasileiro
|
|
201
|
-
- **Telefone**: Formato brasileiro com DDD
|
|
202
|
-
- **Endereço**: Estrutura brasileira completa
|
|
203
|
-
- **IDs**: Formato e unicidade
|
|
204
|
-
- **Tokens**: Comprimento e formato
|
|
205
|
-
|
|
206
|
-
## 🔄 Rate Limiting
|
|
207
|
-
|
|
208
|
-
O SDK inclui proteção automática contra abuso:
|
|
209
|
-
|
|
210
|
-
```javascript
|
|
211
|
-
// Cada método tem seu próprio limite
|
|
212
|
-
await sdk.createCustomer(customerData) // Rate limit: createCustomer
|
|
213
|
-
await sdk.getCustomer(customerId) // Rate limit: getCustomer
|
|
214
|
-
await sdk.addCreditCard(customerId, token) // Rate limit: addCreditCard
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## 🧪 Testes
|
|
218
|
-
|
|
219
|
-
Execute os testes para verificar se tudo está funcionando:
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
# Todos os testes
|
|
223
|
-
npm test
|
|
224
|
-
|
|
225
|
-
# Testes específicos
|
|
226
|
-
npm test -- --testNamePattern="Customer Management"
|
|
227
|
-
npm test -- --testNamePattern="Credit Card Management"
|
|
228
|
-
|
|
229
|
-
# Cobertura
|
|
230
|
-
npm run test:coverage
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
## Status dos Testes
|
|
234
|
-
|
|
235
|
-
- **Total de Testes**: 263
|
|
236
|
-
- **Taxa de Sucesso**: 100%
|
|
237
|
-
- **Cobertura**: Excelente
|
|
238
|
-
- **Funcionalidades**: Todas implementadas
|
|
239
|
-
|
|
240
|
-
## Próximos Passos
|
|
241
|
-
|
|
242
|
-
1. **Integração**: Use o SDK em sua aplicação
|
|
243
|
-
2. **Webhooks**: Configure notificações automáticas
|
|
244
|
-
3. **Monitoramento**: Implemente logs e métricas
|
|
245
|
-
4. **Segurança**: Configure headers de segurança
|
|
246
|
-
5. **Produção**: Deploy em ambiente de produção
|
|
247
|
-
|
|
248
|
-
## 📞 Suporte
|
|
249
|
-
|
|
250
|
-
- **Documentação**: [docs.easyflow.digital](https://docs.easyflow.digital)
|
|
251
|
-
- **Suporte**: [easyflow.digital/contact](https://easyflow.digital/contact)
|
|
252
|
-
- **Issues**: [GitHub Issues](https://github.com/easyflow-cash/easyflow-javascript-sdk/issues)
|
|
253
|
-
|
|
254
|
-
---
|
|
255
|
-
|
|
256
|
-
**EasyFlow JavaScript SDK** - Versão 2.1.4
|
|
257
|
-
**Última atualização**: Dezembro 2024
|
|
258
|
-
**Status**: Pronto para produção
|