jamespot-front-business 1.1.37 → 1.1.39

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
@@ -1971,16 +1971,16 @@ const AUDIENCE = {
1971
1971
  ALL: '1',
1972
1972
  CUSTOM: '0',
1973
1973
  };
1974
- var StatusType;
1974
+ var StatusType$1;
1975
1975
  (function (StatusType) {
1976
1976
  StatusType["draft"] = "draft";
1977
1977
  StatusType["installed"] = "installed";
1978
1978
  StatusType["suspended"] = "suspended";
1979
- })(StatusType || (StatusType = {}));
1979
+ })(StatusType$1 || (StatusType$1 = {}));
1980
1980
  const APP_STATUS_TYPE = {
1981
- DRAFT: StatusType.draft,
1982
- INSTALLED: StatusType.installed,
1983
- SUSPENDED: StatusType.suspended,
1981
+ DRAFT: StatusType$1.draft,
1982
+ INSTALLED: StatusType$1.installed,
1983
+ SUSPENDED: StatusType$1.suspended,
1984
1984
  };
1985
1985
  const STUDIO_VIEW = {
1986
1986
  SOLR: '1',
@@ -2008,6 +2008,7 @@ var AppFormItemTypes;
2008
2008
  AppFormItemTypes["CODEHTML"] = "CODEHTML";
2009
2009
  AppFormItemTypes["USERLINK"] = "USERLINK";
2010
2010
  AppFormItemTypes["CONTENTLINK"] = "CONTENTLINK";
2011
+ AppFormItemTypes["RANGE"] = "RANGE";
2011
2012
  })(AppFormItemTypes || (AppFormItemTypes = {}));
2012
2013
  var ExtraAppFieldsItemViews;
2013
2014
  (function (ExtraAppFieldsItemViews) {
@@ -2029,8 +2030,8 @@ var AppFieldFormPropertyTypes;
2029
2030
  AppFieldFormPropertyTypes["CONTENTTYPE"] = "contenttype";
2030
2031
  })(AppFieldFormPropertyTypes || (AppFieldFormPropertyTypes = {}));
2031
2032
  const AppFormUniqueList = [AppFormItemTypes.DESCRIPTION, AppFormItemTypes.IMAGE];
