@availity/native-form
Advanced tools
Comparing version 2.8.7 to 2.8.10
@@ -6,17 +6,12 @@ # Change Log | ||
## [2.8.7](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.6...@availity/native-form@2.8.7) (2020-01-14) | ||
## [2.8.10](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.7...@availity/native-form@2.8.10) (2020-02-13) | ||
**Note:** Version bump only for package @availity/native-form | ||
### Bug Fixes | ||
* **native-form:** fixed error trying to call toString on undefined ([c009460](https://github.com/Availity/sdk-js/commit/c009460)) | ||
* **native-form:** updated handling of falsey values ([ab57615](https://github.com/Availity/sdk-js/commit/ab57615)) | ||
* **native-form:** updated test suite name ([fbf824c](https://github.com/Availity/sdk-js/commit/fbf824c)) | ||
## [2.8.9](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.8...@availity/native-form@2.8.9) (2020-02-13) | ||
## [2.8.6](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.5...@availity/native-form@2.8.6) (2020-01-03) | ||
**Note:** Version bump only for package @availity/native-form | ||
@@ -28,3 +23,3 @@ | ||
## [2.8.5](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.4...@availity/native-form@2.8.5) (2020-01-03) | ||
## [2.8.8](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.7...@availity/native-form@2.8.8) (2020-02-13) | ||
@@ -37,29 +32,32 @@ **Note:** Version bump only for package @availity/native-form | ||
## [2.8.4](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.3...@availity/native-form@2.8.4) (2019-10-29) | ||
## [2.8.7](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.6...@availity/native-form@2.8.7) (2020-01-14) | ||
**Note:** Version bump only for package @availity/native-form | ||
### Bug Fixes | ||
- **native-form:** fixed error trying to call toString on undefined ([c009460](https://github.com/Availity/sdk-js/commit/c009460)) | ||
- **native-form:** updated handling of falsey values ([ab57615](https://github.com/Availity/sdk-js/commit/ab57615)) | ||
- **native-form:** updated test suite name ([fbf824c](https://github.com/Availity/sdk-js/commit/fbf824c)) | ||
## [2.8.6](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.5...@availity/native-form@2.8.6) (2020-01-03) | ||
**Note:** Version bump only for package @availity/native-form | ||
## [2.8.5](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.4...@availity/native-form@2.8.5) (2020-01-03) | ||
## [2.8.3](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.2...@availity/native-form@2.8.3) (2019-09-27) | ||
**Note:** Version bump only for package @availity/native-form | ||
## [2.8.4](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.3...@availity/native-form@2.8.4) (2019-10-29) | ||
**Note:** Version bump only for package @availity/native-form | ||
## [2.8.3](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.2...@availity/native-form@2.8.3) (2019-09-27) | ||
**Note:** Version bump only for package @availity/native-form | ||
## [2.8.2](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.1...@availity/native-form@2.8.2) (2019-02-20) | ||
### Bug Fixes | ||
* append function is not defined for ie and edge mobile ([d995343](https://github.com/Availity/sdk-js/commit/d995343)) | ||
- append function is not defined for ie and edge mobile ([d995343](https://github.com/Availity/sdk-js/commit/d995343)) | ||
## [2.8.1](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.0...@availity/native-form@2.8.1) (2019-02-12) | ||
@@ -69,32 +67,20 @@ | ||
# 2.8.0 (2019-02-12) | ||
# 2.5.0 (2018-08-20) | ||
### Features | ||
* **native-form:** add native form ([#62](https://github.com/Availity/sdk-js/issues/62)) ([8aa0471](https://github.com/Availity/sdk-js/commit/8aa0471)) | ||
- **native-form:** add native form ([#62](https://github.com/Availity/sdk-js/issues/62)) ([8aa0471](https://github.com/Availity/sdk-js/commit/8aa0471)) | ||
<a name="2.7.0"></a> | ||
<a name="2.7.0"></a> | ||
# 2.7.0 (2018-11-20) | ||
<a name="2.5.0"></a> | ||
<a name="2.5.0"></a> | ||
# 2.5.0 (2018-08-20) | ||
### Features | ||
* **native-form:** add native form ([#62](https://github.com/Availity/sdk-js/issues/62)) ([8aa0471](https://github.com/Availity/sdk-js/commit/8aa0471)) | ||
- **native-form:** add native form ([#62](https://github.com/Availity/sdk-js/issues/62)) ([8aa0471](https://github.com/Availity/sdk-js/commit/8aa0471)) |
@@ -1,30 +0,24 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
// Copied from https://github.com/Availity/sdk-js/blob/master/packages/native-form/flattenObject.js | ||
const parseValue = value => { | ||
var parseValue = function parseValue(value) { | ||
return value === undefined || value === null ? value : value.toString(); | ||
}; | ||
const flattenObject = ob => Object.keys(ob).reduce((toReturn, k) => { | ||
if (Object.prototype.toString.call(ob[k]) === '[object Date]') { | ||
toReturn[k] = ob[k].toJSON(); | ||
} else if (ob[k] && typeof ob[k] === 'object') { | ||
const flatObject = flattenObject(ob[k]); | ||
const isArray = Array.isArray(ob[k]); | ||
Object.keys(flatObject).forEach(k2 => { | ||
toReturn[`${k}${isArray ? k2.replace(/^(\d+)(\..*)?/, '[$1]$2') : `.${k2}`}`] = parseValue(flatObject[k2]); | ||
}); | ||
} else { | ||
toReturn[k] = parseValue(ob[k]); | ||
} | ||
var flattenObject = function flattenObject(ob) { | ||
return Object.keys(ob).reduce(function (toReturn, k) { | ||
if (Object.prototype.toString.call(ob[k]) === '[object Date]') { | ||
toReturn[k] = ob[k].toJSON(); | ||
} else if (ob[k] && typeof ob[k] === 'object') { | ||
var flatObject = flattenObject(ob[k]); | ||
var isArray = Array.isArray(ob[k]); | ||
Object.keys(flatObject).forEach(function (k2) { | ||
toReturn["".concat(k).concat(isArray ? k2.replace(/^(\d+)(\..*)?/, '[$1]$2') : ".".concat(k2))] = parseValue(flatObject[k2]); | ||
}); | ||
} else { | ||
toReturn[k] = parseValue(ob[k]); | ||
} | ||
return toReturn; | ||
}, {}); | ||
return toReturn; | ||
}, {}); | ||
}; | ||
var _default = flattenObject; | ||
exports.default = _default; | ||
export default flattenObject; |
@@ -1,38 +0,29 @@ | ||
"use strict"; | ||
import _objectSpread from "/home/circleci/project/node_modules/@babel/runtime/helpers/esm/objectSpread2"; | ||
import flattenObject from './flattenObject'; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var required = function required(field) { | ||
throw new Error("".concat(field, " is required and was not provided")); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
export default (function () { | ||
var spaceId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : required('spaceId'); | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var formAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'saml'; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _flattenObject = _interopRequireDefault(require("./flattenObject")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
const required = field => { | ||
throw new Error(`${field} is required and was not provided`); | ||
}; | ||
var _default = (spaceId = required('spaceId'), params = {}, formAttributes = {}, type = 'saml') => { | ||
const mergedOptions = _objectSpread({ | ||
var mergedOptions = _objectSpread({ | ||
method: 'post', | ||
action: `/ms/api/availity/internal/spc/magneto/sso/v1/${type}/${spaceId}`, | ||
action: "/ms/api/availity/internal/spc/magneto/sso/v1/".concat(type, "/").concat(spaceId), | ||
target: '_blank' | ||
}, formAttributes); | ||
const form = document.createElement('form'); | ||
Object.keys(mergedOptions).forEach(key => { | ||
var form = document.createElement('form'); | ||
Object.keys(mergedOptions).forEach(function (key) { | ||
form.setAttribute(key, mergedOptions[key]); | ||
}); | ||
const flat = (0, _flattenObject.default)(params); | ||
const fields = Object.keys(flat).map(key => { | ||
const name = key.replace(/\[\d+\]/g, '[]'); | ||
const value = flat[key]; | ||
return `<input type="hidden" name="${name}" value="${value}" />`; | ||
var flat = flattenObject(params); | ||
var fields = Object.keys(flat).map(function (key) { | ||
var name = key.replace(/\[\d+\]/g, '[]'); | ||
var value = flat[key]; | ||
return "<input type=\"hidden\" name=\"".concat(name, "\" value=\"").concat(value, "\" />"); | ||
}).join(''); | ||
@@ -43,4 +34,2 @@ form.insertAdjacentHTML('beforeend', fields); // eslint-disable-next-line unicorn/prefer-node-append | ||
form.submit(); | ||
}; | ||
exports.default = _default; | ||
}); |
{ | ||
"name": "@availity/native-form", | ||
"version": "2.8.7", | ||
"version": "2.8.10", | ||
"description": "Submit JSON data via a native form, not AJAX. Useful when you need to open a new page with a POST action.", | ||
@@ -22,3 +22,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "8622ddc58ced5e0651354cb1f64ce852f657d5f6" | ||
"gitHead": "88c0e7b48de05f599a97ad3547f8b96c63e2004e" | ||
} |
@@ -9,6 +9,14 @@ # native form | ||
### NPM | ||
```bash | ||
$ npm install @availity/native-form | ||
``` | ||
npm install @availity/native-form --save | ||
### Yarn | ||
```bash | ||
$ yarn add @availity/native-form | ||
``` | ||
## [Documentation](https://availity.github.io/sdk-js/features/native-form) |
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
22
16380
305