@fat-zebra/sdk 1.5.9 → 1.5.10-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.
Files changed (177) hide show
  1. package/.github/workflows/ci.yml +286 -0
  2. package/.husky/commit-msg +4 -0
  3. package/.husky/pre-commit +2 -0
  4. package/.husky/prepare-commit-msg +4 -0
  5. package/.tool-versions +1 -1
  6. package/CHANGELOG.md +5 -0
  7. package/README.dev.md +45 -27
  8. package/commitizen.png +0 -0
  9. package/commitlint.config.cjs +3 -0
  10. package/package.json +16 -5
  11. package/.idea/fatzebra-js.iml +0 -12
  12. package/.idea/modules.xml +0 -8
  13. package/.idea/prettier.xml +0 -6
  14. package/.idea/vcs.xml +0 -6
  15. package/deploy-menu.png +0 -0
  16. package/dist/applepay/applepaymanager.d.ts +0 -28
  17. package/dist/applepay/applepaymanager.js +0 -115
  18. package/dist/local/fatzebra.css +0 -91
  19. package/dist/local/fatzebra.js +0 -19935
  20. package/dist/local/fatzebra.js.map +0 -1
  21. package/dist/local/index.html +0 -247
  22. package/dist/production/fatzebra.css +0 -91
  23. package/dist/production/fatzebra.js +0 -8
  24. package/dist/production/fatzebra.js.LICENSE.txt +0 -1
  25. package/dist/react/ApplePay.d.ts +0 -9
  26. package/dist/react/ApplePay.js +0 -11
  27. package/dist/react/applePayUrl.d.ts +0 -12
  28. package/dist/react/applePayUrl.js +0 -19
  29. package/dist/react/useNotification.d.ts +0 -11
  30. package/dist/react/useNotification.js +0 -26
  31. package/dist/sandbox/cdn.pmnts-sandbox.io/sdk/v1/fatzebra.js +0 -8
  32. package/dist/sandbox/fatzebra.css +0 -91
  33. package/dist/sandbox/fatzebra.js +0 -8
  34. package/dist/sandbox/fatzebra.js.LICENSE.txt +0 -1
  35. package/dist/sandbox/orikan-workspace/qa-banyule-ssp-imaas.np.orikan.tech/main-es2015.a50b3edc3412ce44ee0d.js +0 -66771
  36. package/dist/scripts/release-package.js +0 -324
  37. package/dist/scripts/release-package.js.map +0 -1
  38. package/dist/src/applepay/applepay.js +0 -198
  39. package/dist/src/applepay/applepay.js.map +0 -1
  40. package/dist/src/applepay/applepaymanager.js +0 -279
  41. package/dist/src/applepay/applepaymanager.js.map +0 -1
  42. package/dist/src/applepay/clients/apple-pay-client.js +0 -66
  43. package/dist/src/applepay/clients/apple-pay-client.js.map +0 -1
  44. package/dist/src/applepay/clients/paynow-client.js +0 -96
  45. package/dist/src/applepay/clients/paynow-client.js.map +0 -1
  46. package/dist/src/applepay/index.js +0 -6
  47. package/dist/src/applepay/index.js.map +0 -1
  48. package/dist/src/click_to_pay/clicktopay.test.js +0 -131
  49. package/dist/src/click_to_pay/clicktopay.test.js.map +0 -1
  50. package/dist/src/click_to_pay/index.js +0 -135
  51. package/dist/src/click_to_pay/index.js.map +0 -1
  52. package/dist/src/click_to_pay/types.js +0 -3
  53. package/dist/src/click_to_pay/types.js.map +0 -1
  54. package/dist/src/hpp/hpp.js +0 -230
  55. package/dist/src/hpp/hpp.js.map +0 -1
  56. package/dist/src/hpp/hpp.test.js +0 -137
  57. package/dist/src/hpp/hpp.test.js.map +0 -1
  58. package/dist/src/hpp/index.js +0 -6
  59. package/dist/src/hpp/index.js.map +0 -1
  60. package/dist/src/index.js +0 -15
  61. package/dist/src/index.js.map +0 -1
  62. package/dist/src/main.js +0 -229
  63. package/dist/src/main.js.map +0 -1
  64. package/dist/src/main.test.js +0 -236
  65. package/dist/src/main.test.js.map +0 -1
  66. package/dist/src/react/ApplePayButton.js +0 -56
  67. package/dist/src/react/ApplePayButton.js.map +0 -1
  68. package/dist/src/react/VerifyCard.js +0 -29
  69. package/dist/src/react/VerifyCard.js.map +0 -1
  70. package/dist/src/react/VerifyExistingCard.js +0 -30
  71. package/dist/src/react/VerifyExistingCard.js.map +0 -1
  72. package/dist/src/react/applePayUrl.js +0 -46
  73. package/dist/src/react/applePayUrl.js.map +0 -1
  74. package/dist/src/react/applePayUrl.test.js +0 -57
  75. package/dist/src/react/applePayUrl.test.js.map +0 -1
  76. package/dist/src/react/index.js +0 -13
  77. package/dist/src/react/index.js.map +0 -1
  78. package/dist/src/react/paymentUrl.js +0 -60
  79. package/dist/src/react/paymentUrl.js.map +0 -1
  80. package/dist/src/react/paymentUrl.test.js +0 -88
  81. package/dist/src/react/paymentUrl.test.js.map +0 -1
  82. package/dist/src/react/submitForm.js +0 -13
  83. package/dist/src/react/submitForm.js.map +0 -1
  84. package/dist/src/react/useFatZebra.js +0 -70
  85. package/dist/src/react/useFatZebra.js.map +0 -1
  86. package/dist/src/react/useMessage.js +0 -140
  87. package/dist/src/react/useMessage.js.map +0 -1
  88. package/dist/src/react/useMessage.test.js +0 -222
  89. package/dist/src/react/useMessage.test.js.map +0 -1
  90. package/dist/src/react/verifyUrl.js +0 -49
  91. package/dist/src/react/verifyUrl.js.map +0 -1
  92. package/dist/src/sca/cardinal.js +0 -145
  93. package/dist/src/sca/cardinal.js.map +0 -1
  94. package/dist/src/sca/cardinal.test.js +0 -77
  95. package/dist/src/sca/cardinal.test.js.map +0 -1
  96. package/dist/src/sca/eci-mappings.js +0 -63
  97. package/dist/src/sca/eci-mappings.js.map +0 -1
  98. package/dist/src/sca/eci-mappings.test.js +0 -31
  99. package/dist/src/sca/eci-mappings.test.js.map +0 -1
  100. package/dist/src/sca/index.js +0 -382
  101. package/dist/src/sca/index.js.map +0 -1
  102. package/dist/src/sca/index.test.js +0 -624
  103. package/dist/src/sca/index.test.js.map +0 -1
  104. package/dist/src/sca/scenarios/enrollment.js +0 -161
  105. package/dist/src/sca/scenarios/enrollment.js.map +0 -1
  106. package/dist/src/sca/scenarios/index.js +0 -8
  107. package/dist/src/sca/scenarios/index.js.map +0 -1
  108. package/dist/src/sca/scenarios/validation.js +0 -139
  109. package/dist/src/sca/scenarios/validation.js.map +0 -1
  110. package/dist/src/sca/types.js +0 -57
  111. package/dist/src/sca/types.js.map +0 -1
  112. package/dist/src/shared/api-gateway-client.js +0 -148
  113. package/dist/src/shared/api-gateway-client.js.map +0 -1
  114. package/dist/src/shared/bridge-client.js +0 -24
  115. package/dist/src/shared/bridge-client.js.map +0 -1
  116. package/dist/src/shared/constants.js +0 -19
  117. package/dist/src/shared/constants.js.map +0 -1
  118. package/dist/src/shared/env.development.js +0 -12
  119. package/dist/src/shared/env.development.js.map +0 -1
  120. package/dist/src/shared/env.js +0 -50
  121. package/dist/src/shared/env.js.map +0 -1
  122. package/dist/src/shared/envs/local.js +0 -12
  123. package/dist/src/shared/envs/local.js.map +0 -1
  124. package/dist/src/shared/envs/production.js +0 -12
  125. package/dist/src/shared/envs/production.js.map +0 -1
  126. package/dist/src/shared/envs/sandbox.js +0 -12
  127. package/dist/src/shared/envs/sandbox.js.map +0 -1
  128. package/dist/src/shared/envs/staging.js +0 -12
  129. package/dist/src/shared/envs/staging.js.map +0 -1
  130. package/dist/src/shared/event-manager.js +0 -24
  131. package/dist/src/shared/event-manager.js.map +0 -1
  132. package/dist/src/shared/post-message-client.js +0 -127
  133. package/dist/src/shared/post-message-client.js.map +0 -1
  134. package/dist/src/shared/post-message-client.test.js +0 -58
  135. package/dist/src/shared/post-message-client.test.js.map +0 -1
  136. package/dist/src/shared/types.js +0 -36
  137. package/dist/src/shared/types.js.map +0 -1
  138. package/dist/src/shared/types.test.js +0 -55
  139. package/dist/src/shared/types.test.js.map +0 -1
  140. package/dist/src/shared/util.js +0 -96
  141. package/dist/src/shared/util.js.map +0 -1
  142. package/dist/src/shared/util.test.js +0 -148
  143. package/dist/src/shared/util.test.js.map +0 -1
  144. package/dist/src/validation/index.js +0 -12
  145. package/dist/src/validation/index.js.map +0 -1
  146. package/dist/src/validation/schemas/click-to-pay/load-params.json +0 -34
  147. package/dist/src/validation/schemas/click-to-pay/options.json +0 -23
  148. package/dist/src/validation/schemas/click-to-pay/payment-intent.json +0 -42
  149. package/dist/src/validation/schemas/customer.json +0 -38
  150. package/dist/src/validation/schemas/hpp-load-params.json +0 -40
  151. package/dist/src/validation/schemas/hpp-options.json +0 -48
  152. package/dist/src/validation/schemas/payment-intent.json +0 -48
  153. package/dist/src/validation/schemas/payment-method.json +0 -83
  154. package/dist/src/validation/schemas/verify-card-options.json +0 -15
  155. package/dist/src/validation/schemas/verify-card-params.json +0 -24
  156. package/dist/src/validation/validation-helper.js +0 -10
  157. package/dist/src/validation/validation-helper.js.map +0 -1
  158. package/dist/src/validation/validation-helper.test.js +0 -34
  159. package/dist/src/validation/validation-helper.test.js.map +0 -1
  160. package/dist/src/validation/validators/apple-pay-load-params-button-validator.js +0 -19
  161. package/dist/src/validation/validators/apple-pay-load-params-button-validator.js.map +0 -1
  162. package/dist/src/validation/validators/click-to-pay-load-params-validator.js +0 -19
  163. package/dist/src/validation/validators/click-to-pay-load-params-validator.js.map +0 -1
  164. package/dist/src/validation/validators/hpp-load-params-validator.js +0 -21
  165. package/dist/src/validation/validators/hpp-load-params-validator.js.map +0 -1
  166. package/dist/src/validation/validators/hpp-load-params-validator.test.js +0 -56
  167. package/dist/src/validation/validators/hpp-load-params-validator.test.js.map +0 -1
  168. package/dist/src/validation/validators/verify-card-params-validator.js +0 -23
  169. package/dist/src/validation/validators/verify-card-params-validator.js.map +0 -1
  170. package/dist/src/version.js +0 -5
  171. package/dist/src/version.js.map +0 -1
  172. package/dist/staging/fatzebra.css +0 -91
  173. package/dist/staging/fatzebra.js +0 -19935
  174. package/dist/staging/fatzebra.js.map +0 -1
  175. package/dist/staging/index.html +0 -247
  176. package/dist/tests/helpers/api-gateway-mock.js +0 -37
  177. package/dist/tests/helpers/api-gateway-mock.js.map +0 -1