2032
- const AppFormBannedFromViews = new Map();
2033
- AppFormBannedFromViews.set(AppFormItemTypes.IMAGE, ['list', 'filter', 'view']);
2033
+ const AppFormBannedFromViews$1 = new Map();
2034
+ AppFormBannedFromViews$1.set(AppFormItemTypes.IMAGE, ['list', 'filter', 'view']);
2034
2035
  const MapExtraFieldsWithView = {
2035
2036
  create: {
2036
2037
  fixed: [ExtraAppFieldsItemViews.TITLE],
@@ -2061,6 +2062,275 @@ const MapExtraFieldsWithView = {
2061
2062
  optional: [],
2062
2063
  },
2063
2064
  };
2065
+ const AppColumnsDefaultTypes = [
2066
+ ExtraAppFieldsItemViews.TITLE,
2067
+ ExtraAppFieldsItemViews.USER,
2068
+ ExtraAppFieldsItemViews.CREATIONDATE,
2069
+ AppFormItemTypes.DESCRIPTION,
2070
+ ];
2071
+ const AppFormPrimaryList = [AppFormItemTypes.DESCRIPTION];
2072
+
2073
+ var StatusType;
2074
+ (function (StatusType) {
2075
+ StatusType["draft"] = "draft";
2076
+ StatusType["installed"] = "installed";
2077
+ StatusType["suspended"] = "suspended";
2078
+ })(StatusType || (StatusType = {}));
2079
+ ({
2080
+ DRAFT: StatusType.draft,
2081
+ INSTALLED: StatusType.installed,
2082
+ SUSPENDED: StatusType.suspended,
2083
+ });
2084
+ var AppFormItemType;
2085
+ (function (AppFormItemType) {
2086
+ AppFormItemType["TITLE"] = "TITLE";
2087
+ AppFormItemType["IMAGE"] = "IMAGE";
2088
+ AppFormItemType["DESCRIPTION"] = "DESCRIPTION";
2089
+ AppFormItemType["IDUSER"] = "IDUSER";
2090
+ AppFormItemType["PUBLISHTO"] = "PUBLISHTO";
2091
+ AppFormItemType["SENDALERTTOSUBSCRIBERS"] = "SENDALERTTOSUBSCRIBERS";
2092
+ AppFormItemType["RECEIVEACOPY"] = "RECEIVEACOPY";
2093
+ AppFormItemType["TEXT"] = "TEXT";
2094
+ AppFormItemType["TEXTAREA"] = "TEXTAREA";
2095
+ AppFormItemType["TEXTAREAHTML"] = "TEXTAREAHTML";
2096
+ AppFormItemType["DATE"] = "DATE";
2097
+ AppFormItemType["DATETIME"] = "DATETIME";
2098
+ AppFormItemType["RANGE"] = "RANGE";
2099
+ AppFormItemType["NUMBER"] = "NUMBER";
2100
+ AppFormItemType["URL"] = "URL";
2101
+ AppFormItemType["EMAIL"] = "EMAIL";
2102
+ AppFormItemType["SELECT"] = "SELECT";
2103
+ AppFormItemType["CHECKBOX"] = "CHECKBOX";
2104
+ AppFormItemType["TOGGLE"] = "TOGGLE";
2105
+ AppFormItemType["RADIO"] = "RADIO";
2106
+ AppFormItemType["TAGS"] = "TAGS";
2107
+ AppFormItemType["ADDFILEATTACHMENT"] = "ADDFILEATTACHMENT";
2108
+ AppFormItemType["AUDIENCE"] = "AUDIENCE";
2109
+ AppFormItemType["CODEHTML"] = "CODEHTML";
2110
+ AppFormItemType["DATECREATION"] = "DATECREATION";
2111
+ AppFormItemType["USERLINK"] = "USERLINK";
2112
+ AppFormItemType["CONTENTLINK"] = "CONTENTLINK";
2113
+ })(AppFormItemType || (AppFormItemType = {}));
2114
+ [AppFormItemType.DESCRIPTION];
2115
+ const AppFormNotFields = [AppFormItemType.AUDIENCE, AppFormItemType.RANGE];
2116
+ ({
2117
+ create: [AppFormItemType.TITLE],
2118
+ popup: [AppFormItemType.TITLE],
2119
+ edit: [AppFormItemType.TITLE],
2120
+ list: [AppFormItemType.TITLE, AppFormItemType.IDUSER],
2121
+ filter: [AppFormItemType.TITLE, AppFormItemType.IDUSER],
2122
+ view: [AppFormItemType.TITLE],
2123
+ });
2124
+ ({
2125
+ create: [AppFormItemType.PUBLISHTO, AppFormItemType.SENDALERTTOSUBSCRIBERS, AppFormItemType.RECEIVEACOPY],
2126
+ popup: [AppFormItemType.PUBLISHTO],
2127
+ edit: [AppFormItemType.PUBLISHTO],
2128
+ list: [AppFormItemType.DATECREATION],
2129
+ filter: [AppFormItemType.DATECREATION],
2130
+ view: [],
2131
+ });
2132
+ const AppFormFixedList = [
2133
+ AppFormItemType.TITLE,
2134
+ AppFormItemType.PUBLISHTO,
2135
+ AppFormItemType.SENDALERTTOSUBSCRIBERS,
2136
+ AppFormItemType.RECEIVEACOPY,
2137
+ AppFormItemType.IDUSER,
2138
+ AppFormItemType.DATECREATION,
2139
+ ];
2140
+ [AppFormItemType.DESCRIPTION, AppFormItemType.IMAGE];
2141
+ const AppFormBannedFromViews = new Map();
2142
+ AppFormBannedFromViews.set(AppFormItemType.IMAGE, ['list', 'filter', 'view']);
2143
+ const AppListFilter = [
2144
+ AppFormItemType.TITLE,
2145
+ AppFormItemType.DESCRIPTION,
2146
+ AppFormItemType.TEXT,
2147
+ AppFormItemType.TEXTAREA,
2148
+ AppFormItemType.TEXTAREAHTML,
2149
+ AppFormItemType.DATE,
2150
+ AppFormItemType.DATETIME,
2151
+ AppFormItemType.RANGE,
2152
+ AppFormItemType.NUMBER,
2153
+ AppFormItemType.URL,
2154
+ AppFormItemType.EMAIL,
2155
+ AppFormItemType.SELECT,
2156
+ AppFormItemType.TOGGLE,
2157
+ AppFormItemType.CHECKBOX,
2158
+ AppFormItemType.RADIO,
2159
+ AppFormItemType.TAGS,
2160
+ AppFormItemType.PUBLISHTO,
2161
+ AppFormItemType.SENDALERTTOSUBSCRIBERS,
2162
+ AppFormItemType.RECEIVEACOPY,
2163
+ AppFormItemType.ADDFILEATTACHMENT,
2164
+ AppFormItemType.CODEHTML,
2165
+ AppFormItemType.IDUSER,
2166
+ AppFormItemType.DATECREATION,
2167
+ AppFormItemType.USERLINK,
2168
+ AppFormItemType.CONTENTLINK,
2169
+ ];
2170
+ ({
2171
+ create: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML],
2172
+ popup: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML],
2173
+ edit: [AppFormItemType.IMAGE, AppFormItemType.ADDFILEATTACHMENT, AppFormItemType.CODEHTML],
2174
+ list: AppListFilter,
2175
+ filter: AppListFilter,
2176
+ view: AppListFilter,
2177
+ });
2178
+ AppFormFixedList.concat(AppFormNotFields)
2179
+ .concat(AppFormItemType.IDUSER)
2180
+ .concat(AppFormItemType.TITLE);
2181
+ [AppFormItemType.CODEHTML];
2182
+
2183
+ function migrateJson(v1Json) {
2184
+ const v1 = v1Json;
2185
+ const v1Manifest = v1.manifest;
2186
+ const newFields = _renderFields();
2187
+ const v2 = {
2188
+ idApp: v1.idApp,
2189
+ status: v1.status,
2190
+ studioVersion: 2,
2191
+ author: v1.author || '',
2192
+ manifest: {
2193
+ appShortName: v1Manifest.appShortName,
2194
+ appName: v1Manifest.appName,
2195
+ description: v1Manifest.description,
2196
+ author: v1Manifest.author || '',
2197
+ typeLabel: v1Manifest.typeLabel,
2198
+ cssColor: v1Manifest.cssColor,
2199
+ cssClass: v1Manifest.cssClass,
2200
+ version: v1Manifest.version,
2201
+ dateCreation: new Date(v1Manifest.dateCreation).toISOString(),
2202
+ viewSolr: v1Manifest.viewSolr,
2203
+ checkAccess: v1Manifest.checkAccess,
2204
+ accessRightList: v1Manifest.accessRightList || '',
2205
+ attrExposed: v1Manifest.attrExposed,
2206
+ },
2207
+ fields: newFields,
2208
+ views: _renderViews(),
2209
+ audience: v1.audience || '1',
2210
+ installFor: v1.installFor || [],
2211
+ };
2212
+ function _renderFields() {
2213
+ var _a;
2214
+ const v2Fields = [];
2215
+ for (const v1FormItem of v1.form.formItems) {
2216
+ const type = _matctTypes(v1FormItem.type);
2217
+ v2Fields.push({
2218
+ id: v1FormItem.id,
2219
+ type,
2220
+ properties: _renderProperties((_a = v1FormItem.properties) !== null && _a !== void 0 ? _a : {}),
2221
+ mandatory: v1FormItem.mandatory || false,
2222
+ views: v1FormItem.views,
2223
+ isActive: true,
2224
+ isFixed: false,
2225
+ isOptional: false,
2226
+ value: null,
2227
+ });
2228
+ }
2229
+ return v2Fields;
2230
+ }
2231
+ function _matctTypes(v1Type) {
2232
+ return AppFormItemTypes[v1Type];
2233
+ }
2234
+ function _renderProperties(v1FormItemProperties) {
2235
+ var _a, _b, _c, _d, _e, _f, _g;
2236
+ const v2Properties = [];
2237
+ const isEnhancedOptionEditor = v1FormItemProperties.options &&
2238
+ Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'hasDefaultValue');
2239
+ const baseProperty = Object.assign({ isRequired: v1FormItemProperties.mandatory || false }, (isEnhancedOptionEditor && { isOptionsEditorEnhanced: true }));
2240
+ if (v1FormItemProperties.labels) {
2241
+ v2Properties.push(Object.assign({ propertyType: AppFieldFormPropertyTypes.LABEL, value: ((_a = v1FormItemProperties.labels.label) === null || _a === void 0 ? void 0 : _a.content) || '' }, baseProperty));
2242
+ v2Properties.push(Object.assign({ propertyType: AppFieldFormPropertyTypes.DESCRIPTION, value: ((_b = v1FormItemProperties.labels.description) === null || _b === void 0 ? void 0 : _b.content) || '' }, baseProperty));
2243
+ }
2244
+ if (v1FormItemProperties.options) {
2245
+ v2Properties.push(Object.assign({ propertyType: AppFieldFormPropertyTypes.OPTIONS_EDITOR, value: isEnhancedOptionEditor
2246
+ ? {
2247
+ propertyOptions: _renderSelectOptions((_c = v1FormItemProperties.options) !== null && _c !== void 0 ? _c : []),
2248
+ defaultSelectOptionValue: v1FormItemProperties.defaultValue,
2249
+ defaultSelectOption: (_d = v1FormItemProperties.hasDefaultValue) !== null && _d !== void 0 ? _d : false,
2250
+ canSelectMultiple: (_e = v1FormItemProperties.multiple) !== null && _e !== void 0 ? _e : false,
2251
+ userCanModifiyByComment: (_f = v1FormItemProperties.explain) !== null && _f !== void 0 ? _f : false,
2252
+ }
2253
+ : { propertyOptions: _renderSelectOptions((_g = v1FormItemProperties.options) !== null && _g !== void 0 ? _g : []) } }, baseProperty));
2254
+ }
2255
+ if (v1FormItemProperties.code) {
2256
+ v2Properties.push(Object.assign({ propertyType: AppFieldFormPropertyTypes.RICHTEXT, value: v1FormItemProperties.code.html || v1FormItemProperties.code.text || '' }, baseProperty));
2257
+ }
2258
+ if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'digits')) {
2259
+ v2Properties.push(Object.assign({ propertyType: AppFieldFormPropertyTypes.CHECKBOX, value: v1FormItemProperties.digits || false, checkBoxOptions: [{ label: 'APPSTUDIO_FormEditProps_Digits', value: v1FormItemProperties.digits }] }, baseProperty));
2260
+ }
2261
+ if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'taxonomy')) {
2262
+ v2Properties.push(Object.assign({ propertyType: AppFieldFormPropertyTypes.TAXONOMY, value: v1FormItemProperties.taxonomy || '' }, baseProperty));
2263
+ }
2264
+ if (Object.prototype.hasOwnProperty.call(v1FormItemProperties, 'contentType')) {
2265
+ v2Properties.push(Object.assign({ propertyType: AppFieldFormPropertyTypes.CONTENTTYPE, value: v1FormItemProperties.contentType || '' }, baseProperty));
2266
+ }
2267
+ return v2Properties;
2268
+ }
2269
+ function _renderSelectOptions(v1Options) {
2270
+ const v2Options = [];
2271
+ for (const option of v1Options) {
2272
+ v2Options.push({
2273
+ title: option.label,
2274
+ value: option.value,
2275
+ });
2276
+ }
2277
+ return v2Options;
2278
+ }
2279
+ function _renderViews() {
2280
+ return {
2281
+ create: _renderViewFields(v1.formItemsViewList.find((view) => view.view == 'create').formItemRefs),
2282
+ popup: _renderViewFields(v1.formItemsViewList.find((view) => view.view == 'popup').formItemRefs),
2283
+ edit: _renderViewFields(v1.formItemsViewList.find((view) => view.view == 'edit').formItemRefs),
2284
+ list: _renderViewFields(v1.formItemsViewList.find((view) => view.view == 'list').formItemRefs),
2285
+ filter: _renderViewFields(v1.formItemsViewList.find((view) => view.view == 'filter').formItemRefs),
2286
+ view: _renderViewFields(v1.formItemsViewList.find((view) => view.view == 'view').formItemRefs),
2287
+ };
2288
+ }
2289
+ function _renderViewFields(v1FormItemRefs) {
2290
+ const viewItems = {};
2291
+ v1FormItemRefs.forEach((v1FormItemRef) => {
2292
+ const viewBase = {
2293
+ isUsed: true,
2294
+ isFixed: false,
2295
+ isOptional: false,
2296
+ properties: [],
2297
+ pos: 0,
2298
+ isLockedValue: !!v1FormItemRef.fixedValue || false,
2299
+ value: v1FormItemRef.fixedValue || '',
2300
+ };
2301
+ if (v1FormItemRef.ref === AppFormItemType.TITLE) {
2302
+ viewItems[v4()] = Object.assign(Object.assign({}, viewBase), { type: ExtraAppFieldsItemViews.TITLE, isFixed: true });
2303
+ }
2304
+ else if (v1FormItemRef.ref === AppFormItemType.IDUSER) {
2305
+ viewItems[v4()] = Object.assign(Object.assign({}, viewBase), { type: ExtraAppFieldsItemViews.USER, isFixed: true });
2306
+ }
2307
+ else if (v1FormItemRef.ref === AppFormItemType.PUBLISHTO) {
2308
+ viewItems[v4()] = Object.assign(Object.assign({}, viewBase), { type: ExtraAppFieldsItemViews.PUBLISHTO, isOptional: true });
2309
+ }
2310
+ else if (v1FormItemRef.ref === AppFormItemType.SENDALERTTOSUBSCRIBERS) {
2311
+ viewItems[v4()] = Object.assign(Object.assign({}, viewBase), { type: ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS, isOptional: true });
2312
+ }
2313
+ else if (v1FormItemRef.ref === AppFormItemType.RECEIVEACOPY) {
2314
+ viewItems[v4()] = Object.assign(Object.assign({}, viewBase), { type: ExtraAppFieldsItemViews.RECEIVEACOPY, isOptional: true });
2315
+ }
2316
+ else {
2317
+ const v2Field = _mapFormItemRefWithField(v1FormItemRef);
2318
+ if (v2Field) {
2319
+ viewItems[v2Field.id] = Object.assign(Object.assign({ type: v2Field.type }, viewBase), { properties: v2Field.properties || [] });
2320
+ }
2321
+ }
2322
+ });
2323
+ return viewItems;
2324
+ }
2325
+ function _mapFormItemRefWithField(v1FormItemRef) {
2326
+ const v1Field = v1.form.formItems.find((field) => v1FormItemRef.ref === field.id || v1FormItemRef.ref === field.name);
2327
+ if (v1Field) {
2328
+ return newFields.find((field) => field.id === v1Field.id);
2329
+ }
2330
+ return null;
2331
+ }
2332
+ return v2;
2333
+ }
2064
2334
 
