ingeniuscliq-core 0.1.8 → 0.1.10

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/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "ingeniuscliq-core",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "IngeniusCliq Core UI y lógica compartida",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
+ "main": "./dist/registry/index.cjs",
8
+ "module": "./dist/registry/index.js",
9
+ "types": "./dist/registry/index.d.ts",
7
10
  "exports": {
8
11
  ".": {
9
12
  "import": "./dist/registry/index.js",
@@ -1,144 +0,0 @@
1
- var o = Object.defineProperty;
2
- var u = (s, e, t) => e in s ? o(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var i = (s, e, t) => u(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { b as c, c as n, p as l } from "./useAuth-nsWEEQxd.js";
5
- const S = [
6
- {
7
- id: 1,
8
- name: "menu.store",
9
- route: "/store",
10
- isMainAction: !0
11
- },
12
- {
13
- id: 2,
14
- name: "menu.about",
15
- route: "/info"
16
- },
17
- {
18
- id: 3,
19
- name: "menu.contact",
20
- route: "/contact-us"
21
- }
22
- ], $ = (s) => s == null ? void 0 : s.styles.reduce((e, t) => ({
23
- ...e,
24
- ...Object.fromEntries(
25
- t.colorProperties.map((r) => [r.key, r.value])
26
- )
27
- }), {}), b = (s, e) => {
28
- const r = Object.keys(/* @__PURE__ */ Object.assign({})).find(
29
- (a) => a.includes(`/src/components/templates/${s}/`) && a.endsWith(`/${e}.tsx`)
30
- );
31
- return r || Object.keys(/* @__PURE__ */ Object.assign({})).find((a) => a.endsWith(`/${e}.tsx`));
32
- };
33
- function R(s) {
34
- return !s || typeof s != "string" ? s : s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
35
- }
36
- class h {
37
- constructor(e, t = c) {
38
- i(this, "resource");
39
- i(this, "api", c);
40
- i(this, "apiPrefix", "/api");
41
- i(this, "crudResource");
42
- i(this, "setCrudResourceProperty", (e, t) => {
43
- switch (e) {
44
- case "getAll":
45
- this.crudResource.getAll = t;
46
- break;
47
- case "get":
48
- this.crudResource.get = t;
49
- break;
50
- case "create":
51
- this.crudResource.create = t;
52
- break;
53
- case "update":
54
- this.crudResource.update = t;
55
- break;
56
- case "delete":
57
- this.crudResource.delete = t;
58
- break;
59
- }
60
- });
61
- i(this, "buildCrudResource", () => this.resource.trim().length !== 0 && !this.resource.endsWith("s") ? {
62
- getAll: `${this.resource}s`,
63
- get: this.resource,
64
- create: this.resource,
65
- update: this.resource,
66
- delete: this.resource
67
- } : {
68
- getAll: this.resource,
69
- get: this.resource,
70
- create: this.resource,
71
- update: this.resource,
72
- delete: this.resource
73
- });
74
- i(this, "getAll", (e) => this.api.get(`${this.apiPrefix}/${this.crudResource.getAll}`, { params: e }));
75
- i(this, "getById", (e) => this.api.get(`${this.apiPrefix}/${this.crudResource.get}/${e}`));
76
- i(this, "create", (e) => this.api.post(`${this.apiPrefix}/${this.crudResource.create}`, e));
77
- i(this, "update", (e, t) => this.api.put(`${this.apiPrefix}/${this.crudResource.update}/${e}`, t));
78
- i(this, "deleteById", (e) => this.api.delete(`${this.apiPrefix}/${this.crudResource.delete}/${e}`));
79
- this.resource = e, this.crudResource = this.buildCrudResource(), this.api = t;
80
- }
81
- }
82
- class p extends h {
83
- constructor() {
84
- super("layout");
85
- }
86
- fetchTemplate() {
87
- return this.api.get(this.apiPrefix + "/layout");
88
- }
89
- }
90
- class d {
91
- constructor(e = new p(), t = this.initialState) {
92
- i(this, "customizationService");
93
- i(this, "initialState", {
94
- template: null,
95
- components: null,
96
- styles: null,
97
- settings: null,
98
- loading: !1,
99
- error: null
100
- });
101
- this.customizationService = e, this.initialState = t;
102
- }
103
- build() {
104
- return n()(
105
- l(
106
- (e, t) => ({
107
- ...this.initialState,
108
- getTemplate: () => t().template,
109
- getComponents: () => t().components,
110
- getStyles: () => t().styles,
111
- getSettings: () => t().settings,
112
- fetchTemplate: async () => (await this.customizationService.fetchTemplate()).data.data,
113
- setTemplate: (r) => e({ template: r }),
114
- setComponents: (r) => e({ components: r }),
115
- setStyles: (r) => e({ styles: r }),
116
- setSettings: (r) => e({ settings: r }),
117
- setLoading: (r) => e({ loading: r }),
118
- setError: (r) => e({ error: r }),
119
- reset: () => e(this.initialState)
120
- }),
121
- {
122
- name: "template-storage",
123
- partialize: (e) => ({
124
- template: e.template,
125
- components: e.components,
126
- styles: e.styles,
127
- settings: e.settings
128
- })
129
- }
130
- )
131
- );
132
- }
133
- }
134
- const m = new d(), C = m.build();
135
- export {
136
- h as B,
137
- d as C,
138
- S,
139
- p as a,
140
- R as c,
141
- b as f,
142
- $ as g,
143
- C as u
144
- };