@solution-center/communicator 4.0.0
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/README.md +27 -0
- package/dist/solutioncenter.communicator.js +256 -0
- package/package.json +27 -0
package/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# @solution-center/communicator
|
2
|
+
|
3
|
+
solution-center communicator sdk.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
- ES6 syntax, managed with Prettier + Eslint and Stylelint
|
8
|
+
- Unit testing
|
9
|
+
- AngularJS 1
|
10
|
+
- ESM
|
11
|
+
|
12
|
+
## Install
|
13
|
+
|
14
|
+
```sh
|
15
|
+
yarn add @solution-center/communicator
|
16
|
+
// or
|
17
|
+
npm i @solution-center/communicator
|
18
|
+
```
|
19
|
+
|
20
|
+
### Usage
|
21
|
+
|
22
|
+
```js
|
23
|
+
import angular from 'angular';
|
24
|
+
import communicatorModule from '@solution-center/communicator';
|
25
|
+
|
26
|
+
angular.module('myApp', [communicatorModule]);
|
27
|
+
```
|
@@ -0,0 +1,256 @@
|
|
1
|
+
(function e(t, n, r) {
|
2
|
+
function s(o, u) {
|
3
|
+
if (!n[o]) {
|
4
|
+
if (!t[o]) {
|
5
|
+
var a = typeof require == "function" && require;
|
6
|
+
if (!u && a) return a(o, !0);
|
7
|
+
if (i) return i(o, !0);
|
8
|
+
var f = new Error("Cannot find module '" + o + "'");
|
9
|
+
throw ((f.code = "MODULE_NOT_FOUND"), f);
|
10
|
+
}
|
11
|
+
var l = (n[o] = { exports: {} });
|
12
|
+
t[o][0].call(
|
13
|
+
l.exports,
|
14
|
+
function (e) {
|
15
|
+
var n = t[o][1][e];
|
16
|
+
return s(n ? n : e);
|
17
|
+
},
|
18
|
+
l,
|
19
|
+
l.exports,
|
20
|
+
e,
|
21
|
+
t,
|
22
|
+
n,
|
23
|
+
r
|
24
|
+
);
|
25
|
+
}
|
26
|
+
return n[o].exports;
|
27
|
+
}
|
28
|
+
var i = typeof require == "function" && require;
|
29
|
+
for (var o = 0; o < r.length; o++) s(r[o]);
|
30
|
+
return s;
|
31
|
+
})(
|
32
|
+
{
|
33
|
+
1: [
|
34
|
+
function (require, module, exports) {
|
35
|
+
module.exports.DEFAULT_ENVIRONMENT = "INTEGRATION";
|
36
|
+
module.exports.ENVIRONMENTS = {
|
37
|
+
PRODUCTION: {
|
38
|
+
NAME: "PRODUCTION",
|
39
|
+
URL: "https://solutions.zalan.do",
|
40
|
+
DOMAIN: "solutions.zalan.do",
|
41
|
+
PORT: "",
|
42
|
+
USER_SERVICE_OLD: "https://user-management.norris.zalan.do",
|
43
|
+
TOKEN_SERVICE_OLD: "https://token-management.norris.zalan.do",
|
44
|
+
MERCHANT_SERVICE: "https://merchant-management.norris.zalan.do",
|
45
|
+
GOODDATA_SERVICE: "https://gooddata.norris.zalan.do",
|
46
|
+
INSIGHTS_SERVICE: "https://insights-service.norris.zalan.do",
|
47
|
+
MODULE_SERVICE: "https://module-service.norris.zalan.do",
|
48
|
+
USER_SERVICE: "https://user-service.norris.zalan.do",
|
49
|
+
USER_MANAGEMENT: "https://account.solutions.zalan.do",
|
50
|
+
LOGIN_APPLICATION: "https://login.solutions.zalan.do",
|
51
|
+
},
|
52
|
+
STAGE: {
|
53
|
+
NAME: "STAGE",
|
54
|
+
URL: "https://sc-stage.norris.zalan.do",
|
55
|
+
DOMAIN: ".zalan.do",
|
56
|
+
PORT: "",
|
57
|
+
USER_SERVICE_OLD: "https://um-stage.norris.zalan.do",
|
58
|
+
TOKEN_SERVICE_OLD: "https://tm-stage.norris.zalan.do",
|
59
|
+
MERCHANT_SERVICE: "https://merchant-stage.norris.zalan.do",
|
60
|
+
GOODDATA_SERVICE: "https://gooddata-stage.norris.zalan.do",
|
61
|
+
INSIGHTS_SERVICE: "https://is-stage.norris.zalan.do",
|
62
|
+
MODULE_SERVICE: "https://ms-stage.norris.zalan.do",
|
63
|
+
USER_SERVICE: "https://us-stage.norris.zalan.do",
|
64
|
+
USER_MANAGEMENT: "https://account-stage.norris.zalan.do",
|
65
|
+
LOGIN_APPLICATION:
|
66
|
+
"https://login-application.partner-solutions-test.zalan.do",
|
67
|
+
},
|
68
|
+
INTEGRATION: {
|
69
|
+
NAME: "INTEGRATION",
|
70
|
+
URL: "https://sc-integration.norris.zalan.do",
|
71
|
+
DOMAIN: ".zalan.do",
|
72
|
+
PORT: "",
|
73
|
+
USER_SERVICE_OLD: "https://um-integration.norris.zalan.do",
|
74
|
+
TOKEN_SERVICE_OLD: "https://tm-integration.norris.zalan.do",
|
75
|
+
MERCHANT_SERVICE: "https://merchant-integration.norris.zalan.do",
|
76
|
+
GOODDATA_SERVICE: "https://gooddata-integration.norris.zalan.do",
|
77
|
+
INSIGHTS_SERVICE: "https://is-integration.norris.zalan.do",
|
78
|
+
MODULE_SERVICE: "https://ms-integration.norris.zalan.do",
|
79
|
+
USER_SERVICE: "https://us-integration.norris.zalan.do",
|
80
|
+
USER_MANAGEMENT: "https://account-integration.norris.zalan.do",
|
81
|
+
LOGIN_APPLICATION:
|
82
|
+
"https://login-application.partner-solutions-test.zalan.do",
|
83
|
+
},
|
84
|
+
LOCAL: {
|
85
|
+
NAME: "LOCAL",
|
86
|
+
URL: "http://localhost",
|
87
|
+
DOMAIN: "localhost",
|
88
|
+
PORT: 3333,
|
89
|
+
USER_SERVICE_OLD: "https://um-integration.norris.zalan.do",
|
90
|
+
TOKEN_SERVICE_OLD: "https://tm-integration.norris.zalan.do",
|
91
|
+
MERCHANT_SERVICE: "https://merchant-integration.norris.zalan.do",
|
92
|
+
GOODDATA_SERVICE: "https://gooddata-integration.norris.zalan.do",
|
93
|
+
INSIGHTS_SERVICE: "https://is-integration.norris.zalan.do",
|
94
|
+
MODULE_SERVICE: "https://ms-integration.norris.zalan.do",
|
95
|
+
USER_SERVICE: "https://us-integration.norris.zalan.do",
|
96
|
+
USER_MANAGEMENT: "http://localhost:3000",
|
97
|
+
LOGIN_APPLICATION: "http://localhost:3003",
|
98
|
+
},
|
99
|
+
TESTING: {
|
100
|
+
NAME: "TESTING",
|
101
|
+
URL: "",
|
102
|
+
DOMAIN: "",
|
103
|
+
PORT: "",
|
104
|
+
USER_SERVICE_OLD: "",
|
105
|
+
TOKEN_SERVICE_OLD: "",
|
106
|
+
MERCHANT_SERVICE: "",
|
107
|
+
GOODDATA_SERVICE: "",
|
108
|
+
INSIGHTS_SERVICE: "",
|
109
|
+
MODULE_SERVICE: "",
|
110
|
+
USER_SERVICE: "",
|
111
|
+
USER_MANAGEMENT: "",
|
112
|
+
LOGIN_APPLICATION: "",
|
113
|
+
},
|
114
|
+
};
|
115
|
+
},
|
116
|
+
{},
|
117
|
+
],
|
118
|
+
2: [
|
119
|
+
function (require, module, exports) {
|
120
|
+
module.exports = function (ENVIRONMENTS, DEFAULT_ENVIRONMENT) {
|
121
|
+
"use strict";
|
122
|
+
|
123
|
+
var defaultEnvironment = ENVIRONMENTS[DEFAULT_ENVIRONMENT],
|
124
|
+
localEnvironment = ENVIRONMENTS["LOCAL"],
|
125
|
+
environment;
|
126
|
+
|
127
|
+
return {
|
128
|
+
getCurrentEnvironment: getCurrentEnvironment,
|
129
|
+
getSpecificEnvironment: getSpecificEnvironment,
|
130
|
+
setCurrentEnvironment: setCurrentEnvironment,
|
131
|
+
$get: function () {
|
132
|
+
return {
|
133
|
+
getCurrentEnvironment: this.getCurrentEnvironment,
|
134
|
+
getSpecificEnvironment: this.getSpecificEnvironment,
|
135
|
+
setCurrentEnvironment: this.setCurrentEnvironment,
|
136
|
+
};
|
137
|
+
},
|
138
|
+
};
|
139
|
+
|
140
|
+
/////////////////////////
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Get environment object by name
|
144
|
+
* Possible values: 'PRODUCTION', 'STAGE', 'INTEGRATION', 'LOCAL', 'TESTING'
|
145
|
+
*
|
146
|
+
* @private
|
147
|
+
* @param {string} name - Environment name
|
148
|
+
* @returns {Object} Specified or default environment
|
149
|
+
*/
|
150
|
+
function getNamedEnvironment(name) {
|
151
|
+
return ENVIRONMENTS[name] || defaultEnvironment;
|
152
|
+
}
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Get environment object based on custom config
|
156
|
+
*
|
157
|
+
* The config object passed to this function must contain populated environment values to avoid using the
|
158
|
+
* default environment. For example, the Zalando Solution Center populates this object via YAML files during
|
159
|
+
* deployment.
|
160
|
+
*
|
161
|
+
* The `NAME` property of this object will contain either the YAML-supplied environment name (e.g. "PRODUCTION")
|
162
|
+
* or the placeholder string "${NAME}". If we are in a non-LOCAL environment, "${NAME}" will have been replaced
|
163
|
+
* with the appropriate value from the YAML file. The value in `NAME` is assigned to `name` below.
|
164
|
+
*
|
165
|
+
* If `name` does not contain a "$" sign, the custom environment is returned. If `name` does contain a "$" sign,
|
166
|
+
* the LOCAL environment is returned. Otherwise, the default environment is returned.
|
167
|
+
*
|
168
|
+
* @private
|
169
|
+
* @param {Object} env - Custom environment config
|
170
|
+
* @returns {Object} Custom, local or default environment
|
171
|
+
*/
|
172
|
+
function getCustomEnvironment(env) {
|
173
|
+
var name = (env && env.NAME) || "",
|
174
|
+
dollar = name.indexOf("$") === -1,
|
175
|
+
custom = name.length && dollar && env,
|
176
|
+
local = name.length && !dollar && localEnvironment;
|
177
|
+
|
178
|
+
return custom || local || defaultEnvironment;
|
179
|
+
}
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Set current environment
|
183
|
+
*
|
184
|
+
* @public
|
185
|
+
* @param {string|Object} env - Environment name or custom environment object
|
186
|
+
* @returns {Object} Named or custom environment
|
187
|
+
*/
|
188
|
+
function setCurrentEnvironment(env) {
|
189
|
+
environment =
|
190
|
+
(typeof env === "string" && getNamedEnvironment(env)) ||
|
191
|
+
getCustomEnvironment(env);
|
192
|
+
return environment;
|
193
|
+
}
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Get current environment
|
197
|
+
* If environment was not previously configured, use default environment
|
198
|
+
*
|
199
|
+
* @public
|
200
|
+
* @returns {Object} Current or default environment
|
201
|
+
*/
|
202
|
+
function getCurrentEnvironment() {
|
203
|
+
return environment || defaultEnvironment;
|
204
|
+
}
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Get specific environment
|
208
|
+
*
|
209
|
+
* @public
|
210
|
+
* @param {string} name - Environment name
|
211
|
+
* @returns {Object} Specific or default environment
|
212
|
+
*/
|
213
|
+
function getSpecificEnvironment(name) {
|
214
|
+
return (name && getNamedEnvironment(name)) || defaultEnvironment;
|
215
|
+
}
|
216
|
+
};
|
217
|
+
},
|
218
|
+
{},
|
219
|
+
],
|
220
|
+
3: [
|
221
|
+
function (require, module, exports) {
|
222
|
+
"use strict";
|
223
|
+
|
224
|
+
var constants = require("./environments.constant");
|
225
|
+
|
226
|
+
angular
|
227
|
+
.module("solutioncenter.communicator")
|
228
|
+
.constant("DEFAULT_ENVIRONMENT", constants.DEFAULT_ENVIRONMENT)
|
229
|
+
.constant("ENVIRONMENTS", constants.ENVIRONMENTS)
|
230
|
+
.provider("ScEnvironments", [
|
231
|
+
"ENVIRONMENTS",
|
232
|
+
"DEFAULT_ENVIRONMENT",
|
233
|
+
require("./environments.provider"),
|
234
|
+
]);
|
235
|
+
},
|
236
|
+
{ "./environments.constant": 1, "./environments.provider": 2 },
|
237
|
+
],
|
238
|
+
4: [
|
239
|
+
function (require, module, exports) {
|
240
|
+
"use strict";
|
241
|
+
|
242
|
+
angular.module("solutioncenter.communicator", []);
|
243
|
+
require("./environments");
|
244
|
+
},
|
245
|
+
{ "./environments": 3 },
|
246
|
+
],
|
247
|
+
},
|
248
|
+
{},
|
249
|
+
[4]
|
250
|
+
);
|
251
|
+
|
252
|
+
//////////////////
|
253
|
+
// WEBPACK FOOTER
|
254
|
+
// ./node_modules/@solution-center/communicator/dist/solutioncenter.communicator.js
|
255
|
+
// module id = 19
|
256
|
+
// module chunks = 0 1
|
package/package.json
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"name": "@solution-center/communicator",
|
3
|
+
"version": "4.0.0",
|
4
|
+
"private": false,
|
5
|
+
"publishConfig": {
|
6
|
+
"access": "public"
|
7
|
+
},
|
8
|
+
"description": "Solution center communicator",
|
9
|
+
"license": "MIT",
|
10
|
+
"author": "hzlnd0",
|
11
|
+
"main": "dist/solutioncenter.communicator.js",
|
12
|
+
"scripts": {
|
13
|
+
"test": "exit 0"
|
14
|
+
},
|
15
|
+
"dependencies": {
|
16
|
+
"angular": "^1.6.7"
|
17
|
+
},
|
18
|
+
"devDependencies": {
|
19
|
+
"angular-mocks": "1.4.4",
|
20
|
+
"jasmine-core": "2.3.4",
|
21
|
+
"karma": "0.13.9",
|
22
|
+
"karma-chrome-launcher": "0.2.0",
|
23
|
+
"karma-coverage": "0.5.0",
|
24
|
+
"karma-jasmine": "0.3.6",
|
25
|
+
"ng-describe": "1.2.0"
|
26
|
+
}
|
27
|
+
}
|