@esolve/ng-esolve-connect 0.5.1
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 +23 -0
- package/bundles/esolve-ng-esolve-connect.umd.js +3032 -0
- package/bundles/esolve-ng-esolve-connect.umd.js.map +1 -0
- package/esm2015/esolve-ng-esolve-connect.js +5 -0
- package/esm2015/lib/auth/esolve-account.service.js +60 -0
- package/esm2015/lib/auth/esolve-address-record.js +2 -0
- package/esm2015/lib/auth/esolve-address.js +19 -0
- package/esm2015/lib/auth/esolve-auth-interceptor.service.js +43 -0
- package/esm2015/lib/auth/esolve-auth.service.js +200 -0
- package/esm2015/lib/auth/esolve-session.js +27 -0
- package/esm2015/lib/auth/esolve-session.service.js +85 -0
- package/esm2015/lib/auth/esolve-stored-session.js +2 -0
- package/esm2015/lib/banners/esolve-banner-image-hotspot-record.js +2 -0
- package/esm2015/lib/banners/esolve-banner-image-hotspot.js +9 -0
- package/esm2015/lib/banners/esolve-banner-image-record.js +2 -0
- package/esm2015/lib/banners/esolve-banner-image.js +14 -0
- package/esm2015/lib/banners/esolve-banner-record.js +2 -0
- package/esm2015/lib/banners/esolve-banner-type.js +2 -0
- package/esm2015/lib/banners/esolve-banner.js +25 -0
- package/esm2015/lib/banners/esolve-banner.service.js +104 -0
- package/esm2015/lib/cart/esolve-cart-item-record.js +2 -0
- package/esm2015/lib/cart/esolve-cart-item.js +24 -0
- package/esm2015/lib/cart/esolve-cart-stock-item.js +43 -0
- package/esm2015/lib/cart/esolve-cart-totals-record.js +2 -0
- package/esm2015/lib/cart/esolve-cart-totals.js +39 -0
- package/esm2015/lib/cart/esolve-cart.service.js +371 -0
- package/esm2015/lib/cart/esolve-checkout.js +2 -0
- package/esm2015/lib/cart/esolve-payment-method-record.js +2 -0
- package/esm2015/lib/cart/esolve-payment-method.js +49 -0
- package/esm2015/lib/cart/esolve-shipping-cost-record.js +2 -0
- package/esm2015/lib/cart/esolve-shipping-cost.js +18 -0
- package/esm2015/lib/cart/esolve-shipping-method-record.js +2 -0
- package/esm2015/lib/cart/esolve-shipping-method.js +33 -0
- package/esm2015/lib/cart/esolve-stock-location-record.js +2 -0
- package/esm2015/lib/cart/esolve-stock-location.js +76 -0
- package/esm2015/lib/category-tree/esolve-category-tree-item-record.js +2 -0
- package/esm2015/lib/category-tree/esolve-category-tree-item.js +48 -0
- package/esm2015/lib/category-tree/esolve-category-tree.service.js +126 -0
- package/esm2015/lib/esolve-connect.config.js +9 -0
- package/esm2015/lib/media/esolve-media-article.js +16 -0
- package/esm2015/lib/media/esolve-media-record.js +2 -0
- package/esm2015/lib/media/esolve-media.service.js +94 -0
- package/esm2015/lib/menu/esolve-menu-item.js +9 -0
- package/esm2015/lib/menu/esolve-menu-tree-record.js +2 -0
- package/esm2015/lib/menu/esolve-menu.service.js +48 -0
- package/esm2015/lib/news/esolve-news-article-author-record.js +2 -0
- package/esm2015/lib/news/esolve-news-article-author.js +9 -0
- package/esm2015/lib/news/esolve-news-article-list.js +8 -0
- package/esm2015/lib/news/esolve-news-article-record.js +2 -0
- package/esm2015/lib/news/esolve-news-article.js +20 -0
- package/esm2015/lib/news/esolve-news-group-record.js +2 -0
- package/esm2015/lib/news/esolve-news-group.js +9 -0
- package/esm2015/lib/news/esolve-news-manufacturer-record.js +2 -0
- package/esm2015/lib/news/esolve-news-range-record.js +2 -0
- package/esm2015/lib/news/esolve-news.service.js +107 -0
- package/esm2015/lib/ng-esolve-connect.module.js +43 -0
- package/esm2015/lib/shared/esolve-response.js +2 -0
- package/esm2015/lib/shared/esolve-url-target.js +2 -0
- package/esm2015/lib/shared/seo/esolve-seo-info.js +11 -0
- package/esm2015/lib/shared/seo/esolve-seo.service.js +114 -0
- package/esm2015/lib/stock/esolve-stock-badge-record.js +2 -0
- package/esm2015/lib/stock/esolve-stock-badge.js +11 -0
- package/esm2015/lib/stock/esolve-stock-item-list.js +11 -0
- package/esm2015/lib/stock/esolve-stock-item-options.js +2 -0
- package/esm2015/lib/stock/esolve-stock-item.js +130 -0
- package/esm2015/lib/stock/esolve-stock-price.js +43 -0
- package/esm2015/lib/stock/esolve-stock-record.js +2 -0
- package/esm2015/lib/stock/esolve-stock.service.js +146 -0
- package/esm2015/lib/tags/esolve-tag-record.js +2 -0
- package/esm2015/lib/tags/esolve-tag.js +9 -0
- package/esm2015/lib/topics/esolve-topic-record.js +2 -0
- package/esm2015/lib/topics/esolve-topic.js +9 -0
- package/esm2015/lib/topics/esolve-topic.service.js +57 -0
- package/esm2015/public-api.js +54 -0
- package/esolve-ng-esolve-connect.d.ts +5 -0
- package/fesm2015/esolve-ng-esolve-connect.js +2226 -0
- package/fesm2015/esolve-ng-esolve-connect.js.map +1 -0
- package/lib/auth/esolve-account.service.d.ts +17 -0
- package/lib/auth/esolve-address-record.d.ts +18 -0
- package/lib/auth/esolve-address.d.ts +18 -0
- package/lib/auth/esolve-auth-interceptor.service.d.ts +13 -0
- package/lib/auth/esolve-auth.service.d.ts +34 -0
- package/lib/auth/esolve-session.d.ts +11 -0
- package/lib/auth/esolve-session.service.d.ts +22 -0
- package/lib/auth/esolve-stored-session.d.ts +5 -0
- package/lib/banners/esolve-banner-image-hotspot-record.d.ts +8 -0
- package/lib/banners/esolve-banner-image-hotspot.d.ts +12 -0
- package/lib/banners/esolve-banner-image-record.d.ts +10 -0
- package/lib/banners/esolve-banner-image.d.ts +12 -0
- package/lib/banners/esolve-banner-record.d.ts +17 -0
- package/lib/banners/esolve-banner-type.d.ts +7 -0
- package/lib/banners/esolve-banner.d.ts +21 -0
- package/lib/banners/esolve-banner.service.d.ts +26 -0
- package/lib/cart/esolve-cart-item-record.d.ts +43 -0
- package/lib/cart/esolve-cart-item.d.ts +31 -0
- package/lib/cart/esolve-cart-stock-item.d.ts +31 -0
- package/lib/cart/esolve-cart-totals-record.d.ts +7 -0
- package/lib/cart/esolve-cart-totals.d.ts +50 -0
- package/lib/cart/esolve-cart.service.d.ts +112 -0
- package/lib/cart/esolve-checkout.d.ts +7 -0
- package/lib/cart/esolve-payment-method-record.d.ts +47 -0
- package/lib/cart/esolve-payment-method.d.ts +47 -0
- package/lib/cart/esolve-shipping-cost-record.d.ts +14 -0
- package/lib/cart/esolve-shipping-cost.d.ts +12 -0
- package/lib/cart/esolve-shipping-method-record.d.ts +37 -0
- package/lib/cart/esolve-shipping-method.d.ts +32 -0
- package/lib/cart/esolve-stock-location-record.d.ts +47 -0
- package/lib/cart/esolve-stock-location.d.ts +61 -0
- package/lib/category-tree/esolve-category-tree-item-record.d.ts +51 -0
- package/lib/category-tree/esolve-category-tree-item.d.ts +23 -0
- package/lib/category-tree/esolve-category-tree.service.d.ts +47 -0
- package/lib/esolve-connect.config.d.ts +49 -0
- package/lib/media/esolve-media-article.d.ts +13 -0
- package/lib/media/esolve-media-record.d.ts +31 -0
- package/lib/media/esolve-media.service.d.ts +28 -0
- package/lib/menu/esolve-menu-item.d.ts +8 -0
- package/lib/menu/esolve-menu-tree-record.d.ts +20 -0
- package/lib/menu/esolve-menu.service.d.ts +14 -0
- package/lib/news/esolve-news-article-author-record.d.ts +9 -0
- package/lib/news/esolve-news-article-author.d.ts +7 -0
- package/lib/news/esolve-news-article-list.d.ts +7 -0
- package/lib/news/esolve-news-article-record.d.ts +27 -0
- package/lib/news/esolve-news-article.d.ts +16 -0
- package/lib/news/esolve-news-group-record.d.ts +6 -0
- package/lib/news/esolve-news-group.d.ts +7 -0
- package/lib/news/esolve-news-manufacturer-record.d.ts +8 -0
- package/lib/news/esolve-news-range-record.d.ts +9 -0
- package/lib/news/esolve-news.service.d.ts +31 -0
- package/lib/ng-esolve-connect.module.d.ts +11 -0
- package/lib/shared/esolve-response.d.ts +34 -0
- package/lib/shared/esolve-url-target.d.ts +1 -0
- package/lib/shared/seo/esolve-seo-info.d.ts +12 -0
- package/lib/shared/seo/esolve-seo.service.d.ts +28 -0
- package/lib/stock/esolve-stock-badge-record.d.ts +8 -0
- package/lib/stock/esolve-stock-badge.d.ts +9 -0
- package/lib/stock/esolve-stock-item-list.d.ts +10 -0
- package/lib/stock/esolve-stock-item-options.d.ts +10 -0
- package/lib/stock/esolve-stock-item.d.ts +164 -0
- package/lib/stock/esolve-stock-price.d.ts +45 -0
- package/lib/stock/esolve-stock-record.d.ts +45 -0
- package/lib/stock/esolve-stock.service.d.ts +39 -0
- package/lib/tags/esolve-tag-record.d.ts +6 -0
- package/lib/tags/esolve-tag.d.ts +7 -0
- package/lib/topics/esolve-topic-record.d.ts +6 -0
- package/lib/topics/esolve-topic.d.ts +7 -0
- package/lib/topics/esolve-topic.service.d.ts +20 -0
- package/package.json +20 -0
- package/public-api.d.ts +40 -0
|
@@ -0,0 +1,3032 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('@angular/platform-browser')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@esolve/ng-esolve-connect', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', '@angular/platform-browser'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esolve = global.esolve || {}, global.esolve['ng-esolve-connect'] = {}), global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.ng.platformBrowser));
|
|
5
|
+
}(this, (function (exports, i0, common, i1, rxjs, operators, i1$1) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return e[k];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n['default'] = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
|
+
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
|
+
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
30
|
+
|
|
31
|
+
var ESOLVE_CONNECT_CONFIG = new i0.InjectionToken('esolve.connect.config');
|
|
32
|
+
var GLOBAL_CONFIG = {
|
|
33
|
+
images_url: '',
|
|
34
|
+
media_path: '/media',
|
|
35
|
+
stock_path: '/stock',
|
|
36
|
+
banner_path: '/banners'
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var EsolveSession = /** @class */ (function () {
|
|
40
|
+
function EsolveSession(id, _key, _key_expiration_date) {
|
|
41
|
+
if (id === void 0) { id = -1; }
|
|
42
|
+
if (_key === void 0) { _key = ''; }
|
|
43
|
+
this.id = id;
|
|
44
|
+
this._key = _key;
|
|
45
|
+
this._key_expiration_date = _key_expiration_date;
|
|
46
|
+
}
|
|
47
|
+
Object.defineProperty(EsolveSession.prototype, "key", {
|
|
48
|
+
get: function () {
|
|
49
|
+
return this._key;
|
|
50
|
+
},
|
|
51
|
+
enumerable: false,
|
|
52
|
+
configurable: true
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(EsolveSession.prototype, "expired", {
|
|
55
|
+
get: function () {
|
|
56
|
+
var current_date = new Date();
|
|
57
|
+
return ((this._key_expiration_date === undefined) ||
|
|
58
|
+
(current_date >= this._key_expiration_date));
|
|
59
|
+
},
|
|
60
|
+
enumerable: false,
|
|
61
|
+
configurable: true
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(EsolveSession.prototype, "authenticated", {
|
|
64
|
+
get: function () {
|
|
65
|
+
return (this.id > 0);
|
|
66
|
+
},
|
|
67
|
+
enumerable: false,
|
|
68
|
+
configurable: true
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(EsolveSession.prototype, "valid", {
|
|
71
|
+
get: function () {
|
|
72
|
+
return ((this._key !== '') &&
|
|
73
|
+
(this._key_expiration_date !== undefined) &&
|
|
74
|
+
(this.id >= 0));
|
|
75
|
+
},
|
|
76
|
+
enumerable: false,
|
|
77
|
+
configurable: true
|
|
78
|
+
});
|
|
79
|
+
EsolveSession.prototype.updateUser = function (user_id) {
|
|
80
|
+
this.id = user_id;
|
|
81
|
+
};
|
|
82
|
+
return EsolveSession;
|
|
83
|
+
}());
|
|
84
|
+
|
|
85
|
+
/*! *****************************************************************************
|
|
86
|
+
Copyright (c) Microsoft Corporation.
|
|
87
|
+
|
|
88
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
89
|
+
purpose with or without fee is hereby granted.
|
|
90
|
+
|
|
91
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
92
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
93
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
94
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
95
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
96
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
97
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
98
|
+
***************************************************************************** */
|
|
99
|
+
/* global Reflect, Promise */
|
|
100
|
+
var extendStatics = function (d, b) {
|
|
101
|
+
extendStatics = Object.setPrototypeOf ||
|
|
102
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
103
|
+
function (d, b) { for (var p in b)
|
|
104
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
105
|
+
d[p] = b[p]; };
|
|
106
|
+
return extendStatics(d, b);
|
|
107
|
+
};
|
|
108
|
+
function __extends(d, b) {
|
|
109
|
+
if (typeof b !== "function" && b !== null)
|
|
110
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
111
|
+
extendStatics(d, b);
|
|
112
|
+
function __() { this.constructor = d; }
|
|
113
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
114
|
+
}
|
|
115
|
+
var __assign = function () {
|
|
116
|
+
__assign = Object.assign || function __assign(t) {
|
|
117
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
118
|
+
s = arguments[i];
|
|
119
|
+
for (var p in s)
|
|
120
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
121
|
+
t[p] = s[p];
|
|
122
|
+
}
|
|
123
|
+
return t;
|
|
124
|
+
};
|
|
125
|
+
return __assign.apply(this, arguments);
|
|
126
|
+
};
|
|
127
|
+
function __rest(s, e) {
|
|
128
|
+
var t = {};
|
|
129
|
+
for (var p in s)
|
|
130
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
131
|
+
t[p] = s[p];
|
|
132
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
133
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
134
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
135
|
+
t[p[i]] = s[p[i]];
|
|
136
|
+
}
|
|
137
|
+
return t;
|
|
138
|
+
}
|
|
139
|
+
function __decorate(decorators, target, key, desc) {
|
|
140
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
141
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
142
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
143
|
+
else
|
|
144
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
145
|
+
if (d = decorators[i])
|
|
146
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
147
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
148
|
+
}
|
|
149
|
+
function __param(paramIndex, decorator) {
|
|
150
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
151
|
+
}
|
|
152
|
+
function __metadata(metadataKey, metadataValue) {
|
|
153
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
154
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
155
|
+
}
|
|
156
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
157
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
158
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
159
|
+
function fulfilled(value) { try {
|
|
160
|
+
step(generator.next(value));
|
|
161
|
+
}
|
|
162
|
+
catch (e) {
|
|
163
|
+
reject(e);
|
|
164
|
+
} }
|
|
165
|
+
function rejected(value) { try {
|
|
166
|
+
step(generator["throw"](value));
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
reject(e);
|
|
170
|
+
} }
|
|
171
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
172
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function __generator(thisArg, body) {
|
|
176
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
177
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
178
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
179
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
180
|
+
function step(op) {
|
|
181
|
+
if (f)
|
|
182
|
+
throw new TypeError("Generator is already executing.");
|
|
183
|
+
while (_)
|
|
184
|
+
try {
|
|
185
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
186
|
+
return t;
|
|
187
|
+
if (y = 0, t)
|
|
188
|
+
op = [op[0] & 2, t.value];
|
|
189
|
+
switch (op[0]) {
|
|
190
|
+
case 0:
|
|
191
|
+
case 1:
|
|
192
|
+
t = op;
|
|
193
|
+
break;
|
|
194
|
+
case 4:
|
|
195
|
+
_.label++;
|
|
196
|
+
return { value: op[1], done: false };
|
|
197
|
+
case 5:
|
|
198
|
+
_.label++;
|
|
199
|
+
y = op[1];
|
|
200
|
+
op = [0];
|
|
201
|
+
continue;
|
|
202
|
+
case 7:
|
|
203
|
+
op = _.ops.pop();
|
|
204
|
+
_.trys.pop();
|
|
205
|
+
continue;
|
|
206
|
+
default:
|
|
207
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
208
|
+
_ = 0;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
212
|
+
_.label = op[1];
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
216
|
+
_.label = t[1];
|
|
217
|
+
t = op;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
if (t && _.label < t[2]) {
|
|
221
|
+
_.label = t[2];
|
|
222
|
+
_.ops.push(op);
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
if (t[2])
|
|
226
|
+
_.ops.pop();
|
|
227
|
+
_.trys.pop();
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
op = body.call(thisArg, _);
|
|
231
|
+
}
|
|
232
|
+
catch (e) {
|
|
233
|
+
op = [6, e];
|
|
234
|
+
y = 0;
|
|
235
|
+
}
|
|
236
|
+
finally {
|
|
237
|
+
f = t = 0;
|
|
238
|
+
}
|
|
239
|
+
if (op[0] & 5)
|
|
240
|
+
throw op[1];
|
|
241
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
245
|
+
if (k2 === undefined)
|
|
246
|
+
k2 = k;
|
|
247
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
248
|
+
}) : (function (o, m, k, k2) {
|
|
249
|
+
if (k2 === undefined)
|
|
250
|
+
k2 = k;
|
|
251
|
+
o[k2] = m[k];
|
|
252
|
+
});
|
|
253
|
+
function __exportStar(m, o) {
|
|
254
|
+
for (var p in m)
|
|
255
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
256
|
+
__createBinding(o, m, p);
|
|
257
|
+
}
|
|
258
|
+
function __values(o) {
|
|
259
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
260
|
+
if (m)
|
|
261
|
+
return m.call(o);
|
|
262
|
+
if (o && typeof o.length === "number")
|
|
263
|
+
return {
|
|
264
|
+
next: function () {
|
|
265
|
+
if (o && i >= o.length)
|
|
266
|
+
o = void 0;
|
|
267
|
+
return { value: o && o[i++], done: !o };
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
271
|
+
}
|
|
272
|
+
function __read(o, n) {
|
|
273
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
274
|
+
if (!m)
|
|
275
|
+
return o;
|
|
276
|
+
var i = m.call(o), r, ar = [], e;
|
|
277
|
+
try {
|
|
278
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
279
|
+
ar.push(r.value);
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
e = { error: error };
|
|
283
|
+
}
|
|
284
|
+
finally {
|
|
285
|
+
try {
|
|
286
|
+
if (r && !r.done && (m = i["return"]))
|
|
287
|
+
m.call(i);
|
|
288
|
+
}
|
|
289
|
+
finally {
|
|
290
|
+
if (e)
|
|
291
|
+
throw e.error;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return ar;
|
|
295
|
+
}
|
|
296
|
+
/** @deprecated */
|
|
297
|
+
function __spread() {
|
|
298
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
299
|
+
ar = ar.concat(__read(arguments[i]));
|
|
300
|
+
return ar;
|
|
301
|
+
}
|
|
302
|
+
/** @deprecated */
|
|
303
|
+
function __spreadArrays() {
|
|
304
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
305
|
+
s += arguments[i].length;
|
|
306
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
307
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
308
|
+
r[k] = a[j];
|
|
309
|
+
return r;
|
|
310
|
+
}
|
|
311
|
+
function __spreadArray(to, from, pack) {
|
|
312
|
+
if (pack || arguments.length === 2)
|
|
313
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
314
|
+
if (ar || !(i in from)) {
|
|
315
|
+
if (!ar)
|
|
316
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
317
|
+
ar[i] = from[i];
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return to.concat(ar || from);
|
|
321
|
+
}
|
|
322
|
+
function __await(v) {
|
|
323
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
324
|
+
}
|
|
325
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
326
|
+
if (!Symbol.asyncIterator)
|
|
327
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
328
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
329
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
330
|
+
function verb(n) { if (g[n])
|
|
331
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
332
|
+
function resume(n, v) { try {
|
|
333
|
+
step(g[n](v));
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
settle(q[0][3], e);
|
|
337
|
+
} }
|
|
338
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
339
|
+
function fulfill(value) { resume("next", value); }
|
|
340
|
+
function reject(value) { resume("throw", value); }
|
|
341
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
342
|
+
resume(q[0][0], q[0][1]); }
|
|
343
|
+
}
|
|
344
|
+
function __asyncDelegator(o) {
|
|
345
|
+
var i, p;
|
|
346
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
347
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
348
|
+
}
|
|
349
|
+
function __asyncValues(o) {
|
|
350
|
+
if (!Symbol.asyncIterator)
|
|
351
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
352
|
+
var m = o[Symbol.asyncIterator], i;
|
|
353
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
354
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
355
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
356
|
+
}
|
|
357
|
+
function __makeTemplateObject(cooked, raw) {
|
|
358
|
+
if (Object.defineProperty) {
|
|
359
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
cooked.raw = raw;
|
|
363
|
+
}
|
|
364
|
+
return cooked;
|
|
365
|
+
}
|
|
366
|
+
;
|
|
367
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
368
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
369
|
+
}) : function (o, v) {
|
|
370
|
+
o["default"] = v;
|
|
371
|
+
};
|
|
372
|
+
function __importStar(mod) {
|
|
373
|
+
if (mod && mod.__esModule)
|
|
374
|
+
return mod;
|
|
375
|
+
var result = {};
|
|
376
|
+
if (mod != null)
|
|
377
|
+
for (var k in mod)
|
|
378
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
379
|
+
__createBinding(result, mod, k);
|
|
380
|
+
__setModuleDefault(result, mod);
|
|
381
|
+
return result;
|
|
382
|
+
}
|
|
383
|
+
function __importDefault(mod) {
|
|
384
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
385
|
+
}
|
|
386
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
387
|
+
if (kind === "a" && !f)
|
|
388
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
389
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
390
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
391
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
392
|
+
}
|
|
393
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
394
|
+
if (kind === "m")
|
|
395
|
+
throw new TypeError("Private method is not writable");
|
|
396
|
+
if (kind === "a" && !f)
|
|
397
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
398
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
399
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
400
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
var EsolveAddress = /** @class */ (function () {
|
|
404
|
+
function EsolveAddress(id, recipient, address_type, pobox, place_name, street_number, street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
405
|
+
this.id = id;
|
|
406
|
+
this.recipient = recipient;
|
|
407
|
+
this.address_type = address_type;
|
|
408
|
+
this.pobox = pobox;
|
|
409
|
+
this.place_name = place_name;
|
|
410
|
+
this.street_number = street_number;
|
|
411
|
+
this.street = street;
|
|
412
|
+
this.suburb = suburb;
|
|
413
|
+
this.city = city;
|
|
414
|
+
this.province = province;
|
|
415
|
+
this.country = country;
|
|
416
|
+
this.postal_code = postal_code;
|
|
417
|
+
this.latitude = latitude;
|
|
418
|
+
this.longitude = longitude;
|
|
419
|
+
}
|
|
420
|
+
return EsolveAddress;
|
|
421
|
+
}());
|
|
422
|
+
|
|
423
|
+
var EsolveAccountService = /** @class */ (function () {
|
|
424
|
+
function EsolveAccountService(config, http) {
|
|
425
|
+
this.config = config;
|
|
426
|
+
this.http = http;
|
|
427
|
+
this._user_id = 0;
|
|
428
|
+
}
|
|
429
|
+
Object.defineProperty(EsolveAccountService.prototype, "user_id", {
|
|
430
|
+
get: function () {
|
|
431
|
+
return this._user_id;
|
|
432
|
+
},
|
|
433
|
+
set: function (value) {
|
|
434
|
+
value = ((value > 0) ? value : 0);
|
|
435
|
+
if (this._user_id !== value) {
|
|
436
|
+
this._user_id = value;
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
enumerable: false,
|
|
440
|
+
configurable: true
|
|
441
|
+
});
|
|
442
|
+
EsolveAccountService.prototype.processUserAddress = function (records) {
|
|
443
|
+
var e_1, _a;
|
|
444
|
+
var user_addesses = [];
|
|
445
|
+
if (records && (this._user_id > 0)) {
|
|
446
|
+
try {
|
|
447
|
+
for (var records_1 = __values(records), records_1_1 = records_1.next(); !records_1_1.done; records_1_1 = records_1.next()) {
|
|
448
|
+
var record = records_1_1.value;
|
|
449
|
+
if (+record.userid === this._user_id) {
|
|
450
|
+
user_addesses.push(new EsolveAddress(+record.id, record.recipient, record.address_type, record.pobox, record.place_name, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude));
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
455
|
+
finally {
|
|
456
|
+
try {
|
|
457
|
+
if (records_1_1 && !records_1_1.done && (_a = records_1.return)) _a.call(records_1);
|
|
458
|
+
}
|
|
459
|
+
finally { if (e_1) throw e_1.error; }
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return user_addesses;
|
|
463
|
+
};
|
|
464
|
+
EsolveAccountService.prototype.getAddress = function () {
|
|
465
|
+
var _this = this;
|
|
466
|
+
var params = new i1.HttpParams();
|
|
467
|
+
params = params.set('ws_id', this.config.wsid);
|
|
468
|
+
params = params.set('user_id', this.user_id.toString());
|
|
469
|
+
return rxjs.iif(function () { return (_this.user_id > 0); }, this.http.get(this.config.api_url + "/service/get-addresses.php", { params: params }).pipe(operators.map(function (response) {
|
|
470
|
+
if (response.records === undefined) {
|
|
471
|
+
throw response;
|
|
472
|
+
}
|
|
473
|
+
return _this.processUserAddress(response.records);
|
|
474
|
+
}), operators.catchError(function (err) {
|
|
475
|
+
return rxjs.throwError(err);
|
|
476
|
+
})), rxjs.throwError('Log in is required'));
|
|
477
|
+
};
|
|
478
|
+
return EsolveAccountService;
|
|
479
|
+
}());
|
|
480
|
+
EsolveAccountService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
481
|
+
EsolveAccountService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, providedIn: 'root' });
|
|
482
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAccountService, decorators: [{
|
|
483
|
+
type: i0.Injectable,
|
|
484
|
+
args: [{
|
|
485
|
+
providedIn: 'root'
|
|
486
|
+
}]
|
|
487
|
+
}], ctorParameters: function () {
|
|
488
|
+
return [{ type: undefined, decorators: [{
|
|
489
|
+
type: i0.Inject,
|
|
490
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
491
|
+
}] }, { type: i1__namespace.HttpClient }];
|
|
492
|
+
} });
|
|
493
|
+
|
|
494
|
+
var EsolveSessionService = /** @class */ (function () {
|
|
495
|
+
function EsolveSessionService(config, account) {
|
|
496
|
+
this.config = config;
|
|
497
|
+
this.storage_key = 'ngEslvUserSession';
|
|
498
|
+
this.setStorageKey();
|
|
499
|
+
this._session = new rxjs.BehaviorSubject(new EsolveSession(0, ''));
|
|
500
|
+
this.session = this._session.asObservable();
|
|
501
|
+
this._session.subscribe(function (session) {
|
|
502
|
+
if (session.key !== '') {
|
|
503
|
+
account.user_id = session.id;
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
Object.defineProperty(EsolveSessionService.prototype, "currentSession", {
|
|
508
|
+
get: function () {
|
|
509
|
+
return this._session.value;
|
|
510
|
+
},
|
|
511
|
+
enumerable: false,
|
|
512
|
+
configurable: true
|
|
513
|
+
});
|
|
514
|
+
EsolveSessionService.prototype.setStorageKey = function () {
|
|
515
|
+
if ((typeof this.config.user_session_storage_key === 'string') &&
|
|
516
|
+
(this.config.user_session_storage_key !== '')) {
|
|
517
|
+
this.storage_key = this.config.user_session_storage_key;
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
EsolveSessionService.prototype.startTimer = function (callback, duration) {
|
|
521
|
+
this.key_expiration_timer = setTimeout(callback, duration);
|
|
522
|
+
};
|
|
523
|
+
EsolveSessionService.prototype.clearTimer = function () {
|
|
524
|
+
if (this.key_expiration_timer) {
|
|
525
|
+
clearTimeout(this.key_expiration_timer);
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
EsolveSessionService.prototype.restore = function (expirationCallback, invalidSessionCallback) {
|
|
529
|
+
if (!this.currentSession.valid) {
|
|
530
|
+
var stored_session_json = localStorage.getItem(this.storage_key);
|
|
531
|
+
var stored_session = (stored_session_json ? JSON.parse(stored_session_json) : null);
|
|
532
|
+
if (!stored_session) {
|
|
533
|
+
invalidSessionCallback();
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
var expiration_date = new Date(stored_session._key_expiration_date);
|
|
537
|
+
var loaded_session = new EsolveSession(stored_session.id, stored_session._key, expiration_date);
|
|
538
|
+
if (!loaded_session.expired) {
|
|
539
|
+
this._session.next(loaded_session);
|
|
540
|
+
var expiration_duration = expiration_date.getTime() - new Date().getTime();
|
|
541
|
+
this.startTimer(expirationCallback, expiration_duration);
|
|
542
|
+
}
|
|
543
|
+
else {
|
|
544
|
+
expirationCallback(loaded_session);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
EsolveSessionService.prototype.handleSession = function (user_id, key, expiry_time, expires, expirationCallback) {
|
|
549
|
+
var expiration_date = new Date(expiry_time * 1000);
|
|
550
|
+
var session = new EsolveSession(user_id, key, expiration_date);
|
|
551
|
+
localStorage.setItem(this.storage_key, JSON.stringify(session));
|
|
552
|
+
this._session.next(session);
|
|
553
|
+
this.startTimer(expirationCallback, expires * 1000);
|
|
554
|
+
};
|
|
555
|
+
EsolveSessionService.prototype.handleUpdateSession = function (user_id, callback) {
|
|
556
|
+
var current_session = this.currentSession;
|
|
557
|
+
current_session.updateUser(user_id);
|
|
558
|
+
localStorage.setItem(this.storage_key, JSON.stringify(current_session));
|
|
559
|
+
this._session.next(current_session);
|
|
560
|
+
if (typeof callback === 'function') {
|
|
561
|
+
callback();
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
return EsolveSessionService;
|
|
565
|
+
}());
|
|
566
|
+
EsolveSessionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: EsolveAccountService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
567
|
+
EsolveSessionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, providedIn: 'root' });
|
|
568
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSessionService, decorators: [{
|
|
569
|
+
type: i0.Injectable,
|
|
570
|
+
args: [{
|
|
571
|
+
providedIn: 'root'
|
|
572
|
+
}]
|
|
573
|
+
}], ctorParameters: function () {
|
|
574
|
+
return [{ type: undefined, decorators: [{
|
|
575
|
+
type: i0.Inject,
|
|
576
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
577
|
+
}] }, { type: EsolveAccountService }];
|
|
578
|
+
} });
|
|
579
|
+
|
|
580
|
+
var EsolveAuthInterceptorService = /** @class */ (function () {
|
|
581
|
+
function EsolveAuthInterceptorService(config, session) {
|
|
582
|
+
this.config = config;
|
|
583
|
+
this.session = session;
|
|
584
|
+
}
|
|
585
|
+
EsolveAuthInterceptorService.prototype.intercept = function (req, next) {
|
|
586
|
+
if (req.url.startsWith(this.config.api_url + "/service/")) {
|
|
587
|
+
var service_identifier = req.url.replace(this.config.api_url + "/service/", '');
|
|
588
|
+
var old_parms_keys = req.params.keys();
|
|
589
|
+
var modified_url = req.url;
|
|
590
|
+
var params_1 = new i1.HttpParams();
|
|
591
|
+
var session = this.session.currentSession;
|
|
592
|
+
if (session.valid) {
|
|
593
|
+
if (service_identifier !== 'get-access-token.php') {
|
|
594
|
+
params_1 = params_1.set('key', session.key);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
old_parms_keys.forEach(function (key) {
|
|
598
|
+
params_1 = params_1.set(key, req.params.get(key) || '');
|
|
599
|
+
});
|
|
600
|
+
var modified_req = req.clone({
|
|
601
|
+
url: modified_url,
|
|
602
|
+
params: params_1
|
|
603
|
+
});
|
|
604
|
+
return next.handle(modified_req);
|
|
605
|
+
}
|
|
606
|
+
return next.handle(req);
|
|
607
|
+
};
|
|
608
|
+
return EsolveAuthInterceptorService;
|
|
609
|
+
}());
|
|
610
|
+
EsolveAuthInterceptorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: EsolveSessionService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
611
|
+
EsolveAuthInterceptorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService });
|
|
612
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthInterceptorService, decorators: [{
|
|
613
|
+
type: i0.Injectable
|
|
614
|
+
}], ctorParameters: function () {
|
|
615
|
+
return [{ type: undefined, decorators: [{
|
|
616
|
+
type: i0.Inject,
|
|
617
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
618
|
+
}] }, { type: EsolveSessionService }];
|
|
619
|
+
} });
|
|
620
|
+
|
|
621
|
+
var NgEsolveConnectModule = /** @class */ (function () {
|
|
622
|
+
function NgEsolveConnectModule() {
|
|
623
|
+
}
|
|
624
|
+
NgEsolveConnectModule.forRoot = function (config) {
|
|
625
|
+
return {
|
|
626
|
+
ngModule: NgEsolveConnectModule,
|
|
627
|
+
providers: [
|
|
628
|
+
{
|
|
629
|
+
provide: ESOLVE_CONNECT_CONFIG,
|
|
630
|
+
useValue: config
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
provide: i1.HTTP_INTERCEPTORS,
|
|
634
|
+
useClass: EsolveAuthInterceptorService,
|
|
635
|
+
multi: true
|
|
636
|
+
}
|
|
637
|
+
]
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
return NgEsolveConnectModule;
|
|
641
|
+
}());
|
|
642
|
+
NgEsolveConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
643
|
+
NgEsolveConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, imports: [common.CommonModule,
|
|
644
|
+
i1.HttpClientModule] });
|
|
645
|
+
NgEsolveConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, imports: [[
|
|
646
|
+
common.CommonModule,
|
|
647
|
+
i1.HttpClientModule
|
|
648
|
+
]] });
|
|
649
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: NgEsolveConnectModule, decorators: [{
|
|
650
|
+
type: i0.NgModule,
|
|
651
|
+
args: [{
|
|
652
|
+
declarations: [],
|
|
653
|
+
imports: [
|
|
654
|
+
common.CommonModule,
|
|
655
|
+
i1.HttpClientModule
|
|
656
|
+
],
|
|
657
|
+
exports: []
|
|
658
|
+
}]
|
|
659
|
+
}] });
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Search Engine Optimization information.
|
|
663
|
+
*/
|
|
664
|
+
var EsolveSEOInfo = /** @class */ (function () {
|
|
665
|
+
function EsolveSEOInfo(title, description, keywords) {
|
|
666
|
+
if (title === void 0) { title = ''; }
|
|
667
|
+
if (description === void 0) { description = ''; }
|
|
668
|
+
if (keywords === void 0) { keywords = ''; }
|
|
669
|
+
this.title = title;
|
|
670
|
+
this.description = description;
|
|
671
|
+
this.keywords = keywords;
|
|
672
|
+
}
|
|
673
|
+
return EsolveSEOInfo;
|
|
674
|
+
}());
|
|
675
|
+
|
|
676
|
+
var EsolveSeoService = /** @class */ (function () {
|
|
677
|
+
function EsolveSeoService(config, title, meta) {
|
|
678
|
+
this.config = config;
|
|
679
|
+
this.title = title;
|
|
680
|
+
this.meta = meta;
|
|
681
|
+
this.title_prefix = '';
|
|
682
|
+
this.title_suffix = '';
|
|
683
|
+
this.title_separator = '|';
|
|
684
|
+
this.default_seo_title = '';
|
|
685
|
+
this.default_seo_description = '';
|
|
686
|
+
this.default_seo_keywords = '';
|
|
687
|
+
this.init();
|
|
688
|
+
}
|
|
689
|
+
EsolveSeoService.prototype.init = function () {
|
|
690
|
+
if (typeof this.config.title_prefix !== 'undefined') {
|
|
691
|
+
this.title_prefix = this.config.title_prefix;
|
|
692
|
+
}
|
|
693
|
+
if (typeof this.config.title_suffix !== 'undefined') {
|
|
694
|
+
this.title_suffix = this.config.title_suffix;
|
|
695
|
+
}
|
|
696
|
+
if (typeof this.config.title_separator !== 'undefined') {
|
|
697
|
+
this.title_separator = this.config.title_separator;
|
|
698
|
+
}
|
|
699
|
+
if (typeof this.config.default_seo_title !== 'undefined') {
|
|
700
|
+
this.default_seo_title = this.config.default_seo_title;
|
|
701
|
+
}
|
|
702
|
+
if (typeof this.config.default_seo_description !== 'undefined') {
|
|
703
|
+
this.default_seo_description = this.config.default_seo_description;
|
|
704
|
+
}
|
|
705
|
+
if (typeof this.config.default_seo_keywords !== 'undefined') {
|
|
706
|
+
this.default_seo_keywords = this.config.default_seo_keywords;
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
EsolveSeoService.prototype.setPageTitleTags = function (title) {
|
|
710
|
+
this.title.setTitle(title);
|
|
711
|
+
this.meta.updateTag({ property: 'og:title', content: title });
|
|
712
|
+
};
|
|
713
|
+
EsolveSeoService.prototype.setPageDescriptionTags = function (description) {
|
|
714
|
+
this.meta.updateTag({ name: 'description', content: description });
|
|
715
|
+
this.meta.updateTag({ property: 'og:description', content: description });
|
|
716
|
+
};
|
|
717
|
+
EsolveSeoService.prototype.setPageKeywordsTags = function (keywords) {
|
|
718
|
+
this.meta.updateTag({ name: 'keywords', content: keywords });
|
|
719
|
+
};
|
|
720
|
+
EsolveSeoService.prototype.validateAndSanitizeSeoInfo = function (seoInfo) {
|
|
721
|
+
var e_1, _a;
|
|
722
|
+
var pageSeo = new EsolveSEOInfo(this.default_seo_title, this.default_seo_description, this.default_seo_keywords);
|
|
723
|
+
if (seoInfo.description.trim() !== '') {
|
|
724
|
+
pageSeo.description = seoInfo.description;
|
|
725
|
+
}
|
|
726
|
+
if (seoInfo.title.trim() !== '') {
|
|
727
|
+
var titlePartsArray = [];
|
|
728
|
+
if (this.title_prefix !== '') {
|
|
729
|
+
titlePartsArray.push(this.title_prefix);
|
|
730
|
+
if (this.title_separator !== '') {
|
|
731
|
+
titlePartsArray.push(this.title_separator);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
titlePartsArray.push(seoInfo.title);
|
|
735
|
+
if (this.title_suffix !== '') {
|
|
736
|
+
if (this.title_separator !== '') {
|
|
737
|
+
titlePartsArray.push(this.title_separator);
|
|
738
|
+
}
|
|
739
|
+
titlePartsArray.push(this.title_suffix);
|
|
740
|
+
}
|
|
741
|
+
pageSeo.title = titlePartsArray.join(' ');
|
|
742
|
+
if (seoInfo.keywords.trim() === '') {
|
|
743
|
+
var clean_title = seoInfo.title.replace(/[^a-zA-Z0-9\. ]+/gi, '').trim();
|
|
744
|
+
var keywords = clean_title.split(' ');
|
|
745
|
+
var clean_keywords = [];
|
|
746
|
+
try {
|
|
747
|
+
for (var keywords_1 = __values(keywords), keywords_1_1 = keywords_1.next(); !keywords_1_1.done; keywords_1_1 = keywords_1.next()) {
|
|
748
|
+
var keyword = keywords_1_1.value;
|
|
749
|
+
keyword = keyword.trim();
|
|
750
|
+
if (keyword.length > 2) {
|
|
751
|
+
keyword = keyword.toLocaleLowerCase();
|
|
752
|
+
if (!clean_keywords.includes(keyword)) {
|
|
753
|
+
clean_keywords.push(keyword);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
759
|
+
finally {
|
|
760
|
+
try {
|
|
761
|
+
if (keywords_1_1 && !keywords_1_1.done && (_a = keywords_1.return)) _a.call(keywords_1);
|
|
762
|
+
}
|
|
763
|
+
finally { if (e_1) throw e_1.error; }
|
|
764
|
+
}
|
|
765
|
+
seoInfo.keywords = clean_keywords.join(',');
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
if (seoInfo.keywords.trim() !== '') {
|
|
769
|
+
pageSeo.keywords = seoInfo.keywords;
|
|
770
|
+
}
|
|
771
|
+
return pageSeo;
|
|
772
|
+
};
|
|
773
|
+
/**
|
|
774
|
+
* Sets SEO tags for page
|
|
775
|
+
* @param seoInfo SEO object
|
|
776
|
+
*/
|
|
777
|
+
EsolveSeoService.prototype.setTags = function (seoInfo) {
|
|
778
|
+
seoInfo = this.validateAndSanitizeSeoInfo(seoInfo);
|
|
779
|
+
this.setPageTitleTags(seoInfo.title);
|
|
780
|
+
this.setPageDescriptionTags(seoInfo.description);
|
|
781
|
+
this.setPageKeywordsTags(seoInfo.keywords);
|
|
782
|
+
};
|
|
783
|
+
return EsolveSeoService;
|
|
784
|
+
}());
|
|
785
|
+
EsolveSeoService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSeoService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace$1.Title }, { token: i1__namespace$1.Meta }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
786
|
+
EsolveSeoService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSeoService, providedIn: 'root' });
|
|
787
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveSeoService, decorators: [{
|
|
788
|
+
type: i0.Injectable,
|
|
789
|
+
args: [{
|
|
790
|
+
providedIn: 'root'
|
|
791
|
+
}]
|
|
792
|
+
}], ctorParameters: function () {
|
|
793
|
+
return [{ type: undefined, decorators: [{
|
|
794
|
+
type: i0.Inject,
|
|
795
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
796
|
+
}] }, { type: i1__namespace$1.Title }, { type: i1__namespace$1.Meta }];
|
|
797
|
+
} });
|
|
798
|
+
|
|
799
|
+
var EsolveAuthService = /** @class */ (function () {
|
|
800
|
+
function EsolveAuthService(config, http, session) {
|
|
801
|
+
this.config = config;
|
|
802
|
+
this.http = http;
|
|
803
|
+
this.session = session;
|
|
804
|
+
}
|
|
805
|
+
EsolveAuthService.prototype.checkAccessToken = function (session) {
|
|
806
|
+
var _a;
|
|
807
|
+
session = session || this.session.currentSession;
|
|
808
|
+
var token = (_a = session === null || session === void 0 ? void 0 : session.key) !== null && _a !== void 0 ? _a : '';
|
|
809
|
+
var params = new i1.HttpParams({
|
|
810
|
+
fromObject: {
|
|
811
|
+
key: token,
|
|
812
|
+
ws_id: this.config.wsid
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
return this.http.get(this.config.api_url + "/service/get-access-token.php", {
|
|
816
|
+
params: params,
|
|
817
|
+
headers: new i1.HttpHeaders({
|
|
818
|
+
'Accept-Language': '*'
|
|
819
|
+
})
|
|
820
|
+
}).pipe(operators.map(function (responseData) {
|
|
821
|
+
if ((responseData.type === 'error') || (responseData.type === 'exception') || (!responseData.additional_data.key_okay)) {
|
|
822
|
+
throw responseData;
|
|
823
|
+
}
|
|
824
|
+
responseData.additional_data.key = token;
|
|
825
|
+
return responseData;
|
|
826
|
+
})).toPromise();
|
|
827
|
+
};
|
|
828
|
+
EsolveAuthService.prototype.getAccessToken = function (email, password, anonymous) {
|
|
829
|
+
var _this = this;
|
|
830
|
+
if (anonymous === void 0) { anonymous = false; }
|
|
831
|
+
var params = new i1.HttpParams();
|
|
832
|
+
if (anonymous) {
|
|
833
|
+
params = params.set('anonymous', '1');
|
|
834
|
+
}
|
|
835
|
+
if (email !== '') {
|
|
836
|
+
params = params.set('email', email);
|
|
837
|
+
}
|
|
838
|
+
if (password !== '') {
|
|
839
|
+
params = params.set('password', password);
|
|
840
|
+
}
|
|
841
|
+
params = params.set('ws_id', this.config.wsid);
|
|
842
|
+
return this.http.get(this.config.api_url + "/service/get-access-token.php", {
|
|
843
|
+
params: params,
|
|
844
|
+
headers: new i1.HttpHeaders({
|
|
845
|
+
'Accept-Language': '*'
|
|
846
|
+
})
|
|
847
|
+
}).pipe(operators.tap(function (responseData) {
|
|
848
|
+
if ((responseData.type === 'error') || (responseData.type === 'exception')) {
|
|
849
|
+
throw responseData;
|
|
850
|
+
}
|
|
851
|
+
}), operators.catchError(this.handleError), operators.tap(function (responseData) {
|
|
852
|
+
_this.handleAuthentication(responseData);
|
|
853
|
+
}));
|
|
854
|
+
};
|
|
855
|
+
EsolveAuthService.prototype.autoLogin = function () {
|
|
856
|
+
var _this = this;
|
|
857
|
+
this.session.restore(this.handleExpiration(), function () {
|
|
858
|
+
_this.getAccessToken('', '', true).toPromise().then(function (_) { }, function (error) {
|
|
859
|
+
console.log(error);
|
|
860
|
+
});
|
|
861
|
+
});
|
|
862
|
+
};
|
|
863
|
+
EsolveAuthService.prototype.login = function (email, password) {
|
|
864
|
+
var _this = this;
|
|
865
|
+
var body = {
|
|
866
|
+
login: {
|
|
867
|
+
email: email,
|
|
868
|
+
password: password
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
return this.http.post(this.config.api_url + "/service/set-login.php", body, {
|
|
872
|
+
headers: {
|
|
873
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
874
|
+
},
|
|
875
|
+
params: {
|
|
876
|
+
ws_id: this.config.wsid
|
|
877
|
+
},
|
|
878
|
+
responseType: 'json',
|
|
879
|
+
observe: 'body'
|
|
880
|
+
}).pipe(operators.map(function (response) {
|
|
881
|
+
var e_1, _b;
|
|
882
|
+
if ((response.responses === undefined) || (response.responses.length <= 0)) {
|
|
883
|
+
throw response;
|
|
884
|
+
}
|
|
885
|
+
var login_response = response.responses[0];
|
|
886
|
+
if ((login_response.status.state !== 'success') && (login_response.status.state !== 'warning')) {
|
|
887
|
+
throw login_response;
|
|
888
|
+
}
|
|
889
|
+
try {
|
|
890
|
+
for (var _c = __values(login_response.log), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
891
|
+
var response_log = _d.value;
|
|
892
|
+
if ((response_log.type === 'success') && (response_log.message_code === 'login_success')) {
|
|
893
|
+
_this.session.handleUpdateSession(login_response.esolve_id);
|
|
894
|
+
return login_response.esolve_id;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
899
|
+
finally {
|
|
900
|
+
try {
|
|
901
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
902
|
+
}
|
|
903
|
+
finally { if (e_1) throw e_1.error; }
|
|
904
|
+
}
|
|
905
|
+
throw login_response;
|
|
906
|
+
}), operators.catchError(function (errorRes) {
|
|
907
|
+
var parseException = function (exception) {
|
|
908
|
+
var exception_type = exception.additional_data.exception_type;
|
|
909
|
+
var error = {
|
|
910
|
+
type: 'exception',
|
|
911
|
+
message: exception.message || '',
|
|
912
|
+
error_code: exception_type || 'unknown'
|
|
913
|
+
};
|
|
914
|
+
return error;
|
|
915
|
+
};
|
|
916
|
+
var parseLoginErrors = function (login_response) {
|
|
917
|
+
var error = {
|
|
918
|
+
type: 'error',
|
|
919
|
+
message: 'Unknown error has occured',
|
|
920
|
+
error_code: 'unknown'
|
|
921
|
+
};
|
|
922
|
+
if ((login_response.status.state === 'none') && (login_response.log.length > 0)) {
|
|
923
|
+
error.error_code = 'no_response';
|
|
924
|
+
error.message = 'Response was provided';
|
|
925
|
+
}
|
|
926
|
+
else if (login_response.status.state === 'error') {
|
|
927
|
+
var login_error_log = login_response.log[0];
|
|
928
|
+
error.error_code = login_error_log.message_code;
|
|
929
|
+
error.message = login_error_log.message;
|
|
930
|
+
}
|
|
931
|
+
return error;
|
|
932
|
+
};
|
|
933
|
+
if (errorRes instanceof i1.HttpErrorResponse) {
|
|
934
|
+
if (errorRes.status === 500) {
|
|
935
|
+
var server_error = errorRes.error;
|
|
936
|
+
if ((server_error.service_type === 'set-login') ||
|
|
937
|
+
(server_error.type !== undefined) ||
|
|
938
|
+
(server_error.message !== undefined) ||
|
|
939
|
+
(server_error.additional_data !== undefined)) {
|
|
940
|
+
return rxjs.throwError(parseException(server_error));
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
else {
|
|
945
|
+
if (errorRes.type !== undefined) {
|
|
946
|
+
if (errorRes.type === 'exception') {
|
|
947
|
+
return rxjs.throwError(parseException(errorRes));
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
else if (errorRes.transaction_type === 'Login') {
|
|
951
|
+
return rxjs.throwError(parseLoginErrors(errorRes));
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
return rxjs.throwError(errorRes);
|
|
955
|
+
}));
|
|
956
|
+
};
|
|
957
|
+
EsolveAuthService.prototype.logout = function () {
|
|
958
|
+
this.session.clearTimer();
|
|
959
|
+
this.getAccessToken('', '', true).toPromise().then(function (_) { }, function (error) {
|
|
960
|
+
console.log(error);
|
|
961
|
+
});
|
|
962
|
+
};
|
|
963
|
+
EsolveAuthService.prototype.handleExpiration = function () {
|
|
964
|
+
var _this = this;
|
|
965
|
+
return function (session) {
|
|
966
|
+
_this.checkAccessToken(session).then(function (response) {
|
|
967
|
+
_this.handleAuthentication(response);
|
|
968
|
+
}, function () {
|
|
969
|
+
_this.logout();
|
|
970
|
+
});
|
|
971
|
+
};
|
|
972
|
+
};
|
|
973
|
+
EsolveAuthService.prototype.handleAuthentication = function (responseData) {
|
|
974
|
+
if (responseData.additional_data.key) {
|
|
975
|
+
this.session.handleSession(responseData.additional_data.user_id, responseData.additional_data.key, +responseData.additional_data.expiry_time, +responseData.additional_data.expires, this.handleExpiration());
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
EsolveAuthService.prototype.handleError = function (errorRes) {
|
|
979
|
+
var error = {
|
|
980
|
+
message: 'An unknown error occurred',
|
|
981
|
+
data: {}
|
|
982
|
+
};
|
|
983
|
+
if ((!errorRes.type) || (!errorRes.service_type) || (!errorRes.message)) {
|
|
984
|
+
return rxjs.throwError(error);
|
|
985
|
+
}
|
|
986
|
+
if (errorRes.message.trim() !== '') {
|
|
987
|
+
error.message = errorRes.message;
|
|
988
|
+
}
|
|
989
|
+
if (errorRes.additional_data) {
|
|
990
|
+
error.data = errorRes.additional_data;
|
|
991
|
+
}
|
|
992
|
+
return rxjs.throwError(error);
|
|
993
|
+
};
|
|
994
|
+
return EsolveAuthService;
|
|
995
|
+
}());
|
|
996
|
+
EsolveAuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }, { token: EsolveSessionService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
997
|
+
EsolveAuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthService, providedIn: 'root' });
|
|
998
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveAuthService, decorators: [{
|
|
999
|
+
type: i0.Injectable,
|
|
1000
|
+
args: [{
|
|
1001
|
+
providedIn: 'root'
|
|
1002
|
+
}]
|
|
1003
|
+
}], ctorParameters: function () {
|
|
1004
|
+
return [{ type: undefined, decorators: [{
|
|
1005
|
+
type: i0.Inject,
|
|
1006
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1007
|
+
}] }, { type: i1__namespace.HttpClient }, { type: EsolveSessionService }];
|
|
1008
|
+
} });
|
|
1009
|
+
|
|
1010
|
+
var EsolveMediaArticle = /** @class */ (function () {
|
|
1011
|
+
function EsolveMediaArticle(identifier, title, article, image_url, tags, topics, seo_title, seo_keywords, seo_description) {
|
|
1012
|
+
if (image_url === void 0) { image_url = ''; }
|
|
1013
|
+
if (tags === void 0) { tags = []; }
|
|
1014
|
+
if (topics === void 0) { topics = []; }
|
|
1015
|
+
if (seo_title === void 0) { seo_title = ''; }
|
|
1016
|
+
if (seo_keywords === void 0) { seo_keywords = ''; }
|
|
1017
|
+
if (seo_description === void 0) { seo_description = ''; }
|
|
1018
|
+
this.identifier = identifier;
|
|
1019
|
+
this.title = title;
|
|
1020
|
+
this.article = article;
|
|
1021
|
+
this.image_url = image_url;
|
|
1022
|
+
this.tags = tags;
|
|
1023
|
+
this.topics = topics;
|
|
1024
|
+
if (seo_title.trim() === '') {
|
|
1025
|
+
seo_title = this.title;
|
|
1026
|
+
}
|
|
1027
|
+
this.seo_details = new EsolveSEOInfo(seo_title, seo_description, seo_keywords);
|
|
1028
|
+
}
|
|
1029
|
+
return EsolveMediaArticle;
|
|
1030
|
+
}());
|
|
1031
|
+
|
|
1032
|
+
var EsolveTag = /** @class */ (function () {
|
|
1033
|
+
function EsolveTag(id, tag_phrase, tag_weight, description) {
|
|
1034
|
+
this.id = id;
|
|
1035
|
+
this.tag_phrase = tag_phrase;
|
|
1036
|
+
this.tag_weight = tag_weight;
|
|
1037
|
+
this.description = description;
|
|
1038
|
+
}
|
|
1039
|
+
return EsolveTag;
|
|
1040
|
+
}());
|
|
1041
|
+
|
|
1042
|
+
var EsolveTopic = /** @class */ (function () {
|
|
1043
|
+
function EsolveTopic(id, name, short_description, sort_priority) {
|
|
1044
|
+
this.id = id;
|
|
1045
|
+
this.name = name;
|
|
1046
|
+
this.short_description = short_description;
|
|
1047
|
+
this.sort_priority = sort_priority;
|
|
1048
|
+
}
|
|
1049
|
+
return EsolveTopic;
|
|
1050
|
+
}());
|
|
1051
|
+
|
|
1052
|
+
var EsolveMediaService = /** @class */ (function () {
|
|
1053
|
+
function EsolveMediaService(config, http) {
|
|
1054
|
+
this.config = config;
|
|
1055
|
+
this.http = http;
|
|
1056
|
+
}
|
|
1057
|
+
EsolveMediaService.prototype.processMediaRecord = function (record) {
|
|
1058
|
+
var e_1, _a, e_2, _b;
|
|
1059
|
+
var tags = [];
|
|
1060
|
+
var topics = [];
|
|
1061
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
1062
|
+
try {
|
|
1063
|
+
for (var _c = __values(record.tags), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1064
|
+
var tag = _d.value;
|
|
1065
|
+
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1069
|
+
finally {
|
|
1070
|
+
try {
|
|
1071
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1072
|
+
}
|
|
1073
|
+
finally { if (e_1) throw e_1.error; }
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
1077
|
+
try {
|
|
1078
|
+
for (var _e = __values(record.topics), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1079
|
+
var topic = _f.value;
|
|
1080
|
+
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1084
|
+
finally {
|
|
1085
|
+
try {
|
|
1086
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1087
|
+
}
|
|
1088
|
+
finally { if (e_2) throw e_2.error; }
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1092
|
+
};
|
|
1093
|
+
/**
|
|
1094
|
+
* Retrieves media records from eSolve instance.
|
|
1095
|
+
* @param params Header params
|
|
1096
|
+
*/
|
|
1097
|
+
EsolveMediaService.prototype.getMediaRecords = function (params) {
|
|
1098
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1099
|
+
return this.http.get(this.config.api_url + "/service/get-media.php", { params: params });
|
|
1100
|
+
};
|
|
1101
|
+
/**
|
|
1102
|
+
* Retrieves the media record from the eSolve instance using the identifier.
|
|
1103
|
+
* @param identifier String representing the eSolve media indentifier
|
|
1104
|
+
*/
|
|
1105
|
+
EsolveMediaService.prototype.getMediaArticle = function (identifier) {
|
|
1106
|
+
var _this = this;
|
|
1107
|
+
var params = new i1.HttpParams({
|
|
1108
|
+
fromObject: {
|
|
1109
|
+
identifier: identifier
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
// TODO: Error Handling
|
|
1113
|
+
return this.getMediaRecords(params).pipe(operators.map(function (response) {
|
|
1114
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1115
|
+
throw response;
|
|
1116
|
+
}
|
|
1117
|
+
var mediaRecord = response.records[0];
|
|
1118
|
+
if (!mediaRecord.active) {
|
|
1119
|
+
throw response;
|
|
1120
|
+
}
|
|
1121
|
+
return _this.processMediaRecord(mediaRecord);
|
|
1122
|
+
}));
|
|
1123
|
+
};
|
|
1124
|
+
/**
|
|
1125
|
+
* Retrieves a group of media records from the eSolve instance linked to a group.
|
|
1126
|
+
* @param media_group String representing the eSolve media group
|
|
1127
|
+
*/
|
|
1128
|
+
EsolveMediaService.prototype.getGroupedMediaArticles = function (media_group) {
|
|
1129
|
+
var _this = this;
|
|
1130
|
+
var params = new i1.HttpParams({
|
|
1131
|
+
fromObject: {
|
|
1132
|
+
media_group_sef: media_group
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
return this.getMediaRecords(params).pipe(operators.map(function (response) {
|
|
1136
|
+
var e_3, _a;
|
|
1137
|
+
var mediaArticles = [];
|
|
1138
|
+
if ((response.records !== undefined) && (response.records.length > 0)) {
|
|
1139
|
+
try {
|
|
1140
|
+
for (var _b = __values(response.records), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1141
|
+
var mediaRecord = _c.value;
|
|
1142
|
+
if (mediaRecord.active) {
|
|
1143
|
+
mediaArticles.push(_this.processMediaRecord(mediaRecord));
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1148
|
+
finally {
|
|
1149
|
+
try {
|
|
1150
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1151
|
+
}
|
|
1152
|
+
finally { if (e_3) throw e_3.error; }
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
return mediaArticles;
|
|
1156
|
+
}));
|
|
1157
|
+
};
|
|
1158
|
+
return EsolveMediaService;
|
|
1159
|
+
}());
|
|
1160
|
+
EsolveMediaService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1161
|
+
EsolveMediaService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMediaService, providedIn: 'root' });
|
|
1162
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMediaService, decorators: [{
|
|
1163
|
+
type: i0.Injectable,
|
|
1164
|
+
args: [{
|
|
1165
|
+
providedIn: 'root'
|
|
1166
|
+
}]
|
|
1167
|
+
}], ctorParameters: function () {
|
|
1168
|
+
return [{ type: undefined, decorators: [{
|
|
1169
|
+
type: i0.Inject,
|
|
1170
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1171
|
+
}] }, { type: i1__namespace.HttpClient }];
|
|
1172
|
+
} });
|
|
1173
|
+
|
|
1174
|
+
var EsolveNewsArticle = /** @class */ (function () {
|
|
1175
|
+
function EsolveNewsArticle(id, title, sef_title, article, short_description, txdate, active, image, featured, author, seo_title, seo_keywords) {
|
|
1176
|
+
if (seo_title === void 0) { seo_title = ''; }
|
|
1177
|
+
if (seo_keywords === void 0) { seo_keywords = ''; }
|
|
1178
|
+
this.id = id;
|
|
1179
|
+
this.title = title;
|
|
1180
|
+
this.sef_title = sef_title;
|
|
1181
|
+
this.article = article;
|
|
1182
|
+
this.short_description = short_description;
|
|
1183
|
+
this.txdate = txdate;
|
|
1184
|
+
this.active = active;
|
|
1185
|
+
this.image = image;
|
|
1186
|
+
this.featured = featured;
|
|
1187
|
+
this.author = author;
|
|
1188
|
+
if (seo_title.trim() === '') {
|
|
1189
|
+
seo_title = this.title;
|
|
1190
|
+
}
|
|
1191
|
+
this.seo_details = new EsolveSEOInfo(seo_title, short_description, seo_keywords);
|
|
1192
|
+
}
|
|
1193
|
+
return EsolveNewsArticle;
|
|
1194
|
+
}());
|
|
1195
|
+
|
|
1196
|
+
var EsolveNewsGroup = /** @class */ (function () {
|
|
1197
|
+
function EsolveNewsGroup(id, name, description, sef_name) {
|
|
1198
|
+
this.id = id;
|
|
1199
|
+
this.name = name;
|
|
1200
|
+
this.description = description;
|
|
1201
|
+
this.sef_name = sef_name;
|
|
1202
|
+
}
|
|
1203
|
+
return EsolveNewsGroup;
|
|
1204
|
+
}());
|
|
1205
|
+
|
|
1206
|
+
var EsolveNewsArticleList = /** @class */ (function () {
|
|
1207
|
+
function EsolveNewsArticleList(newsArticles, total, page) {
|
|
1208
|
+
this.newsArticles = newsArticles;
|
|
1209
|
+
this.total = total;
|
|
1210
|
+
this.page = page;
|
|
1211
|
+
}
|
|
1212
|
+
return EsolveNewsArticleList;
|
|
1213
|
+
}());
|
|
1214
|
+
|
|
1215
|
+
var EsolveNewsArticleAuthor = /** @class */ (function () {
|
|
1216
|
+
function EsolveNewsArticleAuthor(userid, email, firstname, surname) {
|
|
1217
|
+
this.userid = userid;
|
|
1218
|
+
this.email = email;
|
|
1219
|
+
this.firstname = firstname;
|
|
1220
|
+
this.surname = surname;
|
|
1221
|
+
}
|
|
1222
|
+
return EsolveNewsArticleAuthor;
|
|
1223
|
+
}());
|
|
1224
|
+
|
|
1225
|
+
var EsolveNewsService = /** @class */ (function () {
|
|
1226
|
+
function EsolveNewsService(config, http) {
|
|
1227
|
+
this.config = config;
|
|
1228
|
+
this.http = http;
|
|
1229
|
+
}
|
|
1230
|
+
EsolveNewsService.prototype.getNewsRecords = function (params) {
|
|
1231
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1232
|
+
return this.http.get(this.config.api_url + "/service/get-news.php", { params: params });
|
|
1233
|
+
};
|
|
1234
|
+
EsolveNewsService.prototype.getNewsArticle = function (identifier) {
|
|
1235
|
+
var _this = this;
|
|
1236
|
+
var params = new i1.HttpParams({
|
|
1237
|
+
fromObject: {
|
|
1238
|
+
sef_title: identifier
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
return this.getNewsRecords(params).pipe(operators.map(function (response) {
|
|
1242
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1243
|
+
throw response;
|
|
1244
|
+
}
|
|
1245
|
+
var newsRecord = response.records[0];
|
|
1246
|
+
if (!newsRecord.active) {
|
|
1247
|
+
throw response;
|
|
1248
|
+
}
|
|
1249
|
+
return _this.processNewsArticle(newsRecord);
|
|
1250
|
+
}));
|
|
1251
|
+
};
|
|
1252
|
+
EsolveNewsService.prototype.getNewsArticles = function (options) {
|
|
1253
|
+
var _this = this;
|
|
1254
|
+
var params = new i1.HttpParams();
|
|
1255
|
+
if (options.news_group_id) {
|
|
1256
|
+
params = params.set('news_group_id', options.news_group_id.toString());
|
|
1257
|
+
}
|
|
1258
|
+
else if (options.news_group_sef) {
|
|
1259
|
+
params = params.set('news_group_sef', options.news_group_sef.toString());
|
|
1260
|
+
}
|
|
1261
|
+
if (options.page) {
|
|
1262
|
+
params = params.set('page', options.page.toString());
|
|
1263
|
+
}
|
|
1264
|
+
if (options.rows) {
|
|
1265
|
+
params = params.set('rows', options.rows.toString());
|
|
1266
|
+
}
|
|
1267
|
+
if (options.feature_only) {
|
|
1268
|
+
params = params.set('feature_only', options.feature_only.toString());
|
|
1269
|
+
}
|
|
1270
|
+
if (options.manufacturers_id) {
|
|
1271
|
+
params = params.set('manufacturers_id', options.manufacturers_id.toString());
|
|
1272
|
+
}
|
|
1273
|
+
if (options.ranges_id) {
|
|
1274
|
+
params = params.set('ranges_id', options.ranges_id.toString());
|
|
1275
|
+
}
|
|
1276
|
+
if (options.from_date) {
|
|
1277
|
+
params = params.set('from_date', options.from_date.toString());
|
|
1278
|
+
}
|
|
1279
|
+
if (options.to_date) {
|
|
1280
|
+
params = params.set('to_date', options.to_date.toString());
|
|
1281
|
+
}
|
|
1282
|
+
return this.getNewsRecords(params).pipe(operators.map(function (response) {
|
|
1283
|
+
if (response.records === undefined) {
|
|
1284
|
+
throw response;
|
|
1285
|
+
}
|
|
1286
|
+
var newsArticles = [];
|
|
1287
|
+
response.records.forEach(function (newsArticleRecord) {
|
|
1288
|
+
newsArticles.push(_this.processNewsArticle(newsArticleRecord));
|
|
1289
|
+
});
|
|
1290
|
+
return new EsolveNewsArticleList(newsArticles, response.additional_data.total_records, options.page || 0);
|
|
1291
|
+
}));
|
|
1292
|
+
};
|
|
1293
|
+
EsolveNewsService.prototype.getNewsGroups = function () {
|
|
1294
|
+
var params = new i1.HttpParams();
|
|
1295
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1296
|
+
return this.http.get(this.config.api_url + "/service/get-news-groups.php", { params: params }).pipe(operators.map(function (response) {
|
|
1297
|
+
if (response.records === undefined) {
|
|
1298
|
+
throw response;
|
|
1299
|
+
}
|
|
1300
|
+
var newsGroups = [];
|
|
1301
|
+
response.records.forEach(function (newsGroupRecord) {
|
|
1302
|
+
newsGroups.push(new EsolveNewsGroup(newsGroupRecord.id, newsGroupRecord.name, newsGroupRecord.description, newsGroupRecord.sef_name));
|
|
1303
|
+
});
|
|
1304
|
+
return newsGroups;
|
|
1305
|
+
}));
|
|
1306
|
+
};
|
|
1307
|
+
EsolveNewsService.prototype.processNewsArticle = function (newsRecord) {
|
|
1308
|
+
var author = new EsolveNewsArticleAuthor(newsRecord.user.userid, newsRecord.user.email, newsRecord.user.firstname, newsRecord.user.surname);
|
|
1309
|
+
return new EsolveNewsArticle(newsRecord.id, newsRecord.title, newsRecord.sef_title, newsRecord.article, newsRecord.short_description, newsRecord.txdate, newsRecord.active, newsRecord.image, newsRecord.featured, author, newsRecord.seo_page_title, newsRecord.seo_keywords);
|
|
1310
|
+
};
|
|
1311
|
+
return EsolveNewsService;
|
|
1312
|
+
}());
|
|
1313
|
+
EsolveNewsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveNewsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1314
|
+
EsolveNewsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveNewsService, providedIn: 'root' });
|
|
1315
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveNewsService, decorators: [{
|
|
1316
|
+
type: i0.Injectable,
|
|
1317
|
+
args: [{
|
|
1318
|
+
providedIn: 'root'
|
|
1319
|
+
}]
|
|
1320
|
+
}], ctorParameters: function () {
|
|
1321
|
+
return [{ type: undefined, decorators: [{
|
|
1322
|
+
type: i0.Inject,
|
|
1323
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1324
|
+
}] }, { type: i1__namespace.HttpClient }];
|
|
1325
|
+
} });
|
|
1326
|
+
|
|
1327
|
+
var EsolveBanner = /** @class */ (function () {
|
|
1328
|
+
function EsolveBanner(id, banner_display_container, identifier, type, title, article, sort_priority, link, images) {
|
|
1329
|
+
this.id = id;
|
|
1330
|
+
this.banner_display_container = banner_display_container;
|
|
1331
|
+
this.identifier = identifier;
|
|
1332
|
+
this.type = type;
|
|
1333
|
+
this.title = title;
|
|
1334
|
+
this.article = article;
|
|
1335
|
+
this.sort_priority = sort_priority;
|
|
1336
|
+
this.link = link;
|
|
1337
|
+
this.desktop_images = [];
|
|
1338
|
+
this.mobile_images = [];
|
|
1339
|
+
this.sub_images = [];
|
|
1340
|
+
if (images.desktop) {
|
|
1341
|
+
this.desktop_images = images.desktop;
|
|
1342
|
+
}
|
|
1343
|
+
if (images.mobile) {
|
|
1344
|
+
this.mobile_images = images.mobile;
|
|
1345
|
+
}
|
|
1346
|
+
if (images.sub) {
|
|
1347
|
+
this.sub_images = images.sub;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
return EsolveBanner;
|
|
1351
|
+
}());
|
|
1352
|
+
|
|
1353
|
+
var EsolveBannerImage = /** @class */ (function () {
|
|
1354
|
+
function EsolveBannerImage(id, image_type, width, height, filename, hotspots) {
|
|
1355
|
+
this.id = id;
|
|
1356
|
+
this.image_type = image_type;
|
|
1357
|
+
this.width = width;
|
|
1358
|
+
this.height = height;
|
|
1359
|
+
this.filename = filename;
|
|
1360
|
+
this.hotspots = hotspots;
|
|
1361
|
+
}
|
|
1362
|
+
Object.defineProperty(EsolveBannerImage.prototype, "src", {
|
|
1363
|
+
get: function () {
|
|
1364
|
+
return '/images/banners/' + this.filename;
|
|
1365
|
+
},
|
|
1366
|
+
enumerable: false,
|
|
1367
|
+
configurable: true
|
|
1368
|
+
});
|
|
1369
|
+
return EsolveBannerImage;
|
|
1370
|
+
}());
|
|
1371
|
+
|
|
1372
|
+
var EsolveBannerImageHotspot = /** @class */ (function () {
|
|
1373
|
+
function EsolveBannerImageHotspot(url, target, coords, coords_string) {
|
|
1374
|
+
this.url = url;
|
|
1375
|
+
this.target = target;
|
|
1376
|
+
this.coords = coords;
|
|
1377
|
+
this.coords_string = coords_string;
|
|
1378
|
+
}
|
|
1379
|
+
return EsolveBannerImageHotspot;
|
|
1380
|
+
}());
|
|
1381
|
+
|
|
1382
|
+
var EsolveBannerService = /** @class */ (function () {
|
|
1383
|
+
function EsolveBannerService(config, http) {
|
|
1384
|
+
this.config = config;
|
|
1385
|
+
this.http = http;
|
|
1386
|
+
}
|
|
1387
|
+
EsolveBannerService.prototype.processBannerImageHotspots = function (hotspot_records) {
|
|
1388
|
+
var e_1, _a;
|
|
1389
|
+
var hotspots = [];
|
|
1390
|
+
if (hotspot_records.length > 0) {
|
|
1391
|
+
try {
|
|
1392
|
+
for (var hotspot_records_1 = __values(hotspot_records), hotspot_records_1_1 = hotspot_records_1.next(); !hotspot_records_1_1.done; hotspot_records_1_1 = hotspot_records_1.next()) {
|
|
1393
|
+
var hotspot_record = hotspot_records_1_1.value;
|
|
1394
|
+
var hotspot = new EsolveBannerImageHotspot(hotspot_record.url, hotspot_record.target, hotspot_record.coords, hotspot_record.coords_string);
|
|
1395
|
+
hotspots.push(hotspot);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1399
|
+
finally {
|
|
1400
|
+
try {
|
|
1401
|
+
if (hotspot_records_1_1 && !hotspot_records_1_1.done && (_a = hotspot_records_1.return)) _a.call(hotspot_records_1);
|
|
1402
|
+
}
|
|
1403
|
+
finally { if (e_1) throw e_1.error; }
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
return hotspots;
|
|
1407
|
+
};
|
|
1408
|
+
EsolveBannerService.prototype.processBannerImages = function (image_records, banner_type) {
|
|
1409
|
+
var e_2, _a;
|
|
1410
|
+
var images = [];
|
|
1411
|
+
if (image_records.length > 0) {
|
|
1412
|
+
try {
|
|
1413
|
+
for (var image_records_1 = __values(image_records), image_records_1_1 = image_records_1.next(); !image_records_1_1.done; image_records_1_1 = image_records_1.next()) {
|
|
1414
|
+
var image_record = image_records_1_1.value;
|
|
1415
|
+
var image = new EsolveBannerImage(+image_record.id, image_record.image_type, +image_record.width, +image_record.height, image_record.filename);
|
|
1416
|
+
if ((banner_type === 'hotspot') && (image_record.hotspots)) {
|
|
1417
|
+
var hotspots = this.processBannerImageHotspots(image_record.hotspots);
|
|
1418
|
+
image.hotspots = hotspots;
|
|
1419
|
+
}
|
|
1420
|
+
images.push(image);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1424
|
+
finally {
|
|
1425
|
+
try {
|
|
1426
|
+
if (image_records_1_1 && !image_records_1_1.done && (_a = image_records_1.return)) _a.call(image_records_1);
|
|
1427
|
+
}
|
|
1428
|
+
finally { if (e_2) throw e_2.error; }
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
return images;
|
|
1432
|
+
};
|
|
1433
|
+
/**
|
|
1434
|
+
* Process banner records into banner objects
|
|
1435
|
+
* @param records Array of records
|
|
1436
|
+
* @returns List of banners
|
|
1437
|
+
*/
|
|
1438
|
+
EsolveBannerService.prototype.processBanners = function (records) {
|
|
1439
|
+
var e_3, _a;
|
|
1440
|
+
var banners = [];
|
|
1441
|
+
if ((records) && (records.length > 0)) {
|
|
1442
|
+
try {
|
|
1443
|
+
for (var records_1 = __values(records), records_1_1 = records_1.next(); !records_1_1.done; records_1_1 = records_1.next()) {
|
|
1444
|
+
var record = records_1_1.value;
|
|
1445
|
+
var image_sets = {};
|
|
1446
|
+
if (record.images.desktop) {
|
|
1447
|
+
image_sets.desktop = this.processBannerImages(record.images.desktop, record.type);
|
|
1448
|
+
}
|
|
1449
|
+
if (record.images.mobile) {
|
|
1450
|
+
image_sets.mobile = this.processBannerImages(record.images.mobile, record.type);
|
|
1451
|
+
}
|
|
1452
|
+
if (record.images.sub) {
|
|
1453
|
+
image_sets.sub = this.processBannerImages(record.images.sub, record.type);
|
|
1454
|
+
}
|
|
1455
|
+
var banner = new EsolveBanner(+record.id, record.banner_display_container, record.identifier, record.type, record.title, record.article, +record.sort_priority, {
|
|
1456
|
+
url: record.link.url,
|
|
1457
|
+
target: record.link.target
|
|
1458
|
+
}, image_sets);
|
|
1459
|
+
banners.push(banner);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1463
|
+
finally {
|
|
1464
|
+
try {
|
|
1465
|
+
if (records_1_1 && !records_1_1.done && (_a = records_1.return)) _a.call(records_1);
|
|
1466
|
+
}
|
|
1467
|
+
finally { if (e_3) throw e_3.error; }
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
return banners;
|
|
1471
|
+
};
|
|
1472
|
+
/**
|
|
1473
|
+
* Retrieves banners records from eSolve instance
|
|
1474
|
+
*
|
|
1475
|
+
* @returns An observable of eSolve banners.
|
|
1476
|
+
*/
|
|
1477
|
+
EsolveBannerService.prototype.getBanners = function (identifier, banner_display_container, enable_date_filter) {
|
|
1478
|
+
var _this = this;
|
|
1479
|
+
if (enable_date_filter === void 0) { enable_date_filter = false; }
|
|
1480
|
+
var params = new i1.HttpParams({
|
|
1481
|
+
fromObject: {
|
|
1482
|
+
ws_id: this.config.wsid,
|
|
1483
|
+
enable_date_filter: enable_date_filter
|
|
1484
|
+
}
|
|
1485
|
+
});
|
|
1486
|
+
if (identifier) {
|
|
1487
|
+
params = params.set('identifier', identifier);
|
|
1488
|
+
}
|
|
1489
|
+
if (banner_display_container) {
|
|
1490
|
+
params = params.set('banner_display_container', banner_display_container);
|
|
1491
|
+
}
|
|
1492
|
+
return this.http.get(this.config.api_url + "/service/get-banners.php", { params: params }).pipe(operators.map(function (response) {
|
|
1493
|
+
if (response.records === undefined) {
|
|
1494
|
+
throw response;
|
|
1495
|
+
}
|
|
1496
|
+
return _this.processBanners(response.records);
|
|
1497
|
+
}));
|
|
1498
|
+
};
|
|
1499
|
+
return EsolveBannerService;
|
|
1500
|
+
}());
|
|
1501
|
+
EsolveBannerService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1502
|
+
EsolveBannerService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveBannerService, providedIn: 'root' });
|
|
1503
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveBannerService, decorators: [{
|
|
1504
|
+
type: i0.Injectable,
|
|
1505
|
+
args: [{
|
|
1506
|
+
providedIn: 'root'
|
|
1507
|
+
}]
|
|
1508
|
+
}], ctorParameters: function () {
|
|
1509
|
+
return [{ type: undefined, decorators: [{
|
|
1510
|
+
type: i0.Inject,
|
|
1511
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1512
|
+
}] }, { type: i1__namespace.HttpClient }];
|
|
1513
|
+
} });
|
|
1514
|
+
|
|
1515
|
+
var EsolveMenuItem = /** @class */ (function () {
|
|
1516
|
+
function EsolveMenuItem(url, name, target, children) {
|
|
1517
|
+
if (children === void 0) { children = []; }
|
|
1518
|
+
this.url = url;
|
|
1519
|
+
this.name = name;
|
|
1520
|
+
this.target = target;
|
|
1521
|
+
this.children = children;
|
|
1522
|
+
}
|
|
1523
|
+
return EsolveMenuItem;
|
|
1524
|
+
}());
|
|
1525
|
+
|
|
1526
|
+
var EsolveMenuService = /** @class */ (function () {
|
|
1527
|
+
function EsolveMenuService(config, http) {
|
|
1528
|
+
this.config = config;
|
|
1529
|
+
this.http = http;
|
|
1530
|
+
}
|
|
1531
|
+
EsolveMenuService.prototype.getMenuTree = function (identifier) {
|
|
1532
|
+
var _this = this;
|
|
1533
|
+
var menuParams = new i1.HttpParams();
|
|
1534
|
+
menuParams = menuParams.set('identifier', identifier);
|
|
1535
|
+
menuParams = menuParams.set('ws_id', this.config.wsid);
|
|
1536
|
+
return this.http.get(this.config.api_url + "/service/get-menu-tree.php", { params: menuParams }).pipe(operators.map(function (response) {
|
|
1537
|
+
if ((!response) || (response.records === undefined)) {
|
|
1538
|
+
throw response;
|
|
1539
|
+
}
|
|
1540
|
+
else if (response.records.length === 0) {
|
|
1541
|
+
return [];
|
|
1542
|
+
}
|
|
1543
|
+
return _this.handleMenu(response.records);
|
|
1544
|
+
}));
|
|
1545
|
+
};
|
|
1546
|
+
EsolveMenuService.prototype.handleMenu = function (records) {
|
|
1547
|
+
var e_1, _a;
|
|
1548
|
+
var menu = [];
|
|
1549
|
+
if (typeof records !== 'undefined') {
|
|
1550
|
+
try {
|
|
1551
|
+
for (var records_1 = __values(records), records_1_1 = records_1.next(); !records_1_1.done; records_1_1 = records_1.next()) {
|
|
1552
|
+
var menuTreeRecord = records_1_1.value;
|
|
1553
|
+
menu.push(new EsolveMenuItem(menuTreeRecord.sef_url, menuTreeRecord.name, menuTreeRecord.target, this.handleMenu(menuTreeRecord.children)));
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1557
|
+
finally {
|
|
1558
|
+
try {
|
|
1559
|
+
if (records_1_1 && !records_1_1.done && (_a = records_1.return)) _a.call(records_1);
|
|
1560
|
+
}
|
|
1561
|
+
finally { if (e_1) throw e_1.error; }
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
return menu;
|
|
1565
|
+
};
|
|
1566
|
+
return EsolveMenuService;
|
|
1567
|
+
}());
|
|
1568
|
+
EsolveMenuService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMenuService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1569
|
+
EsolveMenuService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMenuService, providedIn: 'root' });
|
|
1570
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveMenuService, decorators: [{
|
|
1571
|
+
type: i0.Injectable,
|
|
1572
|
+
args: [{
|
|
1573
|
+
providedIn: 'root'
|
|
1574
|
+
}]
|
|
1575
|
+
}], ctorParameters: function () {
|
|
1576
|
+
return [{ type: undefined, decorators: [{
|
|
1577
|
+
type: i0.Inject,
|
|
1578
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1579
|
+
}] }, { type: i1__namespace.HttpClient }];
|
|
1580
|
+
} });
|
|
1581
|
+
|
|
1582
|
+
var EsolveTopicService = /** @class */ (function () {
|
|
1583
|
+
function EsolveTopicService(config, http) {
|
|
1584
|
+
this.config = config;
|
|
1585
|
+
this.http = http;
|
|
1586
|
+
}
|
|
1587
|
+
EsolveTopicService.prototype.processTopics = function (records) {
|
|
1588
|
+
var e_1, _a;
|
|
1589
|
+
var topics = [];
|
|
1590
|
+
if (records) {
|
|
1591
|
+
try {
|
|
1592
|
+
for (var records_1 = __values(records), records_1_1 = records_1.next(); !records_1_1.done; records_1_1 = records_1.next()) {
|
|
1593
|
+
var record = records_1_1.value;
|
|
1594
|
+
var topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1595
|
+
topics.push(topic);
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1599
|
+
finally {
|
|
1600
|
+
try {
|
|
1601
|
+
if (records_1_1 && !records_1_1.done && (_a = records_1.return)) _a.call(records_1);
|
|
1602
|
+
}
|
|
1603
|
+
finally { if (e_1) throw e_1.error; }
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
return topics;
|
|
1607
|
+
};
|
|
1608
|
+
/**
|
|
1609
|
+
* Retrieves active topics from the list of topic ID's. Note that inactive or expired
|
|
1610
|
+
* topics will not be retrieved.
|
|
1611
|
+
*
|
|
1612
|
+
* @param topic_id_list List of topic ID's that need to be retrieved
|
|
1613
|
+
*/
|
|
1614
|
+
EsolveTopicService.prototype.getTopics = function (topic_id_list) {
|
|
1615
|
+
var _this = this;
|
|
1616
|
+
if (topic_id_list === void 0) { topic_id_list = []; }
|
|
1617
|
+
var params = new i1.HttpParams({
|
|
1618
|
+
fromObject: {
|
|
1619
|
+
ws_id: this.config.wsid
|
|
1620
|
+
}
|
|
1621
|
+
});
|
|
1622
|
+
if (topic_id_list.length > 0) {
|
|
1623
|
+
params = params.append('topic_id', topic_id_list.join(','));
|
|
1624
|
+
}
|
|
1625
|
+
return this.http.get(this.config.api_url + "/service/get-topics.php", { params: params }).pipe(operators.map(function (response) {
|
|
1626
|
+
if (response.records === undefined) {
|
|
1627
|
+
throw response;
|
|
1628
|
+
}
|
|
1629
|
+
return _this.processTopics(response.records);
|
|
1630
|
+
}));
|
|
1631
|
+
};
|
|
1632
|
+
return EsolveTopicService;
|
|
1633
|
+
}());
|
|
1634
|
+
EsolveTopicService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1635
|
+
EsolveTopicService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveTopicService, providedIn: 'root' });
|
|
1636
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveTopicService, decorators: [{
|
|
1637
|
+
type: i0.Injectable,
|
|
1638
|
+
args: [{
|
|
1639
|
+
providedIn: 'root'
|
|
1640
|
+
}]
|
|
1641
|
+
}], ctorParameters: function () {
|
|
1642
|
+
return [{ type: undefined, decorators: [{
|
|
1643
|
+
type: i0.Inject,
|
|
1644
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
1645
|
+
}] }, { type: i1__namespace.HttpClient }];
|
|
1646
|
+
} });
|
|
1647
|
+
|
|
1648
|
+
var EsolveStockBadge = /** @class */ (function () {
|
|
1649
|
+
function EsolveStockBadge(id, text, identifier, font_colour, badge_colour, sort_priority) {
|
|
1650
|
+
this.id = id;
|
|
1651
|
+
this.text = text;
|
|
1652
|
+
this.identifier = identifier;
|
|
1653
|
+
this.font_colour = font_colour;
|
|
1654
|
+
this.badge_colour = badge_colour;
|
|
1655
|
+
this.sort_priority = sort_priority;
|
|
1656
|
+
}
|
|
1657
|
+
return EsolveStockBadge;
|
|
1658
|
+
}());
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* Price of eSolve stock item
|
|
1662
|
+
*/
|
|
1663
|
+
var EsolveStockPrice = /** @class */ (function () {
|
|
1664
|
+
/**
|
|
1665
|
+
* Create stock price instance
|
|
1666
|
+
* @param base_price Price without tax
|
|
1667
|
+
* @param base_price_with_tax Price with tax
|
|
1668
|
+
* @param sell_price Price without tax and with discounts applied if appilcable
|
|
1669
|
+
* @param sell_price_with_tax Price with tax and with discounts applied if appilcable
|
|
1670
|
+
*/
|
|
1671
|
+
function EsolveStockPrice(
|
|
1672
|
+
/**
|
|
1673
|
+
* Price without tax
|
|
1674
|
+
*/
|
|
1675
|
+
base_price,
|
|
1676
|
+
/**
|
|
1677
|
+
* Price with tax
|
|
1678
|
+
*/
|
|
1679
|
+
base_price_with_tax,
|
|
1680
|
+
/**
|
|
1681
|
+
* Price without tax and with discounts applied if appilcable
|
|
1682
|
+
*/
|
|
1683
|
+
sell_price,
|
|
1684
|
+
/**
|
|
1685
|
+
* Price with tax and with discounts applied if appilcable
|
|
1686
|
+
*/
|
|
1687
|
+
sell_price_with_tax) {
|
|
1688
|
+
this.base_price = base_price;
|
|
1689
|
+
this.base_price_with_tax = base_price_with_tax;
|
|
1690
|
+
this.sell_price = sell_price;
|
|
1691
|
+
this.sell_price_with_tax = sell_price_with_tax;
|
|
1692
|
+
if ((this.base_price === 0) && (this.sell_price > 0)) {
|
|
1693
|
+
this.base_price = this.sell_price;
|
|
1694
|
+
this.base_price_with_tax = this.sell_price_with_tax;
|
|
1695
|
+
}
|
|
1696
|
+
else if ((this.base_price > 0) && (this.sell_price === 0)) {
|
|
1697
|
+
this.sell_price = this.base_price;
|
|
1698
|
+
this.sell_price_with_tax = this.base_price_with_tax;
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
return EsolveStockPrice;
|
|
1702
|
+
}());
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* Stock Item object. It can be a service or a product (physical and/or digital).
|
|
1706
|
+
*/
|
|
1707
|
+
var EsolveStockItem = /** @class */ (function () {
|
|
1708
|
+
/**
|
|
1709
|
+
* Constructs an instance of EsolveStockItem
|
|
1710
|
+
*
|
|
1711
|
+
* @param id eSolve Generated ID
|
|
1712
|
+
* @param code Code identifying the stock item
|
|
1713
|
+
* @param name Name of the stock item
|
|
1714
|
+
* @param sef_name Search engine friendly name
|
|
1715
|
+
* @param description Short description of stock item
|
|
1716
|
+
* @param active Active state
|
|
1717
|
+
* @param featured Featured state
|
|
1718
|
+
* @param image_name Image filename
|
|
1719
|
+
* @param price Default price
|
|
1720
|
+
* @param tags Linked tags
|
|
1721
|
+
* @param topics Linked topics
|
|
1722
|
+
* @param seo_title SEO page title
|
|
1723
|
+
* @param seo_keywords SEO page keywords
|
|
1724
|
+
*/
|
|
1725
|
+
function EsolveStockItem(
|
|
1726
|
+
/**
|
|
1727
|
+
* eSolve Generated ID
|
|
1728
|
+
*/
|
|
1729
|
+
id,
|
|
1730
|
+
/**
|
|
1731
|
+
* Code identifying the stock item
|
|
1732
|
+
*/
|
|
1733
|
+
code,
|
|
1734
|
+
/**
|
|
1735
|
+
* Name of the stock item
|
|
1736
|
+
*/
|
|
1737
|
+
name,
|
|
1738
|
+
/**
|
|
1739
|
+
* Search engine friendly name
|
|
1740
|
+
*/
|
|
1741
|
+
sef_name,
|
|
1742
|
+
/**
|
|
1743
|
+
* Short description of stock item
|
|
1744
|
+
*/
|
|
1745
|
+
description,
|
|
1746
|
+
/**
|
|
1747
|
+
* Active state
|
|
1748
|
+
*/
|
|
1749
|
+
active,
|
|
1750
|
+
/**
|
|
1751
|
+
* Featured state
|
|
1752
|
+
*/
|
|
1753
|
+
featured,
|
|
1754
|
+
/**
|
|
1755
|
+
* Image filename
|
|
1756
|
+
*/
|
|
1757
|
+
image_name,
|
|
1758
|
+
/**
|
|
1759
|
+
* Default price
|
|
1760
|
+
*/
|
|
1761
|
+
price,
|
|
1762
|
+
/**
|
|
1763
|
+
* Linked tags
|
|
1764
|
+
*/
|
|
1765
|
+
tags,
|
|
1766
|
+
/**
|
|
1767
|
+
* Linked topics
|
|
1768
|
+
*/
|
|
1769
|
+
topics,
|
|
1770
|
+
/**
|
|
1771
|
+
* Stock badges
|
|
1772
|
+
*/
|
|
1773
|
+
badges,
|
|
1774
|
+
/**
|
|
1775
|
+
* ID of default category linked to the stock item
|
|
1776
|
+
*/
|
|
1777
|
+
category_id,
|
|
1778
|
+
/**
|
|
1779
|
+
* ID of default subcategory linked to the stock item
|
|
1780
|
+
*/
|
|
1781
|
+
subcategory_id, seo_title, seo_keywords) {
|
|
1782
|
+
if (seo_title === void 0) { seo_title = ''; }
|
|
1783
|
+
if (seo_keywords === void 0) { seo_keywords = ''; }
|
|
1784
|
+
this.id = id;
|
|
1785
|
+
this.code = code;
|
|
1786
|
+
this.name = name;
|
|
1787
|
+
this.sef_name = sef_name;
|
|
1788
|
+
this.description = description;
|
|
1789
|
+
this.active = active;
|
|
1790
|
+
this.featured = featured;
|
|
1791
|
+
this.image_name = image_name;
|
|
1792
|
+
this.price = price;
|
|
1793
|
+
this.tags = tags;
|
|
1794
|
+
this.topics = topics;
|
|
1795
|
+
this.badges = badges;
|
|
1796
|
+
this.category_id = category_id;
|
|
1797
|
+
this.subcategory_id = subcategory_id;
|
|
1798
|
+
if (seo_title.trim() === '') {
|
|
1799
|
+
seo_title = this.name;
|
|
1800
|
+
}
|
|
1801
|
+
this.seo_details = new EsolveSEOInfo(seo_title, description, seo_keywords);
|
|
1802
|
+
}
|
|
1803
|
+
Object.defineProperty(EsolveStockItem.prototype, "tiny_image_src", {
|
|
1804
|
+
/**
|
|
1805
|
+
* Path to tiny stock image
|
|
1806
|
+
*/
|
|
1807
|
+
get: function () {
|
|
1808
|
+
return '/images/' + (this.image_name ? 'stock/tiny/' + this.image_name : 'no_image.jpg');
|
|
1809
|
+
},
|
|
1810
|
+
enumerable: false,
|
|
1811
|
+
configurable: true
|
|
1812
|
+
});
|
|
1813
|
+
Object.defineProperty(EsolveStockItem.prototype, "thumbnail_image_src", {
|
|
1814
|
+
/**
|
|
1815
|
+
* Path to thumbnail stock image
|
|
1816
|
+
*/
|
|
1817
|
+
get: function () {
|
|
1818
|
+
return '/images/' + (this.image_name ? 'stock/thumb/' + this.image_name : 'no_image.jpg');
|
|
1819
|
+
},
|
|
1820
|
+
enumerable: false,
|
|
1821
|
+
configurable: true
|
|
1822
|
+
});
|
|
1823
|
+
Object.defineProperty(EsolveStockItem.prototype, "small_image_src", {
|
|
1824
|
+
/**
|
|
1825
|
+
* Path to small stock image
|
|
1826
|
+
*/
|
|
1827
|
+
get: function () {
|
|
1828
|
+
return '/images/' + (this.image_name ? 'stock/small/' + this.image_name : 'no_image.jpg');
|
|
1829
|
+
},
|
|
1830
|
+
enumerable: false,
|
|
1831
|
+
configurable: true
|
|
1832
|
+
});
|
|
1833
|
+
Object.defineProperty(EsolveStockItem.prototype, "big_image_src", {
|
|
1834
|
+
/**
|
|
1835
|
+
* Path to big stock image
|
|
1836
|
+
*/
|
|
1837
|
+
get: function () {
|
|
1838
|
+
return '/images/' + (this.image_name ? 'stock/big/' + this.image_name : 'no_image.jpg');
|
|
1839
|
+
},
|
|
1840
|
+
enumerable: false,
|
|
1841
|
+
configurable: true
|
|
1842
|
+
});
|
|
1843
|
+
Object.defineProperty(EsolveStockItem.prototype, "original_image_src", {
|
|
1844
|
+
/**
|
|
1845
|
+
* Path to original stock image
|
|
1846
|
+
*/
|
|
1847
|
+
get: function () {
|
|
1848
|
+
return '/images/' + (this.image_name ? 'stock/original/' + this.image_name : 'no_image.jpg');
|
|
1849
|
+
},
|
|
1850
|
+
enumerable: false,
|
|
1851
|
+
configurable: true
|
|
1852
|
+
});
|
|
1853
|
+
return EsolveStockItem;
|
|
1854
|
+
}());
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* Stock item object list
|
|
1858
|
+
*/
|
|
1859
|
+
var EsolveStockItemList = /** @class */ (function () {
|
|
1860
|
+
function EsolveStockItemList(stock_items, total, page) {
|
|
1861
|
+
this.stock_items = stock_items;
|
|
1862
|
+
this.total = total;
|
|
1863
|
+
this.page = page;
|
|
1864
|
+
}
|
|
1865
|
+
return EsolveStockItemList;
|
|
1866
|
+
}());
|
|
1867
|
+
|
|
1868
|
+
var EsolveStockService = /** @class */ (function () {
|
|
1869
|
+
function EsolveStockService(config, http) {
|
|
1870
|
+
this.config = config;
|
|
1871
|
+
this.http = http;
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Processes the eSolve stock item record and converts it to StockItem object.
|
|
1875
|
+
* @param record eSolve stock item record
|
|
1876
|
+
*/
|
|
1877
|
+
EsolveStockService.prototype.processStockItem = function (record) {
|
|
1878
|
+
var e_1, _b, e_2, _c, e_3, _d;
|
|
1879
|
+
var tags = [];
|
|
1880
|
+
var topics = [];
|
|
1881
|
+
var badges = [];
|
|
1882
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
1883
|
+
try {
|
|
1884
|
+
for (var _e = __values(record.tags), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1885
|
+
var tag = _f.value;
|
|
1886
|
+
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1890
|
+
finally {
|
|
1891
|
+
try {
|
|
1892
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1893
|
+
}
|
|
1894
|
+
finally { if (e_1) throw e_1.error; }
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
1898
|
+
try {
|
|
1899
|
+
for (var _g = __values(record.topics), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1900
|
+
var topic = _h.value;
|
|
1901
|
+
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1905
|
+
finally {
|
|
1906
|
+
try {
|
|
1907
|
+
if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
|
|
1908
|
+
}
|
|
1909
|
+
finally { if (e_2) throw e_2.error; }
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
if ((record.badges) && (record.badges.length > 0)) {
|
|
1913
|
+
try {
|
|
1914
|
+
for (var _j = __values(record.badges), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
1915
|
+
var badge = _k.value;
|
|
1916
|
+
badges.push(new EsolveStockBadge(+badge.id, badge.text, badge.identifier, badge.font_colour, badge.badge_colour, +badge.sort_priority));
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1920
|
+
finally {
|
|
1921
|
+
try {
|
|
1922
|
+
if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
|
|
1923
|
+
}
|
|
1924
|
+
finally { if (e_3) throw e_3.error; }
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
var price = new EsolveStockPrice(record.regular_sellprice, record.regular_sellprice_inclusive, record.sellprice, record.sellprice_inclusive);
|
|
1928
|
+
return new EsolveStockItem(+record.id, record.code, record.name, record.sef_name, record.description, !!+record.is_active, !!+record.is_featured, record.image_name, price, tags, topics, badges, record.category_id, +record.subcategory_id, record.seo_page_title, record.seo_keywords);
|
|
1929
|
+
};
|
|
1930
|
+
/**
|
|
1931
|
+
* Retrieves stock records from HTTP params.
|
|
1932
|
+
* @param params HTTP client parameters
|
|
1933
|
+
*/
|
|
1934
|
+
EsolveStockService.prototype.getStockRecords = function (params) {
|
|
1935
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1936
|
+
return this.http.get(this.config.api_url + "/service/get-items.php", { params: params });
|
|
1937
|
+
};
|
|
1938
|
+
/**
|
|
1939
|
+
* Retrieves the stock record from the eSolve instance using the code.
|
|
1940
|
+
* @param code eSolve stock code
|
|
1941
|
+
*/
|
|
1942
|
+
EsolveStockService.prototype.getStockItem = function (code) {
|
|
1943
|
+
var _this = this;
|
|
1944
|
+
var params = new i1.HttpParams({
|
|
1945
|
+
fromObject: {
|
|
1946
|
+
code: code
|
|
1947
|
+
}
|
|
1948
|
+
});
|
|
1949
|
+
return this.getStockRecords(params).pipe(operators.map(function (response) {
|
|
1950
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1951
|
+
throw response;
|
|
1952
|
+
}
|
|
1953
|
+
var stockRecord = response.records[0];
|
|
1954
|
+
return _this.processStockItem(stockRecord);
|
|
1955
|
+
}));
|
|
1956
|
+
};
|
|
1957
|
+
/**
|
|
1958
|
+
* Retrieves the stock record from the eSolve instance using the SEF name.
|
|
1959
|
+
* @param sef_name SEF name of the stock item
|
|
1960
|
+
*/
|
|
1961
|
+
EsolveStockService.prototype.getStockItemFromSEF = function (sef_name) {
|
|
1962
|
+
var _this = this;
|
|
1963
|
+
var params = new i1.HttpParams({
|
|
1964
|
+
fromObject: {
|
|
1965
|
+
sef_name: sef_name
|
|
1966
|
+
}
|
|
1967
|
+
});
|
|
1968
|
+
return this.getStockRecords(params).pipe(operators.map(function (response) {
|
|
1969
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1970
|
+
throw response;
|
|
1971
|
+
}
|
|
1972
|
+
var stockRecord = response.records[0];
|
|
1973
|
+
return _this.processStockItem(stockRecord);
|
|
1974
|
+
}));
|
|
1975
|
+
};
|
|
1976
|
+
/**
|
|
1977
|
+
* Retrieves list of stock from the eSolve instance using info provided
|
|
1978
|
+
* @param options Stock filter options
|
|
1979
|
+
*/
|
|
1980
|
+
EsolveStockService.prototype.getStockItems = function (options) {
|
|
1981
|
+
var _this = this;
|
|
1982
|
+
var params = new i1.HttpParams();
|
|
1983
|
+
if (options.page) {
|
|
1984
|
+
params = params.set('page', options.page);
|
|
1985
|
+
}
|
|
1986
|
+
if (options.rows) {
|
|
1987
|
+
params = params.set('rows', options.rows);
|
|
1988
|
+
}
|
|
1989
|
+
if (options.display_only) {
|
|
1990
|
+
params = params.set('display_only', options.display_only);
|
|
1991
|
+
}
|
|
1992
|
+
if (options.is_active) {
|
|
1993
|
+
params = params.set('is_active', options.is_active);
|
|
1994
|
+
}
|
|
1995
|
+
if (options.category_id) {
|
|
1996
|
+
params = params.set('category_id', options.category_id);
|
|
1997
|
+
}
|
|
1998
|
+
if (options.subcategory_id) {
|
|
1999
|
+
params = params.set('subcategory_id', options.subcategory_id);
|
|
2000
|
+
}
|
|
2001
|
+
if (options.tag_id_list) {
|
|
2002
|
+
if (options.tag_id_list.length > 0) {
|
|
2003
|
+
params = params.set('tag_id', options.tag_id_list.join(','));
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
if (options.topic_id_list) {
|
|
2007
|
+
if (options.topic_id_list.length > 0) {
|
|
2008
|
+
params = params.set('topic_id', options.topic_id_list.join(','));
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
return this.getStockRecords(params).pipe(operators.map(function (response) {
|
|
2012
|
+
var _a;
|
|
2013
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
2014
|
+
throw response;
|
|
2015
|
+
}
|
|
2016
|
+
var stockItems = [];
|
|
2017
|
+
response.records.forEach(function (stockRecord) {
|
|
2018
|
+
stockItems.push(_this.processStockItem(stockRecord));
|
|
2019
|
+
});
|
|
2020
|
+
return new EsolveStockItemList(stockItems, +response.additional_data.total_records, (_a = options.page) !== null && _a !== void 0 ? _a : 0);
|
|
2021
|
+
}));
|
|
2022
|
+
};
|
|
2023
|
+
return EsolveStockService;
|
|
2024
|
+
}());
|
|
2025
|
+
EsolveStockService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2026
|
+
EsolveStockService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveStockService, providedIn: 'root' });
|
|
2027
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveStockService, decorators: [{
|
|
2028
|
+
type: i0.Injectable,
|
|
2029
|
+
args: [{
|
|
2030
|
+
providedIn: 'root'
|
|
2031
|
+
}]
|
|
2032
|
+
}], ctorParameters: function () {
|
|
2033
|
+
return [{ type: undefined, decorators: [{
|
|
2034
|
+
type: i0.Inject,
|
|
2035
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2036
|
+
}] }, { type: i1__namespace.HttpClient }];
|
|
2037
|
+
} });
|
|
2038
|
+
|
|
2039
|
+
var EsolveCategoryTreeItem = /** @class */ (function () {
|
|
2040
|
+
function EsolveCategoryTreeItem(type, esolve_id, parent_id, description, sef_description, short_description, sort_priority, active, display_only, image_name, seo_title, seo_keywords, seo_description, children) {
|
|
2041
|
+
this.type = type;
|
|
2042
|
+
this.esolve_id = esolve_id;
|
|
2043
|
+
this.parent_id = parent_id;
|
|
2044
|
+
this.description = description;
|
|
2045
|
+
this.sef_description = sef_description;
|
|
2046
|
+
this.short_description = short_description;
|
|
2047
|
+
this.sort_priority = sort_priority;
|
|
2048
|
+
this.active = active;
|
|
2049
|
+
this.display_only = display_only;
|
|
2050
|
+
this.image_name = image_name;
|
|
2051
|
+
this.image_path = '';
|
|
2052
|
+
this.id = '';
|
|
2053
|
+
if (this.type === 'category') {
|
|
2054
|
+
this.id = "<<CAT>>" + this.esolve_id;
|
|
2055
|
+
if (children != null) {
|
|
2056
|
+
this.children = children;
|
|
2057
|
+
}
|
|
2058
|
+
this.image_path = '/images/categories/';
|
|
2059
|
+
}
|
|
2060
|
+
else {
|
|
2061
|
+
this.id = "<<SUB>>" + this.esolve_id;
|
|
2062
|
+
this.image_path = '/images/subcategories/';
|
|
2063
|
+
}
|
|
2064
|
+
if (seo_title.trim() === '') {
|
|
2065
|
+
seo_title = this.description;
|
|
2066
|
+
}
|
|
2067
|
+
this.seo_details = new EsolveSEOInfo(seo_title, seo_description, seo_keywords);
|
|
2068
|
+
}
|
|
2069
|
+
EsolveCategoryTreeItem.prototype.generateImagePath = function (image_size) {
|
|
2070
|
+
if (this.image_name !== '') {
|
|
2071
|
+
return "" + this.image_path + image_size + "/" + this.image_name;
|
|
2072
|
+
}
|
|
2073
|
+
return '';
|
|
2074
|
+
};
|
|
2075
|
+
Object.defineProperty(EsolveCategoryTreeItem.prototype, "small_image_src", {
|
|
2076
|
+
get: function () {
|
|
2077
|
+
return this.generateImagePath('small');
|
|
2078
|
+
},
|
|
2079
|
+
enumerable: false,
|
|
2080
|
+
configurable: true
|
|
2081
|
+
});
|
|
2082
|
+
Object.defineProperty(EsolveCategoryTreeItem.prototype, "thumbnail_image_src", {
|
|
2083
|
+
get: function () {
|
|
2084
|
+
return this.generateImagePath('thumb');
|
|
2085
|
+
},
|
|
2086
|
+
enumerable: false,
|
|
2087
|
+
configurable: true
|
|
2088
|
+
});
|
|
2089
|
+
Object.defineProperty(EsolveCategoryTreeItem.prototype, "tiny_image_src", {
|
|
2090
|
+
get: function () {
|
|
2091
|
+
return this.generateImagePath('tiny');
|
|
2092
|
+
},
|
|
2093
|
+
enumerable: false,
|
|
2094
|
+
configurable: true
|
|
2095
|
+
});
|
|
2096
|
+
return EsolveCategoryTreeItem;
|
|
2097
|
+
}());
|
|
2098
|
+
|
|
2099
|
+
var EsolveCategoryTreeService = /** @class */ (function () {
|
|
2100
|
+
function EsolveCategoryTreeService(config, http) {
|
|
2101
|
+
this.config = config;
|
|
2102
|
+
this.http = http;
|
|
2103
|
+
}
|
|
2104
|
+
/**
|
|
2105
|
+
* Processes the eSolve tree records and converts them into the correct format.
|
|
2106
|
+
* @param tree_records Records to process
|
|
2107
|
+
*/
|
|
2108
|
+
EsolveCategoryTreeService.prototype.processTree = function (tree_records) {
|
|
2109
|
+
var e_1, _a;
|
|
2110
|
+
var tree_items = [];
|
|
2111
|
+
if (tree_records) {
|
|
2112
|
+
try {
|
|
2113
|
+
for (var tree_records_1 = __values(tree_records), tree_records_1_1 = tree_records_1.next(); !tree_records_1_1.done; tree_records_1_1 = tree_records_1.next()) {
|
|
2114
|
+
var tree_record = tree_records_1_1.value;
|
|
2115
|
+
var esolve_id = '';
|
|
2116
|
+
var parent_id = '';
|
|
2117
|
+
var children = [];
|
|
2118
|
+
if (tree_record.type === 'category') {
|
|
2119
|
+
children = this.processTree(tree_record.children);
|
|
2120
|
+
esolve_id = tree_record.menu_id;
|
|
2121
|
+
parent_id = tree_record.owner_menu_id;
|
|
2122
|
+
}
|
|
2123
|
+
else {
|
|
2124
|
+
esolve_id = tree_record.id;
|
|
2125
|
+
parent_id = tree_record.menu_id;
|
|
2126
|
+
}
|
|
2127
|
+
tree_items.push(new EsolveCategoryTreeItem(tree_record.type, esolve_id, parent_id, tree_record.description, tree_record.sef_description, tree_record.seo_description, tree_record.sort_priority, tree_record.active, tree_record.display_only, tree_record.image, tree_record.seo_page_title, tree_record.seo_keywords, tree_record.short_description, children));
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2131
|
+
finally {
|
|
2132
|
+
try {
|
|
2133
|
+
if (tree_records_1_1 && !tree_records_1_1.done && (_a = tree_records_1.return)) _a.call(tree_records_1);
|
|
2134
|
+
}
|
|
2135
|
+
finally { if (e_1) throw e_1.error; }
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
return tree_items;
|
|
2139
|
+
};
|
|
2140
|
+
EsolveCategoryTreeService.prototype.processTreeItem = function (record) {
|
|
2141
|
+
return new EsolveCategoryTreeItem(record.type, record.id, record.parent_id, record.description, record.sef_description, record.short_description, record.sort_priority, record.active, record.display_only, '', record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
2142
|
+
};
|
|
2143
|
+
EsolveCategoryTreeService.prototype.processID = function (id) {
|
|
2144
|
+
var type;
|
|
2145
|
+
var esolve_id;
|
|
2146
|
+
var type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
2147
|
+
var match_results = id.match(type_code_regex);
|
|
2148
|
+
if (match_results) {
|
|
2149
|
+
var type_code = match_results[0];
|
|
2150
|
+
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
2151
|
+
esolve_id = id.replace(type_code_regex, '');
|
|
2152
|
+
return {
|
|
2153
|
+
type: type,
|
|
2154
|
+
esolve_id: esolve_id
|
|
2155
|
+
};
|
|
2156
|
+
}
|
|
2157
|
+
return null;
|
|
2158
|
+
};
|
|
2159
|
+
/**
|
|
2160
|
+
* Retrieves the category tree from eSolve instance and coverts it to the correct format.
|
|
2161
|
+
*/
|
|
2162
|
+
EsolveCategoryTreeService.prototype.getCategoryTree = function () {
|
|
2163
|
+
var _this = this;
|
|
2164
|
+
var params = new i1.HttpParams();
|
|
2165
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2166
|
+
return this.http.get(this.config.api_url + "/service/get-tree.php", { params: params }).pipe(operators.map(function (response) {
|
|
2167
|
+
if (response.records === undefined) {
|
|
2168
|
+
throw response;
|
|
2169
|
+
}
|
|
2170
|
+
return _this.processTree(response.records);
|
|
2171
|
+
}));
|
|
2172
|
+
};
|
|
2173
|
+
/**
|
|
2174
|
+
* Retrieve the details of a category tree item from the eSolve instance and converts it to the correct format.
|
|
2175
|
+
* @param options Filter options
|
|
2176
|
+
*/
|
|
2177
|
+
EsolveCategoryTreeService.prototype.getCategoryTreeItem = function (options) {
|
|
2178
|
+
var _this = this;
|
|
2179
|
+
var type;
|
|
2180
|
+
var esolve_id;
|
|
2181
|
+
var sef_description;
|
|
2182
|
+
if (options.id) {
|
|
2183
|
+
var categoryIdentifier = this.processID(options.id);
|
|
2184
|
+
if (categoryIdentifier) {
|
|
2185
|
+
type = categoryIdentifier.type;
|
|
2186
|
+
esolve_id = categoryIdentifier.esolve_id;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
else if (options.type) {
|
|
2190
|
+
type = options.type;
|
|
2191
|
+
if (options.esolve_id) {
|
|
2192
|
+
esolve_id = options.esolve_id;
|
|
2193
|
+
}
|
|
2194
|
+
else if (options.sef_description) {
|
|
2195
|
+
sef_description = options.sef_description;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
if (type && (esolve_id || sef_description)) {
|
|
2199
|
+
var params = new i1.HttpParams();
|
|
2200
|
+
params = params.set('ws_id', this.config.wsid.toString());
|
|
2201
|
+
params = params.set('type', type.toString());
|
|
2202
|
+
if (esolve_id) {
|
|
2203
|
+
params = params.set('id', esolve_id.toString());
|
|
2204
|
+
}
|
|
2205
|
+
if (sef_description) {
|
|
2206
|
+
params = params.set('sef_description', sef_description.toString());
|
|
2207
|
+
}
|
|
2208
|
+
return this.http.get(this.config.api_url + "/service/get-tree-item.php", { params: params }).pipe(operators.map(function (response) {
|
|
2209
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
2210
|
+
throw response;
|
|
2211
|
+
}
|
|
2212
|
+
return _this.processTreeItem(response.records[0]);
|
|
2213
|
+
}));
|
|
2214
|
+
}
|
|
2215
|
+
return rxjs.throwError('Invalid options');
|
|
2216
|
+
};
|
|
2217
|
+
return EsolveCategoryTreeService;
|
|
2218
|
+
}());
|
|
2219
|
+
EsolveCategoryTreeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2220
|
+
EsolveCategoryTreeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
2221
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCategoryTreeService, decorators: [{
|
|
2222
|
+
type: i0.Injectable,
|
|
2223
|
+
args: [{
|
|
2224
|
+
providedIn: 'root'
|
|
2225
|
+
}]
|
|
2226
|
+
}], ctorParameters: function () {
|
|
2227
|
+
return [{ type: undefined, decorators: [{
|
|
2228
|
+
type: i0.Inject,
|
|
2229
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2230
|
+
}] }, { type: i1__namespace.HttpClient }];
|
|
2231
|
+
} });
|
|
2232
|
+
|
|
2233
|
+
var EsolveStockLocation = /** @class */ (function () {
|
|
2234
|
+
function EsolveStockLocation(record) {
|
|
2235
|
+
this.id = +record.id;
|
|
2236
|
+
this.identifier = record.identifier;
|
|
2237
|
+
this.description = record.description;
|
|
2238
|
+
this.head_office = record.head_office;
|
|
2239
|
+
this.erp_identifier = record.erp_identifier;
|
|
2240
|
+
this.external_system_code = record.external_system_code;
|
|
2241
|
+
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
2242
|
+
this.userid = +record.userid;
|
|
2243
|
+
this.importance = +record.importance;
|
|
2244
|
+
this.active = record.is_active;
|
|
2245
|
+
this.website_url = record.website_url;
|
|
2246
|
+
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
2247
|
+
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
2248
|
+
var telnumbers = [];
|
|
2249
|
+
if (record.branch_telnumber.length > 0) {
|
|
2250
|
+
telnumbers.push(record.branch_telnumber);
|
|
2251
|
+
}
|
|
2252
|
+
if (record.branch_telnumber_2.length > 0) {
|
|
2253
|
+
telnumbers.push(record.branch_telnumber_2);
|
|
2254
|
+
}
|
|
2255
|
+
if (record.branch_telnumber_3.length > 0) {
|
|
2256
|
+
telnumbers.push(record.branch_telnumber_3);
|
|
2257
|
+
}
|
|
2258
|
+
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
2259
|
+
this.trading_times = new EsolveStockLocationTradingTimes(record.monday_open_time, record.monday_close_time, record.tuesday_open_time, record.tuesday_close_time, record.wednesday_open_time, record.wednesday_close_time, record.thursday_open_time, record.thursday_close_time, record.friday_open_time, record.friday_close_time, record.saturday_open_time, record.saturday_close_time, record.sunday_open_time, record.sunday_close_time, record.public_holiday_open_time, record.public_holiday_close_time, record.trading_hours_additional_in);
|
|
2260
|
+
}
|
|
2261
|
+
return EsolveStockLocation;
|
|
2262
|
+
}());
|
|
2263
|
+
var EsolveStockLocationAddress = /** @class */ (function () {
|
|
2264
|
+
function EsolveStockLocationAddress(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
2265
|
+
this.street = street;
|
|
2266
|
+
this.suburb = suburb;
|
|
2267
|
+
this.city = city;
|
|
2268
|
+
this.province = province;
|
|
2269
|
+
this.country = country;
|
|
2270
|
+
this.postal_code = postal_code;
|
|
2271
|
+
this.latitude = latitude;
|
|
2272
|
+
this.longitude = longitude;
|
|
2273
|
+
}
|
|
2274
|
+
return EsolveStockLocationAddress;
|
|
2275
|
+
}());
|
|
2276
|
+
var EsolveStockLocationPOBoxAddress = /** @class */ (function () {
|
|
2277
|
+
function EsolveStockLocationPOBoxAddress(pobox, city, postal_code) {
|
|
2278
|
+
this.pobox = pobox;
|
|
2279
|
+
this.city = city;
|
|
2280
|
+
this.postal_code = postal_code;
|
|
2281
|
+
}
|
|
2282
|
+
return EsolveStockLocationPOBoxAddress;
|
|
2283
|
+
}());
|
|
2284
|
+
var EsolveStockLocationContactInfo = /** @class */ (function () {
|
|
2285
|
+
function EsolveStockLocationContactInfo(telnumber, cellnumber, email, fax) {
|
|
2286
|
+
this.telnumber = telnumber;
|
|
2287
|
+
this.cellnumber = cellnumber;
|
|
2288
|
+
this.email = email;
|
|
2289
|
+
this.fax = fax;
|
|
2290
|
+
}
|
|
2291
|
+
return EsolveStockLocationContactInfo;
|
|
2292
|
+
}());
|
|
2293
|
+
var EsolveStockLocationTradingTimes = /** @class */ (function () {
|
|
2294
|
+
function EsolveStockLocationTradingTimes(monday_open_time, monday_close_time, tuesday_open_time, tuesday_close_time, wednesday_open_time, wednesday_close_time, thursday_open_time, thursday_close_time, friday_open_time, friday_close_time, saturday_open_time, saturday_close_time, sunday_open_time, sunday_close_time, public_holiday_open_time, public_holiday_close_time, trading_hours_additional_info) {
|
|
2295
|
+
if (trading_hours_additional_info === void 0) { trading_hours_additional_info = ''; }
|
|
2296
|
+
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
2297
|
+
this.monday = new EsolveStockLocationTradingTimesDay(monday_open_time, monday_close_time);
|
|
2298
|
+
this.tuesday = new EsolveStockLocationTradingTimesDay(tuesday_open_time, tuesday_close_time);
|
|
2299
|
+
this.wednesday = new EsolveStockLocationTradingTimesDay(wednesday_open_time, wednesday_close_time);
|
|
2300
|
+
this.thursday = new EsolveStockLocationTradingTimesDay(thursday_open_time, thursday_close_time);
|
|
2301
|
+
this.friday = new EsolveStockLocationTradingTimesDay(friday_open_time, friday_close_time);
|
|
2302
|
+
this.saturday = new EsolveStockLocationTradingTimesDay(saturday_open_time, saturday_close_time);
|
|
2303
|
+
this.sunday = new EsolveStockLocationTradingTimesDay(sunday_open_time, sunday_close_time);
|
|
2304
|
+
this.public_holiday = new EsolveStockLocationTradingTimesDay(public_holiday_open_time, public_holiday_close_time);
|
|
2305
|
+
}
|
|
2306
|
+
return EsolveStockLocationTradingTimes;
|
|
2307
|
+
}());
|
|
2308
|
+
var EsolveStockLocationTradingTimesDay = /** @class */ (function () {
|
|
2309
|
+
function EsolveStockLocationTradingTimesDay(open, close) {
|
|
2310
|
+
this.open = open;
|
|
2311
|
+
this.close = close;
|
|
2312
|
+
}
|
|
2313
|
+
return EsolveStockLocationTradingTimesDay;
|
|
2314
|
+
}());
|
|
2315
|
+
|
|
2316
|
+
var EsolveCartItem = /** @class */ (function () {
|
|
2317
|
+
function EsolveCartItem(id, stock_item, qty, type, price, discount, discount_interval, vat_rate, allow_quotes, allow_orders, must_collect, requested_assembly, price_incl, discount_price, discount_price_incl, discount_total, vat_total, total, total_incl) {
|
|
2318
|
+
this.id = id;
|
|
2319
|
+
this.stock_item = stock_item;
|
|
2320
|
+
this.qty = qty;
|
|
2321
|
+
this.type = type;
|
|
2322
|
+
this.price = price;
|
|
2323
|
+
this.discount = discount;
|
|
2324
|
+
this.discount_interval = discount_interval;
|
|
2325
|
+
this.vat_rate = vat_rate;
|
|
2326
|
+
this.allow_quotes = allow_quotes;
|
|
2327
|
+
this.allow_orders = allow_orders;
|
|
2328
|
+
this.must_collect = must_collect;
|
|
2329
|
+
this.requested_assembly = requested_assembly;
|
|
2330
|
+
this.price_incl = price_incl;
|
|
2331
|
+
this.discount_price = discount_price;
|
|
2332
|
+
this.discount_price_incl = discount_price_incl;
|
|
2333
|
+
this.discount_total = discount_total;
|
|
2334
|
+
this.vat_total = vat_total;
|
|
2335
|
+
this.total = total;
|
|
2336
|
+
this.total_incl = total_incl;
|
|
2337
|
+
}
|
|
2338
|
+
return EsolveCartItem;
|
|
2339
|
+
}());
|
|
2340
|
+
|
|
2341
|
+
var EsolveShippingMethod = /** @class */ (function () {
|
|
2342
|
+
function EsolveShippingMethod(id, carrier_name, delivery_category, description, location, pricing, link_to_carrier_website, days_to_deliver, shipping_cost_calculation_method, insurance_cost_calculation_method, insurance_cost_percentage, metric_factor, allow_immediate_payment_processing, allow_postal_address, allow_physical_address, client_to_collect, is_default, location_id, use_zones, min_distance, max_distance, shipping_surge_condition, shipping_surge_percentage, sort_priority, shipping_group, shipping_slot_identifier, shipping_slot_delay_hours, image_url) {
|
|
2343
|
+
this.id = id;
|
|
2344
|
+
this.carrier_name = carrier_name;
|
|
2345
|
+
this.delivery_category = delivery_category;
|
|
2346
|
+
this.description = description;
|
|
2347
|
+
this.location = location;
|
|
2348
|
+
this.pricing = pricing;
|
|
2349
|
+
this.link_to_carrier_website = link_to_carrier_website;
|
|
2350
|
+
this.days_to_deliver = days_to_deliver;
|
|
2351
|
+
this.shipping_cost_calculation_method = shipping_cost_calculation_method;
|
|
2352
|
+
this.insurance_cost_calculation_method = insurance_cost_calculation_method;
|
|
2353
|
+
this.insurance_cost_percentage = insurance_cost_percentage;
|
|
2354
|
+
this.metric_factor = metric_factor;
|
|
2355
|
+
this.allow_immediate_payment_processing = allow_immediate_payment_processing;
|
|
2356
|
+
this.allow_postal_address = allow_postal_address;
|
|
2357
|
+
this.allow_physical_address = allow_physical_address;
|
|
2358
|
+
this.client_to_collect = client_to_collect;
|
|
2359
|
+
this.is_default = is_default;
|
|
2360
|
+
this.location_id = location_id;
|
|
2361
|
+
this.use_zones = use_zones;
|
|
2362
|
+
this.min_distance = min_distance;
|
|
2363
|
+
this.max_distance = max_distance;
|
|
2364
|
+
this.shipping_surge_condition = shipping_surge_condition;
|
|
2365
|
+
this.shipping_surge_percentage = shipping_surge_percentage;
|
|
2366
|
+
this.sort_priority = sort_priority;
|
|
2367
|
+
this.shipping_group = shipping_group;
|
|
2368
|
+
this.shipping_slot_identifier = shipping_slot_identifier;
|
|
2369
|
+
this.shipping_slot_delay_hours = shipping_slot_delay_hours;
|
|
2370
|
+
this.image_url = image_url;
|
|
2371
|
+
}
|
|
2372
|
+
return EsolveShippingMethod;
|
|
2373
|
+
}());
|
|
2374
|
+
|
|
2375
|
+
var EsolvePaymentMethod = /** @class */ (function () {
|
|
2376
|
+
function EsolvePaymentMethod(record) {
|
|
2377
|
+
this.id = +record.id;
|
|
2378
|
+
this.location_id = +record.location_id;
|
|
2379
|
+
this.paymethod_name = record.paymethod_name;
|
|
2380
|
+
this.description = record.description;
|
|
2381
|
+
this.display_banking_details = record.display_banking_details;
|
|
2382
|
+
this.currency_code = record.currency_code;
|
|
2383
|
+
this.terminal_id = record.terminal_id;
|
|
2384
|
+
this.terminal_id_secondary = record.terminal_id_secondary;
|
|
2385
|
+
this.merchant_id = record.merchant_id;
|
|
2386
|
+
this.application_id = record.application_id;
|
|
2387
|
+
this.api_username = record.api_username;
|
|
2388
|
+
this.api_password = record.api_password;
|
|
2389
|
+
this.api_signature = record.api_signature;
|
|
2390
|
+
this.is_gateway = record.is_gateway;
|
|
2391
|
+
this.must_store_card_details = record.must_store_card_details;
|
|
2392
|
+
this.allow_budget = record.allow_budget;
|
|
2393
|
+
this.integration_type = record.integration_type;
|
|
2394
|
+
this.bank_gateway_id = record.bank_gateway_id;
|
|
2395
|
+
this.accepted_card_types = record.accepted_card_types;
|
|
2396
|
+
this.post_transactions_to_gateway = record.post_transactions_to_gateway;
|
|
2397
|
+
this.three_d_secure_url = record.three_d_secure_url;
|
|
2398
|
+
this.gateway_url = record.gateway_url;
|
|
2399
|
+
this.generate_token_url = record.generate_token_url;
|
|
2400
|
+
this.widget_url = record.widget_url;
|
|
2401
|
+
this.successful_url = record.successful_url;
|
|
2402
|
+
this.failed_url = record.failed_url;
|
|
2403
|
+
this.enable_callback = record.enable_callback;
|
|
2404
|
+
this.live = record.live;
|
|
2405
|
+
this.default_module_id = +record.default_module_id;
|
|
2406
|
+
this.service_provider = record.service_provider;
|
|
2407
|
+
this.on_account = record.on_account;
|
|
2408
|
+
this.sort_priority = +record.sort_priority;
|
|
2409
|
+
this.image_url = record.image_url;
|
|
2410
|
+
this.banking_details = new BankingDetails(record.bank_name, record.account_holder, record.account, record.account_type, record.swift_number, record.branch_code);
|
|
2411
|
+
}
|
|
2412
|
+
return EsolvePaymentMethod;
|
|
2413
|
+
}());
|
|
2414
|
+
var BankingDetails = /** @class */ (function () {
|
|
2415
|
+
function BankingDetails(bank_name, account_holder, account, account_type, swift_number, branch_code) {
|
|
2416
|
+
this.bank_name = bank_name;
|
|
2417
|
+
this.account_holder = account_holder;
|
|
2418
|
+
this.account = account;
|
|
2419
|
+
this.account_type = account_type;
|
|
2420
|
+
this.swift_number = swift_number;
|
|
2421
|
+
this.branch_code = branch_code;
|
|
2422
|
+
}
|
|
2423
|
+
return BankingDetails;
|
|
2424
|
+
}());
|
|
2425
|
+
|
|
2426
|
+
var EsolveShippingCost = /** @class */ (function () {
|
|
2427
|
+
function EsolveShippingCost(
|
|
2428
|
+
// Shipping
|
|
2429
|
+
shipping_total, shipping_vat, shipping_total_savings,
|
|
2430
|
+
// Insurance
|
|
2431
|
+
insurance_total, insurance_vat, insurance_total_savings) {
|
|
2432
|
+
if (shipping_total === void 0) { shipping_total = 0; }
|
|
2433
|
+
if (shipping_vat === void 0) { shipping_vat = 0; }
|
|
2434
|
+
if (shipping_total_savings === void 0) { shipping_total_savings = 0; }
|
|
2435
|
+
if (insurance_total === void 0) { insurance_total = 0; }
|
|
2436
|
+
if (insurance_vat === void 0) { insurance_vat = 0; }
|
|
2437
|
+
if (insurance_total_savings === void 0) { insurance_total_savings = 0; }
|
|
2438
|
+
this.shipping = new EsolveShippingTotals(shipping_total, shipping_vat, shipping_total_savings);
|
|
2439
|
+
this.insurance = new EsolveShippingTotals(insurance_total, insurance_vat, insurance_total_savings);
|
|
2440
|
+
}
|
|
2441
|
+
return EsolveShippingCost;
|
|
2442
|
+
}());
|
|
2443
|
+
var EsolveShippingTotals = /** @class */ (function () {
|
|
2444
|
+
function EsolveShippingTotals(total, vat, savings) {
|
|
2445
|
+
this.total = total;
|
|
2446
|
+
this.vat = vat;
|
|
2447
|
+
this.savings = savings;
|
|
2448
|
+
}
|
|
2449
|
+
return EsolveShippingTotals;
|
|
2450
|
+
}());
|
|
2451
|
+
|
|
2452
|
+
/**
|
|
2453
|
+
* Totals in cart
|
|
2454
|
+
*/
|
|
2455
|
+
var EsolveCartTotals = /** @class */ (function () {
|
|
2456
|
+
function EsolveCartTotals(
|
|
2457
|
+
/**
|
|
2458
|
+
* Number of unique records in cart
|
|
2459
|
+
*/
|
|
2460
|
+
records,
|
|
2461
|
+
/**
|
|
2462
|
+
* Total quantity of all items in a cart
|
|
2463
|
+
*/
|
|
2464
|
+
items,
|
|
2465
|
+
/**
|
|
2466
|
+
* Total in cart before discount and VAT is added
|
|
2467
|
+
*/
|
|
2468
|
+
sub_total,
|
|
2469
|
+
/**
|
|
2470
|
+
* Total VAT of all the items in the cart
|
|
2471
|
+
*/
|
|
2472
|
+
vat_total,
|
|
2473
|
+
/**
|
|
2474
|
+
* Total discount of all the item in the cart
|
|
2475
|
+
*/
|
|
2476
|
+
discount_total) {
|
|
2477
|
+
if (records === void 0) { records = 0; }
|
|
2478
|
+
if (items === void 0) { items = 0; }
|
|
2479
|
+
if (sub_total === void 0) { sub_total = 0; }
|
|
2480
|
+
if (vat_total === void 0) { vat_total = 0; }
|
|
2481
|
+
if (discount_total === void 0) { discount_total = 0; }
|
|
2482
|
+
this.records = records;
|
|
2483
|
+
this.items = items;
|
|
2484
|
+
this.sub_total = sub_total;
|
|
2485
|
+
this.vat_total = vat_total;
|
|
2486
|
+
this.discount_total = discount_total;
|
|
2487
|
+
}
|
|
2488
|
+
Object.defineProperty(EsolveCartTotals.prototype, "total", {
|
|
2489
|
+
/**
|
|
2490
|
+
* Grand total of cart which includes discount and VAT (NOTE: shipping and insurance is not included)
|
|
2491
|
+
*/
|
|
2492
|
+
get: function () {
|
|
2493
|
+
return this.sub_total + this.vat_total - this.discount_total;
|
|
2494
|
+
},
|
|
2495
|
+
enumerable: false,
|
|
2496
|
+
configurable: true
|
|
2497
|
+
});
|
|
2498
|
+
return EsolveCartTotals;
|
|
2499
|
+
}());
|
|
2500
|
+
|
|
2501
|
+
var EsolveCartStockItem = /** @class */ (function () {
|
|
2502
|
+
function EsolveCartStockItem(code, name, sef_name, description, active, items_in_pack, delivery_category, image_name) {
|
|
2503
|
+
this.code = code;
|
|
2504
|
+
this.name = name;
|
|
2505
|
+
this.sef_name = sef_name;
|
|
2506
|
+
this.description = description;
|
|
2507
|
+
this.active = active;
|
|
2508
|
+
this.items_in_pack = items_in_pack;
|
|
2509
|
+
this.delivery_category = delivery_category;
|
|
2510
|
+
this.image_name = image_name;
|
|
2511
|
+
}
|
|
2512
|
+
Object.defineProperty(EsolveCartStockItem.prototype, "tiny_image_src", {
|
|
2513
|
+
/**
|
|
2514
|
+
* Path to tiny stock image
|
|
2515
|
+
*/
|
|
2516
|
+
get: function () {
|
|
2517
|
+
return '/images/' + (this.image_name ? 'stock/tiny/' + this.image_name : 'no_image.jpg');
|
|
2518
|
+
},
|
|
2519
|
+
enumerable: false,
|
|
2520
|
+
configurable: true
|
|
2521
|
+
});
|
|
2522
|
+
Object.defineProperty(EsolveCartStockItem.prototype, "thumbnail_image_src", {
|
|
2523
|
+
/**
|
|
2524
|
+
* Path to thumbnail stock image
|
|
2525
|
+
*/
|
|
2526
|
+
get: function () {
|
|
2527
|
+
return '/images/' + (this.image_name ? 'stock/thumb/' + this.image_name : 'no_image.jpg');
|
|
2528
|
+
},
|
|
2529
|
+
enumerable: false,
|
|
2530
|
+
configurable: true
|
|
2531
|
+
});
|
|
2532
|
+
Object.defineProperty(EsolveCartStockItem.prototype, "small_image_src", {
|
|
2533
|
+
/**
|
|
2534
|
+
* Path to small stock image
|
|
2535
|
+
*/
|
|
2536
|
+
get: function () {
|
|
2537
|
+
return '/images/' + (this.image_name ? 'stock/small/' + this.image_name : 'no_image.jpg');
|
|
2538
|
+
},
|
|
2539
|
+
enumerable: false,
|
|
2540
|
+
configurable: true
|
|
2541
|
+
});
|
|
2542
|
+
Object.defineProperty(EsolveCartStockItem.prototype, "big_image_src", {
|
|
2543
|
+
/**
|
|
2544
|
+
* Path to big stock image
|
|
2545
|
+
*/
|
|
2546
|
+
get: function () {
|
|
2547
|
+
return '/images/' + (this.image_name ? 'stock/big/' + this.image_name : 'no_image.jpg');
|
|
2548
|
+
},
|
|
2549
|
+
enumerable: false,
|
|
2550
|
+
configurable: true
|
|
2551
|
+
});
|
|
2552
|
+
Object.defineProperty(EsolveCartStockItem.prototype, "original_image_src", {
|
|
2553
|
+
/**
|
|
2554
|
+
* Path to original stock image
|
|
2555
|
+
*/
|
|
2556
|
+
get: function () {
|
|
2557
|
+
return 'images/' + (this.image_name ? 'stock/original/' + this.image_name : 'no_image.jpg');
|
|
2558
|
+
},
|
|
2559
|
+
enumerable: false,
|
|
2560
|
+
configurable: true
|
|
2561
|
+
});
|
|
2562
|
+
return EsolveCartStockItem;
|
|
2563
|
+
}());
|
|
2564
|
+
|
|
2565
|
+
var EsolveCartService = /** @class */ (function () {
|
|
2566
|
+
function EsolveCartService(config, http) {
|
|
2567
|
+
this.config = config;
|
|
2568
|
+
this.http = http;
|
|
2569
|
+
this._cached_tracking = 0;
|
|
2570
|
+
}
|
|
2571
|
+
/**
|
|
2572
|
+
* Processes the eSolve tree records.
|
|
2573
|
+
* @param cart_item_records Records to process
|
|
2574
|
+
* @returns An array of processed cart items
|
|
2575
|
+
*/
|
|
2576
|
+
EsolveCartService.prototype.processCart = function (cart_item_records) {
|
|
2577
|
+
var e_1, _a;
|
|
2578
|
+
var cart_items = [];
|
|
2579
|
+
if (cart_item_records) {
|
|
2580
|
+
try {
|
|
2581
|
+
for (var cart_item_records_1 = __values(cart_item_records), cart_item_records_1_1 = cart_item_records_1.next(); !cart_item_records_1_1.done; cart_item_records_1_1 = cart_item_records_1.next()) {
|
|
2582
|
+
var cart_item_record = cart_item_records_1_1.value;
|
|
2583
|
+
var cart_stock_item = new EsolveCartStockItem(cart_item_record.code, cart_item_record.name, cart_item_record.sef_name, cart_item_record.description, cart_item_record.is_active, +cart_item_record.items_in_pack, cart_item_record.delivery_category, cart_item_record.image_name);
|
|
2584
|
+
cart_items.push(new EsolveCartItem(+cart_item_record.id, cart_stock_item, +cart_item_record.qty, cart_item_record.type, +cart_item_record.price, +cart_item_record.discount, +cart_item_record.discount_interval, cart_item_record.vat_rate, cart_item_record.allow_quotes, cart_item_record.allow_orders, cart_item_record.must_collect, cart_item_record.requested_assembly, +cart_item_record.price_incl, +cart_item_record.discount_price, +cart_item_record.discount_price_incl, +cart_item_record.discount_total, +cart_item_record.vat_total, +cart_item_record.line_total, +cart_item_record.line_total_incl));
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2588
|
+
finally {
|
|
2589
|
+
try {
|
|
2590
|
+
if (cart_item_records_1_1 && !cart_item_records_1_1.done && (_a = cart_item_records_1.return)) _a.call(cart_item_records_1);
|
|
2591
|
+
}
|
|
2592
|
+
finally { if (e_1) throw e_1.error; }
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
return cart_items;
|
|
2596
|
+
};
|
|
2597
|
+
/**
|
|
2598
|
+
* Processes the eSolve stock location records.
|
|
2599
|
+
* @param records Records to process
|
|
2600
|
+
* @returns An array of processed stock location records
|
|
2601
|
+
*/
|
|
2602
|
+
EsolveCartService.prototype.processStockLocations = function (records) {
|
|
2603
|
+
var e_2, _a;
|
|
2604
|
+
var stock_locations = [];
|
|
2605
|
+
if (records) {
|
|
2606
|
+
try {
|
|
2607
|
+
for (var records_1 = __values(records), records_1_1 = records_1.next(); !records_1_1.done; records_1_1 = records_1.next()) {
|
|
2608
|
+
var record = records_1_1.value;
|
|
2609
|
+
stock_locations.push(new EsolveStockLocation(record));
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2613
|
+
finally {
|
|
2614
|
+
try {
|
|
2615
|
+
if (records_1_1 && !records_1_1.done && (_a = records_1.return)) _a.call(records_1);
|
|
2616
|
+
}
|
|
2617
|
+
finally { if (e_2) throw e_2.error; }
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
return stock_locations;
|
|
2621
|
+
};
|
|
2622
|
+
/**
|
|
2623
|
+
* Processes the eSolve shipping method records.
|
|
2624
|
+
* @param records Records to process
|
|
2625
|
+
* @returns An array of processed shipping methods
|
|
2626
|
+
*/
|
|
2627
|
+
EsolveCartService.prototype.processShippingMethods = function (records) {
|
|
2628
|
+
var e_3, _a;
|
|
2629
|
+
var shipping_methods = [];
|
|
2630
|
+
if (records) {
|
|
2631
|
+
try {
|
|
2632
|
+
for (var records_2 = __values(records), records_2_1 = records_2.next(); !records_2_1.done; records_2_1 = records_2.next()) {
|
|
2633
|
+
var record = records_2_1.value;
|
|
2634
|
+
var shipping_method = new EsolveShippingMethod(+record.id, record.carrier_name, record.delivery_category, record.description, record.location, record.pricing, record.link_to_carrier_website, +record.days_to_deliver, record.shipping_cost_calculation_method, record.insurance_cost_calculation_method, +record.insurance_cost_percentage, +record.metric_factor, record.allow_immediate_payment_processing, record.allow_postal_address, record.allow_physical_address, record.client_to_collect, record.is_default_shipping_method, +record.location_id, record.use_zones, +record.min_distance, +record.max_distance, +record.shipping_surge_condition, +record.shipping_surge_percentage, +record.sort_priority, record.shipping_group, record.shipping_slot_identifier, +record.shipping_slot_delay_hours, record.image_url);
|
|
2635
|
+
shipping_methods.push(shipping_method);
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
2639
|
+
finally {
|
|
2640
|
+
try {
|
|
2641
|
+
if (records_2_1 && !records_2_1.done && (_a = records_2.return)) _a.call(records_2);
|
|
2642
|
+
}
|
|
2643
|
+
finally { if (e_3) throw e_3.error; }
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
return shipping_methods;
|
|
2647
|
+
};
|
|
2648
|
+
/**
|
|
2649
|
+
* Processes the eSolve payment method records.
|
|
2650
|
+
* @param records Records to process
|
|
2651
|
+
* @returns An array of processed payment methods.
|
|
2652
|
+
*/
|
|
2653
|
+
EsolveCartService.prototype.processPaymentMethods = function (records) {
|
|
2654
|
+
var e_4, _a;
|
|
2655
|
+
var payment_methods = [];
|
|
2656
|
+
if (records) {
|
|
2657
|
+
try {
|
|
2658
|
+
for (var records_3 = __values(records), records_3_1 = records_3.next(); !records_3_1.done; records_3_1 = records_3.next()) {
|
|
2659
|
+
var record = records_3_1.value;
|
|
2660
|
+
var payment_method = new EsolvePaymentMethod(record);
|
|
2661
|
+
payment_methods.push(payment_method);
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
2665
|
+
finally {
|
|
2666
|
+
try {
|
|
2667
|
+
if (records_3_1 && !records_3_1.done && (_a = records_3.return)) _a.call(records_3);
|
|
2668
|
+
}
|
|
2669
|
+
finally { if (e_4) throw e_4.error; }
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
return payment_methods;
|
|
2673
|
+
};
|
|
2674
|
+
/**
|
|
2675
|
+
* Processes the eSolve shipping costs record.
|
|
2676
|
+
* @param record Data to process
|
|
2677
|
+
* @returns Processed shipping costs
|
|
2678
|
+
*/
|
|
2679
|
+
EsolveCartService.prototype.processShippingCost = function (record) {
|
|
2680
|
+
var shipping_cost = new EsolveShippingCost(+record.shipping_total, +record.vat_on_shipping, +record.total_saving_on_shipping, +record.insurance_total, +record.vat_on_insurance, +record.total_saving_on_insurance);
|
|
2681
|
+
return shipping_cost;
|
|
2682
|
+
};
|
|
2683
|
+
/**
|
|
2684
|
+
* Processes the eSolve cart totals
|
|
2685
|
+
* @param record Data to process
|
|
2686
|
+
* @returns Processed cart totals
|
|
2687
|
+
*/
|
|
2688
|
+
EsolveCartService.prototype.processCartTotals = function (record) {
|
|
2689
|
+
var cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2690
|
+
return cart_totals;
|
|
2691
|
+
};
|
|
2692
|
+
/**
|
|
2693
|
+
* Retrieves the current cart
|
|
2694
|
+
* @returns An `Observable` with an array of cart items
|
|
2695
|
+
*/
|
|
2696
|
+
EsolveCartService.prototype.getCart = function () {
|
|
2697
|
+
var _this = this;
|
|
2698
|
+
var params = new i1.HttpParams();
|
|
2699
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2700
|
+
return this.http.get(this.config.api_url + "/service/get-cart.php", { params: params }).pipe(operators.map(function (response) {
|
|
2701
|
+
if (response.records === undefined) {
|
|
2702
|
+
throw response;
|
|
2703
|
+
}
|
|
2704
|
+
return _this.processCart(response.records);
|
|
2705
|
+
}));
|
|
2706
|
+
};
|
|
2707
|
+
/**
|
|
2708
|
+
* Updates the cart by preforming various actions, such as adding, editing or removing items from the cart.
|
|
2709
|
+
* @param items An array of options to update the cart
|
|
2710
|
+
* @param action The default action to preform
|
|
2711
|
+
* @returns An `Observable` with an array of responses that gives feedback on the requested changes
|
|
2712
|
+
*/
|
|
2713
|
+
EsolveCartService.prototype.setCart = function (items, action) {
|
|
2714
|
+
if (action === void 0) { action = 'add'; }
|
|
2715
|
+
var body = {
|
|
2716
|
+
items: items,
|
|
2717
|
+
action: action
|
|
2718
|
+
};
|
|
2719
|
+
return this.http.post(this.config.api_url + "/service/set-cart-item.php", body, {
|
|
2720
|
+
headers: {
|
|
2721
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
2722
|
+
},
|
|
2723
|
+
params: {
|
|
2724
|
+
ws_id: this.config.wsid
|
|
2725
|
+
},
|
|
2726
|
+
responseType: 'json',
|
|
2727
|
+
observe: 'body'
|
|
2728
|
+
}).pipe(operators.map(function (response) {
|
|
2729
|
+
if (response.responses === undefined) {
|
|
2730
|
+
throw response;
|
|
2731
|
+
}
|
|
2732
|
+
return response.responses;
|
|
2733
|
+
}));
|
|
2734
|
+
};
|
|
2735
|
+
/**
|
|
2736
|
+
* Retrieves a list of stock locations
|
|
2737
|
+
* @returns An `Observable` with an array of stock locations
|
|
2738
|
+
*/
|
|
2739
|
+
EsolveCartService.prototype.getStockLocations = function () {
|
|
2740
|
+
var _this = this;
|
|
2741
|
+
var params = new i1.HttpParams();
|
|
2742
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2743
|
+
return this.http.get(this.config.api_url + "/service/get-locations.php", { params: params }).pipe(operators.map(function (response) {
|
|
2744
|
+
if (response.records === undefined) {
|
|
2745
|
+
throw response;
|
|
2746
|
+
}
|
|
2747
|
+
return _this.processStockLocations(response.records);
|
|
2748
|
+
}));
|
|
2749
|
+
};
|
|
2750
|
+
/**
|
|
2751
|
+
* Retrieves a list of shipping methods
|
|
2752
|
+
* @returns An `Observable` with an array of shipping methods
|
|
2753
|
+
*/
|
|
2754
|
+
EsolveCartService.prototype.getShippingMethods = function (options) {
|
|
2755
|
+
var _this = this;
|
|
2756
|
+
var params = new i1.HttpParams();
|
|
2757
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2758
|
+
if (options) {
|
|
2759
|
+
if (typeof options.addresses_id !== 'undefined') {
|
|
2760
|
+
params = params.set('addresses_id', options.addresses_id.toString());
|
|
2761
|
+
}
|
|
2762
|
+
if (typeof options.location_id !== 'undefined') {
|
|
2763
|
+
params = params.set('location_id', options.location_id.toString());
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
return this.http.get(this.config.api_url + "/service/get-shipping-methods.php", { params: params }).pipe(operators.map(function (response) {
|
|
2767
|
+
if (response.records === undefined) {
|
|
2768
|
+
throw response;
|
|
2769
|
+
}
|
|
2770
|
+
return _this.processShippingMethods(response.records);
|
|
2771
|
+
}));
|
|
2772
|
+
};
|
|
2773
|
+
/**
|
|
2774
|
+
* Retrieves a list of payment methods
|
|
2775
|
+
* @returns An `Observable` with an array of payment methods
|
|
2776
|
+
*/
|
|
2777
|
+
EsolveCartService.prototype.getPaymentMethods = function (options) {
|
|
2778
|
+
var _this = this;
|
|
2779
|
+
var params = new i1.HttpParams();
|
|
2780
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2781
|
+
if (options) {
|
|
2782
|
+
if (typeof options.live !== 'undefined') {
|
|
2783
|
+
params = params.set('live', options.live.toString());
|
|
2784
|
+
}
|
|
2785
|
+
if (typeof options.location_id !== 'undefined') {
|
|
2786
|
+
params = params.set('location_id', options.location_id.toString());
|
|
2787
|
+
}
|
|
2788
|
+
if (typeof options.is_gateway !== 'undefined') {
|
|
2789
|
+
params = params.set('is_gateway', options.is_gateway.toString());
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
return this.http.get(this.config.api_url + "/service/get-payment-methods.php", { params: params }).pipe(operators.map(function (response) {
|
|
2793
|
+
if (response.records === undefined) {
|
|
2794
|
+
throw response;
|
|
2795
|
+
}
|
|
2796
|
+
return _this.processPaymentMethods(response.records);
|
|
2797
|
+
}));
|
|
2798
|
+
};
|
|
2799
|
+
/**
|
|
2800
|
+
* Retrieves the shipping costs
|
|
2801
|
+
* @param options Shipping cost options
|
|
2802
|
+
* @returns An `Observable` with the shipping costs
|
|
2803
|
+
*/
|
|
2804
|
+
EsolveCartService.prototype.getShippingCost = function (options) {
|
|
2805
|
+
var _this = this;
|
|
2806
|
+
var params = new i1.HttpParams();
|
|
2807
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2808
|
+
if (options) {
|
|
2809
|
+
if (typeof options.addresses_id !== 'undefined') {
|
|
2810
|
+
params = params.set('addresses_id', options.addresses_id.toString());
|
|
2811
|
+
}
|
|
2812
|
+
else {
|
|
2813
|
+
return rxjs.throwError(new Error('Address ID is required'));
|
|
2814
|
+
}
|
|
2815
|
+
if (typeof options.shipping_id !== 'undefined') {
|
|
2816
|
+
params = params.set('shipping_id', options.shipping_id.toString());
|
|
2817
|
+
}
|
|
2818
|
+
else {
|
|
2819
|
+
return rxjs.throwError(new Error('Shipping ID is required'));
|
|
2820
|
+
}
|
|
2821
|
+
if (typeof options.location_id !== 'undefined') {
|
|
2822
|
+
params = params.set('location_id', options.location_id.toString());
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
else {
|
|
2826
|
+
return rxjs.throwError(new Error('Options are invalid'));
|
|
2827
|
+
}
|
|
2828
|
+
return this.http.get(this.config.api_url + "/service/get-shipping-cost.php", { params: params }).pipe(operators.map(function (response) {
|
|
2829
|
+
if (response.records === undefined) {
|
|
2830
|
+
throw response;
|
|
2831
|
+
}
|
|
2832
|
+
return _this.processShippingCost(response.records[0]);
|
|
2833
|
+
}));
|
|
2834
|
+
};
|
|
2835
|
+
/**
|
|
2836
|
+
* Retrieves the totals of the cart with all the totals calculated
|
|
2837
|
+
* @returns An `Observable` with an object containing cart totals
|
|
2838
|
+
*/
|
|
2839
|
+
EsolveCartService.prototype.getTotals = function () {
|
|
2840
|
+
var _this = this;
|
|
2841
|
+
var params = new i1.HttpParams();
|
|
2842
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2843
|
+
return this.http.get(this.config.api_url + "/service/get-cart-totals.php", { params: params }).pipe(operators.map(function (response) {
|
|
2844
|
+
if (response.records === undefined) {
|
|
2845
|
+
throw response;
|
|
2846
|
+
}
|
|
2847
|
+
return _this.processCartTotals(response.records);
|
|
2848
|
+
}));
|
|
2849
|
+
};
|
|
2850
|
+
/**
|
|
2851
|
+
* Retrieves a tracking code for the cart
|
|
2852
|
+
* @returns An `Observable` with the cart tracking code
|
|
2853
|
+
*/
|
|
2854
|
+
EsolveCartService.prototype.getTrackingCode = function () {
|
|
2855
|
+
var _this = this;
|
|
2856
|
+
var params = new i1.HttpParams();
|
|
2857
|
+
params = params.set('ws_id', this.config.wsid);
|
|
2858
|
+
return rxjs.iif(function () { return _this._cached_tracking > 0; }, rxjs.of(this._cached_tracking), this.http.get(this.config.api_url + "/service/get-checkout-tracking.php", { params: params }).pipe(operators.map(function (response) {
|
|
2859
|
+
if (response.records === undefined) {
|
|
2860
|
+
throw response;
|
|
2861
|
+
}
|
|
2862
|
+
_this._cached_tracking = response.records.tracking;
|
|
2863
|
+
return response.records.tracking;
|
|
2864
|
+
})));
|
|
2865
|
+
};
|
|
2866
|
+
/**
|
|
2867
|
+
* Initiates checkout of the cart items
|
|
2868
|
+
* @param type The cart type that needs to be checked out
|
|
2869
|
+
* @param addresses_id The ID of the delivery address
|
|
2870
|
+
* @param shipping_id The ID of the shipping method
|
|
2871
|
+
* @param payment_method_id The ID of the selected payment method
|
|
2872
|
+
* @param location_id The ID of the selected branch from with shipping needs to be calculated
|
|
2873
|
+
* @param comments Additional comments on the cart
|
|
2874
|
+
* @returns An `Observable` with the transaction ID
|
|
2875
|
+
*/
|
|
2876
|
+
EsolveCartService.prototype.checkout = function (type, addresses_id, shipping_id, payment_method_id, location_id, comments) {
|
|
2877
|
+
var _this = this;
|
|
2878
|
+
if (payment_method_id === void 0) { payment_method_id = 0; }
|
|
2879
|
+
if (location_id === void 0) { location_id = 0; }
|
|
2880
|
+
if (comments === void 0) { comments = ''; }
|
|
2881
|
+
var body = {
|
|
2882
|
+
type: type,
|
|
2883
|
+
addresses_id: addresses_id,
|
|
2884
|
+
shipping_id: shipping_id,
|
|
2885
|
+
payment_method_id: payment_method_id,
|
|
2886
|
+
location_id: location_id,
|
|
2887
|
+
comments: comments,
|
|
2888
|
+
tracking: 0
|
|
2889
|
+
};
|
|
2890
|
+
return this.getTrackingCode().pipe(operators.switchMap(function (tracking) {
|
|
2891
|
+
if (tracking <= 0) {
|
|
2892
|
+
throw tracking;
|
|
2893
|
+
}
|
|
2894
|
+
body.tracking = tracking;
|
|
2895
|
+
return _this.http.post(_this.config.api_url + "/service/set-checkout.php", body, {
|
|
2896
|
+
headers: {
|
|
2897
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
2898
|
+
},
|
|
2899
|
+
params: {
|
|
2900
|
+
ws_id: _this.config.wsid
|
|
2901
|
+
},
|
|
2902
|
+
responseType: 'json',
|
|
2903
|
+
observe: 'body'
|
|
2904
|
+
}).pipe(operators.map(function (response) {
|
|
2905
|
+
if ((response.responses === undefined) || (response.responses.length <= 0)) {
|
|
2906
|
+
throw response;
|
|
2907
|
+
}
|
|
2908
|
+
var checkout_result = response.responses[0];
|
|
2909
|
+
if (checkout_result.status.state !== 'success') {
|
|
2910
|
+
throw checkout_result;
|
|
2911
|
+
}
|
|
2912
|
+
return checkout_result.esolve_id;
|
|
2913
|
+
}), operators.catchError(function (errorRes) {
|
|
2914
|
+
var parseException = function (exception) {
|
|
2915
|
+
var exception_type = exception.additional_data.exception_type;
|
|
2916
|
+
var error = {
|
|
2917
|
+
type: 'exception',
|
|
2918
|
+
message: exception.message || '',
|
|
2919
|
+
error_code: exception_type || 'unknown'
|
|
2920
|
+
};
|
|
2921
|
+
return error;
|
|
2922
|
+
};
|
|
2923
|
+
var parseCheckoutErrors = function (response) {
|
|
2924
|
+
var error = {
|
|
2925
|
+
type: 'error',
|
|
2926
|
+
message: 'Unknown error has occured',
|
|
2927
|
+
error_code: 'unknown'
|
|
2928
|
+
};
|
|
2929
|
+
if ((response.status.state === 'none') || (response.log.length === 0)) {
|
|
2930
|
+
error.error_code = 'no_response';
|
|
2931
|
+
error.message = 'Response was provided';
|
|
2932
|
+
}
|
|
2933
|
+
else if (response.status.state === 'error') {
|
|
2934
|
+
var error_log = response.log[0];
|
|
2935
|
+
error.error_code = error_log.message_code;
|
|
2936
|
+
error.message = error_log.message;
|
|
2937
|
+
}
|
|
2938
|
+
return error;
|
|
2939
|
+
};
|
|
2940
|
+
if (errorRes instanceof i1.HttpErrorResponse) {
|
|
2941
|
+
if (errorRes.status === 500) {
|
|
2942
|
+
var server_error = errorRes.error;
|
|
2943
|
+
if ((server_error.service_type === 'set-checkout') ||
|
|
2944
|
+
(server_error.type !== undefined) ||
|
|
2945
|
+
(server_error.message !== undefined) ||
|
|
2946
|
+
(server_error.additional_data !== undefined)) {
|
|
2947
|
+
return rxjs.throwError(parseException(server_error));
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
else {
|
|
2952
|
+
if (errorRes.type !== undefined) {
|
|
2953
|
+
if (errorRes.type === 'exception') {
|
|
2954
|
+
return rxjs.throwError(parseException(errorRes));
|
|
2955
|
+
}
|
|
2956
|
+
}
|
|
2957
|
+
else if (errorRes.transaction_type !== undefined) {
|
|
2958
|
+
return rxjs.throwError(parseCheckoutErrors(errorRes));
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
return rxjs.throwError(errorRes);
|
|
2962
|
+
}));
|
|
2963
|
+
}));
|
|
2964
|
+
};
|
|
2965
|
+
return EsolveCartService;
|
|
2966
|
+
}());
|
|
2967
|
+
EsolveCartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2968
|
+
EsolveCartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCartService, providedIn: 'root' });
|
|
2969
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0__namespace, type: EsolveCartService, decorators: [{
|
|
2970
|
+
type: i0.Injectable,
|
|
2971
|
+
args: [{
|
|
2972
|
+
providedIn: 'root'
|
|
2973
|
+
}]
|
|
2974
|
+
}], ctorParameters: function () {
|
|
2975
|
+
return [{ type: undefined, decorators: [{
|
|
2976
|
+
type: i0.Inject,
|
|
2977
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2978
|
+
}] }, { type: i1__namespace.HttpClient }];
|
|
2979
|
+
} });
|
|
2980
|
+
|
|
2981
|
+
/*
|
|
2982
|
+
* Public API Surface of ng-esolve-connect
|
|
2983
|
+
*/
|
|
2984
|
+
|
|
2985
|
+
/**
|
|
2986
|
+
* Generated bundle index. Do not edit.
|
|
2987
|
+
*/
|
|
2988
|
+
|
|
2989
|
+
exports.BankingDetails = BankingDetails;
|
|
2990
|
+
exports.EsolveAccountService = EsolveAccountService;
|
|
2991
|
+
exports.EsolveAddress = EsolveAddress;
|
|
2992
|
+
exports.EsolveAuthService = EsolveAuthService;
|
|
2993
|
+
exports.EsolveBanner = EsolveBanner;
|
|
2994
|
+
exports.EsolveBannerImage = EsolveBannerImage;
|
|
2995
|
+
exports.EsolveBannerImageHotspot = EsolveBannerImageHotspot;
|
|
2996
|
+
exports.EsolveBannerService = EsolveBannerService;
|
|
2997
|
+
exports.EsolveCartItem = EsolveCartItem;
|
|
2998
|
+
exports.EsolveCartService = EsolveCartService;
|
|
2999
|
+
exports.EsolveCartTotals = EsolveCartTotals;
|
|
3000
|
+
exports.EsolveCategoryTreeItem = EsolveCategoryTreeItem;
|
|
3001
|
+
exports.EsolveCategoryTreeService = EsolveCategoryTreeService;
|
|
3002
|
+
exports.EsolveMediaArticle = EsolveMediaArticle;
|
|
3003
|
+
exports.EsolveMediaService = EsolveMediaService;
|
|
3004
|
+
exports.EsolveMenuItem = EsolveMenuItem;
|
|
3005
|
+
exports.EsolveMenuService = EsolveMenuService;
|
|
3006
|
+
exports.EsolveNewsArticle = EsolveNewsArticle;
|
|
3007
|
+
exports.EsolveNewsArticleAuthor = EsolveNewsArticleAuthor;
|
|
3008
|
+
exports.EsolveNewsArticleList = EsolveNewsArticleList;
|
|
3009
|
+
exports.EsolveNewsGroup = EsolveNewsGroup;
|
|
3010
|
+
exports.EsolveNewsService = EsolveNewsService;
|
|
3011
|
+
exports.EsolvePaymentMethod = EsolvePaymentMethod;
|
|
3012
|
+
exports.EsolveSEOInfo = EsolveSEOInfo;
|
|
3013
|
+
exports.EsolveSeoService = EsolveSeoService;
|
|
3014
|
+
exports.EsolveSession = EsolveSession;
|
|
3015
|
+
exports.EsolveSessionService = EsolveSessionService;
|
|
3016
|
+
exports.EsolveShippingCost = EsolveShippingCost;
|
|
3017
|
+
exports.EsolveShippingMethod = EsolveShippingMethod;
|
|
3018
|
+
exports.EsolveStockBadge = EsolveStockBadge;
|
|
3019
|
+
exports.EsolveStockItem = EsolveStockItem;
|
|
3020
|
+
exports.EsolveStockItemList = EsolveStockItemList;
|
|
3021
|
+
exports.EsolveStockLocation = EsolveStockLocation;
|
|
3022
|
+
exports.EsolveStockPrice = EsolveStockPrice;
|
|
3023
|
+
exports.EsolveStockService = EsolveStockService;
|
|
3024
|
+
exports.EsolveTag = EsolveTag;
|
|
3025
|
+
exports.EsolveTopic = EsolveTopic;
|
|
3026
|
+
exports.EsolveTopicService = EsolveTopicService;
|
|
3027
|
+
exports.NgEsolveConnectModule = NgEsolveConnectModule;
|
|
3028
|
+
|
|
3029
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3030
|
+
|
|
3031
|
+
})));
|
|
3032
|
+
//# sourceMappingURL=esolve-ng-esolve-connect.umd.js.map
|