@headless-adminapp/app 0.0.17-alpha.39 → 0.0.17-alpha.40

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.
@@ -38,12 +38,13 @@ const AppProvider = ({ children, appId, loadingComponent, notFoundComponent, })
38
38
  return acc;
39
39
  }, {})) !== null && _a !== void 0 ? _a : {};
40
40
  }, [schemaMetadataList]);
41
+ const contextValue = (0, react_1.useMemo)(() => ({ app, schemaMetadataDic, schemaMetadataList }), [app, schemaMetadataDic, schemaMetadataList]);
41
42
  if (isLoading) {
42
43
  return loadingComponent;
43
44
  }
44
45
  if (!app) {
45
46
  return notFoundComponent;
46
47
  }
47
- return ((0, jsx_runtime_1.jsx)(context_1.AppContext.Provider, { value: { app, schemaMetadataDic, schemaMetadataList }, children: children }));
48
+ return ((0, jsx_runtime_1.jsx)(context_1.AppContext.Provider, { value: contextValue, children: children }));
48
49
  };
49
50
  exports.AppProvider = AppProvider;
@@ -101,6 +101,10 @@ const AuthProvider = ({ sessionResolver, onUnauthenticated, children, }) => {
101
101
  (_a = onUnauthenticatedRef.current) === null || _a === void 0 ? void 0 : _a.call(onUnauthenticatedRef, 'sessionExpired');
102
102
  return;
103
103
  }
