@tager/admin-blog 0.3.24 → 0.3.25

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.
Files changed (62) hide show
  1. package/dist/index.esm.js +546 -278
  2. package/dist/index.umd.js +545 -275
  3. package/package.json +7 -5
  4. package/src/constants/scopes.ts +11 -0
  5. package/src/dev.ts +11 -42
  6. package/src/hooks/index.ts +3 -0
  7. package/src/hooks/useModuleConfig.ts +2 -2
  8. package/src/hooks/useStore.ts +8 -0
  9. package/src/hooks/useUserPermission.ts +16 -0
  10. package/src/hooks/useUserProfile.ts +13 -0
  11. package/src/locales/en.ts +10 -0
  12. package/src/locales/ru.ts +10 -0
  13. package/src/router/index.ts +39 -0
  14. package/src/services/requests.ts +17 -1
  15. package/src/store/index.ts +21 -0
  16. package/src/store/user.ts +109 -0
  17. package/src/typings/common.ts +1 -0
  18. package/src/typings/model.ts +23 -0
  19. package/src/utils/common.ts +23 -0
  20. package/src/views/App.vue +10 -2
  21. package/src/views/Categories/CategoryForm/CategoryForm.helpers.ts +19 -4
  22. package/src/views/Categories/CategoryForm/CategoryForm.vue +139 -66
  23. package/src/views/Categories/CategoryList/CategoryList.helpers.ts +30 -28
  24. package/src/views/Categories/CategoryList/CategoryList.vue +26 -11
  25. package/src/views/Categories/CategoryList/hooks/useAdvancedSearch.ts +1 -1
  26. package/src/views/Home.vue +1 -1
  27. package/src/views/Posts/PostForm/PostForm.helpers.ts +2 -5
  28. package/src/views/Posts/PostForm/PostForm.vue +4 -6
  29. package/src/views/Posts/PostList/PostList.helpers.ts +2 -7
  30. package/src/views/Posts/PostList/PostList.vue +84 -24
  31. package/src/views/Posts/PostList/hooks/useAdvancedSearch.ts +6 -5
  32. package/dist/constants/menu.d.ts +0 -5
  33. package/dist/constants/paths.d.ts +0 -14
  34. package/dist/constants/routes.d.ts +0 -5
  35. package/dist/dev.d.ts +0 -3
  36. package/dist/hooks/index.d.ts +0 -3
  37. package/dist/hooks/useBlogCategoryList.d.ts +0 -6
  38. package/dist/hooks/useBlogPostList.d.ts +0 -6
  39. package/dist/hooks/useModuleConfig.d.ts +0 -6
  40. package/dist/locales/en.d.ts +0 -66
  41. package/dist/locales/ru.d.ts +0 -3
  42. package/dist/main.d.ts +0 -4
  43. package/dist/services/requests.d.ts +0 -67
  44. package/dist/typings/model.d.ts +0 -73
  45. package/dist/views/Categories/CategoryForm/CategoryForm.helpers.d.ts +0 -16
  46. package/dist/views/Categories/CategoryForm/CategoryForm.vue.d.ts +0 -86
  47. package/dist/views/Categories/CategoryForm/index.d.ts +0 -1
  48. package/dist/views/Categories/CategoryList/CategoryList.helpers.d.ts +0 -7
  49. package/dist/views/Categories/CategoryList/CategoryList.vue.d.ts +0 -57
  50. package/dist/views/Categories/CategoryList/hooks/index.d.ts +0 -1
  51. package/dist/views/Categories/CategoryList/hooks/useAdvancedSearch.d.ts +0 -16
  52. package/dist/views/Categories/CategoryList/index.d.ts +0 -1
  53. package/dist/views/Posts/PostForm/PostForm.helpers.d.ts +0 -27
  54. package/dist/views/Posts/PostForm/PostForm.vue.d.ts +0 -9380
  55. package/dist/views/Posts/PostForm/components/TabList/TabList.types.d.ts +0 -5
  56. package/dist/views/Posts/PostForm/components/TabList/index.d.ts +0 -2
  57. package/dist/views/Posts/PostForm/index.d.ts +0 -1
  58. package/dist/views/Posts/PostList/PostList.helpers.d.ts +0 -6
  59. package/dist/views/Posts/PostList/PostList.vue.d.ts +0 -63
  60. package/dist/views/Posts/PostList/hooks/index.d.ts +0 -1
  61. package/dist/views/Posts/PostList/hooks/useAdvancedSearch.d.ts +0 -22
  62. package/dist/views/Posts/PostList/index.d.ts +0 -1
package/dist/index.umd.js CHANGED
@@ -68,6 +68,14 @@
68
68
  blogCategoryWasSuccessfullyUpdated: 'Blog category was successfully updated',
69
69
  blogCategoryCreationWasFailed: 'Blog category creation was failed',
70
70
  blogCategoryUpdateWasFailed: 'Blog category update was failed',
71
+ clone: 'Clone',
72
+ cloneConfirm: 'Are you sure you want to clone the page?',
73
+ cloneSuccess: 'Page have copied successfully',
74
+ cloneFailure: 'Page copy failure',
75
+ tabs: {
76
+ common: 'Common',
77
+ seo: 'SEO',
78
+ },
71
79
  };
72
80
 
73
81
  const RU = {
@@ -134,6 +142,14 @@
134
142
  blogCategoryWasSuccessfullyUpdated: 'Категория блога успешно обновлена',
135
143
  blogCategoryCreationWasFailed: 'Не удалось создать категорию блога',
136
144
  blogCategoryUpdateWasFailed: 'Не удалось обновить категорию блога',
145
+ clone: 'Клонировать',
146
+ cloneConfirm: 'Вы уверены, что хотите создать копию страницы?',
147
+ cloneSuccess: 'Копия страницы успешно создана',
148
+ cloneFailure: 'Ошибка копирования страницы',
149
+ tabs: {
150
+ common: 'Общие',
151
+ seo: 'SEO',
152
+ },
137
153
  };
138
154
 
139
155
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -2507,6 +2523,9 @@
2507
2523
 
2508
2524
  var lodash_pick = pick;
2509
2525
 
2526
+ function getUserProfile() {
2527
+ return adminServices.request.get({ path: '/admin/self' });
2528
+ }
2510
2529
  /** Blog Posts */
2511
2530
  function getBlogPostList(params) {
2512
2531
  return adminServices.request.get({ path: '/admin/blog/posts', params });
@@ -2517,6 +2536,9 @@
2517
2536
  function getBlogPost(postId) {
2518
2537
  return adminServices.request.get({ path: `/admin/blog/posts/${postId}` });
2519
2538
  }
2539
+ function clonePost(postId) {
2540
+ return adminServices.request.post({ path: `/admin/blog/posts/${postId}/clone` });
2541
+ }
2520
2542
  function createBlogPost(payload) {
2521
2543
  return adminServices.request.post({ path: '/admin/blog/posts', body: payload });
2522
2544
  }
@@ -2618,6 +2640,117 @@
2618
2640
  return resource;
2619
2641
  }
2620
2642
 
