jamespot-front-business 1.1.99 → 1.1.101

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
@@ -3679,6 +3679,14 @@ const ExtraAppFieldsItemViews = {
3679
3679
  RECEIVEACOPY: 'RECEIVEACOPY',
3680
3680
  CREATIONDATE: 'CREATIONDATE',
3681
3681
  };
3682
+ const ExtraAppFieldsItemName = {
3683
+ TITLE: 'title',
3684
+ USER: 'user',
3685
+ PUBLISHTO: 'publishTo',
3686
+ SENDALERTTOSUBSCRIBERS: 'sendAlert',
3687
+ RECEIVEACOPY: 'alertAuthor',
3688
+ CREATIONDATE: 'dateCreation',
3689
+ };
3682
3690
  const AppFieldFormPropertyTypes = {
3683
3691
  LABEL: 'label',
3684
3692
  DESCRIPTION: 'description',
@@ -4801,7 +4809,7 @@ const installedToV2ViewNames = {
4801
4809
  };
4802
4810
  const specialAttrName = ['title', 'alertAuthor', 'sendAlert'];
4803
4811
  const ignoredFields = ['edito'];
4804
- function updateViewsFromFields(clonedApp, appFields) {
4812
+ function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
4805
4813
  return Object.assign({}, ...viewsList.map((view) => {
4806
4814
  var _a, _b, _c, _d, _e, _f;
4807
4815
  const viewItems = {};
@@ -4813,7 +4821,7 @@ function updateViewsFromFields(clonedApp, appFields) {
4813
4821
  if (((_d = MapExtraFieldsWithView[view]) === null || _d === void 0 ? void 0 : _d.fixed) !== undefined) {
4814
4822
  viewMissingFixedFields = viewMissingFixedFields.concat((_f = (_e = MapExtraFieldsWithView[view]) === null || _e === void 0 ? void 0 : _e.fixed) !== null && _f !== void 0 ? _f : []);
4815
4823
  }
4816
- Object.entries(clonedApp.views[view]).forEach(([fieldId, field]) => {
4824
+ Object.entries(views[view]).forEach(([fieldId, field]) => {
4817
4825
  if (field.isFixed) {
4818
4826
  viewItems[fieldId] = field;
4819
4827
  viewMissingFixedFields.splice(viewMissingFixedFields.findIndex((fieldType) => fieldType === field.type), 1);
@@ -4842,10 +4850,11 @@ function updateViewsFromFields(clonedApp, appFields) {
4842
4850
  console.error('ExtraAppFieldsItemViews does not have this field type: ' + fieldType);
4843
4851
  }
4844
4852
  });
4853
+ const newFields = [];
4845
4854
  appFields.forEach((field, idx) => {
4846
- var _a, _b, _c, _d, _e, _f, _g, _h;
4855
+ var _a, _b, _c, _d, _e, _f;
4847
4856
  const isFieldUsedInView = field.views[view];
4848
- const isExistingField = Object.keys(clonedApp.views[view]).includes(field.id);
4857
+ const isExistingField = Object.keys(views[view]).includes(field.id);
4849
4858
  const fieldType = field.type;
4850
4859
  if (AppFormBannedFromViews$1.get(fieldType) && ((_a = AppFormBannedFromViews$1.get(fieldType)) === null || _a === void 0 ? void 0 : _a.includes(view))) {
4851
4860
  return;
@@ -4860,7 +4869,7 @@ function updateViewsFromFields(clonedApp, appFields) {
4860
4869
  if (fieldType === AppFormItemTypes.SELECT) {
4861
4870
  const selectProperty = (_c = field.properties) === null || _c === void 0 ? void 0 : _c.find((prop) => prop.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
4862
4871
  if (isExistingField) {
4863
- const exField = clonedApp.views[view][field.id];
4872
+ const exField = views[view][field.id];
4864
4873
  const exSelectProperty = (_d = exField.properties) === null || _d === void 0 ? void 0 : _d.find((prop) => prop.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
4865
4874
  const isMultivalued = !!((_e = selectProperty === null || selectProperty === void 0 ? void 0 : selectProperty.value) === null || _e === void 0 ? void 0 : _e.canSelectMultiple);
4866
4875
  const exIsMultivalued = !!((_f = exSelectProperty === null || exSelectProperty === void 0 ? void 0 : exSelectProperty.value) === null || _f === void 0 ? void 0 : _f.canSelectMultiple);
@@ -4879,11 +4888,12 @@ function updateViewsFromFields(clonedApp, appFields) {
4879
4888
  }
4880
4889
  }
4881
4890
  if (isExistingField) {
4882
- const exField = clonedApp.views[view][field.id];
4883
- viewItems[field.id] = Object.assign(Object.assign(Object.assign(Object.assign({}, exField), { properties: field.properties || exField.properties || [] }), (fieldValue !== undefined && { value: fieldValue })), { isUsed: isFieldUsedInView, pos: ((_g = clonedApp.syncViewFieldOrder) === null || _g === void 0 ? void 0 : _g[view]) ? idx : exField.pos, isLockedValue: (fieldValue !== undefined || exField.value !== undefined) && exField.isLockedValue });
4891
+ const exField = views[view][field.id];
4892
+ viewItems[field.id] = Object.assign(Object.assign(Object.assign(Object.assign({}, exField), { properties: field.properties || exField.properties || [] }), (fieldValue !== undefined && { value: fieldValue })), { isUsed: isFieldUsedInView, pos: (syncViewFieldOrder === null || syncViewFieldOrder === void 0 ? void 0 : syncViewFieldOrder[view]) ? idx : exField.pos, isLockedValue: (fieldValue !== undefined || exField.value !== undefined) && exField.isLockedValue });
4884
4893
  }
4885
4894
  else {
4886
- const existingFieldsLen = Object.values(clonedApp.views[view]).filter((v) => !v.isFixed && !v.isOptional).length;
4895
+ newFields.push({ id: field.id, idx: idx });
4896
+ const existingFieldsLen = Object.values(views[view]).filter((v) => !v.isFixed && !v.isOptional).length;
4887
4897
  viewItems[field.id] = {
4888
4898
  type: field.type,
4889
4899
  properties: field.properties || [],
@@ -4892,10 +4902,25 @@ function updateViewsFromFields(clonedApp, appFields) {
4892
4902
  isLockedValue: false,
4893
4903
  isFixed: false,
4894
4904
  value: fieldValue !== null && fieldValue !== void 0 ? fieldValue : null,
4895
- pos: ((_h = clonedApp.syncViewFieldOrder) === null || _h === void 0 ? void 0 : _h[view]) ? idx : existingFieldsLen + idx,
4905
+ pos: (syncViewFieldOrder === null || syncViewFieldOrder === void 0 ? void 0 : syncViewFieldOrder[view]) ? idx : existingFieldsLen + idx,
4896
4906
  };
4897
4907
  }
4898
4908
  });
4909
+ if (!(syncViewFieldOrder === null || syncViewFieldOrder === void 0 ? void 0 : syncViewFieldOrder[view])) {
4910
+ newFields.forEach((nf) => {
4911
+ const item = viewItems[nf.id];
4912
+ item.pos = nf.idx + 1;
4913
+ Object.keys(viewItems).forEach((k) => {
4914
+ const e = viewItems[k];
4915
+ if (e &&
4916
+ !Object.values(ExtraAppFieldsItemName).includes(k) &&
4917
+ k !== nf.id &&
4918
+ e.pos >= item.pos) {
4919
+ e.pos++;
4920
+ }
4921
+ });
4922
+ });
4923
+ }
4899
4924
  return {
4900
4925
  [view]: viewItems,
4901
4926
  };
@@ -5375,7 +5400,7 @@ function InstalledAppStudioAdapter(serverApp, serverApps, state) {
5375
5400
  audience: serverApp.checkAccess === false ? AUDIENCE.ALL : AUDIENCE.CUSTOM,
5376
5401
  };
5377
5402
  populateFieldsAndViews(serverApp, studioApp, state);
5378
- studioApp.views = updateViewsFromFields(studioApp, studioApp.fields);
5403
+ studioApp.views = updateViewsFromFields(studioApp.views, studioApp.syncViewFieldOrder, studioApp.fields);
5379
5404
  const inWorkAppVersion = _findAssociatedDraft(serverApp.idApp, serverApps);
5380
5405
  if (!inWorkAppVersion)
5381
5406
  return studioApp;
@@ -6039,6 +6064,7 @@ exports.AssetReservation = AssetReservation;
6039
6064
  exports.Bookmark = Bookmark;
6040
6065
  exports.Comment = Comment;
6041
6066
  exports.ContentReport = ContentReport;
6067
+ exports.ExtraAppFieldsItemName = ExtraAppFieldsItemName;
6042
6068
  exports.ExtraAppFieldsItemViews = ExtraAppFieldsItemViews;
6043
6069
  exports.ExtraBot = ExtraBot;
6044
6070
  exports.Faq = Faq;