104
+ const MAX_TIMEOUT = 2147483647;
105
+ if (timeout > MAX_TIMEOUT) {
106
+ return;
107
+ }
104
108
  const timer = setTimeout(() => {
105
109
  var _a;
106
110
  contextValue.setValue({
@@ -34,9 +34,9 @@ export interface SchemaExperienceBuilderDefaults {
34
34
  interface SchemaExperienceBuilderOptions {
35
35
  }
36
36
  export declare class SchemaExperienceBuilder<S extends SchemaAttributes = SchemaAttributes> extends BaseSchemaExperienceBuilder<S> {
37
- private schema;
38
- private defaults?;
39
- private options?;
37
+ private readonly schema;
38
+ private readonly defaults?;
39
+ private readonly options?;
40
40
  constructor(schema: Schema<S>, defaults?: SchemaExperienceBuilderDefaults | undefined, options?: SchemaExperienceBuilderOptions | undefined);
41
41
  defineViewExperience(viewExperience: Pick<ViewExperience<S>, 'filter' | 'defaultSorting'> & {
42
42
  card?: ViewExperience<S>['card'];
@@ -36,17 +36,17 @@ class BaseSchemaExperienceBuilder {
36
36
  if (!this.defaultLookupId) {
37
37
  throw new Error('Default lookup is required');
38
38
  }
39
- if (!this.views.find(v => v.id === this.defaultViewId)) {
39
+ if (!this.views.find((v) => v.id === this.defaultViewId)) {
40
40
  throw new Error('Default view not found');
41
41
  }
42
- if (!this.forms.find(f => f.id === this.defaultFormId)) {
42
+ if (!this.forms.find((f) => f.id === this.defaultFormId)) {
43
43
  throw new Error('Default form not found');
44
44
  }
45
- if (!this.lookups.find(l => l.id === this.defaultLookupId)) {
45
+ if (!this.lookups.find((l) => l.id === this.defaultLookupId)) {
46
46
  throw new Error('Default lookup not found');
47
47
  }
48
48
  if (this.defaultQuickCreateFormId &&
49
- !this.quickCreateForms.find(f => f.id === this.defaultQuickCreateFormId)) {
49
+ !this.quickCreateForms.find((f) => f.id === this.defaultQuickCreateFormId)) {
50
50
  throw new Error('Default quick create form not found');
51
51
  }
52
52
  return {
@@ -158,9 +158,9 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
158
158
  var _a;
159
159
  const langugesSet = new Set();
160
160
  this.schema.localizedPluralLabels &&
161
- Object.keys(this.schema.localizedPluralLabels).forEach(key => langugesSet.add(key));
161
+ Object.keys(this.schema.localizedPluralLabels).forEach((key) => langugesSet.add(key));
162
162
  ((_a = this.defaults) === null || _a === void 0 ? void 0 : _a.localizedViewNames) &&
163
- Object.keys(this.defaults.localizedViewNames).forEach(key => langugesSet.add(key));
163
+ Object.keys(this.defaults.localizedViewNames).forEach((key) => langugesSet.add(key));
164
164
  const localizedLabels = Array.from(langugesSet).reduce((acc, key) => {
165
165
  var _a, _b, _c, _d, _e, _f;
166
166
  const localizedPluralName = (_c = (_b = (_a = this.schema.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : this.schema.pluralLabel.toLowerCase();
@@ -178,7 +178,7 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
178
178
  if (!defaultId) {
179
179
  return data[0].id;
180
180
  }
181
- if (!data.find(x => x.id === defaultId)) {
181
+ if (!data.find((x) => x.id === defaultId)) {
182
182
  return data[0].id;
183
183
  }
184
184
  return defaultId;
@@ -243,11 +243,11 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
243
243
  defaultViewId,
244
244
  defaultLookupId,
245
245
  defaultAssociatedViewId,
246
- quickCreateForms: (_d = (_c = experience.quickCreateForms) === null || _c === void 0 ? void 0 : _c.map(x => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _d !== void 0 ? _d : [],
247
- views: (_e = views.map(x => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _e !== void 0 ? _e : [],
248
- forms: (_f = forms.map(x => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _f !== void 0 ? _f : [],
249
- lookups: (_g = lookups.map(x => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _g !== void 0 ? _g : [],
250
- associatedViews: (_h = associatedViews.map(x => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _h !== void 0 ? _h : [],
246
+ quickCreateForms: (_d = (_c = experience.quickCreateForms) === null || _c === void 0 ? void 0 : _c.map((x) => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _d !== void 0 ? _d : [],
247
+ views: (_e = views.map((x) => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _e !== void 0 ? _e : [],
248
+ forms: (_f = forms.map((x) => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _f !== void 0 ? _f : [],
249
+ lookups: (_g = lookups.map((x) => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _g !== void 0 ? _g : [],
250
+ associatedViews: (_h = associatedViews.map((x) => (Object.assign(Object.assign({}, x), { logicalName: this.logicalName })))) !== null && _h !== void 0 ? _h : [],
251
251
  formCommands: experience.formCommands,
252
252
  subgridCommands: experience.subgridCommands,
253
253
  viewCommands: experience.viewCommands,
package/builders/utils.js CHANGED
@@ -157,10 +157,10 @@ const exportRecordsXLS = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fi
157
157
  });
158
158
  // Generate the Excel file
159
159
  const buffer = yield workbook.xlsx.writeBuffer();
160
- var blob = new Blob([buffer], {
160
+ const blob = new Blob([buffer], {
161
161
  type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
162
162
  });
163
- var link = document.createElement('a');
163
+ const link = document.createElement('a');
164
164
  link.href = window.URL.createObjectURL(blob);
165
165
  link.download = fileName;
166
166
  link.click();
@@ -22,6 +22,6 @@ function InsightsProvider({ children, experience, insightLookup, onInsightSelect
22
22
  experience,
23
23
  data: experience.defaultData,
24
24
  });
25
- }, [experience, insightLookup]);
25
+ }, [experience, insightsValues]);
26
26
  return ((0, jsx_runtime_1.jsx)(context_1.InsightsContext.Provider, { value: insightsValues, children: children }));
27
27
  }
@@ -1,10 +1,7 @@
1
- import { SchemaAttributes } from '@headless-adminapp/core/schema';
2
1
  export declare function useMetadata(): {
3
- schemas: Record<string, import("@headless-adminapp/core/schema").Schema<SchemaAttributes>>;
2
+ schemas: Record<string, import("@headless-adminapp/core/schema").Schema<import("@headless-adminapp/core/schema").SchemaAttributes>>;
4
3
  schemaLoading: boolean;
5
- /*** @deprecated */
6
- getSchema: <S extends SchemaAttributes = SchemaAttributes>(logicalName: string) => import("@headless-adminapp/core/schema").Schema<S>;
7
- schemaStore: import("@headless-adminapp/core/store").ISchemaStore<SchemaAttributes>;
4
+ schemaStore: import("@headless-adminapp/core/store").ISchemaStore<import("@headless-adminapp/core/schema").SchemaAttributes>;
8
5
  appStore: import("@headless-adminapp/core/store").IClientAppStore;
9
6
  experienceStore: import("@headless-adminapp/core/store").ISchemaExperienceStore;
10
7
  };
@@ -14,17 +14,11 @@ function useMetadata() {
14
14
  // );
15
15
  const schemaLoading = false;
16
16
  const schemas = schemaStore.getAllSchema();
17
- /*** @deprecated */
18
- const getSchema = (0, react_1.useCallback)((logicalName) => {
19
- return schemaStore.getSchema(logicalName);
20
- }, [schemaStore]);
21
17
  return (0, react_1.useMemo)(() => ({
22
18
  schemas,
23
19
  schemaLoading,
24
- /*** @deprecated */
25
- getSchema,
26
20
  schemaStore,
27
21
  appStore,
28
22
  experienceStore,
29
- }), [schemas, schemaLoading, schemaStore, appStore, experienceStore, getSchema]);
23
+ }), [schemas, schemaLoading, schemaStore, appStore, experienceStore]);
30
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/app",
3
- "version": "0.0.17-alpha.39",
3
+ "version": "0.0.17-alpha.40",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -39,5 +39,5 @@
39
39
  "react-hook-form": "7.52.2",
40
40
  "yup": "^1.4.0"
41
41
  },
42
- "gitHead": "2bfa7d267f5fa6beb476fda508c43661444dc894"
42
+ "gitHead": "5141e4c378ed0b2aac011927e4d6c10c797624e0"
43
43
  }