@fat-zebra/sdk 1.5.11 → 1.5.12-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.yml +13 -0
- package/.husky/commit-msg +0 -3
- package/.husky/prepare-commit-msg +0 -3
- package/.tool-versions +1 -1
- package/README.dev.md +0 -68
- package/package.json +18 -35
- package/.husky/pre-commit +0 -2
- package/dist/fatzebra.css +0 -91
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
registries:
|
|
3
|
+
cloudsmith_npm:
|
|
4
|
+
type: npm-registry
|
|
5
|
+
url: https://npm.cloudsmith.io/fat-zebra/npm
|
|
6
|
+
token: ${{ secrets.CLOUDSMITH_NPM_PASSWORD }}
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: npm
|
|
9
|
+
directories:
|
|
10
|
+
- .
|
|
11
|
+
schedule:
|
|
12
|
+
interval: weekly
|
|
13
|
+
registries: '*'
|
package/.husky/commit-msg
CHANGED
package/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
nodejs
|
|
1
|
+
nodejs 24.0.0
|
package/README.dev.md
CHANGED
|
@@ -32,42 +32,6 @@ Install dependencies
|
|
|
32
32
|
$ npm install
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
### Generate an access token
|
|
36
|
-
Mechant developers would follow the [JS SDK setup guide](https://docs.fatzebra.com/docs/obtain-oauth-token) to create an OAuth Client first in order to generate temporary access tokens. To simplify the local development workflow, we can simply generate an access token using the script below.
|
|
37
|
-
|
|
38
|
-
Please note that the access token created will have a lifespan of 1 year!
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
|
|
42
|
-
# The secret used for encoding JWT. Please make sure it is the same as the one used for decoding in PayNow and/or Gateway. Otherwise requests will get rejected.
|
|
43
|
-
$ export JWT_HMAC_SECRET=fatzebra
|
|
44
|
-
|
|
45
|
-
# Specify who the access token is created for. A JWT token can only have one subject.
|
|
46
|
-
$ export MERCHANT_USERNAME=<USERNAME>
|
|
47
|
-
|
|
48
|
-
# Access token will be outputted to stdout.
|
|
49
|
-
$ npm run generate:jwt
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Start mock merchant website using HPP mode
|
|
53
|
-
```bash
|
|
54
|
-
# HPP integration mode: Geared for merchants that use FZ HPP to collect customers' credit card details.
|
|
55
|
-
$ npm run start:<local|staging>:hpp
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Start mock merchant website using API mode
|
|
59
|
-
You rarely need to work with this as most FZ features revolve around HPP.
|
|
60
|
-
```bash
|
|
61
|
-
# API integration mode: Geared for merchants that own their own payments form to collect credit card details.
|
|
62
|
-
$ npm run start:<local|staging>:api
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
The commands above do the following.
|
|
66
|
-
* Build javascript files specified in _src_ directory. The js bundle is outputted to _dist_ directory as fz.js.
|
|
67
|
-
* The bundle is inserted into merchant website templates (at /examples/{mode}/merchant.ejs).
|
|
68
|
-
* Start up webpack-dev-server. Open index.html in Safari.
|
|
69
|
-
* The app will be hosted at http://localhost:8080
|
|
70
|
-
|
|
71
35
|
### Start PayNow
|
|
72
36
|
|
|
73
37
|
```bash
|
|
@@ -130,38 +94,6 @@ The deployed SDKs are available from the following URLs.
|
|
|
130
94
|
* Sandbox: https://cdn.pmnts-sandbox.io/sdk/v1/fatzebra.js
|
|
131
95
|
* Production: https://cdn.pmnts.io/sdk/v1/fatzebra.js
|
|
132
96
|
|
|
133
|
-
## Release react npm package
|
|
134
|
-
|
|
135
|
-
Prerequisite: it is essential that you have been added to the https://www.npmjs.com/ group account.
|
|
136
|
-
|
|
137
|
-
To release the react npm package
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
git checkout master
|
|
141
|
-
git pull
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
then run
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
npm run npm:publish
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
You will be prompted with:
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
enter (y) for minor release or (n) for patch release
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
if it is a major release i.e. a breaking change please update the script/consult with management as major release would indicate a breaking change.
|
|
157
|
-
|
|
158
|
-
You will then see the project build and finally be prompted to:
|
|
159
|
-
```
|
|
160
|
-
Press ENTER to open in the browser...
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
from here enter your 2FA code and voila! You have published a new version of the SDK. Go tell some merchants.
|
|
164
|
-
|
|
165
97
|
|
|
166
98
|
## Release Management
|
|
167
99
|
|
package/package.json
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fat-zebra/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.12-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest --clearCache && jest --passWithNoTests --verbose",
|
|
8
|
-
"build
|
|
9
|
-
"build:
|
|
10
|
-
"build:
|
|
11
|
-
"build:
|
|
12
|
-
"build:
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"start:staging:api": "export MERCHANT_MODE=api && npm run build:staging --watch && webpack serve --config webpack.config.dev.js --open 'Google Chrome'",
|
|
16
|
-
"start:staging:hpp": "export MERCHANT_MODE=hpp && npm run build:staging --watch && webpack serve --config webpack.config.dev.js --open 'Google Chrome'",
|
|
17
|
-
"start:staging:es5": "export MERCHANT_MODE=es5 && npm run build:staging --watch && webpack serve --config webpack.config.dev.js --open 'Google Chrome'",
|
|
18
|
-
"start:docker": "npm run build:dev --watch && webpack serve --config webpack.config.dev.js --host 0.0.0.0",
|
|
19
|
-
"generate:jwt": "node scripts/generate-access-token.js",
|
|
20
|
-
"npm:publish": "ts-node scripts/release-package.ts",
|
|
8
|
+
"build": "ts-node ./build.ts && npm run build:styles",
|
|
9
|
+
"build:local": "cp .env.local .env && export ENVIRONMENT=local && npm run build",
|
|
10
|
+
"build:staging": "cp .env.staging .env && export ENVIRONMENT=staging && npm run build",
|
|
11
|
+
"build:sandbox": "cp .env.sandbox .env && export ENVIRONMENT=sandbox && npm run build",
|
|
12
|
+
"build:production": "cp .env.production .env && export ENVIRONMENT=production && npm run build",
|
|
13
|
+
"build:package": "tsc -p tsconfig.package.json && REACT=true ENVIRONMENT=production",
|
|
14
|
+
"build:styles": "node build-styles.js",
|
|
21
15
|
"prepare": "husky install"
|
|
22
16
|
},
|
|
23
17
|
"keywords": [],
|
|
@@ -26,45 +20,34 @@
|
|
|
26
20
|
"devDependencies": {
|
|
27
21
|
"@commitlint/cli": "^19.8.1",
|
|
28
22
|
"@commitlint/config-conventional": "^19.8.1",
|
|
29
|
-
"@inquirer/prompts": "^5.3.8",
|
|
30
23
|
"@testing-library/dom": "^10.4.0",
|
|
31
24
|
"@testing-library/react": "^16.0.0",
|
|
32
|
-
"@testing-library/react-hooks": "^8.0.1",
|
|
33
25
|
"@testing-library/user-event": "^14.5.2",
|
|
34
26
|
"@types/ajv": "^1.0.0",
|
|
35
27
|
"@types/axios": "^0.14.0",
|
|
36
28
|
"@types/dotenv": "^8.2.0",
|
|
37
|
-
"@types/inquirer": "^9.0.7",
|
|
38
29
|
"@types/jest": "^24.0.23",
|
|
39
30
|
"@types/jsdom": "^21.1.1",
|
|
40
|
-
"@types/
|
|
41
|
-
"@types/react": "^
|
|
42
|
-
"@types/react-dom": "^18.2.7",
|
|
31
|
+
"@types/react": "^19.1.16",
|
|
32
|
+
"@types/react-dom": "^19.1.9",
|
|
43
33
|
"audit-ci": "^6.6.1",
|
|
44
34
|
"commitizen": "^4.3.1",
|
|
45
35
|
"cz-conventional-changelog": "^3.3.0",
|
|
46
36
|
"dotenv": "^16.0.1",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"jest": "^29.6.1",
|
|
52
|
-
"jest-environment-jsdom": "^29.6.1",
|
|
37
|
+
"esbuild": "^0.25.10",
|
|
38
|
+
"husky": "^9.1.7",
|
|
39
|
+
"jest": "^30.2.0",
|
|
40
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
53
41
|
"jest-localstorage-mock": "^2.4.22",
|
|
54
42
|
"jsdom": "^26.1.0",
|
|
55
43
|
"jsonwebtoken": "^9.0.0",
|
|
56
|
-
"nock": "^
|
|
57
|
-
"react": "^
|
|
58
|
-
"react-dom": "^
|
|
59
|
-
"simple-git": "^3.25.0",
|
|
60
|
-
"source-map-loader": "^0.2.4",
|
|
44
|
+
"nock": "^13.0.1",
|
|
45
|
+
"react": "^19.1.1",
|
|
46
|
+
"react-dom": "^19.1.1",
|
|
61
47
|
"ts-jest": "^29.1.1",
|
|
62
48
|
"ts-loader": "^9.4.4",
|
|
63
49
|
"ts-node": "^10.9.2",
|
|
64
|
-
"typescript": "^5.1.6"
|
|
65
|
-
"webpack": "^5.76.0",
|
|
66
|
-
"webpack-cli": "^4.10.0",
|
|
67
|
-
"webpack-dev-server": "^4.7.4"
|
|
50
|
+
"typescript": "^5.1.6"
|
|
68
51
|
},
|
|
69
52
|
"dependencies": {
|
|
70
53
|
"ajv": "^8.17.1",
|
package/.husky/pre-commit
DELETED
package/dist/fatzebra.css
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
.checkout-button-wrapper {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: center;
|
|
4
|
-
align-items: center;
|
|
5
|
-
height: 200px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.iframe-checkout {
|
|
9
|
-
flex: 1;
|
|
10
|
-
border: none;
|
|
11
|
-
width: 100%;
|
|
12
|
-
height: 100%;
|
|
13
|
-
min-height: 0;
|
|
14
|
-
overflow: auto;
|
|
15
|
-
-webkit-overflow-scrolling: touch;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.iframe-foreground,
|
|
19
|
-
.iframe-background {
|
|
20
|
-
top: 0;
|
|
21
|
-
left: 0;
|
|
22
|
-
right: 0;
|
|
23
|
-
bottom: 0;
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.iframe-foreground,
|
|
28
|
-
.iframe-background {
|
|
29
|
-
position: fixed;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.iframe-foreground {
|
|
33
|
-
z-index: -1;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.iframe-background {
|
|
37
|
-
background: rgba(0, 0, 0, 0.5);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.iframe-foreground {
|
|
41
|
-
flex-grow: 1;
|
|
42
|
-
top: auto;
|
|
43
|
-
width: 100%;
|
|
44
|
-
max-width: 480px;
|
|
45
|
-
height: 80vh;
|
|
46
|
-
background-color: #ffffff;
|
|
47
|
-
border-radius: 25px 25px 0 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.slide-in .iframe-foreground {
|
|
51
|
-
transform: translateY(100vh);
|
|
52
|
-
transition: transform 0.4s ease, z-index 0.3s ease 0.4s;
|
|
53
|
-
z-index: -1;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.slide-in .iframe-background {
|
|
57
|
-
opacity: 0;
|
|
58
|
-
z-index: -1;
|
|
59
|
-
transition: opacity 0.3s ease, z-index 0.3s ease 0.3s;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.slide-in.show .iframe-foreground {
|
|
63
|
-
transform: none;
|
|
64
|
-
transition: transform 0.4s ease;
|
|
65
|
-
z-index: 100;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.slide-in.show .iframe-background {
|
|
69
|
-
opacity: 1;
|
|
70
|
-
z-index: 0;
|
|
71
|
-
transition: opacity 0.3s ease;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@media only screen and (min-width: 480px) {
|
|
75
|
-
.iframe-foreground {
|
|
76
|
-
margin: 0 auto;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@media only screen and (min-width: 768px) {
|
|
81
|
-
.iframe-foreground {
|
|
82
|
-
margin: 0;
|
|
83
|
-
width: 400px;
|
|
84
|
-
height: 100vh;
|
|
85
|
-
left: 0;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.slide-in .iframe-foreground {
|
|
89
|
-
transform: translateX(-400px);
|
|
90
|
-
}
|
|
91
|
-
}
|