@bigbinary/neeto-themes-frontend 4.0.5 → 4.0.6
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/README.md
CHANGED
|
@@ -188,6 +188,25 @@ for step-by-step instructions to develop the frontend package.
|
|
|
188
188
|
export default App;
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
+
**Props:**
|
|
192
|
+
|
|
193
|
+
- `entityId` (required): The ID of the entity to which the theme is attached.
|
|
194
|
+
- `entityType` (required): The type of the entity (e.g., "Meeting", "Booking").
|
|
195
|
+
- `thumbnail` (required): A React component to display as the theme thumbnail.
|
|
196
|
+
- `children` (required): The preview component to render.
|
|
197
|
+
- `onPropertiesChange` (optional): Callback function triggered when theme properties change.
|
|
198
|
+
- `defaultImageSize` (optional): Default image size for image uploads. Should be an object with `width` and `height` properties.
|
|
199
|
+
- `fixedAspectRatio` (optional): Fixed aspect ratio for image uploads. Should be an object with `width` and `height` properties.
|
|
200
|
+
- `helpDocUrl` (optional): URL to the help documentation.
|
|
201
|
+
- `isTemplateThemesEnabled` (optional): Boolean to enable template themes feature. Default: `false`.
|
|
202
|
+
- `pageTitle` (optional): Custom page title for the theme builder.
|
|
203
|
+
- `onApplyThemeSuccess` (optional): Callback function triggered when a theme is successfully applied.
|
|
204
|
+
- `onUpdateThemeSuccess` (optional): Callback function triggered when a theme is successfully updated.
|
|
205
|
+
- `onApplyGlobalThemeSuccess` (optional): Callback function triggered when a global theme is successfully applied.
|
|
206
|
+
- `helpPopoverProps` (optional): Props to pass to the help popover component.
|
|
207
|
+
- `enabledFeatures` (optional): Object to control which features are enabled. Default: `{ customCSS: true }`. Set `{ customCSS: false }` to disable the Custom CSS feature.
|
|
208
|
+
- `proFeatures` (optional): Object to specify which features should be marked as "pro" features. Example: `{ customCSS: true }` will mark Custom CSS as a pro feature.
|
|
209
|
+
|
|
191
210
|
#### hooks
|
|
192
211
|
|
|
193
212
|
1. Import `useThemeUtils` hook from "@bigbinary/neeto-themes-frontend"
|
|
@@ -209,7 +228,11 @@ for step-by-step instructions to develop the frontend package.
|
|
|
209
228
|
|
|
210
229
|
`neeto-themes-nano` will inject custom css into your application as part of a
|
|
211
230
|
theme. You can provide `enabledFeatures={{ customCSS: false }}` in
|
|
212
|
-
`NeetoThemesBuilder` to manually
|
|
231
|
+
`NeetoThemesBuilder` to manually **hide** the CustomCSS feature.
|
|
232
|
+
You can pair it with `proFeatures={{ customCSS: true }}` to show it *disabled*
|
|
233
|
+
in non-enabled cases.
|
|
234
|
+
|
|
235
|
+
This feature
|
|
213
236
|
requires the initializer to be set with the additional property
|
|
214
237
|
`{ kind: "custom_css", key: "custom_css", default_value: "", parent_class: "neeto-form-eui" }`.
|
|
215
238
|
The `parent_class` key will be used as a parent to inject styles and for CSS
|
|
@@ -29,7 +29,11 @@
|
|
|
29
29
|
"images": "Images",
|
|
30
30
|
"name": "Name",
|
|
31
31
|
"left": "Left",
|
|
32
|
-
"logo": "Logo"
|
|
32
|
+
"logo": "Logo",
|
|
33
|
+
"proFeature": {
|
|
34
|
+
"title": "PRO feature",
|
|
35
|
+
"description": "This is a PRO feature. Please upgrade to a PRO plan to use this feature."
|
|
36
|
+
}
|
|
33
37
|
},
|
|
34
38
|
"buttons": {
|
|
35
39
|
"saveChanges": "Save changes",
|
|
@@ -271,7 +271,9 @@ var Card$2 = function Card(_ref) {
|
|
|
271
271
|
name = _ref.name,
|
|
272
272
|
className = _ref.className,
|
|
273
273
|
helpPopoverProps = _ref.helpPopoverProps,
|
|
274
|
-
required = _ref.required
|
|
274
|
+
required = _ref.required,
|
|
275
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
276
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
|
|
275
277
|
var _useConfigStore = useConfigStore(function (store) {
|
|
276
278
|
return {
|
|
277
279
|
accordionOpenState: store["accordionOpenState"],
|
|
@@ -286,10 +288,12 @@ var Card$2 = function Card(_ref) {
|
|
|
286
288
|
"data-cy": "theme-".concat(hyphenate(title), "-properties"),
|
|
287
289
|
className: classnames("neeto-themes-nano-section neeto-ui-border-gray-200 border-b pt-2 transition-all duration-300 last:border-none", className, {
|
|
288
290
|
"pb-2": !accordionOpenState[name],
|
|
289
|
-
"pb-3": accordionOpenState[name]
|
|
291
|
+
"pb-3": accordionOpenState[name],
|
|
292
|
+
"opacity-40": isDisabled
|
|
290
293
|
}),
|
|
291
294
|
children: [title && /*#__PURE__*/jsxs("button", {
|
|
292
295
|
className: "neeto-themes-nano-section__title flex w-full cursor-pointer items-center justify-between px-1 py-2 focus:outline-none",
|
|
296
|
+
disabled: isDisabled,
|
|
293
297
|
type: "button",
|
|
294
298
|
onClick: function onClick() {
|
|
295
299
|
return setAccordionOpenState(_objectSpread$4(_objectSpread$4({}, accordionOpenState), {}, _defineProperty({}, name, !accordionOpenState[name])));
|
|
@@ -353,7 +357,9 @@ var buildPathname = function buildPathname(route) {
|
|
|
353
357
|
|
|
354
358
|
var CustomCSS = function CustomCSS(_ref) {
|
|
355
359
|
var onEditCSSClick = _ref.onEditCSSClick,
|
|
356
|
-
currentScreen = _ref.currentScreen
|
|
360
|
+
currentScreen = _ref.currentScreen,
|
|
361
|
+
isEnabled = _ref.isEnabled,
|
|
362
|
+
isProFeature = _ref.isProFeature;
|
|
357
363
|
var _useTranslation = useTranslation(),
|
|
358
364
|
t = _useTranslation.t;
|
|
359
365
|
var _useFormikContext = useFormikContext(),
|
|
@@ -374,7 +380,7 @@ var CustomCSS = function CustomCSS(_ref) {
|
|
|
374
380
|
var customCSS = findBy({
|
|
375
381
|
kind: "custom_css"
|
|
376
382
|
}, values.properties);
|
|
377
|
-
if (!customCSS) return null;
|
|
383
|
+
if (!customCSS || !isEnabled && !isProFeature) return null;
|
|
378
384
|
var parentElementClass = findBy({
|
|
379
385
|
kind: "custom_css"
|
|
380
386
|
}, themePropertiesSchema).parentClass;
|
|
@@ -403,10 +409,14 @@ var CustomCSS = function CustomCSS(_ref) {
|
|
|
403
409
|
className: "neeto-themes-sidebar__custom-css-wrapper",
|
|
404
410
|
id: "css-editor",
|
|
405
411
|
children: /*#__PURE__*/jsx(Card$2, {
|
|
406
|
-
|
|
412
|
+
isDisabled: !isEnabled,
|
|
407
413
|
name: "customcss",
|
|
414
|
+
helpPopoverProps: isEnabled ? customCssHelpPopoverProps : {
|
|
415
|
+
title: t("neetoThemes.common.proFeature.title"),
|
|
416
|
+
description: t("neetoThemes.common.proFeature.description")
|
|
417
|
+
},
|
|
408
418
|
title: isCustomCssScreen ? "" : t("neetoThemes.build.leftSideBar.themes.customCSS"),
|
|
409
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
419
|
+
children: isEnabled && /*#__PURE__*/jsxs("div", {
|
|
410
420
|
className: "w-full",
|
|
411
421
|
children: [/*#__PURE__*/jsx("div", {
|
|
412
422
|
className: "neeto-themes-sidebar__custom-css-editor-header w-full justify-end gap-1 rounded-b-none p-2",
|
|
@@ -1305,14 +1315,16 @@ var Customize = function Customize(_ref) {
|
|
|
1305
1315
|
entityType: store["entityType"],
|
|
1306
1316
|
isFetchingSchema: store["isFetchingSchema"],
|
|
1307
1317
|
helpPopoverProps: store["helpPopoverProps"],
|
|
1308
|
-
enabledFeatures: store["enabledFeatures"]
|
|
1318
|
+
enabledFeatures: store["enabledFeatures"],
|
|
1319
|
+
proFeatures: store["proFeatures"]
|
|
1309
1320
|
};
|
|
1310
1321
|
}, shallow),
|
|
1311
1322
|
themePropertiesSchema = _useConfigStore.themePropertiesSchema,
|
|
1312
1323
|
entityType = _useConfigStore.entityType,
|
|
1313
1324
|
isFetchingSchema = _useConfigStore.isFetchingSchema,
|
|
1314
1325
|
helpPopoverProps = _useConfigStore.helpPopoverProps,
|
|
1315
|
-
enabledFeatures = _useConfigStore.enabledFeatures
|
|
1326
|
+
enabledFeatures = _useConfigStore.enabledFeatures,
|
|
1327
|
+
proFeatures = _useConfigStore.proFeatures;
|
|
1316
1328
|
var _useParams = useParams(),
|
|
1317
1329
|
themeId = _useParams.themeId;
|
|
1318
1330
|
var _useThemeStore = useThemeStore(function (store) {
|
|
@@ -1447,9 +1459,11 @@ var Customize = function Customize(_ref) {
|
|
|
1447
1459
|
defaultImageSize: propertyDefaultSize || defaultImageSize,
|
|
1448
1460
|
key: key
|
|
1449
1461
|
}, "fixedAspectRatio", propertyFixedAspectRatio || fixedAspectRatio));
|
|
1450
|
-
}),
|
|
1462
|
+
}), /*#__PURE__*/jsx(CustomCSS, {
|
|
1451
1463
|
currentScreen: currentScreen,
|
|
1452
|
-
onEditCSSClick: onEditCSSClick
|
|
1464
|
+
onEditCSSClick: onEditCSSClick,
|
|
1465
|
+
isEnabled: enabledFeatures.customCSS,
|
|
1466
|
+
isProFeature: proFeatures.customCSS
|
|
1453
1467
|
}), /*#__PURE__*/jsxs("div", {
|
|
1454
1468
|
className: "neeto-ui-bg-gray-50 neeto-ui-border-gray-200 mt-2 flex flex-col space-y-2 border p-2",
|
|
1455
1469
|
children: [/*#__PURE__*/jsx(Tooltip, {
|
|
@@ -2334,7 +2348,9 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
2334
2348
|
_ref$enabledFeatures = _ref.enabledFeatures,
|
|
2335
2349
|
enabledFeatures = _ref$enabledFeatures === void 0 ? {
|
|
2336
2350
|
customCSS: true
|
|
2337
|
-
} : _ref$enabledFeatures
|
|
2351
|
+
} : _ref$enabledFeatures,
|
|
2352
|
+
_ref$proFeatures = _ref.proFeatures,
|
|
2353
|
+
proFeatures = _ref$proFeatures === void 0 ? {} : _ref$proFeatures;
|
|
2338
2354
|
var _useThemeStore = useThemeStore(function (store) {
|
|
2339
2355
|
return {
|
|
2340
2356
|
setThemeState: store["setThemeState"]
|
|
@@ -2366,7 +2382,8 @@ var NeetoThemesBuilder = function NeetoThemesBuilder(_ref) {
|
|
|
2366
2382
|
isTemplateThemesEnabled: isTemplateThemesEnabled,
|
|
2367
2383
|
helpDocUrl: helpDocUrl,
|
|
2368
2384
|
helpPopoverProps: helpPopoverProps,
|
|
2369
|
-
enabledFeatures: enabledFeatures
|
|
2385
|
+
enabledFeatures: enabledFeatures,
|
|
2386
|
+
proFeatures: proFeatures
|
|
2370
2387
|
});
|
|
2371
2388
|
}, []);
|
|
2372
2389
|
useEffect(function () {
|