ingeniuscliq-core 0.5.9 → 0.5.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.
@@ -1,5 +1,4 @@
1
1
  export * from './axiosGlobal';
2
2
  export * from './strings';
3
- export * from './numbers';
4
3
  export * from './image';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAE9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAE1B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAE9B,cAAc,WAAW,CAAC;AAE1B,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  export { CoreBuilder } from './classes/CoreBuilder.js';
2
2
  export { api, ensureCsrfToken, initAxiosConfigs } from './helpers/axiosGlobal.js';
3
3
  export { capitalizeFirstLetter } from './helpers/strings.js';
4
- export { formatPrice } from './helpers/numbers.js';
5
4
  export { getImageUrlByTenant } from './helpers/image.js';
6
5
  export { resources } from './i18n/config.js';
7
6
  export { loadModuleTranslations } from './i18n/utils/loadModuleTranslations.js';
@@ -9,6 +8,7 @@ export { getModuleNamespace } from './i18n/utils/getModuleNamespace.js';
9
8
  export { BaseService } from './services/base.js';
10
9
  export { createStoreFactory } from './services/factory.js';
11
10
  export { useCustomizationStore } from './stores/customizationStore.js';
11
+ export { useCurrencyStore } from './stores/currencyStore.js';
12
12
  export { CoreAuthBuilder } from './modules/CoreAuth/classes/CoreAuthBuilder.js';
13
13
  export { LOGIN_ROUTE, LOGOUT_ROUTE, REGISTER_ROUTE, USER_ROUTE } from './modules/CoreAuth/constants/auth.js';
14
14
  export { CoreAuthBaseService } from './modules/CoreAuth/services/base.js';
@@ -0,0 +1,23 @@
1
+ import { CoreProductCurrency } from '../modules/CoreProduct/types/CoreProduct';
2
+ interface CurrencyStore {
3
+ currency: CoreProductCurrency;
4
+ setCurrency: (currency: CoreProductCurrency) => void;
5
+ formatPrice: (price: number) => string;
6
+ }
7
+ export declare const useCurrencyStore: import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<CurrencyStore>, "persist"> & {
8
+ persist: {
9
+ setOptions: (options: Partial<import('zustand/middleware').PersistOptions<CurrencyStore, {
10
+ currency: CoreProductCurrency;
11
+ }>>) => void;
12
+ clearStorage: () => void;
13
+ rehydrate: () => Promise<void> | void;
14
+ hasHydrated: () => boolean;
15
+ onHydrate: (fn: (state: CurrencyStore) => void) => () => void;
16
+ onFinishHydration: (fn: (state: CurrencyStore) => void) => () => void;
17
+ getOptions: () => Partial<import('zustand/middleware').PersistOptions<CurrencyStore, {
18
+ currency: CoreProductCurrency;
19
+ }>>;
20
+ };
21
+ }>;
22
+ export {};
23
+ //# sourceMappingURL=currencyStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"currencyStore.d.ts","sourceRoot":"","sources":["../../src/stores/currencyStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,UAAU,aAAa;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,WAAW,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACrD,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1C;AAUD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;EAyB5B,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { create } from 'zustand';
2
+ import { persist } from '../node_modules/zustand/esm/middleware.js';
3
+
4
+ const defaultCurrency = {
5
+ short_name: "USD",
6
+ name: "US Dollar",
7
+ symbol: "$",
8
+ position: "front",
9
+ exchange_rate: 1
10
+ };
11
+ const useCurrencyStore = create()(
12
+ persist(
13
+ (set, get) => ({
14
+ currency: defaultCurrency,
15
+ setCurrency: (currency) => set({ currency }),
16
+ formatPrice: (price) => {
17
+ const { currency } = get();
18
+ const formattedPrice = (price / 100).toFixed(2);
19
+ if (currency.position === "front") {
20
+ return `${currency.symbol} ${formattedPrice}`;
21
+ }
22
+ return `${formattedPrice} ${currency.symbol}`;
23
+ }
24
+ }),
25
+ {
26
+ name: "currency-storage",
27
+ partialize: (state) => ({
28
+ currency: state.currency
29
+ })
30
+ }
31
+ )
32
+ );
33
+
34
+ export { useCurrencyStore };
@@ -1,2 +1,3 @@
1
1
  export * from './customizationStore';
2
+ export * from './currencyStore';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ingeniuscliq-core",
3
- "version": "0.5.9",
3
+ "version": "0.5.10",
4
4
  "description": "IngeniusCliq Core UI y lógica compartida",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,3 +0,0 @@
1
- import { CoreProductCurrency } from '../types';
2
- export declare function formatPrice(price: number, currency: CoreProductCurrency): string;
3
- //# sourceMappingURL=numbers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/helpers/numbers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,MAAM,CAMhF"}
@@ -1,8 +0,0 @@
1
- function formatPrice(price, currency) {
2
- if (currency.position === "front") {
3
- return `${currency.symbol} ${price / 100}`;
4
- }
5
- return `${price / 100} ${currency.symbol}`;
6
- }
7
-
8
- export { formatPrice };