@maioradv/cms-basic-lib 1.6.3 → 1.6.5

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.
@@ -60,5 +60,7 @@ export declare enum Permission {
60
60
  read_settings = "read_settings",
61
61
  write_settings = "write_settings",
62
62
  read_bundles = "read_bundles",
63
- write_bundles = "write_bundles"
63
+ write_bundles = "write_bundles",
64
+ read_linkcollections = "read_linkcollections",
65
+ write_linkcollections = "write_linkcollections"
64
66
  }
@@ -39,4 +39,6 @@ var Permission;
39
39
  Permission["write_settings"] = "write_settings";
40
40
  Permission["read_bundles"] = "read_bundles";
41
41
  Permission["write_bundles"] = "write_bundles";
42
+ Permission["read_linkcollections"] = "read_linkcollections";
43
+ Permission["write_linkcollections"] = "write_linkcollections";
42
44
  })(Permission || (exports.Permission = Permission = {}));
package/dist/client.d.ts CHANGED
@@ -19,6 +19,8 @@ import ProductVariants from "./products/variants";
19
19
  import Settings from "./settings";
20
20
  import Bundles from "./bundles";
21
21
  import BundleVariants from "./bundles/variants";
22
+ import LinkCollections from "./linkCollections";
23
+ import Links from "./linkCollections/links";
22
24
  export declare class MaiorCmsApiClient implements ClientApiI {
23
25
  protected config: ApiConfigs;
24
26
  protected client: Axios;
@@ -41,6 +43,8 @@ export declare class MaiorCmsApiClient implements ClientApiI {
41
43
  settings: Settings;
42
44
  bundles: Bundles;
43
45
  bundleVariants: BundleVariants;
46
+ linkCollections: LinkCollections;
47
+ links: Links;
44
48
  constructor(config: ApiConfigs);
45
49
  protected _initClient(): Axios;
46
50
  protected _initModules(): void;
package/dist/client.js CHANGED
@@ -25,6 +25,8 @@ const variants_1 = __importDefault(require("./products/variants"));
25
25
  const settings_1 = __importDefault(require("./settings"));
26
26
  const bundles_1 = __importDefault(require("./bundles"));
27
27
  const variants_2 = __importDefault(require("./bundles/variants"));
28
+ const linkCollections_1 = __importDefault(require("./linkCollections"));
29
+ const links_1 = __importDefault(require("./linkCollections/links"));
28
30
  class MaiorCmsApiClient {
29
31
  constructor(config) {
30
32
  this.config = config;
@@ -58,6 +60,8 @@ class MaiorCmsApiClient {
58
60
  this.settings = new settings_1.default(this.client);
59
61
  this.bundles = new bundles_1.default(this.client);
60
62
  this.bundleVariants = new variants_2.default(this.client);
63
+ this.linkCollections = new linkCollections_1.default(this.client);
64
+ this.links = new links_1.default(this.client);
61
65
  }
62
66
  _setAccessToken(accessToken) {
63
67
  this.client.defaults.headers.common[types_1.ApiHeader.Authorization] = `Bearer ${accessToken}`;
@@ -43,7 +43,6 @@ exports.ConfigsResolvers = {
43
43
  allowGoogleAnalytics
44
44
  allowMetaPixel
45
45
  allowGoogleTagManager
46
- accountsApiToken
47
46
  allowAdvancedMenu
48
47
  allowDiscounts
49
48
  allowBundles
@@ -52,7 +51,6 @@ exports.ConfigsResolvers = {
52
51
  allowProductVideo
53
52
  allowCustomProductModal
54
53
  allowCustomTheme
55
- dashboardId
56
54
  maxMenuCollectionNumber
57
55
  maxProductImageNumber
58
56
  maxProductsCollectionNumber
@@ -2,7 +2,7 @@ import { PaginatedDto, PaginatedGQL } from "../core/dto/pagination";
2
2
  import { RemoveGQL } from "../core/model/remove-gql.response";
3
3
  import { RestApiModuleI, ApiModule, GraphApiModuleI } from "../model";
4
4
  import { QueryConfigGQLDto } from "./graphql";
5
- import { TiDelizioConfig, TiDelizioPlan } from "./services/ti-delizio.config";
5
+ import { TiDelizioConfig, TiDelizioPlan } from "./services/tidelizio.config";
6
6
  import { Config, CreateConfigDto, PutConfigDto, QueryConfigDto, UpdateConfigDto } from "./types";
7
7
  export default class Configs extends ApiModule implements RestApiModuleI, GraphApiModuleI {
8
8
  create(args: CreateConfigDto): Promise<Config>;
@@ -1,5 +1,3 @@
1
1
  export interface ServiceConfig {
2
- accountsApiToken?: string;
3
- dashboardId?: number;
4
2
  plan?: string;
5
3
  }
@@ -0,0 +1,25 @@
1
+ import { ServiceConfig } from "../model";
2
+ export declare enum TiDelizioPlan {
3
+ standard = "standard",
4
+ plus = "plus",
5
+ premium = "premium"
6
+ }
7
+ export interface TiDelizioConfig extends ServiceConfig {
8
+ allowGoogleAnalytics?: boolean;
9
+ allowMetaPixel?: boolean;
10
+ allowGoogleTagManager?: boolean;
11
+ allowAdvancedMenu?: boolean;
12
+ allowDiscounts?: boolean;
13
+ allowBundles?: boolean;
14
+ allowCustomProductModal?: boolean;
15
+ allowLocalization?: boolean;
16
+ allowProductVideo?: boolean;
17
+ allowPopup?: boolean;
18
+ allowCustomTheme?: boolean;
19
+ plan?: TiDelizioPlan;
20
+ qrLinkRedirect?: string;
21
+ maxMenuCollectionNumber?: number;
22
+ maxProductsCollectionNumber?: number;
23
+ maxProductImageNumber?: number;
24
+ maxAdditionalLanguages?: number;
25
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TiDelizioPlan = void 0;
4
+ var TiDelizioPlan;
5
+ (function (TiDelizioPlan) {
6
+ TiDelizioPlan["standard"] = "standard";
7
+ TiDelizioPlan["plus"] = "plus";
8
+ TiDelizioPlan["premium"] = "premium";
9
+ })(TiDelizioPlan || (exports.TiDelizioPlan = TiDelizioPlan = {}));
package/dist/index.d.ts CHANGED
@@ -17,7 +17,8 @@ export * from './products/types';
17
17
  export * from './roles/types';
18
18
  export * from './settings/types';
19
19
  export * from './bundles/types';
20
+ export * from './linkCollections/types';
20
21
  export * from './gid';
21
22
  export * from './core/dto/pagination';
22
- export { TiDelizioPlan, TiDelizioConfig } from './configs/services/ti-delizio.config';
23
+ export { TiDelizioPlan, TiDelizioConfig } from './configs/services/tidelizio.config';
23
24
  export declare function maiorCmsApiClient(opt: MaiorCmsApiConfigs): MaiorCmsApiClient;
package/dist/index.js CHANGED
@@ -33,10 +33,11 @@ __exportStar(require("./products/types"), exports);
33
33
  __exportStar(require("./roles/types"), exports);
34
34
  __exportStar(require("./settings/types"), exports);
35
35
  __exportStar(require("./bundles/types"), exports);
36
+ __exportStar(require("./linkCollections/types"), exports);
36
37
  __exportStar(require("./gid"), exports);
37
38
  __exportStar(require("./core/dto/pagination"), exports);
38
- var ti_delizio_config_1 = require("./configs/services/ti-delizio.config");
39
- Object.defineProperty(exports, "TiDelizioPlan", { enumerable: true, get: function () { return ti_delizio_config_1.TiDelizioPlan; } });
39
+ var tidelizio_config_1 = require("./configs/services/tidelizio.config");
40
+ Object.defineProperty(exports, "TiDelizioPlan", { enumerable: true, get: function () { return tidelizio_config_1.TiDelizioPlan; } });
40
41
  function maiorCmsApiClient(opt) {
41
42
  return new client_1.MaiorCmsApiClient(opt);
42
43
  }
@@ -0,0 +1,11 @@
1
+ import { PaginatedDto } from "../core/dto/pagination";
2
+ import { RestApiModuleI, ApiModule } from "../model";
3
+ import { CreateLinkCollectionDto, CreateLinkDto, FindOneLinkCollectionDto, Link, LinkCollection, QueryLinkCollectionDto, UpdateLinkCollectionDto } from "./types";
4
+ export default class LinkCollections extends ApiModule implements RestApiModuleI {
5
+ create(args: CreateLinkCollectionDto): Promise<LinkCollection>;
6
+ findAll(args?: QueryLinkCollectionDto): Promise<PaginatedDto<LinkCollection>>;
7
+ findOne(id: number): Promise<FindOneLinkCollectionDto>;
8
+ update(id: number, data: UpdateLinkCollectionDto): Promise<LinkCollection>;
9
+ remove(id: number): Promise<LinkCollection>;
10
+ createLink(linkCollectionId: number, args: CreateLinkDto): Promise<Link>;
11
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const queryParams_1 = require("../core/utils/queryParams");
4
+ const model_1 = require("../model");
5
+ class LinkCollections extends model_1.ApiModule {
6
+ create(args) {
7
+ return this._call('post', '/link-collections', args);
8
+ }
9
+ findAll(args = {}) {
10
+ return this._call('get', '/link-collections', (0, queryParams_1.queryParams)(args));
11
+ }
12
+ findOne(id) {
13
+ return this._call('get', `/link-collections/${id}`);
14
+ }
15
+ update(id, data) {
16
+ return this._call('patch', `/link-collections/${id}`, data);
17
+ }
18
+ remove(id) {
19
+ return this._call('delete', `/link-collections/${id}`);
20
+ }
21
+ createLink(linkCollectionId, args) {
22
+ return this._call('post', `/link-collections/${linkCollectionId}/links`, args);
23
+ }
24
+ }
25
+ exports.default = LinkCollections;
@@ -0,0 +1,13 @@
1
+ import { PaginatedDto } from "../core/dto/pagination";
2
+ import { ApiModule } from "../model";
3
+ import { CreateLinkImageDto, FindAllLinkDto, FindAllLinkImageDto, Link, LinkImage, QueryLinkDto, UpdateLinkDto, UpdateLinkImageDto } from "./types";
4
+ export default class Links extends ApiModule {
5
+ findAll(args?: QueryLinkDto): Promise<PaginatedDto<FindAllLinkDto>>;
6
+ update(id: number, data: UpdateLinkDto): Promise<Link>;
7
+ remove(id: number): Promise<Link>;
8
+ createImage(linkId: number, args: CreateLinkImageDto): Promise<LinkImage>;
9
+ RNCreateImage(linkId: number, formData: any): Promise<LinkImage>;
10
+ findAllImages(linkId: number): Promise<FindAllLinkImageDto>;
11
+ updateImage(linkId: number, imageId: number, data: UpdateLinkImageDto): Promise<LinkImage>;
12
+ removeImage(linkId: number, imageId: number): Promise<LinkImage>;
13
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const queryParams_1 = require("../core/utils/queryParams");
4
+ const model_1 = require("../model");
5
+ class Links extends model_1.ApiModule {
6
+ findAll(args = {}) {
7
+ return this._call('get', '/links', (0, queryParams_1.queryParams)(args));
8
+ }
9
+ update(id, data) {
10
+ return this._call('patch', `/links/${id}`, data);
11
+ }
12
+ remove(id) {
13
+ return this._call('delete', `/links/${id}`);
14
+ }
15
+ createImage(linkId, args) {
16
+ return this._call('post', `/links/${linkId}/images`, args, {
17
+ headers: {
18
+ 'Content-Type': 'multipart/form-data'
19
+ }
20
+ });
21
+ }
22
+ RNCreateImage(linkId, formData) {
23
+ return this._call('post', `/links/${linkId}/images`, formData, {
24
+ headers: {
25
+ 'Content-Type': 'multipart/form-data'
26
+ }
27
+ });
28
+ }
29
+ findAllImages(linkId) {
30
+ return this._call('get', `/links/${linkId}/images`);
31
+ }
32
+ updateImage(linkId, imageId, data) {
33
+ return this._call('patch', `/links/${linkId}/images/${imageId}`, data);
34
+ }
35
+ removeImage(linkId, imageId) {
36
+ return this._call('delete', `/links/${linkId}/images/${imageId}`);
37
+ }
38
+ }
39
+ exports.default = Links;
@@ -0,0 +1,75 @@
1
+ import { BooleanClause, NumberClause, StringClause, WhereClausesDto } from "../core/dto/clauses";
2
+ import { Sorting, SortingParamsDto } from "../core/dto/sorting";
3
+ import { QueryParamsDto } from "../core/utils/queryParams";
4
+ import { CreateImageDto, Image } from "../images/types";
5
+ import { Metafield, OmitRequire, Translation, WithRelation, WithRelations } from "../types";
6
+ export type LinkCollection = {
7
+ id: number;
8
+ title: string;
9
+ subtitle: string | null;
10
+ description: string | null;
11
+ translations: Translation[];
12
+ metafields: Metafield[];
13
+ published: boolean;
14
+ position: number | null;
15
+ createdAt: Date;
16
+ updatedAt: Date;
17
+ };
18
+ export type Link = {
19
+ id: number;
20
+ src: string;
21
+ title: string | null;
22
+ subtitle: string | null;
23
+ description: string | null;
24
+ translations: Translation[];
25
+ metafields: Metafield[];
26
+ published: boolean;
27
+ position: number | null;
28
+ linkCollectionId: number;
29
+ createdAt: Date;
30
+ updatedAt: Date;
31
+ };
32
+ export type LinkImage = {
33
+ linkId: number;
34
+ imageId: number;
35
+ locale: string | null;
36
+ position: number | null;
37
+ createdAt: Date;
38
+ updatedAt: Date;
39
+ };
40
+ export type CreateLinkDto = OmitRequire<Link, 'id' | 'createdAt' | 'updatedAt' | 'linkCollectionId', 'src'>;
41
+ export type CreateLinkCollectionDto = OmitRequire<LinkCollection, 'id' | 'createdAt' | 'updatedAt', 'title'> & {
42
+ links?: CreateLinkDto[];
43
+ };
44
+ export type UpdateLinkCollectionDto = Partial<Omit<CreateLinkCollectionDto, 'links'>>;
45
+ export type UpdateLinkDto = Partial<CreateLinkDto>;
46
+ export type SortingLinkCollectionDto = SortingParamsDto<{
47
+ title?: Sorting;
48
+ published?: Sorting;
49
+ position?: Sorting;
50
+ }>;
51
+ export type SortingLinkDto = SortingParamsDto<{
52
+ title?: Sorting;
53
+ published?: Sorting;
54
+ position?: Sorting;
55
+ }>;
56
+ export type ClausesLinkCollectionDto = WhereClausesDto<{
57
+ search?: StringClause;
58
+ published?: BooleanClause;
59
+ }>;
60
+ export type ClausesLinkDto = WhereClausesDto<{
61
+ search?: StringClause;
62
+ linkCollectionId?: NumberClause;
63
+ published?: BooleanClause;
64
+ }>;
65
+ export type QueryLinkCollectionDto = QueryParamsDto<SortingLinkCollectionDto, ClausesLinkCollectionDto>;
66
+ export type QueryLinkDto = QueryParamsDto<SortingLinkDto, ClausesLinkDto>;
67
+ export type FindOneLinkCollectionDto = WithRelations<LinkCollection, {
68
+ Link: Link[];
69
+ }>;
70
+ export type FindAllLinkDto = WithRelations<Link, {
71
+ LinkImage: WithRelation<LinkImage, 'Image', Image>[];
72
+ }>;
73
+ export type CreateLinkImageDto = OmitRequire<LinkImage, 'linkId' | 'createdAt' | 'updatedAt' | 'imageId'> & CreateImageDto;
74
+ export type UpdateLinkImageDto = Omit<CreateLinkImageDto, 'file'>;
75
+ export type FindAllLinkImageDto = WithRelation<LinkImage, 'Image', Image>[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maioradv/cms-basic-lib",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "JS lib for Maior CMS Basic Api",
5
5
  "repository": "https://github.com/maioradv/cms-basic-lib.git",
6
6
  "author": "Maior ADV Srl",