@cakemail-org/ui-components-v2 2.0.40 → 2.0.41

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
@@ -9168,6 +9168,40 @@ var AccountModel = /** @class */ (function () {
9168
9168
  AccountModel.prototype.isPartnerOrOrganization = function () {
9169
9169
  return this.partner || this.organization;
9170
9170
  };
9171
+ AccountModel.prototype.hasAccessTo = function (feature, resellerBrand) {
9172
+ var featureValue = this.usage_limits[feature];
9173
+ if (featureValue === undefined) {
9174
+ return false;
9175
+ }
9176
+ var brandDisabledLimitsFeatures = getNestedProperty(resellerBrand, "config.disabledLimitsFeatures") || [];
9177
+ if (brandDisabledLimitsFeatures.includes(feature))
9178
+ return true;
9179
+ //Some feature flags are inverted
9180
+ if (feature === "insert_reseller_logo") {
9181
+ return !featureValue;
9182
+ }
9183
+ else {
9184
+ return featureValue;
9185
+ }
9186
+ // TODO have a way to tag the account as primary,
9187
+ // This would fetch the account reports and user count and keep track of it
9188
+ /*
9189
+ currently for these info
9190
+ per_campaign: number,
9191
+ per_month: number,
9192
+ maximum_contacts: number,
9193
+ lists: number,
9194
+ users: number,
9195
+ /*
9196
+ Old code:
9197
+ if(isNaN(featureValue)) {
9198
+ //code above
9199
+ } else {
9200
+ return clientLimits[feature] < featureValue
9201
+ }
9202
+
9203
+ */
9204
+ };
9171
9205
  return AccountModel;
9172
9206
  }());
9173
9207
 
@@ -1,3 +1,4 @@
1
+ import { TBrand } from "../../factories";
1
2
  import { TAccountAddress, TAccountDomains, TAccountLimits, TAccountModel, TAccountReport, TGetAccountReport } from "./types";
2
3
  export declare class AccountModel {
3
4
  readonly id: number;
@@ -29,5 +30,6 @@ export declare class AccountModel {
29
30
  }>;
30
31
  logOut(): Promise<any>;
31
32
  isPartnerOrOrganization(): boolean;
33
+ hasAccessTo(feature: keyof TAccountLimits, resellerBrand?: TBrand): number | boolean;
32
34
  }
33
35
  export * from "./types";
package/dist/esm/index.js CHANGED
@@ -9148,6 +9148,40 @@ var AccountModel = /** @class */ (function () {
9148
9148
  AccountModel.prototype.isPartnerOrOrganization = function () {
9149
9149
  return this.partner || this.organization;
9150
9150
  };
9151
+ AccountModel.prototype.hasAccessTo = function (feature, resellerBrand) {
9152
+ var featureValue = this.usage_limits[feature];
9153
+ if (featureValue === undefined) {
9154
+ return false;
9155
+ }
9156
+ var brandDisabledLimitsFeatures = getNestedProperty(resellerBrand, "config.disabledLimitsFeatures") || [];
9157
+ if (brandDisabledLimitsFeatures.includes(feature))
9158
+ return true;
9159
+ //Some feature flags are inverted
9160
+ if (feature === "insert_reseller_logo") {
9161
+ return !featureValue;
9162
+ }
9163
+ else {
9164
+ return featureValue;
9165
+ }
9166
+ // TODO have a way to tag the account as primary,
9167
+ // This would fetch the account reports and user count and keep track of it
9168
+ /*
9169
+ currently for these info
9170
+ per_campaign: number,
9171
+ per_month: number,
9172
+ maximum_contacts: number,
9173
+ lists: number,
9174
+ users: number,
9175
+ /*
9176
+ Old code:
9177
+ if(isNaN(featureValue)) {
9178
+ //code above
9179
+ } else {
9180
+ return clientLimits[feature] < featureValue
9181
+ }
9182
+
9183
+ */
9184
+ };
9151
9185
  return AccountModel;
9152
9186
  }());
9153
9187
 
@@ -1,3 +1,4 @@
1
+ import { TBrand } from "../../factories";
1
2
  import { TAccountAddress, TAccountDomains, TAccountLimits, TAccountModel, TAccountReport, TGetAccountReport } from "./types";
2
3
  export declare class AccountModel {
3
4
  readonly id: number;
@@ -29,5 +30,6 @@ export declare class AccountModel {
29
30
  }>;
30
31
  logOut(): Promise<any>;
31
32
  isPartnerOrOrganization(): boolean;
33
+ hasAccessTo(feature: keyof TAccountLimits, resellerBrand?: TBrand): number | boolean;
32
34
  }
33
35
  export * from "./types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cakemail-org/ui-components-v2",
3
- "version": "2.0.40",
3
+ "version": "2.0.41",
4
4
  "description": "ui library kit made with material UI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",