@esolve/ng-esolve-connect 0.26.4 → 0.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/account/esolve-account.service.mjs +3 -12
- package/esm2020/lib/account/user-account/classes/esolve-statement-ageing.model.mjs +9 -0
- package/esm2020/lib/account/user-account/classes/esolve-statement-balances.model.mjs +10 -0
- package/esm2020/lib/account/user-account/classes/esolve-statement-transaction.model.mjs +15 -0
- package/esm2020/lib/account/user-account/classes/esolve-statement.model.mjs +11 -0
- package/esm2020/lib/account/user-account/classes/esolve-user-account-business.model.mjs +11 -0
- package/esm2020/lib/account/user-account/classes/esolve-user-account-contact.model.mjs +10 -0
- package/esm2020/lib/account/user-account/classes/esolve-user-account-result.model.mjs +9 -0
- package/esm2020/lib/account/user-account/classes/esolve-user-account.model.mjs +24 -0
- package/esm2020/lib/account/user-account/classes/esolve-user-client-account-balances.model.mjs +13 -0
- package/esm2020/lib/account/user-account/classes/esolve-user-client-account.model.mjs +46 -0
- package/esm2020/lib/account/user-account/classes/index.mjs +7 -0
- package/esm2020/lib/account/user-account/index.mjs +3 -11
- package/esm2020/lib/account/user-account/interfaces/esolve-statement-ageing-record.interface.mjs +2 -0
- package/esm2020/lib/account/user-account/interfaces/esolve-statement-balances-record.interface.mjs +2 -0
- package/esm2020/lib/account/user-account/interfaces/esolve-statement-record.interface.mjs +2 -0
- package/esm2020/lib/account/user-account/interfaces/esolve-statement-transaction-record.interface.mjs +2 -0
- package/esm2020/lib/account/user-account/interfaces/esolve-user-account-data.interface.mjs +2 -0
- package/esm2020/lib/account/user-account/interfaces/esolve-user-account-record.interface.mjs +2 -0
- package/esm2020/lib/account/user-account/interfaces/esolve-user-client-account-balances-record.interface.mjs +2 -0
- package/esm2020/lib/account/user-account/interfaces/esolve-user-client-account-record.interface.mjs +2 -0
- package/esm2020/lib/account/user-account/interfaces/index.mjs +9 -0
- package/esm2020/lib/auth/esolve-auth-interceptor.service.mjs +6 -1
- package/esm2020/lib/cart/esolve-cart.service.mjs +16 -5
- package/esm2020/lib/coupons/classes/esolve-coupon.model.mjs +29 -0
- package/esm2020/lib/coupons/classes/index.mjs +2 -0
- package/esm2020/lib/coupons/esolve-coupons.service.mjs +186 -0
- package/esm2020/lib/coupons/index.mjs +9 -0
- package/esm2020/lib/coupons/interfaces/esolve-coupon-record.interface.mjs +2 -0
- package/esm2020/lib/coupons/interfaces/esolve-coupon-validation-error.interface.mjs +2 -0
- package/esm2020/lib/coupons/interfaces/esolve-coupon-validation-result.interface.mjs +3 -0
- package/esm2020/lib/coupons/interfaces/esolve-coupon-validation.interface.mjs +2 -0
- package/esm2020/lib/coupons/interfaces/index.mjs +5 -0
- package/esm2020/lib/coupons/types/esolve-coupons-cache.type.mjs +2 -0
- package/esm2020/lib/coupons/types/index.mjs +2 -0
- package/esm2020/lib/esolve-connect.config.mjs +1 -1
- package/esm2020/lib/stock/classes/esolve-stock-item-base.model.mjs +7 -1
- package/esm2020/lib/stock/classes/esolve-stock-transaction-history.model.mjs +7 -0
- package/esm2020/lib/stock/esolve-stock.service.mjs +59 -2
- package/esm2020/lib/stock/interfaces/esolve-stock-base-record.interface.mjs +1 -1
- package/esm2020/public-api.mjs +3 -1
- package/fesm2015/esolve-ng-esolve-connect.mjs +434 -81
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +418 -77
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/account/esolve-account.service.d.ts +1 -2
- package/lib/account/user-account/classes/esolve-statement-ageing.model.d.ts +6 -0
- package/lib/account/user-account/classes/esolve-statement-balances.model.d.ts +7 -0
- package/lib/account/user-account/classes/esolve-statement-transaction.model.d.ts +12 -0
- package/lib/account/user-account/classes/esolve-statement.model.d.ts +8 -0
- package/lib/account/user-account/classes/esolve-user-account-business.model.d.ts +8 -0
- package/lib/account/user-account/classes/esolve-user-account-contact.model.d.ts +7 -0
- package/lib/account/user-account/{esolve-user-account-result.model.d.ts → classes/esolve-user-account-result.model.d.ts} +1 -1
- package/lib/account/user-account/{esolve-user-account.model.d.ts → classes/esolve-user-account.model.d.ts} +11 -10
- package/lib/account/user-account/{esolve-user-client-account-balances.model.d.ts → classes/esolve-user-client-account-balances.model.d.ts} +1 -1
- package/lib/account/user-account/classes/esolve-user-client-account.model.d.ts +43 -0
- package/lib/account/user-account/classes/index.d.ts +6 -0
- package/lib/account/user-account/index.d.ts +2 -10
- package/lib/account/user-account/interfaces/esolve-statement-ageing-record.interface.d.ts +4 -0
- package/lib/account/user-account/interfaces/esolve-statement-balances-record.interface.d.ts +5 -0
- package/lib/account/user-account/interfaces/esolve-statement-record.interface.d.ts +6 -0
- package/lib/account/user-account/interfaces/esolve-statement-transaction-record.interface.d.ts +10 -0
- package/lib/account/user-account/{esolve-user-account-data.interface.d.ts → interfaces/esolve-user-account-data.interface.d.ts} +0 -0
- package/lib/account/user-account/{esolve-user-account-record.interface.d.ts → interfaces/esolve-user-account-record.interface.d.ts} +0 -0
- package/lib/account/user-account/{esolve-user-client-account-balances-record.interface.d.ts → interfaces/esolve-user-client-account-balances-record.interface.d.ts} +1 -1
- package/lib/account/user-account/{esolve-user-client-account-record.interface.d.ts → interfaces/esolve-user-client-account-record.interface.d.ts} +2 -1
- package/lib/account/user-account/interfaces/index.d.ts +8 -0
- package/lib/cart/esolve-cart.service.d.ts +5 -1
- package/lib/coupons/classes/esolve-coupon.model.d.ts +20 -0
- package/lib/coupons/classes/index.d.ts +1 -0
- package/lib/coupons/esolve-coupons.service.d.ts +35 -0
- package/lib/coupons/index.d.ts +4 -0
- package/lib/coupons/interfaces/esolve-coupon-record.interface.d.ts +8 -0
- package/lib/coupons/interfaces/esolve-coupon-validation-error.interface.d.ts +4 -0
- package/lib/coupons/interfaces/esolve-coupon-validation-result.interface.d.ts +4 -0
- package/lib/coupons/interfaces/esolve-coupon-validation.interface.d.ts +6 -0
- package/lib/coupons/interfaces/index.d.ts +4 -0
- package/lib/coupons/types/esolve-coupons-cache.type.d.ts +1 -0
- package/lib/coupons/types/index.d.ts +1 -0
- package/lib/esolve-connect.config.d.ts +14 -0
- package/lib/stock/classes/esolve-stock-item-base.model.d.ts +5 -0
- package/lib/stock/classes/esolve-stock-transaction-history.model.d.ts +5 -0
- package/lib/stock/esolve-stock.service.d.ts +11 -0
- package/lib/stock/interfaces/esolve-stock-base-record.interface.d.ts +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/esm2020/lib/account/user-account/esolve-user-account-business.model.mjs +0 -9
- package/esm2020/lib/account/user-account/esolve-user-account-contact.model.mjs +0 -8
- package/esm2020/lib/account/user-account/esolve-user-account-data.interface.mjs +0 -2
- package/esm2020/lib/account/user-account/esolve-user-account-record.interface.mjs +0 -2
- package/esm2020/lib/account/user-account/esolve-user-account-result.model.mjs +0 -9
- package/esm2020/lib/account/user-account/esolve-user-account.model.mjs +0 -14
- package/esm2020/lib/account/user-account/esolve-user-client-account-balances-record.interface.mjs +0 -2
- package/esm2020/lib/account/user-account/esolve-user-client-account-balances.model.mjs +0 -13
- package/esm2020/lib/account/user-account/esolve-user-client-account-record.interface.mjs +0 -2
- package/esm2020/lib/account/user-account/esolve-user-client-account.model.mjs +0 -43
- package/lib/account/user-account/esolve-user-account-business.model.d.ts +0 -7
- package/lib/account/user-account/esolve-user-account-contact.model.d.ts +0 -6
- package/lib/account/user-account/esolve-user-client-account.model.d.ts +0 -41
|
@@ -5,7 +5,7 @@ import * as i1$2 from '@angular/common/http';
|
|
|
5
5
|
import { HTTP_INTERCEPTORS, HttpClientModule, HttpErrorResponse, HttpParams, HttpHeaders } from '@angular/common/http';
|
|
6
6
|
import * as i1 from 'ngx-cookie-service';
|
|
7
7
|
import { CookieService } from 'ngx-cookie-service';
|
|
8
|
-
import { BehaviorSubject, throwError, of, iif } from 'rxjs';
|
|
8
|
+
import { BehaviorSubject, throwError, of, Subject, firstValueFrom, iif } from 'rxjs';
|
|
9
9
|
import * as i1$1 from '@angular/platform-browser';
|
|
10
10
|
import { map, catchError, tap, switchMap } from 'rxjs/operators';
|
|
11
11
|
import { __awaiter } from 'tslib';
|
|
@@ -245,6 +245,7 @@ class EsolveAuthInterceptorService {
|
|
|
245
245
|
const service_identifier = req.url.replace(`${this.config.api_url}/`, '');
|
|
246
246
|
const modified_url = req.url;
|
|
247
247
|
let params = req.params;
|
|
248
|
+
let headers = req.headers;
|
|
248
249
|
const session = this.session.currentSession;
|
|
249
250
|
if (session.valid) {
|
|
250
251
|
if (service_identifier !== 'get-access-token.php') {
|
|
@@ -252,9 +253,13 @@ class EsolveAuthInterceptorService {
|
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
params = params.set('ws_id', this.config.wsid);
|
|
256
|
+
if (this.config.native && this.config.device_designation) {
|
|
257
|
+
headers = headers.set('X-Device-Designation', this.config.device_designation);
|
|
258
|
+
}
|
|
255
259
|
const modified_req = req.clone({
|
|
256
260
|
url: modified_url,
|
|
257
261
|
params,
|
|
262
|
+
headers,
|
|
258
263
|
});
|
|
259
264
|
return next.handle(modified_req);
|
|
260
265
|
}
|
|
@@ -1873,17 +1878,26 @@ class EsolveAddressResult extends EsolveResponseResult {
|
|
|
1873
1878
|
}
|
|
1874
1879
|
}
|
|
1875
1880
|
|
|
1876
|
-
class
|
|
1877
|
-
constructor(
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1881
|
+
class EsolveUserAccountBusiness {
|
|
1882
|
+
constructor(record) {
|
|
1883
|
+
var _a, _b, _c, _d;
|
|
1884
|
+
if (record) {
|
|
1885
|
+
this.name = (_a = record.busname) !== null && _a !== void 0 ? _a : '';
|
|
1886
|
+
this.vat_number = (_b = record.vatnum) !== null && _b !== void 0 ? _b : '';
|
|
1887
|
+
this.description = (_c = record.busdescript) !== null && _c !== void 0 ? _c : '';
|
|
1888
|
+
this.type = (_d = record.business_type) !== null && _d !== void 0 ? _d : '';
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
class EsolveUserAccountContact {
|
|
1894
|
+
constructor(record) {
|
|
1895
|
+
var _a, _b, _c;
|
|
1896
|
+
if (record) {
|
|
1897
|
+
this.tel_number = (_a = record.telnumber) !== null && _a !== void 0 ? _a : '';
|
|
1898
|
+
this.cell_number = (_b = record.cellnumber) !== null && _b !== void 0 ? _b : '';
|
|
1899
|
+
this.fax_number = (_c = record.fax) !== null && _c !== void 0 ? _c : '';
|
|
1900
|
+
}
|
|
1887
1901
|
}
|
|
1888
1902
|
}
|
|
1889
1903
|
|
|
@@ -1895,63 +1909,117 @@ class EsolveUserAccountResult extends EsolveResponseResult {
|
|
|
1895
1909
|
}
|
|
1896
1910
|
}
|
|
1897
1911
|
|
|
1898
|
-
class
|
|
1899
|
-
constructor(
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1912
|
+
class EsolveStatementAgeing {
|
|
1913
|
+
constructor(record) {
|
|
1914
|
+
var _a, _b;
|
|
1915
|
+
if (record) {
|
|
1916
|
+
this.days = +((_a = record.days) !== null && _a !== void 0 ? _a : 0);
|
|
1917
|
+
this.amount = +((_b = record.amount) !== null && _b !== void 0 ? _b : 0);
|
|
1918
|
+
}
|
|
1904
1919
|
}
|
|
1905
1920
|
}
|
|
1906
1921
|
|
|
1907
|
-
class
|
|
1908
|
-
constructor(
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1922
|
+
class EsolveStatementBalances {
|
|
1923
|
+
constructor(record) {
|
|
1924
|
+
var _a, _b, _c;
|
|
1925
|
+
if (record) {
|
|
1926
|
+
this.total = +((_a = record.total) !== null && _a !== void 0 ? _a : 0);
|
|
1927
|
+
this.ageing = (_c = (_b = record.ageing) === null || _b === void 0 ? void 0 : _b.map((e) => new EsolveStatementAgeing(e))) !== null && _c !== void 0 ? _c : [];
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
class EsolveStatementTransaction {
|
|
1933
|
+
constructor(record) {
|
|
1934
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1935
|
+
if (record) {
|
|
1936
|
+
this.order_date = (_a = record.order_date) !== null && _a !== void 0 ? _a : '';
|
|
1937
|
+
this.order_number = (_b = record.order_number) !== null && _b !== void 0 ? _b : '';
|
|
1938
|
+
this.comment = (_c = record.comment) !== null && _c !== void 0 ? _c : '';
|
|
1939
|
+
this.account = (_d = record.account) !== null && _d !== void 0 ? _d : '';
|
|
1940
|
+
this.iq_reference = (_e = record.iq_reference) !== null && _e !== void 0 ? _e : '';
|
|
1941
|
+
this.total = +((_f = record.total) !== null && _f !== void 0 ? _f : 0);
|
|
1942
|
+
this.amount_due = +((_g = record.amount_due) !== null && _g !== void 0 ? _g : 0);
|
|
1943
|
+
this.is_debit = !!+((_h = record.is_debit) !== null && _h !== void 0 ? _h : true);
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
class EsolveStatement {
|
|
1949
|
+
constructor(record) {
|
|
1950
|
+
var _a, _b;
|
|
1951
|
+
if (record) {
|
|
1952
|
+
this.balances = new EsolveStatementBalances(record.balances);
|
|
1953
|
+
this.transactions = (_b = (_a = record.transactions) === null || _a === void 0 ? void 0 : _a.map((e) => new EsolveStatementTransaction(e))) !== null && _b !== void 0 ? _b : [];
|
|
1954
|
+
}
|
|
1912
1955
|
}
|
|
1913
1956
|
}
|
|
1914
1957
|
|
|
1915
1958
|
class EsolveUserClientAccount {
|
|
1916
|
-
constructor(
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1959
|
+
constructor(record) {
|
|
1960
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
1961
|
+
if (record) {
|
|
1962
|
+
this.account = (_a = record.account) !== null && _a !== void 0 ? _a : '';
|
|
1963
|
+
this.branch_code = (_b = record.branch_code) !== null && _b !== void 0 ? _b : '';
|
|
1964
|
+
this.account_group = (_c = record.account_group) !== null && _c !== void 0 ? _c : '';
|
|
1965
|
+
this.pricing_group = (_d = record.pricing_group) !== null && _d !== void 0 ? _d : '';
|
|
1966
|
+
this.company_name = (_e = record.company_name) !== null && _e !== void 0 ? _e : '';
|
|
1967
|
+
this.client_contact_person = (_f = record.client_contact_person) !== null && _f !== void 0 ? _f : '';
|
|
1968
|
+
this.client_firstname = (_g = record.client_firstname) !== null && _g !== void 0 ? _g : '';
|
|
1969
|
+
this.client_surname = (_h = record.client_surname) !== null && _h !== void 0 ? _h : '';
|
|
1970
|
+
this.client_email = (_j = record.client_email) !== null && _j !== void 0 ? _j : '';
|
|
1971
|
+
this.client_contact_number = (_k = record.client_contact_number) !== null && _k !== void 0 ? _k : '';
|
|
1972
|
+
this.client_fax_number = (_l = record.client_fax_number) !== null && _l !== void 0 ? _l : '';
|
|
1973
|
+
this.client_cellphone_number = (_m = record.client_cellphone_number) !== null && _m !== void 0 ? _m : '';
|
|
1974
|
+
this.client_id_number = (_o = record.client_id_number) !== null && _o !== void 0 ? _o : '';
|
|
1975
|
+
this.address_description = (_p = record.address_description) !== null && _p !== void 0 ? _p : '';
|
|
1976
|
+
this.street = (_q = record.street) !== null && _q !== void 0 ? _q : '';
|
|
1977
|
+
this.suburb = record.suburb;
|
|
1978
|
+
this.city = (_r = record.city) !== null && _r !== void 0 ? _r : '';
|
|
1979
|
+
this.province = (_s = record.province) !== null && _s !== void 0 ? _s : '';
|
|
1980
|
+
this.country = (_t = record.country) !== null && _t !== void 0 ? _t : '';
|
|
1981
|
+
this.postal_code = (_u = record.postal_code) !== null && _u !== void 0 ? _u : '';
|
|
1982
|
+
this.postal_address = (_v = record.postal_address) !== null && _v !== void 0 ? _v : '';
|
|
1983
|
+
this.delivery_address = (_w = record.delivery_address) !== null && _w !== void 0 ? _w : '';
|
|
1984
|
+
this.vat_number = (_x = record.vat_number) !== null && _x !== void 0 ? _x : '';
|
|
1985
|
+
this.ageing = (_y = record.ageing) !== null && _y !== void 0 ? _y : '';
|
|
1986
|
+
this.balance_last_updated = (_z = record.balance_last_updated) !== null && _z !== void 0 ? _z : '';
|
|
1987
|
+
this.client_classification = (_0 = record.client_classification) !== null && _0 !== void 0 ? _0 : '';
|
|
1988
|
+
this.override_stock_listing_identifiers = (_1 = record.override_stock_listing_identifiers) !== null && _1 !== void 0 ? _1 : '';
|
|
1989
|
+
this.requires_transaction_approval = (_2 = record.requires_transaction_approval) !== null && _2 !== void 0 ? _2 : '';
|
|
1990
|
+
this.latitude = +((_3 = record.latitude) !== null && _3 !== void 0 ? _3 : 0);
|
|
1991
|
+
this.longitude = +((_4 = record.longitude) !== null && _4 !== void 0 ? _4 : 0);
|
|
1992
|
+
this.price_list = +((_5 = record.price_list) !== null && _5 !== void 0 ? _5 : 0);
|
|
1993
|
+
this.loyalty_classification_id = +((_6 = record.loyalty_classification_id) !== null && _6 !== void 0 ? _6 : 0);
|
|
1994
|
+
this.credit_limit = +((_7 = record.credit_limit) !== null && _7 !== void 0 ? _7 : 0);
|
|
1995
|
+
this.pending_invoice_balance = +((_8 = record.pending_invoice_balance) !== null && _8 !== void 0 ? _8 : 0);
|
|
1996
|
+
this.external_account_balance = +((_9 = record.external_account_balance) !== null && _9 !== void 0 ? _9 : 0);
|
|
1997
|
+
this.default_sellprice = +((_10 = record.default_sellprice) !== null && _10 !== void 0 ? _10 : 0);
|
|
1998
|
+
this.is_active = !!+((_11 = record.is_active) !== null && _11 !== void 0 ? _11 : false);
|
|
1999
|
+
this.external_statement = new EsolveStatement(record.external_statement);
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
class EsolveUserAccount {
|
|
2005
|
+
constructor(record) {
|
|
2006
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2007
|
+
if (record) {
|
|
2008
|
+
this.esolve_id = +((_a = record.userid) !== null && _a !== void 0 ? _a : 0);
|
|
2009
|
+
this.email = (_b = record.email) !== null && _b !== void 0 ? _b : '';
|
|
2010
|
+
this.registration_type = (_c = record.registration_type) !== null && _c !== void 0 ? _c : '';
|
|
2011
|
+
this.title = (_d = record.title) !== null && _d !== void 0 ? _d : '';
|
|
2012
|
+
this.first_name = (_e = record.firstname) !== null && _e !== void 0 ? _e : '';
|
|
2013
|
+
this.last_name = (_f = record.surname) !== null && _f !== void 0 ? _f : '';
|
|
2014
|
+
this.initials = (_g = record.initials) !== null && _g !== void 0 ? _g : '';
|
|
2015
|
+
this.gender = (_h = record.gender) !== null && _h !== void 0 ? _h : '';
|
|
2016
|
+
this.identification_number = (_j = record.idnumber) !== null && _j !== void 0 ? _j : '';
|
|
2017
|
+
this.contact_details = new EsolveUserAccountContact(record);
|
|
2018
|
+
this.business_details = new EsolveUserAccountBusiness(record);
|
|
2019
|
+
if (record.client_details && (record.client_details.account !== '')) {
|
|
2020
|
+
this.client_details = new EsolveUserClientAccount(record.client_details);
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
1955
2023
|
}
|
|
1956
2024
|
}
|
|
1957
2025
|
|
|
@@ -2491,12 +2559,228 @@ class EsolveTransactionAnalyticsData {
|
|
|
2491
2559
|
}
|
|
2492
2560
|
}
|
|
2493
2561
|
|
|
2562
|
+
class EsolveCoupon {
|
|
2563
|
+
constructor(record) {
|
|
2564
|
+
this.id = 0;
|
|
2565
|
+
this.identifier = '';
|
|
2566
|
+
this.discount = 0;
|
|
2567
|
+
/**
|
|
2568
|
+
* Shows either the short code or the coupon key (if short code is not set)
|
|
2569
|
+
*/
|
|
2570
|
+
this.coupon_code = '';
|
|
2571
|
+
/**
|
|
2572
|
+
* Limit of the number of items it can apply to
|
|
2573
|
+
*/
|
|
2574
|
+
this.apply_on = 0;
|
|
2575
|
+
/**
|
|
2576
|
+
* Indicates if the discount does not apply to specified products, meaning
|
|
2577
|
+
* all items get the discount
|
|
2578
|
+
*/
|
|
2579
|
+
this.apply_to_full_cart = false;
|
|
2580
|
+
if (record) {
|
|
2581
|
+
this.id = +record.id;
|
|
2582
|
+
this.identifier = record.identifier;
|
|
2583
|
+
this.discount = +record.discount;
|
|
2584
|
+
this.coupon_code = record.coupon_code;
|
|
2585
|
+
this.apply_on = +record.apply_on;
|
|
2586
|
+
this.apply_to_full_cart = record.apply_to_full_cart;
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
;
|
|
2592
|
+
|
|
2593
|
+
class EsolveCouponsService {
|
|
2594
|
+
constructor(config, http, cookieService) {
|
|
2595
|
+
this.config = config;
|
|
2596
|
+
this.http = http;
|
|
2597
|
+
this.cookieService = cookieService;
|
|
2598
|
+
this.storage_key = '_ng_eslv_coupons';
|
|
2599
|
+
this.coupons_cache = new Map();
|
|
2600
|
+
this.applied = new BehaviorSubject(undefined);
|
|
2601
|
+
this.validation_error = new Subject();
|
|
2602
|
+
this.setStorageKey();
|
|
2603
|
+
this.coupons_cache = this.retrieveCache();
|
|
2604
|
+
}
|
|
2605
|
+
onValidationError() {
|
|
2606
|
+
return this.validation_error.asObservable();
|
|
2607
|
+
}
|
|
2608
|
+
onApplied() {
|
|
2609
|
+
return this.applied.asObservable();
|
|
2610
|
+
}
|
|
2611
|
+
validate(coupon_key) {
|
|
2612
|
+
return this.http
|
|
2613
|
+
.get(`${this.config.api_url}/get-validate-coupon.php`, {
|
|
2614
|
+
params: {
|
|
2615
|
+
coupon_key,
|
|
2616
|
+
},
|
|
2617
|
+
})
|
|
2618
|
+
.pipe(map((response) => {
|
|
2619
|
+
if (response.records === undefined) {
|
|
2620
|
+
throw response;
|
|
2621
|
+
}
|
|
2622
|
+
const valid = response.records.valid;
|
|
2623
|
+
const result = {
|
|
2624
|
+
valid,
|
|
2625
|
+
};
|
|
2626
|
+
if (!valid) {
|
|
2627
|
+
const error = response.records.error;
|
|
2628
|
+
this.validation_error.next(error);
|
|
2629
|
+
}
|
|
2630
|
+
else if (valid) {
|
|
2631
|
+
result.id = response.records.id;
|
|
2632
|
+
}
|
|
2633
|
+
return result;
|
|
2634
|
+
}), catchError(() => {
|
|
2635
|
+
this.validation_error.next(undefined);
|
|
2636
|
+
return of({ valid: false });
|
|
2637
|
+
}));
|
|
2638
|
+
}
|
|
2639
|
+
applyCoupon(coupon_key) {
|
|
2640
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2641
|
+
try {
|
|
2642
|
+
if (coupon_key.trim() === '') {
|
|
2643
|
+
return false;
|
|
2644
|
+
}
|
|
2645
|
+
const result = yield firstValueFrom(this.validate(coupon_key));
|
|
2646
|
+
if (result.valid && result.id) {
|
|
2647
|
+
this.addCoupon(result.id, coupon_key);
|
|
2648
|
+
}
|
|
2649
|
+
return result.valid;
|
|
2650
|
+
}
|
|
2651
|
+
catch (error) {
|
|
2652
|
+
return false;
|
|
2653
|
+
}
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
removeCoupon(id) {
|
|
2657
|
+
this.coupons_cache.delete(id);
|
|
2658
|
+
this.cacheCoupons();
|
|
2659
|
+
this.applied.next();
|
|
2660
|
+
}
|
|
2661
|
+
getAppliedCouponKeys() {
|
|
2662
|
+
return [...this.coupons_cache.values()];
|
|
2663
|
+
}
|
|
2664
|
+
getAppliedCoupons() {
|
|
2665
|
+
const coupon_ids = [...this.coupons_cache.keys()];
|
|
2666
|
+
return this.http
|
|
2667
|
+
.get(`${this.config.api_url}/get-applied-coupons.php`, {
|
|
2668
|
+
params: {
|
|
2669
|
+
coupons: coupon_ids.join(','),
|
|
2670
|
+
},
|
|
2671
|
+
})
|
|
2672
|
+
.pipe(map((response) => {
|
|
2673
|
+
if (response.records === undefined) {
|
|
2674
|
+
throw response;
|
|
2675
|
+
}
|
|
2676
|
+
return this.processCoupons(response.records);
|
|
2677
|
+
}));
|
|
2678
|
+
}
|
|
2679
|
+
reset() {
|
|
2680
|
+
this.deleteCoupons();
|
|
2681
|
+
}
|
|
2682
|
+
retrieveCache() {
|
|
2683
|
+
if (this.cookieService.check(this.storage_key)) {
|
|
2684
|
+
const coupons_json = this.cookieService.get(this.storage_key);
|
|
2685
|
+
try {
|
|
2686
|
+
return this.jsonDecodeMap(coupons_json);
|
|
2687
|
+
}
|
|
2688
|
+
catch (error) {
|
|
2689
|
+
// soft error
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
return new Map();
|
|
2693
|
+
}
|
|
2694
|
+
cacheCoupons() {
|
|
2695
|
+
if (this.coupons_cache.size > 0) {
|
|
2696
|
+
const coupons_json = this.jsonEncodeMap(this.coupons_cache);
|
|
2697
|
+
this.cookieService.set(this.storage_key, coupons_json, undefined, '/');
|
|
2698
|
+
}
|
|
2699
|
+
else {
|
|
2700
|
+
this.deleteCoupons();
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
deleteCoupons() {
|
|
2704
|
+
this.coupons_cache.clear();
|
|
2705
|
+
this.cookieService.delete(this.storage_key, '/');
|
|
2706
|
+
}
|
|
2707
|
+
addCoupon(id, key) {
|
|
2708
|
+
if (!this.coupons_cache.has(id)) {
|
|
2709
|
+
this.coupons_cache.set(id, key);
|
|
2710
|
+
this.cacheCoupons();
|
|
2711
|
+
}
|
|
2712
|
+
this.applied.next();
|
|
2713
|
+
}
|
|
2714
|
+
setStorageKey() {
|
|
2715
|
+
if (typeof this.config.coupon_storage_key === 'string' &&
|
|
2716
|
+
this.config.coupon_storage_key !== '') {
|
|
2717
|
+
this.storage_key = this.config.coupon_storage_key;
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
jsonEncodeMap(data) {
|
|
2721
|
+
if (!(data instanceof Map)) {
|
|
2722
|
+
throw new Error('Invalid map type');
|
|
2723
|
+
}
|
|
2724
|
+
return JSON.stringify(data, (key, value) => {
|
|
2725
|
+
if (value instanceof Map) {
|
|
2726
|
+
return {
|
|
2727
|
+
dataType: 'Map',
|
|
2728
|
+
value: [...value],
|
|
2729
|
+
};
|
|
2730
|
+
}
|
|
2731
|
+
else {
|
|
2732
|
+
return value;
|
|
2733
|
+
}
|
|
2734
|
+
});
|
|
2735
|
+
}
|
|
2736
|
+
jsonDecodeMap(json_data) {
|
|
2737
|
+
const data = JSON.parse(json_data, (key, value) => {
|
|
2738
|
+
if (typeof value === 'object' && value !== null) {
|
|
2739
|
+
if (value.dataType === 'Map') {
|
|
2740
|
+
return new Map(value.value);
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
return value;
|
|
2744
|
+
});
|
|
2745
|
+
if (data instanceof Map) {
|
|
2746
|
+
return data;
|
|
2747
|
+
}
|
|
2748
|
+
throw new Error('Invalid map type');
|
|
2749
|
+
}
|
|
2750
|
+
processCoupons(records) {
|
|
2751
|
+
const coupons = [];
|
|
2752
|
+
if (records) {
|
|
2753
|
+
for (const record of records) {
|
|
2754
|
+
const coupon = new EsolveCoupon(record);
|
|
2755
|
+
coupons.push(coupon);
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
return coupons;
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
EsolveCouponsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveCouponsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveCookieService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2762
|
+
EsolveCouponsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveCouponsService, providedIn: 'root' });
|
|
2763
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveCouponsService, decorators: [{
|
|
2764
|
+
type: Injectable,
|
|
2765
|
+
args: [{
|
|
2766
|
+
providedIn: 'root',
|
|
2767
|
+
}]
|
|
2768
|
+
}], ctorParameters: function () {
|
|
2769
|
+
return [{ type: undefined, decorators: [{
|
|
2770
|
+
type: Inject,
|
|
2771
|
+
args: [ESOLVE_CONNECT_CONFIG]
|
|
2772
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveCookieService }];
|
|
2773
|
+
} });
|
|
2774
|
+
|
|
2775
|
+
// Classes
|
|
2776
|
+
|
|
2494
2777
|
class EsolveCartService {
|
|
2495
|
-
constructor(config, http, errorHandler, responseHandler) {
|
|
2778
|
+
constructor(config, http, errorHandler, responseHandler, coupons) {
|
|
2496
2779
|
this.config = config;
|
|
2497
2780
|
this.http = http;
|
|
2498
2781
|
this.errorHandler = errorHandler;
|
|
2499
2782
|
this.responseHandler = responseHandler;
|
|
2783
|
+
this.coupons = coupons;
|
|
2500
2784
|
this._cached_tracking = 0;
|
|
2501
2785
|
}
|
|
2502
2786
|
/**
|
|
@@ -2505,8 +2789,13 @@ class EsolveCartService {
|
|
|
2505
2789
|
* @returns An `Observable` with an array of cart items
|
|
2506
2790
|
*/
|
|
2507
2791
|
getCart() {
|
|
2792
|
+
let params = new HttpParams();
|
|
2793
|
+
const coupons = this.coupons.getAppliedCouponKeys();
|
|
2794
|
+
if (coupons.length > 0) {
|
|
2795
|
+
params = params.set('coupons', coupons.join(','));
|
|
2796
|
+
}
|
|
2508
2797
|
return this.http
|
|
2509
|
-
.get(`${this.config.api_url}/get-cart.php
|
|
2798
|
+
.get(`${this.config.api_url}/get-cart.php`, { params })
|
|
2510
2799
|
.pipe(map((response) => {
|
|
2511
2800
|
if (response.records === undefined) {
|
|
2512
2801
|
throw response;
|
|
@@ -2519,6 +2808,7 @@ class EsolveCartService {
|
|
|
2519
2808
|
*
|
|
2520
2809
|
* @param items An array of options to update the cart
|
|
2521
2810
|
* @param action The default action to preform
|
|
2811
|
+
*
|
|
2522
2812
|
* @returns An `Observable` with an array of responses that gives feedback on the requested changes
|
|
2523
2813
|
*/
|
|
2524
2814
|
setCart(items, action = 'add') {
|
|
@@ -2626,6 +2916,7 @@ class EsolveCartService {
|
|
|
2626
2916
|
* @param payment_method_id The ID of the selected payment method
|
|
2627
2917
|
* @param location_id The ID of the selected branch from with shipping needs to be calculated
|
|
2628
2918
|
* @param comments Additional comments on the cart
|
|
2919
|
+
*
|
|
2629
2920
|
* @returns An `Observable` with the transaction ID
|
|
2630
2921
|
*/
|
|
2631
2922
|
checkout(type, addresses_id, shipping_id, payment_method_id = 0, location_id = 0, comments = '') {
|
|
@@ -2653,6 +2944,7 @@ class EsolveCartService {
|
|
|
2653
2944
|
})
|
|
2654
2945
|
.pipe(map((http_response) => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
|
|
2655
2946
|
this._cached_tracking = 0;
|
|
2947
|
+
this.coupons.reset();
|
|
2656
2948
|
return new EsolveCheckoutResult(response);
|
|
2657
2949
|
})), catchError((errorRes) => {
|
|
2658
2950
|
return this.errorHandler.handleHttpPostError('set-checkout', errorRes);
|
|
@@ -2686,7 +2978,7 @@ class EsolveCartService {
|
|
|
2686
2978
|
return cart_totals;
|
|
2687
2979
|
}
|
|
2688
2980
|
}
|
|
2689
|
-
EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2981
|
+
EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }, { token: EsolveCouponsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2690
2982
|
EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
|
|
2691
2983
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveCartService, decorators: [{
|
|
2692
2984
|
type: Injectable,
|
|
@@ -2697,7 +2989,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
2697
2989
|
return [{ type: undefined, decorators: [{
|
|
2698
2990
|
type: Inject,
|
|
2699
2991
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2700
|
-
}] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }];
|
|
2992
|
+
}] }, { type: i1$2.HttpClient }, { type: EsolveErrorHandlerService }, { type: EsolveResponseHandlerService }, { type: EsolveCouponsService }];
|
|
2701
2993
|
} });
|
|
2702
2994
|
|
|
2703
2995
|
class EsolveAccountService {
|
|
@@ -2993,22 +3285,13 @@ class EsolveAccountService {
|
|
|
2993
3285
|
}
|
|
2994
3286
|
}
|
|
2995
3287
|
processUserAccount(record) {
|
|
2996
|
-
var _a;
|
|
2997
3288
|
if (!record) {
|
|
2998
3289
|
throw new Error('Invalid record');
|
|
2999
3290
|
}
|
|
3000
3291
|
if (+record.userid !== this._user_id) {
|
|
3001
3292
|
throw new Error('Invalid user account retrieved');
|
|
3002
3293
|
}
|
|
3003
|
-
|
|
3004
|
-
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
3005
|
-
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
3006
|
-
if (record.client_details != undefined) {
|
|
3007
|
-
if (((_a = record.client_details) === null || _a === void 0 ? void 0 : _a.account) !== '') {
|
|
3008
|
-
user_account.client_details = new EsolveUserClientAccount(record.client_details.account, record.client_details.branch_code, record.client_details.account_group, record.client_details.pricing_group, +record.client_details.price_list, +record.client_details.loyalty_classification_id, record.client_details.company_name, record.client_details.client_contact_person, record.client_details.client_firstname, record.client_details.client_surname, record.client_details.client_email, record.client_details.client_contact_number, record.client_details.client_fax_number, record.client_details.client_cellphone_number, record.client_details.client_id_number, record.client_details.address_description, record.client_details.street, record.client_details.suburb, record.client_details.city, record.client_details.province, record.client_details.country, record.client_details.postal_code, record.client_details.postal_address, record.client_details.delivery_address, +record.client_details.latitude, +record.client_details.longitude, record.client_details.vat_number, +record.client_details.credit_limit, +record.client_details.pending_invoice_balance, +record.client_details.external_account_balance, record.client_details.ageing, record.client_details.balance_last_updated, +record.client_details.default_sellprice, record.client_details.client_classification, record.client_details.override_stock_listing_identifiers, record.client_details.requires_transaction_approval, record.client_details.is_active, record.client_details.external_statement);
|
|
3009
|
-
}
|
|
3010
|
-
}
|
|
3011
|
-
return user_account;
|
|
3294
|
+
return new EsolveUserAccount(record);
|
|
3012
3295
|
}
|
|
3013
3296
|
processUserAddress(records) {
|
|
3014
3297
|
const user_addresses = [];
|
|
@@ -3543,9 +3826,16 @@ class EsolveStockLeadTimes {
|
|
|
3543
3826
|
}
|
|
3544
3827
|
}
|
|
3545
3828
|
|
|
3829
|
+
class EsolveStockTransactionHistory {
|
|
3830
|
+
constructor(total_order_qty = 0, total_quote_qty = 0) {
|
|
3831
|
+
this.total_order_qty = total_order_qty;
|
|
3832
|
+
this.total_quote_qty = total_quote_qty;
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3546
3836
|
class EsolveStockItemBase {
|
|
3547
3837
|
constructor(record = {}) {
|
|
3548
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
3838
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
3549
3839
|
/**
|
|
3550
3840
|
* eSolve Generated ID
|
|
3551
3841
|
*/
|
|
@@ -3746,8 +4036,13 @@ class EsolveStockItemBase {
|
|
|
3746
4036
|
if (record.custom_fields) {
|
|
3747
4037
|
this.custom_fields = record.custom_fields;
|
|
3748
4038
|
}
|
|
3749
|
-
|
|
3750
|
-
|
|
4039
|
+
if ((record.total_order_qty) || ((record.total_quote_qty))) {
|
|
4040
|
+
const total_order_qty = +((_4 = record.total_order_qty) !== null && _4 !== void 0 ? _4 : 0);
|
|
4041
|
+
const total_quote_qty = +((_5 = record.total_quote_qty) !== null && _5 !== void 0 ? _5 : 0);
|
|
4042
|
+
this.history = new EsolveStockTransactionHistory(total_order_qty, total_quote_qty);
|
|
4043
|
+
}
|
|
4044
|
+
seo_title = (_6 = record.seo_page_title) !== null && _6 !== void 0 ? _6 : '';
|
|
4045
|
+
seo_keywords = (_7 = record.seo_keywords) !== null && _7 !== void 0 ? _7 : '';
|
|
3751
4046
|
}
|
|
3752
4047
|
this.price = new EsolveStockPrice(base_price, base_price_with_tax, sell_price, sell_price_with_tax, record.vat_rate, record.vat_item);
|
|
3753
4048
|
if (seo_title.trim() === '') {
|
|
@@ -4030,6 +4325,57 @@ class EsolveStockService {
|
|
|
4030
4325
|
* @param options Stock filter options
|
|
4031
4326
|
*/
|
|
4032
4327
|
getStockItems(options) {
|
|
4328
|
+
let params = new HttpParams();
|
|
4329
|
+
if (options.page) {
|
|
4330
|
+
params = params.set('page', options.page);
|
|
4331
|
+
}
|
|
4332
|
+
if (options.rows) {
|
|
4333
|
+
params = params.set('rows', options.rows);
|
|
4334
|
+
}
|
|
4335
|
+
if (options.sort) {
|
|
4336
|
+
const sort = options.sort;
|
|
4337
|
+
if (sort.field) {
|
|
4338
|
+
params = params.set('sort', sort.field);
|
|
4339
|
+
}
|
|
4340
|
+
if (sort.order) {
|
|
4341
|
+
params = params.set('order', sort.order);
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
if (options.search_phrase) {
|
|
4345
|
+
params = params.set('search_phrase', options.search_phrase);
|
|
4346
|
+
}
|
|
4347
|
+
if (options.display_only) {
|
|
4348
|
+
params = params.set('display_only', options.display_only);
|
|
4349
|
+
}
|
|
4350
|
+
if (options.is_active) {
|
|
4351
|
+
params = params.set('is_active', options.is_active);
|
|
4352
|
+
}
|
|
4353
|
+
if (options.filters) {
|
|
4354
|
+
let filters = options.filters;
|
|
4355
|
+
if (!Array.isArray(filters)) {
|
|
4356
|
+
filters = EsolveFilterFactory.covertFromObj(filters);
|
|
4357
|
+
}
|
|
4358
|
+
params = EsolveFilterFactory.convertToHttpParams(filters, params);
|
|
4359
|
+
}
|
|
4360
|
+
return this.getStockRecords(params).pipe(map((response) => {
|
|
4361
|
+
var _a;
|
|
4362
|
+
if ((response.records === undefined) ||
|
|
4363
|
+
(response.records.length <= 0)) {
|
|
4364
|
+
throw response;
|
|
4365
|
+
}
|
|
4366
|
+
const stockItems = [];
|
|
4367
|
+
response.records.forEach((stockRecord) => {
|
|
4368
|
+
stockItems.push(this.processStockItem(stockRecord));
|
|
4369
|
+
});
|
|
4370
|
+
return new EsolveStockItemList(stockItems, +response.additional_data.total_records, (_a = options.page) !== null && _a !== void 0 ? _a : 0);
|
|
4371
|
+
}));
|
|
4372
|
+
}
|
|
4373
|
+
/**
|
|
4374
|
+
* Retrieves list of stock from the eSolve instance using info provided
|
|
4375
|
+
*
|
|
4376
|
+
* @param options Stock filter options
|
|
4377
|
+
*/
|
|
4378
|
+
getStockItemsTransactionHistory(options) {
|
|
4033
4379
|
let params = new HttpParams();
|
|
4034
4380
|
if (options.page) {
|
|
4035
4381
|
params = params.set('page', options.page);
|
|
@@ -4083,7 +4429,7 @@ class EsolveStockService {
|
|
|
4083
4429
|
}
|
|
4084
4430
|
params = EsolveFilterFactory.convertToHttpParams(filters, params);
|
|
4085
4431
|
}
|
|
4086
|
-
return this.
|
|
4432
|
+
return this.getStockHistoryRecords(params).pipe(map((response) => {
|
|
4087
4433
|
var _a;
|
|
4088
4434
|
if ((response.records === undefined) ||
|
|
4089
4435
|
(response.records.length <= 0)) {
|
|
@@ -4298,6 +4644,13 @@ class EsolveStockService {
|
|
|
4298
4644
|
getStockRecords(params) {
|
|
4299
4645
|
return this.http.get(`${this.config.api_url}/get-items.php`, { params });
|
|
4300
4646
|
}
|
|
4647
|
+
/**
|
|
4648
|
+
* Retrieves stock transaction history records from HTTP params.
|
|
4649
|
+
* @param params HTTP client parameters
|
|
4650
|
+
*/
|
|
4651
|
+
getStockHistoryRecords(params) {
|
|
4652
|
+
return this.http.get(`${this.config.api_url}/get-items-transaction-history.php`, { params });
|
|
4653
|
+
}
|
|
4301
4654
|
}
|
|
4302
4655
|
EsolveStockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveStockService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4303
4656
|
EsolveStockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EsolveStockService, providedIn: 'root' });
|
|
@@ -5238,5 +5591,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
5238
5591
|
* Generated bundle index. Do not edit.
|
|
5239
5592
|
*/
|
|
5240
5593
|
|
|
5241
|
-
export { ESOLVE_CONNECT_CONFIG, EsolveAccountConfirmationResult, EsolveAccountService, EsolveAdditionalStockImage, EsolveAddress, EsolveAddressResult, EsolveAsset, EsolveAssetsService, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartStockItem, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveColour, EsolveCookieService, EsolveDependantItem, EsolveEmptyCartResult, EsolveEmptyWishlistResult, EsolveEnquiryResult, EsolveEnquiryService, EsolveErrorHandlerService, EsolveFilterFactory, EsolveGeocodeAddressResult, EsolveGeocodeCoordsResult, EsolveGeocodeResult, EsolveGeocoderService, EsolveHttpError, EsolveLinkedAsset, EsolveLinkedStockItem, EsolveList, EsolveLocation, EsolveLocationAddress, EsolveLocationContactInfo, EsolveLocationGEO, EsolveLocationPOBoxAddress, EsolveLocationTradingDay, EsolveLocationTradingTimes, EsolveLocationsService, EsolveManufacturer, EsolveManufacturersService, EsolveMediaStockItem, EsolveMenuItem, EsolveMenuService, EsolveMultipleSelectFilter, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRange, EsolveRangeFilter, EsolveRangesService, EsolveRecipeStockItem, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSeoInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveShippingTotals, EsolveSingleSelectFilter, EsolveSpecial, EsolveSpecialDates, EsolveSpecialImage, EsolveSpecialImageCollection, EsolveSpecialsService, EsolveStockBadge, EsolveStockGroup, EsolveStockGroupItem, EsolveStockImage, EsolveStockImageCollection, EsolveStockItem, EsolveStockItemBase, EsolveStockItemList, EsolveStockLeadTimes, EsolveStockPrice, EsolveStockService, EsolveSupplier, EsolveSuppliersService, EsolveTag, EsolveTagsService, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionAnalyticsData, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveUserClientAccount, EsolveUserClientAccountBalances, EsolveVaultItem, EsolveVaultItemResult, EsolveWishlistItem, EsolveWishlistService, NgEsolveConnectModule };
|
|
5594
|
+
export { ESOLVE_CONNECT_CONFIG, EsolveAccountConfirmationResult, EsolveAccountService, EsolveAdditionalStockImage, EsolveAddress, EsolveAddressResult, EsolveAsset, EsolveAssetsService, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartStockItem, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveColour, EsolveCookieService, EsolveCoupon, EsolveCouponsService, EsolveDependantItem, EsolveEmptyCartResult, EsolveEmptyWishlistResult, EsolveEnquiryResult, EsolveEnquiryService, EsolveErrorHandlerService, EsolveFilterFactory, EsolveGeocodeAddressResult, EsolveGeocodeCoordsResult, EsolveGeocodeResult, EsolveGeocoderService, EsolveHttpError, EsolveLinkedAsset, EsolveLinkedStockItem, EsolveList, EsolveLocation, EsolveLocationAddress, EsolveLocationContactInfo, EsolveLocationGEO, EsolveLocationPOBoxAddress, EsolveLocationTradingDay, EsolveLocationTradingTimes, EsolveLocationsService, EsolveManufacturer, EsolveManufacturersService, EsolveMediaStockItem, EsolveMenuItem, EsolveMenuService, EsolveMultipleSelectFilter, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRange, EsolveRangeFilter, EsolveRangesService, EsolveRecipeStockItem, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSeoInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveShippingTotals, EsolveSingleSelectFilter, EsolveSpecial, EsolveSpecialDates, EsolveSpecialImage, EsolveSpecialImageCollection, EsolveSpecialsService, EsolveStockBadge, EsolveStockGroup, EsolveStockGroupItem, EsolveStockImage, EsolveStockImageCollection, EsolveStockItem, EsolveStockItemBase, EsolveStockItemList, EsolveStockLeadTimes, EsolveStockPrice, EsolveStockService, EsolveSupplier, EsolveSuppliersService, EsolveTag, EsolveTagsService, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionAnalyticsData, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveUserClientAccount, EsolveUserClientAccountBalances, EsolveVaultItem, EsolveVaultItemResult, EsolveWishlistItem, EsolveWishlistService, NgEsolveConnectModule };
|
|
5242
5595
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|