Skip to content

Commit

Permalink
chore: Bump to 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yagues committed Nov 15, 2023
1 parent 5db6547 commit 9289311
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

# 1.4.0

- [feat] loadLibrary invalid value management improvements

# 1.3.8

- [feat] Update d.ts file
Expand Down
2 changes: 1 addition & 1 deletion dist/js/kr-payment-form-glue.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/js/kr-payment-form-glue.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions lib/KryptonGlue.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ var Glue = /*#__PURE__*/ (function () {
arguments.length > 2 && arguments[2] !== undefined
? arguments[2]
: null
var domainRegex =
/^(?:http(s)?:\/\/)[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/g
var pubKeyRegex = /^\d{2,8}:(|test)publickey_.+$/g
if (this.loaded) return this.getKrypton(publicKey)
if (!domain) return Promise.reject('Domain not defined')
if (!publicKey) return Promise.reject('Public key not defined')

if (!domainRegex.test(domain)) {
if (!publicKey) return Promise.reject('Public key not defined') // Domain validation

try {
var domainUrl = new URL(domain)
if (!['http:', 'https:'].includes(domainUrl.protocol))
throw new Error('Invalid protocol')
if (domainUrl.port) throw new Error('No port allowed')
if (domainUrl.search !== '')
throw new Error('No query params allowed')
if (domainUrl.pathname !== '/') throw new Error('Invalid path')
} catch (err) {
console.error('Domain format should be https://domain.name')
return Promise.reject(
'['.concat(domain, '] is not a valid endpoint domain')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lyracom/embedded-form-glue",
"version": "1.3.8",
"version": "1.4.0",
"description": "Lyra embedded form glue",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 9289311

Please sign in to comment.