@cakemail-org/ui-components-v2 2.0.98 → 2.1.0

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.
@@ -8,5 +8,9 @@ export declare class FormsFactory {
8
8
  static create({ form }: {
9
9
  form: Partial<TEnhancedFormModel>;
10
10
  }): Promise<EnhancedFormModel>;
11
+ static renderPublic({ id, token }: {
12
+ id: string;
13
+ token: string;
14
+ }): Promise<string>;
11
15
  }
12
16
  export * from "./types";
package/dist/cjs/index.js CHANGED
@@ -2746,11 +2746,15 @@ function ElementContains(element, target) {
2746
2746
  }
2747
2747
  return false;
2748
2748
  }
2749
- function modelToJson(model) {
2749
+ function modelToJson(model, exclude) {
2750
+ if (exclude === void 0) { exclude = []; }
2750
2751
  var obj = {};
2751
2752
  Object.keys(model).forEach(function (key) {
2752
2753
  var _a;
2753
2754
  var value = model[key];
2755
+ if (exclude.includes(key)) {
2756
+ return;
2757
+ }
2754
2758
  if (value != null && typeof value === "object") {
2755
2759
  if (((_a = Object.keys(value)) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2756
2760
  obj[key] = value;
@@ -9497,17 +9501,33 @@ var AccountModel = /** @class */ (function () {
9497
9501
  this.overrides = params.overrides || {};
9498
9502
  this.stripe_customer_id = params.stripe_customer_id || "";
9499
9503
  this.metadata = params.metadata || {};
9504
+ if (params.isMainAccount) {
9505
+ this.getUsageReport();
9506
+ }
9500
9507
  }
9501
9508
  AccountModel.prototype.toJson = function () {
9502
- return modelToJson(this);
9509
+ return modelToJson(this, ["usage"]);
9503
9510
  };
9504
9511
  AccountModel.prototype.set = function (property, value) {
9505
9512
  modelSet(this, property, value);
9506
9513
  };
9514
+ AccountModel.prototype.getUsageReport = function () {
9515
+ return __awaiter(this, void 0, void 0, function () {
9516
+ var _this = this;
9517
+ return __generator(this, function (_a) {
9518
+ return [2 /*return*/, this.getReport({}).then(function (report) {
9519
+ _this.usage = report;
9520
+ })];
9521
+ });
9522
+ });
9523
+ };
9507
9524
  AccountModel.prototype.getReport = function (_a) {
9508
9525
  return __awaiter(this, void 0, void 0, function () {
9509
9526
  var options = __rest(_a, []);
9510
9527
  return __generator(this, function (_b) {
9528
+ if (!this.id) {
9529
+ throw new Error("Account was not initialized");
9530
+ }
9511
9531
  return [2 /*return*/, getAccountReport(__assign(__assign({}, options), { accountId: this.id })).then(function (result) {
9512
9532
  return result.data;
9513
9533
  })];
@@ -9518,6 +9538,9 @@ var AccountModel = /** @class */ (function () {
9518
9538
  return __awaiter(this, arguments, void 0, function (byContext) {
9519
9539
  if (byContext === void 0) { byContext = true; }
9520
9540
  return __generator(this, function (_a) {
9541
+ if (!this.id) {
9542
+ throw new Error("Account was not initialized");
9543
+ }
9521
9544
  return [2 /*return*/, impersonateService({ id: this.id, byContext: byContext })];
9522
9545
  });
9523
9546
  });
@@ -9525,6 +9548,9 @@ var AccountModel = /** @class */ (function () {
9525
9548
  AccountModel.prototype.getDomains = function () {
9526
9549
  return __awaiter(this, void 0, void 0, function () {
9527
9550
  return __generator(this, function (_a) {
9551
+ if (!this.id) {
9552
+ throw new Error("Account was not initialized");
9553
+ }
9528
9554
  return [2 /*return*/, getDomainsService({ id: this.id }).then(function (data) { return data.data; })];
9529
9555
  });
9530
9556
  });
@@ -9532,6 +9558,9 @@ var AccountModel = /** @class */ (function () {
9532
9558
  AccountModel.prototype.getCustomer = function () {
9533
9559
  return __awaiter(this, void 0, void 0, function () {
9534
9560
  return __generator(this, function (_a) {
9561
+ if (!this.id) {
9562
+ throw new Error("Account was not initialized");
9563
+ }
9535
9564
  return [2 /*return*/, BillingFactory.get({ id: this.id })];
9536
9565
  });
9537
9566
  });
@@ -9539,6 +9568,9 @@ var AccountModel = /** @class */ (function () {
9539
9568
  AccountModel.prototype.update = function (account) {
9540
9569
  return __awaiter(this, void 0, void 0, function () {
9541
9570
  return __generator(this, function (_a) {
9571
+ if (!this.id) {
9572
+ throw new Error("Account was not initialized");
9573
+ }
9542
9574
  trackEvent(exports.EEvents.ACCOUNT_UPDATED, {
9543
9575
  id: account === null || account === void 0 ? void 0 : account.id,
9544
9576
  address: account === null || account === void 0 ? void 0 : account.address,
@@ -9568,45 +9600,57 @@ var AccountModel = /** @class */ (function () {
9568
9600
  AccountModel.prototype.isPartnerOrOrganization = function () {
9569
9601
  return this.partner || this.organization;
9570
9602
  };
9571
- AccountModel.prototype.hasAccessTo = function (feature, resellerBrand) {
9572
- var featureValue = this.usage_limits[feature];
9573
- if (featureValue === undefined) {
9574
- return false;
9575
- }
9576
- var brandDisabledLimitsFeatures = getNestedProperty(resellerBrand, "config.disabledLimitsFeatures") || [];
9577
- if (brandDisabledLimitsFeatures.includes(feature))
9578
- return true;
9579
- if (typeof featureValue === "boolean" || Number.isNaN(featureValue)) {
9580
- //Some feature flags are inverted
9581
- if (feature === "insert_reseller_logo") {
9582
- return !featureValue;
9583
- }
9584
- else {
9585
- return Boolean(featureValue);
9586
- }
9587
- }
9588
- else {
9589
- return true;
9590
- //return clientLimits[feature] < featureValue
9591
- }
9592
- // TODO have a way to tag the account as primary,
9593
- // This would fetch the account reports and user count and keep track of it
9594
- /*
9595
- currently for these info
9596
- per_campaign: number,
9597
- per_month: number,
9598
- maximum_contacts: number,
9599
- lists: number,
9600
- users: number,
9601
- /*
9602
- Old code:
9603
- if(isNaN(featureValue)) {
9604
- //code above
9605
- } else {
9606
- return clientLimits[feature] < featureValue
9607
- }
9608
-
9609
- */
9603
+ AccountModel.prototype.hasAccessTo = function (_a) {
9604
+ return __awaiter(this, arguments, void 0, function (_b) {
9605
+ var featureValue, brandDisabledLimitsFeatures;
9606
+ var feature = _b.feature, resellerBrand = _b.resellerBrand, userCount = _b.userCount;
9607
+ return __generator(this, function (_c) {
9608
+ switch (_c.label) {
9609
+ case 0:
9610
+ featureValue = this.usage_limits[feature];
9611
+ if (featureValue === undefined) {
9612
+ return [2 /*return*/, false];
9613
+ }
9614
+ brandDisabledLimitsFeatures = getNestedProperty(resellerBrand, "config.disabledLimitsFeatures") || [];
9615
+ if (brandDisabledLimitsFeatures.includes(feature))
9616
+ return [2 /*return*/, true];
9617
+ if (!(typeof featureValue === "boolean" || Number.isNaN(featureValue))) return [3 /*break*/, 1];
9618
+ //Some feature flags are inverted
9619
+ if (feature === "insert_reseller_logo") {
9620
+ return [2 /*return*/, !featureValue];
9621
+ }
9622
+ else {
9623
+ return [2 /*return*/, Boolean(featureValue)];
9624
+ }
9625
+ case 1:
9626
+ if (!!this.usage) return [3 /*break*/, 3];
9627
+ return [4 /*yield*/, this.getUsageReport()];
9628
+ case 2:
9629
+ _c.sent();
9630
+ _c.label = 3;
9631
+ case 3:
9632
+ if (this.usage) {
9633
+ if (feature === "lists") {
9634
+ return [2 /*return*/, this.usage.current_lists <= featureValue];
9635
+ }
9636
+ else if (feature === "users" && userCount !== undefined) {
9637
+ return [2 /*return*/, userCount <= featureValue];
9638
+ }
9639
+ else if (feature === "per_month") {
9640
+ return [2 /*return*/, this.usage.emails_usage <= 100];
9641
+ }
9642
+ else if (feature === "maximum_contacts") {
9643
+ return [2 /*return*/, this.usage.active_contacts <= featureValue];
9644
+ }
9645
+ throw new Error("Requested Feature does not exist in account usage");
9646
+ }
9647
+ else {
9648
+ return [2 /*return*/, true];
9649
+ }
9650
+ case 4: return [2 /*return*/];
9651
+ }
9652
+ });
9653
+ });
9610
9654
  };
9611
9655
  return AccountModel;
9612
9656
  }());
@@ -10174,6 +10218,15 @@ function renderForm(_a) {
10174
10218
  }
10175
10219
  });
10176
10220
  }
10221
+ function renderPublicHtmlForm(_a) {
10222
+ var id = _a.id, token = _a.token;
10223
+ return callApi({
10224
+ url: uiKitConfig.GATEWAY_PROXY + "/forms/" + id + "/render-html?token=" + token,
10225
+ fetchOptions: {
10226
+ method: exports.EMethods.get
10227
+ }
10228
+ });
10229
+ }
10177
10230
 
10178
10231
  exports.EEditorType = void 0;
10179
10232
  (function (EEditorType) {
@@ -17098,28 +17151,38 @@ var FormModel = /** @class */ (function (_super) {
17098
17151
  var SummaryEnhancedFormModel = /** @class */ (function (_super) {
17099
17152
  __extends(SummaryEnhancedFormModel, _super);
17100
17153
  function SummaryEnhancedFormModel(_a) {
17101
- var id = _a.id, list_id = _a.list_id, enabled = _a.enabled, name = _a.name, description = _a.description, tags = _a.tags, post_redirect_url = _a.post_redirect_url, double_opt_in = _a.double_opt_in, double_opt_in_redirect_url = _a.double_opt_in_redirect_url, submission_url = _a.submission_url, async_processing = _a.async_processing, branding = _a.branding, created_on = _a.created_on, updated_on = _a.updated_on, published_on = _a.published_on, edited_by = _a.edited_by, thumbnail_url = _a.thumbnail_url, recaptcha = _a.recaptcha;
17102
- var _this = _super.call(this, { id: id, name: name, list_id: list_id, double_opt_in: double_opt_in }) || this;
17103
- _this.enabled = enabled;
17104
- _this.description = description;
17105
- _this.tags = tags;
17106
- _this.post_redirect_url = post_redirect_url;
17107
- _this.double_opt_in_redirect_url = double_opt_in_redirect_url;
17108
- _this.submission_url = submission_url;
17109
- _this.async_processing = async_processing;
17110
- _this.branding = branding;
17111
- _this.created_on = created_on;
17112
- _this.updated_on = updated_on;
17113
- _this.published_on = published_on;
17114
- _this.edited_by = edited_by;
17115
- _this.thumbnail_url = thumbnail_url;
17116
- _this.recaptcha = recaptcha;
17154
+ var id = _a.id, list_id = _a.list_id, enabled = _a.enabled, name = _a.name, description = _a.description, tags = _a.tags, post_redirect_url = _a.post_redirect_url, double_opt_in = _a.double_opt_in, double_opt_in_redirect_url = _a.double_opt_in_redirect_url, submission_url = _a.submission_url, async_processing = _a.async_processing, branding = _a.branding, created_on = _a.created_on, updated_on = _a.updated_on, published_on = _a.published_on, edited_by = _a.edited_by, thumbnail_url = _a.thumbnail_url, recaptcha = _a.recaptcha, published_url = _a.published_url;
17155
+ var _this = _super.call(this, { id: id || "", name: name || "", list_id: list_id || 0, double_opt_in: double_opt_in || true }) || this;
17156
+ _this.enabled = enabled || true;
17157
+ _this.description = description || "";
17158
+ _this.tags = tags || [];
17159
+ _this.post_redirect_url = post_redirect_url || "";
17160
+ _this.double_opt_in_redirect_url = double_opt_in_redirect_url || "";
17161
+ _this.submission_url = submission_url || "";
17162
+ _this.async_processing = async_processing || false;
17163
+ _this.branding = branding || "";
17164
+ _this.created_on = created_on || 0;
17165
+ _this.updated_on = updated_on || 0;
17166
+ _this.published_on = published_on || 0;
17167
+ _this.edited_by = edited_by || {
17168
+ id: 0,
17169
+ email: ""
17170
+ };
17171
+ _this.thumbnail_url = thumbnail_url || "";
17172
+ _this.recaptcha = recaptcha || {
17173
+ secret: "",
17174
+ domain: ""
17175
+ };
17176
+ _this.published_url = published_url || "";
17117
17177
  return _this;
17118
17178
  }
17119
17179
  SummaryEnhancedFormModel.prototype.enable = function () {
17120
17180
  return __awaiter(this, void 0, void 0, function () {
17121
17181
  var _this = this;
17122
17182
  return __generator(this, function (_a) {
17183
+ if (!this.id) {
17184
+ throw new Error("Form was not initialized");
17185
+ }
17123
17186
  return [2 /*return*/, enableForm({ id: this.id.toString() }).then(function (data) {
17124
17187
  trackEvent(exports.EEvents.FORM_ENABLED, { id: _this.id });
17125
17188
  return data.data;
@@ -17131,6 +17194,9 @@ var SummaryEnhancedFormModel = /** @class */ (function (_super) {
17131
17194
  return __awaiter(this, void 0, void 0, function () {
17132
17195
  var _this = this;
17133
17196
  return __generator(this, function (_a) {
17197
+ if (!this.id) {
17198
+ throw new Error("Form was not initialized");
17199
+ }
17134
17200
  return [2 /*return*/, disableForm({ id: this.id.toString() }).then(function (data) {
17135
17201
  trackEvent(exports.EEvents.FORM_DISABLED, { id: _this.id });
17136
17202
  return data.data;
@@ -17142,6 +17208,9 @@ var SummaryEnhancedFormModel = /** @class */ (function (_super) {
17142
17208
  return __awaiter(this, void 0, void 0, function () {
17143
17209
  var _this = this;
17144
17210
  return __generator(this, function (_a) {
17211
+ if (!this.id) {
17212
+ throw new Error("Form was not initialized");
17213
+ }
17145
17214
  return [2 /*return*/, publishForm({ id: this.id.toString() }).then(function (data) {
17146
17215
  trackEvent(exports.EEvents.FORM_PUBLISHED, { id: _this.id });
17147
17216
  return data.data;
@@ -17154,6 +17223,9 @@ var SummaryEnhancedFormModel = /** @class */ (function (_super) {
17154
17223
  var _this = this;
17155
17224
  if (published === void 0) { published = false; }
17156
17225
  return __generator(this, function (_a) {
17226
+ if (!this.id) {
17227
+ throw new Error("Form was not initialized");
17228
+ }
17157
17229
  return [2 /*return*/, renderForm({ id: this.id.toString(), published: published }).then(function (data) {
17158
17230
  trackEvent(published ? exports.EEvents.FORM_RENDERED_PUBLISHED : exports.EEvents.FORM_RENDERED, { id: _this.id });
17159
17231
  return data.data;
@@ -17165,6 +17237,9 @@ var SummaryEnhancedFormModel = /** @class */ (function (_super) {
17165
17237
  return __awaiter(this, void 0, void 0, function () {
17166
17238
  var _this = this;
17167
17239
  return __generator(this, function (_a) {
17240
+ if (!this.id) {
17241
+ throw new Error("Form was not initialized");
17242
+ }
17168
17243
  return [2 /*return*/, patchForm({ id: this.id.toString(), data: this.toJson() }).then(function (data) {
17169
17244
  trackEvent(exports.EEvents.FORM_UPDATED, { id: _this.id });
17170
17245
  return data.data;
@@ -17441,6 +17516,16 @@ var FormsFactory = /** @class */ (function () {
17441
17516
  });
17442
17517
  });
17443
17518
  };
17519
+ FormsFactory.renderPublic = function (_a) {
17520
+ return __awaiter(this, arguments, void 0, function (_b) {
17521
+ var id = _b.id, token = _b.token;
17522
+ return __generator(this, function (_c) {
17523
+ return [2 /*return*/, renderPublicHtmlForm({ id: id, token: token }).then(function (data) {
17524
+ return data;
17525
+ })];
17526
+ });
17527
+ });
17528
+ };
17444
17529
  return FormsFactory;
17445
17530
  }());
17446
17531
 
@@ -17937,6 +18022,7 @@ exports.removeQueryParams = removeQueryParams;
17937
18022
  exports.removeTrailingChar = removeTrailingChar;
17938
18023
  exports.renderCampaign = renderCampaign;
17939
18024
  exports.renderForm = renderForm;
18025
+ exports.renderPublicHtmlForm = renderPublicHtmlForm;
17940
18026
  exports.renderTemplate = renderTemplate;
17941
18027
  exports.requestSupportService = requestSupportService;
17942
18028
  exports.resumeCampaign = resumeCampaign;
@@ -18,9 +18,13 @@ export declare class AccountModel {
18
18
  overrides: any;
19
19
  stripe_customer_id: string;
20
20
  metadata: any;
21
- constructor(params: Partial<TAccountModel>);
21
+ usage?: TAccountReport;
22
+ constructor(params: Partial<TAccountModel> & {
23
+ isMainAccount?: boolean;
24
+ });
22
25
  toJson(): any;
23
26
  set<T extends keyof this>(property: T, value: this[T]): void;
27
+ getUsageReport(): Promise<void>;
24
28
  getReport({ ...options }: TGetAccountReport): Promise<TAccountReport>;
25
29
  impersonate(byContext?: boolean): Promise<any>;
26
30
  getDomains(): Promise<TAccountDomains>;
@@ -31,6 +35,10 @@ export declare class AccountModel {
31
35
  }>;
32
36
  logOut(): Promise<any>;
33
37
  isPartnerOrOrganization(): boolean;
34
- hasAccessTo(feature: keyof TAccountLimits, resellerBrand?: TBrand): boolean;
38
+ hasAccessTo({ feature, resellerBrand, userCount }: {
39
+ feature: keyof TAccountLimits;
40
+ resellerBrand?: TBrand;
41
+ userCount?: number;
42
+ }): Promise<boolean>;
35
43
  }
36
44
  export * from "./types";
@@ -44,16 +44,17 @@ export declare class SummaryEnhancedFormModel extends CommonFormModel {
44
44
  tags: string[] | null;
45
45
  post_redirect_url: string;
46
46
  double_opt_in_redirect_url: string;
47
- submission_url: string;
48
47
  async_processing: boolean;
49
48
  branding: string;
49
+ recaptcha: TEnhancedFormRecaptcha;
50
+ readonly submission_url: string;
50
51
  readonly created_on: number;
51
52
  readonly updated_on: number;
52
53
  readonly published_on: number;
53
54
  readonly edited_by: TEnhancedFormEditedBy;
54
55
  readonly thumbnail_url: string;
55
- recaptcha: TEnhancedFormRecaptcha;
56
- constructor({ id, list_id, enabled, name, description, tags, post_redirect_url, double_opt_in, double_opt_in_redirect_url, submission_url, async_processing, branding, created_on, updated_on, published_on, edited_by, thumbnail_url, recaptcha, }: TSummaryEnhancedFormModel);
56
+ readonly published_url: string;
57
+ constructor({ id, list_id, enabled, name, description, tags, post_redirect_url, double_opt_in, double_opt_in_redirect_url, submission_url, async_processing, branding, created_on, updated_on, published_on, edited_by, thumbnail_url, recaptcha, published_url }: Partial<TSummaryEnhancedFormModel>);
57
58
  enable(): Promise<EnhancedFormModel>;
58
59
  disable(): Promise<EnhancedFormModel>;
59
60
  publish(): Promise<EnhancedFormModel>;
@@ -53,6 +53,7 @@ export interface TSummaryEnhancedFormModel {
53
53
  readonly edited_by: TEnhancedFormEditedBy;
54
54
  readonly thumbnail_url: string;
55
55
  recaptcha: TEnhancedFormRecaptcha;
56
+ published_url: string;
56
57
  }
57
58
  export interface TEnhancedFormModel extends TSummaryEnhancedFormModel {
58
59
  content: TEnhancedFormContent;
@@ -27,4 +27,8 @@ export declare function renderForm({ id, published }: {
27
27
  id: string;
28
28
  published: boolean;
29
29
  }): Promise<any>;
30
+ export declare function renderPublicHtmlForm({ id, token }: {
31
+ id: string;
32
+ token: string;
33
+ }): Promise<any>;
30
34
  export * from "./types";
@@ -1,3 +1,3 @@
1
1
  export declare function ElementContains(element: HTMLElement, target: Node): boolean;
2
- export declare function modelToJson<T extends Record<string, any>>(model: T): any;
2
+ export declare function modelToJson<T extends Record<string, any>>(model: T, exclude?: string[]): any;
3
3
  export declare function modelSet<T extends Record<string, any>>(model: T, property: string | number | symbol, value: any): void;
@@ -8,5 +8,9 @@ export declare class FormsFactory {
8
8
  static create({ form }: {
9
9
  form: Partial<TEnhancedFormModel>;
10
10
  }): Promise<EnhancedFormModel>;
11
+ static renderPublic({ id, token }: {
12
+ id: string;
13
+ token: string;
14
+ }): Promise<string>;
11
15
  }
12
16
  export * from "./types";
package/dist/esm/index.js CHANGED
@@ -2726,11 +2726,15 @@ function ElementContains(element, target) {
2726
2726
  }
2727
2727
  return false;
2728
2728
  }
2729
- function modelToJson(model) {
2729
+ function modelToJson(model, exclude) {
2730
+ if (exclude === void 0) { exclude = []; }
2730
2731
  var obj = {};
2731
2732
  Object.keys(model).forEach(function (key) {
2732
2733
  var _a;
2733
2734
  var value = model[key];
2735
+ if (exclude.includes(key)) {
2736
+ return;
2737
+ }
2734
2738
  if (value != null && typeof value === "object") {
2735
2739
  if (((_a = Object.keys(value)) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2736
2740
  obj[key] = value;
@@ -9477,17 +9481,33 @@ var AccountModel = /** @class */ (function () {
9477
9481
  this.overrides = params.overrides || {};
9478
9482
  this.stripe_customer_id = params.stripe_customer_id || "";
9479
9483
  this.metadata = params.metadata || {};
9484
+ if (params.isMainAccount) {
9485
+ this.getUsageReport();
9486
+ }
9480
9487
  }
9481
9488
  AccountModel.prototype.toJson = function () {
9482
- return modelToJson(this);
9489
+ return modelToJson(this, ["usage"]);
9483
9490
  };
9484
9491
  AccountModel.prototype.set = function (property, value) {
9485
9492
  modelSet(this, property, value);
9486
9493
  };
9494
+ AccountModel.prototype.getUsageReport = function () {
9495
+ return __awaiter(this, void 0, void 0, function () {
9496
+ var _this = this;
9497
+ return __generator(this, function (_a) {
9498
+ return [2 /*return*/, this.getReport({}).then(function (report) {
9499
+ _this.usage = report;
9500
+ })];
9501
+ });
9502
+ });
9503
+ };
9487
9504
  AccountModel.prototype.getReport = function (_a) {
9488
9505
  return __awaiter(this, void 0, void 0, function () {
9489
9506
  var options = __rest(_a, []);
9490
9507
  return __generator(this, function (_b) {
9508
+ if (!this.id) {
9509
+ throw new Error("Account was not initialized");
9510
+ }
9491
9511
  return [2 /*return*/, getAccountReport(__assign(__assign({}, options), { accountId: this.id })).then(function (result) {
9492
9512
  return result.data;
9493
9513
  })];
@@ -9498,6 +9518,9 @@ var AccountModel = /** @class */ (function () {
9498
9518
  return __awaiter(this, arguments, void 0, function (byContext) {
9499
9519
  if (byContext === void 0) { byContext = true; }
9500
9520
  return __generator(this, function (_a) {
9521
+ if (!this.id) {
9522
+ throw new Error("Account was not initialized");
9523
+ }
9501
9524
  return [2 /*return*/, impersonateService({ id: this.id, byContext: byContext })];
9502
9525
  });
9503
9526
  });
@@ -9505,6 +9528,9 @@ var AccountModel = /** @class */ (function () {
9505
9528
  AccountModel.prototype.getDomains = function () {
9506
9529
  return __awaiter(this, void 0, void 0, function () {
9507
9530
  return __generator(this, function (_a) {
9531
+ if (!this.id) {
9532
+ throw new Error("Account was not initialized");
9533
+ }
9508
9534
  return [2 /*return*/, getDomainsService({ id: this.id }).then(function (data) { return data.data; })];
9509
9535
  });
9510
9536
  });
@@ -9512,6 +9538,9 @@ var AccountModel = /** @class */ (function () {
9512
9538
  AccountModel.prototype.getCustomer = function () {
9513
9539
  return __awaiter(this, void 0, void 0, function () {
9514
9540
  return __generator(this, function (_a) {
9541
+ if (!this.id) {
9542
+ throw new Error("Account was not initialized");
9543
+ }
9515
9544
  return [2 /*return*/, BillingFactory.get({ id: this.id })];
9516
9545
  });
9517
9546
  });
@@ -9519,6 +9548,9 @@ var AccountModel = /** @class */ (function () {
9519
9548
  AccountModel.prototype.update = function (account) {
9520
9549
  return __awaiter(this, void 0, void 0, function () {
9521
9550
  return __generator(this, function (_a) {
9551
+ if (!this.id) {
9552
+ throw new Error("Account was not initialized");
9553
+ }
9522
9554
  trackEvent(EEvents.ACCOUNT_UPDATED, {
9523
9555
  id: account === null || account === void 0 ? void 0 : account.id,
9524
9556
  address: account === null || account === void 0 ? void 0 : account.address,
@@ -9548,45 +9580,57 @@ var AccountModel = /** @class */ (function () {
9548
9580
  AccountModel.prototype.isPartnerOrOrganization = function () {
9549
9581
  return this.partner || this.organization;
9550
9582
  };
9551
- AccountModel.prototype.hasAccessTo = function (feature, resellerBrand) {
9552
- var featureValue = this.usage_limits[feature];
9553
- if (featureValue === undefined) {
9554
- return false;
9555
- }
9556
- var brandDisabledLimitsFeatures = getNestedProperty(resellerBrand, "config.disabledLimitsFeatures") || [];
9557
- if (brandDisabledLimitsFeatures.includes(feature))
9558
- return true;
9559
- if (typeof featureValue === "boolean" || Number.isNaN(featureValue)) {
9560
- //Some feature flags are inverted
9561
- if (feature === "insert_reseller_logo") {
9562
- return !featureValue;
9563
- }
9564
- else {
9565
- return Boolean(featureValue);
9566
- }
9567
- }
9568
- else {
9569
- return true;
9570
- //return clientLimits[feature] < featureValue
9571
- }
9572
- // TODO have a way to tag the account as primary,
9573
- // This would fetch the account reports and user count and keep track of it
9574
- /*
9575
- currently for these info
9576
- per_campaign: number,
9577
- per_month: number,
9578
- maximum_contacts: number,
9579
- lists: number,
9580
- users: number,
9581
- /*
9582
- Old code:
9583
- if(isNaN(featureValue)) {
9584
- //code above
9585
- } else {
9586
- return clientLimits[feature] < featureValue
9587
- }
9588
-
9589
- */
9583
+ AccountModel.prototype.hasAccessTo = function (_a) {
9584
+ return __awaiter(this, arguments, void 0, function (_b) {
9585
+ var featureValue, brandDisabledLimitsFeatures;
9586
+ var feature = _b.feature, resellerBrand = _b.resellerBrand, userCount = _b.userCount;
9587
+ return __generator(this, function (_c) {
9588
+ switch (_c.label) {
9589
+ case 0:
9590
+ featureValue = this.usage_limits[feature];
9591
+ if (featureValue === undefined) {
9592
+ return [2 /*return*/, false];
9593
+ }
9594
+ brandDisabledLimitsFeatures = getNestedProperty(resellerBrand, "config.disabledLimitsFeatures") || [];
9595
+ if (brandDisabledLimitsFeatures.includes(feature))
9596
+ return [2 /*return*/, true];
9597
+ if (!(typeof featureValue === "boolean" || Number.isNaN(featureValue))) return [3 /*break*/, 1];
9598
+ //Some feature flags are inverted
9599
+ if (feature === "insert_reseller_logo") {
9600
+ return [2 /*return*/, !featureValue];
9601
+ }
9602
+ else {
9603
+ return [2 /*return*/, Boolean(featureValue)];
9604
+ }
9605
+ case 1:
9606
+ if (!!this.usage) return [3 /*break*/, 3];
9607
+ return [4 /*yield*/, this.getUsageReport()];
9608
+ case 2:
9609
+ _c.sent();
9610
+ _c.label = 3;
9611
+ case 3:
9612
+ if (this.usage) {
9613
+ if (feature === "lists") {
9614
+ return [2 /*return*/, this.usage.current_lists <= featureValue];
9615
+ }
9616
+ else if (feature === "users" && userCount !== undefined) {
9617
+ return [2 /*return*/, userCount <= featureValue];
9618
+ }
9619
+ else if (feature === "per_month") {
9620
+ return [2 /*return*/, this.usage.emails_usage <= 100];
9621
+ }
9622
+ else if (feature === "maximum_contacts") {
9623
+ return [2 /*return*/, this.usage.active_contacts <= featureValue];
9624
+ }
9625
+ throw new Error("Requested Feature does not exist in account usage");
9626
+ }
9627
+ else {
9628
+ return [2 /*return*/, true];
9629
+ }
9630
+ case 4: return [2 /*return*/];
9631
+ }
9632
+ });
9633
+ });
9590
9634
  };
9591
9635
  return AccountModel;
9592
9636
  }());
@@ -10154,6 +10198,15 @@ function renderForm(_a) {
10154
10198
  }
10155
10199
  });
10156
10200
  }
10201
+ function renderPublicHtmlForm(_a) {
10202
+ var id = _a.id, token = _a.token;
10203
+ return callApi({
10204
+ url: uiKitConfig.GATEWAY_PROXY + "/forms/" + id + "/render-html?token=" + token,
10205
+ fetchOptions: {
10206
+ method: EMethods.get
10207
+ }
10208
+ });
10209
+ }
10157
10210
 
10158
10211
  var EEditorType;
10159
10212
  (function (EEditorType) {
@@ -17078,28 +17131,38 @@ var FormModel = /** @class */ (function (_super) {
17078
17131
  var SummaryEnhancedFormModel = /** @class */ (function (_super) {
17079
17132
  __extends(SummaryEnhancedFormModel, _super);
17080
17133
  function SummaryEnhancedFormModel(_a) {
17081
- var id = _a.id, list_id = _a.list_id, enabled = _a.enabled, name = _a.name, description = _a.description, tags = _a.tags, post_redirect_url = _a.post_redirect_url, double_opt_in = _a.double_opt_in, double_opt_in_redirect_url = _a.double_opt_in_redirect_url, submission_url = _a.submission_url, async_processing = _a.async_processing, branding = _a.branding, created_on = _a.created_on, updated_on = _a.updated_on, published_on = _a.published_on, edited_by = _a.edited_by, thumbnail_url = _a.thumbnail_url, recaptcha = _a.recaptcha;
17082
- var _this = _super.call(this, { id: id, name: name, list_id: list_id, double_opt_in: double_opt_in }) || this;
17083
- _this.enabled = enabled;
17084
- _this.description = description;
17085
- _this.tags = tags;
17086
- _this.post_redirect_url = post_redirect_url;
17087
- _this.double_opt_in_redirect_url = double_opt_in_redirect_url;
17088
- _this.submission_url = submission_url;
17089
- _this.async_processing = async_processing;
17090
- _this.branding = branding;
17091
- _this.created_on = created_on;
17092
- _this.updated_on = updated_on;
17093
- _this.published_on = published_on;
17094
- _this.edited_by = edited_by;
17095
- _this.thumbnail_url = thumbnail_url;
17096
- _this.recaptcha = recaptcha;
17134
+ var id = _a.id, list_id = _a.list_id, enabled = _a.enabled, name = _a.name, description = _a.description, tags = _a.tags, post_redirect_url = _a.post_redirect_url, double_opt_in = _a.double_opt_in, double_opt_in_redirect_url = _a.double_opt_in_redirect_url, submission_url = _a.submission_url, async_processing = _a.async_processing, branding = _a.branding, created_on = _a.created_on, updated_on = _a.updated_on, published_on = _a.published_on, edited_by = _a.edited_by, thumbnail_url = _a.thumbnail_url, recaptcha = _a.recaptcha, published_url = _a.published_url;
17135
+ var _this = _super.call(this, { id: id || "", name: name || "", list_id: list_id || 0, double_opt_in: double_opt_in || true }) || this;
17136
+ _this.enabled = enabled || true;
17137
+ _this.description = description || "";
17138
+ _this.tags = tags || [];
17139
+ _this.post_redirect_url = post_redirect_url || "";
17140
+ _this.double_opt_in_redirect_url = double_opt_in_redirect_url || "";
17141
+ _this.submission_url = submission_url || "";
17142
+ _this.async_processing = async_processing || false;
17143
+ _this.branding = branding || "";
17144
+ _this.created_on = created_on || 0;
17145
+ _this.updated_on = updated_on || 0;
17146
+ _this.published_on = published_on || 0;
17147
+ _this.edited_by = edited_by || {
17148
+ id: 0,
17149
+ email: ""
17150
+ };
17151
+ _this.thumbnail_url = thumbnail_url || "";
17152
+ _this.recaptcha = recaptcha || {
17153
+ secret: "",
17154
+ domain: ""
17155
+ };
17156
+ _this.published_url = published_url || "";
17097
17157
  return _this;
17098
17158
  }
17099
17159
  SummaryEnhancedFormModel.prototype.enable = function () {
17100
17160
  return __awaiter(this, void 0, void 0, function () {
17101
17161
  var _this = this;
17102
17162
  return __generator(this, function (_a) {
17163
+ if (!this.id) {
17164
+ throw new Error("Form was not initialized");
17165
+ }
17103
17166
  return [2 /*return*/, enableForm({ id: this.id.toString() }).then(function (data) {
17104
17167
  trackEvent(EEvents.FORM_ENABLED, { id: _this.id });
17105
17168
  return data.data;
@@ -17111,6 +17174,9 @@ var SummaryEnhancedFormModel = /** @class */ (function (_super) {
17111
17174
  return __awaiter(this, void 0, void 0, function () {
17112
17175
  var _this = this;
17113
17176
  return __generator(this, function (_a) {
17177
+ if (!this.id) {
17178
+ throw new Error("Form was not initialized");
17179
+ }
17114
17180
  return [2 /*return*/, disableForm({ id: this.id.toString() }).then(function (data) {
17115
17181
  trackEvent(EEvents.FORM_DISABLED, { id: _this.id });
17116
17182
  return data.data;
@@ -17122,6 +17188,9 @@ var SummaryEnhancedFormModel = /** @class */ (function (_super) {
17122
17188
  return __awaiter(this, void 0, void 0, function () {
17123
17189
  var _this = this;
17124
17190
  return __generator(this, function (_a) {
17191
+ if (!this.id) {
17192
+ throw new Error("Form was not initialized");
17193
+ }
17125
17194
  return [2 /*return*/, publishForm({ id: this.id.toString() }).then(function (data) {
17126
17195
  trackEvent(EEvents.FORM_PUBLISHED, { id: _this.id });
17127
17196
  return data.data;
@@ -17134,6 +17203,9 @@ var SummaryEnhancedFormModel = /** @class */ (function (_super) {
17134
17203
  var _this = this;
17135
17204
  if (published === void 0) { published = false; }
17136
17205
  return __generator(this, function (_a) {
17206
+ if (!this.id) {
17207
+ throw new Error("Form was not initialized");
17208
+ }
17137
17209
  return [2 /*return*/, renderForm({ id: this.id.toString(), published: published }).then(function (data) {
17138
17210
  trackEvent(published ? EEvents.FORM_RENDERED_PUBLISHED : EEvents.FORM_RENDERED, { id: _this.id });
17139
17211
  return data.data;
@@ -17145,6 +17217,9 @@ var SummaryEnhancedFormModel = /** @class */ (function (_super) {
17145
17217
  return __awaiter(this, void 0, void 0, function () {
17146
17218
  var _this = this;
17147
17219
  return __generator(this, function (_a) {
17220
+ if (!this.id) {
17221
+ throw new Error("Form was not initialized");
17222
+ }
17148
17223
  return [2 /*return*/, patchForm({ id: this.id.toString(), data: this.toJson() }).then(function (data) {
17149
17224
  trackEvent(EEvents.FORM_UPDATED, { id: _this.id });
17150
17225
  return data.data;
@@ -17421,6 +17496,16 @@ var FormsFactory = /** @class */ (function () {
17421
17496
  });
17422
17497
  });
17423
17498
  };
17499
+ FormsFactory.renderPublic = function (_a) {
17500
+ return __awaiter(this, arguments, void 0, function (_b) {
17501
+ var id = _b.id, token = _b.token;
17502
+ return __generator(this, function (_c) {
17503
+ return [2 /*return*/, renderPublicHtmlForm({ id: id, token: token }).then(function (data) {
17504
+ return data;
17505
+ })];
17506
+ });
17507
+ });
17508
+ };
17424
17509
  return FormsFactory;
17425
17510
  }());
17426
17511
 
@@ -17685,4 +17770,4 @@ var UsersFactory = /** @class */ (function () {
17685
17770
  return UsersFactory;
17686
17771
  }());
17687
17772
 
17688
- export { AccountModel, AccountsFactory, ActionBarContainer, ActionBarContainerHandler, AssetManager, 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, ECampaignStatuses, EEMailSummaryStatuses, EEditorType, EEmailAttachementTypes, EEmailLogType, EEmailLogTypeParam, EEmailProviders, EEmailSummaryEngagement, EEvents, EListAttributeType, EMethods, EOperatorTypes, EPartialInfoPool, EStorageType, ElementContains, Email, EmailAPIFactory, EmptyContent, EnhancedFormModel, FileUpload, FilterBar, FormModel, FormsFactory, FullBar, GenericWrapper, GenericWrapperContext, GroupedActions, Header, Icon, IconPill, InformationGroup, InlineTextEdit, LinearProgress, Link, ListCampaignModel, ListModel, ListTemplateModel, ListsFactory, LoadingContainer, LocationTextField, Logo, MD5, MetricCard, Modal, ModalHandler, ModalHeading, OverlayHandler, PhoneTextField, Radio, ResourceEdit, Search, SenderModel, SendersFactory, SideMenu, SideMenuContainer, SideMenuItem, SubNav, SummaryEnhancedFormModel, SupportFactory, SystemEmailsFactory, SystemEmailsModel, TemplateModel, TemplatesFactory, TextField, TimePicker, TimeSelector, Toggle, TopMenu, Typography, UserModel, UsersFactory, acceptListPolicy, addPartialInformation, addToImpersonificationTree, amIImpersonating, amILoggedInService, archiveCampaign, areAllPropertiesEmpty, buildMUITheme, callApi, camelCase, camelToSnakeCase, cancelCampaign, capitalizeFirstLetter, cleanPostHogId, clearImpersonificationTree, clearStorage, connectToZendeskSupportService, createAccount, createBrand, createCampaign, createCampaignLogsExports, createCampaignsReportsExport, createForm, createTemplate, deepMergeObject, deleteCampaign, deleteCampaignsReportsExport, deleteForm, deletePartialInformation, deleteStorageItem, deleteTemplate, descendingComparator, disableForm, downloadCampaignLogExport, downloadCampaignsReportsExport, emptyAccountAddress, emptyAccountLimits, enableForm, enrichBrand, enrichOrganization, enrichProfile, eventCondition, eventIdentify, eventLogout, fetchRetry, fetchRoute, findNestedProperty, formatNumber, getAccount, getAccountReport, getAdjustedBillingCycle, 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, getPropertyValue, getSender, getStartOfDate, getStorage, getTColor, getTemplate, getUnixTime, getUrlQueryParam, getUser, getUtmCookies, googlePlacesMapper, hasDecimal, impersonateService, initFieldValidation, initPostHog, isColorLight, isDomainValidService, isSimpleType, isValidEmail, isValidString, isValidUrl, lisTEmailTags, listAccounts, listCampaigns, listCampaignsReportsExports, listContacts, listEmailLogs, listForms, listList, listListAttributes, listSenders, listSystemEmails, listTemplates, listUsers, logOutService, loginService, miliToSecond, modelSet, modelToJson, originalBrand, patchForm, popImpersonificationTree, postMessage, publishForm, reScheduleCampaign, removeEmptyProperties, removeQueryParams, removeTrailingChar, renderCampaign, renderForm, renderTemplate, requestSupportService, resumeCampaign, scheduleCampaign, searchCustomerProfiles, sendCampaignTest, setBrandHeadElements, setStorage, shareTemplate, splitArray, splitObject, stableSort, startPromisePool, suspendCampaign, trackEvent, truncateEmail, truncateText, uiKitConfig, unArchiveCampaign, unScheduleCampaign, unshareTemplate, updateAccount, updateAndClearUrlParams, updateCampaign, updateSystemEmails, updateTemplate, updateUser, validateColor, validateEmail, validateGenericInput, validateUrl, wait, whiteLabelBrand, whoAmi };
17773
+ export { AccountModel, AccountsFactory, ActionBarContainer, ActionBarContainerHandler, AssetManager, 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, ECampaignStatuses, EEMailSummaryStatuses, EEditorType, EEmailAttachementTypes, EEmailLogType, EEmailLogTypeParam, EEmailProviders, EEmailSummaryEngagement, EEvents, EListAttributeType, EMethods, EOperatorTypes, EPartialInfoPool, EStorageType, ElementContains, Email, EmailAPIFactory, EmptyContent, EnhancedFormModel, FileUpload, FilterBar, FormModel, FormsFactory, FullBar, GenericWrapper, GenericWrapperContext, GroupedActions, Header, Icon, IconPill, InformationGroup, InlineTextEdit, LinearProgress, Link, ListCampaignModel, ListModel, ListTemplateModel, ListsFactory, LoadingContainer, LocationTextField, Logo, MD5, MetricCard, Modal, ModalHandler, ModalHeading, OverlayHandler, PhoneTextField, Radio, ResourceEdit, Search, SenderModel, SendersFactory, SideMenu, SideMenuContainer, SideMenuItem, SubNav, SummaryEnhancedFormModel, SupportFactory, SystemEmailsFactory, SystemEmailsModel, TemplateModel, TemplatesFactory, TextField, TimePicker, TimeSelector, Toggle, TopMenu, Typography, UserModel, UsersFactory, acceptListPolicy, addPartialInformation, addToImpersonificationTree, amIImpersonating, amILoggedInService, archiveCampaign, areAllPropertiesEmpty, buildMUITheme, callApi, camelCase, camelToSnakeCase, cancelCampaign, capitalizeFirstLetter, cleanPostHogId, clearImpersonificationTree, clearStorage, connectToZendeskSupportService, createAccount, createBrand, createCampaign, createCampaignLogsExports, createCampaignsReportsExport, createForm, createTemplate, deepMergeObject, deleteCampaign, deleteCampaignsReportsExport, deleteForm, deletePartialInformation, deleteStorageItem, deleteTemplate, descendingComparator, disableForm, downloadCampaignLogExport, downloadCampaignsReportsExport, emptyAccountAddress, emptyAccountLimits, enableForm, enrichBrand, enrichOrganization, enrichProfile, eventCondition, eventIdentify, eventLogout, fetchRetry, fetchRoute, findNestedProperty, formatNumber, getAccount, getAccountReport, getAdjustedBillingCycle, 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, getPropertyValue, getSender, getStartOfDate, getStorage, getTColor, getTemplate, getUnixTime, getUrlQueryParam, getUser, getUtmCookies, googlePlacesMapper, hasDecimal, impersonateService, initFieldValidation, initPostHog, isColorLight, isDomainValidService, isSimpleType, isValidEmail, isValidString, isValidUrl, lisTEmailTags, listAccounts, listCampaigns, listCampaignsReportsExports, listContacts, listEmailLogs, listForms, listList, listListAttributes, listSenders, listSystemEmails, listTemplates, listUsers, logOutService, loginService, miliToSecond, modelSet, modelToJson, originalBrand, patchForm, popImpersonificationTree, postMessage, publishForm, reScheduleCampaign, removeEmptyProperties, removeQueryParams, removeTrailingChar, renderCampaign, renderForm, renderPublicHtmlForm, renderTemplate, requestSupportService, resumeCampaign, scheduleCampaign, searchCustomerProfiles, sendCampaignTest, setBrandHeadElements, setStorage, shareTemplate, splitArray, splitObject, stableSort, startPromisePool, suspendCampaign, trackEvent, truncateEmail, truncateText, uiKitConfig, unArchiveCampaign, unScheduleCampaign, unshareTemplate, updateAccount, updateAndClearUrlParams, updateCampaign, updateSystemEmails, updateTemplate, updateUser, validateColor, validateEmail, validateGenericInput, validateUrl, wait, whiteLabelBrand, whoAmi };
@@ -18,9 +18,13 @@ export declare class AccountModel {
18
18
  overrides: any;
19
19
  stripe_customer_id: string;
20
20
  metadata: any;
21
- constructor(params: Partial<TAccountModel>);
21
+ usage?: TAccountReport;
22
+ constructor(params: Partial<TAccountModel> & {
23
+ isMainAccount?: boolean;
24
+ });
22
25
  toJson(): any;
23
26
  set<T extends keyof this>(property: T, value: this[T]): void;
27
+ getUsageReport(): Promise<void>;
24
28
  getReport({ ...options }: TGetAccountReport): Promise<TAccountReport>;
25
29
  impersonate(byContext?: boolean): Promise<any>;
26
30
  getDomains(): Promise<TAccountDomains>;
@@ -31,6 +35,10 @@ export declare class AccountModel {
31
35
  }>;
32
36
  logOut(): Promise<any>;
33
37
  isPartnerOrOrganization(): boolean;
34
- hasAccessTo(feature: keyof TAccountLimits, resellerBrand?: TBrand): boolean;
38
+ hasAccessTo({ feature, resellerBrand, userCount }: {
39
+ feature: keyof TAccountLimits;
40
+ resellerBrand?: TBrand;
41
+ userCount?: number;
42
+ }): Promise<boolean>;
35
43
  }
36
44
  export * from "./types";
@@ -44,16 +44,17 @@ export declare class SummaryEnhancedFormModel extends CommonFormModel {
44
44
  tags: string[] | null;
45
45
  post_redirect_url: string;
46
46
  double_opt_in_redirect_url: string;
47
- submission_url: string;
48
47
  async_processing: boolean;
49
48
  branding: string;
49
+ recaptcha: TEnhancedFormRecaptcha;
50
+ readonly submission_url: string;
50
51
  readonly created_on: number;
51
52
  readonly updated_on: number;
52
53
  readonly published_on: number;
53
54
  readonly edited_by: TEnhancedFormEditedBy;
54
55
  readonly thumbnail_url: string;
55
- recaptcha: TEnhancedFormRecaptcha;
56
- constructor({ id, list_id, enabled, name, description, tags, post_redirect_url, double_opt_in, double_opt_in_redirect_url, submission_url, async_processing, branding, created_on, updated_on, published_on, edited_by, thumbnail_url, recaptcha, }: TSummaryEnhancedFormModel);
56
+ readonly published_url: string;
57
+ constructor({ id, list_id, enabled, name, description, tags, post_redirect_url, double_opt_in, double_opt_in_redirect_url, submission_url, async_processing, branding, created_on, updated_on, published_on, edited_by, thumbnail_url, recaptcha, published_url }: Partial<TSummaryEnhancedFormModel>);
57
58
  enable(): Promise<EnhancedFormModel>;
58
59
  disable(): Promise<EnhancedFormModel>;
59
60
  publish(): Promise<EnhancedFormModel>;
@@ -53,6 +53,7 @@ export interface TSummaryEnhancedFormModel {
53
53
  readonly edited_by: TEnhancedFormEditedBy;
54
54
  readonly thumbnail_url: string;
55
55
  recaptcha: TEnhancedFormRecaptcha;
56
+ published_url: string;
56
57
  }
57
58
  export interface TEnhancedFormModel extends TSummaryEnhancedFormModel {
58
59
  content: TEnhancedFormContent;
@@ -27,4 +27,8 @@ export declare function renderForm({ id, published }: {
27
27
  id: string;
28
28
  published: boolean;
29
29
  }): Promise<any>;
30
+ export declare function renderPublicHtmlForm({ id, token }: {
31
+ id: string;
32
+ token: string;
33
+ }): Promise<any>;
30
34
  export * from "./types";
@@ -1,3 +1,3 @@
1
1
  export declare function ElementContains(element: HTMLElement, target: Node): boolean;
2
- export declare function modelToJson<T extends Record<string, any>>(model: T): any;
2
+ export declare function modelToJson<T extends Record<string, any>>(model: T, exclude?: string[]): any;
3
3
  export declare function modelSet<T extends Record<string, any>>(model: T, property: string | number | symbol, value: any): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cakemail-org/ui-components-v2",
3
- "version": "2.0.98",
3
+ "version": "2.1.0",
4
4
  "description": "ui library kit made with material UI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",