@antscorp/antsomi-ui 1.3.5-beta.102 → 1.3.5-beta.104

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.
@@ -36,6 +36,7 @@ export declare const useTemplateSave: (options: TemplateListingOptions) => {
36
36
  }>;
37
37
  }[];
38
38
  templateItems: {
39
+ [key: string]: any;
39
40
  id: string | number;
40
41
  label: string;
41
42
  thumbnail?: string | undefined;
@@ -68,11 +68,7 @@ export const useTemplateSave = (options) => {
68
68
  const templateItems = useMemo(() => {
69
69
  if (infiniteObjectTemplate) {
70
70
  const { pages } = infiniteObjectTemplate;
71
- return pages.flatMap(({ entities }) => entities.flatMap(({ id, name, thumbnail }) => ({
72
- id,
73
- label: name,
74
- thumbnail,
75
- })));
71
+ return pages.flatMap(({ entities }) => entities.flatMap(entity => (Object.assign(Object.assign({}, entity.toJson()), { label: entity.name }))));
76
72
  }
77
73
  return [];
78
74
  }, [infiniteObjectTemplate]);
@@ -17,14 +17,14 @@ export interface BannerProps {
17
17
  showSkeleton?: boolean;
18
18
  children?: React.ReactNode;
19
19
  }
20
- export type ThumbnailProps = Omit<ThumbnailCardProps, keyof TTemplateItem | 'onClickWrapper'> & {
20
+ export type ThumbnailProps = Omit<ThumbnailCardProps, 'id' | 'name' | 'thumbnail' | 'onClickWrapper'> & {
21
21
  thumbnails?: TThumbnail[];
22
22
  onClickThumbnail?: (value: TThumbnail) => void;
23
23
  };
24
24
  export interface SimilarTemplateProps {
25
25
  show?: boolean;
26
26
  similarTemplates?: TTemplateItem[];
27
- similarCardProps?: Omit<ThumbnailCardProps, keyof TTemplateItem>;
27
+ similarCardProps?: Omit<ThumbnailCardProps, 'id' | 'name' | 'thumbnail'>;
28
28
  }
29
29
  export interface InformationProps {
30
30
  deviceType: string;
@@ -150,11 +150,7 @@ export const useTemplateListing = (options) => {
150
150
  const templateItems = useMemo(() => {
151
151
  if (infiniteObjectTemplate) {
152
152
  const { pages } = infiniteObjectTemplate;
153
- return pages.flatMap(({ entities }) => entities.flatMap(({ id, name, thumbnail }) => ({
154
- id,
155
- name,
156
- thumbnail,
157
- })));
153
+ return pages.flatMap(({ entities }) => entities.flatMap(entity => entity.toJson()));
158
154
  }
159
155
  return [];
160
156
  }, [infiniteObjectTemplate]);
@@ -22,5 +22,6 @@ export interface TTemplateItem {
22
22
  id: TThumbnailCardId;
23
23
  name?: ThumbnailCardProps['name'];
24
24
  thumbnail?: ThumbnailCardProps['thumbnail'];
25
+ [key: string]: any;
25
26
  }
26
27
  export type TSelectTemplateAction = 'edit' | 'preview' | 'use';
@@ -55,4 +55,30 @@ export declare class ObjectTemplate extends Model<TObjectTemplate> {
55
55
  get goal(): number[] | undefined;
56
56
  get channel(): number | undefined;
57
57
  get shareAccess(): TShareAccess | undefined;
58
+ toJson(): {
59
+ id: string | number;
60
+ name: string;
61
+ type: number;
62
+ typeLabel: string;
63
+ description: string;
64
+ templateSettings: Record<string, any>;
65
+ settings: Record<string, any>;
66
+ status: string | TTemplateStatus;
67
+ userId: string | number;
68
+ createdAt: string | dayjs.Dayjs;
69
+ updatedAt: string | dayjs.Dayjs;
70
+ objectiveTypes: number[];
71
+ networkId: number | undefined;
72
+ thumbnail: string;
73
+ objectType: number | undefined;
74
+ config: Record<string, any> | undefined;
75
+ configObject: Record<string, any> | undefined;
76
+ seasonality: number[] | undefined;
77
+ industry: number[] | undefined;
78
+ lifecycleStage: number[] | undefined;
79
+ journeyType: number[] | undefined;
80
+ goal: number[] | undefined;
81
+ channel: number | undefined;
82
+ shareAccess: TShareAccess | undefined;
83
+ };
58
84
  }
@@ -82,4 +82,32 @@ export class ObjectTemplate extends Model {
82
82
  get shareAccess() {
83
83
  return this.model.share_access;
84
84
  }
85
+ toJson() {
86
+ return {
87
+ id: this.id,
88
+ name: this.name,
89
+ type: this.type,
90
+ typeLabel: this.typeLabel,
91
+ description: this.description,
92
+ templateSettings: this.templateSettings,
93
+ settings: this.settings,
94
+ status: this.status,
95
+ userId: this.userId,
96
+ createdAt: this.createdAt,
97
+ updatedAt: this.updatedAt,
98
+ objectiveTypes: this.objectiveTypes,
99
+ networkId: this.networkId,
100
+ thumbnail: this.thumbnail,
101
+ objectType: this.objectType,
102
+ config: this.config,
103
+ configObject: this.configObject,
104
+ seasonality: this.seasonality,
105
+ industry: this.industry,
106
+ lifecycleStage: this.lifecycleStage,
107
+ journeyType: this.journeyType,
108
+ goal: this.goal,
109
+ channel: this.channel,
110
+ shareAccess: this.shareAccess,
111
+ };
112
+ }
85
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.102",
3
+ "version": "1.3.5-beta.104",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",