@fat-zebra/sdk 1.5.8 → 1.5.10-beta.0
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/workflows/ci.yml +226 -0
- package/CHANGELOG.md +9 -0
- package/dist/react/VerifyExistingCard.js +4 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/.idea/fatzebra-js.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/dist/applepay/applepaymanager.d.ts +0 -28
- package/dist/applepay/applepaymanager.js +0 -115
- package/dist/local/fatzebra.css +0 -91
- package/dist/local/fatzebra.js +0 -20147
- package/dist/local/fatzebra.js.map +0 -1
- package/dist/local/index.html +0 -247
- package/dist/production/fatzebra.css +0 -91
- package/dist/production/fatzebra.js +0 -8
- package/dist/production/fatzebra.js.LICENSE.txt +0 -1
- package/dist/react/ApplePay.d.ts +0 -9
- package/dist/react/ApplePay.js +0 -11
- package/dist/react/applePayUrl.d.ts +0 -12
- package/dist/react/applePayUrl.js +0 -19
- package/dist/react/useNotification.d.ts +0 -11
- package/dist/react/useNotification.js +0 -26
- package/dist/sandbox/fatzebra.css +0 -91
- package/dist/sandbox/fatzebra.js +0 -8
- package/dist/sandbox/fatzebra.js.LICENSE.txt +0 -1
- package/dist/scripts/release-package.js +0 -324
- package/dist/scripts/release-package.js.map +0 -1
- package/dist/src/applepay/applepay.js +0 -198
- package/dist/src/applepay/applepay.js.map +0 -1
- package/dist/src/applepay/applepaymanager.js +0 -279
- package/dist/src/applepay/applepaymanager.js.map +0 -1
- package/dist/src/applepay/clients/apple-pay-client.js +0 -66
- package/dist/src/applepay/clients/apple-pay-client.js.map +0 -1
- package/dist/src/applepay/clients/paynow-client.js +0 -96
- package/dist/src/applepay/clients/paynow-client.js.map +0 -1
- package/dist/src/applepay/index.js +0 -6
- package/dist/src/applepay/index.js.map +0 -1
- package/dist/src/click_to_pay/clicktopay.test.js +0 -131
- package/dist/src/click_to_pay/clicktopay.test.js.map +0 -1
- package/dist/src/click_to_pay/index.js +0 -135
- package/dist/src/click_to_pay/index.js.map +0 -1
- package/dist/src/click_to_pay/types.js +0 -3
- package/dist/src/click_to_pay/types.js.map +0 -1
- package/dist/src/hpp/hpp.js +0 -230
- package/dist/src/hpp/hpp.js.map +0 -1
- package/dist/src/hpp/hpp.test.js +0 -137
- package/dist/src/hpp/hpp.test.js.map +0 -1
- package/dist/src/hpp/index.js +0 -6
- package/dist/src/hpp/index.js.map +0 -1
- package/dist/src/index.js +0 -15
- package/dist/src/index.js.map +0 -1
- package/dist/src/main.js +0 -229
- package/dist/src/main.js.map +0 -1
- package/dist/src/main.test.js +0 -236
- package/dist/src/main.test.js.map +0 -1
- package/dist/src/react/ApplePayButton.js +0 -56
- package/dist/src/react/ApplePayButton.js.map +0 -1
- package/dist/src/react/VerifyCard.js +0 -29
- package/dist/src/react/VerifyCard.js.map +0 -1
- package/dist/src/react/VerifyExistingCard.js +0 -30
- package/dist/src/react/VerifyExistingCard.js.map +0 -1
- package/dist/src/react/applePayUrl.js +0 -46
- package/dist/src/react/applePayUrl.js.map +0 -1
- package/dist/src/react/applePayUrl.test.js +0 -57
- package/dist/src/react/applePayUrl.test.js.map +0 -1
- package/dist/src/react/index.js +0 -13
- package/dist/src/react/index.js.map +0 -1
- package/dist/src/react/paymentUrl.js +0 -60
- package/dist/src/react/paymentUrl.js.map +0 -1
- package/dist/src/react/paymentUrl.test.js +0 -88
- package/dist/src/react/paymentUrl.test.js.map +0 -1
- package/dist/src/react/submitForm.js +0 -13
- package/dist/src/react/submitForm.js.map +0 -1
- package/dist/src/react/useFatZebra.js +0 -70
- package/dist/src/react/useFatZebra.js.map +0 -1
- package/dist/src/react/useMessage.js +0 -140
- package/dist/src/react/useMessage.js.map +0 -1
- package/dist/src/react/useMessage.test.js +0 -222
- package/dist/src/react/useMessage.test.js.map +0 -1
- package/dist/src/react/verifyUrl.js +0 -49
- package/dist/src/react/verifyUrl.js.map +0 -1
- package/dist/src/sca/cardinal.js +0 -145
- package/dist/src/sca/cardinal.js.map +0 -1
- package/dist/src/sca/cardinal.test.js +0 -77
- package/dist/src/sca/cardinal.test.js.map +0 -1
- package/dist/src/sca/eci-mappings.js +0 -63
- package/dist/src/sca/eci-mappings.js.map +0 -1
- package/dist/src/sca/eci-mappings.test.js +0 -31
- package/dist/src/sca/eci-mappings.test.js.map +0 -1
- package/dist/src/sca/index.js +0 -382
- package/dist/src/sca/index.js.map +0 -1
- package/dist/src/sca/index.test.js +0 -624
- package/dist/src/sca/index.test.js.map +0 -1
- package/dist/src/sca/scenarios/enrollment.js +0 -161
- package/dist/src/sca/scenarios/enrollment.js.map +0 -1
- package/dist/src/sca/scenarios/index.js +0 -8
- package/dist/src/sca/scenarios/index.js.map +0 -1
- package/dist/src/sca/scenarios/validation.js +0 -139
- package/dist/src/sca/scenarios/validation.js.map +0 -1
- package/dist/src/sca/types.js +0 -57
- package/dist/src/sca/types.js.map +0 -1
- package/dist/src/shared/api-gateway-client.js +0 -148
- package/dist/src/shared/api-gateway-client.js.map +0 -1
- package/dist/src/shared/bridge-client.js +0 -24
- package/dist/src/shared/bridge-client.js.map +0 -1
- package/dist/src/shared/constants.js +0 -19
- package/dist/src/shared/constants.js.map +0 -1
- package/dist/src/shared/env.development.js +0 -12
- package/dist/src/shared/env.development.js.map +0 -1
- package/dist/src/shared/env.js +0 -50
- package/dist/src/shared/env.js.map +0 -1
- package/dist/src/shared/envs/local.js +0 -12
- package/dist/src/shared/envs/local.js.map +0 -1
- package/dist/src/shared/envs/production.js +0 -12
- package/dist/src/shared/envs/production.js.map +0 -1
- package/dist/src/shared/envs/sandbox.js +0 -12
- package/dist/src/shared/envs/sandbox.js.map +0 -1
- package/dist/src/shared/envs/staging.js +0 -12
- package/dist/src/shared/envs/staging.js.map +0 -1
- package/dist/src/shared/event-manager.js +0 -24
- package/dist/src/shared/event-manager.js.map +0 -1
- package/dist/src/shared/post-message-client.js +0 -127
- package/dist/src/shared/post-message-client.js.map +0 -1
- package/dist/src/shared/post-message-client.test.js +0 -58
- package/dist/src/shared/post-message-client.test.js.map +0 -1
- package/dist/src/shared/types.js +0 -36
- package/dist/src/shared/types.js.map +0 -1
- package/dist/src/shared/types.test.js +0 -55
- package/dist/src/shared/types.test.js.map +0 -1
- package/dist/src/shared/util.js +0 -96
- package/dist/src/shared/util.js.map +0 -1
- package/dist/src/shared/util.test.js +0 -148
- package/dist/src/shared/util.test.js.map +0 -1
- package/dist/src/validation/index.js +0 -12
- package/dist/src/validation/index.js.map +0 -1
- package/dist/src/validation/schemas/click-to-pay/load-params.json +0 -34
- package/dist/src/validation/schemas/click-to-pay/options.json +0 -23
- package/dist/src/validation/schemas/click-to-pay/payment-intent.json +0 -42
- package/dist/src/validation/schemas/customer.json +0 -38
- package/dist/src/validation/schemas/hpp-load-params.json +0 -40
- package/dist/src/validation/schemas/hpp-options.json +0 -48
- package/dist/src/validation/schemas/payment-intent.json +0 -48
- package/dist/src/validation/schemas/payment-method.json +0 -83
- package/dist/src/validation/schemas/verify-card-options.json +0 -15
- package/dist/src/validation/schemas/verify-card-params.json +0 -24
- package/dist/src/validation/validation-helper.js +0 -10
- package/dist/src/validation/validation-helper.js.map +0 -1
- package/dist/src/validation/validation-helper.test.js +0 -34
- package/dist/src/validation/validation-helper.test.js.map +0 -1
- package/dist/src/validation/validators/apple-pay-load-params-button-validator.js +0 -19
- package/dist/src/validation/validators/apple-pay-load-params-button-validator.js.map +0 -1
- package/dist/src/validation/validators/click-to-pay-load-params-validator.js +0 -19
- package/dist/src/validation/validators/click-to-pay-load-params-validator.js.map +0 -1
- package/dist/src/validation/validators/hpp-load-params-validator.js +0 -21
- package/dist/src/validation/validators/hpp-load-params-validator.js.map +0 -1
- package/dist/src/validation/validators/hpp-load-params-validator.test.js +0 -56
- package/dist/src/validation/validators/hpp-load-params-validator.test.js.map +0 -1
- package/dist/src/validation/validators/verify-card-params-validator.js +0 -23
- package/dist/src/validation/validators/verify-card-params-validator.js.map +0 -1
- package/dist/src/version.js +0 -5
- package/dist/src/version.js.map +0 -1
- package/dist/staging/fatzebra.css +0 -91
- package/dist/staging/fatzebra.js +0 -20423
- package/dist/staging/fatzebra.js.map +0 -1
- package/dist/staging/index.html +0 -247
- package/dist/tests/helpers/api-gateway-mock.js +0 -37
- package/dist/tests/helpers/api-gateway-mock.js.map +0 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
env:
|
|
4
|
+
AWS_REGION: ap-southeast-2
|
|
5
|
+
TEST_UPLOAD_PATH: s3://test-cdn-pmnts-origin/sdk/v1/
|
|
6
|
+
SBOX_UPLOAD_PATH: s3://sandbox-pmnts-resources/sdk/v1/
|
|
7
|
+
PROD_UPLOAD_PATH: s3://pmnts-resources/sdk/v1/
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches: ['**'] # all branches
|
|
11
|
+
tags:
|
|
12
|
+
- 'v*.*.*' # prod tags e.g. v1.5.8
|
|
13
|
+
- 'v*.*.*-beta.*' # beta tags e.g. v1.5.8-beta.0
|
|
14
|
+
pull_request:
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
checks:
|
|
18
|
+
name: Security & Type checks
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
env:
|
|
21
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
- uses: actions/setup-node@v4
|
|
25
|
+
with: { node-version: '20.x', cache: 'npm' }
|
|
26
|
+
- run: npm ci
|
|
27
|
+
- run: npx --yes audit-ci --high
|
|
28
|
+
- run: npx tsc --noEmit
|
|
29
|
+
- run: npx tsc -p tsconfig.package.json --noEmit
|
|
30
|
+
- run: yarn test
|
|
31
|
+
|
|
32
|
+
# --- BUILD JOBS ----------------------------------------------------
|
|
33
|
+
|
|
34
|
+
build-staging:
|
|
35
|
+
needs: checks
|
|
36
|
+
if: github.ref_type == 'branch' && github.ref_name != 'main'
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
env:
|
|
39
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
- uses: fatzebra/gh-workflows/build_npm@main
|
|
43
|
+
with:
|
|
44
|
+
credentials_json: |
|
|
45
|
+
{
|
|
46
|
+
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
|
|
47
|
+
"NPM_CLOUDSMITH_REPO_PWD": "${{ secrets.CLOUDSMITH_API_KEY }}"
|
|
48
|
+
}
|
|
49
|
+
- name: Build (staging)
|
|
50
|
+
run: npm run build:staging
|
|
51
|
+
- uses: actions/upload-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
name: sdk-dist-staging
|
|
54
|
+
path: |
|
|
55
|
+
dist/staging/*.js
|
|
56
|
+
dist/staging/*.css
|
|
57
|
+
if-no-files-found: error
|
|
58
|
+
|
|
59
|
+
build-sandbox:
|
|
60
|
+
needs: checks
|
|
61
|
+
if: github.ref_type == 'tag' && contains(github.ref_name, '-beta.') && github.base_ref == 'main'
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
env:
|
|
64
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v4
|
|
67
|
+
- uses: fatzebra/gh-workflows/build_npm@main
|
|
68
|
+
with:
|
|
69
|
+
credentials_json: |
|
|
70
|
+
{
|
|
71
|
+
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
|
|
72
|
+
"NPM_CLOUDSMITH_REPO_PWD": "${{ secrets.CLOUDSMITH_API_KEY }}"
|
|
73
|
+
}
|
|
74
|
+
- name: Build (sandbox)
|
|
75
|
+
run: npm run build:sandbox
|
|
76
|
+
- uses: actions/upload-artifact@v4
|
|
77
|
+
with:
|
|
78
|
+
name: sdk-dist-sandbox
|
|
79
|
+
path: |
|
|
80
|
+
dist/sandbox/*.js
|
|
81
|
+
dist/sandbox/*.css
|
|
82
|
+
if-no-files-found: error
|
|
83
|
+
|
|
84
|
+
build-production:
|
|
85
|
+
needs: checks
|
|
86
|
+
if: github.ref_type == 'tag' && !contains(github.ref_name, '-beta.') && github.base_ref == 'main'
|
|
87
|
+
runs-on: ubuntu-latest
|
|
88
|
+
env:
|
|
89
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
90
|
+
steps:
|
|
91
|
+
- uses: actions/checkout@v4
|
|
92
|
+
- uses: fatzebra/gh-workflows/build_npm@main
|
|
93
|
+
with:
|
|
94
|
+
credentials_json: |
|
|
95
|
+
{
|
|
96
|
+
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
|
|
97
|
+
"NPM_CLOUDSMITH_REPO_PWD": "${{ secrets.CLOUDSMITH_API_KEY }}"
|
|
98
|
+
}
|
|
99
|
+
- name: Build (production)
|
|
100
|
+
run: npm run build:production
|
|
101
|
+
- uses: actions/upload-artifact@v4
|
|
102
|
+
with:
|
|
103
|
+
name: sdk-dist-production
|
|
104
|
+
path: |
|
|
105
|
+
dist/production/*.js
|
|
106
|
+
dist/production/*.css
|
|
107
|
+
if-no-files-found: error
|
|
108
|
+
|
|
109
|
+
# --- DEPLOY JOBS ----------------------------------------------------
|
|
110
|
+
|
|
111
|
+
deploy-staging:
|
|
112
|
+
needs: build-staging
|
|
113
|
+
if: github.ref_type == 'branch' && github.ref_name != 'main'
|
|
114
|
+
runs-on: ubuntu-latest
|
|
115
|
+
permissions: { id-token: write, contents: read }
|
|
116
|
+
steps:
|
|
117
|
+
- uses: fatzebra/gh-workflows/aws_login@main
|
|
118
|
+
with:
|
|
119
|
+
platform: fz
|
|
120
|
+
environment: test
|
|
121
|
+
role_name: AppDeploy
|
|
122
|
+
- run: aws s3 sync --delete --content-type 'application/javascript' --exclude '*' --include '*.js' dist/staging/ "${TEST_UPLOAD_PATH}"
|
|
123
|
+
- run: aws s3 sync --delete --content-type 'text/css' --exclude '*' --include '*.css' dist/staging/ "${TEST_UPLOAD_PATH}"
|
|
124
|
+
|
|
125
|
+
deploy-sandbox:
|
|
126
|
+
needs: build-sandbox
|
|
127
|
+
if: github.ref_type == 'tag' && contains(github.ref_name, '-beta.') && github.base_ref == 'main'
|
|
128
|
+
runs-on: ubuntu-latest
|
|
129
|
+
permissions: { id-token: write, contents: read }
|
|
130
|
+
steps:
|
|
131
|
+
- uses: fatzebra/gh-workflows/aws_login@main
|
|
132
|
+
with:
|
|
133
|
+
platform: fz
|
|
134
|
+
environment: sbox
|
|
135
|
+
role_name: AppDeploy
|
|
136
|
+
- run: aws s3 sync --delete --content-type 'application/javascript' --exclude '*' --include '*.js' dist/sandbox/ "${SBOX_UPLOAD_PATH}"
|
|
137
|
+
- run: aws s3 sync --delete --content-type 'text/css' --exclude '*' --include '*.css' dist/sandbox/ "${SBOX_UPLOAD_PATH}"
|
|
138
|
+
|
|
139
|
+
deploy-production:
|
|
140
|
+
needs: build-production
|
|
141
|
+
if: github.ref_type == 'tag' && !contains(github.ref_name, '-beta.') && github.base_ref == 'main'
|
|
142
|
+
runs-on: ubuntu-latest
|
|
143
|
+
permissions: { id-token: write, contents: read }
|
|
144
|
+
steps:
|
|
145
|
+
- uses: actions/download-artifact@v4
|
|
146
|
+
with: { name: sdk-dist-production, path: dist/production }
|
|
147
|
+
- uses: fatzebra/gh-workflows/aws_login@main
|
|
148
|
+
with:
|
|
149
|
+
platform: fz
|
|
150
|
+
environment: prod
|
|
151
|
+
role_name: AppDeploy
|
|
152
|
+
- run: aws s3 sync --delete --content-type 'application/javascript' --exclude '*' --include '*.js' dist/production/ "${PROD_UPLOAD_PATH}"
|
|
153
|
+
- run: aws s3 sync --delete --content-type 'text/css' --exclude '*' --include '*.css' dist/production/ "${PROD_UPLOAD_PATH}"
|
|
154
|
+
|
|
155
|
+
# Publish to npm for beta tags and production tags
|
|
156
|
+
publish-npm-beta:
|
|
157
|
+
runs-on: ubuntu-latest
|
|
158
|
+
if: startsWith(github.ref, 'refs/tags/') && contains(github.ref_name, '-beta.')
|
|
159
|
+
env:
|
|
160
|
+
TAG_NAME: ${{ github.ref_name }} # e.g. v1.5.10-beta.0
|
|
161
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
162
|
+
steps:
|
|
163
|
+
- uses: actions/checkout@v4
|
|
164
|
+
with:
|
|
165
|
+
fetch-depth: 0
|
|
166
|
+
|
|
167
|
+
- uses: actions/setup-node@v4
|
|
168
|
+
with:
|
|
169
|
+
node-version: 20
|
|
170
|
+
registry-url: 'https://registry.npmjs.org' # writes .npmrc using NPM_TOKEN
|
|
171
|
+
|
|
172
|
+
- name: Show tag name
|
|
173
|
+
run: echo "Publishing for tag $TAG_NAME"
|
|
174
|
+
|
|
175
|
+
# make package.json version match the git tag (strip leading "v" if present)
|
|
176
|
+
- name: Sync package.json version to git tag
|
|
177
|
+
run: |
|
|
178
|
+
VERSION="${TAG_NAME#v}" # v1.5.10-beta.0 -> 1.5.10-beta.0
|
|
179
|
+
npm version --no-git-tag-version "$VERSION"
|
|
180
|
+
echo "package.json version: $(node -p "require('./package.json').version")"
|
|
181
|
+
|
|
182
|
+
- name: Install deps
|
|
183
|
+
run: npm ci
|
|
184
|
+
|
|
185
|
+
- name: Run package build
|
|
186
|
+
run: npm run build:package
|
|
187
|
+
|
|
188
|
+
- name: Publish (beta dist-tag)
|
|
189
|
+
run: npm publish --access public --tag beta
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# --- NPM publish for production tags (vX.Y.Z) ---
|
|
193
|
+
publish-npm-latest:
|
|
194
|
+
runs-on: ubuntu-latest
|
|
195
|
+
env:
|
|
196
|
+
TAG_NAME: ${{ github.ref_name }}
|
|
197
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
198
|
+
if: startsWith(github.ref, 'refs/tags/') &&
|
|
199
|
+
!contains(github.ref_name, '-beta.')
|
|
200
|
+
steps:
|
|
201
|
+
- uses: actions/checkout@v4
|
|
202
|
+
with:
|
|
203
|
+
fetch-depth: 0
|
|
204
|
+
|
|
205
|
+
- uses: actions/setup-node@v4
|
|
206
|
+
with:
|
|
207
|
+
node-version: 20
|
|
208
|
+
registry-url: 'https://registry.npmjs.org'
|
|
209
|
+
|
|
210
|
+
- name: Tag Name
|
|
211
|
+
run: echo "Publishing for tag $TAG_NAME"
|
|
212
|
+
|
|
213
|
+
- name: Sync package.json version to git tag
|
|
214
|
+
run: |
|
|
215
|
+
VERSION="${TAG_NAME#v}" # v1.5.10 -> 1.5.10
|
|
216
|
+
npm version --no-git-tag-version "$VERSION"
|
|
217
|
+
echo "package.json version: $(node -p "require('./package.json').version")"
|
|
218
|
+
|
|
219
|
+
- name: Install deps
|
|
220
|
+
run: npm ci
|
|
221
|
+
|
|
222
|
+
- name: Run package build
|
|
223
|
+
run: npm run build:package
|
|
224
|
+
|
|
225
|
+
- name: Publish (latest dist-tag)
|
|
226
|
+
run: npm publish --access public --tag latest
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Change log
|
|
4
4
|
|
|
5
|
+
## [1.5.10] - 2025-08-11
|
|
6
|
+
## Updated
|
|
7
|
+
- bumped jsdom from ^16.2.1 to jsdom 26.1.0
|
|
8
|
+
- bumped axios from ^1.6.4 to 1.11.0
|
|
9
|
+
|
|
10
|
+
## [1.5.9] - 2025-07-09
|
|
11
|
+
## Changed
|
|
12
|
+
- VerifyExistingCard component will now always perform 3DS action. Previously, the VerifyExistingCard would only check if the card had been previously tokenized, unless sca_enabled: true was passed as an option. This update will run SCA regardless.
|
|
13
|
+
|
|
5
14
|
## [1.5.8] – 2025-05-27
|
|
6
15
|
### Changed
|
|
7
16
|
- removed yarn.lock in favour of package-lock.json
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import useFatZebra from "./useFatZebra";
|
|
3
3
|
const VerifyExistingCard = ({ handlers, cardToken, config, iframeProps }) => {
|
|
4
|
+
let options = {
|
|
5
|
+
sca_enabled: true
|
|
6
|
+
};
|
|
7
|
+
config.options = Object.assign(Object.assign({}, (config.options || {})), options);
|
|
4
8
|
const { verifyUrl } = useFatZebra({
|
|
5
9
|
config,
|
|
6
10
|
cardToken,
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.5.
|
|
1
|
+
export declare const version = "1.5.9";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.5.
|
|
1
|
+
export const version = '1.5.9';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fat-zebra/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.10-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"jest": "^29.6.1",
|
|
46
46
|
"jest-environment-jsdom": "^29.6.1",
|
|
47
47
|
"jest-localstorage-mock": "^2.4.22",
|
|
48
|
-
"jsdom": "^
|
|
48
|
+
"jsdom": "^26.1.0",
|
|
49
49
|
"jsonwebtoken": "^9.0.0",
|
|
50
50
|
"nock": "^12.0.1",
|
|
51
51
|
"react": "^18.3.1",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"ajv": "^8.17.1",
|
|
65
65
|
"ajv-formats": "^3.0.1",
|
|
66
66
|
"ajv-keywords": "^5.1.0",
|
|
67
|
-
"axios": "^1.
|
|
67
|
+
"axios": "^1.11.0",
|
|
68
68
|
"custom-event-polyfill": "^1.0.7",
|
|
69
69
|
"ts-polyfill": "^3.8.2",
|
|
70
70
|
"url-template": "^3.1.0"
|
|
@@ -73,4 +73,4 @@
|
|
|
73
73
|
"react": ">= 16",
|
|
74
74
|
"react-dom": ">= 16"
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|
package/.idea/fatzebra-js.iml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/fatzebra-js.iml" filepath="$PROJECT_DIR$/.idea/fatzebra-js.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/prettier.xml
DELETED
package/.idea/vcs.xml
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { PaymentRequest } from './clients/apple-pay-client';
|
|
2
|
-
import * as payNow from './clients/paynow-client';
|
|
3
|
-
import { PostMessage } from '../shared/post-message-client';
|
|
4
|
-
declare class ApplePayManager {
|
|
5
|
-
private merchantId;
|
|
6
|
-
private canMakePayments;
|
|
7
|
-
private iframe;
|
|
8
|
-
private applePaySession;
|
|
9
|
-
private postMessageClient;
|
|
10
|
-
private fzPayNowDomain;
|
|
11
|
-
private username?;
|
|
12
|
-
private token?;
|
|
13
|
-
constructor(config: {
|
|
14
|
-
iframe: HTMLIFrameElement;
|
|
15
|
-
fzPayNowDomain: string;
|
|
16
|
-
username?: string;
|
|
17
|
-
token?: string;
|
|
18
|
-
});
|
|
19
|
-
initialize(): Promise<void>;
|
|
20
|
-
checkApplePayEligibility(): void;
|
|
21
|
-
notifyApplePayEligibility(): void;
|
|
22
|
-
registerEventListener(): Promise<void>;
|
|
23
|
-
purchase(request: PaymentRequest): Promise<void>;
|
|
24
|
-
extractApplePaymentRequestParams(payload: any): PaymentRequest;
|
|
25
|
-
extractPayNowPaymentAttributes(payload: any): payNow.PaymentAttributes;
|
|
26
|
-
sendMessage(payload: PostMessage): void;
|
|
27
|
-
}
|
|
28
|
-
export default ApplePayManager;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { createSession, getEligibilty, } from './clients/apple-pay-client';
|
|
11
|
-
import * as payNow from './clients/paynow-client';
|
|
12
|
-
import { PostMessageClient } from '../shared/post-message-client';
|
|
13
|
-
// import * as process from "process";
|
|
14
|
-
const channel = 'applepay';
|
|
15
|
-
// const fzPayNowDomain = process.env.PAYNOW_BASE_URL
|
|
16
|
-
// do the domain handling stuff better
|
|
17
|
-
const paynowDomain = 'https://paynow.test';
|
|
18
|
-
const merchantSessionPath = '/v2/apple_pay/payment_session';
|
|
19
|
-
const purchaseTokenPath = '/v2/apple_pay/token';
|
|
20
|
-
class ApplePayManager {
|
|
21
|
-
constructor(config) {
|
|
22
|
-
// if (!config.fzPayNowDomain) {
|
|
23
|
-
// console.log('hitting i here')
|
|
24
|
-
// this.fzPayNowDomain = process?.env?.PAYNOW_BASE_URL;
|
|
25
|
-
// } else {
|
|
26
|
-
this.fzPayNowDomain = config.fzPayNowDomain;
|
|
27
|
-
this.username = config.username;
|
|
28
|
-
this.token = config.token;
|
|
29
|
-
// }
|
|
30
|
-
this.iframe = config.iframe;
|
|
31
|
-
this.postMessageClient = new PostMessageClient({
|
|
32
|
-
channel: 'applepay',
|
|
33
|
-
target: this.iframe
|
|
34
|
-
});
|
|
35
|
-
this.initialize();
|
|
36
|
-
}
|
|
37
|
-
initialize() {
|
|
38
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
yield this.registerEventListener();
|
|
40
|
-
this.checkApplePayEligibility();
|
|
41
|
-
this.notifyApplePayEligibility();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
checkApplePayEligibility() {
|
|
45
|
-
if (getEligibilty()) {
|
|
46
|
-
this.canMakePayments = true;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
notifyApplePayEligibility() {
|
|
50
|
-
const message = {
|
|
51
|
-
channel,
|
|
52
|
-
subject: 'eligibility',
|
|
53
|
-
data: {
|
|
54
|
-
canMakePayments: this.canMakePayments
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
this.postMessageClient.send(message);
|
|
58
|
-
}
|
|
59
|
-
registerEventListener() {
|
|
60
|
-
return new Promise((resolve, reject) => {
|
|
61
|
-
this.postMessageClient.setEventListeners({
|
|
62
|
-
'paymentrequest': (data) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
yield this.purchase(data);
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
resolve();
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
purchase(request) {
|
|
70
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const applePayPaymentRequest = this.extractApplePaymentRequestParams(request);
|
|
72
|
-
const payNowPaymentAttributes = this.extractPayNowPaymentAttributes(request);
|
|
73
|
-
this.applePaySession = yield createSession(applePayPaymentRequest);
|
|
74
|
-
this.applePaySession.onvalidatemerchant = (event) => __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
let merchantSession;
|
|
76
|
-
try {
|
|
77
|
-
merchantSession = yield payNow.getMerchantSession(event.validationURL, Object.assign(Object.assign({}, payNowPaymentAttributes), { merchant: this.username, domain_name: window.location.hostname, display_name: this.username }), `${paynowDomain}${merchantSessionPath}`, this.username, this.token);
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
console.log('Unable to establish new merchant session');
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
this.applePaySession.completeMerchantValidation(merchantSession);
|
|
84
|
-
});
|
|
85
|
-
this.applePaySession.onpaymentauthorized = (event) => __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
try {
|
|
87
|
-
yield payNow.authorizePayment(Object.assign(Object.assign({}, payNowPaymentAttributes), { merchant: this.username, token: event.payment.token }), `${paynowDomain}${purchaseTokenPath}`);
|
|
88
|
-
this.applePaySession.completePayment(window.ApplePaySession.STATUS_SUCCESS);
|
|
89
|
-
}
|
|
90
|
-
catch (e) {
|
|
91
|
-
this.applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
this.applePaySession.begin();
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
extractApplePaymentRequestParams(payload) {
|
|
98
|
-
const { countryCode, currencyCode, merchantCapabilities, supportedNetworks, total, } = payload;
|
|
99
|
-
return {
|
|
100
|
-
countryCode,
|
|
101
|
-
currencyCode,
|
|
102
|
-
merchantCapabilities,
|
|
103
|
-
supportedNetworks,
|
|
104
|
-
total,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
extractPayNowPaymentAttributes(payload) {
|
|
108
|
-
const { paymentAttributes } = payload;
|
|
109
|
-
return paymentAttributes;
|
|
110
|
-
}
|
|
111
|
-
sendMessage(payload) {
|
|
112
|
-
this.iframe.contentWindow.postMessage(payload, this.fzPayNowDomain);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
export default ApplePayManager;
|
package/dist/local/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
|
-
}
|