@bringg/dashboard-sdk 10.1.0 → 10.2.0-pre.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/dist/Tag/Entity/TagEntity.d.ts +10 -1
- package/dist/Tag/Entity/TagEntity.js +60 -0
- package/dist/Tag/Entity/TagEntity.js.map +1 -1
- package/dist/Tag/Tag.consts.d.ts +9 -0
- package/dist/Tag/Tag.consts.js.map +1 -1
- package/dist/Tag/Tag.d.ts +11 -3
- package/dist/Tag/Tag.js +25 -1
- package/dist/Tag/Tag.js.map +1 -1
- package/dist/bringg-dashboard-sdk-cjs2.js +86 -2
- package/dist/bringg-dashboard-sdk-cjs2.js.map +1 -1
- package/dist/bringg-dashboard-sdk.js +3 -3
- package/dist/bringg-dashboard-sdk.min.js +1 -1
- package/dist/bringg-dashboard-sdk.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { Tag as TagType } from '@bringg/types';
|
|
1
|
+
import { MerchantConfigurationImageField, Tag as TagType } from '@bringg/types';
|
|
2
2
|
import Entity from '../../Core/Entity';
|
|
3
|
+
import { UploadLogoResponse } from '../../MerchantConfiguration/MerchantConfiguration.consts';
|
|
3
4
|
import Session from '../../Services/Identity/Session';
|
|
5
|
+
import { CreateTagWithConfigurationsOptions, TagConfigurationType, TagResponse } from '../Tag.consts';
|
|
4
6
|
export default class TagEntity extends Entity<TagType> {
|
|
5
7
|
constructor(session: Session);
|
|
8
|
+
createWithConfigurations(options: CreateTagWithConfigurationsOptions): Promise<TagResponse>;
|
|
9
|
+
createConfiguration(tagId: number, type: TagConfigurationType): Promise<TagResponse>;
|
|
10
|
+
deleteConfiguration(tagId: number, type: TagConfigurationType): Promise<TagResponse>;
|
|
11
|
+
createCancelReasonsConfiguration(tagId: number): Promise<TagResponse>;
|
|
12
|
+
deleteCancelReasonsConfiguration(tagId: number): Promise<TagResponse>;
|
|
13
|
+
updateCancelReasons(tagId: number, tag: TagType): Promise<TagResponse>;
|
|
14
|
+
uploadImage(tagId: number, field: MerchantConfigurationImageField, imageFile: File): Promise<UploadLogoResponse>;
|
|
6
15
|
}
|
|
@@ -39,6 +39,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
var Entity_1 = __importStar(require("../../Core/Entity"));
|
|
42
|
+
var BASE_ROUTE = '/tags';
|
|
43
|
+
var REASON_TO_CANCEL_TASKS_ROUTE = '/reason_to_cancel_tasks';
|
|
44
|
+
var Routes = {
|
|
45
|
+
CREATE_WITH_CONFIGURATIONS: "".concat(BASE_ROUTE, "/create_tag"),
|
|
46
|
+
CREATE_CANCEL_REASONS_CONFIGURATION: "".concat(REASON_TO_CANCEL_TASKS_ROUTE, "/create_tag_reason_to_cancel_tasks_configuration"),
|
|
47
|
+
DELETE_CANCEL_REASONS_CONFIGURATION: "".concat(REASON_TO_CANCEL_TASKS_ROUTE, "/delete_tag_reason_to_cancel_tasks_configuration"),
|
|
48
|
+
UPDATE_CANCEL_REASONS: "".concat(REASON_TO_CANCEL_TASKS_ROUTE, "/update_tag_reasons_to_cancel_task")
|
|
49
|
+
};
|
|
42
50
|
var TagEntity = /** @class */ (function (_super) {
|
|
43
51
|
__extends(TagEntity, _super);
|
|
44
52
|
function TagEntity(session) {
|
|
@@ -48,6 +56,58 @@ var TagEntity = /** @class */ (function (_super) {
|
|
|
48
56
|
routes: [Entity_1.BaseRoutes.Create, Entity_1.BaseRoutes.Update, Entity_1.BaseRoutes.Delete, Entity_1.BaseRoutes.GetAll]
|
|
49
57
|
}) || this;
|
|
50
58
|
}
|
|
59
|
+
TagEntity.prototype.createWithConfigurations = function (options) {
|
|
60
|
+
return this.service.routeGenerator
|
|
61
|
+
.post(Routes.CREATE_WITH_CONFIGURATIONS)
|
|
62
|
+
.withPayload(options)
|
|
63
|
+
.setException('Could not create tag')
|
|
64
|
+
.invoke();
|
|
65
|
+
};
|
|
66
|
+
TagEntity.prototype.createConfiguration = function (tagId, type) {
|
|
67
|
+
return (this.service.routeGenerator
|
|
68
|
+
.post("".concat(BASE_ROUTE, "/").concat(tagId, "/create_tag_").concat(type, "_configuration"))
|
|
69
|
+
// The server looks the tag up by `params[:id]`, which the nested route doesn't provide (it has `tag_id`)
|
|
70
|
+
.withPayload({ id: tagId })
|
|
71
|
+
.setException("Could not create ".concat(type, " configuration for tag #").concat(tagId))
|
|
72
|
+
.invoke());
|
|
73
|
+
};
|
|
74
|
+
TagEntity.prototype.deleteConfiguration = function (tagId, type) {
|
|
75
|
+
return this.service.routeGenerator
|
|
76
|
+
.delete("".concat(BASE_ROUTE, "/").concat(tagId, "/delete_tag_").concat(type, "_configuration"))
|
|
77
|
+
.setException("Could not delete ".concat(type, " configuration of tag #").concat(tagId))
|
|
78
|
+
.invoke();
|
|
79
|
+
};
|
|
80
|
+
TagEntity.prototype.createCancelReasonsConfiguration = function (tagId) {
|
|
81
|
+
return this.service.routeGenerator
|
|
82
|
+
.post(Routes.CREATE_CANCEL_REASONS_CONFIGURATION)
|
|
83
|
+
.withPayload({ tag_id: tagId })
|
|
84
|
+
.setException("Could not create cancel reasons configuration for tag #".concat(tagId))
|
|
85
|
+
.invoke();
|
|
86
|
+
};
|
|
87
|
+
TagEntity.prototype.deleteCancelReasonsConfiguration = function (tagId) {
|
|
88
|
+
return this.service.routeGenerator
|
|
89
|
+
.delete(Routes.DELETE_CANCEL_REASONS_CONFIGURATION)
|
|
90
|
+
.withQueryString({ tag_id: tagId })
|
|
91
|
+
.setException("Could not delete cancel reasons configuration of tag #".concat(tagId))
|
|
92
|
+
.invoke();
|
|
93
|
+
};
|
|
94
|
+
TagEntity.prototype.updateCancelReasons = function (tagId, tag) {
|
|
95
|
+
return this.service.routeGenerator
|
|
96
|
+
.post(Routes.UPDATE_CANCEL_REASONS)
|
|
97
|
+
.withPayload({ tag_id: tagId, tag: tag })
|
|
98
|
+
.setException("Could not update cancel reasons of tag #".concat(tagId))
|
|
99
|
+
.invoke();
|
|
100
|
+
};
|
|
101
|
+
TagEntity.prototype.uploadImage = function (tagId, field, imageFile) {
|
|
102
|
+
var formData = new FormData();
|
|
103
|
+
formData.append('file', imageFile);
|
|
104
|
+
return this.service.routeGenerator
|
|
105
|
+
.post("".concat(BASE_ROUTE, "/").concat(tagId, "/").concat(field, "/"))
|
|
106
|
+
.withHeaders({ 'Content-Type': 'multipart/form-data' })
|
|
107
|
+
.withPayload(formData)
|
|
108
|
+
.setException("Could not upload ".concat(field, " of tag #").concat(tagId))
|
|
109
|
+
.invoke();
|
|
110
|
+
};
|
|
51
111
|
return TagEntity;
|
|
52
112
|
}(Entity_1.default));
|
|
53
113
|
exports.default = TagEntity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagEntity.js","sourceRoot":"","sources":["../../../src/Tag/Entity/TagEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAAuD;
|
|
1
|
+
{"version":3,"file":"TagEntity.js","sourceRoot":"","sources":["../../../src/Tag/Entity/TagEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAAuD;AAKvD,IAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,IAAM,4BAA4B,GAAG,yBAAyB,CAAC;AAE/D,IAAM,MAAM,GAAG;IACd,0BAA0B,EAAE,UAAG,UAAU,gBAAa;IACtD,mCAAmC,EAAE,UAAG,4BAA4B,qDAAkD;IACtH,mCAAmC,EAAE,UAAG,4BAA4B,qDAAkD;IACtH,qBAAqB,EAAE,UAAG,4BAA4B,uCAAoC;CAC1F,CAAC;AAEF;IAAuC,6BAAe;IACrD,mBAAY,OAAgB;eAC3B,kBAAM;YACL,OAAO,SAAA;YACP,UAAU,EAAE,MAAM;YAClB,MAAM,EAAE,CAAC,mBAAU,CAAC,MAAM,EAAE,mBAAU,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cAAc;aAChC,MAAM,CAAC,MAAM,CAAC,mCAAmC,CAAC;aAClD,eAAe,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;aAClC,YAAY,CAAC,gEAAyD,KAAK,CAAE,CAAC;aAC9E,MAAM,EAAE,CAAC;IACZ,CAAC;IAEM,uCAAmB,GAA1B,UAA2B,KAAa,EAAE,GAAY;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc;aAChC,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC;aAClC,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAA,EAAE,CAAC;aACnC,YAAY,CAAC,kDAA2C,KAAK,CAAE,CAAC;aAChE,MAAM,EAAE,CAAC;IACZ,CAAC;IAEM,+BAAW,GAAlB,UACC,KAAa,EACb,KAAsC,EACtC,SAAe;QAEf,IAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAEhC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAEnC,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc;aAChC,IAAI,CAAC,UAAG,UAAU,cAAI,KAAK,cAAI,KAAK,MAAG,CAAC;aACxC,WAAW,CAAC,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAAC;aACtD,WAAW,CAAC,QAAQ,CAAC;aACrB,YAAY,CAAC,2BAAoB,KAAK,sBAAY,KAAK,CAAE,CAAC;aAC1D,MAAM,EAAE,CAAC;IACZ,CAAC;IACF,gBAAC;AAAD,CAAC,AA3ED,CAAuC,gBAAM,GA2E5C"}
|
package/dist/Tag/Tag.consts.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Tag, TagCustomerConfiguration, TagMerchantConfiguration, TagRulesConfiguration } from '@bringg/types';
|
|
2
2
|
import { BasicResponse } from '../Core/Responses';
|
|
3
|
+
/** @deprecated `Tag.getAll` resolves the tags array itself, this shape is not what the server returns */
|
|
3
4
|
export type TagGetAllResponse = {
|
|
4
5
|
tags: Tag[];
|
|
5
6
|
};
|
|
6
7
|
export type TagResponse = BasicResponse & {
|
|
7
8
|
tag: Tag;
|
|
8
9
|
rc?: number;
|
|
10
|
+
message?: string;
|
|
9
11
|
};
|
|
10
12
|
export type TagWithoutConfigurations = Omit<Tag, 'tag_merchant_configuration' | 'tag_customer_configuration' | 'tag_rules_configuration'>;
|
|
11
13
|
export type TagMerchantConfigurationDefaultValues = Array<keyof Omit<TagMerchantConfiguration, 'id' | 'merchant_id' | 'tag_id' | 'created_at' | 'updated_at' | 'logo' | 'delivery_pin' | 'email_logo' | 'destination_pin'>>;
|
|
@@ -28,3 +30,10 @@ export type CreateTag = {
|
|
|
28
30
|
tag_rules_configuration?: TagRulesConfigurationDefaultValues;
|
|
29
31
|
};
|
|
30
32
|
export declare const defaultExtractor: (response: any) => any;
|
|
33
|
+
export type TagConfigurationType = 'merchant' | 'customer' | 'rules';
|
|
34
|
+
export type CreateTagWithConfigurationsOptions = {
|
|
35
|
+
tag: string;
|
|
36
|
+
with_app_styling?: boolean;
|
|
37
|
+
with_customer_configuration?: boolean;
|
|
38
|
+
with_rules_configuration?: boolean;
|
|
39
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.consts.js","sourceRoot":"","sources":["../../src/Tag/Tag.consts.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Tag.consts.js","sourceRoot":"","sources":["../../src/Tag/Tag.consts.ts"],"names":[],"mappings":";;;AAyEO,IAAM,gBAAgB,GAAG,UAAC,QAAa,IAAK,OAAA,QAAQ,EAAR,CAAQ,CAAC;AAA/C,QAAA,gBAAgB,oBAA+B"}
|
package/dist/Tag/Tag.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import { Tag as TagType } from '@bringg/types';
|
|
1
|
+
import { MerchantConfigurationImageField, Tag as TagType } from '@bringg/types';
|
|
2
2
|
import { BasicResponse } from '../Core/Responses';
|
|
3
|
+
import { UploadLogoResponse } from '../MerchantConfiguration/MerchantConfiguration.consts';
|
|
3
4
|
import Session from '../Services/Identity/Session';
|
|
4
|
-
import {
|
|
5
|
+
import { CreateTagWithConfigurationsOptions, TagConfigurationType, TagResponse } from './Tag.consts';
|
|
5
6
|
export default class Tag {
|
|
6
7
|
private tagEntity;
|
|
7
8
|
constructor(session: Session);
|
|
8
|
-
getAll(): Promise<
|
|
9
|
+
getAll(): Promise<TagType[]>;
|
|
9
10
|
create(tag: TagType): Promise<TagResponse>;
|
|
10
11
|
update(id: number, tag: TagType): Promise<TagResponse>;
|
|
11
12
|
delete(id: number): Promise<BasicResponse>;
|
|
13
|
+
createTagWithConfigurations(options: CreateTagWithConfigurationsOptions): Promise<TagResponse>;
|
|
14
|
+
createTagConfiguration(tagId: number, type: TagConfigurationType): Promise<TagResponse>;
|
|
15
|
+
deleteTagConfiguration(tagId: number, type: TagConfigurationType): Promise<TagResponse>;
|
|
16
|
+
createTagCancelReasonsConfiguration(tagId: number): Promise<TagResponse>;
|
|
17
|
+
deleteTagCancelReasonsConfiguration(tagId: number): Promise<TagResponse>;
|
|
18
|
+
updateTagCancelReasons(tagId: number, tag: TagType): Promise<TagResponse>;
|
|
19
|
+
uploadTagImage(tagId: number, field: MerchantConfigurationImageField, imageFile: File): Promise<UploadLogoResponse>;
|
|
12
20
|
}
|
package/dist/Tag/Tag.js
CHANGED
|
@@ -8,6 +8,7 @@ var Tag = /** @class */ (function () {
|
|
|
8
8
|
function Tag(session) {
|
|
9
9
|
this.tagEntity = new TagEntity_1.default(session);
|
|
10
10
|
}
|
|
11
|
+
// The server answers with the array of tags itself, not `{ tags }`
|
|
11
12
|
Tag.prototype.getAll = function () {
|
|
12
13
|
return this.tagEntity.service.getAll();
|
|
13
14
|
};
|
|
@@ -15,11 +16,34 @@ var Tag = /** @class */ (function () {
|
|
|
15
16
|
return this.tagEntity.service.create(tag);
|
|
16
17
|
};
|
|
17
18
|
Tag.prototype.update = function (id, tag) {
|
|
18
|
-
|
|
19
|
+
// The server reads the tag from `params[:tag]` (including `params[:tag][:id]`), so the body is nested.
|
|
20
|
+
// Sending the tag flat fails: its own `tag` name field stops Rails from wrapping the params.
|
|
21
|
+
return this.tagEntity.service.update(id, { id: id, tag: tag });
|
|
19
22
|
};
|
|
20
23
|
Tag.prototype.delete = function (id) {
|
|
21
24
|
return this.tagEntity.service.delete(id);
|
|
22
25
|
};
|
|
26
|
+
Tag.prototype.createTagWithConfigurations = function (options) {
|
|
27
|
+
return this.tagEntity.createWithConfigurations(options);
|
|
28
|
+
};
|
|
29
|
+
Tag.prototype.createTagConfiguration = function (tagId, type) {
|
|
30
|
+
return this.tagEntity.createConfiguration(tagId, type);
|
|
31
|
+
};
|
|
32
|
+
Tag.prototype.deleteTagConfiguration = function (tagId, type) {
|
|
33
|
+
return this.tagEntity.deleteConfiguration(tagId, type);
|
|
34
|
+
};
|
|
35
|
+
Tag.prototype.createTagCancelReasonsConfiguration = function (tagId) {
|
|
36
|
+
return this.tagEntity.createCancelReasonsConfiguration(tagId);
|
|
37
|
+
};
|
|
38
|
+
Tag.prototype.deleteTagCancelReasonsConfiguration = function (tagId) {
|
|
39
|
+
return this.tagEntity.deleteCancelReasonsConfiguration(tagId);
|
|
40
|
+
};
|
|
41
|
+
Tag.prototype.updateTagCancelReasons = function (tagId, tag) {
|
|
42
|
+
return this.tagEntity.updateCancelReasons(tagId, tag);
|
|
43
|
+
};
|
|
44
|
+
Tag.prototype.uploadTagImage = function (tagId, field, imageFile) {
|
|
45
|
+
return this.tagEntity.uploadImage(tagId, field, imageFile);
|
|
46
|
+
};
|
|
23
47
|
return Tag;
|
|
24
48
|
}());
|
|
25
49
|
exports.default = Tag;
|
package/dist/Tag/Tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../src/Tag/Tag.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Tag.js","source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AC,CAAC;IAC/D,CAAC;IAEM,iDAAmC,GAA1C,UAA2C,KAAa;QACvD,OAAO,IAAI,CAAC,SAAS,CAAC,gCAAgC,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;IAEM,oCAAsB,GAA7B,UAA8B,KAAa,EAAE,GAAY;QACxD,OAAO,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACvD,CAAC;IAEM,4BAAc,GAArB,UACC,KAAa,EACb,KAAsC,EACtC,SAAe;QAEf,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC5D,CAAC;IACF,UAAC;AAAD,CAAC,AAzDD,IAyDC"}
|
|
@@ -25027,7 +25027,7 @@ var BringgException_1 = __webpack_require__(43605);
|
|
|
25027
25027
|
var client_page_1 = __webpack_require__(16573);
|
|
25028
25028
|
var Logger_1 = __importDefault(__webpack_require__(55860));
|
|
25029
25029
|
var abort_1 = __webpack_require__(34179);
|
|
25030
|
-
var version = '10.
|
|
25030
|
+
var version = '10.2.0-pre.1';
|
|
25031
25031
|
function logErrorResponse(response) {
|
|
25032
25032
|
var data = response.data, status = response.status;
|
|
25033
25033
|
try {
|
|
@@ -26140,6 +26140,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26140
26140
|
};
|
|
26141
26141
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26142
26142
|
var Entity_1 = __importStar(__webpack_require__(7483));
|
|
26143
|
+
var BASE_ROUTE = '/tags';
|
|
26144
|
+
var REASON_TO_CANCEL_TASKS_ROUTE = '/reason_to_cancel_tasks';
|
|
26145
|
+
var Routes = {
|
|
26146
|
+
CREATE_WITH_CONFIGURATIONS: "".concat(BASE_ROUTE, "/create_tag"),
|
|
26147
|
+
CREATE_CANCEL_REASONS_CONFIGURATION: "".concat(REASON_TO_CANCEL_TASKS_ROUTE, "/create_tag_reason_to_cancel_tasks_configuration"),
|
|
26148
|
+
DELETE_CANCEL_REASONS_CONFIGURATION: "".concat(REASON_TO_CANCEL_TASKS_ROUTE, "/delete_tag_reason_to_cancel_tasks_configuration"),
|
|
26149
|
+
UPDATE_CANCEL_REASONS: "".concat(REASON_TO_CANCEL_TASKS_ROUTE, "/update_tag_reasons_to_cancel_task")
|
|
26150
|
+
};
|
|
26143
26151
|
var TagEntity = /** @class */ (function (_super) {
|
|
26144
26152
|
__extends(TagEntity, _super);
|
|
26145
26153
|
function TagEntity(session) {
|
|
@@ -26149,6 +26157,58 @@ var TagEntity = /** @class */ (function (_super) {
|
|
|
26149
26157
|
routes: [Entity_1.BaseRoutes.Create, Entity_1.BaseRoutes.Update, Entity_1.BaseRoutes.Delete, Entity_1.BaseRoutes.GetAll]
|
|
26150
26158
|
}) || this;
|
|
26151
26159
|
}
|
|
26160
|
+
TagEntity.prototype.createWithConfigurations = function (options) {
|
|
26161
|
+
return this.service.routeGenerator
|
|
26162
|
+
.post(Routes.CREATE_WITH_CONFIGURATIONS)
|
|
26163
|
+
.withPayload(options)
|
|
26164
|
+
.setException('Could not create tag')
|
|
26165
|
+
.invoke();
|
|
26166
|
+
};
|
|
26167
|
+
TagEntity.prototype.createConfiguration = function (tagId, type) {
|
|
26168
|
+
return (this.service.routeGenerator
|
|
26169
|
+
.post("".concat(BASE_ROUTE, "/").concat(tagId, "/create_tag_").concat(type, "_configuration"))
|
|
26170
|
+
// The server looks the tag up by `params[:id]`, which the nested route doesn't provide (it has `tag_id`)
|
|
26171
|
+
.withPayload({ id: tagId })
|
|
26172
|
+
.setException("Could not create ".concat(type, " configuration for tag #").concat(tagId))
|
|
26173
|
+
.invoke());
|
|
26174
|
+
};
|
|
26175
|
+
TagEntity.prototype.deleteConfiguration = function (tagId, type) {
|
|
26176
|
+
return this.service.routeGenerator
|
|
26177
|
+
.delete("".concat(BASE_ROUTE, "/").concat(tagId, "/delete_tag_").concat(type, "_configuration"))
|
|
26178
|
+
.setException("Could not delete ".concat(type, " configuration of tag #").concat(tagId))
|
|
26179
|
+
.invoke();
|
|
26180
|
+
};
|
|
26181
|
+
TagEntity.prototype.createCancelReasonsConfiguration = function (tagId) {
|
|
26182
|
+
return this.service.routeGenerator
|
|
26183
|
+
.post(Routes.CREATE_CANCEL_REASONS_CONFIGURATION)
|
|
26184
|
+
.withPayload({ tag_id: tagId })
|
|
26185
|
+
.setException("Could not create cancel reasons configuration for tag #".concat(tagId))
|
|
26186
|
+
.invoke();
|
|
26187
|
+
};
|
|
26188
|
+
TagEntity.prototype.deleteCancelReasonsConfiguration = function (tagId) {
|
|
26189
|
+
return this.service.routeGenerator
|
|
26190
|
+
.delete(Routes.DELETE_CANCEL_REASONS_CONFIGURATION)
|
|
26191
|
+
.withQueryString({ tag_id: tagId })
|
|
26192
|
+
.setException("Could not delete cancel reasons configuration of tag #".concat(tagId))
|
|
26193
|
+
.invoke();
|
|
26194
|
+
};
|
|
26195
|
+
TagEntity.prototype.updateCancelReasons = function (tagId, tag) {
|
|
26196
|
+
return this.service.routeGenerator
|
|
26197
|
+
.post(Routes.UPDATE_CANCEL_REASONS)
|
|
26198
|
+
.withPayload({ tag_id: tagId, tag: tag })
|
|
26199
|
+
.setException("Could not update cancel reasons of tag #".concat(tagId))
|
|
26200
|
+
.invoke();
|
|
26201
|
+
};
|
|
26202
|
+
TagEntity.prototype.uploadImage = function (tagId, field, imageFile) {
|
|
26203
|
+
var formData = new FormData();
|
|
26204
|
+
formData.append('file', imageFile);
|
|
26205
|
+
return this.service.routeGenerator
|
|
26206
|
+
.post("".concat(BASE_ROUTE, "/").concat(tagId, "/").concat(field, "/"))
|
|
26207
|
+
.withHeaders({ 'Content-Type': 'multipart/form-data' })
|
|
26208
|
+
.withPayload(formData)
|
|
26209
|
+
.setException("Could not upload ".concat(field, " of tag #").concat(tagId))
|
|
26210
|
+
.invoke();
|
|
26211
|
+
};
|
|
26152
26212
|
return TagEntity;
|
|
26153
26213
|
}(Entity_1.default));
|
|
26154
26214
|
exports["default"] = TagEntity;
|
|
@@ -26183,6 +26243,7 @@ var Tag = /** @class */ (function () {
|
|
|
26183
26243
|
function Tag(session) {
|
|
26184
26244
|
this.tagEntity = new TagEntity_1.default(session);
|
|
26185
26245
|
}
|
|
26246
|
+
// The server answers with the array of tags itself, not `{ tags }`
|
|
26186
26247
|
Tag.prototype.getAll = function () {
|
|
26187
26248
|
return this.tagEntity.service.getAll();
|
|
26188
26249
|
};
|
|
@@ -26190,11 +26251,34 @@ var Tag = /** @class */ (function () {
|
|
|
26190
26251
|
return this.tagEntity.service.create(tag);
|
|
26191
26252
|
};
|
|
26192
26253
|
Tag.prototype.update = function (id, tag) {
|
|
26193
|
-
|
|
26254
|
+
// The server reads the tag from `params[:tag]` (including `params[:tag][:id]`), so the body is nested.
|
|
26255
|
+
// Sending the tag flat fails: its own `tag` name field stops Rails from wrapping the params.
|
|
26256
|
+
return this.tagEntity.service.update(id, { id: id, tag: tag });
|
|
26194
26257
|
};
|
|
26195
26258
|
Tag.prototype.delete = function (id) {
|
|
26196
26259
|
return this.tagEntity.service.delete(id);
|
|
26197
26260
|
};
|
|
26261
|
+
Tag.prototype.createTagWithConfigurations = function (options) {
|
|
26262
|
+
return this.tagEntity.createWithConfigurations(options);
|
|
26263
|
+
};
|
|
26264
|
+
Tag.prototype.createTagConfiguration = function (tagId, type) {
|
|
26265
|
+
return this.tagEntity.createConfiguration(tagId, type);
|
|
26266
|
+
};
|
|
26267
|
+
Tag.prototype.deleteTagConfiguration = function (tagId, type) {
|
|
26268
|
+
return this.tagEntity.deleteConfiguration(tagId, type);
|
|
26269
|
+
};
|
|
26270
|
+
Tag.prototype.createTagCancelReasonsConfiguration = function (tagId) {
|
|
26271
|
+
return this.tagEntity.createCancelReasonsConfiguration(tagId);
|
|
26272
|
+
};
|
|
26273
|
+
Tag.prototype.deleteTagCancelReasonsConfiguration = function (tagId) {
|
|
26274
|
+
return this.tagEntity.deleteCancelReasonsConfiguration(tagId);
|
|
26275
|
+
};
|
|
26276
|
+
Tag.prototype.updateTagCancelReasons = function (tagId, tag) {
|
|
26277
|
+
return this.tagEntity.updateCancelReasons(tagId, tag);
|
|
26278
|
+
};
|
|
26279
|
+
Tag.prototype.uploadTagImage = function (tagId, field, imageFile) {
|
|
26280
|
+
return this.tagEntity.uploadImage(tagId, field, imageFile);
|
|
26281
|
+
};
|
|
26198
26282
|
return Tag;
|
|
26199
26283
|
}());
|
|
26200
26284
|
exports["default"] = Tag;
|