@lighthouse/sdk
Advanced tools
Comparing version 9.0.0-beta-3 to 9.0.0-beta-4
@@ -6,7 +6,7 @@ 'use strict'; | ||
}); | ||
exports.validateFn = undefined; | ||
exports.validateFn = exports.schema = undefined; | ||
var _reduxFormSchema = require('redux-form-schema'); | ||
var schema = { | ||
var schema = exports.schema = { | ||
firstName: { | ||
@@ -13,0 +13,0 @@ label: 'First Name' |
@@ -7,2 +7,21 @@ 'use strict'; | ||
exports.speakerIdSelector = exports.askPermission = exports.getPermissions = exports.getCurrentApplication = exports.QUERY_ERROR = exports.QUERY_SUCCESS = exports.QUERY_REQUEST = undefined; | ||
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; }; /* | ||
* User Applications Module | ||
* | ||
* Example State: | ||
* ============== | ||
* | ||
* { | ||
* current: '1', | ||
* list: [{ | ||
* _id: '1', | ||
* name: 'Application1' | ||
* }, { | ||
* _id: '2', | ||
* name: 'Application2' | ||
* }] | ||
* } | ||
*/ | ||
exports.reducer = reducer; | ||
@@ -42,19 +61,3 @@ exports.queryRequest = queryRequest; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* | ||
* User Applications Module | ||
* | ||
* Example State: | ||
* ============== | ||
* | ||
* { | ||
* current: '1', | ||
* list: [{ | ||
* _id: '1', | ||
* name: 'Application1' | ||
* }, { | ||
* _id: '2', | ||
* name: 'Application2' | ||
* }] | ||
* } | ||
*/ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -74,45 +77,61 @@ var QUERY_REQUEST = exports.QUERY_REQUEST = 'lighthouse/user-applications/QUERY_REQUEST'; | ||
switch (action.type) { | ||
case QUERY_REQUEST: | ||
return state.set('state', 'resolving'); | ||
// TODO API needs updating to match expected response | ||
case QUERY_SUCCESS: | ||
return state.merge({ | ||
state: 'resolved', | ||
applications: action.data | ||
}); | ||
case QUERY_ERROR: | ||
return state.merge({ | ||
state: 'resolved', | ||
error: action.error | ||
}); | ||
case _authentication.AUTHENTICATE_SUCCESS: | ||
return state.merge({ | ||
state: 'resolved', | ||
applications: action.data.applications | ||
}); | ||
/** | ||
NOTE | ||
We need to handle this here for when users have never logged into the app | ||
before. The speakerId is stored on a users' userApplication, but if | ||
they're a new user, when they first login then they won't have a speakerId | ||
in the place. So what we do here is use the speakerId returned by | ||
messagesRegistration and set that on the speakerbox configuration for that | ||
user | ||
*/ | ||
case _applicationUsers.actions.MESSAGES_REGISTRATION_SUCCESS: | ||
action.data = action.data || {}; | ||
var _action$data = action.data, | ||
applicationId = _action$data.applicationId, | ||
speakerId = _action$data.speakerId; | ||
var _ret = function () { | ||
switch (action.type) { | ||
case QUERY_REQUEST: | ||
return { | ||
v: state.set('state', 'resolving') | ||
}; | ||
// TODO API needs updating to match expected response | ||
case QUERY_SUCCESS: | ||
return { | ||
v: state.merge({ | ||
state: 'resolved', | ||
applications: action.data | ||
}) | ||
}; | ||
case QUERY_ERROR: | ||
return { | ||
v: state.merge({ | ||
state: 'resolved', | ||
error: action.error | ||
}) | ||
}; | ||
case _authentication.AUTHENTICATE_SUCCESS: | ||
return { | ||
v: state.merge({ | ||
state: 'resolved', | ||
applications: action.data.applications | ||
}) | ||
}; | ||
/** | ||
NOTE | ||
We need to handle this here for when users have never logged into the app | ||
before. The speakerId is stored on a users' userApplication, but if | ||
they're a new user, when they first login then they won't have a speakerId | ||
in the place. So what we do here is use the speakerId returned by | ||
messagesRegistration and set that on the speakerbox configuration for that | ||
user | ||
*/ | ||
case _applicationUsers.actions.MESSAGES_REGISTRATION_SUCCESS: | ||
action.data = action.data || {}; | ||
var _action$data = action.data, | ||
applicationId = _action$data.applicationId, | ||
speakerId = _action$data.speakerId; | ||
return state.set('applications', (0, _map2.default)(state.applications, function (userApplication) { | ||
var matchesApplication = (0, _get2.default)(userApplication, 'application._id', '') === applicationId; | ||
if (!matchesApplication) return userApplication; | ||
return { | ||
v: state.set('applications', (0, _map2.default)(state.applications, function (userApplication) { | ||
var matchesApplication = (0, _get2.default)(userApplication, 'application._id', '') === applicationId; | ||
if (!matchesApplication) return userApplication; | ||
return userApplication.setIn(['speakerbox', 'speakerId'], speakerId); | ||
})); | ||
default: | ||
return state; | ||
} | ||
return userApplication.setIn(['speakerbox', 'speakerId'], speakerId); | ||
})) | ||
}; | ||
default: | ||
return { | ||
v: state | ||
}; | ||
} | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
} | ||
@@ -119,0 +138,0 @@ |
@@ -16,3 +16,3 @@ 'use strict'; | ||
lastName: { | ||
label: 'First Name', | ||
label: 'Last Name', | ||
required: true | ||
@@ -19,0 +19,0 @@ }, |
{ | ||
"name": "@lighthouse/sdk", | ||
"version": "9.0.0-beta-3", | ||
"version": "9.0.0-beta-4", | ||
"description": "Lighthouse.io SDK for JavaScript applications", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
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
529386
5477