ingeniuscliq-core 0.1.26 → 0.1.28
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/components/ui/button.d.ts +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +26233 -0
- package/dist/modules/CorePayForm/classes/CorePayFormBuilder.d.ts +2 -2
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.d.ts +2 -2
- package/dist/stores/customizationStore.d.ts +5 -5
- package/package.json +1 -11
- package/dist/authStore-CBIJbSuH.js +0 -2011
- package/dist/customizationStore-C7lxXp5P.js +0 -144
- package/dist/index2.js +0 -20
- package/dist/index3.js +0 -421
- package/dist/index4.js +0 -22856
- package/dist/useAuth-CQWwwHN3.js +0 -841
|
@@ -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 { a as c, c as n, p as l } from "./authStore-CBIJbSuH.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
|
-
}), {}), R = (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 b(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
|
-
b as c,
|
|
141
|
-
R as f,
|
|
142
|
-
$ as g,
|
|
143
|
-
C as u
|
|
144
|
-
};
|
package/dist/index2.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { t as i } from "./useAuth-CQWwwHN3.js";
|
|
2
|
-
import { b as p, u as g, a as m } from "./useAuth-CQWwwHN3.js";
|
|
3
|
-
function n() {
|
|
4
|
-
return {
|
|
5
|
-
notify: (t, o, s = 1e3, e) => {
|
|
6
|
-
i(t, {
|
|
7
|
-
description: o,
|
|
8
|
-
duration: s,
|
|
9
|
-
position: "top-right",
|
|
10
|
-
action: e
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
p as useAuth,
|
|
17
|
-
g as useIsMobile,
|
|
18
|
-
m as useLanguage,
|
|
19
|
-
n as useNotify
|
|
20
|
-
};
|
package/dist/index3.js
DELETED
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
var p = Object.defineProperty;
|
|
2
|
-
var h = (o, t, r) => t in o ? p(o, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[t] = r;
|
|
3
|
-
var i = (o, t, r) => h(o, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { B as d } from "./customizationStore-C7lxXp5P.js";
|
|
5
|
-
import { a as Ft, C as Ot, S as qt, c as $t, f as Bt, g as Nt, u as xt } from "./customizationStore-C7lxXp5P.js";
|
|
6
|
-
import { c as u, p as l } from "./authStore-CBIJbSuH.js";
|
|
7
|
-
import { C as Dt, L as zt, d as Mt, f as Ut, R as Ht, U as Gt, a as Vt, e as kt, b as Kt, g as Yt, i as jt, u as Jt } from "./authStore-CBIJbSuH.js";
|
|
8
|
-
import C from "i18next";
|
|
9
|
-
import { default as Wt } from "i18next";
|
|
10
|
-
import { initReactI18next as _ } from "react-i18next";
|
|
11
|
-
class wt {
|
|
12
|
-
}
|
|
13
|
-
const S = { store: "Store", about: "About", contact: "Contact" }, v = { login: "Login", register: "Register", noAccount: "Don't have an account?", alreadyHaveAccount: "Already have an account?" }, f = {
|
|
14
|
-
menu: S,
|
|
15
|
-
auth: v
|
|
16
|
-
}, y = { store: "Tienda", about: "Acerca de", contact: "Contacto" }, g = { login: "Iniciar sesión", register: "Registrarse", noAccount: "¿No tiene una cuenta?", alreadyHaveAccount: "¿Ya tiene una cuenta?" }, I = {
|
|
17
|
-
menu: y,
|
|
18
|
-
auth: g
|
|
19
|
-
}, w = "Loading...", E = { create: "Successfully created", update: "Successfully updated", delete: "Successfully deleted" }, T = { required: "This field is required", invalid: "The entered value is invalid", notFound: "The requested resource was not found" }, A = { delete: "Are you sure you want to delete this item?", cancel: "Are you sure you want to cancel?" }, R = { name: "Name is required", lastname: "Lastname is required", email: "Invalid email address", password: "Password must be at least 8 characters", passwordConfirmation: "Confirm password required", passwordConfirmationNotMatch: "Passwords do not match", customer_name: "Name is required", customer_email: "Invalid email address", customer_phone: { required: "Phone is required", prefix: "Phone must start with +", length: "Phone must be 10 digits" }, customer_address: "Address is required" }, P = {
|
|
20
|
-
loading: w,
|
|
21
|
-
success: E,
|
|
22
|
-
error: T,
|
|
23
|
-
confirmation: A,
|
|
24
|
-
validation: R
|
|
25
|
-
}, b = "Cargando...", F = { create: "Creado exitosamente", update: "Actualizado exitosamente", delete: "Eliminado exitosamente" }, O = { required: "Este campo es requerido", invalid: "El valor ingresado no es válido", notFound: "No se encontró el recurso solicitado" }, q = { delete: "¿Está seguro que desea eliminar este elemento?", cancel: "¿Está seguro que desea cancelar?" }, $ = { name: "El nombre es requerido", lastname: "El apellido es requerido", email: "El correo electrónico no es válido", password: "La contraseña debe tener al menos 8 caracteres", passwordConfirmation: "Confirmar contraseña requerida", passwordConfirmationNotMatch: "Las contraseñas no coinciden", customer_name: "El nombre es requerido", customer_email: "El correo electrónico no es válido", customer_phone: { required: "El teléfono es requerido", prefix: "El teléfono debe empezar con +", length: "El teléfono debe tener 10 dígitos" }, customer_address: "La dirección es requerida" }, B = {
|
|
26
|
-
loading: b,
|
|
27
|
-
success: F,
|
|
28
|
-
error: O,
|
|
29
|
-
confirmation: q,
|
|
30
|
-
validation: $
|
|
31
|
-
}, N = "Name", x = "Lastname", L = "Email", D = "Password", z = "Confirm password", M = "Phone", U = "Address", H = "Note", G = "Name", V = "Email", k = "Phone", K = "Address", Y = {
|
|
32
|
-
name: N,
|
|
33
|
-
lastname: x,
|
|
34
|
-
email: L,
|
|
35
|
-
password: D,
|
|
36
|
-
password_confirmation: z,
|
|
37
|
-
phone: M,
|
|
38
|
-
address: U,
|
|
39
|
-
note: H,
|
|
40
|
-
customer_name: G,
|
|
41
|
-
customer_email: V,
|
|
42
|
-
customer_phone: k,
|
|
43
|
-
customer_address: K
|
|
44
|
-
}, j = "Nombre", J = "Apellido", Q = "Correo electrónico", W = "Contraseña", X = "Confirmar contraseña", Z = "Teléfono", tt = "Dirección", et = "Notas", rt = "Nombre", at = "Correo electrónico", st = "Teléfono", ot = "Dirección", ct = {
|
|
45
|
-
name: j,
|
|
46
|
-
lastname: J,
|
|
47
|
-
email: Q,
|
|
48
|
-
password: W,
|
|
49
|
-
password_confirmation: X,
|
|
50
|
-
phone: Z,
|
|
51
|
-
address: tt,
|
|
52
|
-
note: et,
|
|
53
|
-
customer_name: rt,
|
|
54
|
-
customer_email: at,
|
|
55
|
-
customer_phone: st,
|
|
56
|
-
customer_address: ot
|
|
57
|
-
}, it = {
|
|
58
|
-
en: {
|
|
59
|
-
translation: {
|
|
60
|
-
...f,
|
|
61
|
-
modules: {},
|
|
62
|
-
// Initialize empty modules object
|
|
63
|
-
messages: P,
|
|
64
|
-
fields: Y
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
es: {
|
|
68
|
-
translation: {
|
|
69
|
-
...I,
|
|
70
|
-
modules: {},
|
|
71
|
-
// Initialize empty modules object
|
|
72
|
-
messages: B,
|
|
73
|
-
fields: ct
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
C.use(_).init({
|
|
78
|
-
resources: it,
|
|
79
|
-
lng: "en",
|
|
80
|
-
// default language
|
|
81
|
-
fallbackLng: "en",
|
|
82
|
-
interpolation: {
|
|
83
|
-
escapeValue: !1
|
|
84
|
-
// not needed for react as it escapes by default
|
|
85
|
-
},
|
|
86
|
-
// Uncomment these options if you want to detect user's language
|
|
87
|
-
// detection: {
|
|
88
|
-
// order: ['localStorage', 'navigator']
|
|
89
|
-
// },
|
|
90
|
-
// have a common namespace used around the full app
|
|
91
|
-
defaultNS: "translation",
|
|
92
|
-
ns: ["translation"]
|
|
93
|
-
});
|
|
94
|
-
class nt extends d {
|
|
95
|
-
constructor() {
|
|
96
|
-
super("orders");
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
class Et {
|
|
100
|
-
constructor(t = new nt(), r = this.initialState) {
|
|
101
|
-
i(this, "orderService");
|
|
102
|
-
i(this, "initialState", {
|
|
103
|
-
order: {
|
|
104
|
-
id: 0,
|
|
105
|
-
customer_name: "",
|
|
106
|
-
customer_email: "",
|
|
107
|
-
customer_address: "",
|
|
108
|
-
customer_phone: "",
|
|
109
|
-
order_number: "",
|
|
110
|
-
userable_type: "",
|
|
111
|
-
userable_id: 0,
|
|
112
|
-
items_subtotal: 0,
|
|
113
|
-
current_base_currency: "",
|
|
114
|
-
currency: "",
|
|
115
|
-
exchange_rate: 0,
|
|
116
|
-
status: "",
|
|
117
|
-
base_total_amount_in_cents: 0,
|
|
118
|
-
base_total_amount_formatted: "",
|
|
119
|
-
total_amount_in_cents: 0,
|
|
120
|
-
total_amount_formatted: "",
|
|
121
|
-
status_name: "",
|
|
122
|
-
allowed_next_statuses: [],
|
|
123
|
-
products: []
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
this.orderService = t, this.initialState = r;
|
|
127
|
-
}
|
|
128
|
-
build() {
|
|
129
|
-
return u()(
|
|
130
|
-
l(
|
|
131
|
-
(t, r) => ({
|
|
132
|
-
...this.initialState,
|
|
133
|
-
createOrder: async (e) => {
|
|
134
|
-
const a = await this.orderService.create(e), s = a.data.data.order;
|
|
135
|
-
return t({ order: s }), a.data;
|
|
136
|
-
},
|
|
137
|
-
fetchOrder: async (e) => {
|
|
138
|
-
const a = await this.orderService.getById(e), s = a.data.data;
|
|
139
|
-
return t({ order: s }), a.data;
|
|
140
|
-
},
|
|
141
|
-
getOrder: () => r().order
|
|
142
|
-
}),
|
|
143
|
-
{
|
|
144
|
-
name: "order-storage",
|
|
145
|
-
partialize: (t) => ({
|
|
146
|
-
order: t.order
|
|
147
|
-
})
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
class dt extends d {
|
|
154
|
-
constructor() {
|
|
155
|
-
super("payforms"), this.setCrudResourceProperty("getAll", "payforms/actives");
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
class Tt {
|
|
159
|
-
constructor(t = new dt(), r = this.initialState) {
|
|
160
|
-
i(this, "payFormService");
|
|
161
|
-
i(this, "initialState", {
|
|
162
|
-
payForms: null,
|
|
163
|
-
loading: !1,
|
|
164
|
-
error: null
|
|
165
|
-
});
|
|
166
|
-
this.payFormService = t, this.initialState = r;
|
|
167
|
-
}
|
|
168
|
-
build() {
|
|
169
|
-
return u()(
|
|
170
|
-
l(
|
|
171
|
-
(t, r) => ({
|
|
172
|
-
...this.initialState,
|
|
173
|
-
setPayForms: (e) => t({ payForms: e }),
|
|
174
|
-
setLoading: (e) => t({ loading: e }),
|
|
175
|
-
setError: (e) => t({ error: e }),
|
|
176
|
-
getPayForms: () => r().payForms,
|
|
177
|
-
fetchPayForms: async (e) => {
|
|
178
|
-
try {
|
|
179
|
-
const a = await this.payFormService.getAll(e);
|
|
180
|
-
return t({ payForms: a.data.data }), a.data;
|
|
181
|
-
} catch (a) {
|
|
182
|
-
throw t({ error: a }), a;
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
reset: () => t(this.initialState)
|
|
186
|
-
}),
|
|
187
|
-
{
|
|
188
|
-
name: "pay-form-storage",
|
|
189
|
-
partialize: (t) => ({
|
|
190
|
-
payForms: t.payForms
|
|
191
|
-
})
|
|
192
|
-
}
|
|
193
|
-
)
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
class ut extends d {
|
|
198
|
-
constructor() {
|
|
199
|
-
super("product"), this.setCrudResourceProperty("getAll", "shop/products"), this.setCrudResourceProperty("get", "products");
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
class At {
|
|
203
|
-
constructor(t = new ut(), r = this.initialState) {
|
|
204
|
-
i(this, "productService");
|
|
205
|
-
i(this, "initialState", {
|
|
206
|
-
productDetails: null,
|
|
207
|
-
products: null,
|
|
208
|
-
loading: !1,
|
|
209
|
-
error: null
|
|
210
|
-
});
|
|
211
|
-
this.productService = t, this.initialState = r;
|
|
212
|
-
}
|
|
213
|
-
build() {
|
|
214
|
-
return u()(
|
|
215
|
-
l(
|
|
216
|
-
(t, r) => ({
|
|
217
|
-
...this.initialState,
|
|
218
|
-
setProductDetails: (e) => t({ productDetails: e }),
|
|
219
|
-
setProducts: (e) => t({ products: e }),
|
|
220
|
-
setLoading: (e) => t({ loading: e }),
|
|
221
|
-
setError: (e) => t({ error: e }),
|
|
222
|
-
getProducts: () => r().products,
|
|
223
|
-
fetchProducts: async (e) => {
|
|
224
|
-
try {
|
|
225
|
-
const a = await this.productService.getAll(e);
|
|
226
|
-
return t({ products: a.data.data }), a.data;
|
|
227
|
-
} catch (a) {
|
|
228
|
-
throw t({ error: a }), a;
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
getProductDetails: () => r().productDetails,
|
|
232
|
-
fetchProductDetails: async (e) => {
|
|
233
|
-
try {
|
|
234
|
-
const a = await this.productService.getById(e);
|
|
235
|
-
return t({ productDetails: a.data.data }), a.data;
|
|
236
|
-
} catch (a) {
|
|
237
|
-
throw t({ error: a }), a;
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
reset: () => t(this.initialState)
|
|
241
|
-
}),
|
|
242
|
-
{
|
|
243
|
-
name: "product-storage",
|
|
244
|
-
partialize: (t) => ({
|
|
245
|
-
productDetails: t.productDetails,
|
|
246
|
-
products: t.products
|
|
247
|
-
})
|
|
248
|
-
}
|
|
249
|
-
)
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
const lt = "/api/cart/product/add", mt = "/api/cart/product/remove", pt = "/api/cart/product/delete", ht = "/api/cart/clear", Ct = "/api/cart/items", _t = "/api/cart";
|
|
254
|
-
class St extends d {
|
|
255
|
-
constructor() {
|
|
256
|
-
super("shop-cart");
|
|
257
|
-
}
|
|
258
|
-
addToCart(t, r) {
|
|
259
|
-
return this.api.post(lt, { product_id: t, quantity: r });
|
|
260
|
-
}
|
|
261
|
-
removeFromCart(t) {
|
|
262
|
-
this.api.put(mt, { product_id: t });
|
|
263
|
-
}
|
|
264
|
-
removeItemFromCart(t) {
|
|
265
|
-
this.api.delete(pt, { data: { product_id: t } });
|
|
266
|
-
}
|
|
267
|
-
clearCart() {
|
|
268
|
-
this.api.post(ht);
|
|
269
|
-
}
|
|
270
|
-
getCartItems() {
|
|
271
|
-
return this.api.get(Ct);
|
|
272
|
-
}
|
|
273
|
-
getCart() {
|
|
274
|
-
return this.api.get(_t);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
class Rt {
|
|
278
|
-
constructor(t = new St(), r = this.initialState) {
|
|
279
|
-
i(this, "shopCartService");
|
|
280
|
-
i(this, "initialState", {
|
|
281
|
-
cart: {
|
|
282
|
-
items: [],
|
|
283
|
-
subtotal: 0,
|
|
284
|
-
total: 0,
|
|
285
|
-
itemized_subtotals: []
|
|
286
|
-
},
|
|
287
|
-
cartItems: []
|
|
288
|
-
});
|
|
289
|
-
this.shopCartService = t, this.initialState = r;
|
|
290
|
-
}
|
|
291
|
-
build() {
|
|
292
|
-
return u()(
|
|
293
|
-
l(
|
|
294
|
-
(t, r) => ({
|
|
295
|
-
...this.initialState,
|
|
296
|
-
addToCart: async (e, a) => {
|
|
297
|
-
const s = r().cart, c = r().cartItems;
|
|
298
|
-
try {
|
|
299
|
-
const n = await this.shopCartService.addToCart(e, a);
|
|
300
|
-
t((m) => ({ cartItems: [...m.cartItems, n.data.data], cart: { ...m.cart, items: [...m.cart.items, n.data.data] } }));
|
|
301
|
-
} catch (n) {
|
|
302
|
-
console.error(n), t(() => ({ cart: s, cartItems: c }));
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
removeFromCart: (e) => {
|
|
306
|
-
const a = r().cart;
|
|
307
|
-
try {
|
|
308
|
-
this.shopCartService.removeFromCart(e);
|
|
309
|
-
const s = r().cart.items.find((c) => c.productible_id === e);
|
|
310
|
-
s && t(
|
|
311
|
-
(c) => ({
|
|
312
|
-
cart: {
|
|
313
|
-
...c.cart,
|
|
314
|
-
items: [
|
|
315
|
-
...c.cart.items,
|
|
316
|
-
{ ...s, quantity: s.quantity - 1 }
|
|
317
|
-
]
|
|
318
|
-
},
|
|
319
|
-
cartItems: [
|
|
320
|
-
...c.cartItems,
|
|
321
|
-
{ ...s, quantity: s.quantity - 1 }
|
|
322
|
-
]
|
|
323
|
-
})
|
|
324
|
-
);
|
|
325
|
-
} catch (s) {
|
|
326
|
-
console.error(s), t(() => ({ cart: a }));
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
removeItemFromCart: (e) => {
|
|
330
|
-
const a = r().cart;
|
|
331
|
-
try {
|
|
332
|
-
this.shopCartService.removeItemFromCart(e), t((s) => ({ cart: { ...s.cart, items: s.cart.items.filter((c) => c.productible_id !== e) }, cartItems: s.cartItems.filter((c) => c.productible_id !== e) }));
|
|
333
|
-
} catch (s) {
|
|
334
|
-
console.error(s), t(() => ({ cart: a }));
|
|
335
|
-
}
|
|
336
|
-
},
|
|
337
|
-
clearCart: () => {
|
|
338
|
-
const e = r().cart, a = r().cartItems;
|
|
339
|
-
try {
|
|
340
|
-
this.shopCartService.clearCart(), t({ ...this.initialState });
|
|
341
|
-
} catch (s) {
|
|
342
|
-
console.error(s), t(() => ({ cart: e, cartItems: a }));
|
|
343
|
-
}
|
|
344
|
-
},
|
|
345
|
-
getCartItems: () => r().cartItems,
|
|
346
|
-
getCart: () => r().cart,
|
|
347
|
-
setCart: (e) => {
|
|
348
|
-
t({ cart: e });
|
|
349
|
-
},
|
|
350
|
-
setCartItems: (e) => {
|
|
351
|
-
t({ cartItems: e });
|
|
352
|
-
},
|
|
353
|
-
fetchCart: async () => {
|
|
354
|
-
const e = r().cart, a = r().cartItems;
|
|
355
|
-
try {
|
|
356
|
-
let s = await this.shopCartService.getCart();
|
|
357
|
-
return t(() => ({ cart: s.data.data, cartItems: s.data.data.items })), s.data;
|
|
358
|
-
} catch (s) {
|
|
359
|
-
throw console.error(s), t(() => ({ cart: e, cartItems: a })), s;
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
fetchCartItems: async () => {
|
|
363
|
-
const e = r().cartItems, a = r().cart;
|
|
364
|
-
try {
|
|
365
|
-
let s = await this.shopCartService.getCartItems();
|
|
366
|
-
return t(() => ({ cartItems: s.data.data })), s.data;
|
|
367
|
-
} catch (s) {
|
|
368
|
-
throw console.error(s), t(() => ({ cartItems: e, cart: a })), s;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}),
|
|
372
|
-
{
|
|
373
|
-
name: "shop-cart-storage",
|
|
374
|
-
partialize: (t) => ({
|
|
375
|
-
cart: t.cart,
|
|
376
|
-
cartItems: t.cartItems
|
|
377
|
-
})
|
|
378
|
-
}
|
|
379
|
-
)
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
export {
|
|
384
|
-
d as BaseService,
|
|
385
|
-
Dt as CoreAuthBaseService,
|
|
386
|
-
wt as CoreBuilder,
|
|
387
|
-
Ft as CoreCustomizationBaseService,
|
|
388
|
-
Ot as CoreCustomizationBuilder,
|
|
389
|
-
nt as CoreOrderBaseService,
|
|
390
|
-
Et as CoreOrderBuilder,
|
|
391
|
-
dt as CorePayFormBaseService,
|
|
392
|
-
Tt as CorePayFormBuilder,
|
|
393
|
-
ut as CoreProductBaseService,
|
|
394
|
-
At as CoreProductBuilder,
|
|
395
|
-
St as CoreShopCartBaseService,
|
|
396
|
-
Rt as CoreShopCartBuilder,
|
|
397
|
-
zt as LOGIN_ROUTE,
|
|
398
|
-
Mt as LOGOUT_ROUTE,
|
|
399
|
-
Ut as REFRESH_TOKEN_ROUTE,
|
|
400
|
-
Ht as REGISTER_ROUTE,
|
|
401
|
-
lt as SHOP_CART_ADD_TO_CART,
|
|
402
|
-
ht as SHOP_CART_CLEAR_CART,
|
|
403
|
-
_t as SHOP_CART_GET_CART,
|
|
404
|
-
Ct as SHOP_CART_GET_CART_ITEMS,
|
|
405
|
-
mt as SHOP_CART_REMOVE_FROM_CART,
|
|
406
|
-
pt as SHOP_CART_REMOVE_ITEM_FROM_CART,
|
|
407
|
-
qt as SUB_MENU_HEADER,
|
|
408
|
-
Gt as USER_ROUTE,
|
|
409
|
-
Vt as api,
|
|
410
|
-
$t as capitalizeFirstLetter,
|
|
411
|
-
kt as ensureCsrfToken,
|
|
412
|
-
Bt as findComponentPath,
|
|
413
|
-
Nt as getTemplateStyles,
|
|
414
|
-
Kt as getTenantName,
|
|
415
|
-
Yt as getTenantURL,
|
|
416
|
-
Wt as i18n,
|
|
417
|
-
jt as isCentralAccess,
|
|
418
|
-
it as resources,
|
|
419
|
-
Jt as useAuthStore,
|
|
420
|
-
xt as useCustomizationStore
|
|
421
|
-
};
|