@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
package/test-setup.cjs
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
// Test setup file for Jest
|
|
2
|
-
// This file is referenced in jest.config.js
|
|
3
|
-
|
|
4
|
-
// Mock global objects that might not be available in Node.js environment
|
|
5
|
-
global.window = {
|
|
6
|
-
crypto: {
|
|
7
|
-
getRandomValues: jest.fn((array) => {
|
|
8
|
-
for (let i = 0; i < array.length; i++) {
|
|
9
|
-
array[i] = Math.floor(Math.random() * 256)
|
|
10
|
-
}
|
|
11
|
-
return array
|
|
12
|
-
}),
|
|
13
|
-
subtle: {
|
|
14
|
-
// Mock Web Crypto API methods if needed
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
location: {
|
|
18
|
-
protocol: 'https:',
|
|
19
|
-
hostname: 'localhost',
|
|
20
|
-
origin: 'https://localhost:443',
|
|
21
|
-
},
|
|
22
|
-
top: {},
|
|
23
|
-
self: {},
|
|
24
|
-
trustedTypes: undefined,
|
|
25
|
-
outerHeight: 800,
|
|
26
|
-
innerHeight: 600,
|
|
27
|
-
outerWidth: 1200,
|
|
28
|
-
innerWidth: 1000,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Mock fetch globally
|
|
32
|
-
global.fetch = jest.fn()
|
|
33
|
-
|
|
34
|
-
// Mock console methods to prevent noise in tests
|
|
35
|
-
const originalConsole = { ...console }
|
|
36
|
-
global.console = {
|
|
37
|
-
...originalConsole,
|
|
38
|
-
log: jest.fn(),
|
|
39
|
-
warn: jest.fn(),
|
|
40
|
-
error: jest.fn(),
|
|
41
|
-
debug: jest.fn(),
|
|
42
|
-
info: jest.fn(),
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Mock AbortController
|
|
46
|
-
global.AbortController = jest.fn().mockImplementation(() => ({
|
|
47
|
-
signal: {},
|
|
48
|
-
abort: jest.fn(),
|
|
49
|
-
}))
|
|
50
|
-
|
|
51
|
-
// Mock setTimeout and clearTimeout
|
|
52
|
-
global.setTimeout = jest.fn((callback, delay) => {
|
|
53
|
-
const id = Math.random()
|
|
54
|
-
setTimeout.mock.timers[id] = { callback, delay }
|
|
55
|
-
return id
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
global.clearTimeout = jest.fn((id) => {
|
|
59
|
-
delete setTimeout.mock.timers[id]
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
setTimeout.mock.timers = {}
|
|
63
|
-
|
|
64
|
-
// Mock URL and URLSearchParams
|
|
65
|
-
global.URL = jest.fn().mockImplementation((url, base) => ({
|
|
66
|
-
toString: () => url,
|
|
67
|
-
searchParams: new URLSearchParams(),
|
|
68
|
-
}))
|
|
69
|
-
|
|
70
|
-
global.URLSearchParams = jest.fn().mockImplementation((init) => ({
|
|
71
|
-
toString: () => {
|
|
72
|
-
if (!init) return ''
|
|
73
|
-
return Object.entries(init)
|
|
74
|
-
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
|
|
75
|
-
.join('&')
|
|
76
|
-
},
|
|
77
|
-
}))
|
|
78
|
-
|
|
79
|
-
// Mock document for fingerprinting tests
|
|
80
|
-
global.document = {
|
|
81
|
-
createElement: jest.fn((tagName) => {
|
|
82
|
-
if (tagName === 'canvas') {
|
|
83
|
-
return {
|
|
84
|
-
getContext: jest.fn(() => ({
|
|
85
|
-
textBaseline: '',
|
|
86
|
-
font: '',
|
|
87
|
-
fillStyle: '',
|
|
88
|
-
fillRect: jest.fn(),
|
|
89
|
-
fillText: jest.fn(),
|
|
90
|
-
clearRect: jest.fn(),
|
|
91
|
-
clear: jest.fn(),
|
|
92
|
-
createBuffer: jest.fn(() => ({})),
|
|
93
|
-
bindBuffer: jest.fn(),
|
|
94
|
-
bufferData: jest.fn(),
|
|
95
|
-
createProgram: jest.fn(() => ({})),
|
|
96
|
-
createShader: jest.fn(() => ({})),
|
|
97
|
-
shaderSource: jest.fn(),
|
|
98
|
-
compileShader: jest.fn(),
|
|
99
|
-
attachShader: jest.fn(),
|
|
100
|
-
linkProgram: jest.fn(),
|
|
101
|
-
useProgram: jest.fn(),
|
|
102
|
-
getAttribLocation: jest.fn(),
|
|
103
|
-
getUniformLocation: jest.fn(),
|
|
104
|
-
enableVertexAttribArray: jest.fn(),
|
|
105
|
-
vertexAttribPointer: jest.fn(),
|
|
106
|
-
uniform2f: jest.fn(),
|
|
107
|
-
drawArrays: jest.fn(),
|
|
108
|
-
readPixels: jest.fn(),
|
|
109
|
-
getParameter: jest.fn(() => 'mock-parameter'),
|
|
110
|
-
getSupportedExtensions: jest.fn(() => ['mock-extension']),
|
|
111
|
-
ARRAY_BUFFER: 'ARRAY_BUFFER',
|
|
112
|
-
STATIC_DRAW: 'STATIC_DRAW',
|
|
113
|
-
VERTEX_SHADER: 'VERTEX_SHADER',
|
|
114
|
-
FRAGMENT_SHADER: 'FRAGMENT_SHADER',
|
|
115
|
-
TRIANGLE_STRIP: 'TRIANGLE_STRIP',
|
|
116
|
-
RGBA: 'RGBA',
|
|
117
|
-
UNSIGNED_BYTE: 'UNSIGNED_BYTE',
|
|
118
|
-
COLOR_BUFFER_BIT: 'COLOR_BUFFER_BIT',
|
|
119
|
-
DEPTH_BUFFER_BIT: 'DEPTH_BUFFER_BIT',
|
|
120
|
-
STENCIL_BUFFER_BIT: 'STENCIL_BUFFER_BIT',
|
|
121
|
-
VERSION: 'VERSION',
|
|
122
|
-
SHADING_LANGUAGE_VERSION: 'SHADING_LANGUAGE_VERSION',
|
|
123
|
-
VENDOR: 'VENDOR',
|
|
124
|
-
})),
|
|
125
|
-
toDataURL: jest.fn(() => 'data:image/png;base64,mock-data'),
|
|
126
|
-
width: 256,
|
|
127
|
-
height: 128,
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return {}
|
|
131
|
-
}),
|
|
132
|
-
body: {
|
|
133
|
-
appendChild: jest.fn(),
|
|
134
|
-
},
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Mock navigator
|
|
138
|
-
global.navigator = {
|
|
139
|
-
cookieEnabled: true,
|
|
140
|
-
deviceMemory: 8,
|
|
141
|
-
doNotTrack: null,
|
|
142
|
-
hardwareConcurrency: 4,
|
|
143
|
-
language: 'en-US',
|
|
144
|
-
languages: ['en-US', 'en'],
|
|
145
|
-
maxTouchPoints: 0,
|
|
146
|
-
platform: 'Win32',
|
|
147
|
-
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
|
|
148
|
-
vendor: 'Google Inc.',
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Mock screen
|
|
152
|
-
global.screen = {
|
|
153
|
-
width: 1920,
|
|
154
|
-
height: 1080,
|
|
155
|
-
colorDepth: 24,
|
|
156
|
-
pixelDepth: 24,
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Mock Date
|
|
160
|
-
const originalDate = global.Date
|
|
161
|
-
global.Date = class extends originalDate {
|
|
162
|
-
constructor(...args) {
|
|
163
|
-
if (args.length === 0) {
|
|
164
|
-
return new originalDate('2023-01-01T00:00:00.000Z')
|
|
165
|
-
}
|
|
166
|
-
return new originalDate(...args)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
static now() {
|
|
170
|
-
return new originalDate('2023-01-01T00:00:00.000Z').getTime()
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// Mock Intl
|
|
175
|
-
global.Intl = {
|
|
176
|
-
DateTimeFormat: jest.fn(() => ({
|
|
177
|
-
resolvedOptions: jest.fn(() => ({
|
|
178
|
-
timeZone: 'America/New_York',
|
|
179
|
-
})),
|
|
180
|
-
})),
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Mock Math.random for consistent tests
|
|
184
|
-
const originalMathRandom = Math.random
|
|
185
|
-
Math.random = jest.fn(() => 0.5)
|
|
186
|
-
|
|
187
|
-
// Mock crypto.getRandomValues for consistent fingerprinting
|
|
188
|
-
const originalGetRandomValues = global.window.crypto.getRandomValues
|
|
189
|
-
global.window.crypto.getRandomValues = jest.fn((array) => {
|
|
190
|
-
for (let i = 0; i < array.length; i++) {
|
|
191
|
-
array[i] = i % 256 // Consistent values for testing
|
|
192
|
-
}
|
|
193
|
-
return array
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
// Cleanup function to restore mocks
|
|
197
|
-
afterEach(() => {
|
|
198
|
-
jest.clearAllMocks()
|
|
199
|
-
fetch.mockClear()
|
|
200
|
-
console.log.mockClear()
|
|
201
|
-
console.warn.mockClear()
|
|
202
|
-
console.error.mockClear()
|
|
203
|
-
console.debug.mockClear()
|
|
204
|
-
console.info.mockClear()
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
// Restore original functions after all tests
|
|
208
|
-
afterAll(() => {
|
|
209
|
-
Math.random = originalMathRandom
|
|
210
|
-
global.window.crypto.getRandomValues = originalGetRandomValues
|
|
211
|
-
})
|
package/test.html
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
|
6
|
-
<title>Easyflow SDK Test</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<h1>Easyflow SDK Test</h1>
|
|
10
|
-
<button onclick="testPurchase()">Test Purchase</button>
|
|
11
|
-
<p id="result"></p>
|
|
12
|
-
|
|
13
|
-
<!-- Carregar o script ANTES de usá-lo -->
|
|
14
|
-
<script src="https://easyflow-sdk.pages.dev/easyflow-sdk.min.js"></script>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
async function testPurchase() {
|
|
18
|
-
try {
|
|
19
|
-
debugger
|
|
20
|
-
const businessId = '6bbf1a80-6a6d-4a33-abdd-50c34860bcd3'
|
|
21
|
-
const sdk = new EasyflowSDK({ businessId })
|
|
22
|
-
const offerId = '290fef7a-5dba-4be1-8315-9e5426dcfe00'
|
|
23
|
-
const offer = await sdk.getOffer(offerId)
|
|
24
|
-
console.log('Offer Details:', offer)
|
|
25
|
-
const params = {
|
|
26
|
-
buyer: {
|
|
27
|
-
'name': 'Eduardo Rotundaro',
|
|
28
|
-
'email': 'diegomoura637@gmail.com',
|
|
29
|
-
'document': {
|
|
30
|
-
'number': '01234567890',
|
|
31
|
-
'type': 'CPF',
|
|
32
|
-
},
|
|
33
|
-
'phone': {
|
|
34
|
-
'areaCode': '+55',
|
|
35
|
-
'ddd': '92',
|
|
36
|
-
'number': '984292191',
|
|
37
|
-
'isMobile': true,
|
|
38
|
-
},
|
|
39
|
-
'address': {
|
|
40
|
-
'zipCode': '37537074',
|
|
41
|
-
'street': 'Rua Richard Conrad Menezes de Alckmin',
|
|
42
|
-
'complement': '',
|
|
43
|
-
'neighborhood': 'Morada do Sol',
|
|
44
|
-
'city': 'Santa Rita do Sapucaí',
|
|
45
|
-
'state': 'MG',
|
|
46
|
-
'number': '233',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
'payments': [
|
|
50
|
-
{
|
|
51
|
-
'method': 'pix',
|
|
52
|
-
'numberInstallments': 1,
|
|
53
|
-
'valueInCents': 500,
|
|
54
|
-
// 'creditCard': {
|
|
55
|
-
// 'cardNumber': '',
|
|
56
|
-
// 'cvv': '',
|
|
57
|
-
// 'month': '',
|
|
58
|
-
// 'year': '',
|
|
59
|
-
// 'holderName': '',
|
|
60
|
-
// },
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
items: [{
|
|
64
|
-
name: 'Carregador de Celular',
|
|
65
|
-
description: 'Carregador de celular com cabo USB-C',
|
|
66
|
-
quantity: 1,
|
|
67
|
-
priceInCents: 500,
|
|
68
|
-
}],
|
|
69
|
-
}
|
|
70
|
-
// const orderId = await sdk.charge(params)
|
|
71
|
-
// console.log('Order ID:', orderId)
|
|
72
|
-
// const order = await sdk.getOrder(orderId)
|
|
73
|
-
// console.log('Order ID:', orderId)
|
|
74
|
-
// console.log('Order Details:', order)
|
|
75
|
-
|
|
76
|
-
// const orderId2 = await sdk.placeOrder(offerId, params)
|
|
77
|
-
// const order2 = await sdk.getOrder(orderId)
|
|
78
|
-
// console.log('Order ID 2:', orderId2)
|
|
79
|
-
// console.log('Order 2 Details:', order2)
|
|
80
|
-
|
|
81
|
-
debugger
|
|
82
|
-
const newCustomer = await sdk.createCustomer({
|
|
83
|
-
'businessId': '6bbf1a80-6a6d-4a33-abdd-50c34860bcd3',
|
|
84
|
-
'name': 'Diego Moura',
|
|
85
|
-
'email': 'diegomoura637+50@gmail.com',
|
|
86
|
-
'deliveryAddress': {
|
|
87
|
-
'zipCode': '37540114',
|
|
88
|
-
'street': 'Rua Marechal Deodoro',
|
|
89
|
-
'complement': 'Apt',
|
|
90
|
-
'neighborhood': 'Centro',
|
|
91
|
-
'city': 'Pouso Alegre',
|
|
92
|
-
'state': 'MG',
|
|
93
|
-
'number': '33',
|
|
94
|
-
},
|
|
95
|
-
'address': {
|
|
96
|
-
'zipCode': '37540114',
|
|
97
|
-
'street': 'Rua Marechal Deodoro',
|
|
98
|
-
'complement': 'Apt',
|
|
99
|
-
'neighborhood': 'Centro',
|
|
100
|
-
'city': 'Pouso Alegre',
|
|
101
|
-
'state': 'MG',
|
|
102
|
-
'number': '33',
|
|
103
|
-
},
|
|
104
|
-
'document': {
|
|
105
|
-
'type': 'CPF',
|
|
106
|
-
'number': '01234567890',
|
|
107
|
-
},
|
|
108
|
-
'phone': {
|
|
109
|
-
'areaCode': '+55',
|
|
110
|
-
'ddd': '11',
|
|
111
|
-
'number': '998862782',
|
|
112
|
-
'isMobile': true,
|
|
113
|
-
},
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
console.log('New Customer:', newCustomer)
|
|
117
|
-
|
|
118
|
-
await sdk.updateCustomer(newCustomer.id, { 'name': 'Diego Moura Updated' })
|
|
119
|
-
|
|
120
|
-
const updatedCustomer = await sdk.getCustomer(newCustomer.id)
|
|
121
|
-
console.log('Updated Customer:', updatedCustomer)
|
|
122
|
-
|
|
123
|
-
const creditCardEncrypted = await sdk.encrypt({
|
|
124
|
-
'cardNumber': '4022827530107566',
|
|
125
|
-
'cvv': '991',
|
|
126
|
-
'month': '09',
|
|
127
|
-
'year': '2026',
|
|
128
|
-
'holderName': 'Fernando Barrows',
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
console.log('Encrypted Credit Card:', creditCardEncrypted)
|
|
132
|
-
|
|
133
|
-
const response = await sdk.addCreditCard(newCustomer.id, creditCardEncrypted)
|
|
134
|
-
console.log('Credit Card Added:', response)
|
|
135
|
-
|
|
136
|
-
const params2 = JSON.parse(JSON.stringify(params))
|
|
137
|
-
params2.buyer['customerId'] = newCustomer.id
|
|
138
|
-
params2.payments[0]['creditCard'] = {
|
|
139
|
-
'cardId': response.id,
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const orderId3 = await sdk.charge(params2)
|
|
143
|
-
const order3 = await sdk.getOrder(orderId3)
|
|
144
|
-
console.log('Order ID 3:', orderId3)
|
|
145
|
-
console.log('Order 3 Details:', order3)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
} catch (error) {
|
|
149
|
-
console.error('Error:', error)
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
</script>
|
|
153
|
-
</body>
|
|
154
|
-
</html>
|
package/webpack.config.cjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const TerserPlugin = require('terser-webpack-plugin')
|
|
3
|
-
const WebpackObfuscator = require('webpack-obfuscator')
|
|
4
|
-
|
|
5
|
-
const config = {
|
|
6
|
-
mode: 'production',
|
|
7
|
-
entry: './sdk.mjs',
|
|
8
|
-
output: {
|
|
9
|
-
filename: 'easyflow-sdk.min.js',
|
|
10
|
-
path: path.resolve(__dirname, 'dist'),
|
|
11
|
-
},
|
|
12
|
-
module: {
|
|
13
|
-
rules: [
|
|
14
|
-
{
|
|
15
|
-
test: /\.m?js$/,
|
|
16
|
-
include: /lib/,
|
|
17
|
-
exclude: /node_modules/,
|
|
18
|
-
use: {
|
|
19
|
-
loader: 'babel-loader',
|
|
20
|
-
options: {
|
|
21
|
-
presets: ['@babel/preset-env'],
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
devtool: 'source-map',
|
|
28
|
-
optimization: {
|
|
29
|
-
minimize: true,
|
|
30
|
-
minimizer: [new TerserPlugin()],
|
|
31
|
-
},
|
|
32
|
-
plugins: [
|
|
33
|
-
new WebpackObfuscator({
|
|
34
|
-
rotateStringArray: true,
|
|
35
|
-
stringArray: true,
|
|
36
|
-
stringArrayThreshold: 0.75,
|
|
37
|
-
}),
|
|
38
|
-
],
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
module.exports = config
|