@constructor-io/constructorio-client-javascript 2.34.1 → 2.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constructorio.js +4 -1
- package/lib/modules/quizzes.js +3 -3
- package/package.json +1 -1
package/lib/constructorio.js
CHANGED
|
@@ -6,7 +6,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
6
6
|
|
|
7
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
8
|
|
|
9
|
-
/* eslint-disable camelcase, no-unneeded-ternary, max-len */
|
|
9
|
+
/* eslint-disable camelcase, no-unneeded-ternary, max-len, complexity */
|
|
10
10
|
var ConstructorioID = require('@constructor-io/constructorio-id');
|
|
11
11
|
|
|
12
12
|
var fetchPonyfill = require('fetch-ponyfill'); // Modules
|
|
@@ -56,6 +56,7 @@ var ConstructorIO = /*#__PURE__*/function () {
|
|
|
56
56
|
* @param {object} parameters - Parameters for client instantiation
|
|
57
57
|
* @param {string} parameters.apiKey - Constructor.io API key
|
|
58
58
|
* @param {string} [parameters.serviceUrl='https://ac.cnstrc.com'] - API URL endpoint
|
|
59
|
+
* @param {string} [parameters.quizzesServiceUrl='https://quizzes.cnstrc.com'] - Quizzes API URL endpoint
|
|
59
60
|
* @param {array} [parameters.segments] - User segments
|
|
60
61
|
* @param {object} [parameters.testCells] - User test cells
|
|
61
62
|
* @param {string} [parameters.clientId] - Client ID, defaults to value supplied by 'constructorio-id' module
|
|
@@ -85,6 +86,7 @@ var ConstructorIO = /*#__PURE__*/function () {
|
|
|
85
86
|
var apiKey = options.apiKey,
|
|
86
87
|
versionFromOptions = options.version,
|
|
87
88
|
serviceUrl = options.serviceUrl,
|
|
89
|
+
quizzesServiceUrl = options.quizzesServiceUrl,
|
|
88
90
|
segments = options.segments,
|
|
89
91
|
testCells = options.testCells,
|
|
90
92
|
clientId = options.clientId,
|
|
@@ -128,6 +130,7 @@ var ConstructorIO = /*#__PURE__*/function () {
|
|
|
128
130
|
apiKey: apiKey,
|
|
129
131
|
version: versionFromOptions || versionFromGlobal || computePackageVersion(),
|
|
130
132
|
serviceUrl: serviceUrl && serviceUrl.replace(/\/$/, '') || 'https://ac.cnstrc.com',
|
|
133
|
+
quizzesServiceUrl: quizzesServiceUrl && quizzesServiceUrl.replace(/\/$/, '') || 'https://quizzes.cnstrc.com',
|
|
131
134
|
sessionId: sessionId || session_id,
|
|
132
135
|
clientId: clientId || client_id,
|
|
133
136
|
userId: userId,
|
package/lib/modules/quizzes.js
CHANGED
|
@@ -22,8 +22,8 @@ function createQuizUrl(quizId, parameters, options, path) {
|
|
|
22
22
|
sessionId = options.sessionId,
|
|
23
23
|
segments = options.segments,
|
|
24
24
|
userId = options.userId,
|
|
25
|
-
version = options.version
|
|
26
|
-
|
|
25
|
+
version = options.version,
|
|
26
|
+
quizzesServiceUrl = options.quizzesServiceUrl;
|
|
27
27
|
var queryParams = {
|
|
28
28
|
c: version
|
|
29
29
|
};
|
|
@@ -77,7 +77,7 @@ function createQuizUrl(quizId, parameters, options, path) {
|
|
|
77
77
|
queryParams._dt = Date.now();
|
|
78
78
|
queryParams = helpers.cleanParams(queryParams);
|
|
79
79
|
var queryString = helpers.stringify(queryParams);
|
|
80
|
-
return "".concat(
|
|
80
|
+
return "".concat(quizzesServiceUrl, "/v1/quizzes/").concat(encodeURIComponent(quizId), "/").concat(encodeURIComponent(path), "/?").concat(queryString).concat(answersParamString);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Interface to quiz related API calls
|