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/esm.js CHANGED
@@ -2221,6 +2221,20 @@ const AppColumnsDefaultTypes = [
2221
2221
  AppFormItemTypes.DESCRIPTION,
2222
2222
  ];
2223
2223
  const AppFormPrimaryList = [AppFormItemTypes.DESCRIPTION];
2224
+ const AppFormFixedList$1 = [
2225
+ ExtraAppFieldsItemViews.TITLE,
2226
+ ExtraAppFieldsItemViews.PUBLISHTO,
2227
+ ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS,
2228
+ ExtraAppFieldsItemViews.RECEIVEACOPY,
2229
+ ExtraAppFieldsItemViews.USER,
2230
+ ExtraAppFieldsItemViews.CREATIONDATE,
2231
+ ];
2232
+ const AppFormNoAsFieldList = [
2233
+ ExtraAppFieldsItemViews.USER,
2234
+ ExtraAppFieldsItemViews.TITLE,
2235
+ ];
2236
+ const AppFormFieldOnlyInView = [AppFormItemTypes.CODEHTML];
2237
+ const AppFormNonPrimaryList = AppFormNoAsFieldList.concat(AppFormFieldOnlyInView).concat(AppFormPrimaryList);
2224
2238
 
2225
2239
  var StatusType;
2226
2240
  (function (StatusType) {
@@ -2405,7 +2419,7 @@ function migrateJson(v1Json) {
2405
2419
  : { propertyOptions: _renderSelectOptions((_g = v1FormItemProperties.options) !== null && _g !== void 0 ? _g : []) } }, baseProperty));
2406
2420
  }
2407
2421
  if (v1FormItemProperties.code) {
2408
- v2Properties.push(Object.assign({ propertyType: AppFieldFormPropertyTypes.RICHTEXT, value: v1FormItemProperties.code.html || v1FormItemProperties.code.text || '' }, baseProperty));
2422
+ v2Properties.push(Object.assign({ propertyType: AppFieldFormPropertyTypes.RICHTEXT, value: { html: v1FormItemProperties.code.html, text: v1FormItemProperties.code.text } }, baseProperty));
2409
2423
  }