@@ -0,0 +1,286 @@
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
+ TEST_CLOUDFRONT_ID: "E1MCI9BNDVLHEU"
9
+ SBOX_CLOUDFRONT_ID: "E5G12OAJDKLBT"
10
+ PROD_CLOUDFRONT_ID: "E3348QX8Q2J4OV"
11
+ on:
12
+ push:
13
+ branches: ['**'] # all branches
14
+ tags:
15
+ - 'v*.*.*' # prod tags e.g. v1.5.8
16
+ - 'v*.*.*-beta.*' # beta tags e.g. v1.5.8-beta.0
17
+
18
+ jobs:
19
+ checks:
20
+ name: Security & Type checks
21
+ runs-on: ubuntu-latest
22
+ env:
23
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: actions/setup-node@v4
27
+ with: { node-version: '20.x', cache: 'npm' }
28
+ - run: npm ci
29
+ - run: npx --yes audit-ci --high
30
+ - run: npx tsc --noEmit
31
+ - run: npx tsc -p tsconfig.package.json --noEmit
32
+ - run: yarn test
33
+
34
+ # --- BUILD JOBS ----------------------------------------------------
35
+
36
+ build-staging:
37
+ needs: checks
38
+ if: github.ref_type == 'branch' && github.ref_name != 'main'
39
+ runs-on: ubuntu-latest
40
+ env:
41
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - uses: fatzebra/gh-workflows/build_npm@main
45
+ with:
46
+ credentials_json: |
47
+ {
48
+ "GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
49
+ "NPM_CLOUDSMITH_REPO_PWD": "${{ secrets.CLOUDSMITH_API_KEY }}"
50
+ }
51
+ - name: Build (staging)
52
+ run: npm run build:staging
53
+ - uses: actions/upload-artifact@v4
54
+ with:
55
+ name: sdk-dist-staging
56
+ path: |
57
+ dist/staging/*.js
58
+ dist/staging/*.css
59
+ if-no-files-found: error
60
+
61
+ build-sandbox:
62
+ needs: checks
63
+ if: github.ref_type == 'tag' && contains(github.ref_name, '-beta.') && github.base_ref == 'main'
64
+ runs-on: ubuntu-latest
65
+ env:
66
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
67
+ steps:
68
+ - uses: actions/checkout@v4
69
+ - uses: fatzebra/gh-workflows/build_npm@main
70
+ with:
71
+ credentials_json: |
72
+ {
73
+ "GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
74
+ "NPM_CLOUDSMITH_REPO_PWD": "${{ secrets.CLOUDSMITH_API_KEY }}"
75
+ }
76
+ - name: Build (sandbox)
77
+ run: npm run build:sandbox
78
+ - uses: actions/upload-artifact@v4
79
+ with:
80
+ name: sdk-dist-sandbox
81
+ path: |
82
+ dist/sandbox/*.js
83
+ dist/sandbox/*.css
84
+ if-no-files-found: error
85
+
86
+ build-production:
87
+ needs: checks
88
+ if: github.ref_type == 'tag' && !contains(github.ref_name, '-beta.') && github.base_ref == 'main'
89
+ runs-on: ubuntu-latest
90
+ env:
91
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
92
+ steps:
93
+ - uses: actions/checkout@v4
94
+ - uses: fatzebra/gh-workflows/build_npm@main
95
+ with:
96
+ credentials_json: |
97
+ {
98
+ "GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
99
+ "NPM_CLOUDSMITH_REPO_PWD": "${{ secrets.CLOUDSMITH_API_KEY }}"
100
+ }
101
+ - name: Build (production)
102
+ run: npm run build:production
103
+ - uses: actions/upload-artifact@v4
104
+ with:
105
+ name: sdk-dist-production
106
+ path: |
107
+ dist/production/*.js
108
+ dist/production/*.css
109
+ if-no-files-found: error
110
+
111
+ # --- DEPLOY JOBS ----------------------------------------------------
112
+
113
+ deploy-staging:
114
+ if: github.ref_type == 'branch' && github.ref_name != 'main'
115
+ needs:
116
+ - build-staging
117
+ runs-on: ubuntu-latest
118
+ permissions:
119
+ id-token: write
120
+ contents: read
121
+ steps:
122
+ - uses: actions/download-artifact@v4
123
+ with:
124
+ name: sdk-dist-staging
125
+ path: dist/staging/
126
+ - uses: fatzebra/gh-workflows/aws_login@main
127
+ with:
128
+ platform: fz
129
+ environment: test
130
+ role_name: AppDeploy
131
+
132
+ - run: aws s3 sync --delete --content-type 'application/javascript' --exclude '*' --include '*.js' dist/staging/ "${TEST_UPLOAD_PATH}"
133
+ - run: aws s3 sync --delete --content-type 'text/css' --exclude '*' --include '*.css' dist/staging/ "${TEST_UPLOAD_PATH}"
134
+
135
+ - name: Invalidate CloudFront cache
136
+ shell: bash
137
+ run: |
138
+ invalidation_id=$(aws cloudfront create-invalidation \
139
+ --distribution-id "${TEST_CLOUDFRONT_ID}" \
140
+ --paths '/sdk/*' \
141
+ --output text \
142
+ --query 'Invalidation.Id')
143
+ echo "Invalidation started: ${invalidation_id}"
144
+ aws cloudfront wait invalidation-completed \
145
+ --distribution-id "${TEST_CLOUDFRONT_ID}" \
146
+ --id "${invalidation_id}"
147
+ echo "Invalidation completed."
148
+
149
+ deploy-sandbox:
150
+ if: github.ref_type == 'tag' && contains(github.ref_name, '-beta.') && github.base_ref == 'main'
151
+ needs:
152
+ - build-sandbox
153
+ runs-on: ubuntu-latest
154
+ permissions:
155
+ id-token: write
156
+ contents: read
157
+
158
+ steps:
159
+ - uses: actions/download-artifact@v4
160
+ with:
161
+ name: sdk-dist-sandbox
162
+ path: dist/sandbox/
163
+ - uses: fatzebra/gh-workflows/aws_login@main
164
+ with:
165
+ platform: fz
166
+ environment: sbox
167
+ role_name: AppDeploy
168
+ - run: aws s3 sync --delete --content-type 'application/javascript' --exclude '*' --include '*.js' dist/sandbox/ "${SBOX_UPLOAD_PATH}"
169
+ - run: aws s3 sync --delete --content-type 'text/css' --exclude '*' --include '*.css' dist/sandbox/ "${SBOX_UPLOAD_PATH}"
170
+ - name: Invalidate CloudFront cache
171
+ shell: bash
172
+ run: |
173
+ invalidation_id=$(aws cloudfront create-invalidation \
174
+ --distribution-id "${SBOX_CLOUDFRONT_ID}" \
175
+ --paths '/sdk/*' \
176
+ --output text \
177
+ --query 'Invalidation.Id')
178
+ echo "Invalidation started: ${invalidation_id}"
179
+ aws cloudfront wait invalidation-completed \
180
+ --distribution-id "${SBOX_CLOUDFRONT_ID}" \
181
+ --id "${invalidation_id}"
182
+ echo "Invalidation completed."
183
+
184
+ deploy-production:
185
+ if: github.ref_type == 'tag' && !contains(github.ref_name, '-beta.') && github.base_ref == 'main'
186
+ needs:
187
+ - build-production
188
+ runs-on: ubuntu-latest
189
+ permissions:
190
+ id-token: write
191
+ contents: read
192
+ steps:
193
+ - uses: actions/download-artifact@v4
194
+ with:
195
+ name: sdk-dist-production
196
+ path: dist/production
197
+ - uses: fatzebra/gh-workflows/aws_login@main
198
+ with:
199
+ platform: fz
200
+ environment: prod
201
+ role_name: AppDeploy
202
+ - run: aws s3 sync --delete --content-type 'application/javascript' --exclude '*' --include '*.js' dist/production/ "${PROD_UPLOAD_PATH}"
203
+ - run: aws s3 sync --delete --content-type 'text/css' --exclude '*' --include '*.css' dist/production/ "${PROD_UPLOAD_PATH}"
204
+ - name: Invalidate CloudFront cache
205
+ shell: bash
206
+ run: |
207
+ invalidation_id=$(aws cloudfront create-invalidation \
208
+ --distribution-id "${PROD_CLOUDFRONT_ID}" \
209
+ --paths '/sdk/*' \
210
+ --output text \
211
+ --query 'Invalidation.Id')
212
+ echo "Invalidation started: ${invalidation_id}"
213
+ aws cloudfront wait invalidation-completed \
214
+ --distribution-id "${PROD_CLOUDFRONT_ID}" \
215
+ --id "${invalidation_id}"
216
+ echo "Invalidation completed."
217
+
218
+ # Publish to npm for beta tags and production tags
219
+ publish-npm-beta:
220
+ runs-on: ubuntu-latest
221
+ if: startsWith(github.ref, 'refs/tags/') && contains(github.ref_name, '-beta.')
222
+ env:
223
+ TAG_NAME: ${{ github.ref_name }} # e.g. v1.5.10-beta.0
224
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
225
+ steps:
226
+ - uses: actions/checkout@v4
227
+ with:
228
+ fetch-depth: 0
229
+
230
+ - uses: actions/setup-node@v4
231
+ with:
232
+ node-version: 20
233
+ registry-url: 'https://registry.npmjs.org' # writes .npmrc using NPM_TOKEN
234
+
235
+ - name: Show tag name
236
+ run: echo "Publishing for tag $TAG_NAME"
237
+
238
+ # make package.json version match the git tag (strip leading "v" if present)
239
+ - name: Sync package.json version to git tag
240
+ run: |
241
+ VERSION="${TAG_NAME#v}"
242
+ npm version --no-git-tag-version "$VERSION"
243
+
244
+ - name: Install deps
245
+ run: npm ci
246
+
247
+ - name: Run package build
248
+ run: npm run build:package
249
+
250
+ - name: Publish (beta dist-tag)
251
+ run: npm publish --access public --tag beta
252
+
253
+
254
+ # --- NPM publish for production tags (vX.Y.Z) ---
255
+ publish-npm-latest:
256
+ if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, '-beta.')
257
+ runs-on: ubuntu-latest
258
+ env:
259
+ TAG_NAME: ${{ github.ref_name }}
260
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
261
+ steps:
262
+ - uses: actions/checkout@v4
263
+ with:
264
+ fetch-depth: 0
265
+
266
+ - uses: actions/setup-node@v4
267
+ with:
268
+ node-version: 20
269
+ registry-url: 'https://registry.npmjs.org'
270
+
271
+ - name: Tag Name
272
+ run: echo "Publishing for tag $TAG_NAME"
273
+
274
+ - name: Sync package.json version to git tag
275
+ run: |
276
+ VERSION="${TAG_NAME#v}"
277
+ npm version --no-git-tag-version "$VERSION"
278
+
279
+ - name: Install deps
280
+ run: npm ci
281
+
282
+ - name: Run package build
283
+ run: npm run build:package
284
+
285
+ - name: Publish (latest dist-tag)
286
+ run: npm publish --access public --tag latest
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx --no -- commitlint --edit "$1"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ exec < /dev/tty && npx cz --hook || true
package/.tool-versions CHANGED
@@ -1 +1 @@
1
- nodejs 22.0.0
1
+ nodejs 23.7.0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
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
+
5
10
  ## [1.5.9] - 2025-07-09
6
11
  ## Changed
7
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.
package/README.dev.md CHANGED
@@ -165,45 +165,63 @@ from here enter your 2FA code and voila! You have published a new version of the
165
165
 
166
166
  ## Release Management
167
167
 
168
- ### Automated release:
168
+ ### NPM
169
169
 
170
- To deploy to npm run this command:
170
+ Releases are based on tags. There are two types of releases:
171
+ - Production
172
+ - Beta
171
173
 
174
+ To perform a production release:
175
+
176
+ ```shell
177
+ git tag -a v1.5.10 -m "Production Release: 1.5.10"
178
+ git push origin v1.5.10
172
179
  ```
173
- npm run npm:publish
180
+
181
+ To perform a beta release
182
+
183
+ ```shell
184
+ git tag -a v1.5.10-beta.0 -m "Beta: 1.5.10-beta.0"
185
+ git push origin v1.5.10-beta.0
174
186
  ```
175
187
 
176
- ![deployment options](deploy-menu.png)
188
+ ### CDN
177
189
 
178
- The semantic version will be bumped according to the selected release type.
190
+ ## Staging
179
191
 
180
- | Release type | version |
181
- |--------------|--------------|
182
- | Major | x-0-0 |
183
- | Minor | 0-x-0 |
184
- | Patch | 0-0-x |
185
- | Beta | 0-0-0-beta-x |
192
+ Staging is released automatically for each branch (on push)
186
193
 
187
- The publish script will also tag the release and push to the current branch.
188
- This process is an automated version of the process below, excluding changelog
194
+ ## Sandbox
189
195
 
190
- The release of the sdk follows a weekly schedule. In the beginning of a new release cycle, do the following
196
+ Sandbox deployment will trigger on the main branch and when pushing through a tag with beta in it.
197
+
198
+ Running this on main will trigger sandbox deployment (as well as npm beta release):
199
+
200
+ ```shell
201
+ git tag -a v1.5.10-beta.0 -m "Beta: 1.5.10-beta.0"
202
+ git push origin v1.5.10-beta.0
203
+ ```
191
204
 
192
- 1. Create a release branch, release/vX.X.X
193
- 2. Work out the PRs that need to be released. Make sure the merge destination points to the new release branch.
194
- 3. On the release cut-off day (2 days before the release day), merge all PRs into the release branch.
195
- 4. Do last round of testing.
196
- 5. While on the release branch locally, bump version number in package.json. Make sure the version number is the same as that of the release git branch.
197
- 6. Update CHANGELOG. List down all JIRAs included in the new release.
198
- 7. Push the changes (version update, CHANGELOG) to the release branch.
199
- 8. Create a PR for the release candidate.
200
- 9. Merge the release candidate PR back to develop. The git merge message should include the release number vX.X.X.
201
- 10. Prepare a new git tag for the new release version `git tag -a vX.X.X`.
202
- 11. Push git tag. `git push origin vX.X.X`.
205
+ ## Production
203
206
 
204
- Upon successful CI , a new entry with title 'Merged in release/vX.X,X' will be visible in the master branch page. This provides us with a clear view of what gets released in the past. Moreoever, we can quickly find out the list of features/bug fixes in a release by referring to the PR of the release candidate.
207
+ Sandbox deployment will trigger on the main branch and when pushing through a tag WITHOUT beta in it.
208
+ Running this on main will trigger production deployment:
205
209
 
210
+ ```shell
211
+ git tag -a v1.5.10 -m "Beta: 1.5.10"
212
+ git push origin v1.5.10
213
+ ```
206
214
 
207
215
  ## Rollback management
208
216
 
209
- The CDN is now versioned across staging, sandbox and production environments. The pipeline will upload a version to override the existing deployment, but also a version of the build to a folder in s3. The folder will be a shortened version of the commit hash. This will allow us to advise merchants to rollback to a specific working commit hash, or for us to test different versions in gazelle to facilitate a rollback if necessary.
217
+ The pipeline will upload a version to override the existing deployment, but also a version of the build to a folder in s3.
218
+
219
+ ## Commitizen
220
+
221
+ We use Husky and Commitizen to keep our commit history consistent, readable, and meaningful. Husky runs Git hooks automatically. This will in turn run commitizen. Commitizen enforces a standard commit message format based on Conventional Commits
222
+ . This ensures every commit clearly communicates its purpose, making it easier to track changes, generate changelogs, and automate releases.
223
+
224
+ Follow the commitizen wizard to correctly format the commit message.
225
+
226
+ ![commitizen wizard](readme.png)
227
+
package/commitizen.png ADDED
Binary file
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: ['@commitlint/config-conventional'],
3
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fat-zebra/sdk",
3
- "version": "1.5.9",
3
+ "version": "1.5.10-beta.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,12 +17,15 @@
17
17
  "start:staging:es5": "export MERCHANT_MODE=es5 && npm run build:staging --watch && webpack serve --config webpack.config.dev.js --open 'Google Chrome'",
18
18
  "start:docker": "npm run build:dev --watch && webpack serve --config webpack.config.dev.js --host 0.0.0.0",
19
19
  "generate:jwt": "node scripts/generate-access-token.js",
20
- "npm:publish": "ts-node scripts/release-package.ts"
20
+ "npm:publish": "ts-node scripts/release-package.ts",
21
+ "prepare": "husky install"
21
22
  },
22
23
  "keywords": [],
23
24
  "author": "",
24
25
  "license": "ISC",
25
26
  "devDependencies": {
27
+ "@commitlint/cli": "^19.8.1",
28
+ "@commitlint/config-conventional": "^19.8.1",
26
29
  "@inquirer/prompts": "^5.3.8",
27
30
  "@testing-library/dom": "^10.4.0",
28
31
  "@testing-library/react": "^16.0.0",
@@ -38,14 +41,17 @@
38
41
  "@types/react": "^18.2.15",
39
42
  "@types/react-dom": "^18.2.7",
40
43
  "audit-ci": "^6.6.1",
44
+ "commitizen": "^4.3.1",
45
+ "cz-conventional-changelog": "^3.3.0",
41
46
  "dotenv": "^16.0.1",
42
47
  "dotenv-webpack": "^8.0.0",
43
48
  "ejs": "^3.0.1",
44
49
  "html-webpack-plugin": "^5.3.1",
50
+ "husky": "^8.0.0",
45
51
  "jest": "^29.6.1",
46
52
  "jest-environment-jsdom": "^29.6.1",
47
53
  "jest-localstorage-mock": "^2.4.22",
48
- "jsdom": "^16.2.1",
54
+ "jsdom": "^26.1.0",
49
55
  "jsonwebtoken": "^9.0.0",
50
56
  "nock": "^12.0.1",
51
57
  "react": "^18.3.1",
@@ -64,7 +70,7 @@
64
70
  "ajv": "^8.17.1",
65
71
  "ajv-formats": "^3.0.1",
66
72
  "ajv-keywords": "^5.1.0",
67
- "axios": "^1.6.4",
73
+ "axios": "^1.11.0",
68
74
  "custom-event-polyfill": "^1.0.7",
69
75
  "ts-polyfill": "^3.8.2",
70
76
  "url-template": "^3.1.0"
@@ -72,5 +78,10 @@
72
78
  "peerDependencies": {
73
79
  "react": ">= 16",
74
80
  "react-dom": ">= 16"
81
+ },
82
+ "config": {
83
+ "commitizen": {
84
+ "path": "./node_modules/cz-conventional-changelog"
85
+ }
75
86
  }
76
- }
87
+ }
@@ -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>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="PrettierConfiguration">
4
- <option name="myConfigurationMode" value="AUTOMATIC" />
5
- </component>
6
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>
package/deploy-menu.png DELETED
Binary file
@@ -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;