addio-admin-sdk 1.7.207 → 1.7.209

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.
@@ -0,0 +1,13 @@
1
+ import type { IPriceOptions } from '../Interfaces/Declination';
2
+ /**
3
+ * Check whether a declination's `price.discountPrice` actually defines an applicable discount.
4
+ *
5
+ * `IPriceOptions.discountPrice` is optional, but every declination built through `getDefaultPrice`
6
+ * sets it and uses `amount === 0` as for "no discount set". `amount: 0` therefore does
7
+ * NOT mean the item is worth zero (free) and must never be treated as a real price. A discount price
8
+ * equal to the regular price is also considered "no discount", since it removes nothing.
9
+ *
10
+ * @param price - The declination price options
11
+ * @returns {boolean} true when an applicable (non-zero) discount price is set
12
+ */
13
+ export declare const hasApplicableDiscountPrice: (price: IPriceOptions) => boolean;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasApplicableDiscountPrice = void 0;
4
+ /**
5
+ * Check whether a declination's `price.discountPrice` actually defines an applicable discount.
6
+ *
7
+ * `IPriceOptions.discountPrice` is optional, but every declination built through `getDefaultPrice`
8
+ * sets it and uses `amount === 0` as for "no discount set". `amount: 0` therefore does
9
+ * NOT mean the item is worth zero (free) and must never be treated as a real price. A discount price
10
+ * equal to the regular price is also considered "no discount", since it removes nothing.
11
+ *
12
+ * @param price - The declination price options
13
+ * @returns {boolean} true when an applicable (non-zero) discount price is set
14
+ */
15
+ const hasApplicableDiscountPrice = (price) => {
16
+ const { discountPrice, regular } = price;
17
+ if (discountPrice && discountPrice.amount !== 0 && discountPrice.amount !== regular.amount) {
18
+ return true;
19
+ }
20
+ return false;
21
+ };
22
+ exports.hasApplicableDiscountPrice = hasApplicableDiscountPrice;
23
+ //# sourceMappingURL=pricing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../src/utils/pricing.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;GAUG;AACI,MAAM,0BAA0B,GAAG,CAAC,KAAoB,EAAW,EAAE;IAC3E,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;IACvC,IAAI,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE;QAC1F,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAPY,QAAA,0BAA0B,8BAOtC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "addio-admin-sdk",
3
- "version": "1.7.207",
3
+ "version": "1.7.209",
4
4
  "description": "Admin EComm SDK - Addio",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://github.com/gitngin/gng-tb-admin-sdk",
