@cakemail-org/ui-components-v2 2.1.80 → 2.2.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.
@@ -9,7 +9,6 @@ export * from "./chip";
9
9
  export * from './circularProgress';
10
10
  export * from "./codeInput";
11
11
  export * from "./contentSectionContainer";
12
- export * from "./copyToClipboard";
13
12
  export * from "./dataTable";
14
13
  export * from "./datePicker";
15
14
  export * from "./dialog";
@@ -2,6 +2,9 @@ import { TGenericListParams, TGenericListReturn } from "../../types/services";
2
2
  import { TAutomationStats, TAutomationStatsParam } from "./types";
3
3
  import { AutomationModel } from "../../models/automation";
4
4
  export declare class AutomationsFactory {
5
+ static get({ id }: {
6
+ id: number;
7
+ }): Promise<AutomationModel>;
5
8
  static getAutomationStats({ ...options }: TAutomationStatsParam): Promise<TAutomationStats>;
6
9
  static list({ ...options }: TGenericListParams): Promise<TGenericListReturn<AutomationModel>>;
7
10
  static listWorkflows({ ...options }: TGenericListParams): Promise<TGenericListReturn<AutomationModel>>;
package/dist/cjs/index.js CHANGED
@@ -2703,6 +2703,33 @@ function deepMergeObject(source, target) {
2703
2703
  }
2704
2704
  return target;
2705
2705
  }
2706
+ function copyToClipboard(text) {
2707
+ if (navigator.clipboard && navigator.clipboard.writeText) {
2708
+ navigator.clipboard.writeText(text).catch(function (err) {
2709
+ fallbackCopyToClipboard(text);
2710
+ });
2711
+ }
2712
+ else {
2713
+ fallbackCopyToClipboard(text);
2714
+ }
2715
+ }
2716
+ function fallbackCopyToClipboard(text) {
2717
+ var textarea = document.createElement('textarea');
2718
+ textarea.value = text;
2719
+ textarea.style.position = 'fixed';
2720
+ textarea.style.top = '-1000px';
2721
+ textarea.style.left = '-1000px';
2722
+ textarea.style.opacity = '0';
2723
+ document.body.appendChild(textarea);
2724
+ textarea.select();
2725
+ try {
2726
+ document.execCommand('copy');
2727
+ }
2728
+ catch (err) {
2729
+ console.error('Failed to copy text');
2730
+ }
2731
+ document.body.removeChild(textarea);
2732
+ }
2706
2733
 
2707
2734
  function setBrandHeadElements(brand, locale) {
2708
2735
  var link = document.getElementById("favicon");
@@ -8474,23 +8501,6 @@ function CodeInput(_a) {
8474
8501
  React.createElement(OTPInput, { value: cValue, onChange: handleOnChange, onPaste: handleOnPaste, renderInput: function (props) { return React.createElement("input", __assign({}, props)); }, inputType: inputType, numInputs: numInputs, skipDefaultStyles: true, shouldAutoFocus: shouldAutoFocus, placeholder: placeholder, renderSeparator: renderSeparator }));
8475
8502
  }
8476
8503
 
8477
- var CopyToClipboard = React.forwardRef(function (props, ref) {
8478
- var textareaRef = React.useRef(null);
8479
- React.useImperativeHandle(ref, function () { return ({
8480
- // Expose the 'copy' function through the ref
8481
- copy: function (text) {
8482
- setTimeout(function () {
8483
- if (textareaRef.current) {
8484
- textareaRef.current.value = text;
8485
- textareaRef.current.select();
8486
- document.execCommand('copy');
8487
- }
8488
- }, 0);
8489
- },
8490
- }); });
8491
- return (React.createElement("textarea", { ref: textareaRef, style: { position: "fixed", top: "-1000px" } }));
8492
- });
8493
-
8494
8504
  function CustomPaginationActions(_a) {
8495
8505
  var count = _a.count, page = _a.page, rowsPerPage = _a.rowsPerPage, onPageChange = _a.onPageChange, showFirstButton = _a.showFirstButton, showLastButton = _a.showLastButton;
8496
8506
  var handleFirstPageButtonClick = function (event) {
@@ -9875,7 +9885,7 @@ function loginService(_a) {
9875
9885
  });
9876
9886
  }
9877
9887
 
