@cakemail-org/ui-components-v2 2.0.40 → 2.0.42
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,46 @@ 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
|
+
if (Number.isNaN(featureValue)) {
|
|
9180
|
+
//Some feature flags are inverted
|
|
9181
|
+
if (feature === "insert_reseller_logo") {
|
|
9182
|
+
return !featureValue;
|
|
9183
|
+
}
|
|
9184
|
+
else {
|
|
9185
|
+
return Boolean(featureValue);
|
|
9186
|
+
}
|
|
9187
|
+
}
|
|
9188
|
+
else {
|
|
9189
|
+
return true;
|
|
9190
|
+
//return clientLimits[feature] < featureValue
|
|
9191
|
+
}
|
|
9192
|
+
// TODO have a way to tag the account as primary,
|
|
9193
|
+
// This would fetch the account reports and user count and keep track of it
|
|
9194
|
+
/*
|
|
9195
|
+
currently for these info
|
|
9196
|
+
per_campaign: number,
|
|
9197
|
+
per_month: number,
|
|
9198
|
+
maximum_contacts: number,
|
|
9199
|
+
lists: number,
|
|
9200
|
+
users: number,
|
|
9201
|
+
/*
|
|
9202
|
+
Old code:
|
|
9203
|
+
if(isNaN(featureValue)) {
|
|
9204
|
+
//code above
|
|
9205
|
+
} else {
|
|
9206
|
+
return clientLimits[feature] < featureValue
|
|
9207
|
+
}
|
|
9208
|
+
|
|
9209
|
+
*/
|
|
9210
|
+
};
|
|
9171
9211
|
return AccountModel;
|
|
9172
9212
|
}());
|
|
9173
9213
|
|
|
@@ -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): boolean;
|
|
32
34
|
}
|
|
33
35
|
export * from "./types";
|
package/dist/esm/index.js
CHANGED
|
@@ -9148,6 +9148,46 @@ 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
|
+
if (Number.isNaN(featureValue)) {
|
|
9160
|
+
//Some feature flags are inverted
|
|
9161
|
+
if (feature === "insert_reseller_logo") {
|
|
9162
|
+
return !featureValue;
|
|
9163
|
+
}
|
|
9164
|
+
else {
|
|
9165
|
+
return Boolean(featureValue);
|
|
9166
|
+
}
|
|
9167
|
+
}
|
|
9168
|
+
else {
|
|
9169
|
+
return true;
|
|
9170
|
+
//return clientLimits[feature] < featureValue
|
|
9171
|
+
}
|
|
9172
|
+
// TODO have a way to tag the account as primary,
|
|
9173
|
+
// This would fetch the account reports and user count and keep track of it
|
|
9174
|
+
/*
|
|
9175
|
+
currently for these info
|
|
9176
|
+
per_campaign: number,
|
|
9177
|
+
per_month: number,
|
|
9178
|
+
maximum_contacts: number,
|
|
9179
|
+
lists: number,
|
|
9180
|
+
users: number,
|
|
9181
|
+
/*
|
|
9182
|
+
Old code:
|
|
9183
|
+
if(isNaN(featureValue)) {
|
|
9184
|
+
//code above
|
|
9185
|
+
} else {
|
|
9186
|
+
return clientLimits[feature] < featureValue
|
|
9187
|
+
}
|
|
9188
|
+
|
|
9189
|
+
*/
|
|
9190
|
+
};
|
|
9151
9191
|
return AccountModel;
|
|
9152
9192
|
}());
|
|
9153
9193
|
|
|
@@ -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): boolean;
|
|
32
34
|
}
|
|
33
35
|
export * from "./types";
|