2065
2335
  function InstalledAppStudioAdapter(serverApp, serverApps) {
2066
2336
  const { version, dateCreation } = serverApp.manifest;
@@ -2071,6 +2341,7 @@ function InstalledAppStudioAdapter(serverApp, serverApps) {
2071
2341
  const studioApp = {
2072
2342
  idApp: serverApp.idApp,
2073
2343
  status: _formatStatus(serverApp),
2344
+ studioVersion: 2,
2074
2345
  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 })),
2075
2346
  fields: [],
2076
2347
  views,
@@ -2090,22 +2361,28 @@ function DraftAppStudioAdapter(serverApp) {
2090
2361
  if (!serverApp.value)
2091
2362
  return undefined;
2092
2363
  const parsedJson = JSON.parse(serverApp.value);
2093
- return {
2094
- idApp: serverApp.idApp,
2095
- status: _formatStatus(serverApp),
2096
- manifest: parsedJson.manifest,
2097
- fields: parsedJson.fields,
2098
- views: parsedJson.views,
2099
- audience: parsedJson.audience,
2100
- installFor: parsedJson.installFor,
2101
- };
2364
+ if (parsedJson.studioVersion == 2) {
2365
+ return {
2366
+ idApp: serverApp.idApp,
2367
+ studioVersion: 2,
2368
+ status: _formatStatus(serverApp),
2369
+ manifest: parsedJson.manifest,
2370
+ fields: parsedJson.fields,
2371
+ views: parsedJson.views,
2372
+ audience: parsedJson.audience,
2373
+ installFor: parsedJson.installFor,
2374
+ };
2375
+ }
2376
+ else {
2377
+ return Object.assign(Object.assign({}, migrateJson(JSON.parse(serverApp.value))), { status: _formatStatus(serverApp) });
2378
+ }
2102
2379
  }