9878
- function getAutomationStats(_a) {
9888
+ function getAllAutomationStats(_a) {
9879
9889
  var options = __rest(_a, []);
9880
9890
  return callApi({
9881
9891
  url: uiKitConfig.GATEWAY_PROXY + "/automations/generalStats/" + options.accountId,
@@ -9905,6 +9915,15 @@ function listWorkflows(_a) {
9905
9915
  }
9906
9916
  });
9907
9917
  }
9918
+ function getAutomation(_a) {
9919
+ var id = _a.id;
9920
+ return callApi({
9921
+ url: uiKitConfig.GATEWAY_PROXY + "/automations/".concat(id),
9922
+ fetchOptions: {
9923
+ method: exports.EMethods.get
9924
+ }
9925
+ });
9926
+ }
9908
9927
  function deleteAutomation(_a) {
9909
9928
  var id = _a.id;
9910
9929
  return callApi({
@@ -9934,37 +9953,54 @@ function updateAutomation(_a) {
9934
9953
  });
9935
9954
  }
9936
9955
  function deleteWorkflow(_a) {
9937
- var id = _a.id, options = __rest(_a, ["id"]);
9956
+ var id = _a.id;
9938
9957
  return callApi({
9939
9958
  url: uiKitConfig.GATEWAY_PROXY + "/workflows/".concat(id),
9940
- query: camelCase(options),
9941
9959
  fetchOptions: {
9942
9960
  method: exports.EMethods.delete
9943
9961
  }
9944
9962
  });
9945
9963
  }
9946
9964
  function updateWorkflow(_a) {
9947
- var id = _a.id, data = _a.data, options = __rest(_a, ["id", "data"]);
9965
+ var id = _a.id, data = _a.data;
9948
9966
  return callApi({
9949
9967
  url: uiKitConfig.GATEWAY_PROXY + "/workflows/".concat(id),
9950
- query: camelCase(options),
9951
9968
  fetchOptions: {
9952
9969
  method: exports.EMethods.patch,
9953
9970
  body: data
9954
9971
  }
9955
9972
  });
9956
9973
  }
9974
+ // implement
9975
+ function getAutomationStats(_a) {
9976
+ var id = _a.id, path = _a.path;
9977
+ return callApi({
9978
+ url: uiKitConfig.GATEWAY_PROXY + "/automations/".concat(id, "/steps/").concat(path, "/stats"),
9979
+ fetchOptions: {
9980
+ method: exports.EMethods.get
9981
+ }
9982
+ });
9983
+ }
9984
+ function getAutomationEmailContent(_a) {
9985
+ var contentId = _a.contentId;
9986
+ return callApi({
9987
+ url: uiKitConfig.GATEWAY_PROXY + "/content/".concat(contentId),
9988
+ fetchOptions: {
9989
+ method: exports.EMethods.get
9990
+ }
9991
+ });
9992
+ }
9957
9993
  function deleteAnyAutomation(_a) {
9958
- var id = _a.id, v1 = _a.v1, options = __rest(_a, ["id", "v1"]);
9994
+ var id = _a.id, v1 = _a.v1;
9959
9995
  if (v1) {
9960
- return deleteWorkflow(__assign({ id: id }, options));
9996
+ return deleteWorkflow({ id: id });
9961
9997
  }
9962
9998
  return deleteAutomation({ id: id });
9963
9999
  }
9964
10000
  function updateAnyAutomation(_a) {
9965
- var id = _a.id, data = _a.data, v1 = _a.v1, options = __rest(_a, ["id", "data", "v1"]);
10001
+ var id = _a.id, data = _a.data, v1 = _a.v1;
9966
10002
  if (v1) {
9967
- return updateWorkflow(__assign({ id: id, data: data }, options));
10003
+ return updateWorkflow({ id: id, data: data });
9968
10004
  }
9969
10005
  return updateAutomation({ id: id, data: data });
9970
10006
  }
@@ -17034,39 +17070,68 @@ var AutomationModel = /** @class */ (function () {
17034
17070
  AutomationModel.prototype.set = function (property, value) {
17035
17071
  modelSet(this, property, value);
17036
17072
  };
17037
- AutomationModel.prototype.save = function (automation, options) {
17073
+ AutomationModel.prototype.save = function (automation) {
17038
17074
  return __awaiter(this, void 0, void 0, function () {
17039
17075
  var dataToUpdate;
17040
17076
  return __generator(this, function (_a) {
17041
17077
  dataToUpdate = automation || this.toJson();
17042
- return [2 /*return*/, updateAnyAutomation(__assign({ id: this.id, data: dataToUpdate, v1: this.v1 }, options)).then(function (data) {
17078
+ return [2 /*return*/, updateAnyAutomation({ id: this.id, data: dataToUpdate, v1: this.v1 }).then(function (data) {
17043
17079
  trackEvent(exports.EEvents.AUTOMATION_UPDATED);
17044
17080
  return new AutomationModel(data.data);
17045
17081
  })];
17046
17082
  });
17047
17083
  });
17048
17084
  };
17049
- AutomationModel.prototype.delete = function (options) {
17085
+ AutomationModel.prototype.delete = function () {
17050
17086
  return __awaiter(this, void 0, void 0, function () {
17051
17087
  return __generator(this, function (_a) {
17052
- return [2 /*return*/, deleteAnyAutomation(__assign({ id: this.id, v1: this.v1 }, options)).then(function (data) {
17088
+ return [2 /*return*/, deleteAnyAutomation({ id: this.id, v1: this.v1 }).then(function (data) {
17053
17089
  trackEvent(exports.EEvents.AUTOMATION_DELETED);
17054
17090
  return data.data;
17055
17091
  })];
17056
17092
  });
17057
17093
  });
17058
17094
  };
17095
+ AutomationModel.prototype.getStats = function (_a) {
17096
+ return __awaiter(this, arguments, void 0, function (_b) {
17097
+ var path = _b.path;
17098
+ return __generator(this, function (_c) {
17099
+ return [2 /*return*/, getAutomationStats({ id: this.id, path: path }).then(function (data) {
17100
+ return data.data;
17101
+ })];
17102
+ });
17103
+ });
17104
+ };
17105
+ AutomationModel.getContent = function (contentId) {
17106
+ return __awaiter(this, void 0, void 0, function () {
17107
+ return __generator(this, function (_a) {
17108
+ return [2 /*return*/, getAutomationEmailContent({ contentId: contentId }).then(function (data) {
17109
+ return data.data;
17110
+ })];
17111
+ });
17112
+ });
17113
+ };
17059
17114
  return AutomationModel;
17060
17115
  }());
17061
17116
 
17062
17117
  var AutomationsFactory = /** @class */ (function () {
17063
17118
  function AutomationsFactory() {
17064
17119
  }
17120
+ AutomationsFactory.get = function (_a) {
17121
+ return __awaiter(this, arguments, void 0, function (_b) {
17122
+ var id = _b.id;
17123
+ return __generator(this, function (_c) {
17124
+ return [2 /*return*/, getAutomation({ id: id }).then(function (data) {
17125
+ return new AutomationModel(data.data);
17126
+ })];
17127
+ });
17128
+ });
17129
+ };
17065
17130
  AutomationsFactory.getAutomationStats = function (_a) {
17066
17131
  return __awaiter(this, void 0, void 0, function () {
17067
17132
  var options = __rest(_a, []);
17068
17133
  return __generator(this, function (_b) {
17069
- return [2 /*return*/, getAutomationStats(__assign({}, options))];
17134
+ return [2 /*return*/, getAllAutomationStats(__assign({}, options))];
17070
17135
  });
17071
17136
  });
17072
17137
  };
@@ -18868,7 +18933,6 @@ exports.CommonFormModel = CommonFormModel;
18868
18933
  exports.ContactModel = ContactModel;
18869
18934
  exports.ContactsFactory = ContactsFactory;
18870
18935
  exports.ContentSectionContainer = ContentSectionContainer;
18871
- exports.CopyToClipboard = CopyToClipboard;
18872
18936
  exports.CountryDropdown = CountryDropdown;
18873
18937
  exports.CustomerModel = CustomerModel;
18874
18938
  exports.DataTable = DataTable;
@@ -18968,6 +19032,7 @@ exports.cleanPostHogId = cleanPostHogId;
18968
19032
  exports.clearImpersonificationTree = clearImpersonificationTree;
18969
19033
  exports.clearStorage = clearStorage;
18970
19034
  exports.connectToZendeskSupportService = connectToZendeskSupportService;
19035
+ exports.copyToClipboard = copyToClipboard;
18971
19036
  exports.createAccount = createAccount;
18972
19037
  exports.createBrand = createBrand;
18973
19038
  exports.createCampaign = createCampaign;
@@ -19017,6 +19082,9 @@ exports.formatNumber = formatNumber;
19017
19082
  exports.getAccount = getAccount;
19018
19083
  exports.getAccountReport = getAccountReport;
19019
19084
  exports.getAdjustedBillingCycle = getAdjustedBillingCycle;
19085
+ exports.getAllAutomationStats = getAllAutomationStats;
19086
+ exports.getAutomation = getAutomation;
19087
+ exports.getAutomationEmailContent = getAutomationEmailContent;
19020
19088
  exports.getAutomationExecutionsCount = getAutomationExecutionsCount;
19021
19089
  exports.getAutomationStats = getAutomationStats;
19022
19090
  exports.getBeeTokenService = getBeeTokenService;
@@ -1,5 +1,6 @@
1
1
  import { TAutomation } from "../../factories/automations/types";
2
- import { TGenericListParams } from "../../types";
2
+ import { TAutomationEmailContent, TSingleAutomationStats } from "./types";
3
+ import { TDeleteApiResource } from "../../types";
3
4
  export declare class AutomationModel {
4
5
  readonly id: number;
5
6
  name: string;
@@ -45,7 +46,11 @@ export declare class AutomationModel {
45
46
  });
46
47
  toJson(): any;
47
48
  set<T extends keyof this>(property: T, value: this[T]): void;
48
- save(automation?: Partial<TAutomation>, options?: TGenericListParams): Promise<AutomationModel>;
49
- delete(options?: TGenericListParams): Promise<any>;
49
+ save(automation?: Partial<TAutomation>): Promise<AutomationModel>;
50
+ delete(): Promise<TDeleteApiResource>;
51
+ getStats({ path }: {
52
+ path: string;
53
+ }): Promise<TSingleAutomationStats>;
54
+ static getContent(contentId: string): Promise<TAutomationEmailContent>;
50
55
  }
51
56
  export * from "./types";
@@ -1 +1,22 @@
1
1
  export {};
2
+ export type TAutomationEmailContent = {
3
+ id: string;
4
+ thumbnail?: string;
5
+ created_on: number;
6
+ updated_on: number;
7
+ };
8
+ export type TAutomationStatsMetrics = {
9
+ open: number;
10
+ clickthru: number;
11
+ sent: number;
12
+ subscribe: number;
13
+ unsubscribe: number;
14
+ bounce: number;
15
+ soft_bounce: number;
16
+ hard_bounce: number;
17
+ spam: number;
18
+ };
19
+ export type TSingleAutomationStats = {
20
+ groupedByContact: TAutomationStatsMetrics;
21
+ totals: TAutomationStatsMetrics;
22
+ };
@@ -1,4 +1,5 @@
1
1
  export * from "./account";
2
+ export * from "./automation";
2
3
  export * from "./campaign";
3
4
  export * from "./contact";
4
5
  export * from "./customer";
@@ -11,4 +12,3 @@ export * from "./systemEmails";
11
12
  export * from "./tasks";
12
13
  export * from "./templates";
13
14
  export * from "./user";
14
- export * from "./automation";
@@ -1,8 +1,11 @@
1
1
  import { TAutomationStatsParam, TAutomation } from "../../factories/automations/types";
2
2
  import { TGenericListParams } from "../../types";
3
- export declare function getAutomationStats({ ...options }: TAutomationStatsParam): Promise<any>;
3
+ export declare function getAllAutomationStats({ ...options }: TAutomationStatsParam): Promise<any>;
4
4
  export declare function listAutomations({ ...options }: TGenericListParams): Promise<any>;
5
5
  export declare function listWorkflows({ ...options }: TGenericListParams): Promise<any>;
6
+ export declare function getAutomation({ id }: {
7
+ id: number;
8
+ }): Promise<any>;
6
9
  export declare function deleteAutomation({ id }: {
7
10
  id: number;
8
11
  }): Promise<any>;
@@ -13,19 +16,26 @@ export declare function updateAutomation({ id, data }: {
13
16
  id: number;
14
17
  data: Partial<TAutomation>;
15
18
  }): Promise<any>;
16
- export declare function deleteWorkflow({ id, ...options }: {
19
+ export declare function deleteWorkflow({ id }: {
17
20
  id: number;
18
- } & TGenericListParams): Promise<any>;
19
- export declare function updateWorkflow({ id, data, ...options }: {
21
+ }): Promise<any>;
22
+ export declare function updateWorkflow({ id, data }: {
20
23
  id: number;
21
24
  data: Partial<TAutomation>;
22
- } & TGenericListParams): Promise<any>;
23
- export declare function deleteAnyAutomation({ id, v1, ...options }: {
25
+ }): Promise<any>;
26
+ export declare function getAutomationStats({ id, path }: {
27
+ id: number;
28
+ path: string;
29
+ }): Promise<any>;
30
+ export declare function getAutomationEmailContent({ contentId }: {
31
+ contentId: string;
32
+ }): Promise<any>;
33
+ export declare function deleteAnyAutomation({ id, v1 }: {
24
34
  id: number;
25
35
  v1?: boolean;
26
- } & TGenericListParams): Promise<any>;
27
- export declare function updateAnyAutomation({ id, data, v1, ...options }: {
36
+ }): Promise<any>;
37
+ export declare function updateAnyAutomation({ id, data, v1 }: {
28
38
  id: number;
29
39
  data: Partial<TAutomation>;
30
40
  v1?: boolean;
31
- } & TGenericListParams): Promise<any>;
41
+ }): Promise<any>;
@@ -24,4 +24,5 @@ export declare function removeEmptyProperties(obj: any, treatStringHasEmtpy?: bo
24
24
  export declare function getNestedProperty(obj: any, path: string): any;
25
25
  export declare function findNestedProperty(obj: any, key: string): any | undefined;
26
26
  export declare function deepMergeObject(source: any, target: any): any;
27
+ export declare function copyToClipboard(text: string): void;
27
28
  export {};
@@ -9,7 +9,6 @@ export * from "./chip";
9
9
  export * from './circularProgress';
10
10
  export * from "./codeInput";
11
11
  export * from "./contentSectionContainer";
12
- export * from "./copyToClipboard";
13
12
  export * from "./dataTable";
14
13
  export * from "./datePicker";
15
14
  export * from "./dialog";
@@ -2,6 +2,9 @@ import { TGenericListParams, TGenericListReturn } from "../../types/services";
2
2
  import { TAutomationStats, TAutomationStatsParam } from "./types";
3
3
  import { AutomationModel } from "../../models/automation";
4
4
  export declare class AutomationsFactory {
5
+ static get({ id }: {
6
+ id: number;
7
+ }): Promise<AutomationModel>;
5
8
  static getAutomationStats({ ...options }: TAutomationStatsParam): Promise<TAutomationStats>;
6
9
  static list({ ...options }: TGenericListParams): Promise<TGenericListReturn<AutomationModel>>;
7
10
  static listWorkflows({ ...options }: TGenericListParams): Promise<TGenericListReturn<AutomationModel>>;
package/dist/esm/index.js CHANGED
@@ -2683,6 +2683,33 @@ function deepMergeObject(source, target) {
2683
2683
  }
2684
2684
  return target;
2685
2685
  }
2686
+ function copyToClipboard(text) {
2687
+ if (navigator.clipboard && navigator.clipboard.writeText) {
2688
+ navigator.clipboard.writeText(text).catch(function (err) {
2689
+ fallbackCopyToClipboard(text);
2690
+ });
2691
+ }
2692
+ else {
2693
+ fallbackCopyToClipboard(text);
2694
+ }
2695
+ }
2696
+ function fallbackCopyToClipboard(text) {
2697
+ var textarea = document.createElement('textarea');
2698
+ textarea.value = text;
2699
+ textarea.style.position = 'fixed';
2700
+ textarea.style.top = '-1000px';
2701
+ textarea.style.left = '-1000px';
2702
+ textarea.style.opacity = '0';
2703
+ document.body.appendChild(textarea);
2704
+ textarea.select();
2705
+ try {
2706
+ document.execCommand('copy');
2707
+ }
2708
+ catch (err) {
2709
+ console.error('Failed to copy text');
2710
+ }
2711
+ document.body.removeChild(textarea);
2712
+ }
2686
2713
 
2687
2714
  function setBrandHeadElements(brand, locale) {
2688
2715
  var link = document.getElementById("favicon");
@@ -8454,23 +8481,6 @@ function CodeInput(_a) {
8454
8481
  React__default.createElement(OTPInput, { value: cValue, onChange: handleOnChange, onPaste: handleOnPaste, renderInput: function (props) { return React__default.createElement("input", __assign({}, props)); }, inputType: inputType, numInputs: numInputs, skipDefaultStyles: true, shouldAutoFocus: shouldAutoFocus, placeholder: placeholder, renderSeparator: renderSeparator }));
8455
8482
  }
8456
8483
 
8457
- var CopyToClipboard = forwardRef(function (props, ref) {
8458
- var textareaRef = useRef(null);
8459
- useImperativeHandle(ref, function () { return ({
8460
- // Expose the 'copy' function through the ref
8461
- copy: function (text) {
8462
- setTimeout(function () {
8463
- if (textareaRef.current) {
8464
- textareaRef.current.value = text;
8465
- textareaRef.current.select();
8466
- document.execCommand('copy');
8467
- }
8468
- }, 0);
8469
- },
8470
- }); });
8471
- return (React__default.createElement("textarea", { ref: textareaRef, style: { position: "fixed", top: "-1000px" } }));
8472
- });
8473
-
8474
8484
  function CustomPaginationActions(_a) {
8475
8485
  var count = _a.count, page = _a.page, rowsPerPage = _a.rowsPerPage, onPageChange = _a.onPageChange, showFirstButton = _a.showFirstButton, showLastButton = _a.showLastButton;
8476
8486
  var handleFirstPageButtonClick = function (event) {
@@ -9855,7 +9865,7 @@ function loginService(_a) {
9855
9865
  });
9856
9866
  }
9857
9867
 
9858
- function getAutomationStats(_a) {
9868
+ function getAllAutomationStats(_a) {
9859
9869
  var options = __rest(_a, []);
9860
9870
  return callApi({
9861
9871
  url: uiKitConfig.GATEWAY_PROXY + "/automations/generalStats/" + options.accountId,
@@ -9885,6 +9895,15 @@ function listWorkflows(_a) {
9885
9895
  }
9886
9896
  });
9887
9897
  }
9898
+ function getAutomation(_a) {
9899
+ var id = _a.id;
9900
+ return callApi({
9901
+ url: uiKitConfig.GATEWAY_PROXY + "/automations/".concat(id),
9902
+ fetchOptions: {
9903
+ method: EMethods.get
9904
+ }
9905
+ });
9906
+ }
9888
9907
  function deleteAutomation(_a) {
9889
9908
  var id = _a.id;
9890
9909
  return callApi({
@@ -9914,37 +9933,54 @@ function updateAutomation(_a) {
9914
9933
  });
9915
9934
  }
9916
9935
  function deleteWorkflow(_a) {
9917
- var id = _a.id, options = __rest(_a, ["id"]);
9936
+ var id = _a.id;
9918
9937
  return callApi({
9919
9938
  url: uiKitConfig.GATEWAY_PROXY + "/workflows/".concat(id),
9920
- query: camelCase(options),
9921
9939
  fetchOptions: {
9922
9940
  method: EMethods.delete
9923
9941
  }
9924
9942
  });
9925
9943
  }
9926
9944
  function updateWorkflow(_a) {
9927
- var id = _a.id, data = _a.data, options = __rest(_a, ["id", "data"]);
9945
+ var id = _a.id, data = _a.data;
9928
9946
  return callApi({
9929
9947
  url: uiKitConfig.GATEWAY_PROXY + "/workflows/".concat(id),
9930
- query: camelCase(options),
9931
9948
  fetchOptions: {
9932
9949
  method: EMethods.patch,
9933
9950
  body: data
9934
9951
  }
9935
9952
  });
9936
9953
  }
9954
+ // implement
9955
+ function getAutomationStats(_a) {
9956
+ var id = _a.id, path = _a.path;
9957
+ return callApi({
9958
+ url: uiKitConfig.GATEWAY_PROXY + "/automations/".concat(id, "/steps/").concat(path, "/stats"),
9959
+ fetchOptions: {
9960
+ method: EMethods.get
9961
+ }
9962
+ });
9963
+ }
9964
+ function getAutomationEmailContent(_a) {
9965
+ var contentId = _a.contentId;
9966
+ return callApi({
9967
+ url: uiKitConfig.GATEWAY_PROXY + "/content/".concat(contentId),
9968
+ fetchOptions: {
9969
+ method: EMethods.get
9970
+ }
9971
+ });
9972
+ }
9937
9973
  function deleteAnyAutomation(_a) {
9938
- var id = _a.id, v1 = _a.v1, options = __rest(_a, ["id", "v1"]);
9974
+ var id = _a.id, v1 = _a.v1;
9939
9975
  if (v1) {
9940
- return deleteWorkflow(__assign({ id: id }, options));
9976
+ return deleteWorkflow({ id: id });
9941
9977
  }
9942
9978
  return deleteAutomation({ id: id });
9943
9979
  }
9944
9980
  function updateAnyAutomation(_a) {
9945
- var id = _a.id, data = _a.data, v1 = _a.v1, options = __rest(_a, ["id", "data", "v1"]);
9981
+ var id = _a.id, data = _a.data, v1 = _a.v1;
9946
9982
  if (v1) {
9947
- return updateWorkflow(__assign({ id: id, data: data }, options));
9983
+ return updateWorkflow({ id: id, data: data });
9948
9984
  }
9949
9985
  return updateAutomation({ id: id, data: data });
9950
9986
  }
@@ -17014,39 +17050,68 @@ var AutomationModel = /** @class */ (function () {
17014
17050
  AutomationModel.prototype.set = function (property, value) {
17015
17051
  modelSet(this, property, value);
17016
17052
  };
17017
- AutomationModel.prototype.save = function (automation, options) {
17053
+ AutomationModel.prototype.save = function (automation) {
17018
17054
  return __awaiter(this, void 0, void 0, function () {
17019
17055
  var dataToUpdate;
17020
17056
  return __generator(this, function (_a) {
17021
17057
  dataToUpdate = automation || this.toJson();
17022
- return [2 /*return*/, updateAnyAutomation(__assign({ id: this.id, data: dataToUpdate, v1: this.v1 }, options)).then(function (data) {
17058
+ return [2 /*return*/, updateAnyAutomation({ id: this.id, data: dataToUpdate, v1: this.v1 }).then(function (data) {
17023
17059
  trackEvent(EEvents.AUTOMATION_UPDATED);
17024
17060
  return new AutomationModel(data.data);
17025
17061
  })];
17026
17062
  });
17027
17063
  });
17028
17064
  };
17029
- AutomationModel.prototype.delete = function (options) {
17065
+ AutomationModel.prototype.delete = function () {
17030
17066
  return __awaiter(this, void 0, void 0, function () {
17031
17067
  return __generator(this, function (_a) {
17032
- return [2 /*return*/, deleteAnyAutomation(__assign({ id: this.id, v1: this.v1 }, options)).then(function (data) {
17068
+ return [2 /*return*/, deleteAnyAutomation({ id: this.id, v1: this.v1 }).then(function (data) {
17033
17069
  trackEvent(EEvents.AUTOMATION_DELETED);
17034
17070
  return data.data;
17035
17071
  })];
17036
17072
  });
17037
17073
  });
17038
17074
  };
17075
+ AutomationModel.prototype.getStats = function (_a) {
17076
+ return __awaiter(this, arguments, void 0, function (_b) {
17077
+ var path = _b.path;
17078
+ return __generator(this, function (_c) {
17079
+ return [2 /*return*/, getAutomationStats({ id: this.id, path: path }).then(function (data) {
17080
+ return data.data;
17081
+ })];
17082
+ });
17083
+ });
17084
+ };
17085
+ AutomationModel.getContent = function (contentId) {
17086
+ return __awaiter(this, void 0, void 0, function () {
17087
+ return __generator(this, function (_a) {
17088
+ return [2 /*return*/, getAutomationEmailContent({ contentId: contentId }).then(function (data) {
17089
+ return data.data;
17090
+ })];
17091
+ });
17092
+ });
17093
+ };
17039
17094
  return AutomationModel;
17040
17095
  }());
17041
17096
 
17042
17097
  var AutomationsFactory = /** @class */ (function () {
17043
17098
  function AutomationsFactory() {
17044
17099
  }
17100
+ AutomationsFactory.get = function (_a) {
17101
+ return __awaiter(this, arguments, void 0, function (_b) {
17102
+ var id = _b.id;
17103
+ return __generator(this, function (_c) {
17104
+ return [2 /*return*/, getAutomation({ id: id }).then(function (data) {
17105
+ return new AutomationModel(data.data);
17106
+ })];
17107
+ });
17108
+ });
17109
+ };
17045
17110
  AutomationsFactory.getAutomationStats = function (_a) {
17046
17111
  return __awaiter(this, void 0, void 0, function () {
17047
17112
  var options = __rest(_a, []);
17048
17113
  return __generator(this, function (_b) {
17049
- return [2 /*return*/, getAutomationStats(__assign({}, options))];
17114
+ return [2 /*return*/, getAllAutomationStats(__assign({}, options))];
17050
17115
  });
17051
17116
  });
17052
17117
  };
@@ -18823,4 +18888,4 @@ var UsersFactory = /** @class */ (function () {
18823
18888
  return UsersFactory;
18824
18889
  }());
18825
18890
 
18826
- export { AccountModel, AccountsFactory, ActionBarContainer, ActionBarContainerHandler, AssetManager, AutomationModel, AutomationsFactory, Avatar, BillingFactory, BrandWrapper, BrandsFactory, Button, ButtonMenu, CampaignModel, CampaignsFactory, Checkbox, Chip, CircularProgress, CodeInput, ColManager, ColorTextField, CommonFormModel, ContactModel, ContactsFactory, ContentSectionContainer, CopyToClipboard, CountryDropdown, CustomerModel, DataTable, DataTableHead, DataTableRow, DateCalendar, DatePicker, DateTimeCalendar, DateTimePicker, Dialog, DialogActions, DialogHandler, DialogTitle, Divider, Drawer, DrawerHandler, DropMenu, Dropdown, EApiLanguages, EAssetManagerMatchType, ECampaignStatuses, EEMailSummaryStatuses, EEditorType, EEmailAttachementTypes, EEmailLogType, EEmailLogTypeParam, EEmailProviders, EEmailSummaryEngagement, EEvents, EListAttributeType, EMethods, EOperatorTypes, EPartialInfoPool, EPopupBranding, EPopupBrowserType, EPopupCloseButtonPosition, EPopupDeviceType, EPopupDisplayFrequency, EPopupPosition, EPopupTriggerType, EStorageType, ETaskType, ElementContains, Email, EmailAPIFactory, EmptyContent, EnhancedFormModel, FileUpload, FilterBar, FormModel, FormsFactory, FullBar, GenericWrapper, GenericWrapperContext, GroupedActions, Header, Icon, IconPill, InformationGroup, InlineTextEdit, LinearProgress, Link, ListCampaignModel, ListModel, ListPopupModel, ListTemplateModel, ListsFactory, LoadingContainer, LocationTextField, Logo, MD5, MetricCard, Modal, ModalHandler, ModalHeading, OverlayHandler, PhoneTextField, PopupModel, PopupsFactory, Radio, ResourceEdit, Search, SenderModel, SendersFactory, SideMenu, SideMenuContainer, SideMenuItem, SubNav, SummaryEnhancedFormModel, SupportFactory, SuppressedEmailsFactory, SystemEmailsFactory, SystemEmailsModel, TagsFactory, TasksFactory, TemplateModel, TemplatesFactory, TextField, TimePicker, TimeSelector, Toggle, TopMenu, Typography, UserModel, UsersFactory, acceptListPolicy, addPartialInformation, addSuppressedEmail, addToImpersonificationTree, amIImpersonating, amILoggedInService, archiveCampaign, areAllPropertiesEmpty, buildMUITheme, callApi, camelCase, camelToSnakeCase, cancelCampaign, capitalizeFirstLetter, cleanPostHogId, clearImpersonificationTree, clearStorage, connectToZendeskSupportService, createAccount, createBrand, createCampaign, createCampaignLogsExports, createCampaignsReportsExport, createForm, createPopup, createSuppressedEmailExport, createTemplate, deepMergeObject, deleteAnyAutomation, deleteAutomation, deleteCampaign, deleteCampaignsReportsExport, deleteForm, deleteList, deletePartialInformation, deletePopup, deleteStorageItem, deleteSuppressedEmail, deleteTaskService, deleteTemplate, deleteUser, deleteWorkflow, descendingComparator, disableForm, disablePopup, downloadCampaignLogExport, downloadCampaignsReportsExport, downloadContactsExport, downloadListLogExport, downloadSuppressedEmailExport, emptyAccountAddress, emptyAccountLimits, enableForm, enablePopup, enrichBrand, enrichOrganization, enrichProfile, eventCondition, eventIdentify, eventLogout, fetchRetry, fetchRoute, findNestedProperty, formatNumber, getAccount, getAccountReport, getAdjustedBillingCycle, getAutomationExecutionsCount, getAutomationStats, getBeeTokenService, getBestLocalMatch, getBrand, getBrandService, getBrandUrl, getCalendarFormat, getCampaign, getCampaignLinks, getCampaignLinksReport, getCampaignLogs, getCampaignLogsExports, getCampaignReport, getCampaignRevisions, getCampaignsReportsExport, getComparator, getCustomerProfile, getDate, getDomainFromEmail, getDomainsFromEmails, getDomainsService, getEmail, getEmailActivitySummary, getEmailReport, getEndOfDate, getForm, getHashQueryWithoutHistory, getIconSize, getList, getListLogs, getListReport, getNestedProperty, getPopup, getPropertyValue, getSender, getStartOfDate, getStorage, getSuppressedEmailExport, getTColor, getTaskService, getTemplate, getUnixTime, getUrlQueryParam, getUser, getUtmCookies, googlePlacesMapper, hasDecimal, impersonateService, initFieldValidation, initPostHog, isColorLight, isDomainValidService, isSimpleType, isValidEmail, isValidString, isValidUrl, lisTEmailTags, listAccounts, listAutomations, listCampaigns, listCampaignsReportsExports, listContacts, listEmailLogs, listForms, listList, listListAttributes, listListInterests, listPopups, listSenders, listSuppressedEmails, listSystemEmails, listTasksService, listTemplates, listUsers, listWorkflows, logOutService, loginService, miliToSecond, modelSet, modelToJson, originalBrand, patchForm, popImpersonificationTree, postMessage, publishForm, publishPopup, reScheduleCampaign, removeEmptyProperties, removeQueryParams, removeTrailingChar, renderCampaign, renderForm, renderPopup, renderPublicHtmlForm, renderTemplate, requestSupportService, resendVerificationEmail, resumeCampaign, saveList, scheduleCampaign, searchCustomerProfiles, sendCampaignTest, setBrandHeadElements, setStorage, shareTemplate, splitArray, splitObject, stableSort, startPromisePool, suspendCampaign, trackEvent, truncateEmail, truncateText, uiKitConfig, unArchiveCampaign, unScheduleCampaign, unshareTemplate, updateAccount, updateAndClearUrlParams, updateAnyAutomation, updateAutomation, updateCampaign, updatePopup, updateSystemEmails, updateTemplate, updateUser, updateWorkflow, validateColor, validateEmail, validateGenericInput, validateUrl, wait, whiteLabelBrand, whoAmi };
18891
+ export { AccountModel, AccountsFactory, ActionBarContainer, ActionBarContainerHandler, AssetManager, AutomationModel, AutomationsFactory, Avatar, BillingFactory, BrandWrapper, BrandsFactory, Button, ButtonMenu, CampaignModel, CampaignsFactory, Checkbox, Chip, CircularProgress, CodeInput, ColManager, ColorTextField, CommonFormModel, ContactModel, ContactsFactory, ContentSectionContainer, CountryDropdown, CustomerModel, DataTable, DataTableHead, DataTableRow, DateCalendar, DatePicker, DateTimeCalendar, DateTimePicker, Dialog, DialogActions, DialogHandler, DialogTitle, Divider, Drawer, DrawerHandler, DropMenu, Dropdown, EApiLanguages, EAssetManagerMatchType, ECampaignStatuses, EEMailSummaryStatuses, EEditorType, EEmailAttachementTypes, EEmailLogType, EEmailLogTypeParam, EEmailProviders, EEmailSummaryEngagement, EEvents, EListAttributeType, EMethods, EOperatorTypes, EPartialInfoPool, EPopupBranding, EPopupBrowserType, EPopupCloseButtonPosition, EPopupDeviceType, EPopupDisplayFrequency, EPopupPosition, EPopupTriggerType, EStorageType, ETaskType, ElementContains, Email, EmailAPIFactory, EmptyContent, EnhancedFormModel, FileUpload, FilterBar, FormModel, FormsFactory, FullBar, GenericWrapper, GenericWrapperContext, GroupedActions, Header, Icon, IconPill, InformationGroup, InlineTextEdit, LinearProgress, Link, ListCampaignModel, ListModel, ListPopupModel, ListTemplateModel, ListsFactory, LoadingContainer, LocationTextField, Logo, MD5, MetricCard, Modal, ModalHandler, ModalHeading, OverlayHandler, PhoneTextField, PopupModel, PopupsFactory, Radio, ResourceEdit, Search, SenderModel, SendersFactory, SideMenu, SideMenuContainer, SideMenuItem, SubNav, SummaryEnhancedFormModel, SupportFactory, SuppressedEmailsFactory, SystemEmailsFactory, SystemEmailsModel, TagsFactory, TasksFactory, TemplateModel, TemplatesFactory, TextField, TimePicker, TimeSelector, Toggle, TopMenu, Typography, UserModel, UsersFactory, acceptListPolicy, addPartialInformation, addSuppressedEmail, addToImpersonificationTree, amIImpersonating, amILoggedInService, archiveCampaign, areAllPropertiesEmpty, buildMUITheme, callApi, camelCase, camelToSnakeCase, cancelCampaign, capitalizeFirstLetter, cleanPostHogId, clearImpersonificationTree, clearStorage, connectToZendeskSupportService, copyToClipboard, createAccount, createBrand, createCampaign, createCampaignLogsExports, createCampaignsReportsExport, createForm, createPopup, createSuppressedEmailExport, createTemplate, deepMergeObject, deleteAnyAutomation, deleteAutomation, deleteCampaign, deleteCampaignsReportsExport, deleteForm, deleteList, deletePartialInformation, deletePopup, deleteStorageItem, deleteSuppressedEmail, deleteTaskService, deleteTemplate, deleteUser, deleteWorkflow, descendingComparator, disableForm, disablePopup, downloadCampaignLogExport, downloadCampaignsReportsExport, downloadContactsExport, downloadListLogExport, downloadSuppressedEmailExport, emptyAccountAddress, emptyAccountLimits, enableForm, enablePopup, enrichBrand, enrichOrganization, enrichProfile, eventCondition, eventIdentify, eventLogout, fetchRetry, fetchRoute, findNestedProperty, formatNumber, getAccount, getAccountReport, getAdjustedBillingCycle, getAllAutomationStats, getAutomation, getAutomationEmailContent, getAutomationExecutionsCount, getAutomationStats, getBeeTokenService, getBestLocalMatch, getBrand, getBrandService, getBrandUrl, getCalendarFormat, getCampaign, getCampaignLinks, getCampaignLinksReport, getCampaignLogs, getCampaignLogsExports, getCampaignReport, getCampaignRevisions, getCampaignsReportsExport, getComparator, getCustomerProfile, getDate, getDomainFromEmail, getDomainsFromEmails, getDomainsService, getEmail, getEmailActivitySummary, getEmailReport, getEndOfDate, getForm, getHashQueryWithoutHistory, getIconSize, getList, getListLogs, getListReport, getNestedProperty, getPopup, getPropertyValue, getSender, getStartOfDate, getStorage, getSuppressedEmailExport, getTColor, getTaskService, getTemplate, getUnixTime, getUrlQueryParam, getUser, getUtmCookies, googlePlacesMapper, hasDecimal, impersonateService, initFieldValidation, initPostHog, isColorLight, isDomainValidService, isSimpleType, isValidEmail, isValidString, isValidUrl, lisTEmailTags, listAccounts, listAutomations, listCampaigns, listCampaignsReportsExports, listContacts, listEmailLogs, listForms, listList, listListAttributes, listListInterests, listPopups, listSenders, listSuppressedEmails, listSystemEmails, listTasksService, listTemplates, listUsers, listWorkflows, logOutService, loginService, miliToSecond, modelSet, modelToJson, originalBrand, patchForm, popImpersonificationTree, postMessage, publishForm, publishPopup, reScheduleCampaign, removeEmptyProperties, removeQueryParams, removeTrailingChar, renderCampaign, renderForm, renderPopup, renderPublicHtmlForm, renderTemplate, requestSupportService, resendVerificationEmail, resumeCampaign, saveList, scheduleCampaign, searchCustomerProfiles, sendCampaignTest, setBrandHeadElements, setStorage, shareTemplate, splitArray, splitObject, stableSort, startPromisePool, suspendCampaign, trackEvent, truncateEmail, truncateText, uiKitConfig, unArchiveCampaign, unScheduleCampaign, unshareTemplate, updateAccount, updateAndClearUrlParams, updateAnyAutomation, updateAutomation, updateCampaign, updatePopup, updateSystemEmails, updateTemplate, updateUser, updateWorkflow, validateColor, validateEmail, validateGenericInput, validateUrl, wait, whiteLabelBrand, whoAmi };
@@ -1,5 +1,6 @@
1
1
  import { TAutomation } from "../../factories/automations/types";
2
- import { TGenericListParams } from "../../types";
2
+ import { TAutomationEmailContent, TSingleAutomationStats } from "./types";
3
+ import { TDeleteApiResource } from "../../types";
3
4
  export declare class AutomationModel {
4
5
  readonly id: number;
5
6
  name: string;
@@ -45,7 +46,11 @@ export declare class AutomationModel {
45
46
  });
46
47
  toJson(): any;
47
48
  set<T extends keyof this>(property: T, value: this[T]): void;
48
- save(automation?: Partial<TAutomation>, options?: TGenericListParams): Promise<AutomationModel>;
49
- delete(options?: TGenericListParams): Promise<any>;
49
+ save(automation?: Partial<TAutomation>): Promise<AutomationModel>;
50
+ delete(): Promise<TDeleteApiResource>;
51
+ getStats({ path }: {
52
+ path: string;
53
+ }): Promise<TSingleAutomationStats>;
54
+ static getContent(contentId: string): Promise<TAutomationEmailContent>;
50
55
  }
51
56
  export * from "./types";
@@ -1 +1,22 @@
1
1
  export {};
2
+ export type TAutomationEmailContent = {
3
+ id: string;
4
+ thumbnail?: string;
5
+ created_on: number;
6
+ updated_on: number;
7
+ };
8
+ export type TAutomationStatsMetrics = {
9
+ open: number;
10
+ clickthru: number;
11
+ sent: number;
12
+ subscribe: number;
13
+ unsubscribe: number;
14
+ bounce: number;
15
+ soft_bounce: number;
16
+ hard_bounce: number;
17
+ spam: number;
18
+ };
19
+ export type TSingleAutomationStats = {
20
+ groupedByContact: TAutomationStatsMetrics;
21
+ totals: TAutomationStatsMetrics;
22
+ };
@@ -1,4 +1,5 @@
1
1
  export * from "./account";
2
+ export * from "./automation";
2
3
  export * from "./campaign";
3
4
  export * from "./contact";
4
5
  export * from "./customer";
@@ -11,4 +12,3 @@ export * from "./systemEmails";
11
12
  export * from "./tasks";
12
13
  export * from "./templates";
13
14
  export * from "./user";
14
- export * from "./automation";
@@ -1,8 +1,11 @@
1
1
  import { TAutomationStatsParam, TAutomation } from "../../factories/automations/types";
2
2
  import { TGenericListParams } from "../../types";
3
- export declare function getAutomationStats({ ...options }: TAutomationStatsParam): Promise<any>;
3
+ export declare function getAllAutomationStats({ ...options }: TAutomationStatsParam): Promise<any>;
4
4
  export declare function listAutomations({ ...options }: TGenericListParams): Promise<any>;
5
5
  export declare function listWorkflows({ ...options }: TGenericListParams): Promise<any>;
6
+ export declare function getAutomation({ id }: {
7
+ id: number;
8
+ }): Promise<any>;
6
9
  export declare function deleteAutomation({ id }: {
7
10
  id: number;
8
11
  }): Promise<any>;
@@ -13,19 +16,26 @@ export declare function updateAutomation({ id, data }: {
13
16
  id: number;
14
17
  data: Partial<TAutomation>;
15
18
  }): Promise<any>;
16
- export declare function deleteWorkflow({ id, ...options }: {
19
+ export declare function deleteWorkflow({ id }: {
17
20
  id: number;
18
- } & TGenericListParams): Promise<any>;
19
- export declare function updateWorkflow({ id, data, ...options }: {
21
+ }): Promise<any>;
22
+ export declare function updateWorkflow({ id, data }: {
20
23
  id: number;
21
24
  data: Partial<TAutomation>;
22
- } & TGenericListParams): Promise<any>;
23
- export declare function deleteAnyAutomation({ id, v1, ...options }: {
25
+ }): Promise<any>;
26
+ export declare function getAutomationStats({ id, path }: {
27
+ id: number;
28
+ path: string;
29
+ }): Promise<any>;
30
+ export declare function getAutomationEmailContent({ contentId }: {
31
+ contentId: string;
32
+ }): Promise<any>;
33
+ export declare function deleteAnyAutomation({ id, v1 }: {
24
34
  id: number;
25
35
  v1?: boolean;
26
- } & TGenericListParams): Promise<any>;
27
- export declare function updateAnyAutomation({ id, data, v1, ...options }: {
36
+ }): Promise<any>;
37
+ export declare function updateAnyAutomation({ id, data, v1 }: {
28
38
  id: number;
29
39
  data: Partial<TAutomation>;
30
40
  v1?: boolean;
31
- } & TGenericListParams): Promise<any>;
41
+ }): Promise<any>;
@@ -24,4 +24,5 @@ export declare function removeEmptyProperties(obj: any, treatStringHasEmtpy?: bo
24
24
  export declare function getNestedProperty(obj: any, path: string): any;
25
25
  export declare function findNestedProperty(obj: any, key: string): any | undefined;
26
26
  export declare function deepMergeObject(source: any, target: any): any;
27
+ export declare function copyToClipboard(text: string): void;
27
28
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cakemail-org/ui-components-v2",
3
- "version": "2.1.80",
3
+ "version": "2.2.1",
4
4
  "description": "ui library kit made with material UI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -14,7 +14,7 @@
14
14
  "dev": "rollup -c --bundleConfigAsCjs --watch",
15
15
  "test": "jest",
16
16
  "storybook": "storybook dev -p 6006",
17
- "build-storybook": "storybook build"
17
+ "build-storybook": "storybook buloadingild"
18
18
  },
19
19
  "author": "",
20
20
  "license": "ISC",
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- import { TCopyToClipboard } from "./types";
3
- export declare const CopyToClipboard: React.ForwardRefExoticComponent<React.RefAttributes<TCopyToClipboard | undefined>>;
4
- export default CopyToClipboard;
5
- export * from "./types";
@@ -1,4 +0,0 @@
1
- export type TCopyToClipboard = {
2
- copy: TCopyToClipboardFunction;
3
- };
4
- export type TCopyToClipboardFunction = (text: string) => void;
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- import { TCopyToClipboard } from "./types";
3
- export declare const CopyToClipboard: React.ForwardRefExoticComponent<React.RefAttributes<TCopyToClipboard | undefined>>;
4
- export default CopyToClipboard;
5
- export * from "./types";
@@ -1,4 +0,0 @@
1
- export type TCopyToClipboard = {
2
- copy: TCopyToClipboardFunction;
3
- };
4
- export type TCopyToClipboardFunction = (text: string) => void;