@cakemail-org/ui-components-v2 2.1.27 → 2.1.29

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/cjs/index.js CHANGED
@@ -16698,11 +16698,18 @@ var ListCampaignModel = /** @class */ (function () {
16698
16698
  });
16699
16699
  });
16700
16700
  };
16701
- ListCampaignModel.prototype.update = function (_a) {
16702
- return __awaiter(this, arguments, void 0, function (_b) {
16701
+ ListCampaignModel.prototype.save = function () {
16702
+ return __awaiter(this, arguments, void 0, function (_a) {
16703
16703
  var _this = this;
16704
- var campaign = _b.campaign;
16704
+ var _b = _a === void 0 ? {} : _a, campaign = _b.campaign;
16705
16705
  return __generator(this, function (_c) {
16706
+ if (!this.id) {
16707
+ throw new Error("Campaign was not initialized");
16708
+ }
16709
+ if (!campaign) {
16710
+ campaign = this.toJson();
16711
+ campaign === null || campaign === void 0 ? true : delete campaign.sender;
16712
+ }
16706
16713
  return [2 /*return*/, updateCampaign({ campaign: campaign, id: this.id }).then(function (data) {
16707
16714
  trackEvent(exports.EEvents.CAMPAIGN_UPDATED, { id: _this.id });
16708
16715
  return new CampaignModel(data.data);
@@ -17212,13 +17219,14 @@ var CommonFormModel = /** @class */ (function () {
17212
17219
  });
17213
17220
  };
17214
17221
  CommonFormModel.prototype.save = function () {
17215
- return __awaiter(this, void 0, void 0, function () {
17222
+ return __awaiter(this, arguments, void 0, function (_a) {
17216
17223
  var _this = this;
17217
- return __generator(this, function (_a) {
17224
+ var _b = _a === void 0 ? {} : _a, form = _b.form;
17225
+ return __generator(this, function (_c) {
17218
17226
  if (!this.id) {
17219
17227
  throw new Error("Form was not initialized");
17220
17228
  }
17221
- return [2 /*return*/, patchForm({ id: this.id.toString(), data: this.toJson() }).then(function (data) {
17229
+ return [2 /*return*/, patchForm({ id: this.id.toString(), data: form || this.toJson() }).then(function (data) {
17222
17230
  trackEvent(exports.EEvents.FORM_UPDATED, { id: _this.id });
17223
17231
  return data.data;
17224
17232
  })];
@@ -25,8 +25,8 @@ export declare class ListCampaignModel {
25
25
  toJson(): any;
26
26
  set<T extends keyof this>(property: T, value: this[T]): void;
27
27
  delete(): Promise<TDeleteApiResource>;
28
- update({ campaign }: {
29
- campaign: Partial<TCampaignUpdate>;
28
+ save({ campaign }?: {
29
+ campaign?: Partial<TCampaignUpdate>;
30
30
  }): Promise<CampaignModel>;
31
31
  render({ contactId }: {
32
32
  contactId?: number;
@@ -14,7 +14,9 @@ export declare class CommonFormModel {
14
14
  toJson(): any;
15
15
  set<T extends keyof this>(property: T, value: this[T]): void;
16
16
  delete(): Promise<TDeleteApiResource>;
17
- save(): Promise<EnhancedFormModel>;
17
+ save({ form }?: {
18
+ form?: Partial<TEnhancedFormModel>;
19
+ }): Promise<EnhancedFormModel>;
18
20
  }
19
21
  export declare class FormModel extends CommonFormModel {
20
22
  readonly status: string;
package/dist/esm/index.js CHANGED
@@ -16678,11 +16678,18 @@ var ListCampaignModel = /** @class */ (function () {
16678
16678
  });
16679
16679
  });
16680
16680
  };
16681
- ListCampaignModel.prototype.update = function (_a) {
16682
- return __awaiter(this, arguments, void 0, function (_b) {
16681
+ ListCampaignModel.prototype.save = function () {
16682
+ return __awaiter(this, arguments, void 0, function (_a) {
16683
16683
  var _this = this;
16684
- var campaign = _b.campaign;
16684
+ var _b = _a === void 0 ? {} : _a, campaign = _b.campaign;
16685
16685
  return __generator(this, function (_c) {
16686
+ if (!this.id) {
16687
+ throw new Error("Campaign was not initialized");
16688
+ }
16689
+ if (!campaign) {
16690
+ campaign = this.toJson();
16691
+ campaign === null || campaign === void 0 ? true : delete campaign.sender;
16692
+ }
16686
16693
  return [2 /*return*/, updateCampaign({ campaign: campaign, id: this.id }).then(function (data) {
16687
16694
  trackEvent(EEvents.CAMPAIGN_UPDATED, { id: _this.id });
16688
16695
  return new CampaignModel(data.data);
@@ -17192,13 +17199,14 @@ var CommonFormModel = /** @class */ (function () {
17192
17199
  });
17193
17200
  };
17194
17201
  CommonFormModel.prototype.save = function () {
17195
- return __awaiter(this, void 0, void 0, function () {
17202
+ return __awaiter(this, arguments, void 0, function (_a) {
17196
17203
  var _this = this;
17197
- return __generator(this, function (_a) {
17204
+ var _b = _a === void 0 ? {} : _a, form = _b.form;
17205
+ return __generator(this, function (_c) {
17198
17206
  if (!this.id) {
17199
17207
  throw new Error("Form was not initialized");
17200
17208
  }
17201
- return [2 /*return*/, patchForm({ id: this.id.toString(), data: this.toJson() }).then(function (data) {
17209
+ return [2 /*return*/, patchForm({ id: this.id.toString(), data: form || this.toJson() }).then(function (data) {
17202
17210
  trackEvent(EEvents.FORM_UPDATED, { id: _this.id });
17203
17211
  return data.data;
17204
17212
  })];
@@ -25,8 +25,8 @@ export declare class ListCampaignModel {
25
25
  toJson(): any;
26
26
  set<T extends keyof this>(property: T, value: this[T]): void;
27
27
  delete(): Promise<TDeleteApiResource>;
28
- update({ campaign }: {
29
- campaign: Partial<TCampaignUpdate>;
28
+ save({ campaign }?: {
29
+ campaign?: Partial<TCampaignUpdate>;
30
30
  }): Promise<CampaignModel>;
31
31
  render({ contactId }: {
32
32
  contactId?: number;
@@ -14,7 +14,9 @@ export declare class CommonFormModel {
14
14
  toJson(): any;
15
15
  set<T extends keyof this>(property: T, value: this[T]): void;
16
16
  delete(): Promise<TDeleteApiResource>;
17
- save(): Promise<EnhancedFormModel>;
17
+ save({ form }?: {
18
+ form?: Partial<TEnhancedFormModel>;
19
+ }): Promise<EnhancedFormModel>;
18
20
  }
19
21
  export declare class FormModel extends CommonFormModel {
20
22
  readonly status: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cakemail-org/ui-components-v2",
3
- "version": "2.1.27",
3
+ "version": "2.1.29",
4
4
  "description": "ui library kit made with material UI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",