jamespot-front-business 1.1.40 → 1.1.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs.js CHANGED
@@ -2229,6 +2229,20 @@ const AppColumnsDefaultTypes = [
2229
2229
  exports.AppFormItemTypes.DESCRIPTION,
2230
2230
  ];
2231
2231
  const AppFormPrimaryList = [exports.AppFormItemTypes.DESCRIPTION];
2232
+ const AppFormFixedList$1 = [
2233
+ exports.ExtraAppFieldsItemViews.TITLE,
2234
+ exports.ExtraAppFieldsItemViews.PUBLISHTO,
2235
+ exports.ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS,
2236
+ exports.ExtraAppFieldsItemViews.RECEIVEACOPY,
2237
+ exports.ExtraAppFieldsItemViews.USER,
2238
+ exports.ExtraAppFieldsItemViews.CREATIONDATE,
2239
+ ];
2240
+ const AppFormNoAsFieldList = [
2241
+ exports.ExtraAppFieldsItemViews.USER,
2242
+ exports.ExtraAppFieldsItemViews.TITLE,
2243
+ ];
2244
+ const AppFormFieldOnlyInView = [exports.AppFormItemTypes.CODEHTML];
2245
+ const AppFormNonPrimaryList = AppFormNoAsFieldList.concat(AppFormFieldOnlyInView).concat(AppFormPrimaryList);
2232
2246
 
2233
2247
  var StatusType;
2234
2248
  (function (StatusType) {
@@ -2413,7 +2427,7 @@ function migrateJson(v1Json) {
2413
2427
  : { propertyOptions: _renderSelectOptions((_g = v1FormItemProperties.options) !== null && _g !== void 0 ? _g : []) } }, baseProperty));
2414
2428
  }
2415
2429
  if (v1FormItemProperties.code) {
2416
- v2Properties.push(Object.assign({ propertyType: exports.AppFieldFormPropertyTypes.RICHTEXT, value: v1FormItemProperties.code.html || v1FormItemProperties.code.text || '' }, baseProperty));
2430
+ v2Properties.push(Object.assign({ propertyType: exports.AppFieldFormPropertyTypes.RICHTEXT, value: { html: v1FormItemProperties.code.html, text: v1FormItemProperties.code.text } }, baseProperty));
2417
2431
  }