2103
2380
  function _formatStatus(serverApp) {
2104
2381
  return serverApp.status === StudioApplicationStatus.installed
2105
2382
  ? serverApp.suspended
2106
- ? StatusType.suspended
2107
- : StatusType.installed
2108
- : StatusType.draft;
2383
+ ? StatusType$1.suspended
2384
+ : StatusType$1.installed
2385
+ : StatusType$1.draft;
2109
2386
  }
2110
2387
  function _findAssociatedDraft(idApp, serverApps) {
2111
2388
  const draft = serverApps.find((app) => app.idApp === idApp && app.status === StudioApplicationStatus.saved);
@@ -2130,10 +2407,493 @@ function serverAppsToStudioApps(serverApps) {
2130
2407
  return studioApps;
2131
2408
  }
2132
2409
 
2410
+ function appToXml(studioApp) {
2411
+ const { manifest, views, audience, installFor } = studioApp;
2412
+ return `<?xml version='1.0' encoding='utf-8'?>
2413
+ <Application>
2414
+ ${createAppManifest(manifest, views, audience, installFor)}
2415
+ <Types>
2416
+ <objecttype
2417
+ label="${manifest.typeLabel}"
2418
+ labelPlural="${manifest.typeLabel}"
2419
+ labelLinkSingular="${manifest.typeLabel}"
2420
+ labelLinkPlural="${manifest.typeLabel}"
2421
+ name="${manifest.appShortName}"
2422
+ classImpl="JPBEContent"
2423
+ classCodeLocation="jamespot/jpro/objs/JPBEContent.php"
2424
+ cssClass="${manifest.cssClass.value}"
2425
+ cssColor="${manifest.cssColor}"
2426
+ searchtab="${manifest.appShortName}"
2427
+ searchtablabel="${manifest.typeLabel}"
2428
+ buttonlabel="${manifest.typeLabel}"
2429
+ extends="article">
2430
+ ${renderPrimaryFields(studioApp.fields)}
2431
+ ${renderCustomFields(studioApp.fields)}
2432
+ </objecttype>
2433
+ ${renderDisplays(studioApp)}
2434
+ </Types>
2435
+ </Application>`;
2436
+ }
2437
+ function createAppManifest(manifest, views, audience, installFor) {
2438
+ var _a;
2439
+ return `<Manifest>
2440
+ <ShowImport>true</ShowImport>
2441
+ <AppShortName>${manifest.appShortName}</AppShortName>
2442
+ <AppName>${manifest.appName}</AppName>
2443
+ <Description>${manifest.description}</Description>
2444
+ <Version>${manifest.version}</Version>
2445
+ <ManifestVersion>1.0</ManifestVersion>
2446
+ <StudioVersion>2</StudioVersion>
2447
+ <DateCreation>${manifest.dateCreation.toString().split('T')[0]}</DateCreation>
2448
+ <CssClass>${(_a = manifest.cssClass) === null || _a === void 0 ? void 0 : _a.label}</CssClass>
2449
+ <CssColor>${manifest.cssColor}</CssColor>
2450
+ <Categories>N.A.</Categories>
2451
+ <Editor>Jamespot</Editor>
2452
+ <EditorUrl>https://www.fr.jamespot.com/</EditorUrl>
2453
+ <Type>${manifest.appShortName}</Type>
2454
+ ${renderAppView(manifest.viewSolr, views.list)}
2455
+ ${renderAppSearch(views.filter)}
2456
+ ${renderAudience(audience, installFor)}
2457
+ <Order>1</Order>
2458
+ </Manifest>`;
2459
+ }
2460
+ function renderAppView(viewSolr, listView) {
2461
+ if (viewSolr === 'solr') {
2462
+ let xml = '<AppView>solr</AppView>';
2463
+ const formItemIdInList = [];
2464
+ Object.entries(listView).forEach(([fieldId, field]) => {
2465
+ formItemIdInList.push(getAttrNameFormItem(field, fieldId));
2466
+ });
2467
+ xml += `<AppColumns>${formItemIdInList.join()}</AppColumns>`;
2468
+ return xml;
2469
+ }
2470
+ return '';
2471
+ }
2472
+ function renderAppSearch(searchView) {
2473
+ const formItemIdInFilter = [];
2474
+ Object.entries(searchView).forEach(([fieldId, field]) => {
2475
+ if (![ExtraAppFieldsItemViews.TITLE, AppFormItemTypes.IMAGE].includes(field.type))
2476
+ formItemIdInFilter.push(getAttrNameFormItem(field, fieldId));
2477
+ });
2478
+ return `<AttrExposed>${formItemIdInFilter.join()}</AttrExposed>`;
2479
+ }
2480
+ function getAttrNameFormItem(field, fieldId) {
2481
+ function fieldType() {
2482
+ if (field.type === ExtraAppFieldsItemViews.USER)
2483
+ return 'idUser';
2484
+ if (field.type === ExtraAppFieldsItemViews.CREATIONDATE)
2485
+ return 'dateCreation';
2486
+ return field.type;
2487
+ }
2488
+ return (AppColumnsDefaultTypes.includes(field.type) ? fieldType() : uuid2Alpha(fieldId)).toLowerCase();
2489
+ }
2490
+ function renderAudience(audience, installFor) {
2491
+ if (audience === AUDIENCE.ALL)
2492
+ return '<checkAccess>false</checkAccess>';
2493
+ else if (installFor.length > 0) {
2494
+ return `<checkAccess>true</checkAccess>
2495
+ <accessRightList>${installFor.map((user) => user.uri).join()}</accessRightList>`;
2496
+ }
2497
+ return '';
2498
+ }
2499
+ function renderPrimaryFields(fields) {
2500
+ const primaryFields = fields === null || fields === void 0 ? void 0 : fields.filter((field) => AppFormPrimaryList.includes(field.type));
2501
+ if (primaryFields.length === 0)
2502
+ return '';
2503
+ return `<primaryFields>${primaryFields.map((field) => formItem2xml(field)).join('')}</primaryFields>`;
2504
+ }
2505
+ function renderCustomFields(fields) {
2506
+ const customFields = fields === null || fields === void 0 ? void 0 : fields.filter((field) => !AppFormPrimaryList.includes(field.type));
2507
+ const filteredCustomFields = customFields === null || customFields === void 0 ? void 0 : customFields.filter((field) => field.type !== AppFormItemTypes.IMAGE);
2508
+ if (filteredCustomFields.length === 0)
2509
+ return '';
2510
+ const articlesTablesItems = filteredCustomFields.filter((f) => f.type !== AppFormItemTypes.TAGS);
2511
+ const linksTableItems = filteredCustomFields.filter((f) => f.type === AppFormItemTypes.TAGS);
2512
+ return `<custom>
2513
+ ${articlesTablesItems.length > 0
2514
+ ? `<articlemstable>
2515
+ ${articlesTablesItems.map((field) => formItem2xml(field)).join('')}
2516
+ </articlemstable>`
2517
+ : ''}
2518
+ ${linksTableItems.length > 0
2519
+ ? `<linkstable>
2520
+ ${linksTableItems.map((field) => formItem2xml(field)).join('')}
2521
+ </linkstable>`
2522
+ : ''}</custom>`;
2523
+ }
2524
+ function formItem2xml(field) {
2525
+ return `<field
2526
+ type="${renderFieldTypeToXmlType(field.type)}"
2527
+ name="${getAttrNameFormItem(field, field.id)}"
2528
+ sqlname="${renderSqlName(field.type, field.id)}"
2529
+ ${field.properties && renderProperty(field.properties, AppFieldFormPropertyTypes.LABEL)}
2530
+ ${field.properties && renderProperty(field.properties, AppFieldFormPropertyTypes.DESCRIPTION)}
2531
+ mandatory="${field.mandatory}"
2532
+ solr.type="${renderSolrType(field.type)}"
2533
+ solr.used="true"
2534
+ solr.indexed="true"
2535
+ solr.stored="true"
2536
+ solr.searchable="true"
2537
+ solr.multiValued="${field.type === AppFormItemTypes.TAGS || (field.type === AppFormItemTypes.CHECKBOX && true) || false}"
2538
+ teaser="true"
2539
+ display="true"
2540
+ >
2541
+ ${renderWidget(field.type, field.properties)}
2542
+ </field>`;
2543
+ }
2544
+ function renderWidget(fieldType, fieldProperties) {
2545
+ var _a;
2546
+ switch (fieldType) {
2547
+ case AppFormItemTypes.DESCRIPTION:
2548
+ return '<widget form="textarea"><params><param key="class" value="mceEditor"></param><param key="mention" value="1"></param></params></widget>';
2549
+ case AppFormItemTypes.TEXT:
2550
+ return '<widget form="text"></widget>';
2551
+ case AppFormItemTypes.TEXTAREA:
2552
+ return '<widget form="textarea"></widget>';
2553
+ case AppFormItemTypes.TEXTAREAHTML:
2554
+ return '<widget form="textarea"><params><param key="class" value="mceEditor"></param></params></widget>';
2555
+ case AppFormItemTypes.DATE:
2556
+ return '<widget form="date" format="d/m/Y"></widget>';
2557
+ case AppFormItemTypes.DATETIME:
2558
+ return `<widget form="datetime" format="d/m/Y H:i:s"></widget>`;
2559
+ case AppFormItemTypes.NUMBER: {
2560
+ const isFloat = ((_a = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === AppFieldFormPropertyTypes.CHECKBOX)) === null || _a === void 0 ? void 0 : _a.value) === true;
2561
+ return `<widget form="number">
2562
+ ${isFloat ? `<params><param value="0.01" key="step"/></params>` : ''}
2563
+ </widget>`;
2564
+ }
2565
+ case AppFormItemTypes.SELECT: {
2566
+ const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
2567
+ if (!optionEditor)
2568
+ return '';
2569
+ const isMultiple = optionEditor.value.canSelectMultiple;
2570
+ const options = optionEditor.value.propertyOptions;
2571
+ const hasDefaultValue = optionEditor.value.defaultSelectOption;
2572
+ const defaultValue = optionEditor.value.defaultSelectOptionValue;
2573
+ return `<widget form="select" ${isMultiple ? 'multiple="1"' : ''}>
2574
+ <options>
2575
+ ${options
2576
+ .map((option) => `<option value="${option.value}" label="${option.title}"></option>`)
2577
+ .join('')}
2578
+ </options>
2579
+ ${hasDefaultValue ? `<params><param key="defaultValue" value="${defaultValue}"/></params>` : ''}
2580
+ </widget>`;
2581
+ }
2582
+ case AppFormItemTypes.RADIO: {
2583
+ const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === AppFieldFormPropertyTypes.CHECKBOX);
2584
+ if (!optionEditor)
2585
+ return '';
2586
+ const options = optionEditor.value.propertyOptions;
2587
+ return `<widget form="radio">
2588
+ ${options
2589
+ .map((option) => `<option value="${option.value}" label="${option.title}"></option>`)
2590
+ .join('')}
2591
+ </widget>`;
2592
+ }
2593
+ case AppFormItemTypes.TOGGLE:
2594
+ return `<widget form="checkbox">
2595
+ <options>
2596
+ <option value="1" label="GLOBAL_Yes"></option>
2597
+ </options>
2598
+ <params>
2599
+ <param key="jagCheckbox" value="1"></param>
2600
+ </params>
2601
+ </widget>`;
2602
+ case AppFormItemTypes.TAGS: {
2603
+ const taxonomy = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === AppFieldFormPropertyTypes.TAXONOMY);
2604
+ if (!taxonomy)
2605
+ return '';
2606
+ const taxonomyId = taxonomy.value.id;
2607
+ return `<widget form="taxonomy">
2608
+ <params><param key="idTaxonomy" value="${taxonomyId}"></param></params>
2609
+ </widget>`;
2610
+ }
2611
+ case AppFormItemTypes.CHECKBOX: {
2612
+ const optionEditor = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === AppFieldFormPropertyTypes.CHECKBOX);
2613
+ if (!optionEditor)
2614
+ return '';
2615
+ const options = optionEditor.value.propertyOptions;
2616
+ return `<widget form="checkbox" multiple="1">
2617
+ <options>
2618
+ ${options
2619
+ .map((option) => `<option value="${option.value}" label="${option.label}"></option>`)
2620
+ .join('')}
2621
+ </options>
2622
+ </widget>`;
2623
+ }
2624
+ case AppFormItemTypes.ADDFILEATTACHMENT:
2625
+ return `<widget form="file" type="fileArticle" multiple="1"></widget>`;
2626
+ case AppFormItemTypes.URL:
2627
+ return `<widget form="url"`;
2628
+ case AppFormItemTypes.EMAIL:
2629
+ return `<widget form="email"></widget>`;
2630
+ case ExtraAppFieldsItemViews.USER:
2631
+ return `<widget form="idUser"></widget>`;
2632
+ case AppFormItemTypes.USERLINK:
2633
+ return `<widget form="uri">
2634
+ <params>
2635
+ <param key="mode" value="ng-view"></param>
2636
+ <param key="class" value="jcomplete"></param>
2637
+ <param key="namespace" value="jamespot"></param>
2638
+ <param key="types" value="user"></param>
2639
+ <param key="views" value="user"></param>
2640
+ <param key="jcomplete-url" value="/?action=ajax&amp;group=autocomplete&amp;export function=user"></param>
2641
+ </params>
2642
+ </widget>`;
2643
+ case AppFormItemTypes.CONTENTLINK: {
2644
+ const contentType = fieldProperties === null || fieldProperties === void 0 ? void 0 : fieldProperties.find((property) => property.propertyType === AppFieldFormPropertyTypes.CONTENTTYPE);
2645
+ if (!contentType)
2646
+ return '';
2647
+ const type = contentType.value.type;
2648
+ return `<widget form="uri">
2649
+ <params>
2650
+ <param key="mode" value="ng-view"></param>
2651
+ <param key="namespace" value="jamespot"></param>
2652
+ <param key="types" value="${type}"></param>
2653
+ <param key="views" value="article"></param>
2654
+ <param key="jcomplete-url" value="/?action=ajax&amp;group=autocomplete&amp;export function=article&amp;types=[]=${type}"></param>
2655
+ </params>
2656
+ </widget>`;
2657
+ }
2658
+ default:
2659
+ return '';
2660
+ }
2661
+ }
2662
+ function renderProperty(properties, propertyToFind) {
2663
+ const labelProperty = properties === null || properties === void 0 ? void 0 : properties.find((property) => property.propertyType === propertyToFind);
2664
+ if (labelProperty) {
2665
+ return `${propertyToFind.toLowerCase()}="${labelProperty.value}"`;
2666
+ }
2667
+ return '';
2668
+ }
2669
+ function renderSqlName(fieldType, fieldId) {
2670
+ switch (fieldType) {
2671
+ case AppFormItemTypes.DESCRIPTION:
2672
+ return 'Description';
2673
+ case ExtraAppFieldsItemViews.USER:
2674
+ return 'IdUser';
2675
+ default:
2676
+ return uuid2Alpha(fieldId);
2677
+ }
2678
+ }
2679
+ function renderSolrType(fieldType) {
2680
+ switch (fieldType) {
2681
+ case AppFormItemTypes.DESCRIPTION:
2682
+ case AppFormItemTypes.TEXT:
2683
+ case AppFormItemTypes.TEXTAREA:
2684
+ case AppFormItemTypes.TEXTAREAHTML:
2685
+ case AppFormItemTypes.URL:
2686
+ case AppFormItemTypes.EMAIL:
2687
+ case AppFormItemTypes.USERLINK:
2688
+ case AppFormItemTypes.CONTENTLINK:
2689
+ case AppFormItemTypes.NUMBER:
2690
+ case AppFormItemTypes.ADDFILEATTACHMENT:
2691
+ return 'text';
2692
+ case AppFormItemTypes.DATE:
2693
+ case AppFormItemTypes.DATETIME:
2694
+ return 'date';
2695
+ case ExtraAppFieldsItemViews.USER:
2696
+ return 'integer';
2697
+ case AppFormItemTypes.SELECT:
2698
+ case AppFormItemTypes.RADIO:
2699
+ case AppFormItemTypes.TOGGLE:
2700
+ case AppFormItemTypes.CHECKBOX:
2701
+ case AppFormItemTypes.TAGS:
2702
+ return 'string';
2703
+ default:
2704
+ return '';
2705
+ }
2706
+ }
2707
+ function renderFieldTypeToXmlType(fieldType) {
2708
+ switch (fieldType) {
2709
+ default:
2710
+ case AppFormItemTypes.DESCRIPTION:
2711
+ case AppFormItemTypes.TEXTAREAHTML:
2712
+ return 'html';
2713
+ case AppFormItemTypes.TAGS:
2714
+ return 'taxonomy';
2715
+ case AppFormItemTypes.TEXT:
2716
+ case AppFormItemTypes.SELECT:
2717
+ case AppFormItemTypes.RADIO:
2718
+ case AppFormItemTypes.CHECKBOX:
2719
+ case AppFormItemTypes.URL:
2720
+ case AppFormItemTypes.EMAIL:
2721
+ case AppFormItemTypes.ADDFILEATTACHMENT:
2722
+ case ExtraAppFieldsItemViews.USER:
2723
+ case AppFormItemTypes.USERLINK:
2724
+ case AppFormItemTypes.CONTENTLINK:
2725
+ return 'text';
2726
+ case AppFormItemTypes.TEXTAREA:
2727
+ return 'longtext';
2728
+ case AppFormItemTypes.DATE:
2729
+ return 'date';
2730
+ case AppFormItemTypes.DATETIME: {
2731
+ return 'date';
2732
+ }
2733
+ case AppFormItemTypes.NUMBER:
2734
+ return 'float';
2735
+ }
2736
+ }
2737
+ const uuid2Alpha = (id) => {
2738
+ let alphaUuid = '';
2739
+ for (let i = 0; i < id.length; i++) {
2740
+ const c = id.charAt(i);
2741
+ if (c >= '0' && c <= '9')
2742
+ alphaUuid += numToAlpha(Number(c));
2743
+ else if (c >= 'a' && c <= 'z')
2744
+ alphaUuid += c;
2745
+ }
2746
+ return alphaUuid;
2747
+ };
2748
+ const numToAlpha = (num) => {
2749
+ let s = '', t;
2750
+ while (num > 0) {
2751
+ t = (num - 1) % 26;
2752
+ s = String.fromCharCode(97 + t) + s;
2753
+ num = ((num - t) / 26) | 0;
2754
+ }
2755
+ return s;
2756
+ };
2757
+ const internal2XmlView = {
2758
+ create: 'create',
2759
+ popup: 'create-popup',
2760
+ edit: 'edit',
2761
+ view: 'display',
2762
+ };
2763
+ function renderDisplays(studioApp) {
2764
+ let toRet = '';
2765
+ Object.entries(studioApp.views).forEach(([viewName, viewContent]) => {
2766
+ if (Object.prototype.hasOwnProperty.call(internal2XmlView, viewName)) {
2767
+ const viewField = Object.entries(viewContent);
2768
+ toRet += `<display view="${internal2XmlView[viewName]}" mode="${viewName === 'view' ? 'view' : 'form'}">
2769
+ ${viewField.map(([fieldId, view]) => renderDisplayAttr(fieldId, view)).join('')}
2770
+ </display>`;
2771
+ }
2772
+ });
2773
+ if (toRet.length > 0) {
2774
+ toRet = `<displays type="${studioApp.manifest.appShortName}">${toRet}</displays>`;
2775
+ }
2776
+ return toRet;
2777
+ }
2778
+ function getDisplayName(fieldId, view) {
2779
+ switch (view.type) {
2780
+ case ExtraAppFieldsItemViews.TITLE:
2781
+ return 'title';
2782
+ case ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS:
2783
+ return 'sendAlert';
2784
+ case ExtraAppFieldsItemViews.RECEIVEACOPY:
2785
+ return 'alertAuthor';
2786
+ case ExtraAppFieldsItemViews.PUBLISHTO:
2787
+ return 'publishTo';
2788
+ case ExtraAppFieldsItemViews.USER:
2789
+ return 'idUser';
2790
+ case ExtraAppFieldsItemViews.CREATIONDATE:
2791
+ return 'dateCreation';
2792
+ default:
2793
+ return uuid2Alpha(fieldId);
2794
+ }
2795
+ }
2796
+ function renderDisplayAttr(fieldId, view) {
2797
+ var _a, _b, _c;
2798
+ let xml = '';
2799
+ const attrName = getDisplayName(fieldId, view);
2800
+ const isFixed = view.isLockedValue;
2801
+ if (isFixed) {
2802
+ const formItemRefWithName = {
2803
+ ref: attrName,
2804
+ fixedValue: view.value,
2805
+ };
2806
+ xml += `<html><![CDATA[ <!-- <JAMESPOT.STUDIO.FIXED>${JSON.stringify(formItemRefWithName)}</JAMESPOT.STUDIO.FIXED> -->`;
2807
+ if (view.type === ExtraAppFieldsItemViews.PUBLISHTO) {
2808
+ const uris = view.value.map((user) => user.uri).join(',');
2809
+ xml += `<input type="hidden" name="publishTo" value="${uris}">`;
2810
+ }
2811
+ else if (view.type === ExtraAppFieldsItemViews.USER ||
2812
+ view.type === AppFormItemTypes.USERLINK ||
2813
+ view.type === AppFormItemTypes.CONTENTLINK) {
2814
+ xml += `<input type="hidden" name="${attrName}[]" value=${JSON.stringify(view.value.uri)}>`;
2815
+ }
2816
+ else if (view.type === AppFormItemTypes.SELECT) {
2817
+ const values = view.value;
2818
+ const canSelectMultiple = (_a = view.properties.find((property) => property.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR)) === null || _a === void 0 ? void 0 : _a.value.canSelectMultiple;
2819
+ values.forEach((value) => {
2820
+ xml += `<input type="hidden" name="${attrName}${canSelectMultiple ? '[]' : ''}" value="${value.value}">`;
2821
+ });
2822
+ }
2823
+ else if (view.type === AppFormItemTypes.CHECKBOX) {
2824
+ const values = view.value;
2825
+ values.forEach((value) => {
2826
+ xml += `<input type="hidden" name="${attrName}[]" value="${value.value}">`;
2827
+ });
2828
+ }
2829
+ else if (view.type === AppFormItemTypes.DATE) {
2830
+ const dateValue = new Date(view.value);
2831
+ const xmlFixedValue = [
2832
+ pad(dateValue.getDate()),
2833
+ pad(dateValue.getMonth() + 1),
2834
+ dateValue.getFullYear(),
2835
+ ].join('/');
2836
+ xml += '<input type="hidden" name="' + attrName + '" value="' + xmlFixedValue + '">';
2837
+ }
2838
+ else if (view.type === AppFormItemTypes.DATETIME) {
2839
+ const dateValue = new Date(view.value);
2840
+ const xmlFixedValue = [
2841
+ pad(dateValue.getDate()),
2842
+ pad(dateValue.getMonth() + 1),
2843
+ dateValue.getFullYear(),
2844
+ pad(dateValue.getHours()),
2845
+ pad(dateValue.getMinutes()),
2846
+ pad(dateValue.getSeconds()),
2847
+ ].join('/');
2848
+ xml += '<input type="hidden" name="' + attrName + '" value="' + xmlFixedValue + '">';
2849
+ }
2850
+ else if (view.type === AppFormItemTypes.TAGS) {
2851
+ xml += `<input type="hidden" name="${attrName}" value="${(_c = (_b = view.value) === null || _b === void 0 ? void 0 : _b.map((v) => v.uri)) === null || _c === void 0 ? void 0 : _c.join(',')}">`;
2852
+ }
2853
+ else if (view.type === AppFormItemTypes.DESCRIPTION || view.type === AppFormItemTypes.TEXTAREAHTML) {
2854
+ xml += `<input type="hidden" name="${attrName}" value="${view.value.html}">`;
2855
+ }
2856
+ else {
2857
+ xml += `<input type="hidden" name="${attrName}" value="${view.value}">`;
2858
+ }
2859
+ xml += ']]></html>';
2860
+ }
2861
+ else {
2862
+ switch (view.type) {
2863
+ case AppFormItemTypes.CODEHTML: {
2864
+ const content = {
2865
+ ref: attrName,
2866
+ fixedValue: {
2867
+ html: view.value.html,
2868
+ text: view.value.text,
2869
+ },
2870
+ };
2871
+ xml += `<html><![CDATA[ <!-- <JAMESPOT.STUDIO.CODEHTML>${JSON.stringify(content)}</JAMESPOT.STUDIO.CODEHTML><JAMESPOT.STUDIO.FIELD_POS></JAMESPOT.STUDIO.FIELD_POS>-->]]></html>`;
2872
+ break;
2873
+ }
2874
+ case AppFormItemTypes.IMAGE:
2875
+ xml += '<image />';
2876
+ break;
2877
+ case ExtraAppFieldsItemViews.PUBLISHTO:
2878
+ xml += '<publishTo />';
2879
+ break;
2880
+ default:
2881
+ xml += "<attr name='" + attrName + "' />";
2882
+ break;
2883
+ }
2884
+ }
2885
+ return xml;
2886
+ }
2887
+ function pad(s) {
2888
+ return s < 10 ? '0' + s : s;
2889
+ }
2890
+
2133
2891
  const initialState$1 = {
2134
2892
  currentStudioApp: null,
2135
2893
  fetchCurrentStudioAppStatus: 'idle',
2136
2894
  saveCurrentStudioAppStatus: 'idle',
2895
+ installStudioAppStatus: 'idle',
2896
+ hasChanged: false,
2137
2897
  };