2643
+ function useStore(context) {
2644
+ return context.root.$store;
2645
+ }
2646
+
2647
+ const Scope = {
2648
+ All: '*',
2649
+ OrdersCreate: 'orders.create',
2650
+ OrdersView: 'orders.view',
2651
+ OrdersDelete: 'orders.delete',
2652
+ RbacViewRoles: 'rbac.view-roles',
2653
+ RbacEditRoles: 'rbac.edit-roles',
2654
+ AdministratorsView: 'administrators.view',
2655
+ AdministratorsEdit: 'administrators.edit',
2656
+ AdministratorsDelete: 'administrators.delete',
2657
+ };
2658
+
2659
+ const USER_MODULE_NAMESPACE = 'user';
2660
+ const USER_MUTATION_TYPES = {
2661
+ PROFILE_REQUEST_STARTED: 'profileRequestStarted',
2662
+ PROFILE_REQUEST_FULFILLED: 'profileRequestFulfilled',
2663
+ PROFILE_REQUEST_REJECTED: 'profileRequestRejected',
2664
+ };
2665
+ const USER_ACTION_TYPES = {
2666
+ FETCH_USER_PROFILE: 'fetchUserProfile',
2667
+ };
2668
+ const userGetters = {
2669
+ userProfile(state) {
2670
+ return state.profile;
2671
+ },
2672
+ userScopes(state) {
2673
+ const roles = state.profile ? state.profile.roles : [];
2674
+ const scopes = [];
2675
+ roles.forEach((role) => {
2676
+ scopes.push(...role.scopes);
2677
+ });
2678
+ return scopes;
2679
+ },
2680
+ userHasPermission: (state, getters) => (scope) => {
2681
+ const scopes = getters.userScopes;
2682
+ if (scopes.includes(Scope.All))
2683
+ return true;
2684
+ return scopes.includes(scope);
2685
+ },
2686
+ };
2687
+ const userModule = {
2688
+ namespaced: true,
2689
+ state: {
2690
+ profile: null,
2691
+ status: adminServices.FETCH_STATUSES.IDLE,
2692
+ },
2693
+ mutations: {
2694
+ [USER_MUTATION_TYPES.PROFILE_REQUEST_STARTED](state) {
2695
+ if (state.status === adminServices.FETCH_STATUSES.IDLE) {
2696
+ state.status = adminServices.FETCH_STATUSES.LOADING;
2697
+ }
2698
+ },
2699
+ [USER_MUTATION_TYPES.PROFILE_REQUEST_FULFILLED](state, user) {
2700
+ if (state.status === adminServices.FETCH_STATUSES.LOADING) {
2701
+ state.status = adminServices.FETCH_STATUSES.SUCCESS;
2702
+ state.profile = user;
2703
+ }
2704
+ },
2705
+ [USER_MUTATION_TYPES.PROFILE_REQUEST_REJECTED](state) {
2706
+ if (state.status === adminServices.FETCH_STATUSES.LOADING) {
2707
+ state.status = adminServices.FETCH_STATUSES.FAILURE;
2708
+ state.profile = null;
2709
+ }
2710
+ },
2711
+ },
2712
+ actions: {
2713
+ [USER_ACTION_TYPES.FETCH_USER_PROFILE](store) {
2714
+ if (store.state.status !== adminServices.FETCH_STATUSES.IDLE)
2715
+ return;
2716
+ store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_STARTED);
2717
+ getUserProfile()
2718
+ .then((response) => {
2719
+ store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_FULFILLED, response.data);
2720
+ })
2721
+ .catch((error) => {
2722
+ console.error(error);
2723
+ store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_REJECTED);
2724
+ });
2725
+ },
2726
+ },
2727
+ getters: userGetters,
2728
+ };
2729
+
2730
+ function namespace(namespace, name) {
2731
+ return `${namespace}/${name}`;
2732
+ }
2733
+ function userNamespace(name) {
2734
+ return namespace(USER_MODULE_NAMESPACE, name);
2735
+ }
2736
+ function generateNumberArray(length) {
2737
+ return Array.from({ length }, (_, index) => index);
2738
+ }
2739
+ function getNameWithDepth(name, depth) {
2740
+ return (generateNumberArray(depth)
2741
+ .map(() => '—')
2742
+ .join(' ') +
2743
+ ' ' +
2744
+ name);
2745
+ }
2746
+
2747
+ function useUserPermission(context, scope) {
2748
+ const store = useStore(context);
2749
+ return compositionApi.computed(() => {
2750
+ return store.getters[userNamespace('userHasPermission')](scope);
2751
+ });
2752
+ }
2753
+
2621
2754
  function convertPostList(postList, selectedCategory, languages) {
2622
2755
  return postList
2623
2756
  .filter((post) => selectedCategory
@@ -2626,7 +2759,10 @@
2626
2759
  .map((post) => {
2627
2760
  if (languages.length > 0) {
2628
2761
  const foundLanguage = languages.find(({ id }) => id === post.language);
2629
- return Object.assign(Object.assign({}, post), { language: foundLanguage ? foundLanguage.name : post.language });
2762
+ return {
2763
+ ...post,
2764
+ language: foundLanguage ? foundLanguage.name : post.language,
2765
+ };
2630
2766
  }
2631
2767
  return post;
2632
2768
  });
@@ -2701,9 +2837,9 @@
2701
2837
  const dateFormat = (date) => date.split('-').reverse().join('.');
2702
2838
  function useAdvancedSearch({ context, categoryList, languageList, }) {
2703
2839
  /** Category **/
2704
- const categoryOptionList = compositionApi.computed(() => categoryList.value.map(({ id, name }) => ({
2840
+ const categoryOptionList = compositionApi.computed(() => categoryList.value.map(({ id, name, depth }) => ({
2705
2841
  value: String(id),
2706
- label: name,
2842
+ label: getNameWithDepth(name, depth),
2707
2843
  })));
2708
2844
  const initialCategoryFilter = compositionApi.computed(() => {
2709
2845
  const queryValue = adminUi.getFilterParamAsStringArray(context.root.$route.query, FilterTypes.CATEGORY);
@@ -2724,13 +2860,14 @@
2724
2860
  languageFilter.value = initialLanguageFilter.value;
2725
2861
  });
2726
2862
  /** From date **/
2727
- const initialFromDateFilter = compositionApi.computed(() => { var _a; return (_a = adminUi.getFilterParamAsString(context.root.$route.query, FilterTypes.FROM_DATE)) !== null && _a !== void 0 ? _a : ''; });
2863
+ const initialFromDateFilter = compositionApi.computed(() => adminUi.getFilterParamAsString(context.root.$route.query, FilterTypes.FROM_DATE) ?? '');
2728
2864
  const fromDateFilter = compositionApi.ref(initialFromDateFilter.value);
2729
2865
  compositionApi.watch(initialFromDateFilter, () => {
2730
2866
  fromDateFilter.value = initialFromDateFilter.value;
2731
2867
  });
2732
2868
  /** To date **/
2733
- const initialToDateFilter = compositionApi.computed(() => { var _a; return (_a = adminUi.getFilterParamAsString(context.root.$route.query, FilterTypes.TO_DATE)) !== null && _a !== void 0 ? _a : ''; });
2869
+ const initialToDateFilter = compositionApi.computed(() => adminUi.getFilterParamAsString(context.root.$route.query, FilterTypes.TO_DATE) ??
2870
+ '');
2734
2871
  const toDateFilter = compositionApi.ref(initialToDateFilter.value);
2735
2872
  compositionApi.watch(initialToDateFilter, () => {
2736
2873
  toDateFilter.value = initialToDateFilter.value;
@@ -2806,9 +2943,9 @@
2806
2943
  return categoryOptionList.value;
2807
2944
  }
2808
2945
  const selectedList = categoryList.value.filter(({ language }) => languageFilter.value.some(({ value }) => value === language));
2809
- return selectedList.map(({ id, name }) => ({
2946
+ return selectedList.map(({ id, name, depth }) => ({
2810
2947
  value: String(id),
2811
- label: name,
2948
+ label: getNameWithDepth(name, depth),
2812
2949
  }));
2813
2950
  });
2814
2951
  return {
@@ -2827,21 +2964,21 @@
2827
2964
  var script = compositionApi.defineComponent({
2828
2965
  name: 'BlogPostList',
2829
2966
  setup(props, context) {
2967
+ const { t } = adminUi.useTranslation(context);
2968
+ const canViewAdministrators = useUserPermission(context, Scope.AdministratorsView);
2830
2969
  const categoryId = compositionApi.computed(() => {
2831
- var _a;
2832
2970
  return Array.isArray(context.root.$route.query.category)
2833
- ? (_a = context.root.$route.query.category[0]) !== null && _a !== void 0 ? _a : '' : context.root.$route.query.category;
2971
+ ? context.root.$route.query.category[0] ?? ''
2972
+ : context.root.$route.query.category;
2834
2973
  });
2835
2974
  /** Fetch module config */
2836
2975
  const { data: moduleConfig, loading: isModuleConfigLoading, } = useModuleConfig({ context });
2837
- const languageList = compositionApi.computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []; });
2976
+ const languageList = compositionApi.computed(() => moduleConfig.value?.languages ?? []);
2838
2977
  /** Fetch category list */
2839
2978
  const { data: categoryList, loading: isCategoryListLoading, } = useBlogCategoryList({ context });
2840
- const selectedCategory = compositionApi.computed(() => {
2841
- var _a;
2842
- return categoryId.value
2843
- ? (_a = categoryList.value.find(({ id }) => String(id) === String(categoryId.value))) !== null && _a !== void 0 ? _a : null : null;
2844
- });
2979
+ const selectedCategory = compositionApi.computed(() => categoryId.value
2980
+ ? categoryList.value.find(({ id }) => String(id) === String(categoryId.value)) ?? null
2981
+ : null);
2845
2982
  const pageTitle = compositionApi.computed(() => {
2846
2983
  return selectedCategory.value
2847
2984
  ? `${context.root.$t('blog:postsByCategory')} "${selectedCategory.value.name}"`
@@ -2856,7 +2993,12 @@
2856
2993
  const isLangSpecific = compositionApi.computed(() => languageOptionList.value.length > 1);
2857
2994
  /** Fetch Post list */
2858
2995
  const { fetchEntityList: fetchPostList, isLoading: isPostLoading, rowData: postList, errorMessage, searchQuery, handleChange, pageNumber, pageCount, pageSize, } = adminUi.useDataTable({
2859
- fetchEntityList: (params) => getBlogPostList(Object.assign({ query: params.searchQuery, pageNumber: params.pageNumber, pageSize: params.pageSize }, filterParams.value)),
2996
+ fetchEntityList: (params) => getBlogPostList({
2997
+ query: params.searchQuery,
2998
+ pageNumber: params.pageNumber,
2999
+ pageSize: params.pageSize,
3000
+ ...filterParams.value,
3001
+ }),
2860
3002
  initialValue: [],
2861
3003
  context,
2862
3004
  resourceName: 'Blog post list',
@@ -2866,25 +3008,36 @@
2866
3008
  if (isModuleConfigLoading.value || isCategoryListLoading.value) {
2867
3009
  return;
2868
3010
  }
2869
- const newQuery = Object.assign(Object.assign({}, lodash_pick(context.root.$route.query, ['query', 'pageNumber'])), filterParams.value);
3011
+ const newQuery = {
3012
+ ...lodash_pick(context.root.$route.query, ['query', 'pageNumber']),
3013
+ ...filterParams.value,
3014
+ };
2870
3015
  if (!lodash_isequal(context.root.$route.query, newQuery)) {
2871
3016
  context.root.$router.replace({ query: newQuery });
2872
3017
  fetchPostList();
2873
3018
  }
2874
3019
  });
2875
- const displayedPostList = compositionApi.computed(() => {
2876
- var _a, _b;
2877
- return convertPostList(postList.value, selectedCategory.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []);
2878
- });
2879
- const { handleResourceDelete, isDeleting } = adminServices.useResourceDelete({
3020
+ const displayedPostList = compositionApi.computed(() => convertPostList(postList.value, selectedCategory.value, moduleConfig.value?.languages ?? []));
3021
+ const isRowDataLoading = compositionApi.computed(() => isCategoryListLoading.value ||
3022
+ isPostLoading.value ||
3023
+ isModuleConfigLoading.value);
3024
+ const { isDeleting, handleResourceDelete } = adminServices.useResourceDelete({
2880
3025
  deleteResource: deleteBlogPost,
2881
3026
  resourceName: 'Post',
2882
3027
  onSuccess: fetchPostList,
2883
3028
  context,
2884
3029
  });
2885
- const isRowDataLoading = compositionApi.computed(() => isCategoryListLoading.value ||
2886
- isPostLoading.value ||
2887
- isModuleConfigLoading.value);
3030
+ const { isCloning, handleResourceClone } = adminServices.useResourceClone({
3031
+ cloneResource: clonePost,
3032
+ confirmMessage: t('blog:cloneConfirm'),
3033
+ successMessage: t('blog:cloneSuccess'),
3034
+ failureMessage: t('blog:cloneFailure'),
3035
+ onSuccessRedirectTo: (data) => `/posts/${data.id}`,
3036
+ context,
3037
+ });
3038
+ function isBusy(postId) {
3039
+ return isDeleting(postId) || isCloning(postId) || isRowDataLoading.value;
3040
+ }
2888
3041
  const columnDefs = compositionApi.computed(() => getPostTableColumnDefs(moduleConfig.value, context.root.$t));
2889
3042
  return {
2890
3043
  columnDefs,
@@ -2911,6 +3064,11 @@
2911
3064
  toDateFilter,
2912
3065
  tags,
2913
3066
  tagRemovalHandler,
3067
+ // Permissions
3068
+ canViewAdministrators,
3069
+ // Clone
3070
+ handleResourceClone,
3071
+ isBusy,
2914
3072
  };
2915
3073
  },
2916
3074
  });
@@ -3055,11 +3213,13 @@
3055
3213
  attrs: {
3056
3214
  title: _vm.pageTitle,
3057
3215
  "header-buttons": [
3058
- {
3059
- text: _vm.$t("blog:newPost"),
3060
- href: _vm.getBlogPostFormUrl({ postId: "create" }),
3061
- },
3062
- ],
3216
+ _vm.canViewAdministrators
3217
+ ? {
3218
+ text: _vm.$t("blog:newPost"),
3219
+ href: _vm.getBlogPostFormUrl({ postId: "create" }),
3220
+ }
3221
+ : null,
3222
+ ].filter(Boolean),
3063
3223
  },
3064
3224
  scopedSlots: _vm._u([
3065
3225
  {
@@ -3196,37 +3356,61 @@
3196
3356
  fn: function (ref) {
3197
3357
  var row = ref.row;
3198
3358
  return [
3199
- _c(
3200
- "base-button",
3201
- {
3202
- attrs: {
3203
- variant: "icon",
3204
- title: _vm.$t("blog:edit"),
3205
- disabled: _vm.isDeleting(row.id),
3206
- href: _vm.getBlogPostFormUrl({ postId: row.id }),
3207
- },
3208
- },
3209
- [_c("svg-icon", { attrs: { name: "edit" } })],
3210
- 1
3211
- ),
3359
+ _vm.canViewAdministrators
3360
+ ? _c(
3361
+ "base-button",
3362
+ {
3363
+ attrs: {
3364
+ variant: "icon",
3365
+ title: _vm.$t("blog:edit"),
3366
+ disabled: _vm.isBusy(row.id),
3367
+ href: _vm.getBlogPostFormUrl({
3368
+ postId: row.id,
3369
+ }),
3370
+ },
3371
+ },
3372
+ [_c("svg-icon", { attrs: { name: "edit" } })],
3373
+ 1
3374
+ )
3375
+ : _vm._e(),
3212
3376
  _vm._v(" "),
3213
3377
  _c(
3214
3378
  "base-button",
3215
3379
  {
3216
3380
  attrs: {
3217
3381
  variant: "icon",
3218
- title: _vm.$t("blog:remove"),
3219
- disabled: _vm.isDeleting(row.id),
3382
+ title: _vm.$t("blog:clone"),
3383
+ disabled: _vm.isBusy(row.id),
3220
3384
  },
3221
3385
  on: {
3222
3386
  click: function ($event) {
3223
- return _vm.handleResourceDelete(row.id)
3387
+ return _vm.handleResourceClone(row.id)
3224
3388
  },
3225
3389
  },
3226
3390
  },
3227
- [_c("svg-icon", { attrs: { name: "delete" } })],
3391
+ [_c("svg-icon", { attrs: { name: "contentCopy" } })],
3228
3392
  1
3229
3393
  ),
3394
+ _vm._v(" "),
3395
+ _vm.canViewAdministrators
3396
+ ? _c(
3397
+ "base-button",
3398
+ {
3399
+ attrs: {
3400
+ variant: "icon",
3401
+ title: _vm.$t("blog:remove"),
3402
+ disabled: _vm.isBusy(row.id),
3403
+ },
3404
+ on: {
3405
+ click: function ($event) {
3406
+ return _vm.handleResourceDelete(row.id)
3407
+ },
3408
+ },
3409
+ },
3410
+ [_c("svg-icon", { attrs: { name: "delete" } })],
3411
+ 1
3412
+ )
3413
+ : _vm._e(),
3230
3414
  ]
3231
3415
  },
3232
3416
  },
@@ -3245,11 +3429,11 @@
3245
3429
  /* style */
3246
3430
  const __vue_inject_styles__ = function (inject) {
3247
3431
  if (!inject) return
3248
- inject("data-v-4aed84bf_0", { source: ".filters[data-v-4aed84bf] {\n display: flex;\n margin: 0 -10px;\n}\n.filters[data-v-4aed84bf]:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter[data-v-4aed84bf] {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n.date-label[data-v-4aed84bf] {\n margin-bottom: 0.5rem;\n}\n.date-content[data-v-4aed84bf] {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n/*# sourceMappingURL=PostList.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-blog/tager-admin-blog/src/views/Posts/PostList/PostList.vue","PostList.vue"],"names":[],"mappings":"AAoRA;EACA,aAAA;EACA,eAAA;ACnRA;ADqRA;EACA,gBAAA;ACnRA;ADsRA;EACA,oBAAA;EACA,UAAA;EACA,SAAA;ACpRA;ADwRA;EACA,qBAAA;ACrRA;ADwRA;EACA,aAAA;EACA,qCAAA;EACA,gBAAA;ACrRA;;AAEA,uCAAuC","file":"PostList.vue","sourcesContent":["<template>\n <page\n :title=\"pageTitle\"\n :header-buttons=\"[\n {\n text: $t('blog:newPost'),\n href: getBlogPostFormUrl({ postId: 'create' }),\n },\n ]\"\n >\n <template v-slot:content>\n <data-table\n :column-defs=\"columnDefs\"\n :row-data=\"rowData\"\n :loading=\"isRowDataLoading\"\n :error-message=\"errorMessage\"\n :search-query=\"searchQuery\"\n :pagination=\"{\n pageNumber,\n pageCount,\n pageSize,\n disabled: isRowDataLoading,\n }\"\n data-table=\"blog-post\"\n @change=\"handleChange\"\n >\n <template v-slot:filters>\n <advanced-search :tags=\"tags\" @click:tag=\"tagRemovalHandler\">\n <div class=\"filters\">\n <form-field-multi-select\n v-model=\"categoryFilter\"\n :options=\"categoryOptionList\"\n name=\"categoryFilter\"\n :searchable=\"true\"\n :label=\"$t('blog:category')\"\n class=\"filter\"\n />\n\n <form-field-multi-select\n v-if=\"isLangSpecific\"\n v-model=\"languageFilter\"\n :options=\"languageOptionList\"\n name=\"languageFilter\"\n :searchable=\"true\"\n :label=\"$t('blog:language')\"\n class=\"filter\"\n />\n\n <div class=\"filter\">\n <div class=\"date-label\">\n {{ $t('blog:dateOfPublication') }}\n </div>\n\n <div class=\"date-content\">\n <form-field\n v-model=\"fromDateFilter\"\n :label=\"$t('blog:From')\"\n name=\"fromDateFilter\"\n type=\"date\"\n :max=\"toDateFilter\"\n />\n\n <form-field\n v-model=\"toDateFilter\"\n :label=\"$t('blog:To')\"\n name=\"toDateFilter\"\n type=\"date\"\n :min=\"fromDateFilter\"\n />\n </div>\n </div>\n </div>\n </advanced-search>\n </template>\n\n <template v-slot:cell(actions)=\"{ row }\">\n <base-button\n variant=\"icon\"\n :title=\"$t('blog:edit')\"\n :disabled=\"isDeleting(row.id)\"\n :href=\"getBlogPostFormUrl({ postId: row.id })\"\n >\n <svg-icon name=\"edit\"></svg-icon>\n </base-button>\n <base-button\n variant=\"icon\"\n :title=\"$t('blog:remove')\"\n :disabled=\"isDeleting(row.id)\"\n @click=\"handleResourceDelete(row.id)\"\n >\n <svg-icon name=\"delete\"></svg-icon>\n </base-button>\n </template>\n </data-table>\n </template>\n </page>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent, watch } from '@vue/composition-api';\nimport isEqual from 'lodash.isequal';\nimport pick from 'lodash.pick';\n\nimport { ColumnDefinition, useDataTable } from '@tager/admin-ui';\nimport { Nullable, useResourceDelete } from '@tager/admin-services';\n\nimport { Category, Language, PostShort } from '../../../typings/model';\nimport { deleteBlogPost, getBlogPostList } from '../../../services/requests';\nimport { getBlogPostFormUrl } from '../../../constants/paths';\nimport { useModuleConfig, useBlogCategoryList } from '../../../hooks';\n\nimport { convertPostList, getPostTableColumnDefs } from './PostList.helpers';\nimport { useAdvancedSearch } from './hooks';\n\nexport default defineComponent({\n name: 'BlogPostList',\n setup(props, context) {\n const categoryId = computed<string>(() => {\n return Array.isArray(context.root.$route.query.category)\n ? context.root.$route.query.category[0] ?? ''\n : context.root.$route.query.category;\n });\n\n /** Fetch module config */\n const {\n data: moduleConfig,\n loading: isModuleConfigLoading,\n } = useModuleConfig({ context });\n\n const languageList = computed<Language[]>(\n () => moduleConfig.value?.languages ?? []\n );\n\n /** Fetch category list */\n const {\n data: categoryList,\n loading: isCategoryListLoading,\n } = useBlogCategoryList({ context });\n\n const selectedCategory = computed<Nullable<Category>>(() =>\n categoryId.value\n ? categoryList.value.find(\n ({ id }) => String(id) === String(categoryId.value)\n ) ?? null\n : null\n );\n\n const pageTitle = computed<string>(() => {\n return selectedCategory.value\n ? `${context.root.$t('blog:postsByCategory')} \"${\n selectedCategory.value.name\n }\"`\n : context.root.$t('blog:posts');\n });\n\n /** Advanced search **/\n\n const {\n categoryFilter,\n categoryOptionList,\n languageFilter,\n languageOptionList,\n fromDateFilter,\n toDateFilter,\n filterParams,\n tags,\n tagRemovalHandler,\n } = useAdvancedSearch({\n context,\n categoryList,\n languageList,\n });\n\n const isLangSpecific = computed<boolean>(\n () => languageOptionList.value.length > 1\n );\n\n /** Fetch Post list */\n const {\n fetchEntityList: fetchPostList,\n isLoading: isPostLoading,\n rowData: postList,\n errorMessage,\n searchQuery,\n handleChange,\n pageNumber,\n pageCount,\n pageSize,\n } = useDataTable<PostShort>({\n fetchEntityList: (params) =>\n getBlogPostList({\n query: params.searchQuery,\n pageNumber: params.pageNumber,\n pageSize: params.pageSize,\n ...filterParams.value,\n }),\n initialValue: [],\n context,\n resourceName: 'Blog post list',\n pageSize: 100,\n });\n\n watch(filterParams, () => {\n if (isModuleConfigLoading.value || isCategoryListLoading.value) {\n return;\n }\n\n const newQuery = {\n ...pick(context.root.$route.query, ['query', 'pageNumber']),\n ...filterParams.value,\n };\n\n if (!isEqual(context.root.$route.query, newQuery)) {\n context.root.$router.replace({ query: newQuery });\n fetchPostList();\n }\n });\n\n const displayedPostList = computed<PostShort[]>(() =>\n convertPostList(\n postList.value,\n selectedCategory.value,\n moduleConfig.value?.languages ?? []\n )\n );\n\n const { handleResourceDelete, isDeleting } = useResourceDelete({\n deleteResource: deleteBlogPost,\n resourceName: 'Post',\n onSuccess: fetchPostList,\n context,\n });\n\n const isRowDataLoading = computed<boolean>(\n () =>\n isCategoryListLoading.value ||\n isPostLoading.value ||\n isModuleConfigLoading.value\n );\n\n const columnDefs = computed<ColumnDefinition<PostShort>[]>(() =>\n getPostTableColumnDefs(moduleConfig.value, context.root.$t)\n );\n\n return {\n columnDefs,\n rowData: displayedPostList,\n handleResourceDelete,\n isDeleting,\n categoryList,\n isRowDataLoading,\n errorMessage,\n getBlogPostFormUrl,\n pageTitle,\n searchQuery,\n handleChange,\n pageNumber,\n pageCount,\n pageSize,\n\n // Advanced search\n categoryFilter,\n categoryOptionList,\n isLangSpecific,\n languageFilter,\n languageOptionList,\n fromDateFilter,\n toDateFilter,\n tags,\n tagRemovalHandler,\n };\n },\n});\n</script>\n\n<style scoped lang=\"scss\">\n.filters {\n display: flex;\n margin: 0 -10px;\n\n &:not(:first-child) {\n margin-top: 10px;\n }\n\n .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n }\n}\n\n.date-label {\n margin-bottom: 0.5rem;\n}\n\n.date-content {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n</style>\n",".filters {\n display: flex;\n margin: 0 -10px;\n}\n.filters:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n\n.date-label {\n margin-bottom: 0.5rem;\n}\n\n.date-content {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n/*# sourceMappingURL=PostList.vue.map */"]}, media: undefined });
3432
+ inject("data-v-7a3e00a4_0", { source: ".filters[data-v-7a3e00a4] {\n display: flex;\n margin: 0 -10px;\n}\n.filters[data-v-7a3e00a4]:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter[data-v-7a3e00a4] {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n.date-label[data-v-7a3e00a4] {\n margin-bottom: 0.5rem;\n}\n.date-content[data-v-7a3e00a4] {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n/*# sourceMappingURL=PostList.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-blog/tager-admin-blog/src/views/Posts/PostList/PostList.vue","PostList.vue"],"names":[],"mappings":"AAgVA;EACA,aAAA;EACA,eAAA;AC/UA;ADiVA;EACA,gBAAA;AC/UA;ADkVA;EACA,oBAAA;EACA,UAAA;EACA,SAAA;AChVA;ADoVA;EACA,qBAAA;ACjVA;ADoVA;EACA,aAAA;EACA,qCAAA;EACA,gBAAA;ACjVA;;AAEA,uCAAuC","file":"PostList.vue","sourcesContent":["<template>\n <page\n :title=\"pageTitle\"\n :header-buttons=\"\n [\n canViewAdministrators\n ? {\n text: $t('blog:newPost'),\n href: getBlogPostFormUrl({ postId: 'create' }),\n }\n : null,\n ].filter(Boolean)\n \"\n >\n <template v-slot:content>\n <data-table\n :column-defs=\"columnDefs\"\n :row-data=\"rowData\"\n :loading=\"isRowDataLoading\"\n :error-message=\"errorMessage\"\n :search-query=\"searchQuery\"\n :pagination=\"{\n pageNumber,\n pageCount,\n pageSize,\n disabled: isRowDataLoading,\n }\"\n data-table=\"blog-post\"\n @change=\"handleChange\"\n >\n <template v-slot:filters>\n <advanced-search :tags=\"tags\" @click:tag=\"tagRemovalHandler\">\n <div class=\"filters\">\n <form-field-multi-select\n v-model=\"categoryFilter\"\n :options=\"categoryOptionList\"\n name=\"categoryFilter\"\n :searchable=\"true\"\n :label=\"$t('blog:category')\"\n class=\"filter\"\n />\n\n <form-field-multi-select\n v-if=\"isLangSpecific\"\n v-model=\"languageFilter\"\n :options=\"languageOptionList\"\n name=\"languageFilter\"\n :searchable=\"true\"\n :label=\"$t('blog:language')\"\n class=\"filter\"\n />\n\n <div class=\"filter\">\n <div class=\"date-label\">\n {{ $t('blog:dateOfPublication') }}\n </div>\n\n <div class=\"date-content\">\n <form-field\n v-model=\"fromDateFilter\"\n :label=\"$t('blog:From')\"\n name=\"fromDateFilter\"\n type=\"date\"\n :max=\"toDateFilter\"\n />\n\n <form-field\n v-model=\"toDateFilter\"\n :label=\"$t('blog:To')\"\n name=\"toDateFilter\"\n type=\"date\"\n :min=\"fromDateFilter\"\n />\n </div>\n </div>\n </div>\n </advanced-search>\n </template>\n\n <template v-slot:cell(actions)=\"{ row }\">\n <base-button\n v-if=\"canViewAdministrators\"\n variant=\"icon\"\n :title=\"$t('blog:edit')\"\n :disabled=\"isBusy(row.id)\"\n :href=\"getBlogPostFormUrl({ postId: row.id })\"\n >\n <svg-icon name=\"edit\" />\n </base-button>\n\n <base-button\n variant=\"icon\"\n :title=\"$t('blog:clone')\"\n :disabled=\"isBusy(row.id)\"\n @click=\"handleResourceClone(row.id)\"\n >\n <svg-icon name=\"contentCopy\" />\n </base-button>\n\n <base-button\n v-if=\"canViewAdministrators\"\n variant=\"icon\"\n :title=\"$t('blog:remove')\"\n :disabled=\"isBusy(row.id)\"\n @click=\"handleResourceDelete(row.id)\"\n >\n <svg-icon name=\"delete\" />\n </base-button>\n </template>\n </data-table>\n </template>\n </page>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent, watch } from '@vue/composition-api';\nimport isEqual from 'lodash.isequal';\nimport pick from 'lodash.pick';\n\nimport {\n ColumnDefinition,\n useDataTable,\n useTranslation,\n} from '@tager/admin-ui';\nimport {\n Nullable,\n useResourceClone,\n useResourceDelete,\n} from '@tager/admin-services';\n\nimport { Category, Language, PostFull, PostShort } from '@/typings/model';\nimport {\n clonePost,\n deleteBlogPost,\n getBlogPostList,\n} from '@/services/requests';\nimport { getBlogPostFormUrl } from '@/constants/paths';\nimport {\n useModuleConfig,\n useBlogCategoryList,\n useUserPermission,\n} from '@/hooks';\nimport { Scope } from '@/constants/scopes';\n\nimport { convertPostList, getPostTableColumnDefs } from './PostList.helpers';\nimport { useAdvancedSearch } from './hooks';\n\nexport default defineComponent({\n name: 'BlogPostList',\n setup(props, context) {\n const { t } = useTranslation(context);\n\n const canViewAdministrators = useUserPermission(\n context,\n Scope.AdministratorsView\n );\n\n const categoryId = computed<string>(() => {\n return Array.isArray(context.root.$route.query.category)\n ? context.root.$route.query.category[0] ?? ''\n : context.root.$route.query.category;\n });\n\n /** Fetch module config */\n const {\n data: moduleConfig,\n loading: isModuleConfigLoading,\n } = useModuleConfig({ context });\n\n const languageList = computed<Language[]>(\n () => moduleConfig.value?.languages ?? []\n );\n\n /** Fetch category list */\n const {\n data: categoryList,\n loading: isCategoryListLoading,\n } = useBlogCategoryList({ context });\n\n const selectedCategory = computed<Nullable<Category>>(() =>\n categoryId.value\n ? categoryList.value.find(\n ({ id }) => String(id) === String(categoryId.value)\n ) ?? null\n : null\n );\n\n const pageTitle = computed<string>(() => {\n return selectedCategory.value\n ? `${context.root.$t('blog:postsByCategory')} \"${\n selectedCategory.value.name\n }\"`\n : context.root.$t('blog:posts');\n });\n\n /** Advanced search **/\n\n const {\n categoryFilter,\n categoryOptionList,\n languageFilter,\n languageOptionList,\n fromDateFilter,\n toDateFilter,\n filterParams,\n tags,\n tagRemovalHandler,\n } = useAdvancedSearch({\n context,\n categoryList,\n languageList,\n });\n\n const isLangSpecific = computed<boolean>(\n () => languageOptionList.value.length > 1\n );\n\n /** Fetch Post list */\n const {\n fetchEntityList: fetchPostList,\n isLoading: isPostLoading,\n rowData: postList,\n errorMessage,\n searchQuery,\n handleChange,\n pageNumber,\n pageCount,\n pageSize,\n } = useDataTable<PostShort>({\n fetchEntityList: (params) =>\n getBlogPostList({\n query: params.searchQuery,\n pageNumber: params.pageNumber,\n pageSize: params.pageSize,\n ...filterParams.value,\n }),\n initialValue: [],\n context,\n resourceName: 'Blog post list',\n pageSize: 100,\n });\n\n watch(filterParams, () => {\n if (isModuleConfigLoading.value || isCategoryListLoading.value) {\n return;\n }\n\n const newQuery = {\n ...pick(context.root.$route.query, ['query', 'pageNumber']),\n ...filterParams.value,\n };\n\n if (!isEqual(context.root.$route.query, newQuery)) {\n context.root.$router.replace({ query: newQuery });\n fetchPostList();\n }\n });\n\n const displayedPostList = computed<PostShort[]>(() =>\n convertPostList(\n postList.value,\n selectedCategory.value,\n moduleConfig.value?.languages ?? []\n )\n );\n\n const isRowDataLoading = computed<boolean>(\n () =>\n isCategoryListLoading.value ||\n isPostLoading.value ||\n isModuleConfigLoading.value\n );\n\n const { isDeleting, handleResourceDelete } = useResourceDelete({\n deleteResource: deleteBlogPost,\n resourceName: 'Post',\n onSuccess: fetchPostList,\n context,\n });\n\n const { isCloning, handleResourceClone } = useResourceClone({\n cloneResource: clonePost,\n confirmMessage: t('blog:cloneConfirm'),\n successMessage: t('blog:cloneSuccess'),\n failureMessage: t('blog:cloneFailure'),\n onSuccessRedirectTo: (data: PostFull) => `/posts/${data.id}`,\n context,\n });\n\n function isBusy(postId: number): boolean {\n return isDeleting(postId) || isCloning(postId) || isRowDataLoading.value;\n }\n\n const columnDefs = computed<ColumnDefinition<PostShort>[]>(() =>\n getPostTableColumnDefs(moduleConfig.value, context.root.$t)\n );\n\n return {\n columnDefs,\n rowData: displayedPostList,\n handleResourceDelete,\n isDeleting,\n categoryList,\n isRowDataLoading,\n errorMessage,\n getBlogPostFormUrl,\n pageTitle,\n searchQuery,\n handleChange,\n pageNumber,\n pageCount,\n pageSize,\n\n // Advanced search\n categoryFilter,\n categoryOptionList,\n isLangSpecific,\n languageFilter,\n languageOptionList,\n fromDateFilter,\n toDateFilter,\n tags,\n tagRemovalHandler,\n\n // Permissions\n canViewAdministrators,\n\n // Clone\n handleResourceClone,\n isBusy,\n };\n },\n});\n</script>\n\n<style scoped lang=\"scss\">\n.filters {\n display: flex;\n margin: 0 -10px;\n\n &:not(:first-child) {\n margin-top: 10px;\n }\n\n .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n }\n}\n\n.date-label {\n margin-bottom: 0.5rem;\n}\n\n.date-content {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n</style>\n",".filters {\n display: flex;\n margin: 0 -10px;\n}\n.filters:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n\n.date-label {\n margin-bottom: 0.5rem;\n}\n\n.date-content {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n/*# sourceMappingURL=PostList.vue.map */"]}, media: undefined });
3249
3433
 
3250
3434
  };
3251
3435
  /* scoped */
3252
- const __vue_scope_id__ = "data-v-4aed84bf";
3436
+ const __vue_scope_id__ = "data-v-7a3e00a4";
3253
3437
  /* module identifier */
3254
3438
  const __vue_module_identifier__ = undefined;
3255
3439
  /* functional template */
@@ -3274,7 +3458,6 @@
3274
3458
  );
3275
3459
 
3276
3460
  function convertPostToFormValues(post, languageOptionList, postOptionList, additionalFieldList) {
3277
- var _a, _b;
3278
3461
  if (!post) {
3279
3462
  return {
3280
3463
  title: '',
@@ -3309,8 +3492,8 @@
3309
3492
  imageMobile: post.imageMobile
3310
3493
  ? { id: adminServices.createId(), file: post.imageMobile }
3311
3494
  : null,
3312
- pageTitle: (_a = post.pageTitle) !== null && _a !== void 0 ? _a : '',
3313
- pageDescription: (_b = post.pageDescription) !== null && _b !== void 0 ? _b : '',
3495
+ pageTitle: post.pageTitle ?? '',
3496
+ pageDescription: post.pageDescription ?? '',
3314
3497
  openGraphImage: post.openGraphImage
3315
3498
  ? { id: adminServices.createId(), file: post.openGraphImage }
3316
3499
  : null,
@@ -3319,32 +3502,31 @@
3319
3502
  value: category.id,
3320
3503
  label: category.name,
3321
3504
  })),
3322
- language: currentLangOption !== null && currentLangOption !== void 0 ? currentLangOption : null,
3505
+ language: currentLangOption ?? null,
3323
3506
  relatedPosts: selectedPostOptionList,
3324
3507
  tags: post.tags.join(','),
3325
3508
  additionalFields: additionalFieldList.map((fieldConfig, index) => {
3326
3509
  const postAdditionalField = post.additionalFields.find((item) => item.name === fieldConfig.name);
3327
- return adminDynamicField.universalFieldUtils.createFormField(fieldConfig, postAdditionalField === null || postAdditionalField === void 0 ? void 0 : postAdditionalField.value);
3510
+ return adminDynamicField.universalFieldUtils.createFormField(fieldConfig, postAdditionalField?.value);
3328
3511
  }),
3329
3512
  };
3330
3513
  }
3331
3514
  function convertFormValuesToCreationPayload(values) {
3332
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
3333
3515
  return {
3334
3516
  title: values.title,
3335
3517
  excerpt: values.excerpt,
3336
3518
  urlAlias: values.urlAlias,
3337
3519
  body: values.body,
3338
3520
  date: values.date,
3339
- coverImage: (_b = (_a = values.coverImage) === null || _a === void 0 ? void 0 : _a.file.id) !== null && _b !== void 0 ? _b : null,
3340
- image: (_d = (_c = values.image) === null || _c === void 0 ? void 0 : _c.file.id) !== null && _d !== void 0 ? _d : null,
3341
- imageMobile: (_f = (_e = values.imageMobile) === null || _e === void 0 ? void 0 : _e.file.id) !== null && _f !== void 0 ? _f : null,
3521
+ coverImage: values.coverImage?.file.id ?? null,
3522
+ image: values.image?.file.id ?? null,
3523
+ imageMobile: values.imageMobile?.file.id ?? null,
3342
3524
  pageTitle: values.pageTitle,
3343
3525
  pageDescription: values.pageDescription,
3344
- openGraphImage: (_h = (_g = values.openGraphImage) === null || _g === void 0 ? void 0 : _g.file.id) !== null && _h !== void 0 ? _h : null,
3526
+ openGraphImage: values.openGraphImage?.file.id ?? null,
3345
3527
  status: 'PUBLISHED',
3346
3528
  categories: values.categories.map((option) => option.value),
3347
- language: (_k = (_j = values.language) === null || _j === void 0 ? void 0 : _j.value) !== null && _k !== void 0 ? _k : null,
3529
+ language: values.language?.value ?? null,
3348
3530
  relatedPosts: values.relatedPosts.map((relatedPostOption) => relatedPostOption.value),
3349
3531
  tags: values.tags.split(',').filter((tag) => tag.trim().length > 0),
3350
3532
  additionalFields: values.additionalFields.map((field) => ({
@@ -3354,7 +3536,10 @@
3354
3536
  };
3355
3537
  }
3356
3538
  function convertFormValuesToUpdatePayload(values) {
3357
- return Object.assign(Object.assign({}, convertFormValuesToCreationPayload(values)), { urlAlias: values.urlAlias });
3539
+ return {
3540
+ ...convertFormValuesToCreationPayload(values),
3541
+ urlAlias: values.urlAlias,
3542
+ };
3358
3543
  }
3359
3544
  function convertCategoryListToOptions(categoryList, languageId) {
3360
3545
  return categoryList
@@ -3366,13 +3551,12 @@
3366
3551
  name: 'BlogPostForm',
3367
3552
  components: { DynamicField: adminDynamicField.DynamicField, ShortCodeConstructor: adminUi.ShortCodeConstructor, FormFooter: adminUi.FormFooter },
3368
3553
  setup(props, context) {
3369
- var _a, _b;
3370
3554
  const postId = compositionApi.computed(() => context.root.$route.params.postId);
3371
3555
  const isCreation = compositionApi.computed(() => postId.value === 'create');
3372
3556
  const urlAliasChanged = compositionApi.ref(false);
3373
3557
  /** Fetch module config */
3374
3558
  const { data: moduleConfig, loading: isModuleConfigLoading, } = useModuleConfig({ context });
3375
- const languageList = compositionApi.computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []; });
3559
+ const languageList = compositionApi.computed(() => moduleConfig.value?.languages ?? []);
3376
3560
  const languageOptionList = compositionApi.computed(() => languageList.value.map(({ id, name }) => ({
3377
3561
  value: id,
3378
3562
  label: name,
@@ -3402,18 +3586,17 @@
3402
3586
  context,
3403
3587
  });
3404
3588
  const postOptionList = compositionApi.computed(() => postList.value
3405
- .filter((relatedPost) => { var _a; return relatedPost.id !== ((_a = post.value) === null || _a === void 0 ? void 0 : _a.id); })
3589
+ .filter((relatedPost) => relatedPost.id !== post.value?.id)
3406
3590
  .map((post) => ({
3407
3591
  value: post.id,
3408
3592
  label: post.title,
3409
3593
  })));
3410
3594
  /** Form State */
3411
- const values = compositionApi.ref(convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : []));
3595
+ const values = compositionApi.ref(convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, moduleConfig.value?.fields ?? []));
3412
3596
  const errors = compositionApi.ref({});
3413
3597
  const isSubmitting = compositionApi.ref(false);
3414
3598
  compositionApi.watch([post, languageOptionList, postOptionList, moduleConfig], () => {
3415
- var _a, _b;
3416
- values.value = convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : []);
3599
+ values.value = convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, moduleConfig.value?.fields ?? []);
3417
3600
  });
3418
3601
  function submitForm(event) {
3419
3602
  isSubmitting.value = true;
@@ -3424,7 +3607,6 @@
3424
3607
  : updateBlogPost(postId.value, updateBody);
3425
3608
  requestPromise
3426
3609
  .then(({ data }) => {
3427
- var _a, _b;
3428
3610
  errors.value = {};
3429
3611
  if (event.type === 'create') {
3430
3612
  context.root.$router.push(getBlogPostFormUrl({ postId: String(data.id) }));
@@ -3438,7 +3620,7 @@
3438
3620
  }
3439
3621
  }
3440
3622
  if (event.type === 'create_create-another') {
3441
- values.value = convertPostToFormValues(null, languageOptionList.value, postOptionList.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : []);
3623
+ values.value = convertPostToFormValues(null, languageOptionList.value, postOptionList.value, moduleConfig.value?.fields ?? []);
3442
3624
  }
3443
3625
  context.root.$toast({
3444
3626
  variant: 'success',
@@ -3464,17 +3646,13 @@
3464
3646
  });
3465
3647
  }
3466
3648
  /** Category Options */
3467
- const categoryOptionList = compositionApi.computed(() => {
3468
- var _a, _b;
3469
- return convertCategoryListToOptions(categoryList.value, (_b = (_a = values.value.language) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null);
3470
- });
3649
+ const categoryOptionList = compositionApi.computed(() => convertCategoryListToOptions(categoryList.value, values.value.language?.value ?? null));
3471
3650
  compositionApi.watch([categoryOptionList, moduleConfig], () => {
3472
- var _a;
3473
3651
  function isOptionExist(selectedCategoryOption) {
3474
3652
  return categoryOptionList.value.some((option) => option.value === selectedCategoryOption.value);
3475
3653
  }
3476
3654
  if (isCreation.value) {
3477
- if ((_a = moduleConfig === null || moduleConfig === void 0 ? void 0 : moduleConfig.value) === null || _a === void 0 ? void 0 : _a.defaultCategories) {
3655
+ if (moduleConfig?.value?.defaultCategories) {
3478
3656
  const defaultIds = moduleConfig.value.defaultCategories.map((item) => item.id);
3479
3657
  values.value.categories = categoryOptionList.value.filter((item) => {
3480
3658
  return defaultIds.indexOf(item.value) !== -1;
@@ -3489,13 +3667,11 @@
3489
3667
  isPostListLoading.value ||
3490
3668
  isModuleConfigLoading.value);
3491
3669
  function getUploadAdapterOptions() {
3492
- var _a;
3493
- return { uploadScenario: (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fileScenarios.content };
3670
+ return { uploadScenario: moduleConfig.value?.fileScenarios.content };
3494
3671
  }
3495
3672
  const blogPagePath = compositionApi.computed(() => {
3496
- var _a, _b;
3497
3673
  const origin = process.env.VUE_APP_WEBSITE_URL || window.location.origin;
3498
- return origin + ((_b = (_a = post.value) === null || _a === void 0 ? void 0 : _a.urlTemplate) !== null && _b !== void 0 ? _b : '');
3674
+ return origin + (post.value?.urlTemplate ?? '');
3499
3675
  });
3500
3676
  const tabList = compositionApi.computed(() => {
3501
3677
  const hasErrors = adminUi.createTabErrorFinder(errors.value);
@@ -3970,7 +4146,10 @@
3970
4146
  return categoryList.map((category) => {
3971
4147
  if (languages.length > 0) {
3972
4148
  const foundLanguage = languages.find(({ id }) => category.language === id);
3973
- return Object.assign(Object.assign({}, category), { language: foundLanguage ? foundLanguage.name : category.language });
4149
+ return {
4150
+ ...category,
4151
+ language: foundLanguage ? foundLanguage.name : category.language,
4152
+ };
3974
4153
  }
3975
4154
  return category;
3976
4155
  });
@@ -3981,40 +4160,44 @@
3981
4160
  : false;
3982
4161
  const COLUMN_DEFS = [
3983
4162
  {
3984
- id: 2,
4163
+ id: 1,
3985
4164
  name: t('blog:name'),
3986
4165
  field: 'name',
3987
4166
  type: 'name',
3988
- format: ({ row }) => {
3989
- return {
3990
- adminLink: {
3991
- url: getBlogCategoryFormUrl({ categoryId: row.id }),
3992
- text: row.name,
3993
- },
3994
- websiteLink: {
3995
- url: [
3996
- process.env.VUE_APP_WEBSITE_URL || window.location.origin,
3997
- row.url,
3998
- ].join(''),
3999
- text: row.url,
4000
- },
4001
- paramList: row.isDefault
4002
- ? [{ name: t('blog:defaultCategory'), value: t('blog:yes') }]
4003
- : [],
4004
- };
4167
+ format: ({ row }) => ({
4168
+ adminLink: {
4169
+ url: getBlogCategoryFormUrl({ categoryId: row.id }),
4170
+ text: getNameWithDepth(row.name, row.depth),
4171
+ },
4172
+ paramList: row.isDefault
4173
+ ? [{ name: t('blog:defaultCategory'), value: t('blog:yes') }]
4174
+ : [],
4175
+ }),
4176
+ },
4177
+ {
4178
+ id: 2,
4179
+ name: t('pages:path'),
4180
+ field: 'path',
4181
+ type: 'link',
4182
+ format: ({ row }) => ({
4183
+ url: `${adminServices.getWebsiteOrigin()}${row.url}`,
4184
+ text: row.url,
4185
+ }),
4186
+ options: {
4187
+ shouldOpenNewTab: true,
4005
4188
  },
4006
4189
  },
4007
4190
  isLangSpecific
4008
- ? { id: 4, name: t('blog:language'), field: 'language' }
4191
+ ? { id: 3, name: t('blog:language'), field: 'language' }
4009
4192
  : null,
4010
4193
  {
4011
- id: 3,
4194
+ id: 4,
4012
4195
  name: t('blog:posts'),
4013
4196
  field: 'linkToPosts',
4014
4197
  style: { whiteSpace: 'nowrap', width: '130px' },
4015
4198
  },
4016
4199
  {
4017
- id: 4,
4200
+ id: 5,
4018
4201
  name: t('blog:actions'),
4019
4202
  field: 'actions',
4020
4203
  style: { whiteSpace: 'nowrap', width: '205px' },
@@ -4074,32 +4257,40 @@
4074
4257
  var script$2 = compositionApi.defineComponent({
4075
4258
  name: 'BlogCategoryList',
4076
4259
  setup(props, context) {
4260
+ const canViewAdministrators = useUserPermission(context, Scope.AdministratorsView);
4077
4261
  /** Fetch module config */
4078
4262
  const { data: moduleConfig, loading: isModuleConfigLoading, } = useModuleConfig({ context });
4079
- const languageList = compositionApi.computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []; });
4263
+ const languageList = compositionApi.computed(() => moduleConfig.value?.languages ?? []);
4080
4264
  /** Advanced search **/
4081
4265
  const { languageFilter, languageOptionList, filterParams, tags, tagRemovalHandler, } = useAdvancedSearch$1({ context, languageList });
4082
4266
  const isLangSpecific = compositionApi.computed(() => languageOptionList.value.length > 1);
4083
4267
  /** Fetch category list */
4084
4268
  const { fetchEntityList: fetchCategoryList, isLoading: isCategoryListLoading, rowData: categoryList, errorMessage, searchQuery, handleChange, pageNumber, pageCount, pageSize, } = adminUi.useDataTable({
4085
- fetchEntityList: (params) => getBlogCategoryList(Object.assign({ query: params.searchQuery, pageNumber: params.pageNumber, pageSize: params.pageSize }, filterParams.value)),
4269
+ fetchEntityList: (params) => getBlogCategoryList({
4270
+ query: params.searchQuery,
4271
+ pageNumber: params.pageNumber,
4272
+ pageSize: params.pageSize,
4273
+ ...filterParams.value,
4274
+ }),
4086
4275
  initialValue: [],
4087
4276
  context,
4088
4277
  resourceName: 'Blog category list',
4089
4278
  pageSize: 100,
4090
4279
  });
4091
4280
  compositionApi.watch(filterParams, () => {
4092
- var _a;
4093
4281
  if (isModuleConfigLoading.value || isCategoryListLoading.value) {
4094
4282
  return;
4095
4283
  }
4096
- const newQuery = Object.assign(Object.assign({}, filterParams.value), { query: ((_a = context.root.$route.query.query) !== null && _a !== void 0 ? _a : '') });
4284
+ const newQuery = {
4285
+ ...filterParams.value,
4286
+ query: (context.root.$route.query.query ?? ''),
4287
+ };
4097
4288
  if (!lodash_isequal(context.root.$route.query, newQuery)) {
4098
4289
  context.root.$router.replace({ query: newQuery });
4099
4290
  fetchCategoryList();
4100
4291
  }
4101
4292
  });
4102
- const { handleResourceDelete: handleCategoryDelete, isDeleting, } = adminServices.useResourceDelete({
4293
+ const { isDeleting, handleResourceDelete: handleCategoryDelete, } = adminServices.useResourceDelete({
4103
4294
  deleteResource: deleteBlogCategory,
4104
4295
  resourceName: 'Post',
4105
4296
  onSuccess: fetchCategoryList,
@@ -4144,6 +4335,8 @@
4144
4335
  languageOptionList,
4145
4336
  tags,
4146
4337
  tagRemovalHandler,
4338
+ // Permissions
4339
+ canViewAdministrators,
4147
4340
  };
4148
4341
  },
4149
4342
  });
@@ -4160,11 +4353,13 @@
4160
4353
  attrs: {
4161
4354
  title: _vm.$t("blog:blogCategories"),
4162
4355
  "header-buttons": [
4163
- {
4164
- text: _vm.$t("blog:newCategory"),
4165
- href: _vm.getBlogCategoryFormUrl({ categoryId: "create" }),
4166
- },
4167
- ],
4356
+ _vm.canViewAdministrators
4357
+ ? {
4358
+ text: _vm.$t("blog:newCategory"),
4359
+ href: _vm.getBlogCategoryFormUrl({ categoryId: "create" }),
4360
+ }
4361
+ : null,
4362
+ ].filter(Boolean),
4168
4363
  },
4169
4364
  scopedSlots: _vm._u([
4170
4365
  {
@@ -4262,21 +4457,23 @@
4262
4457
  var row = ref.row;
4263
4458
  var rowIndex = ref.rowIndex;
4264
4459
  return [
4265
- _c(
4266
- "base-button",
4267
- {
4268
- attrs: {
4269
- variant: "icon",
4270
- title: _vm.$t("blog:edit"),
4271
- disabled: _vm.isDeleting(row.id),
4272
- href: _vm.getBlogCategoryFormUrl({
4273
- categoryId: row.id,
4274
- }),
4275
- },
4276
- },
4277
- [_c("svg-icon", { attrs: { name: "edit" } })],
4278
- 1
4279
- ),
4460
+ _vm.canViewAdministrators
4461
+ ? _c(
4462
+ "base-button",
4463
+ {
4464
+ attrs: {
4465
+ variant: "icon",
4466
+ title: _vm.$t("blog:edit"),
4467
+ disabled: _vm.isDeleting(row.id),
4468
+ href: _vm.getBlogCategoryFormUrl({
4469
+ categoryId: row.id,
4470
+ }),
4471
+ },
4472
+ },
4473
+ [_c("svg-icon", { attrs: { name: "edit" } })],
4474
+ 1
4475
+ )
4476
+ : _vm._e(),
4280
4477
  _vm._v(" "),
4281
4478
  _c(
4282
4479
  "base-button",
@@ -4316,24 +4513,27 @@
4316
4513
  1
4317
4514
  ),
4318
4515
  _vm._v(" "),
4319
- _c(
4320
- "base-button",
4321
- {
4322
- attrs: {
4323
- variant: "icon",
4324
- title: _vm.$t("blog:remove"),
4325
- disabled:
4326
- _vm.isDeleting(row.id) || row.postsCount > 0,
4327
- },
4328
- on: {
4329
- click: function ($event) {
4330
- return _vm.handleCategoryDelete(row.id)
4516
+ _vm.canViewAdministrators
4517
+ ? _c(
4518
+ "base-button",
4519
+ {
4520
+ attrs: {
4521
+ variant: "icon",
4522
+ title: _vm.$t("blog:remove"),
4523
+ disabled:
4524
+ _vm.isDeleting(row.id) ||
4525
+ row.postsCount > 0,
4526
+ },
4527
+ on: {
4528
+ click: function ($event) {
4529
+ return _vm.handleCategoryDelete(row.id)
4530
+ },
4531
+ },
4331
4532
  },
4332
- },
4333
- },
4334
- [_c("svg-icon", { attrs: { name: "delete" } })],
4335
- 1
4336
- ),
4533
+ [_c("svg-icon", { attrs: { name: "delete" } })],
4534
+ 1
4535
+ )
4536
+ : _vm._e(),
4337
4537
  ]
4338
4538
  },
4339
4539
  },
@@ -4382,57 +4582,66 @@
4382
4582
  );
4383
4583
 
4384
4584
  function convertCategoryToFormValues(category, languageOptionList) {
4385
- var _a, _b;
4386
- const currentLangOption = languageOptionList.find(({ value }) => value === (category === null || category === void 0 ? void 0 : category.language));
4585
+ const currentLangOption = languageOptionList.find(({ value }) => value === category?.language);
4387
4586
  if (!category) {
4388
4587
  return {
4389
4588
  name: '',
4390
4589
  isDefault: false,
4391
4590
  pageTitle: '',
4392
4591
  pageDescription: '',
4592
+ openGraphTitle: '',
4593
+ openGraphDescription: '',
4594
+ pageKeywords: '',
4393
4595
  openGraphImage: null,
4394
4596
  urlAlias: '',
4395
- language: currentLangOption !== null && currentLangOption !== void 0 ? currentLangOption : null,
4597
+ language: currentLangOption ?? null,
4396
4598
  };
4397
4599
  }
4398
4600
  return {
4399
4601
  name: category.name,
4400
4602
  isDefault: category.isDefault,
4401
- pageTitle: (_a = category.pageTitle) !== null && _a !== void 0 ? _a : '',
4402
- pageDescription: (_b = category.pageDescription) !== null && _b !== void 0 ? _b : '',
4603
+ pageTitle: category.pageTitle ?? '',
4604
+ pageDescription: category.pageDescription ?? '',
4605
+ pageKeywords: category.pageKeywords ?? '',
4606
+ openGraphTitle: category.openGraphTitle ?? '',
4607
+ openGraphDescription: category.openGraphDescription ?? '',
4403
4608
  openGraphImage: category.openGraphImage
4404
4609
  ? { id: adminServices.createId(), file: category.openGraphImage }
4405
4610
  : null,
4406
4611
  urlAlias: category.urlAlias,
4407
- language: currentLangOption !== null && currentLangOption !== void 0 ? currentLangOption : null,
4612
+ language: currentLangOption ?? null,
4408
4613
  };
4409
4614
  }
4410
4615
  function convertCategoryFormValuesToCreationPayload(values) {
4411
- var _a, _b, _c, _d;
4412
4616
  return {
4413
4617
  name: values.name,
4414
4618
  isDefault: values.isDefault,
4415
4619
  pageTitle: values.pageTitle,
4416
4620
  pageDescription: values.pageDescription,
4417
- openGraphImage: (_b = (_a = values.openGraphImage) === null || _a === void 0 ? void 0 : _a.file.id) !== null && _b !== void 0 ? _b : null,
4418
- language: (_d = (_c = values.language) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : null,
4621
+ openGraphImage: values.openGraphImage?.file.id ?? null,
4622
+ language: values.language?.value ?? null,
4419
4623
  };
4420
4624
  }
4421
4625
  function convertCategoryFormValuesToUpdatePayload(values) {
4422
- return Object.assign(Object.assign({}, convertCategoryFormValuesToCreationPayload(values)), { urlAlias: values.urlAlias });
4626
+ return {
4627
+ ...convertCategoryFormValuesToCreationPayload(values),
4628
+ urlAlias: values.urlAlias,
4629
+ };
4423
4630
  }
4424
4631
 
4425
4632
  var script$3 = compositionApi.defineComponent({
4426
4633
  name: 'BlogCategoryForm',
4427
4634
  components: { FormFooter: adminUi.FormFooter },
4428
4635
  setup(props, context) {
4636
+ const { t } = adminUi.useTranslation(context);
4429
4637
  const categoryId = compositionApi.computed(() => context.root.$route.params.categoryId);
4430
4638
  const isCreation = compositionApi.computed(() => categoryId.value === 'create');
4431
4639
  /** Fetch module config */
4432
4640
  const { data: moduleConfig, loading: isModuleConfigLoading, } = useModuleConfig({ context });
4433
- const languageList = compositionApi.computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []; });
4641
+ const languageList = compositionApi.computed(() => moduleConfig.value?.languages ?? []);
4434
4642
  const languageOptionList = compositionApi.computed(() => languageList.value.map(({ id, name }) => ({ value: id, label: name })));
4435
4643
  const isLangSpecific = compositionApi.computed(() => languageOptionList.value.length > 0);
4644
+ const imageScenario = compositionApi.computed(() => moduleConfig.value?.fileScenarios?.openGraph ?? null);
4436
4645
  /** Fetch Category */
4437
4646
  const [fetchCategory, { data: category, loading: isCategoryLoading },] = adminServices.useResource({
4438
4647
  fetchResource: () => getBlogCategory(categoryId.value),
@@ -4441,13 +4650,15 @@
4441
4650
  resourceName: 'Category',
4442
4651
  });
4443
4652
  compositionApi.onMounted(() => {
4444
- if (isCreation.value)
4653
+ if (isCreation.value) {
4445
4654
  return;
4655
+ }
4446
4656
  fetchCategory();
4447
4657
  });
4448
4658
  compositionApi.watch(categoryId, () => {
4449
- if (isCreation.value)
4659
+ if (isCreation.value) {
4450
4660
  return;
4661
+ }
4451
4662
  fetchCategory();
4452
4663
  });
4453
4664
  /** Form State */
@@ -4458,12 +4669,13 @@
4458
4669
  values.value = convertCategoryToFormValues(category.value, languageOptionList.value);
4459
4670
  });
4460
4671
  function submitForm(event) {
4461
- var _a, _b;
4462
4672
  isSubmitting.value = true;
4463
4673
  const creationBody = convertCategoryFormValuesToCreationPayload(values.value);
4464
4674
  const updateBody = convertCategoryFormValuesToUpdatePayload(values.value);
4465
4675
  if (!isCreation.value) {
4466
- updateBody.language = ((_a = category.value) === null || _a === void 0 ? void 0 : _a.language) ? (_b = category.value) === null || _b === void 0 ? void 0 : _b.language : null;
4676
+ updateBody.language = category.value?.language
4677
+ ? category.value?.language
4678
+ : null;
4467
4679
  }
4468
4680
  const requestPromise = isCreation.value
4469
4681
  ? createBlogCategory(creationBody)
@@ -4506,10 +4718,21 @@
4506
4718
  /** Misc */
4507
4719
  const isContentLoading = compositionApi.computed(() => isCategoryLoading.value || isModuleConfigLoading.value);
4508
4720
  const categoryPagePath = compositionApi.computed(() => {
4509
- var _a, _b;
4510
- const origin = process.env.VUE_APP_WEBSITE_URL || window.location.origin;
4511
- return origin + ((_b = (_a = category.value) === null || _a === void 0 ? void 0 : _a.urlTemplate) !== null && _b !== void 0 ? _b : '');
4721
+ return `${adminServices.getWebsiteOrigin()}${category.value?.urlTemplate ?? ''}`;
4512
4722
  });
4723
+ // SEO
4724
+ function handleSeoFieldGroupChange({ title, description, keywords, image, }) {
4725
+ values.value.pageTitle = title;
4726
+ values.value.pageDescription = description;
4727
+ values.value.pageKeywords = keywords;
4728
+ values.value.openGraphImage = image;
4729
+ }
4730
+ /** Tabs */
4731
+ const tabList = compositionApi.computed(() => [
4732
+ { id: 'common', label: t('blog:tabs.common') },
4733
+ { id: 'seo', label: t('blog:tabs.seo') },
4734
+ ]);
4735
+ const selectedTabId = compositionApi.ref(tabList.value[0].id);
4513
4736
  return {
4514
4737
  isCreation,
4515
4738
  isContentLoading: isContentLoading,
@@ -4522,6 +4745,12 @@
4522
4745
  submitForm,
4523
4746
  isSubmitting,
4524
4747
  moduleConfig,
4748
+ // SEO
4749
+ imageScenario,
4750
+ handleSeoFieldGroupChange,
4751
+ // Tabs
4752
+ tabList,
4753
+ selectedTabId,
4525
4754
  };
4526
4755
  },
4527
4756
  });
@@ -4558,123 +4787,162 @@
4558
4787
  },
4559
4788
  },
4560
4789
  [
4561
- _vm.isCreation && _vm.isLangSpecific
4562
- ? _c("form-field-select", {
4563
- attrs: {
4564
- name: "language",
4565
- label: _vm.$t("blog:language"),
4566
- options: _vm.languageOptionList,
4567
- error: _vm.errors.language,
4568
- },
4569
- model: {
4570
- value: _vm.values.language,
4571
- callback: function ($$v) {
4572
- _vm.$set(_vm.values, "language", $$v);
4790
+ _vm.isCreation
4791
+ ? [
4792
+ _vm.isLangSpecific
4793
+ ? _c("form-field-select", {
4794
+ attrs: {
4795
+ name: "language",
4796
+ label: _vm.$t("blog:language"),
4797
+ options: _vm.languageOptionList,
4798
+ error: _vm.errors.language,
4799
+ },
4800
+ model: {
4801
+ value: _vm.values.language,
4802
+ callback: function ($$v) {
4803
+ _vm.$set(_vm.values, "language", $$v);
4804
+ },
4805
+ expression: "values.language",
4806
+ },
4807
+ })
4808
+ : _vm._e(),
4809
+ _vm._v(" "),
4810
+ _c("form-field", {
4811
+ attrs: {
4812
+ name: "name",
4813
+ label: _vm.$t("blog:name"),
4814
+ error: _vm.errors.name,
4573
4815
  },
4574
- expression: "values.language",
4575
- },
4576
- })
4577
- : _vm._e(),
4578
- _vm._v(" "),
4579
- _c("form-field", {
4580
- attrs: {
4581
- name: "name",
4582
- label: _vm.$t("blog:name"),
4583
- error: _vm.errors.name,
4584
- },
4585
- model: {
4586
- value: _vm.values.name,
4587
- callback: function ($$v) {
4588
- _vm.$set(_vm.values, "name", $$v);
4589
- },
4590
- expression: "values.name",
4591
- },
4592
- }),
4593
- _vm._v(" "),
4594
- _c("form-field-checkbox", {
4595
- attrs: {
4596
- name: "isDefault",
4597
- label: _vm.$t("blog:defaultCategory"),
4598
- error: _vm.errors.isDefault,
4599
- },
4600
- model: {
4601
- value: _vm.values.isDefault,
4602
- callback: function ($$v) {
4603
- _vm.$set(_vm.values, "isDefault", $$v);
4604
- },
4605
- expression: "values.isDefault",
4606
- },
4607
- }),
4608
- _vm._v(" "),
4609
- !_vm.isCreation
4610
- ? _c("form-field-url-alias-input", {
4611
- attrs: {
4612
- id: "urlAlias",
4613
- name: "urlAlias",
4614
- label: _vm.$t("blog:URLAlias"),
4615
- "url-template": _vm.pagePath,
4616
- error: _vm.errors.urlAlias,
4617
- },
4618
- model: {
4619
- value: _vm.values.urlAlias,
4620
- callback: function ($$v) {
4621
- _vm.$set(_vm.values, "urlAlias", $$v);
4816
+ model: {
4817
+ value: _vm.values.name,
4818
+ callback: function ($$v) {
4819
+ _vm.$set(_vm.values, "name", $$v);
4820
+ },
4821
+ expression: "values.name",
4622
4822
  },
4623
- expression: "values.urlAlias",
4624
- },
4625
- })
4626
- : _vm._e(),
4627
- _vm._v(" "),
4628
- _c("form-field", {
4629
- attrs: {
4630
- name: "pageTitle",
4631
- label: _vm.$t("blog:pageTitle"),
4632
- error: _vm.errors.pageTitle,
4633
- },
4634
- model: {
4635
- value: _vm.values.pageTitle,
4636
- callback: function ($$v) {
4637
- _vm.$set(_vm.values, "pageTitle", $$v);
4638
- },
4639
- expression: "values.pageTitle",
4640
- },
4641
- }),
4642
- _vm._v(" "),
4643
- _c("form-field", {
4644
- attrs: {
4645
- name: "pageDescription",
4646
- label: _vm.$t("blog:pageDescription"),
4647
- type: "textarea",
4648
- error: _vm.errors.pageDescription,
4649
- },
4650
- model: {
4651
- value: _vm.values.pageDescription,
4652
- callback: function ($$v) {
4653
- _vm.$set(_vm.values, "pageDescription", $$v);
4654
- },
4655
- expression: "values.pageDescription",
4656
- },
4657
- }),
4658
- _vm._v(" "),
4659
- _c("form-field-file-input", {
4660
- attrs: {
4661
- label: _vm.$t("blog:openGraphImage"),
4662
- name: "openGraphImage",
4663
- "file-type": "image",
4664
- "image-scenario": _vm.moduleConfig
4665
- ? _vm.moduleConfig.fileScenarios.openGraph
4666
- : null,
4667
- },
4668
- model: {
4669
- value: _vm.values.openGraphImage,
4670
- callback: function ($$v) {
4671
- _vm.$set(_vm.values, "openGraphImage", $$v);
4672
- },
4673
- expression: "values.openGraphImage",
4674
- },
4675
- }),
4823
+ }),
4824
+ _vm._v(" "),
4825
+ _c("form-field-checkbox", {
4826
+ attrs: {
4827
+ name: "isDefault",
4828
+ label: _vm.$t("blog:defaultCategory"),
4829
+ error: _vm.errors.isDefault,
4830
+ },
4831
+ model: {
4832
+ value: _vm.values.isDefault,
4833
+ callback: function ($$v) {
4834
+ _vm.$set(_vm.values, "isDefault", $$v);
4835
+ },
4836
+ expression: "values.isDefault",
4837
+ },
4838
+ }),
4839
+ _vm._v(" "),
4840
+ _c("form-field-url-alias-input", {
4841
+ attrs: {
4842
+ id: "urlAlias",
4843
+ name: "urlAlias",
4844
+ label: _vm.$t("blog:URLAlias"),
4845
+ "url-template": _vm.pagePath,
4846
+ error: _vm.errors.urlAlias,
4847
+ },
4848
+ model: {
4849
+ value: _vm.values.urlAlias,
4850
+ callback: function ($$v) {
4851
+ _vm.$set(_vm.values, "urlAlias", $$v);
4852
+ },
4853
+ expression: "values.urlAlias",
4854
+ },
4855
+ }),
4856
+ ]
4857
+ : [
4858
+ _c("tab-list", {
4859
+ attrs: {
4860
+ "tab-list": _vm.tabList,
4861
+ "selected-tab-id": _vm.selectedTabId,
4862
+ },
4863
+ on: {
4864
+ "tab:update": function ($event) {
4865
+ _vm.selectedTabId = $event.tabId;
4866
+ },
4867
+ },
4868
+ }),
4869
+ _vm._v(" "),
4870
+ _vm.selectedTabId === "common"
4871
+ ? [
4872
+ _c("form-field", {
4873
+ attrs: {
4874
+ name: "name",
4875
+ label: _vm.$t("blog:name"),
4876
+ error: _vm.errors.name,
4877
+ },
4878
+ model: {
4879
+ value: _vm.values.name,
4880
+ callback: function ($$v) {
4881
+ _vm.$set(_vm.values, "name", $$v);
4882
+ },
4883
+ expression: "values.name",
4884
+ },
4885
+ }),
4886
+ _vm._v(" "),
4887
+ _c("form-field-checkbox", {
4888
+ attrs: {
4889
+ name: "isDefault",
4890
+ label: _vm.$t("blog:defaultCategory"),
4891
+ error: _vm.errors.isDefault,
4892
+ },
4893
+ model: {
4894
+ value: _vm.values.isDefault,
4895
+ callback: function ($$v) {
4896
+ _vm.$set(_vm.values, "isDefault", $$v);
4897
+ },
4898
+ expression: "values.isDefault",
4899
+ },
4900
+ }),
4901
+ _vm._v(" "),
4902
+ _c("form-field-url-alias-input", {
4903
+ attrs: {
4904
+ id: "urlAlias",
4905
+ name: "urlAlias",
4906
+ label: _vm.$t("blog:URLAlias"),
4907
+ "url-template": _vm.pagePath,
4908
+ error: _vm.errors.urlAlias,
4909
+ },
4910
+ model: {
4911
+ value: _vm.values.urlAlias,
4912
+ callback: function ($$v) {
4913
+ _vm.$set(_vm.values, "urlAlias", $$v);
4914
+ },
4915
+ expression: "values.urlAlias",
4916
+ },
4917
+ }),
4918
+ ]
4919
+ : _vm._e(),
4920
+ _vm._v(" "),
4921
+ _vm.selectedTabId === "seo"
4922
+ ? [
4923
+ _c("seo-field-group", {
4924
+ attrs: {
4925
+ title: _vm.values.pageTitle,
4926
+ "title-error-message": _vm.errors.pageTitle,
4927
+ description: _vm.values.pageDescription,
4928
+ "description-error-message":
4929
+ _vm.errors.pageDescription,
4930
+ "should-display-keywords": false,
4931
+ keywords: _vm.values.pageKeywords,
4932
+ "keywords-error-message":
4933
+ _vm.errors.pageKeywords,
4934
+ image: _vm.values.openGraphImage,
4935
+ "image-scenario": _vm.imageScenario,
4936
+ "image-error-message":
4937
+ _vm.errors.openGraphImage,
4938
+ },
4939
+ on: { change: _vm.handleSeoFieldGroupChange },
4940
+ }),
4941
+ ]
4942
+ : _vm._e(),
4943
+ ],
4676
4944
  ],
4677
- 1
4945
+ 2
4678
4946
  ),
4679
4947
  ]
4680
4948
  },
@@ -4807,6 +5075,7 @@
4807
5075
  exports.BLOG_POST_FORM_ROUTE = BLOG_POST_FORM_ROUTE;
4808
5076
  exports.BLOG_POST_LIST_ROUTE = BLOG_POST_LIST_ROUTE;
4809
5077
  exports.BLOG_ROUTE_PATHS = BLOG_ROUTE_PATHS;
5078
+ exports.clonePost = clonePost;
4810
5079
  exports.createBlogCategory = createBlogCategory;
4811
5080
  exports.createBlogPost = createBlogPost;
4812
5081
  exports.deleteBlogCategory = deleteBlogCategory;
@@ -4822,6 +5091,7 @@
4822
5091
  exports.getBlogPostFormUrl = getBlogPostFormUrl;
4823
5092
  exports.getBlogPostList = getBlogPostList;
4824
5093
  exports.getBlogPostListUrl = getBlogPostListUrl;
5094
+ exports.getUserProfile = getUserProfile;
4825
5095
  exports.moveBlogCategory = moveBlogCategory;
4826
5096
  exports.updateBlogCategory = updateBlogCategory;
4827
5097
  exports.updateBlogPost = updateBlogPost;