ingeniuscliq-core 0.5.8 → 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.
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/CoreProduct/types/CoreProduct.d.ts +8 -0
- package/dist/modules/CoreProduct/types/CoreProduct.d.ts.map +1 -1
- package/dist/stores/currencyStore.d.ts +23 -0
- package/dist/stores/currencyStore.d.ts.map +1 -0
- package/dist/stores/currencyStore.js +34 -0
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/helpers/numbers.d.ts +0 -2
- package/dist/helpers/numbers.d.ts.map +0 -1
- package/dist/helpers/numbers.js +0 -8
package/dist/helpers/index.d.ts
CHANGED
|
@@ -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;
|
|
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';
|
|
@@ -7,6 +7,13 @@ import { BaseVisibleType } from '../../../types/interfaces/BaseVisibleType';
|
|
|
7
7
|
import { CoreProductCategory, HasProductCategories } from './CoreProductCategory';
|
|
8
8
|
import { BaseApiResponse, BaseApiResponsePagination } from '../../../types/contracts/BaseApiResponse';
|
|
9
9
|
import { CoreActions } from '../../../types';
|
|
10
|
+
export interface CoreProductCurrency {
|
|
11
|
+
short_name: string;
|
|
12
|
+
name: string;
|
|
13
|
+
symbol: string;
|
|
14
|
+
position: 'front' | 'back';
|
|
15
|
+
exchange_rate: number;
|
|
16
|
+
}
|
|
10
17
|
/**
|
|
11
18
|
* CoreProduct base type
|
|
12
19
|
*/
|
|
@@ -21,6 +28,7 @@ export interface CoreProduct extends BaseType, BaseSlugType, BaseImagesType, Bas
|
|
|
21
28
|
stock_for_sale: number;
|
|
22
29
|
unit_of_measurement: string;
|
|
23
30
|
short_description: string;
|
|
31
|
+
currency: CoreProductCurrency;
|
|
24
32
|
}
|
|
25
33
|
export interface CoreProductStore<T extends CoreProduct, K extends CoreProductCategory> extends BaseStore {
|
|
26
34
|
productDetails: T | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreProduct.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreProduct/types/CoreProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,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oreProduct';
|
|
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 };
|
package/dist/stores/index.d.ts
CHANGED
|
@@ -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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/helpers/numbers.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKjD"}
|