2138
2898
  const fetchCurrentStudioApp = createAsyncThunk('studio/fetchCurrentStudioApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
2139
2899
  const jApi = extra.jApi;
@@ -2168,6 +2928,24 @@ const saveCurrentStudioApp = createAsyncThunk('studio/saveCurrentStudioApp', (_,
2168
2928
  return rejectWithValue(error);
2169
2929
  }
2170
2930
  }));
2931
+ const installStudioApp = createAsyncThunk('studio/installApp', (_, { extra, rejectWithValue, getState, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
2932
+ const jApi = extra.jApi;
2933
+ const error = { error: 1, errorMsg: 'Error saving application' };
2934
+ const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
2935
+ if (!currentStudioApp) {
2936
+ return rejectWithValue(error);
2937
+ }
2938
+ const xml = appToXml(currentStudioApp);
2939
+ try {
2940
+ yield jApi.application.install(xml);
2941
+ dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
2942
+ return;
2943
+ }
2944
+ catch (_) {
2945
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
2946
+ return rejectWithValue(error);
2947
+ }
2948
+ }));
2171
2949
  const CurrentStudioAppSlice = createSlice({
2172
2950
  name: 'currentStudioApp',
2173
2951
  initialState: initialState$1,
@@ -2178,6 +2956,9 @@ const CurrentStudioAppSlice = createSlice({
2178
2956
  resetCurrentApp: (state) => {
2179
2957
  state.currentStudioApp = null;
2180
2958
  },
2959
+ setHasChanged: (state, action) => {
2960
+ state.hasChanged = action.payload;
2961
+ },
2181
2962
  },
2182
2963
  extraReducers: (builder) => {
2183
2964
  builder
@@ -2205,6 +2986,18 @@ const CurrentStudioAppSlice = createSlice({
2205
2986
  .addCase(saveCurrentStudioApp.rejected, (state) => {
2206
2987
  if (state.saveCurrentStudioAppStatus === 'pending')
2207
2988
  state.saveCurrentStudioAppStatus = 'idle';
2989
+ })
2990
+ .addCase(installStudioApp.pending, (state) => {
2991
+ if (state.installStudioAppStatus === 'idle')
2992
+ state.installStudioAppStatus = 'pending';
2993
+ })
2994
+ .addCase(installStudioApp.fulfilled, (state) => {
2995
+ if (state.installStudioAppStatus === 'pending')
2996
+ state.installStudioAppStatus = 'idle';
2997
+ })
2998
+ .addCase(installStudioApp.rejected, (state) => {
2999
+ if (state.installStudioAppStatus === 'pending')
3000
+ state.installStudioAppStatus = 'idle';
2208
3001
  });
2209
3002
  },
2210
3003
  });
@@ -2260,6 +3053,7 @@ function createNewStudioApp$1({ author, appName }) {
2260
3053
  idApp: newAppId,
2261
3054
  status: APP_STATUS_TYPE.DRAFT,
2262
3055
  author: author || '',
3056
+ studioVersion: 2,
2263
3057
  manifest: {
2264
3058
  appShortName: appName,
2265
3059
  appName: appName,
@@ -2524,12 +3318,13 @@ const studio = {
2524
3318
  cloneStudioApp,
2525
3319
  createNewStudioApp,
2526
3320
  fetchCurrentStudioApp,
2527
- saveCurrentStudioApp }),
3321
+ saveCurrentStudioApp,
3322
+ installStudioApp }),
2528
3323
  selectors: {
2529
3324
  selectStudioAppsList,
2530
3325
  selectCurrentStudioApp,
2531
3326
  },
2532
3327
  };
2533
3328
 
2534
- export { APP_STATUS_TYPE, AUDIENCE, AppFieldFormPropertyTypes, AppFormBannedFromViews, AppFormItemTypes, AppFormUniqueList, Application, AssetReservation, Bookmark, Comment, ExtraAppFieldsItemViews, Faq, MODE_EDIT, MODE_VIEW, MapExtraFieldsWithView, Model, Network, Platform, STUDIO_VIEW, Share, StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, jland, slice, studio, updateWidgetContent, viewsList };
3329
+ export { APP_STATUS_TYPE, AUDIENCE, 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, jland, slice, studio, updateWidgetContent, viewsList };
2535
3330
  //# sourceMappingURL=esm.js.map