@statickit/core
Advanced tools
Comparing version 1.3.1 to 1.4.0
# Changelog | ||
## 1.4.0 | ||
- Accept `site` + `form` combo (in lieu of `id`) for identifying forms. | ||
## 1.3.0 | ||
@@ -4,0 +8,0 @@ |
@@ -918,2 +918,15 @@ 'use strict'; | ||
}; | ||
var submissionUrl = function submissionUrl(props) { | ||
var id = props.id, | ||
site = props.site, | ||
form = props.form; | ||
var endpoint = props.endpoint || 'https://api.statickit.com'; | ||
if (site && form) { | ||
return "".concat(endpoint, "/j/sites/").concat(site, "/forms/").concat(form, "/submissions"); | ||
} else { | ||
return "".concat(endpoint, "/j/forms/").concat(id, "/submissions"); | ||
} | ||
}; | ||
/** | ||
@@ -965,4 +978,4 @@ * The client constructor. | ||
StaticKit.prototype.submitForm = function submitForm(props) { | ||
if (!props.id) { | ||
throw new Error('You must provide an `id` for the form'); | ||
if (!props.id && !(props.site && props.form)) { | ||
throw new Error('You must set an `id` or `site` & `form` properties'); | ||
} | ||
@@ -973,4 +986,3 @@ | ||
}).fetch; | ||
var endpoint = props.endpoint || 'https://api.statickit.com'; | ||
var url = "".concat(endpoint, "/j/forms/").concat(props.id, "/submissions"); | ||
var url = submissionUrl(props); | ||
var data = props.data || {}; | ||
@@ -977,0 +989,0 @@ var session = objectAssign({}, this.session, { |
@@ -916,2 +916,15 @@ var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; | ||
}; | ||
var submissionUrl = function submissionUrl(props) { | ||
var id = props.id, | ||
site = props.site, | ||
form = props.form; | ||
var endpoint = props.endpoint || 'https://api.statickit.com'; | ||
if (site && form) { | ||
return "".concat(endpoint, "/j/sites/").concat(site, "/forms/").concat(form, "/submissions"); | ||
} else { | ||
return "".concat(endpoint, "/j/forms/").concat(id, "/submissions"); | ||
} | ||
}; | ||
/** | ||
@@ -963,4 +976,4 @@ * The client constructor. | ||
StaticKit.prototype.submitForm = function submitForm(props) { | ||
if (!props.id) { | ||
throw new Error('You must provide an `id` for the form'); | ||
if (!props.id && !(props.site && props.form)) { | ||
throw new Error('You must set an `id` or `site` & `form` properties'); | ||
} | ||
@@ -971,4 +984,3 @@ | ||
}).fetch; | ||
var endpoint = props.endpoint || 'https://api.statickit.com'; | ||
var url = "".concat(endpoint, "/j/forms/").concat(props.id, "/submissions"); | ||
var url = submissionUrl(props); | ||
var data = props.data || {}; | ||
@@ -975,0 +987,0 @@ var session = objectAssign({}, this.session, { |
{ | ||
"name": "@statickit/core", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "The core library for StaticKit", | ||
@@ -5,0 +5,0 @@ "homepage": "https://statickit.com", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
60956
1747
0