@formium/client
Advanced tools
Comparing version 0.0.17 to 0.0.18
@@ -8,2 +8,3 @@ 'use strict'; | ||
var qs = _interopDefault(require('query-string')); | ||
var utils = require('@formium/utils'); | ||
@@ -199,4 +200,2 @@ function _extends() { | ||
return function fetcher(endpoint, options) { | ||
var _options; | ||
if (options === void 0) { | ||
@@ -206,8 +205,10 @@ options = {}; | ||
return fetchImplementation(baseUrl + endpoint, _extends({ | ||
headers: _extends({ | ||
var opts = { | ||
headers: { | ||
'X-Formik-Client': '@formium/client', | ||
'X-Formik-Client-Version': "0.0.17" | ||
}, (_options = options) === null || _options === void 0 ? void 0 : _options.headers) | ||
}, options)); | ||
'X-Formik-Client-Version': "0.0.18", | ||
Authorization: "Bearer " + apiToken | ||
} | ||
}; | ||
return fetchImplementation(baseUrl + endpoint, utils.deepMerge(opts, options)); | ||
}; | ||
@@ -227,3 +228,3 @@ } | ||
this.baseUrl = (_options$baseUrl = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _options$baseUrl !== void 0 ? _options$baseUrl : 'https://api.formium.io'; | ||
this._fetcher = _createFetcher(this.baseUrl, (_options$fetchImpleme = options === null || options === void 0 ? void 0 : options.fetchImplementation) !== null && _options$fetchImpleme !== void 0 ? _options$fetchImpleme : fetch); | ||
this._fetcher = _createFetcher(this.baseUrl, (_options$fetchImpleme = options === null || options === void 0 ? void 0 : options.fetchImplementation) !== null && _options$fetchImpleme !== void 0 ? _options$fetchImpleme : fetch, options === null || options === void 0 ? void 0 : options.apiToken); | ||
} | ||
@@ -243,11 +244,10 @@ /** | ||
var url = "/v1/form?" + qs.stringify(_extends({ | ||
projectID: this.projectId | ||
projectId: this.projectId | ||
}, query)); | ||
return this._fetcher(url, _extends({ | ||
method: 'GET' | ||
}, fetchOptions, { | ||
headers: _extends({ | ||
return this._fetcher(url, utils.deepMerge({ | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers) | ||
})).then(function (res) { | ||
} | ||
}, fetchOptions)).then(function (res) { | ||
return res.json(); | ||
@@ -267,3 +267,3 @@ }); | ||
_proto.getFormBySlug = function getFormBySlug(formSlug, query, fetchOptions) { | ||
var url = "/v1/form/slug/" + this.projectId + "/" + formSlug; | ||
var url = "/v1/form/id/" + this.projectId + "/" + formSlug; | ||
var headers = {}; | ||
@@ -277,9 +277,8 @@ | ||
return this._fetcher(url, _extends({ | ||
method: 'GET' | ||
}, fetchOptions, { | ||
return this._fetcher(url, utils.deepMerge({ | ||
method: 'GET', | ||
headers: _extends({ | ||
'Content-Type': 'application/json' | ||
}, headers, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers) | ||
})).then(function (res) { | ||
}, headers) | ||
}, fetchOptions)).then(function (res) { | ||
return res.json(); | ||
@@ -308,9 +307,8 @@ }); | ||
return this._fetcher(url, _extends({ | ||
method: 'GET' | ||
}, fetchOptions, { | ||
return this._fetcher(url, utils.deepMerge({ | ||
method: 'GET', | ||
headers: _extends({ | ||
'Content-Type': 'application/json' | ||
}, headers, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers) | ||
})).then(function (res) { | ||
}, headers) | ||
}, fetchOptions)).then(function (res) { | ||
return res.json(); | ||
@@ -317,0 +315,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,r,o,n,i,s,a,u,l,p=(e=require("query-string"))&&"object"==typeof e&&"default"in e?e.default:e;function E(){return(E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function m(e,t,r){return function(r,o){var n;return void 0===o&&(o={}),t(e+r,E({headers:E({"X-Formik-Client":"@formium/client","X-Formik-Client-Version":"0.0.17"},null===(n=o)||void 0===n?void 0:n.headers)},o))}}(t=exports.FormSubmitLayout||(exports.FormSubmitLayout={})).LIST="LIST",t.TABLE="TABLE",(r=exports.FormUploadTypes||(exports.FormUploadTypes={})).JPG="JPG",r.GIF="GIF",r.PNG="PNG",r.PDF="PDF",r.DOC="DOC",r.DOCX="DOCX",r.XLS="XLS",r.XLSX="XLSX",r.PPT="PPT",r.PPTX="PPTX",(o=exports.FormStatus||(exports.FormStatus={})).ACTIVE="ACTIVE",o.INACTIVE="INACTIVE",(n=exports.FormValidate||(exports.FormValidate={})).ANY="ANY",n.KEYS_ANY="KEYS_ANY",n.KEYS_ALL="KEYS_ALL",(i=exports.FormKeyVisibility||(exports.FormKeyVisibility={})).HIDDEN="HIDDEN",i.SHOWN="SHOWN",i.ADMIN="ADMIN",(s=exports.FormElementType||(exports.FormElementType={}))[s.DATE="DATE"]="DATE",s[s.EMAIL="EMAIL"]="EMAIL",s[s.FILE="FILE"]="FILE",s[s.LONG_TEXT="LONG_TEXT"]="LONG_TEXT",s[s.NUMBER="NUMBER"]="NUMBER",s[s.PHONE_NUMBER="PHONE_NUMBER"]="PHONE_NUMBER",s[s.SHORT_TEXT="SHORT_TEXT"]="SHORT_TEXT",s[s.TIME="TIME"]="TIME",s[s.URL="URL"]="URL",s[s.CHOICE="CHOICE"]="CHOICE",s[s.RADIO="RADIO"]="RADIO",s[s.BOOLEAN="BOOLEAN"]="BOOLEAN",s[s.CHECKBOX="CHECKBOX"]="CHECKBOX",s[s.PAGE="PAGE"]="PAGE",s[s.GROUP="GROUP"]="GROUP",s[s.STAR_RATING="STAR_RATING"]="STAR_RATING",s[s.NPS="NPS"]="NPS",s[s.HIDDEN="HIDDEN"]="HIDDEN",s[s.DROPDOWN="DROPDOWN"]="DROPDOWN",s[s.PAYMENT="PAYMENT"]="PAYMENT",(a=exports.FormElementUploadTypes||(exports.FormElementUploadTypes={}))[a.JPG="JPG"]="JPG",a[a.GIF="GIF"]="GIF",a[a.PNG="PNG"]="PNG",a[a.PDF="PDF"]="PDF",a[a.DOC="DOC"]="DOC",a[a.DOCX="DOCX"]="DOCX",a[a.XLS="XLS"]="XLS",a[a.XLSX="XLSX"]="XLSX",a[a.PPT="PPT"]="PPT",a[a.PPTX="PPTX"]="PPTX",(u=exports.FormElementActionAction||(exports.FormElementActionAction={}))[u.JUMP="JUMP"]="JUMP",u[u.SHOW="SHOW"]="SHOW",u[u.HIDE="HIDE"]="HIDE",(l=exports.FormElementActionDetailsToType||(exports.FormElementActionDetailsToType={}))[l.FIELD="FIELD"]="FIELD",l[l.HIDDEN="HIDDEN"]="HIDDEN",l[l.THANK_YOU="THANK_YOU"]="THANK_YOU";var c=function(){function e(e,t){var r,o;this.projectId=e,this.baseUrl=null!==(r=null==t?void 0:t.baseUrl)&&void 0!==r?r:"https://api.formium.io",this._fetcher=m(this.baseUrl,null!==(o=null==t?void 0:t.fetchImplementation)&&void 0!==o?o:fetch)}var t=e.prototype;return t.findForms=function(e,t){var r="/v1/form?"+p.stringify(E({projectID:this.projectId},e));return this._fetcher(r,E({method:"GET"},t,{headers:E({"Content-Type":"application/json"},null==t?void 0:t.headers)})).then((function(e){return e.json()}))},t.getFormBySlug=function(e,t,r){var o={};return t&&t.revisionId&&(o={"X-Formik-Revision":t.revisionId}),this._fetcher("/v1/form/slug/"+this.projectId+"/"+e,E({method:"GET"},r,{headers:E({"Content-Type":"application/json"},o,null==r?void 0:r.headers)})).then((function(e){return e.json()}))},t.getFormById=function(e,t,r){var o={};return t&&t.revisionId&&(o={"X-Formik-Revision":t.revisionId}),this._fetcher("/v1/form/"+e,E({method:"GET"},r,{headers:E({"Content-Type":"application/json"},o,null==r?void 0:r.headers)})).then((function(e){return e.json()}))},t.submitForm=function(e,t){var r;if(t instanceof FormData){for(var o,n={},i=function(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return T(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?T(e,void 0):void 0}}(e))){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}(t);!(o=i()).done;){var s=o.value,a=s[0],u=s[1];n.hasOwnProperty(a)?(Array.isArray(n[a])||(n[a]=[n[a]]),n[a].push(u)):n[a]=u}r=JSON.stringify(n)}else r=JSON.stringify(t);return this._fetcher("/submit/"+this.projectId+"/"+e,{method:"POST",headers:{"Content-Type":"application/json"},body:r}).then((function(e){return e.json()}))},t.uploadFile=function(e,t){var r=new FormData;return r.append("file",t),this._fetcher("/submit/"+this.projectId+"/"+e+"/upload",{method:"POST",body:r}).then((function(e){return e.headers.get("Location")}))},e}();exports.FormiumClient=c,exports._createFetcher=m,exports.createClient=function(e,t){return new c(e,t)}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,r,o,n,i,s,a,u,p,E=(e=require("query-string"))&&"object"==typeof e&&"default"in e?e.default:e,l=require("@formium/utils");function T(){return(T=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function c(e,t,r){return function(o,n){return void 0===n&&(n={}),t(e+o,l.deepMerge({headers:{"X-Formik-Client":"@formium/client","X-Formik-Client-Version":"0.0.18",Authorization:"Bearer "+r}},n))}}(t=exports.FormSubmitLayout||(exports.FormSubmitLayout={})).LIST="LIST",t.TABLE="TABLE",(r=exports.FormUploadTypes||(exports.FormUploadTypes={})).JPG="JPG",r.GIF="GIF",r.PNG="PNG",r.PDF="PDF",r.DOC="DOC",r.DOCX="DOCX",r.XLS="XLS",r.XLSX="XLSX",r.PPT="PPT",r.PPTX="PPTX",(o=exports.FormStatus||(exports.FormStatus={})).ACTIVE="ACTIVE",o.INACTIVE="INACTIVE",(n=exports.FormValidate||(exports.FormValidate={})).ANY="ANY",n.KEYS_ANY="KEYS_ANY",n.KEYS_ALL="KEYS_ALL",(i=exports.FormKeyVisibility||(exports.FormKeyVisibility={})).HIDDEN="HIDDEN",i.SHOWN="SHOWN",i.ADMIN="ADMIN",(s=exports.FormElementType||(exports.FormElementType={}))[s.DATE="DATE"]="DATE",s[s.EMAIL="EMAIL"]="EMAIL",s[s.FILE="FILE"]="FILE",s[s.LONG_TEXT="LONG_TEXT"]="LONG_TEXT",s[s.NUMBER="NUMBER"]="NUMBER",s[s.PHONE_NUMBER="PHONE_NUMBER"]="PHONE_NUMBER",s[s.SHORT_TEXT="SHORT_TEXT"]="SHORT_TEXT",s[s.TIME="TIME"]="TIME",s[s.URL="URL"]="URL",s[s.CHOICE="CHOICE"]="CHOICE",s[s.RADIO="RADIO"]="RADIO",s[s.BOOLEAN="BOOLEAN"]="BOOLEAN",s[s.CHECKBOX="CHECKBOX"]="CHECKBOX",s[s.PAGE="PAGE"]="PAGE",s[s.GROUP="GROUP"]="GROUP",s[s.STAR_RATING="STAR_RATING"]="STAR_RATING",s[s.NPS="NPS"]="NPS",s[s.HIDDEN="HIDDEN"]="HIDDEN",s[s.DROPDOWN="DROPDOWN"]="DROPDOWN",s[s.PAYMENT="PAYMENT"]="PAYMENT",(a=exports.FormElementUploadTypes||(exports.FormElementUploadTypes={}))[a.JPG="JPG"]="JPG",a[a.GIF="GIF"]="GIF",a[a.PNG="PNG"]="PNG",a[a.PDF="PDF"]="PDF",a[a.DOC="DOC"]="DOC",a[a.DOCX="DOCX"]="DOCX",a[a.XLS="XLS"]="XLS",a[a.XLSX="XLSX"]="XLSX",a[a.PPT="PPT"]="PPT",a[a.PPTX="PPTX"]="PPTX",(u=exports.FormElementActionAction||(exports.FormElementActionAction={}))[u.JUMP="JUMP"]="JUMP",u[u.SHOW="SHOW"]="SHOW",u[u.HIDE="HIDE"]="HIDE",(p=exports.FormElementActionDetailsToType||(exports.FormElementActionDetailsToType={}))[p.FIELD="FIELD"]="FIELD",p[p.HIDDEN="HIDDEN"]="HIDDEN",p[p.THANK_YOU="THANK_YOU"]="THANK_YOU";var d=function(){function e(e,t){var r,o;this.projectId=e,this.baseUrl=null!==(r=null==t?void 0:t.baseUrl)&&void 0!==r?r:"https://api.formium.io",this._fetcher=c(this.baseUrl,null!==(o=null==t?void 0:t.fetchImplementation)&&void 0!==o?o:fetch,null==t?void 0:t.apiToken)}var t=e.prototype;return t.findForms=function(e,t){var r="/v1/form?"+E.stringify(T({projectId:this.projectId},e));return this._fetcher(r,l.deepMerge({method:"GET",headers:{"Content-Type":"application/json"}},t)).then((function(e){return e.json()}))},t.getFormBySlug=function(e,t,r){var o={};return t&&t.revisionId&&(o={"X-Formik-Revision":t.revisionId}),this._fetcher("/v1/form/id/"+this.projectId+"/"+e,l.deepMerge({method:"GET",headers:T({"Content-Type":"application/json"},o)},r)).then((function(e){return e.json()}))},t.getFormById=function(e,t,r){var o={};return t&&t.revisionId&&(o={"X-Formik-Revision":t.revisionId}),this._fetcher("/v1/form/"+e,l.deepMerge({method:"GET",headers:T({"Content-Type":"application/json"},o)},r)).then((function(e){return e.json()}))},t.submitForm=function(e,t){var r;if(t instanceof FormData){for(var o,n={},i=function(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return m(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,void 0):void 0}}(e))){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}(t);!(o=i()).done;){var s=o.value,a=s[0],u=s[1];n.hasOwnProperty(a)?(Array.isArray(n[a])||(n[a]=[n[a]]),n[a].push(u)):n[a]=u}r=JSON.stringify(n)}else r=JSON.stringify(t);return this._fetcher("/submit/"+this.projectId+"/"+e,{method:"POST",headers:{"Content-Type":"application/json"},body:r}).then((function(e){return e.json()}))},t.uploadFile=function(e,t){var r=new FormData;return r.append("file",t),this._fetcher("/submit/"+this.projectId+"/"+e+"/upload",{method:"POST",body:r}).then((function(e){return e.headers.get("Location")}))},e}();exports.FormiumClient=d,exports._createFetcher=c,exports.createClient=function(e,t){return new d(e,t)}; | ||
//# sourceMappingURL=formium.cjs.production.min.js.map |
import qs from 'query-string'; | ||
import { deepMerge } from '@formium/utils'; | ||
@@ -263,4 +264,2 @@ function _extends() { | ||
return function fetcher(endpoint, options) { | ||
var _options; | ||
if (options === void 0) { | ||
@@ -270,8 +269,10 @@ options = {}; | ||
return fetchImplementation(baseUrl + endpoint, _extends({ | ||
headers: _extends({ | ||
var opts = { | ||
headers: { | ||
'X-Formik-Client': '@formium/client', | ||
'X-Formik-Client-Version': "0.0.17" | ||
}, (_options = options) === null || _options === void 0 ? void 0 : _options.headers) | ||
}, options)); | ||
'X-Formik-Client-Version': "0.0.18", | ||
Authorization: "Bearer " + apiToken | ||
} | ||
}; | ||
return fetchImplementation(baseUrl + endpoint, deepMerge(opts, options)); | ||
}; | ||
@@ -291,3 +292,3 @@ } | ||
this.baseUrl = (_options$baseUrl = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _options$baseUrl !== void 0 ? _options$baseUrl : 'https://api.formium.io'; | ||
this._fetcher = _createFetcher(this.baseUrl, (_options$fetchImpleme = options === null || options === void 0 ? void 0 : options.fetchImplementation) !== null && _options$fetchImpleme !== void 0 ? _options$fetchImpleme : fetch); | ||
this._fetcher = _createFetcher(this.baseUrl, (_options$fetchImpleme = options === null || options === void 0 ? void 0 : options.fetchImplementation) !== null && _options$fetchImpleme !== void 0 ? _options$fetchImpleme : fetch, options === null || options === void 0 ? void 0 : options.apiToken); | ||
} | ||
@@ -307,11 +308,10 @@ /** | ||
var url = "/v1/form?" + qs.stringify(_extends({ | ||
projectID: this.projectId | ||
projectId: this.projectId | ||
}, query)); | ||
return this._fetcher(url, _extends({ | ||
method: 'GET' | ||
}, fetchOptions, { | ||
headers: _extends({ | ||
return this._fetcher(url, deepMerge({ | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers) | ||
})).then(function (res) { | ||
} | ||
}, fetchOptions)).then(function (res) { | ||
return res.json(); | ||
@@ -331,3 +331,3 @@ }); | ||
_proto.getFormBySlug = function getFormBySlug(formSlug, query, fetchOptions) { | ||
var url = "/v1/form/slug/" + this.projectId + "/" + formSlug; | ||
var url = "/v1/form/id/" + this.projectId + "/" + formSlug; | ||
var headers = {}; | ||
@@ -341,9 +341,8 @@ | ||
return this._fetcher(url, _extends({ | ||
method: 'GET' | ||
}, fetchOptions, { | ||
return this._fetcher(url, deepMerge({ | ||
method: 'GET', | ||
headers: _extends({ | ||
'Content-Type': 'application/json' | ||
}, headers, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers) | ||
})).then(function (res) { | ||
}, headers) | ||
}, fetchOptions)).then(function (res) { | ||
return res.json(); | ||
@@ -372,9 +371,8 @@ }); | ||
return this._fetcher(url, _extends({ | ||
method: 'GET' | ||
}, fetchOptions, { | ||
return this._fetcher(url, deepMerge({ | ||
method: 'GET', | ||
headers: _extends({ | ||
'Content-Type': 'application/json' | ||
}, headers, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers) | ||
})).then(function (res) { | ||
}, headers) | ||
}, fetchOptions)).then(function (res) { | ||
return res.json(); | ||
@@ -381,0 +379,0 @@ }); |
@@ -566,2 +566,42 @@ var Formium = (function (exports) { | ||
/** | ||
* Copyright (c) Formium, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the Business Source License found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
/** | ||
* @private | ||
* @param {Record<string,any>} opts | ||
* @param {Record<string,any>} [overrides] | ||
* @param {boolean} [lowerCase] | ||
* @returns {Partial<opts>} | ||
*/ | ||
function deepMerge(opts, overrides, lowerCase) { | ||
var out = {}, | ||
i; | ||
if (Array.isArray(opts)) { | ||
return opts.concat(overrides); | ||
} | ||
for (i in opts) { | ||
var key = lowerCase ? i.toLowerCase() : i; | ||
out[key] = opts[i]; | ||
} | ||
for (i in overrides) { | ||
var _key = lowerCase ? i.toLowerCase() : i; | ||
var value = | ||
/** @type {any} */ | ||
overrides[i]; | ||
out[_key] = _key in out && typeof value == 'object' ? deepMerge(out[_key], value, _key === 'headers') : value; | ||
} | ||
return out; | ||
} | ||
/** | ||
* Submission UI layout | ||
@@ -695,4 +735,2 @@ * | ||
return function fetcher(endpoint, options) { | ||
var _options; | ||
if (options === void 0) { | ||
@@ -702,8 +740,10 @@ options = {}; | ||
return fetchImplementation(baseUrl + endpoint, _extends({ | ||
headers: _extends({ | ||
var opts = { | ||
headers: { | ||
'X-Formik-Client': '@formium/client', | ||
'X-Formik-Client-Version': "0.0.17" | ||
}, (_options = options) === null || _options === void 0 ? void 0 : _options.headers) | ||
}, options)); | ||
'X-Formik-Client-Version': "0.0.18", | ||
Authorization: "Bearer " + apiToken | ||
} | ||
}; | ||
return fetchImplementation(baseUrl + endpoint, deepMerge(opts, options)); | ||
}; | ||
@@ -723,3 +763,3 @@ } | ||
this.baseUrl = (_options$baseUrl = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _options$baseUrl !== void 0 ? _options$baseUrl : 'https://api.formium.io'; | ||
this._fetcher = _createFetcher(this.baseUrl, (_options$fetchImpleme = options === null || options === void 0 ? void 0 : options.fetchImplementation) !== null && _options$fetchImpleme !== void 0 ? _options$fetchImpleme : fetch); | ||
this._fetcher = _createFetcher(this.baseUrl, (_options$fetchImpleme = options === null || options === void 0 ? void 0 : options.fetchImplementation) !== null && _options$fetchImpleme !== void 0 ? _options$fetchImpleme : fetch, options === null || options === void 0 ? void 0 : options.apiToken); | ||
} | ||
@@ -739,11 +779,10 @@ /** | ||
var url = "/v1/form?" + queryString.stringify(_extends({ | ||
projectID: this.projectId | ||
projectId: this.projectId | ||
}, query)); | ||
return this._fetcher(url, _extends({ | ||
method: 'GET' | ||
}, fetchOptions, { | ||
headers: _extends({ | ||
return this._fetcher(url, deepMerge({ | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers) | ||
})).then(function (res) { | ||
} | ||
}, fetchOptions)).then(function (res) { | ||
return res.json(); | ||
@@ -763,3 +802,3 @@ }); | ||
_proto.getFormBySlug = function getFormBySlug(formSlug, query, fetchOptions) { | ||
var url = "/v1/form/slug/" + this.projectId + "/" + formSlug; | ||
var url = "/v1/form/id/" + this.projectId + "/" + formSlug; | ||
var headers = {}; | ||
@@ -773,9 +812,8 @@ | ||
return this._fetcher(url, _extends({ | ||
method: 'GET' | ||
}, fetchOptions, { | ||
return this._fetcher(url, deepMerge({ | ||
method: 'GET', | ||
headers: _extends({ | ||
'Content-Type': 'application/json' | ||
}, headers, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers) | ||
})).then(function (res) { | ||
}, headers) | ||
}, fetchOptions)).then(function (res) { | ||
return res.json(); | ||
@@ -804,9 +842,8 @@ }); | ||
return this._fetcher(url, _extends({ | ||
method: 'GET' | ||
}, fetchOptions, { | ||
return this._fetcher(url, deepMerge({ | ||
method: 'GET', | ||
headers: _extends({ | ||
'Content-Type': 'application/json' | ||
}, headers, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers) | ||
})).then(function (res) { | ||
}, headers) | ||
}, fetchOptions)).then(function (res) { | ||
return res.json(); | ||
@@ -813,0 +850,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
var Formium=function(r){"use strict";function e(){return(e=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r}).apply(this,arguments)}function t(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function n(r,e){var n;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(n=function(r,e){if(r){if("string"==typeof r)return t(r,void 0);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(r,void 0):void 0}}(r))||e&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=r[Symbol.iterator]()).next.bind(n)}function o(r,e){return r(e={exports:{}},e.exports),e.exports}var i=new RegExp("%[a-f0-9]{2}","gi"),a=new RegExp("(%[a-f0-9]{2})+","gi");function u(r,e){try{return decodeURIComponent(r.join(""))}catch(r){}if(1===r.length)return r;var t=r.slice(0,e=e||1),n=r.slice(e);return Array.prototype.concat.call([],u(t),u(n))}function c(r){try{return decodeURIComponent(r)}catch(n){for(var e=r.match(i),t=1;t<e.length;t++)e=(r=u(e,t).join("")).match(i);return r}}var s,l,f,p,m,d,y,E,v,O=function(r){if("string"!=typeof r)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch(e){return function(r){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=a.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch(r){var n=c(t[0]);n!==t[0]&&(e[t[0]]=n)}t=a.exec(r)}e["%C2"]="�";for(var o=Object.keys(e),i=0;i<o.length;i++){var u=o[i];r=r.replace(new RegExp(u,"g"),e[u])}return r}(r)}},h=function(r,e){if("string"!=typeof r||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[r];var t=r.indexOf(e);return-1===t?[r]:[r.slice(0,t),r.slice(t+e.length)]},T=o((function(r,e){function t(r){if("string"!=typeof r||1!==r.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(r,e){return e.encode?e.strict?encodeURIComponent(r).replace(/[!'()*]/g,(function(r){return"%"+r.charCodeAt(0).toString(16).toUpperCase()})):encodeURIComponent(r):r}function i(r,e){return e.decode?O(r):r}function a(r){var e=r.indexOf("#");return-1!==e&&(r=r.slice(0,e)),r}function u(r){var e=(r=a(r)).indexOf("?");return-1===e?"":r.slice(e+1)}function c(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&"string"==typeof r&&""!==r.trim()?r=Number(r):!e.parseBooleans||null===r||"true"!==r.toLowerCase()&&"false"!==r.toLowerCase()||(r="true"===r.toLowerCase()),r}function s(r,e){t((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);var o=function(r){var e;switch(r.arrayFormat){case"index":return function(r,t,n){e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),e?(void 0===n[r]&&(n[r]={}),n[r][e[1]]=t):n[r]=t};case"bracket":return function(r,t,n){e=/(\[\])$/.exec(r),n[r=r.replace(/\[\]$/,"")]=e?void 0!==n[r]?[].concat(n[r],t):[t]:t};case"comma":case"separator":return function(e,t,n){var o="string"==typeof t&&t.split("").indexOf(r.arrayFormatSeparator)>-1?t.split(r.arrayFormatSeparator).map((function(e){return i(e,r)})):null===t?t:i(t,r);n[e]=o};default:return function(r,e,t){t[r]=void 0!==t[r]?[].concat(t[r],e):e}}}(e),a=Object.create(null);if("string"!=typeof r)return a;if(!(r=r.trim().replace(/^[?#&]/,"")))return a;for(var u,s=n(r.split("&"));!(u=s()).done;){var l=u.value,f=h(e.decode?l.replace(/\+/g," "):l,"="),p=f[0],m=f[1];m=void 0===m?null:["comma","separator"].includes(e.arrayFormat)?m:i(m,e),o(i(p,e),m,a)}for(var d=0,y=Object.keys(a);d<y.length;d++){var E=y[d],v=a[E];if("object"==typeof v&&null!==v)for(var O=0,T=Object.keys(v);O<T.length;O++){var I=T[O];v[I]=c(v[I],e)}else a[E]=c(v,e)}return!1===e.sort?a:(!0===e.sort?Object.keys(a).sort():Object.keys(a).sort(e.sort)).reduce((function(r,e){var t=a[e];return r[e]=Boolean(t)&&"object"==typeof t&&!Array.isArray(t)?function r(e){return Array.isArray(e)?e.sort():"object"==typeof e?r(Object.keys(e)).sort((function(r,e){return Number(r)-Number(e)})).map((function(r){return e[r]})):e}(t):t,r}),Object.create(null))}e.extract=u,e.parse=s,e.stringify=function(r,e){if(!r)return"";t((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);for(var n=function(t){return e.skipNull&&null==r[t]||e.skipEmptyString&&""===r[t]},i=function(r){switch(r.arrayFormat){case"index":return function(e){return function(t,n){var i=t.length;return void 0===n||r.skipNull&&null===n||r.skipEmptyString&&""===n?t:[].concat(t,null===n?[[o(e,r),"[",i,"]"].join("")]:[[o(e,r),"[",o(i,r),"]=",o(n,r)].join("")])}};case"bracket":return function(e){return function(t,n){return void 0===n||r.skipNull&&null===n||r.skipEmptyString&&""===n?t:[].concat(t,null===n?[[o(e,r),"[]"].join("")]:[[o(e,r),"[]=",o(n,r)].join("")])}};case"comma":case"separator":return function(e){return function(t,n){return null==n||0===n.length?t:0===t.length?[[o(e,r),"=",o(n,r)].join("")]:[[t,o(n,r)].join(r.arrayFormatSeparator)]}};default:return function(e){return function(t,n){return void 0===n||r.skipNull&&null===n||r.skipEmptyString&&""===n?t:[].concat(t,null===n?[o(e,r)]:[[o(e,r),"=",o(n,r)].join("")])}}}}(e),a={},u=0,c=Object.keys(r);u<c.length;u++){var s=c[u];n(s)||(a[s]=r[s])}var l=Object.keys(a);return!1!==e.sort&&l.sort(e.sort),l.map((function(t){var n=r[t];return void 0===n?"":null===n?o(t,e):Array.isArray(n)?n.reduce(i(t),[]).join("&"):o(t,e)+"="+o(n,e)})).filter((function(r){return r.length>0})).join("&")},e.parseUrl=function(r,e){e=Object.assign({decode:!0},e);var t=h(r,"#"),n=t[1];return Object.assign({url:t[0].split("?")[0]||"",query:s(u(r),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:i(n,e)}:{})},e.stringifyUrl=function(r,t){t=Object.assign({encode:!0,strict:!0},t);var n=a(r.url).split("?")[0]||"",i=e.extract(r.url),u=e.parse(i,{sort:!1}),c=Object.assign(u,r.query),s=e.stringify(c,t);s&&(s="?"+s);var l=function(r){var e="",t=r.indexOf("#");return-1!==t&&(e=r.slice(t)),e}(r.url);return r.fragmentIdentifier&&(l="#"+o(r.fragmentIdentifier,t)),""+n+s+l}}));function I(r,t,n){return function(n,o){var i;return void 0===o&&(o={}),t(r+n,e({headers:e({"X-Formik-Client":"@formium/client","X-Formik-Client-Version":"0.0.17"},null===(i=o)||void 0===i?void 0:i.headers)},o))}}(s=r.FormSubmitLayout||(r.FormSubmitLayout={})).LIST="LIST",s.TABLE="TABLE",(l=r.FormUploadTypes||(r.FormUploadTypes={})).JPG="JPG",l.GIF="GIF",l.PNG="PNG",l.PDF="PDF",l.DOC="DOC",l.DOCX="DOCX",l.XLS="XLS",l.XLSX="XLSX",l.PPT="PPT",l.PPTX="PPTX",(f=r.FormStatus||(r.FormStatus={})).ACTIVE="ACTIVE",f.INACTIVE="INACTIVE",(p=r.FormValidate||(r.FormValidate={})).ANY="ANY",p.KEYS_ANY="KEYS_ANY",p.KEYS_ALL="KEYS_ALL",(m=r.FormKeyVisibility||(r.FormKeyVisibility={})).HIDDEN="HIDDEN",m.SHOWN="SHOWN",m.ADMIN="ADMIN",(d=r.FormElementType||(r.FormElementType={}))[d.DATE="DATE"]="DATE",d[d.EMAIL="EMAIL"]="EMAIL",d[d.FILE="FILE"]="FILE",d[d.LONG_TEXT="LONG_TEXT"]="LONG_TEXT",d[d.NUMBER="NUMBER"]="NUMBER",d[d.PHONE_NUMBER="PHONE_NUMBER"]="PHONE_NUMBER",d[d.SHORT_TEXT="SHORT_TEXT"]="SHORT_TEXT",d[d.TIME="TIME"]="TIME",d[d.URL="URL"]="URL",d[d.CHOICE="CHOICE"]="CHOICE",d[d.RADIO="RADIO"]="RADIO",d[d.BOOLEAN="BOOLEAN"]="BOOLEAN",d[d.CHECKBOX="CHECKBOX"]="CHECKBOX",d[d.PAGE="PAGE"]="PAGE",d[d.GROUP="GROUP"]="GROUP",d[d.STAR_RATING="STAR_RATING"]="STAR_RATING",d[d.NPS="NPS"]="NPS",d[d.HIDDEN="HIDDEN"]="HIDDEN",d[d.DROPDOWN="DROPDOWN"]="DROPDOWN",d[d.PAYMENT="PAYMENT"]="PAYMENT",(y=r.FormElementUploadTypes||(r.FormElementUploadTypes={}))[y.JPG="JPG"]="JPG",y[y.GIF="GIF"]="GIF",y[y.PNG="PNG"]="PNG",y[y.PDF="PDF"]="PDF",y[y.DOC="DOC"]="DOC",y[y.DOCX="DOCX"]="DOCX",y[y.XLS="XLS"]="XLS",y[y.XLSX="XLSX"]="XLSX",y[y.PPT="PPT"]="PPT",y[y.PPTX="PPTX"]="PPTX",(E=r.FormElementActionAction||(r.FormElementActionAction={}))[E.JUMP="JUMP"]="JUMP",E[E.SHOW="SHOW"]="SHOW",E[E.HIDE="HIDE"]="HIDE",(v=r.FormElementActionDetailsToType||(r.FormElementActionDetailsToType={}))[v.FIELD="FIELD"]="FIELD",v[v.HIDDEN="HIDDEN"]="HIDDEN",v[v.THANK_YOU="THANK_YOU"]="THANK_YOU";var g=function(){function r(r,e){var t,n;this.projectId=r,this.baseUrl=null!==(t=null==e?void 0:e.baseUrl)&&void 0!==t?t:"https://api.formium.io",this._fetcher=I(this.baseUrl,null!==(n=null==e?void 0:e.fetchImplementation)&&void 0!==n?n:fetch)}var t=r.prototype;return t.findForms=function(r,t){var n="/v1/form?"+T.stringify(e({projectID:this.projectId},r));return this._fetcher(n,e({method:"GET"},t,{headers:e({"Content-Type":"application/json"},null==t?void 0:t.headers)})).then((function(r){return r.json()}))},t.getFormBySlug=function(r,t,n){var o={};return t&&t.revisionId&&(o={"X-Formik-Revision":t.revisionId}),this._fetcher("/v1/form/slug/"+this.projectId+"/"+r,e({method:"GET"},n,{headers:e({"Content-Type":"application/json"},o,null==n?void 0:n.headers)})).then((function(r){return r.json()}))},t.getFormById=function(r,t,n){var o={};return t&&t.revisionId&&(o={"X-Formik-Revision":t.revisionId}),this._fetcher("/v1/form/"+r,e({method:"GET"},n,{headers:e({"Content-Type":"application/json"},o,null==n?void 0:n.headers)})).then((function(r){return r.json()}))},t.submitForm=function(r,e){var t;if(e instanceof FormData){for(var o,i={},a=n(e);!(o=a()).done;){var u=o.value,c=u[0],s=u[1];i.hasOwnProperty(c)?(Array.isArray(i[c])||(i[c]=[i[c]]),i[c].push(s)):i[c]=s}t=JSON.stringify(i)}else t=JSON.stringify(e);return this._fetcher("/submit/"+this.projectId+"/"+r,{method:"POST",headers:{"Content-Type":"application/json"},body:t}).then((function(r){return r.json()}))},t.uploadFile=function(r,e){var t=new FormData;return t.append("file",e),this._fetcher("/submit/"+this.projectId+"/"+r+"/upload",{method:"POST",body:t}).then((function(r){return r.headers.get("Location")}))},r}();return r.FormiumClient=g,r._createFetcher=I,r.createClient=function(r,e){return new g(r,e)},r}({}); | ||
var Formium=function(r){"use strict";function t(){return(t=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r}).apply(this,arguments)}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function n(r,t){var n;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r)return e(r,void 0);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,void 0):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=r[Symbol.iterator]()).next.bind(n)}function o(r,t){return r(t={exports:{}},t.exports),t.exports}var i=new RegExp("%[a-f0-9]{2}","gi"),a=new RegExp("(%[a-f0-9]{2})+","gi");function c(r,t){try{return decodeURIComponent(r.join(""))}catch(r){}if(1===r.length)return r;var e=r.slice(0,t=t||1),n=r.slice(t);return Array.prototype.concat.call([],c(e),c(n))}function u(r){try{return decodeURIComponent(r)}catch(n){for(var t=r.match(i),e=1;e<t.length;e++)t=(r=c(t,e).join("")).match(i);return r}}var s,l,f,p,m,d,y,E,O,v=function(r){if("string"!=typeof r)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch(t){return function(r){for(var t={"%FE%FF":"��","%FF%FE":"��"},e=a.exec(r);e;){try{t[e[0]]=decodeURIComponent(e[0])}catch(r){var n=u(e[0]);n!==e[0]&&(t[e[0]]=n)}e=a.exec(r)}t["%C2"]="�";for(var o=Object.keys(t),i=0;i<o.length;i++){var c=o[i];r=r.replace(new RegExp(c,"g"),t[c])}return r}(r)}},h=function(r,t){if("string"!=typeof r||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[r];var e=r.indexOf(t);return-1===e?[r]:[r.slice(0,e),r.slice(e+t.length)]},T=o((function(r,t){function e(r){if("string"!=typeof r||1!==r.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(r,t){return t.encode?t.strict?encodeURIComponent(r).replace(/[!'()*]/g,(function(r){return"%"+r.charCodeAt(0).toString(16).toUpperCase()})):encodeURIComponent(r):r}function i(r,t){return t.decode?v(r):r}function a(r){var t=r.indexOf("#");return-1!==t&&(r=r.slice(0,t)),r}function c(r){var t=(r=a(r)).indexOf("?");return-1===t?"":r.slice(t+1)}function u(r,t){return t.parseNumbers&&!Number.isNaN(Number(r))&&"string"==typeof r&&""!==r.trim()?r=Number(r):!t.parseBooleans||null===r||"true"!==r.toLowerCase()&&"false"!==r.toLowerCase()||(r="true"===r.toLowerCase()),r}function s(r,t){e((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);var o=function(r){var t;switch(r.arrayFormat){case"index":return function(r,e,n){t=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),t?(void 0===n[r]&&(n[r]={}),n[r][t[1]]=e):n[r]=e};case"bracket":return function(r,e,n){t=/(\[\])$/.exec(r),n[r=r.replace(/\[\]$/,"")]=t?void 0!==n[r]?[].concat(n[r],e):[e]:e};case"comma":case"separator":return function(t,e,n){var o="string"==typeof e&&e.split("").indexOf(r.arrayFormatSeparator)>-1?e.split(r.arrayFormatSeparator).map((function(t){return i(t,r)})):null===e?e:i(e,r);n[t]=o};default:return function(r,t,e){e[r]=void 0!==e[r]?[].concat(e[r],t):t}}}(t),a=Object.create(null);if("string"!=typeof r)return a;if(!(r=r.trim().replace(/^[?#&]/,"")))return a;for(var c,s=n(r.split("&"));!(c=s()).done;){var l=c.value,f=h(t.decode?l.replace(/\+/g," "):l,"="),p=f[0],m=f[1];m=void 0===m?null:["comma","separator"].includes(t.arrayFormat)?m:i(m,t),o(i(p,t),m,a)}for(var d=0,y=Object.keys(a);d<y.length;d++){var E=y[d],O=a[E];if("object"==typeof O&&null!==O)for(var v=0,T=Object.keys(O);v<T.length;v++){var I=T[v];O[I]=u(O[I],t)}else a[E]=u(O,t)}return!1===t.sort?a:(!0===t.sort?Object.keys(a).sort():Object.keys(a).sort(t.sort)).reduce((function(r,t){var e=a[t];return r[t]=Boolean(e)&&"object"==typeof e&&!Array.isArray(e)?function r(t){return Array.isArray(t)?t.sort():"object"==typeof t?r(Object.keys(t)).sort((function(r,t){return Number(r)-Number(t)})).map((function(r){return t[r]})):t}(e):e,r}),Object.create(null))}t.extract=c,t.parse=s,t.stringify=function(r,t){if(!r)return"";e((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);for(var n=function(e){return t.skipNull&&null==r[e]||t.skipEmptyString&&""===r[e]},i=function(r){switch(r.arrayFormat){case"index":return function(t){return function(e,n){var i=e.length;return void 0===n||r.skipNull&&null===n||r.skipEmptyString&&""===n?e:[].concat(e,null===n?[[o(t,r),"[",i,"]"].join("")]:[[o(t,r),"[",o(i,r),"]=",o(n,r)].join("")])}};case"bracket":return function(t){return function(e,n){return void 0===n||r.skipNull&&null===n||r.skipEmptyString&&""===n?e:[].concat(e,null===n?[[o(t,r),"[]"].join("")]:[[o(t,r),"[]=",o(n,r)].join("")])}};case"comma":case"separator":return function(t){return function(e,n){return null==n||0===n.length?e:0===e.length?[[o(t,r),"=",o(n,r)].join("")]:[[e,o(n,r)].join(r.arrayFormatSeparator)]}};default:return function(t){return function(e,n){return void 0===n||r.skipNull&&null===n||r.skipEmptyString&&""===n?e:[].concat(e,null===n?[o(t,r)]:[[o(t,r),"=",o(n,r)].join("")])}}}}(t),a={},c=0,u=Object.keys(r);c<u.length;c++){var s=u[c];n(s)||(a[s]=r[s])}var l=Object.keys(a);return!1!==t.sort&&l.sort(t.sort),l.map((function(e){var n=r[e];return void 0===n?"":null===n?o(e,t):Array.isArray(n)?n.reduce(i(e),[]).join("&"):o(e,t)+"="+o(n,t)})).filter((function(r){return r.length>0})).join("&")},t.parseUrl=function(r,t){t=Object.assign({decode:!0},t);var e=h(r,"#"),n=e[1];return Object.assign({url:e[0].split("?")[0]||"",query:s(c(r),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:i(n,t)}:{})},t.stringifyUrl=function(r,e){e=Object.assign({encode:!0,strict:!0},e);var n=a(r.url).split("?")[0]||"",i=t.extract(r.url),c=t.parse(i,{sort:!1}),u=Object.assign(c,r.query),s=t.stringify(u,e);s&&(s="?"+s);var l=function(r){var t="",e=r.indexOf("#");return-1!==e&&(t=r.slice(e)),t}(r.url);return r.fragmentIdentifier&&(l="#"+o(r.fragmentIdentifier,e)),""+n+s+l}}));function I(r,t,e){var n,o={};if(Array.isArray(r))return r.concat(t);for(n in r)o[e?n.toLowerCase():n]=r[n];for(n in t){var i=e?n.toLowerCase():n,a=t[n];o[i]=i in o&&"object"==typeof a?I(o[i],a,"headers"===i):a}return o}function g(r,t,e){return function(n,o){return void 0===o&&(o={}),t(r+n,I({headers:{"X-Formik-Client":"@formium/client","X-Formik-Client-Version":"0.0.18",Authorization:"Bearer "+e}},o))}}(s=r.FormSubmitLayout||(r.FormSubmitLayout={})).LIST="LIST",s.TABLE="TABLE",(l=r.FormUploadTypes||(r.FormUploadTypes={})).JPG="JPG",l.GIF="GIF",l.PNG="PNG",l.PDF="PDF",l.DOC="DOC",l.DOCX="DOCX",l.XLS="XLS",l.XLSX="XLSX",l.PPT="PPT",l.PPTX="PPTX",(f=r.FormStatus||(r.FormStatus={})).ACTIVE="ACTIVE",f.INACTIVE="INACTIVE",(p=r.FormValidate||(r.FormValidate={})).ANY="ANY",p.KEYS_ANY="KEYS_ANY",p.KEYS_ALL="KEYS_ALL",(m=r.FormKeyVisibility||(r.FormKeyVisibility={})).HIDDEN="HIDDEN",m.SHOWN="SHOWN",m.ADMIN="ADMIN",(d=r.FormElementType||(r.FormElementType={}))[d.DATE="DATE"]="DATE",d[d.EMAIL="EMAIL"]="EMAIL",d[d.FILE="FILE"]="FILE",d[d.LONG_TEXT="LONG_TEXT"]="LONG_TEXT",d[d.NUMBER="NUMBER"]="NUMBER",d[d.PHONE_NUMBER="PHONE_NUMBER"]="PHONE_NUMBER",d[d.SHORT_TEXT="SHORT_TEXT"]="SHORT_TEXT",d[d.TIME="TIME"]="TIME",d[d.URL="URL"]="URL",d[d.CHOICE="CHOICE"]="CHOICE",d[d.RADIO="RADIO"]="RADIO",d[d.BOOLEAN="BOOLEAN"]="BOOLEAN",d[d.CHECKBOX="CHECKBOX"]="CHECKBOX",d[d.PAGE="PAGE"]="PAGE",d[d.GROUP="GROUP"]="GROUP",d[d.STAR_RATING="STAR_RATING"]="STAR_RATING",d[d.NPS="NPS"]="NPS",d[d.HIDDEN="HIDDEN"]="HIDDEN",d[d.DROPDOWN="DROPDOWN"]="DROPDOWN",d[d.PAYMENT="PAYMENT"]="PAYMENT",(y=r.FormElementUploadTypes||(r.FormElementUploadTypes={}))[y.JPG="JPG"]="JPG",y[y.GIF="GIF"]="GIF",y[y.PNG="PNG"]="PNG",y[y.PDF="PDF"]="PDF",y[y.DOC="DOC"]="DOC",y[y.DOCX="DOCX"]="DOCX",y[y.XLS="XLS"]="XLS",y[y.XLSX="XLSX"]="XLSX",y[y.PPT="PPT"]="PPT",y[y.PPTX="PPTX"]="PPTX",(E=r.FormElementActionAction||(r.FormElementActionAction={}))[E.JUMP="JUMP"]="JUMP",E[E.SHOW="SHOW"]="SHOW",E[E.HIDE="HIDE"]="HIDE",(O=r.FormElementActionDetailsToType||(r.FormElementActionDetailsToType={}))[O.FIELD="FIELD"]="FIELD",O[O.HIDDEN="HIDDEN"]="HIDDEN",O[O.THANK_YOU="THANK_YOU"]="THANK_YOU";var F=function(){function r(r,t){var e,n;this.projectId=r,this.baseUrl=null!==(e=null==t?void 0:t.baseUrl)&&void 0!==e?e:"https://api.formium.io",this._fetcher=g(this.baseUrl,null!==(n=null==t?void 0:t.fetchImplementation)&&void 0!==n?n:fetch,null==t?void 0:t.apiToken)}var e=r.prototype;return e.findForms=function(r,e){var n="/v1/form?"+T.stringify(t({projectId:this.projectId},r));return this._fetcher(n,I({method:"GET",headers:{"Content-Type":"application/json"}},e)).then((function(r){return r.json()}))},e.getFormBySlug=function(r,e,n){var o={};return e&&e.revisionId&&(o={"X-Formik-Revision":e.revisionId}),this._fetcher("/v1/form/id/"+this.projectId+"/"+r,I({method:"GET",headers:t({"Content-Type":"application/json"},o)},n)).then((function(r){return r.json()}))},e.getFormById=function(r,e,n){var o={};return e&&e.revisionId&&(o={"X-Formik-Revision":e.revisionId}),this._fetcher("/v1/form/"+r,I({method:"GET",headers:t({"Content-Type":"application/json"},o)},n)).then((function(r){return r.json()}))},e.submitForm=function(r,t){var e;if(t instanceof FormData){for(var o,i={},a=n(t);!(o=a()).done;){var c=o.value,u=c[0],s=c[1];i.hasOwnProperty(u)?(Array.isArray(i[u])||(i[u]=[i[u]]),i[u].push(s)):i[u]=s}e=JSON.stringify(i)}else e=JSON.stringify(t);return this._fetcher("/submit/"+this.projectId+"/"+r,{method:"POST",headers:{"Content-Type":"application/json"},body:e}).then((function(r){return r.json()}))},e.uploadFile=function(r,t){var e=new FormData;return e.append("file",t),this._fetcher("/submit/"+this.projectId+"/"+r+"/upload",{method:"POST",body:e}).then((function(r){return r.headers.get("Location")}))},r}();return r.FormiumClient=F,r._createFetcher=g,r.createClient=function(r,t){return new F(r,t)},r}({}); | ||
//# sourceMappingURL=formium.umd.production.min.js.map |
{ | ||
"name": "@formium/client", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "Autogenerate IDs to facilitate WAI-ARIA and server rendering.", | ||
@@ -26,3 +26,3 @@ "author": "Jared Palmer <hello@formium.io>", | ||
"dependencies": { | ||
"@formium/utils": "^0.0.17", | ||
"@formium/utils": "^0.0.18", | ||
"cross-fetch": "^3.0.5", | ||
@@ -35,3 +35,3 @@ "query-string": "^6.13.1", | ||
}, | ||
"gitHead": "c61525f61c53a264979e18f61028105c2ea5d11e" | ||
"gitHead": "722fdd7e3781b5dce3792e6e7309c5969f4f8b22" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
252635
2145
+ Added@formium/utils@0.0.18(transitive)
- Removed@formium/utils@0.0.17(transitive)
Updated@formium/utils@^0.0.18