2418
2432
  if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'digits')) {
2419
2433
  v2Properties.push(Object.assign({ propertyType: exports.AppFieldFormPropertyTypes.CHECKBOX, value: v1FormItemProperties.digits || false, checkBoxOptions: [{ label: 'APPSTUDIO_FormEditProps_Digits', value: v1FormItemProperties.digits }] }, baseProperty));
@@ -2493,6 +2507,7 @@ function migrateJson(v1Json) {
2493
2507
  }
2494
2508
 
2495
2509
  function InstalledAppStudioAdapter(serverApp, serverApps) {
2510
+ var _a, _b, _c, _d;
2496
2511
  const { version, dateCreation } = serverApp.manifest;
2497
2512
  const appTypeServer = serverApp.typeModel;
2498
2513
  const views = Object.assign({}, ...viewsList.map((view) => ({
@@ -2502,7 +2517,7 @@ function InstalledAppStudioAdapter(serverApp, serverApps) {
2502
2517
  idApp: serverApp.idApp,
2503
2518
  status: _formatStatus(serverApp),
2504
2519
  studioVersion: 2,
2505
- manifest: Object.assign({ appShortName: serverApp.name, appName: serverApp.label, description: serverApp.description, author: serverApp.author, cssColor: appTypeServer.cssColor, cssClass: { label: appTypeServer.cssClass, value: appTypeServer.cssClass }, version: version, dateCreation: dateCreation, checkAccess: serverApp.checkAccess, attrExposed: serverApp.attrExposed, viewSolr: serverApp.view, typeLabel: appTypeServer.typeLabel }, (serverApp.articlesCount && { articlesCount: serverApp.articlesCount })),
2520
+ manifest: Object.assign({ appShortName: serverApp.name, appName: serverApp.label, description: serverApp.description, author: serverApp.author, cssColor: (_a = appTypeServer.cssColor) !== null && _a !== void 0 ? _a : '#392994', cssClass: { label: (_b = appTypeServer.cssClass) !== null && _b !== void 0 ? _b : 'star', value: (_c = appTypeServer.cssClass) !== null && _c !== void 0 ? _c : 'star' }, version: version, dateCreation: dateCreation, checkAccess: serverApp.checkAccess, attrExposed: serverApp.attrExposed, viewSolr: serverApp.view, typeLabel: (_d = appTypeServer.typeLabel) !== null && _d !== void 0 ? _d : {} }, (serverApp.articlesCount && { articlesCount: serverApp.articlesCount })),
2506
2521
  fields: [],
2507
2522
  views,
2508
2523
  installFor: serverApp.accessRightObjectList,
@@ -2571,19 +2586,19 @@ function appToXml(studioApp) {
2571
2586
  const { manifest, views, audience, installFor } = studioApp;
2572
2587
  return `<?xml version='1.0' encoding='utf-8'?>
2573
2588
  <Application>
2574
- ${createAppManifest(manifest, views, audience, installFor)}
2589
+ ${createAppManifest(manifest, views, audience, installFor, studioApp.idApp)}
2575
2590
  <Types>
2576
2591
  <objecttype
2577
2592
  label="${manifest.typeLabel}"
2578
2593
  labelPlural="${manifest.typeLabel}"
2579
2594
  labelLinkSingular="${manifest.typeLabel}"
2580
2595
  labelLinkPlural="${manifest.typeLabel}"
2581
- name="${manifest.appShortName}"
2596
+ name="${studioApp.idApp}"
2582
2597
  classImpl="JPBEContent"
2583
2598
  classCodeLocation="jamespot/jpro/objs/JPBEContent.php"
2584
2599
  cssClass="${manifest.cssClass.value}"
2585
2600
  cssColor="${manifest.cssColor}"
2586
- searchtab="${manifest.appShortName}"
2601
+ searchtab="${studioApp.idApp}"
2587
2602
  searchtablabel="${manifest.typeLabel}"
2588
2603
  buttonlabel="${manifest.typeLabel}"
2589
2604
  extends="article">
@@ -2594,14 +2609,14 @@ function appToXml(studioApp) {
2594
2609
  </Types>
2595
2610
  </Application>`;
2596
2611
  }
2597
- function createAppManifest(manifest, views, audience, installFor) {
2612
+ function createAppManifest(manifest, views, audience, installFor, idApp) {
2598
2613
  var _a;
2599
2614
  return `<Manifest>
2600
2615
  <ShowImport>true</ShowImport>
2601
- <AppShortName>${manifest.appShortName}</AppShortName>
2616
+ <AppShortName>${idApp}</AppShortName>
2602
2617
  <AppName>${manifest.appName}</AppName>
2603
2618
  <Description>${manifest.description}</Description>
2604
- <Version>${manifest.version}</Version>
2619
+ <Version>${manifest.version + 1}</Version>
2605
2620
  <ManifestVersion>1.0</ManifestVersion>
2606
2621
  <StudioVersion>2</StudioVersion>
2607
2622
  <DateCreation>${manifest.dateCreation.toString().split('T')[0]}</DateCreation>
@@ -2610,7 +2625,7 @@ function createAppManifest(manifest, views, audience, installFor) {
2610
2625
  <Categories>N.A.</Categories>
2611
2626
  <Editor>Jamespot</Editor>
2612
2627
  <EditorUrl>https://www.fr.jamespot.com/</EditorUrl>
2613
- <Type>${manifest.appShortName}</Type>
2628
+ <Type>${idApp}</Type>
2614
2629
  ${renderAppView(manifest.viewSolr, views.list)}
2615
2630
  ${renderAppSearch(views.filter)}
2616
2631
  ${renderAudience(audience, installFor)}
@@ -2618,7 +2633,7 @@ function createAppManifest(manifest, views, audience, installFor) {
2618
2633
  </Manifest>`;
2619
2634
  }
2620
2635
  function renderAppView(viewSolr, listView) {
2621
- if (viewSolr === 'solr') {
2636
+ if (viewSolr === STUDIO_VIEW.SOLR) {
2622
2637
  let xml = '<AppView>solr</AppView>';
2623
2638
  const formItemIdInList = [];
2624
2639
  Object.entries(listView).forEach(([fieldId, field]) => {
@@ -2639,10 +2654,20 @@ function renderAppSearch(searchView) {
2639
2654
  }
2640
2655
  function getAttrNameFormItem(field, fieldId) {
2641
2656
  function fieldType() {
2657
+ if (field.type === exports.ExtraAppFieldsItemViews.TITLE)
2658
+ return 'title';
2659
+ if (field.type === exports.ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS)
2660
+ return 'sendAlert';
2661
+ if (field.type === exports.ExtraAppFieldsItemViews.RECEIVEACOPY)
2662
+ return 'alertAuthor';
2663
+ if (field.type === exports.ExtraAppFieldsItemViews.PUBLISHTO)
2664
+ return 'publishTo';
2642
2665
  if (field.type === exports.ExtraAppFieldsItemViews.USER)
2643
2666
  return 'idUser';
2644
2667
  if (field.type === exports.ExtraAppFieldsItemViews.CREATIONDATE)
2645
2668
  return 'dateCreation';
2669
+ if (field.type === exports.AppFormItemTypes.DESCRIPTION)
2670
+ return 'description';
2646
2671
  return field.type;
2647
2672
  }
2648
2673
  return (AppColumnsDefaultTypes.includes(field.type) ? fieldType() : uuid2Alpha(fieldId)).toLowerCase();
@@ -2667,7 +2692,7 @@ function renderCustomFields(fields) {
2667
2692
  const filteredCustomFields = customFields === null || customFields === void 0 ? void 0 : customFields.filter((field) => field.type !== exports.AppFormItemTypes.IMAGE);
2668
2693
  if (filteredCustomFields.length === 0)
2669
2694
  return '';
2670
- const articlesTablesItems = filteredCustomFields.filter((f) => f.type !== exports.AppFormItemTypes.TAGS);
2695
+ const articlesTablesItems = filteredCustomFields.filter((f) => f.type !== exports.AppFormItemTypes.TAGS && !AppFormNonPrimaryList.includes(f.type));
2671
2696
  const linksTableItems = filteredCustomFields.filter((f) => f.type === exports.AppFormItemTypes.TAGS);
2672
2697
  return `<custom>
2673
2698
  ${articlesTablesItems.length > 0
@@ -2676,7 +2701,7 @@ function renderCustomFields(fields) {
2676
2701
  </articlemstable>`
2677
2702
  : ''}
2678
2703
  ${linksTableItems.length > 0
2679
- ? `<linkstable>
2704
+ ? `<linkstable tablename="tag_links" sqlNameColumn="name" sqlSrcIdColumn="srcId" sqlSrcTypeColumn="srcType" sqlTargetIdColumn="targetId" sqlTargetTypeColumn="targetType">
2680
2705
  ${linksTableItems.map((field) => formItem2xml(field)).join('')}
2681
2706
  </linkstable>`
2682
2707
  : ''}</custom>`;
@@ -2694,7 +2719,7 @@ function formItem2xml(field) {
2694
2719
  solr.indexed="true"
2695
2720
  solr.stored="true"
2696
2721
  solr.searchable="true"
2697
- solr.multiValued="${field.type === exports.AppFormItemTypes.TAGS || (field.type === exports.AppFormItemTypes.CHECKBOX && true) || false}"
2722
+ solr.multiValued="${field.type === exports.AppFormItemTypes.TAGS || field.type === exports.AppFormItemTypes.CHECKBOX ? true : false}"
2698
2723
  teaser="true"
2699
2724
  display="true"
2700
2725
  >
@@ -2740,14 +2765,16 @@ function renderWidget(fieldType, fieldProperties) {
2740
2765
  </widget>`;
2741
2766
  }
2742
2767
  case exports.AppFormItemTypes.RADIO: {
2743
- const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === exports.AppFieldFormPropertyTypes.CHECKBOX);
2768
+ const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === exports.AppFieldFormPropertyTypes.OPTIONS_EDITOR);
2744
2769
  if (!optionEditor)
2745
2770
  return '';
2746
2771
  const options = optionEditor.value.propertyOptions;
2747
2772
  return `<widget form="radio">
2773
+ <options>
2748
2774
  ${options
2749
2775
  .map((option) => `<option value="${option.value}" label="${option.title}"></option>`)
2750
2776
  .join('')}
2777
+ </options>
2751
2778
  </widget>`;
2752
2779
  }
2753
2780
  case exports.AppFormItemTypes.TOGGLE:
@@ -2769,14 +2796,14 @@ function renderWidget(fieldType, fieldProperties) {
2769
2796
  </widget>`;
2770
2797
  }
2771
2798
  case exports.AppFormItemTypes.CHECKBOX: {
2772
- const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === exports.AppFieldFormPropertyTypes.CHECKBOX);
2799
+ const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === exports.AppFieldFormPropertyTypes.OPTIONS_EDITOR);
2773
2800
  if (!optionEditor)
2774
2801
  return '';
2775
2802
  const options = optionEditor.value.propertyOptions;
2776
2803
  return `<widget form="checkbox" multiple="1">
2777
2804
  <options>
2778
2805
  ${options
2779
- .map((option) => `<option value="${option.value}" label="${option.label}"></option>`)
2806
+ .map((option) => `<option value="${option.value}" label="${option.title}"></option>`)
2780
2807
  .join('')}
2781
2808
  </options>
2782
2809
  </widget>`;
@@ -2784,7 +2811,7 @@ function renderWidget(fieldType, fieldProperties) {
2784
2811
  case exports.AppFormItemTypes.ADDFILEATTACHMENT:
2785
2812
  return `<widget form="file" type="fileArticle" multiple="1"></widget>`;
2786
2813
  case exports.AppFormItemTypes.URL:
2787
- return `<widget form="url"`;
2814
+ return `<widget form="url"></widget>`;
2788
2815
  case exports.AppFormItemTypes.EMAIL:
2789
2816
  return `<widget form="email"></widget>`;
2790
2817
  case exports.ExtraAppFieldsItemViews.USER:
@@ -2797,7 +2824,7 @@ function renderWidget(fieldType, fieldProperties) {
2797
2824
  <param key="namespace" value="jamespot"></param>
2798
2825
  <param key="types" value="user"></param>
2799
2826
  <param key="views" value="user"></param>
2800
- <param key="jcomplete-url" value="/?action=ajax&amp;group=autocomplete&amp;export function=user"></param>
2827
+ <param key="jcomplete-url" value="/?action=ajax&amp;group=autocomplete&amp;function=user"></param>
2801
2828
  </params>
2802
2829
  </widget>`;
2803
2830
  case exports.AppFormItemTypes.CONTENTLINK: {
@@ -2811,7 +2838,7 @@ function renderWidget(fieldType, fieldProperties) {
2811
2838
  <param key="namespace" value="jamespot"></param>
2812
2839
  <param key="types" value="${type}"></param>
2813
2840
  <param key="views" value="article"></param>
2814
- <param key="jcomplete-url" value="/?action=ajax&amp;group=autocomplete&amp;export function=article&amp;types=[]=${type}"></param>
2841
+ <param key="jcomplete-url" value="/?action=ajax&amp;group=autocomplete&amp;function=article&amp;types=[]=${type}"></param>
2815
2842
  </params>
2816
2843
  </widget>`;
2817
2844
  }
@@ -2931,7 +2958,7 @@ function renderDisplays(studioApp) {
2931
2958
  }
2932
2959
  });
2933
2960
  if (toRet.length > 0) {
2934
- toRet = `<displays type="${studioApp.manifest.appShortName}">${toRet}</displays>`;
2961
+ toRet = `<displays type="${studioApp.idApp}">${toRet}</displays>`;
2935
2962
  }
2936
2963
  return toRet;
2937
2964
  }
@@ -2949,6 +2976,8 @@ function getDisplayName(fieldId, view) {
2949
2976
  return 'idUser';
2950
2977
  case exports.ExtraAppFieldsItemViews.CREATIONDATE:
2951
2978
  return 'dateCreation';
2979
+ case exports.AppFormItemTypes.DESCRIPTION:
2980
+ return 'description';
2952
2981
  default:
2953
2982
  return uuid2Alpha(fieldId);
2954
2983
  }
@@ -3021,14 +3050,7 @@ function renderDisplayAttr(fieldId, view) {
3021
3050
  else {
3022
3051
  switch (view.type) {
3023
3052
  case exports.AppFormItemTypes.CODEHTML: {
3024
- const content = {
3025
- ref: attrName,
3026
- fixedValue: {
3027
- html: view.value.html,
3028
- text: view.value.text,
3029
- },
3030
- };
3031
- xml += `<html><![CDATA[ <!-- <JAMESPOT.STUDIO.CODEHTML>${JSON.stringify(content)}</JAMESPOT.STUDIO.CODEHTML><JAMESPOT.STUDIO.FIELD_POS></JAMESPOT.STUDIO.FIELD_POS>-->]]></html>`;
3053
+ xml += `<html><![CDATA[ <!-- <JAMESPOT.STUDIO.CODEHTML>${view.value}</JAMESPOT.STUDIO.CODEHTML><JAMESPOT.STUDIO.FIELD_POS>${view.pos}</JAMESPOT.STUDIO.FIELD_POS>-->${view.value}]]></html>`;
3032
3054
  break;
3033
3055
  }
3034
3056
  case exports.AppFormItemTypes.IMAGE:
@@ -3088,7 +3110,7 @@ const saveCurrentStudioApp = toolkit.createAsyncThunk('studio/saveCurrentStudioA
3088
3110
  return rejectWithValue(error);
3089
3111
  }
3090
3112
  }));
3091
- const installStudioApp = toolkit.createAsyncThunk('studio/installApp', (_, { extra, rejectWithValue, getState, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
3113
+ const installStudioApp = toolkit.createAsyncThunk('studio/installApp', ({ callback }, { extra, rejectWithValue, getState, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
3092
3114
  const jApi = extra.jApi;
3093
3115
  const error = { error: 1, errorMsg: 'Error saving application' };
3094
3116
  const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
@@ -3098,7 +3120,9 @@ const installStudioApp = toolkit.createAsyncThunk('studio/installApp', (_, { ext
3098
3120
  const xml = appToXml(currentStudioApp);
3099
3121
  try {
3100
3122
  yield jApi.application.install(xml);
3101
- dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
3123
+ dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Installed' }));
3124
+ if (callback)
3125
+ callback();
3102
3126
  return;
3103
3127
  }
3104
3128
  catch (_) {
@@ -3227,7 +3251,7 @@ function createNewStudioApp$1({ author, appName }) {
3227
3251
  },
3228
3252
  version: 0.1,
3229
3253
  dateCreation: new Date().toISOString(),
3230
- viewSolr: 'solr',
3254
+ viewSolr: STUDIO_VIEW.SOLR,
3231
3255
  checkAccess: false,
3232
3256
  accessRightList: '',
3233
3257
  attrExposed: [],
@@ -3265,7 +3289,7 @@ const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (_, { ex
3265
3289
  throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
3266
3290
  }
3267
3291
  }));
3268
- const createNewStudioApp = toolkit.createAsyncThunk('studio/createApp', ({ appName }, { extra, dispatch, rejectWithValue, getState }) => __awaiter(void 0, void 0, void 0, function* () {
3292
+ const createNewStudioApp = toolkit.createAsyncThunk('studio/createApp', ({ appName, callback }, { extra, dispatch, rejectWithValue, getState }) => __awaiter(void 0, void 0, void 0, function* () {
3269
3293
  var _a;
3270
3294
  const jApi = extra.jApi;
3271
3295
  const author = (_a = getState().userCurrent) === null || _a === void 0 ? void 0 : _a.uri;
@@ -3274,6 +3298,8 @@ const createNewStudioApp = toolkit.createAsyncThunk('studio/createApp', ({ appNa
3274
3298
  yield jApi.application.save(newAppId, JSON.stringify(newStudioApp), 'saved');
3275
3299
  dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Created' }));
3276
3300
  dispatch(CurrentStudioAppSlice.actions.setCurrentApp(newStudioApp));
3301
+ if (callback)
3302
+ callback();
3277
3303
  return newStudioApp;
3278
3304
  }
3279
3305
  catch (_) {
@@ -3367,7 +3393,10 @@ const StudioAppsListSlice = toolkit.createSlice({
3367
3393
  state.deleteStudioAppStatus = 'idle';
3368
3394
  }
3369
3395
  state.studioAppsList = state.studioAppsList.reduce((acc, app) => {
3370
- const { idApp, status } = action.meta.arg;
3396
+ const { idApp } = action.meta.arg;
3397
+ let { status } = action.meta.arg;
3398
+ if (status === APP_STATUS_TYPE.INSTALLED)
3399
+ status = APP_STATUS_TYPE.SUSPENDED;
3371
3400
  if (app.idApp === idApp && app.status === status)
3372
3401
  return acc;
3373
3402
  if (app.inWorkVersion &&
@@ -3491,6 +3520,10 @@ exports.AUDIENCE = AUDIENCE;
3491
3520
  exports.Animations = Animations;
3492
3521
  exports.AppColumnsDefaultTypes = AppColumnsDefaultTypes;
3493
3522
  exports.AppFormBannedFromViews = AppFormBannedFromViews$1;
3523
+ exports.AppFormFieldOnlyInView = AppFormFieldOnlyInView;
3524
+ exports.AppFormFixedList = AppFormFixedList$1;
3525
+ exports.AppFormNoAsFieldList = AppFormNoAsFieldList;
3526
+ exports.AppFormNonPrimaryList = AppFormNonPrimaryList;
3494
3527
  exports.AppFormPrimaryList = AppFormPrimaryList;
3495
3528
  exports.AppFormUniqueList = AppFormUniqueList;
3496
3529
  exports.Application = Application;