@cakemail-org/ui-components-v2 2.1.0 → 2.1.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.
package/dist/cjs/index.js
CHANGED
|
@@ -9603,7 +9603,7 @@ var AccountModel = /** @class */ (function () {
|
|
|
9603
9603
|
AccountModel.prototype.hasAccessTo = function (_a) {
|
|
9604
9604
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
9605
9605
|
var featureValue, brandDisabledLimitsFeatures;
|
|
9606
|
-
var feature = _b.feature,
|
|
9606
|
+
var feature = _b.feature, partnerBrand = _b.partnerBrand, userCount = _b.userCount;
|
|
9607
9607
|
return __generator(this, function (_c) {
|
|
9608
9608
|
switch (_c.label) {
|
|
9609
9609
|
case 0:
|
|
@@ -9611,7 +9611,7 @@ var AccountModel = /** @class */ (function () {
|
|
|
9611
9611
|
if (featureValue === undefined) {
|
|
9612
9612
|
return [2 /*return*/, false];
|
|
9613
9613
|
}
|
|
9614
|
-
brandDisabledLimitsFeatures = getNestedProperty(
|
|
9614
|
+
brandDisabledLimitsFeatures = getNestedProperty(partnerBrand, "config.disabledLimitsFeatures") || [];
|
|
9615
9615
|
if (brandDisabledLimitsFeatures.includes(feature))
|
|
9616
9616
|
return [2 /*return*/, true];
|
|
9617
9617
|
if (!(typeof featureValue === "boolean" || Number.isNaN(featureValue))) return [3 /*break*/, 1];
|
|
@@ -10522,7 +10522,7 @@ var GenericWrapperContext = React.createContext({
|
|
|
10522
10522
|
function GenericWrapper(_a) {
|
|
10523
10523
|
var children = _a.children, brandObj = _a.brandObj, userBrandObj = _a.userBrandObj, brandId = _a.brandId, brandHost = _a.brandHost, account = _a.account, user = _a.user, _b = _a.setPageHead, setPageHead = _b === void 0 ? true : _b, _c = _a.setPostHog, setPostHog = _c === void 0 ? true : _c, LocizeInitializer = _a.LocizeInitializer, brandThemeContext = _a.brandThemeContext, proxyUrl = _a.proxyUrl, _d = _a.styleOverride, styleOverride = _d === void 0 ? {} : _d, _e = _a.includeHandlers, includeHandlers = _e === void 0 ? true : _e;
|
|
10524
10524
|
var _f = React.useState(brandObj ? buildMUITheme({ brand: brandObj }) : undefined), mUITheme = _f[0], setMUITheme = _f[1];
|
|
10525
|
-
var _g = React.useState(brandObj),
|
|
10525
|
+
var _g = React.useState(brandObj), partnerBrand = _g[0], setPartnerBrand = _g[1];
|
|
10526
10526
|
var _h = React.useState(userBrandObj), userBrand = _h[0], setUserBrand = _h[1];
|
|
10527
10527
|
var _j = reactI18next.useTranslation(); _j.t; _j.i18n;
|
|
10528
10528
|
var dialogRef = React.useRef(undefined);
|
|
@@ -10537,7 +10537,7 @@ function GenericWrapper(_a) {
|
|
|
10537
10537
|
var _a, _b;
|
|
10538
10538
|
if (user) {
|
|
10539
10539
|
//@ts-ignore
|
|
10540
|
-
var locale = getBestLocalMatch((_a = user === null || user === void 0 ? void 0 : user.language) === null || _a === void 0 ? void 0 : _a.replace("_", "-"), (_b =
|
|
10540
|
+
var locale = getBestLocalMatch((_a = user === null || user === void 0 ? void 0 : user.language) === null || _a === void 0 ? void 0 : _a.replace("_", "-"), (_b = partnerBrand === null || partnerBrand === void 0 ? void 0 : partnerBrand.client_config) === null || _b === void 0 ? void 0 : _b.languages);
|
|
10541
10541
|
if (LocizeInitializer) {
|
|
10542
10542
|
LocizeInitializer.changeLanguage(locale);
|
|
10543
10543
|
}
|
|
@@ -10581,13 +10581,13 @@ function GenericWrapper(_a) {
|
|
|
10581
10581
|
}
|
|
10582
10582
|
var content = React.createElement(BrandWrapper, { MUITheme: mUITheme, brandId: brandId, styleOverride: styleOverride, brandHost: brandHost, onBrandSuccess: function (compiledBrand, theme) {
|
|
10583
10583
|
initPH(compiledBrand);
|
|
10584
|
-
|
|
10584
|
+
setPartnerBrand(compiledBrand);
|
|
10585
10585
|
setMUITheme(theme);
|
|
10586
10586
|
}, onBrandError: function () {
|
|
10587
10587
|
setMUITheme(buildMUITheme({ brand: whiteLabelBrand }));
|
|
10588
|
-
}, noFetch: !!brandObj, setPageHead: setPageHead, brandThemeContext: brandThemeContext, includeHandlers: false },
|
|
10588
|
+
}, noFetch: !!brandObj, setPageHead: setPageHead, brandThemeContext: brandThemeContext, includeHandlers: false }, partnerBrand &&
|
|
10589
10589
|
React.createElement(GenericWrapperContext.Provider, { value: {
|
|
10590
|
-
partnerBrand:
|
|
10590
|
+
partnerBrand: partnerBrand,
|
|
10591
10591
|
userBrand: userBrand,
|
|
10592
10592
|
account: account ? new AccountModel(account) : new AccountModel({}),
|
|
10593
10593
|
user: user ? new UserModel(user) : new UserModel({})
|
|
@@ -35,9 +35,9 @@ export declare class AccountModel {
|
|
|
35
35
|
}>;
|
|
36
36
|
logOut(): Promise<any>;
|
|
37
37
|
isPartnerOrOrganization(): boolean;
|
|
38
|
-
hasAccessTo({ feature,
|
|
38
|
+
hasAccessTo({ feature, partnerBrand, userCount }: {
|
|
39
39
|
feature: keyof TAccountLimits;
|
|
40
|
-
|
|
40
|
+
partnerBrand?: TBrand;
|
|
41
41
|
userCount?: number;
|
|
42
42
|
}): Promise<boolean>;
|
|
43
43
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -9583,7 +9583,7 @@ var AccountModel = /** @class */ (function () {
|
|
|
9583
9583
|
AccountModel.prototype.hasAccessTo = function (_a) {
|
|
9584
9584
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
9585
9585
|
var featureValue, brandDisabledLimitsFeatures;
|
|
9586
|
-
var feature = _b.feature,
|
|
9586
|
+
var feature = _b.feature, partnerBrand = _b.partnerBrand, userCount = _b.userCount;
|
|
9587
9587
|
return __generator(this, function (_c) {
|
|
9588
9588
|
switch (_c.label) {
|
|
9589
9589
|
case 0:
|
|
@@ -9591,7 +9591,7 @@ var AccountModel = /** @class */ (function () {
|
|
|
9591
9591
|
if (featureValue === undefined) {
|
|
9592
9592
|
return [2 /*return*/, false];
|
|
9593
9593
|
}
|
|
9594
|
-
brandDisabledLimitsFeatures = getNestedProperty(
|
|
9594
|
+
brandDisabledLimitsFeatures = getNestedProperty(partnerBrand, "config.disabledLimitsFeatures") || [];
|
|
9595
9595
|
if (brandDisabledLimitsFeatures.includes(feature))
|
|
9596
9596
|
return [2 /*return*/, true];
|
|
9597
9597
|
if (!(typeof featureValue === "boolean" || Number.isNaN(featureValue))) return [3 /*break*/, 1];
|
|
@@ -10502,7 +10502,7 @@ var GenericWrapperContext = createContext({
|
|
|
10502
10502
|
function GenericWrapper(_a) {
|
|
10503
10503
|
var children = _a.children, brandObj = _a.brandObj, userBrandObj = _a.userBrandObj, brandId = _a.brandId, brandHost = _a.brandHost, account = _a.account, user = _a.user, _b = _a.setPageHead, setPageHead = _b === void 0 ? true : _b, _c = _a.setPostHog, setPostHog = _c === void 0 ? true : _c, LocizeInitializer = _a.LocizeInitializer, brandThemeContext = _a.brandThemeContext, proxyUrl = _a.proxyUrl, _d = _a.styleOverride, styleOverride = _d === void 0 ? {} : _d, _e = _a.includeHandlers, includeHandlers = _e === void 0 ? true : _e;
|
|
10504
10504
|
var _f = useState(brandObj ? buildMUITheme({ brand: brandObj }) : undefined), mUITheme = _f[0], setMUITheme = _f[1];
|
|
10505
|
-
var _g = useState(brandObj),
|
|
10505
|
+
var _g = useState(brandObj), partnerBrand = _g[0], setPartnerBrand = _g[1];
|
|
10506
10506
|
var _h = useState(userBrandObj), userBrand = _h[0], setUserBrand = _h[1];
|
|
10507
10507
|
var _j = useTranslation(); _j.t; _j.i18n;
|
|
10508
10508
|
var dialogRef = useRef(undefined);
|
|
@@ -10517,7 +10517,7 @@ function GenericWrapper(_a) {
|
|
|
10517
10517
|
var _a, _b;
|
|
10518
10518
|
if (user) {
|
|
10519
10519
|
//@ts-ignore
|
|
10520
|
-
var locale = getBestLocalMatch((_a = user === null || user === void 0 ? void 0 : user.language) === null || _a === void 0 ? void 0 : _a.replace("_", "-"), (_b =
|
|
10520
|
+
var locale = getBestLocalMatch((_a = user === null || user === void 0 ? void 0 : user.language) === null || _a === void 0 ? void 0 : _a.replace("_", "-"), (_b = partnerBrand === null || partnerBrand === void 0 ? void 0 : partnerBrand.client_config) === null || _b === void 0 ? void 0 : _b.languages);
|
|
10521
10521
|
if (LocizeInitializer) {
|
|
10522
10522
|
LocizeInitializer.changeLanguage(locale);
|
|
10523
10523
|
}
|
|
@@ -10561,13 +10561,13 @@ function GenericWrapper(_a) {
|
|
|
10561
10561
|
}
|
|
10562
10562
|
var content = React__default.createElement(BrandWrapper, { MUITheme: mUITheme, brandId: brandId, styleOverride: styleOverride, brandHost: brandHost, onBrandSuccess: function (compiledBrand, theme) {
|
|
10563
10563
|
initPH(compiledBrand);
|
|
10564
|
-
|
|
10564
|
+
setPartnerBrand(compiledBrand);
|
|
10565
10565
|
setMUITheme(theme);
|
|
10566
10566
|
}, onBrandError: function () {
|
|
10567
10567
|
setMUITheme(buildMUITheme({ brand: whiteLabelBrand }));
|
|
10568
|
-
}, noFetch: !!brandObj, setPageHead: setPageHead, brandThemeContext: brandThemeContext, includeHandlers: false },
|
|
10568
|
+
}, noFetch: !!brandObj, setPageHead: setPageHead, brandThemeContext: brandThemeContext, includeHandlers: false }, partnerBrand &&
|
|
10569
10569
|
React__default.createElement(GenericWrapperContext.Provider, { value: {
|
|
10570
|
-
partnerBrand:
|
|
10570
|
+
partnerBrand: partnerBrand,
|
|
10571
10571
|
userBrand: userBrand,
|
|
10572
10572
|
account: account ? new AccountModel(account) : new AccountModel({}),
|
|
10573
10573
|
user: user ? new UserModel(user) : new UserModel({})
|
|
@@ -35,9 +35,9 @@ export declare class AccountModel {
|
|
|
35
35
|
}>;
|
|
36
36
|
logOut(): Promise<any>;
|
|
37
37
|
isPartnerOrOrganization(): boolean;
|
|
38
|
-
hasAccessTo({ feature,
|
|
38
|
+
hasAccessTo({ feature, partnerBrand, userCount }: {
|
|
39
39
|
feature: keyof TAccountLimits;
|
|
40
|
-
|
|
40
|
+
partnerBrand?: TBrand;
|
|
41
41
|
userCount?: number;
|
|
42
42
|
}): Promise<boolean>;
|
|
43
43
|
}
|