2410
2424
  if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'digits')) {
2411
2425
  v2Properties.push(Object.assign({ propertyType: AppFieldFormPropertyTypes.CHECKBOX, value: v1FormItemProperties.digits || false, checkBoxOptions: [{ label: 'APPSTUDIO_FormEditProps_Digits', value: v1FormItemProperties.digits }] }, baseProperty));
@@ -2485,6 +2499,7 @@ function migrateJson(v1Json) {
2485
2499
  }
2486
2500
 
2487
2501
  function InstalledAppStudioAdapter(serverApp, serverApps) {
2502
+ var _a, _b, _c, _d;
2488
2503
  const { version, dateCreation } = serverApp.manifest;
2489
2504
  const appTypeServer = serverApp.typeModel;
2490
2505
  const views = Object.assign({}, ...viewsList.map((view) => ({
@@ -2494,7 +2509,7 @@ function InstalledAppStudioAdapter(serverApp, serverApps) {
2494
2509
  idApp: serverApp.idApp,
2495
2510
  status: _formatStatus(serverApp),
2496
2511
  studioVersion: 2,
2497
- 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 })),
2512
+ 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 })),
2498
2513
  fields: [],
2499
2514
  views,
2500
2515
  installFor: serverApp.accessRightObjectList,
@@ -2563,19 +2578,19 @@ function appToXml(studioApp) {
2563
2578
  const { manifest, views, audience, installFor } = studioApp;
2564
2579
  return `<?xml version='1.0' encoding='utf-8'?>
2565
2580
  <Application>
2566
- ${createAppManifest(manifest, views, audience, installFor)}
2581
+ ${createAppManifest(manifest, views, audience, installFor, studioApp.idApp)}
2567
2582
  <Types>
2568
2583
  <objecttype
2569
2584
  label="${manifest.typeLabel}"
2570
2585
  labelPlural="${manifest.typeLabel}"
2571
2586
  labelLinkSingular="${manifest.typeLabel}"
2572
2587
  labelLinkPlural="${manifest.typeLabel}"
2573
- name="${manifest.appShortName}"
2588
+ name="${studioApp.idApp}"
2574
2589
  classImpl="JPBEContent"
2575
2590
  classCodeLocation="jamespot/jpro/objs/JPBEContent.php"
2576
2591
  cssClass="${manifest.cssClass.value}"
2577
2592
  cssColor="${manifest.cssColor}"
2578
- searchtab="${manifest.appShortName}"
2593
+ searchtab="${studioApp.idApp}"
2579
2594
  searchtablabel="${manifest.typeLabel}"
2580
2595
  buttonlabel="${manifest.typeLabel}"
2581
2596
  extends="article">
@@ -2586,14 +2601,14 @@ function appToXml(studioApp) {
2586
2601
  </Types>
2587
2602
  </Application>`;
2588
2603
  }
2589
- function createAppManifest(manifest, views, audience, installFor) {
2604
+ function createAppManifest(manifest, views, audience, installFor, idApp) {
2590
2605
  var _a;
2591
2606
  return `<Manifest>
2592
2607
  <ShowImport>true</ShowImport>
2593
- <AppShortName>${manifest.appShortName}</AppShortName>
2608
+ <AppShortName>${idApp}</AppShortName>
2594
2609
  <AppName>${manifest.appName}</AppName>
2595
2610
  <Description>${manifest.description}</Description>
2596
- <Version>${manifest.version}</Version>
2611
+ <Version>${manifest.version + 1}</Version>
2597
2612
  <ManifestVersion>1.0</ManifestVersion>
2598
2613
  <StudioVersion>2</StudioVersion>
2599
2614
  <DateCreation>${manifest.dateCreation.toString().split('T')[0]}</DateCreation>
@@ -2602,7 +2617,7 @@ function createAppManifest(manifest, views, audience, installFor) {
2602
2617
  <Categories>N.A.</Categories>
2603
2618
  <Editor>Jamespot</Editor>
2604
2619
  <EditorUrl>https://www.fr.jamespot.com/</EditorUrl>
2605
- <Type>${manifest.appShortName}</Type>
2620
+ <Type>${idApp}</Type>
2606
2621
  ${renderAppView(manifest.viewSolr, views.list)}
2607
2622
  ${renderAppSearch(views.filter)}
2608
2623
  ${renderAudience(audience, installFor)}
@@ -2610,7 +2625,7 @@ function createAppManifest(manifest, views, audience, installFor) {
2610
2625
  </Manifest>`;
2611
2626
  }
2612
2627
  function renderAppView(viewSolr, listView) {
2613
- if (viewSolr === 'solr') {
2628
+ if (viewSolr === STUDIO_VIEW.SOLR) {
2614
2629
  let xml = '<AppView>solr</AppView>';
2615
2630
  const formItemIdInList = [];
2616
2631
  Object.entries(listView).forEach(([fieldId, field]) => {
@@ -2631,10 +2646,20 @@ function renderAppSearch(searchView) {
2631
2646
  }
2632
2647
  function getAttrNameFormItem(field, fieldId) {
2633
2648
  function fieldType() {
2649
+ if (field.type === ExtraAppFieldsItemViews.TITLE)
2650
+ return 'title';
2651
+ if (field.type === ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS)
2652
+ return 'sendAlert';
2653
+ if (field.type === ExtraAppFieldsItemViews.RECEIVEACOPY)
2654
+ return 'alertAuthor';
2655
+ if (field.type === ExtraAppFieldsItemViews.PUBLISHTO)
2656
+ return 'publishTo';
2634
2657
  if (field.type === ExtraAppFieldsItemViews.USER)
2635
2658
  return 'idUser';
2636
2659
  if (field.type === ExtraAppFieldsItemViews.CREATIONDATE)
2637
2660
  return 'dateCreation';
2661
+ if (field.type === AppFormItemTypes.DESCRIPTION)
2662
+ return 'description';
2638
2663
  return field.type;
2639
2664
  }
2640
2665
  return (AppColumnsDefaultTypes.includes(field.type) ? fieldType() : uuid2Alpha(fieldId)).toLowerCase();
@@ -2659,7 +2684,7 @@ function renderCustomFields(fields) {
2659
2684
  const filteredCustomFields = customFields === null || customFields === void 0 ? void 0 : customFields.filter((field) => field.type !== AppFormItemTypes.IMAGE);
2660
2685
  if (filteredCustomFields.length === 0)
2661
2686
  return '';
2662
- const articlesTablesItems = filteredCustomFields.filter((f) => f.type !== AppFormItemTypes.TAGS);
2687
+ const articlesTablesItems = filteredCustomFields.filter((f) => f.type !== AppFormItemTypes.TAGS && !AppFormNonPrimaryList.includes(f.type));
2663
2688
  const linksTableItems = filteredCustomFields.filter((f) => f.type === AppFormItemTypes.TAGS);
2664
2689
  return `<custom>
2665
2690
  ${articlesTablesItems.length > 0
@@ -2668,7 +2693,7 @@ function renderCustomFields(fields) {
2668
2693
  </articlemstable>`
2669
2694
  : ''}
2670
2695
  ${linksTableItems.length > 0
2671
- ? `<linkstable>
2696
+ ? `<linkstable tablename="tag_links" sqlNameColumn="name" sqlSrcIdColumn="srcId" sqlSrcTypeColumn="srcType" sqlTargetIdColumn="targetId" sqlTargetTypeColumn="targetType">
2672
2697
  ${linksTableItems.map((field) => formItem2xml(field)).join('')}
2673
2698
  </linkstable>`
2674
2699
  : ''}</custom>`;
@@ -2686,7 +2711,7 @@ function formItem2xml(field) {
2686
2711
  solr.indexed="true"
2687
2712
  solr.stored="true"
2688
2713
  solr.searchable="true"
2689
- solr.multiValued="${field.type === AppFormItemTypes.TAGS || (field.type === AppFormItemTypes.CHECKBOX && true) || false}"
2714
+ solr.multiValued="${field.type === AppFormItemTypes.TAGS || field.type === AppFormItemTypes.CHECKBOX ? true : false}"
2690
2715
  teaser="true"
2691
2716
  display="true"
2692
2717
  >
@@ -2732,14 +2757,16 @@ function renderWidget(fieldType, fieldProperties) {
2732
2757
  </widget>`;
2733
2758
  }
2734
2759
  case AppFormItemTypes.RADIO: {
2735
- const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === AppFieldFormPropertyTypes.CHECKBOX);
2760
+ const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
2736
2761
  if (!optionEditor)
2737
2762
  return '';
2738
2763
  const options = optionEditor.value.propertyOptions;
2739
2764
  return `<widget form="radio">
2765
+ <options>
2740
2766
  ${options
2741
2767
  .map((option) => `<option value="${option.value}" label="${option.title}"></option>`)
2742
2768
  .join('')}
2769
+ </options>
2743
2770
  </widget>`;
2744
2771
  }
2745
2772
  case AppFormItemTypes.TOGGLE:
@@ -2761,14 +2788,14 @@ function renderWidget(fieldType, fieldProperties) {
2761
2788
  </widget>`;
2762
2789
  }
2763
2790
  case AppFormItemTypes.CHECKBOX: {
2764
- const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === AppFieldFormPropertyTypes.CHECKBOX);
2791
+ const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
2765
2792
  if (!optionEditor)
2766
2793
  return '';
2767
2794
  const options = optionEditor.value.propertyOptions;
2768
2795
  return `<widget form="checkbox" multiple="1">
2769
2796
  <options>
2770
2797
  ${options
2771
- .map((option) => `<option value="${option.value}" label="${option.label}"></option>`)
2798
+ .map((option) => `<option value="${option.value}" label="${option.title}"></option>`)
2772
2799
  .join('')}
2773
2800
  </options>
2774
2801
  </widget>`;
@@ -2776,7 +2803,7 @@ function renderWidget(fieldType, fieldProperties) {
2776
2803
  case AppFormItemTypes.ADDFILEATTACHMENT:
2777
2804
  return `<widget form="file" type="fileArticle" multiple="1"></widget>`;
2778
2805
  case AppFormItemTypes.URL:
2779
- return `<widget form="url"`;
2806
+ return `<widget form="url"></widget>`;
2780
2807
  case AppFormItemTypes.EMAIL:
2781
2808
  return `<widget form="email"></widget>`;
2782
2809
  case ExtraAppFieldsItemViews.USER:
@@ -2789,7 +2816,7 @@ function renderWidget(fieldType, fieldProperties) {
2789
2816
  <param key="namespace" value="jamespot"></param>
2790
2817
  <param key="types" value="user"></param>
2791
2818
  <param key="views" value="user"></param>
2792
- <param key="jcomplete-url" value="/?action=ajax&amp;group=autocomplete&amp;export function=user"></param>
2819
+ <param key="jcomplete-url" value="/?action=ajax&amp;group=autocomplete&amp;function=user"></param>
2793
2820
  </params>
2794
2821
  </widget>`;
2795
2822
  case AppFormItemTypes.CONTENTLINK: {
@@ -2803,7 +2830,7 @@ function renderWidget(fieldType, fieldProperties) {
2803
2830
  <param key="namespace" value="jamespot"></param>
2804
2831
  <param key="types" value="${type}"></param>
2805
2832
  <param key="views" value="article"></param>
2806
- <param key="jcomplete-url" value="/?action=ajax&amp;group=autocomplete&amp;export function=article&amp;types=[]=${type}"></param>
2833
+ <param key="jcomplete-url" value="/?action=ajax&amp;group=autocomplete&amp;function=article&amp;types=[]=${type}"></param>
2807
2834
  </params>
2808
2835
  </widget>`;
2809
2836
  }
@@ -2923,7 +2950,7 @@ function renderDisplays(studioApp) {
2923
2950
  }
2924
2951
  });
2925
2952
  if (toRet.length > 0) {
2926
- toRet = `<displays type="${studioApp.manifest.appShortName}">${toRet}</displays>`;
2953
+ toRet = `<displays type="${studioApp.idApp}">${toRet}</displays>`;
2927
2954
  }
2928
2955
  return toRet;
2929
2956
  }
@@ -2941,6 +2968,8 @@ function getDisplayName(fieldId, view) {
2941
2968
  return 'idUser';
2942
2969
  case ExtraAppFieldsItemViews.CREATIONDATE:
2943
2970
  return 'dateCreation';
2971
+ case AppFormItemTypes.DESCRIPTION:
2972
+ return 'description';
2944
2973
  default:
2945
2974
  return uuid2Alpha(fieldId);
2946
2975
  }
@@ -3013,14 +3042,7 @@ function renderDisplayAttr(fieldId, view) {
3013
3042
  else {
3014
3043
  switch (view.type) {
3015
3044
  case AppFormItemTypes.CODEHTML: {
3016
- const content = {
3017
- ref: attrName,
3018
- fixedValue: {
3019
- html: view.value.html,
3020
- text: view.value.text,
3021
- },
3022
- };
3023
- xml += `<html><![CDATA[ <!-- <JAMESPOT.STUDIO.CODEHTML>${JSON.stringify(content)}</JAMESPOT.STUDIO.CODEHTML><JAMESPOT.STUDIO.FIELD_POS></JAMESPOT.STUDIO.FIELD_POS>-->]]></html>`;
3045
+ xml += `<html><![CDATA[ <!-- <JAMESPOT.STUDIO.CODEHTML>${view.value}</JAMESPOT.STUDIO.CODEHTML><JAMESPOT.STUDIO.FIELD_POS>${view.pos}</JAMESPOT.STUDIO.FIELD_POS>-->${view.value}]]></html>`;
3024
3046
  break;
3025
3047
  }
3026
3048
  case AppFormItemTypes.IMAGE:
@@ -3080,7 +3102,7 @@ const saveCurrentStudioApp = createAsyncThunk('studio/saveCurrentStudioApp', (_,
3080
3102
  return rejectWithValue(error);
3081
3103
  }
3082
3104
  }));
3083
- const installStudioApp = createAsyncThunk('studio/installApp', (_, { extra, rejectWithValue, getState, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
3105
+ const installStudioApp = createAsyncThunk('studio/installApp', ({ callback }, { extra, rejectWithValue, getState, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
3084
3106
  const jApi = extra.jApi;
3085
3107
  const error = { error: 1, errorMsg: 'Error saving application' };
3086
3108
  const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
@@ -3090,7 +3112,9 @@ const installStudioApp = createAsyncThunk('studio/installApp', (_, { extra, reje
3090
3112
  const xml = appToXml(currentStudioApp);
3091
3113
  try {
3092
3114
  yield jApi.application.install(xml);
3093
- dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
3115
+ dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Installed' }));
3116
+ if (callback)
3117
+ callback();
3094
3118
  return;
3095
3119
  }
3096
3120
  catch (_) {
@@ -3219,7 +3243,7 @@ function createNewStudioApp$1({ author, appName }) {
3219
3243
  },
3220
3244
  version: 0.1,
3221
3245
  dateCreation: new Date().toISOString(),
3222
- viewSolr: 'solr',
3246
+ viewSolr: STUDIO_VIEW.SOLR,
3223
3247
  checkAccess: false,
3224
3248
  accessRightList: '',
3225
3249
  attrExposed: [],
@@ -3257,7 +3281,7 @@ const fetchStudioAppsList = createAsyncThunk('studio/appsList', (_, { extra, rej
3257
3281
  throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
3258
3282
  }
3259
3283
  }));
3260
- const createNewStudioApp = createAsyncThunk('studio/createApp', ({ appName }, { extra, dispatch, rejectWithValue, getState }) => __awaiter(void 0, void 0, void 0, function* () {
3284
+ const createNewStudioApp = createAsyncThunk('studio/createApp', ({ appName, callback }, { extra, dispatch, rejectWithValue, getState }) => __awaiter(void 0, void 0, void 0, function* () {
3261
3285
  var _a;
3262
3286
  const jApi = extra.jApi;
3263
3287
  const author = (_a = getState().userCurrent) === null || _a === void 0 ? void 0 : _a.uri;
@@ -3266,6 +3290,8 @@ const createNewStudioApp = createAsyncThunk('studio/createApp', ({ appName }, {
3266
3290
  yield jApi.application.save(newAppId, JSON.stringify(newStudioApp), 'saved');
3267
3291
  dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Created' }));
3268
3292
  dispatch(CurrentStudioAppSlice.actions.setCurrentApp(newStudioApp));
3293
+ if (callback)
3294
+ callback();
3269
3295
  return newStudioApp;
3270
3296
  }
3271
3297
  catch (_) {
@@ -3359,7 +3385,10 @@ const StudioAppsListSlice = createSlice({
3359
3385
  state.deleteStudioAppStatus = 'idle';
3360
3386
  }
3361
3387
  state.studioAppsList = state.studioAppsList.reduce((acc, app) => {
3362
- const { idApp, status } = action.meta.arg;
3388
+ const { idApp } = action.meta.arg;
3389
+ let { status } = action.meta.arg;
3390
+ if (status === APP_STATUS_TYPE.INSTALLED)
3391
+ status = APP_STATUS_TYPE.SUSPENDED;
3363
3392
  if (app.idApp === idApp && app.status === status)
3364
3393
  return acc;
3365
3394
  if (app.inWorkVersion &&
@@ -3478,5 +3507,5 @@ const studio = {
3478
3507
  },
3479
3508
  };
3480
3509
 
3481
- export { APP_STATUS_TYPE, AUDIENCE, Animations, AppColumnsDefaultTypes, AppFieldFormPropertyTypes, AppFormBannedFromViews$1 as AppFormBannedFromViews, AppFormItemTypes, AppFormPrimaryList, AppFormUniqueList, Application, AssetReservation, Bookmark, Comment, ExtraAppFieldsItemViews, Faq, MODE_EDIT, MODE_VIEW, MapExtraFieldsWithView, Model, Network, Platform, STUDIO_VIEW, Share, StatusType$1 as StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, animationsReducer, animationsSlice, deleteCurrentAnimation, fetchCurrentAnimation, fetchCurrentAnimationApp, jland, saveCurrentAnimation, slice, studio, toggleAnimationIsActive, updateWidgetContent, viewsList };
3510
+ export { APP_STATUS_TYPE, AUDIENCE, Animations, AppColumnsDefaultTypes, AppFieldFormPropertyTypes, AppFormBannedFromViews$1 as AppFormBannedFromViews, AppFormFieldOnlyInView, AppFormFixedList$1 as AppFormFixedList, AppFormItemTypes, AppFormNoAsFieldList, AppFormNonPrimaryList, AppFormPrimaryList, AppFormUniqueList, Application, AssetReservation, Bookmark, Comment, ExtraAppFieldsItemViews, Faq, MODE_EDIT, MODE_VIEW, MapExtraFieldsWithView, Model, Network, Platform, STUDIO_VIEW, Share, StatusType$1 as StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, animationsReducer, animationsSlice, deleteCurrentAnimation, fetchCurrentAnimation, fetchCurrentAnimationApp, jland, saveCurrentAnimation, slice, studio, toggleAnimationIsActive, updateWidgetContent, viewsList };
3482
3511
  //# sourceMappingURL=esm.js.map