@humany/serviceclient
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,2 +0,2 @@ | ||
import { getType } from '@humany/widget-core'; | ||
import { getType } from '@humany/utils'; | ||
import appendQueryString from './appendQueryString'; | ||
@@ -3,0 +3,0 @@ |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import { extend } from '@humany/widget-core'; | ||
import { extend } from '@humany/utils'; | ||
@@ -5,0 +5,0 @@ var Category = function Category(model, serviceClient) { |
@@ -7,3 +7,3 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
import { extend } from '@humany/widget-core'; | ||
import { extend } from '@humany/utils'; | ||
@@ -10,0 +10,0 @@ var CategoryCache = function () { |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import { extend } from '@humany/widget-core'; | ||
import { extend } from '@humany/utils'; | ||
@@ -5,0 +5,0 @@ var ContactMethod = function ContactMethod(model, serviceClient) { |
@@ -1,2 +0,2 @@ | ||
import { getType } from '@humany/widget-core'; | ||
import { getType } from '@humany/utils'; | ||
@@ -3,0 +3,0 @@ export default function createProxyArray(data, property, Template, serviceClient) { |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import { extend } from '@humany/widget-core'; | ||
import { extend } from '@humany/utils'; | ||
@@ -5,0 +5,0 @@ var Guide = function Guide(model, serviceClient) { |
@@ -5,3 +5,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
import { extend, getType, getCookie, setCookie } from '@humany/widget-core'; | ||
import { extend, getType, getCookie, setCookie } from '@humany/utils'; | ||
@@ -8,0 +8,0 @@ function normalize(parameters) { |
@@ -1,2 +0,2 @@ | ||
import { getCookie, setCookie } from '@humany/widget-core'; | ||
import { getCookie, setCookie } from '@humany/utils'; | ||
import createUUID from './createUUID'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { isFunction } from '@humany/widget-core'; | ||
import { isFunction } from '@humany/utils'; | ||
@@ -3,0 +3,0 @@ export default function result(obj, context) { |
@@ -13,3 +13,3 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
import { extend, isFunction } from '@humany/widget-core'; | ||
import { extend, isFunction } from '@humany/utils'; | ||
import appendParameters from './appendParameters'; | ||
@@ -16,0 +16,0 @@ import appendQueryString from './appendQueryString'; |
@@ -6,3 +6,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
import 'isomorphic-fetch'; | ||
import { isFunction, extend } from '@humany/widget-core'; | ||
import { isFunction, extend } from '@humany/utils'; | ||
import appendQueryString from './appendQueryString'; | ||
@@ -9,0 +9,0 @@ |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
@@ -23,3 +23,3 @@ var _appendQueryString = require('./appendQueryString'); | ||
var value = parameters[name]; | ||
if ((0, _widgetCore.getType)(value) === 'array') { | ||
if ((0, _utils.getType)(value) === 'array') { | ||
value.forEach(function (arrayValue) { | ||
@@ -26,0 +26,0 @@ appendedUrl = (0, _appendQueryString2.default)(appendedUrl, '' + parameterPrefix + name, arrayValue); |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
@@ -16,5 +16,5 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
(0, _widgetCore.extend)(true, this, model, { _client: serviceClient }); | ||
(0, _utils.extend)(true, this, model, { _client: serviceClient }); | ||
}; | ||
exports.default = Category; |
@@ -12,3 +12,3 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
@@ -70,3 +70,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
_this.categoriesPromise.then(function () { | ||
success((0, _widgetCore.extend)(true, {}, _this.categories)); | ||
success((0, _utils.extend)(true, {}, _this.categories)); | ||
}); | ||
@@ -81,3 +81,3 @@ } else { | ||
}).then(function () { | ||
success((0, _widgetCore.extend)(true, {}, _this.categories)); | ||
success((0, _utils.extend)(true, {}, _this.categories)); | ||
}); | ||
@@ -84,0 +84,0 @@ } |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
@@ -16,5 +16,5 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
(0, _widgetCore.extend)(true, this, model, { _client: serviceClient }); | ||
(0, _utils.extend)(true, this, model, { _client: serviceClient }); | ||
}; | ||
exports.default = ContactMethod; |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
@@ -16,3 +16,3 @@ function createProxyArray(data, property, Template, serviceClient) { | ||
var modelMember = model[property]; | ||
var modelMemberType = (0, _widgetCore.getType)(modelMember); | ||
var modelMemberType = (0, _utils.getType)(modelMember); | ||
if (model[property] && (modelMemberType === 'array' || modelMemberType === 'object')) { | ||
@@ -19,0 +19,0 @@ proxyClass[property] = createProxyArray(model, property, Template, serviceClient); |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
@@ -16,5 +16,5 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
(0, _widgetCore.extend)(true, this, model, { _client: serviceClient }); | ||
(0, _utils.extend)(true, this, model, { _client: serviceClient }); | ||
}; | ||
exports.default = Guide; |
@@ -10,3 +10,3 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
@@ -20,3 +20,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var value = parameters[key]; | ||
var valuesToAdd = (0, _widgetCore.getType)(value) === 'array' ? value : [value]; | ||
var valuesToAdd = (0, _utils.getType)(value) === 'array' ? value : [value]; | ||
valuesToAdd.forEach(function (valueToAdd) { | ||
@@ -47,3 +47,3 @@ if (typeof normalized[key] === 'undefined') { | ||
this.ensureIsLoaded(); | ||
return (0, _widgetCore.extend)(true, {}, this.parameters); | ||
return (0, _utils.extend)(true, {}, this.parameters); | ||
} | ||
@@ -96,3 +96,3 @@ }, { | ||
var stringData = JSON.stringify(this.parameters); | ||
(0, _widgetCore.setCookie)(cookieName, stringData, 1); | ||
(0, _utils.setCookie)(cookieName, stringData, 1); | ||
} catch (ex) { | ||
@@ -108,3 +108,3 @@ // eslint-disable-next-line | ||
try { | ||
var stringData = (0, _widgetCore.getCookie)(cookieName); | ||
var stringData = (0, _utils.getCookie)(cookieName); | ||
this.parameters = stringData ? JSON.parse(stringData) : {}; | ||
@@ -111,0 +111,0 @@ } catch (ex) { |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
@@ -25,6 +25,6 @@ var _createUUID = require('./createUUID'); | ||
var days = arguments.length >= 1 ? arguments.length <= 0 ? undefined : arguments[0] : 1; | ||
var clientId = (0, _widgetCore.getCookie)(clientIdCookieName); | ||
var clientId = (0, _utils.getCookie)(clientIdCookieName); | ||
if (!clientId) { | ||
clientId = (0, _createUUID2.default)(); | ||
(0, _widgetCore.setCookie)(clientIdCookieName, clientId, days); | ||
(0, _utils.setCookie)(clientIdCookieName, clientId, days); | ||
} | ||
@@ -31,0 +31,0 @@ return clientId; |
@@ -8,7 +8,7 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
function result(obj, context) { | ||
// If the object is a function then invoke, otherwise return it. | ||
if ((0, _widgetCore.isFunction)(obj)) { | ||
if ((0, _utils.isFunction)(obj)) { | ||
return context ? obj.call(context) : obj.call(window); | ||
@@ -15,0 +15,0 @@ } |
@@ -15,3 +15,3 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
@@ -66,3 +66,3 @@ var _appendParameters = require('./appendParameters'); | ||
this.proxy = typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'string' ? new _ServiceProxy2.default(arguments.length <= 0 ? undefined : arguments[0]) : arguments.length <= 0 ? undefined : arguments[0]; | ||
this.settings = (0, _widgetCore.extend)(true, {}, ServiceClient.defaults, (arguments.length <= 1 ? undefined : arguments[1]) || {}); | ||
this.settings = (0, _utils.extend)(true, {}, ServiceClient.defaults, (arguments.length <= 1 ? undefined : arguments[1]) || {}); | ||
this.parameters = new _ParameterBag2.default(arguments.length <= 2 ? undefined : arguments[2]); | ||
@@ -127,3 +127,3 @@ this.current = { phrase: options.phrase }; | ||
var path = endpoint; | ||
var config = (0, _widgetCore.extend)(this.getConfiguration(), customConfiguration); | ||
var config = (0, _utils.extend)(this.getConfiguration(), customConfiguration); | ||
Object.keys(config).filter(function (key) { | ||
@@ -163,3 +163,3 @@ var value = config[key]; | ||
function onSuccess(response) { | ||
if ((0, _widgetCore.isFunction)(success)) { | ||
if ((0, _utils.isFunction)(success)) { | ||
var serviceClient = this; | ||
@@ -177,3 +177,3 @@ // eslint-disable-next-line no-param-reassign | ||
function onError(response) { | ||
if ((0, _widgetCore.isFunction)(error)) { | ||
if ((0, _utils.isFunction)(error)) { | ||
error(response); | ||
@@ -183,3 +183,3 @@ } | ||
var configuration = (0, _widgetCore.extend)(true, this.getConfiguration(), this.settings.paging, options); | ||
var configuration = (0, _utils.extend)(true, this.getConfiguration(), this.settings.paging, options); | ||
var data = {}; | ||
@@ -258,3 +258,3 @@ var verb = 'GET'; | ||
function onSuccess(response) { | ||
if ((0, _widgetCore.isFunction)(success)) { | ||
if ((0, _utils.isFunction)(success)) { | ||
var guide = this.settings.useProxyClasses && response ? new _Guide2.default(response, this) : response; | ||
@@ -268,3 +268,3 @@ this.guideCache[guide.Id] = guide; | ||
function onError(response) { | ||
if ((0, _widgetCore.isFunction)(error)) { | ||
if ((0, _utils.isFunction)(error)) { | ||
error(response); | ||
@@ -274,3 +274,3 @@ } | ||
var configuration = (0, _widgetCore.extend)(true, this.getConfiguration(), options); | ||
var configuration = (0, _utils.extend)(true, this.getConfiguration(), options); | ||
var data = {}; | ||
@@ -294,5 +294,5 @@ var verb = 'GET'; | ||
verb = 'POST'; | ||
path = this.constructPath(endpoint, (0, _widgetCore.extend)({}, this.current, options)); | ||
path = this.constructPath(endpoint, (0, _utils.extend)({}, this.current, options)); | ||
} else { | ||
path = this.constructPath(endpoint, (0, _widgetCore.extend)({}, this.current, options), false); | ||
path = this.constructPath(endpoint, (0, _utils.extend)({}, this.current, options), false); | ||
} | ||
@@ -325,3 +325,3 @@ | ||
function onSuccess(response) { | ||
if ((0, _widgetCore.isFunction)(success)) { | ||
if ((0, _utils.isFunction)(success)) { | ||
var serviceClient = this; | ||
@@ -339,3 +339,3 @@ // eslint-disable-next-line no-param-reassign | ||
function onError(response) { | ||
if ((0, _widgetCore.isFunction)(error)) error(response); | ||
if ((0, _utils.isFunction)(error)) error(response); | ||
} | ||
@@ -347,3 +347,3 @@ | ||
} | ||
var path = this.constructPath(endpoint, (0, _widgetCore.extend)({}, this.current, options)); | ||
var path = this.constructPath(endpoint, (0, _utils.extend)({}, this.current, options)); | ||
@@ -390,3 +390,3 @@ return this.proxy.request(path, { | ||
removeParameterFromBag(); | ||
if ((0, _widgetCore.isFunction)(success)) { | ||
if ((0, _utils.isFunction)(success)) { | ||
var _guide = this.settings.useProxyClasses && response ? new _Guide2.default(response, this) : response; | ||
@@ -400,3 +400,3 @@ this.guideCache[_guide.Id] = _guide; | ||
removeParameterFromBag(); | ||
if ((0, _widgetCore.isFunction)(error)) error(response); | ||
if ((0, _utils.isFunction)(error)) error(response); | ||
} | ||
@@ -416,3 +416,3 @@ | ||
var endpoint = 'guides/' + guideId + '/' + connectionId; | ||
var path = this.constructPath(endpoint, (0, _widgetCore.extend)({}, this.current, options)); | ||
var path = this.constructPath(endpoint, (0, _utils.extend)({}, this.current, options)); | ||
@@ -460,3 +460,3 @@ return this.proxy.request(path, { | ||
function onSuccess(response) { | ||
if ((0, _widgetCore.isFunction)(success)) { | ||
if ((0, _utils.isFunction)(success)) { | ||
success(response); | ||
@@ -468,3 +468,3 @@ } | ||
function onError(response) { | ||
if ((0, _widgetCore.isFunction)(error)) { | ||
if ((0, _utils.isFunction)(error)) { | ||
error(response); | ||
@@ -476,3 +476,3 @@ } | ||
var endpoint = 'guides/' + id + (connectionId ? '/' + connectionId : '') + '/feedback'; | ||
var path = this.constructPath(endpoint, (0, _widgetCore.extend)({}, options, { feedbackType: feedbackType })); | ||
var path = this.constructPath(endpoint, (0, _utils.extend)({}, options, { feedbackType: feedbackType })); | ||
@@ -505,7 +505,7 @@ return this.proxy.request(path, { | ||
function onSuccess(response) { | ||
if ((0, _widgetCore.isFunction)(success)) success(response); | ||
if ((0, _utils.isFunction)(success)) success(response); | ||
} | ||
function onError(response) { | ||
if ((0, _widgetCore.isFunction)(error)) error(response); | ||
if ((0, _utils.isFunction)(error)) error(response); | ||
} | ||
@@ -542,11 +542,11 @@ | ||
function onSuccess(response) { | ||
if ((0, _widgetCore.isFunction)(success)) success(response.ContactMethod); | ||
if ((0, _utils.isFunction)(success)) success(response.ContactMethod); | ||
} | ||
function onError(response) { | ||
if ((0, _widgetCore.isFunction)(error)) error(response); | ||
if ((0, _utils.isFunction)(error)) error(response); | ||
} | ||
var endpoint = 'contactmethods/' + contactMethodId; | ||
var path = this.constructPath(endpoint, (0, _widgetCore.extend)({}, this.current, options)); | ||
var path = this.constructPath(endpoint, (0, _utils.extend)({}, this.current, options)); | ||
@@ -585,3 +585,3 @@ return this.proxy.request(path, { | ||
function onSuccess(response) { | ||
if ((0, _widgetCore.isFunction)(success)) { | ||
if ((0, _utils.isFunction)(success)) { | ||
// eslint-disable-next-line no-param-reassign | ||
@@ -598,3 +598,3 @@ response = this.settings.useProxyClasses && response ? function () { | ||
function onError(response) { | ||
if ((0, _widgetCore.isFunction)(error)) error(response); | ||
if ((0, _utils.isFunction)(error)) error(response); | ||
@@ -605,3 +605,3 @@ return response; | ||
var endpoint = guideId ? 'guides/' + guideId + '/contactmethods' : 'contactmethods'; | ||
var path = this.constructPath(endpoint, (0, _widgetCore.extend)({}, this.current, options)); | ||
var path = this.constructPath(endpoint, (0, _utils.extend)({}, this.current, options)); | ||
@@ -646,3 +646,3 @@ return this.proxy.request(path, { | ||
function onSuccess(response) { | ||
if ((0, _widgetCore.isFunction)(success)) { | ||
if ((0, _utils.isFunction)(success)) { | ||
if (response && this.settings.useProxyClasses) { | ||
@@ -664,6 +664,6 @@ if (response.Children) { | ||
function onError(response) { | ||
if ((0, _widgetCore.isFunction)(error)) error(response); | ||
if ((0, _utils.isFunction)(error)) error(response); | ||
} | ||
var path = this.constructPath('contacts/' + (guideOrCategoryId || ''), (0, _widgetCore.extend)({}, this.current, options)); | ||
var path = this.constructPath('contacts/' + (guideOrCategoryId || ''), (0, _utils.extend)({}, this.current, options)); | ||
@@ -689,3 +689,3 @@ return this.proxy.request(path, { | ||
/* eslint-enable */ | ||
path = this.constructPath('config', (0, _widgetCore.extend)({}, this.current, data)); | ||
path = this.constructPath('config', (0, _utils.extend)({}, this.current, data)); | ||
return this.proxy.request(path, 'POST', data, success, error); | ||
@@ -692,0 +692,0 @@ } |
@@ -11,3 +11,3 @@ 'use strict'; | ||
var _widgetCore = require('@humany/widget-core'); | ||
var _utils = require('@humany/utils'); | ||
@@ -27,3 +27,3 @@ var _appendQueryString = require('./appendQueryString'); | ||
var interceptorHandler = interceptors[i][interceptorType]; | ||
if ((0, _widgetCore.isFunction)(interceptorHandler)) { | ||
if ((0, _utils.isFunction)(interceptorHandler)) { | ||
sequence = sequence.then(function () { | ||
@@ -69,3 +69,3 @@ return interceptorHandler(data, options); | ||
value: function request(path, options) { | ||
var localOptions = (0, _widgetCore.extend)(true, {}, this.globalOptions, options); | ||
var localOptions = (0, _utils.extend)(true, {}, this.globalOptions, options); | ||
var url = this.constructUrl(path); | ||
@@ -99,3 +99,3 @@ var interceptors = this.interceptors; | ||
invokeInterceptors(interceptors, 'responseError', response).then(function (interceptedError) { | ||
if ((0, _widgetCore.isFunction)(localOptions.onError)) { | ||
if ((0, _utils.isFunction)(localOptions.onError)) { | ||
localOptions.onError(interceptedError); | ||
@@ -108,3 +108,3 @@ } | ||
invokeInterceptors(interceptors, 'responseError', error).then(function (interceptedError) { | ||
if ((0, _widgetCore.isFunction)(localOptions.onError)) { | ||
if ((0, _utils.isFunction)(localOptions.onError)) { | ||
localOptions.onError(interceptedError); | ||
@@ -111,0 +111,0 @@ } |
{ | ||
"name": "@humany/serviceclient", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"keywords": [ | ||
@@ -25,3 +25,3 @@ "humany" | ||
"dependencies": { | ||
"@humany/widget-core": "^1.0.0-beta.18", | ||
"@humany/utils": "^1.0.0-beta.19", | ||
"isomorphic-fetch": "^2.2.1" | ||
@@ -56,3 +56,3 @@ }, | ||
"license": "SEE LICENSE IN LICENSE.txt", | ||
"gitHead": "cf990abd92b3bd7e9c87e6187b2a7dcc47f3f2f7" | ||
"gitHead": "7643af5c29a3d4678b0da1c62996bfc3eec8f937" | ||
} |
@@ -162,3 +162,3 @@ # @humany/serviceclient | ||
```javascript | ||
import { Plugin } from '@webprovisions/platform'; | ||
import { Plugin } from '@humany/widget-core'; | ||
@@ -165,0 +165,0 @@ class MyPlugin extends Plugin { |
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
107146
+ Added@humany/utils@^1.0.0-beta.19
+ Added@humany/utils@1.1.6(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@16.14.0(transitive)
+ Addedreact-is@16.13.1(transitive)
- Removed@humany/widget-core@^1.0.0-beta.18
- Removed@humany/widget-core@1.0.15(transitive)
- Removed@webprovisions/bootstrapping@1.0.14(transitive)