package/.env DELETED
@@ -1,15 +0,0 @@
1
- NEXT_PUBLIC_FIREBASE_CONFIG_API_KEY_DEV='AIzaSyBNtwzdIe2__HJD23S87RIbWbIqKQVtFiw'
2
- NEXT_PUBLIC_FIREBASE_CONFIG_API_KEY_PROD='AIzaSyDK6WQZkCrsMGunAPHn9KkdCGPky4hTgL4'
3
- NEXT_PUBLIC_MESSAGING_SENDER_ID_DEV='188490998694'
4
- NEXT_PUBLIC_MESSAGING_SENDER_ID_PROD='725873016982'
5
- NEXT_PUBLIC_FIREBASE_APP_ID_PROD='1:725873016982:web:9b1f6d77819909e19102b7'
6
- NEXT_PUBLIC_FIREBASE_APP_ID_DEV='1:188490998694:web:eecd719e7b18f38d272567'
7
- NEXT_PUBLIC_MEASUREMENT_ID_DEV='G-4BB66ZRTWZ'
8
- NEXT_PUBLIC_MEASUREMENT_ID_PROD='G-BB8HHZ466R'
9
-
10
- NEXT_PUBLIC_SERVICE_DATABASE_READ_PROVIDER=nobase
11
- NEXT_PUBLIC_SERVICE_DATABASE_WRITE_PROVIDER=nobase
12
- NEXT_PUBLIC_SERVICE_DATABASE_URL=https://db-test.addiocommerce.com/
13
- NEXT_PUBLIC_API_URL=https://api-test.addiocommerce.com/v1
14
- NEXT_PUBLIC_SERVICE_DATABASE_TOKEN='337043a374-6f0be-5eb26-05be550631'
15
- LOCAL_FIRESTORE=false
@@ -1,22 +0,0 @@
1
- import IEmail from './IEmail';
2
- export default interface IAccountConfirmationEmail extends IEmail {
3
- readonly Attachments?: {
4
- readonly Name: string;
5
- readonly ContentID: string;
6
- readonly Content: string;
7
- readonly ContentType: string;
8
- }[];
9
- readonly TemplateModel: {
10
- readonly subject: string;
11
- readonly mail_icon: string;
12
- readonly title: string;
13
- readonly subtitle: string;
14
- readonly username: string;
15
- readonly email: string;
16
- readonly btn_href: string;
17
- readonly btn_label: string;
18
- readonly text: string;
19
- readonly company_logo_onwhite_src: string;
20
- readonly [key: string]: any;
21
- };
22
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IAccountConfirmationEmail.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IAccountConfirmationEmail.js","sourceRoot":"","sources":["../../../src/Interfaces/Email/IAccountConfirmationEmail.ts"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- /**
2
- * AccountConfirmation class.
3
- *
4
- * @link ecomm.gitngin.com/wiki/models/accountconfirmation
5
- * @file Extends Email class with IAccountConfirmation interface
6
- * @author Titane Studio <sloranger@titanestudio.ca>.
7
- * @since 01-01-2020
8
- */
9
- import Email from '.';
10
- import IAccountConfirmationEmail from '../../Interfaces/Email/IAccountConfirmationEmail';
11
- import Space from '../Space';
12
- export default class AccountConfirmationEmail extends Email {
13
- data: IAccountConfirmationEmail;
14
- constructor(_data: IAccountConfirmationEmail, _space: Space, _to: string);
15
- getDefaultInfosForEmail: () => {
16
- company_logo_onwhite_src: string;
17
- };
18
- sendEmail: (locale?: string) => Promise<import("postmark/dist/client/models").MessageSendingResponse>;
19
- }
@@ -1,31 +0,0 @@
1
- "use strict";
2
- /**
3
- * AccountConfirmation class.
4
- *
5
- * @link ecomm.gitngin.com/wiki/models/accountconfirmation
6
- * @file Extends Email class with IAccountConfirmation interface
7
- * @author Titane Studio <sloranger@titanestudio.ca>.
8
- * @since 01-01-2020
9
- */
10
- var __importDefault = (this && this.__importDefault) || function (mod) {
11
- return (mod && mod.__esModule) ? mod : { "default": mod };
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- const _1 = __importDefault(require("."));
15
- const __1 = require("../..");
16
- class AccountConfirmationEmail extends _1.default {
17
- constructor(_data, _space, _to) {
18
- super(_space, _to, 'account_confirmation');
19
- this.getDefaultInfosForEmail = () => {
20
- return {
21
- company_logo_onwhite_src: `https://gng-ecr${__1.isTestEnv ? '-test' : ''}.imgix.net//the_beast/1.0.0/orgs/zrqIBwO7QyqUT2DoxeNW/spaces/RqUTslR7Jcll3lsD68yT/logo-lariviere-meunier.png`
22
- };
23
- };
24
- this.sendEmail = async (locale = 'fr') => {
25
- return await this.send(this.data, locale);
26
- };
27
- this.data = Object.assign(Object.assign({}, _data), this.getDefaultInfosForEmail());
28
- }
29
- }
30
- exports.default = AccountConfirmationEmail;
31
- //# sourceMappingURL=AccountConfirmationEmail.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AccountConfirmationEmail.js","sourceRoot":"","sources":["../../../src/lib/Email/AccountConfirmationEmail.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;AAEH,yCAAqB;AACrB,6BAAiC;AAIjC,MAAqB,wBAAyB,SAAQ,UAAK;IAG1D,YAAmB,KAAgC,EAAE,MAAa,EAAE,GAAW;QAC9E,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,sBAAsB,CAAC,CAAA;QAIpC,4BAAuB,GAAG,GAAG,EAAE;YACrC,OAAO;gBACN,wBAAwB,EAAE,kBACzB,aAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EACvB,8GAA8G;aAC9G,CAAA;QACF,CAAC,CAAA;QAEM,cAAS,GAAG,KAAK,EAAE,SAAiB,IAAI,EAAE,EAAE;YAClD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QAC1C,CAAC,CAAA;QAbA,IAAI,CAAC,IAAI,mCAAQ,KAAK,GAAK,IAAI,CAAC,uBAAuB,EAAE,CAAE,CAAA;IAC5D,CAAC;CAaD;AAnBD,2CAmBC"}
@@ -1,40 +0,0 @@
1
- import Space from '../Space';
2
- export default class Queue {
3
- private _space;
4
- constructor(space: Space);
5
- last: () => Promise<QueueItem>;
6
- first: () => Promise<QueueItem>;
7
- lastX: (numberOfReturnedItems: number) => Promise<QueueItem[]>;
8
- firstX: (numberOfReturnedItems: number) => Promise<QueueItem[]>;
9
- }
10
- export declare enum QueueItemTypeEnum {
11
- PRODUCT_CREATE = 0,
12
- PRODUCT_UPDATE = 1,
13
- PRODUCT_DELETE = 2,
14
- INVENTORY_UPDATE = 3,
15
- CLIENT_CREATE = 4,
16
- CLIENT_UPDATE = 5,
17
- CLIENT_DELETE = 6
18
- }
19
- export declare enum QueueExternalService {
20
- QUICKBOOKS = 0,
21
- SAGE = 1,
22
- ACOMBA = 2
23
- }
24
- export declare enum QueueDirection {
25
- FROM_OUTTER = 0,
26
- TO_OUTTER = 1
27
- }
28
- export declare class QueueItem {
29
- private _space;
30
- private _type;
31
- private _added_at;
32
- private _id;
33
- private _service;
34
- private _direction;
35
- private _details?;
36
- private _progress;
37
- constructor(space: Space, type: QueueItemTypeEnum, added_at: Date, id: string, service: QueueExternalService, direction: QueueDirection, rest: any);
38
- private _triggerExec;
39
- private _getOperation;
40
- }
@@ -1,255 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- 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) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __rest = (this && this.__rest) || function (s, e) {
39
- var t = {};
40
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
41
- t[p] = s[p];
42
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
43
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
44
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
45
- t[p[i]] = s[p[i]];
46
- }
47
- return t;
48
- };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
51
- };
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.QueueItem = exports.QueueDirection = exports.QueueExternalService = exports.QueueItemTypeEnum = void 0;
54
- var DatabaseService_1 = __importDefault(require("../../services/database/DatabaseService"));
55
- var console_1 = require("../../utils/console");
56
- var Product_1 = __importDefault(require("../Product"));
57
- var Queue = (function () {
58
- function Queue(space) {
59
- var _this = this;
60
- this.last = function () { return __awaiter(_this, void 0, void 0, function () {
61
- var lastReq, _a, type, added_at, id, service, direction, rest;
62
- return __generator(this, function (_b) {
63
- switch (_b.label) {
64
- case 0:
65
- if (!!!this._space)
66
- throw new Error("Space must be defined");
67
- return [4, DatabaseService_1.default.getDocuments(this._space.documents.queue(), {
68
- orderBy: 'added_at',
69
- order: 'desc',
70
- limit: 1
71
- })];
72
- case 1:
73
- lastReq = _b.sent();
74
- if (lastReq.length == 0)
75
- throw new Error("Can't access last, may be empty");
76
- if (lastReq[0].exists || !!!lastReq[0].data)
77
- throw new Error("Can't access last, may be empty");
78
- _a = lastReq[0].data, type = _a.type, added_at = _a.added_at, id = _a.id, service = _a.service, direction = _a.direction, rest = __rest(_a, ["type", "added_at", "id", "service", "direction"]);
79
- return [2, new QueueItem(this._space, type, added_at, id, service, direction, rest)];
80
- }
81
- });
82
- }); };
83
- this.first = function () { return __awaiter(_this, void 0, void 0, function () {
84
- var firstReq, _a, type, added_at, id, service, direction, rest;
85
- return __generator(this, function (_b) {
86
- switch (_b.label) {
87
- case 0:
88
- if (!!!this._space)
89
- throw new Error("Space must be defined");
90
- return [4, DatabaseService_1.default.getDocuments(this._space.documents.queue(), {
91
- orderBy: 'added_at',
92
- order: 'asc',
93
- limit: 1
94
- })];
95
- case 1:
96
- firstReq = _b.sent();
97
- if (firstReq.length == 0)
98
- throw new Error("Can't access first, may be empty");
99
- if (firstReq[0].exists || !!!firstReq[0].data)
100
- throw new Error("Can't access last, may be empty");
101
- _a = firstReq[0].data, type = _a.type, added_at = _a.added_at, id = _a.id, service = _a.service, direction = _a.direction, rest = __rest(_a, ["type", "added_at", "id", "service", "direction"]);
102
- return [2, new QueueItem(this._space, type, added_at, id, service, direction, rest)];
103
- }
104
- });
105
- }); };
106
- this.lastX = function (numberOfReturnedItems) { return __awaiter(_this, void 0, void 0, function () {
107
- var lastReq;
108
- var _this = this;
109
- return __generator(this, function (_a) {
110
- switch (_a.label) {
111
- case 0:
112
- if (!!!this._space)
113
- throw new Error("Space must be defined");
114
- return [4, DatabaseService_1.default.getDocuments(this._space.documents.queue(), {
115
- orderBy: 'added_at',
116
- order: 'desc',
117
- limit: numberOfReturnedItems
118
- })];
119
- case 1:
120
- lastReq = _a.sent();
121
- if (lastReq.length == 0)
122
- throw new Error("Can't access last, may be empty");
123
- if (lastReq[0].exists || !!!lastReq[0].data)
124
- throw new Error("Can't access last, may be empty");
125
- return [2, lastReq.map(function (d) {
126
- var _a = d.data, type = _a.type, added_at = _a.added_at, id = _a.id, service = _a.service, direction = _a.direction, rest = __rest(_a, ["type", "added_at", "id", "service", "direction"]);
127
- return new QueueItem(_this._space, type, added_at, id, service, direction, rest);
128
- })];
129
- }
130
- });
131
- }); };
132
- this.firstX = function (numberOfReturnedItems) { return __awaiter(_this, void 0, void 0, function () {
133
- var firstReq;
134
- var _this = this;
135
- return __generator(this, function (_a) {
136
- switch (_a.label) {
137
- case 0:
138
- if (!!!this._space)
139
- throw new Error("Space must be defined");
140
- return [4, DatabaseService_1.default.getDocuments(this._space.documents.queue(), {
141
- orderBy: 'added_at',
142
- order: 'asc',
143
- limit: numberOfReturnedItems
144
- })];
145
- case 1:
146
- firstReq = _a.sent();
147
- if (firstReq.length == 0)
148
- throw new Error("Can't access first, may be empty");
149
- if (firstReq[0].exists || !!!firstReq[0].data)
150
- throw new Error("Can't access last, may be empty");
151
- return [2, firstReq.map(function (d) {
152
- var _a = d.data, type = _a.type, added_at = _a.added_at, id = _a.id, service = _a.service, direction = _a.direction, rest = __rest(_a, ["type", "added_at", "id", "service", "direction"]);
153
- return new QueueItem(_this._space, type, added_at, id, service, direction, rest);
154
- })];
155
- }
156
- });
157
- }); };
158
- this._space = space;
159
- }
160
- return Queue;
161
- }());
162
- exports.default = Queue;
163
- var QueueItemTypeEnum;
164
- (function (QueueItemTypeEnum) {
165
- QueueItemTypeEnum[QueueItemTypeEnum["PRODUCT_CREATE"] = 0] = "PRODUCT_CREATE";
166
- QueueItemTypeEnum[QueueItemTypeEnum["PRODUCT_UPDATE"] = 1] = "PRODUCT_UPDATE";
167
- QueueItemTypeEnum[QueueItemTypeEnum["PRODUCT_DELETE"] = 2] = "PRODUCT_DELETE";
168
- QueueItemTypeEnum[QueueItemTypeEnum["INVENTORY_UPDATE"] = 3] = "INVENTORY_UPDATE";
169
- QueueItemTypeEnum[QueueItemTypeEnum["CLIENT_CREATE"] = 4] = "CLIENT_CREATE";
170
- QueueItemTypeEnum[QueueItemTypeEnum["CLIENT_UPDATE"] = 5] = "CLIENT_UPDATE";
171
- QueueItemTypeEnum[QueueItemTypeEnum["CLIENT_DELETE"] = 6] = "CLIENT_DELETE";
172
- })(QueueItemTypeEnum = exports.QueueItemTypeEnum || (exports.QueueItemTypeEnum = {}));
173
- var QueueExternalService;
174
- (function (QueueExternalService) {
175
- QueueExternalService[QueueExternalService["QUICKBOOKS"] = 0] = "QUICKBOOKS";
176
- QueueExternalService[QueueExternalService["SAGE"] = 1] = "SAGE";
177
- QueueExternalService[QueueExternalService["ACOMBA"] = 2] = "ACOMBA";
178
- })(QueueExternalService = exports.QueueExternalService || (exports.QueueExternalService = {}));
179
- var QueueDirection;
180
- (function (QueueDirection) {
181
- QueueDirection[QueueDirection["FROM_OUTTER"] = 0] = "FROM_OUTTER";
182
- QueueDirection[QueueDirection["TO_OUTTER"] = 1] = "TO_OUTTER";
183
- })(QueueDirection = exports.QueueDirection || (exports.QueueDirection = {}));
184
- var QueueItem = (function () {
185
- function QueueItem(space, type, added_at, id, service, direction, rest) {
186
- var _this = this;
187
- this._triggerExec = function () { return __awaiter(_this, void 0, void 0, function () {
188
- var operation, _a, _b, _c, _d, error_1;
189
- return __generator(this, function (_e) {
190
- switch (_e.label) {
191
- case 0:
192
- _e.trys.push([0, 5, , 6]);
193
- operation = this._getOperation(this._type);
194
- if (!!!!this._details) return [3, 2];
195
- _a = this;
196
- _b = _a._progress;
197
- return [4, operation()];
198
- case 1:
199
- _a._progress = _b + _e.sent();
200
- return [3, 4];
201
- case 2:
202
- _c = this;
203
- _d = _c._progress;
204
- return [4, operation(this._details)];
205
- case 3:
206
- _c._progress = _d + _e.sent();
207
- _e.label = 4;
208
- case 4: return [3, 6];
209
- case 5:
210
- error_1 = _e.sent();
211
- (0, console_1.errorMessage)("Error while processing queue ".concat(error_1, " - ").concat(JSON.stringify(error_1)));
212
- return [3, 6];
213
- case 6: return [2];
214
- }
215
- });
216
- }); };
217
- this._getOperation = function (type) { return __awaiter(_this, void 0, void 0, function () {
218
- var _this = this;
219
- return __generator(this, function (_a) {
220
- switch (type) {
221
- case QueueItemTypeEnum.CLIENT_CREATE:
222
- case QueueItemTypeEnum.CLIENT_DELETE:
223
- case QueueItemTypeEnum.CLIENT_UPDATE:
224
- case QueueItemTypeEnum.PRODUCT_CREATE:
225
- return [2, this._space.addProduct];
226
- case QueueItemTypeEnum.PRODUCT_DELETE:
227
- return [2, function () {
228
- return new Product_1.default(_this._details, DatabaseService_1.default.asCollectionObject(_this._space.getRef().path, _this._space.getRef().id + '/products'), "External service ".concat(_this._service.toString())).delete;
229
- }];
230
- case QueueItemTypeEnum.PRODUCT_UPDATE:
231
- return [2, function () {
232
- return new Product_1.default({ id: _this._details.id }, DatabaseService_1.default.asCollectionObject(_this._space.getRef().path, _this._space.getRef().id + '/products'), "External service ".concat(_this._service.toString())).save;
233
- }];
234
- case QueueItemTypeEnum.INVENTORY_UPDATE:
235
- default:
236
- return [2, function () { }];
237
- }
238
- return [2];
239
- });
240
- }); };
241
- this._space = space;
242
- this._type = type;
243
- this._added_at = added_at;
244
- this._id = id;
245
- this._service = service;
246
- this._direction = direction;
247
- this._details = rest;
248
- this._progress = '';
249
- if (direction === QueueDirection.FROM_OUTTER)
250
- this._triggerExec();
251
- }
252
- return QueueItem;
253
- }());
254
- exports.QueueItem = QueueItem;
255
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/Queue/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4FAAqE;AACrE,+CAAkD;AAClD,uDAAgC;AAGhC;IAGC,eAAmB,KAAY;QAA/B,iBAEC;QAEM,SAAI,GAAG;;;;;wBACb,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM;4BAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;wBAE5C,WAAM,yBAAe,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE;gCACjF,OAAO,EAAE,UAAU;gCACnB,KAAK,EAAE,MAAM;gCACb,KAAK,EAAE,CAAC;6BACR,CAAC,EAAA;;wBAJI,OAAO,GAAG,SAId;wBAEF,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;4BAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;wBAC3E,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;4BAAE,MAAM,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Y,EAAE,CAAA;IAClE,CAAC;IA0CF,gBAAC;AAAD,CAAC,AAvED,IAuEC;AAvEY,8BAAS"}
@@ -1,37 +0,0 @@
1
- import ICart from '../../Interfaces/Cart';
2
- import IProduct from '../../Interfaces/Product';
3
- import { ExternalServiceSlugEnum } from '../../Interfaces/Space/IExternalService';
4
- import Space from '../../lib/Space';
5
- import BaseMarketServiceClass, { executeQueryFnc, IMarketplaceOrigin, MarketServiceResult } from './BaseMarketServiceClass';
6
- import { MarketServiceActionsEnum } from './utils';
7
- export declare enum EbayActionEnum {
8
- UPDATE_PRICE = "PROD_UPD",
9
- UPDATE_QTY = "PROD_UPD",
10
- REMOVE_ITEM = "REM_ITM",
11
- ORDER_SHIPPED = "ORDER_SHIP",
12
- ORDER_CANCEL = "ORDER_CAN"
13
- }
14
- export declare enum EbayMarketplaceOriginEnum {
15
- EBAY_CA = "EBAY_CA"
16
- }
17
- export default class CardtraderServiceClass extends BaseMarketServiceClass {
18
- constructor(space: Space, executeQuery?: executeQueryFnc);
19
- getServiceSlug(): ExternalServiceSlugEnum;
20
- getSupportedServices(): IMarketplaceOrigin[];
21
- hasCapability(action: MarketServiceActionsEnum): boolean;
22
- private testIfProductAllowed;
23
- updateDeclinationPrice(product: IProduct, sku: string, newValue: number): Promise<MarketServiceResult>;
24
- updateDeclinationQty(product: IProduct, sku: string, newValue: number): Promise<MarketServiceResult>;
25
- removeDeclination(product: IProduct, sku: string): Promise<MarketServiceResult>;
26
- private shouldProcessCart;
27
- /**
28
- * Update the invoice status on the marketplace
29
- * @param _cart the cart data
30
- */
31
- setOrderAsShipped(cart: ICart): Promise<MarketServiceResult>;
32
- /**
33
- * Update the invoice status on the marketplace
34
- * @param _cart the cart data
35
- */
36
- acceptCancelationRequest(cart: ICart): Promise<MarketServiceResult>;
37
- }