@nizza/core 0.3.0 → 0.3.1-alpha.1

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.
Files changed (60) hide show
  1. package/dist/environments/environment.d.ts +1 -0
  2. package/dist/index.cjs +12 -4
  3. package/dist/index.d.ts +1 -7
  4. package/dist/index.mjs +2832 -1970
  5. package/dist/lib/accounts/atoms/account.d.ts +4 -0
  6. package/dist/lib/accounts/atoms/index.d.ts +1 -0
  7. package/dist/lib/accounts/core/domain/Account.d.ts +35 -0
  8. package/dist/lib/accounts/core/domain/AccountRepository.d.ts +4 -0
  9. package/dist/lib/accounts/core/domain/index.d.ts +4 -0
  10. package/dist/lib/accounts/core/domain/shared/constants.d.ts +40 -0
  11. package/dist/lib/accounts/core/domain/shared/index.d.ts +2 -0
  12. package/dist/lib/accounts/core/domain/types.d.ts +65 -0
  13. package/dist/lib/accounts/core/index.d.ts +6 -0
  14. package/dist/lib/accounts/core/infrastructure/EventRestRepository.d.ts +4 -0
  15. package/dist/lib/accounts/core/infrastructure/index.d.ts +1 -0
  16. package/dist/lib/accounts/core/services/AccountService.d.ts +6 -0
  17. package/dist/lib/accounts/core/services/index.d.ts +1 -0
  18. package/dist/lib/accounts/hooks/index.d.ts +1 -0
  19. package/dist/lib/accounts/hooks/useAccount.d.ts +4 -0
  20. package/dist/lib/accounts/index.d.ts +4 -0
  21. package/dist/lib/accounts/utils/getAccount.d.ts +1 -0
  22. package/dist/lib/accounts/utils/index.d.ts +1 -0
  23. package/dist/lib/constants/products.d.ts +8 -0
  24. package/dist/lib/index.d.ts +8 -0
  25. package/dist/lib/jotai/globalAtomStore.d.ts +33 -0
  26. package/dist/lib/jotai/index.d.ts +1 -0
  27. package/dist/lib/mobx/NizzaStore.d.ts +18 -0
  28. package/dist/lib/{providers → mobx}/StoreProvider.d.ts +2 -2
  29. package/dist/lib/mobx/index.d.ts +3 -0
  30. package/dist/lib/types/api-graphql-types.d.ts +42 -6
  31. package/dist/lib/types/{app-module.d.ts → appModule.d.ts} +1 -1
  32. package/dist/lib/types/index.d.ts +4 -4
  33. package/dist/lib/types/nizza/index.d.ts +4 -0
  34. package/dist/lib/types/nizza/main.d.ts +3 -0
  35. package/dist/lib/types/nizza/nizzaGlobalObject.d.ts +5 -0
  36. package/dist/lib/types/{products/base.d.ts → nizza/product.d.ts} +2 -1
  37. package/dist/lib/types/nizza/productDataSource.d.ts +23 -0
  38. package/dist/lib/types/utils.d.ts +1 -1
  39. package/dist/lib/types/vtex/index.d.ts +2 -0
  40. package/dist/lib/types/vtex/orderForm.d.ts +263 -0
  41. package/dist/lib/types/vtex/product.d.ts +58 -0
  42. package/dist/lib/utils/customFetch.d.ts +2 -0
  43. package/dist/lib/utils/index.d.ts +1 -6
  44. package/dist/package.json +1 -7
  45. package/package.json +1 -7
  46. package/dist/lib/providers/index.d.ts +0 -1
  47. package/dist/lib/stores/NizzaStore.d.ts +0 -12
  48. package/dist/lib/stores/index.d.ts +0 -1
  49. package/dist/lib/types/nizzaGlobalObject.d.ts +0 -11
  50. package/dist/lib/types/products/index.d.ts +0 -2
  51. package/dist/lib/types/products/product.d.ts +0 -16
  52. package/dist/lib/utils/Result.d.ts +0 -26
  53. package/dist/lib/utils/apiCall.d.ts +0 -2
  54. package/dist/lib/utils/customStorage/MemoryStorage.d.ts +0 -12
  55. package/dist/lib/utils/customStorage/index.d.ts +0 -9
  56. package/dist/lib/utils/customStorage/utils.d.ts +0 -4
  57. package/dist/lib/utils/fingerprint.d.ts +0 -1
  58. package/dist/lib/utils/lazyLoad.d.ts +0 -7
  59. /package/dist/lib/{utils/mobxHooks.d.ts → mobx/hooks.d.ts} +0 -0
  60. /package/dist/lib/types/{mobx-store.d.ts → mobx.d.ts} +0 -0
@@ -0,0 +1,263 @@
1
+ export interface VtexOrderForm {
2
+ orderFormId: string;
3
+ salesChannel: string;
4
+ loggedIn: boolean;
5
+ isCheckedIn: boolean;
6
+ storeId?: any;
7
+ checkedInPickupPointId?: any;
8
+ allowManualPrice: boolean;
9
+ canEditData: boolean;
10
+ userProfileId?: any;
11
+ userType?: any;
12
+ ignoreProfileData: boolean;
13
+ value: number;
14
+ messages: any[];
15
+ items: VtexOrderFormItem[];
16
+ selectableGifts: any[];
17
+ totalizers: VtexOrderFormTotalizer[];
18
+ shippingData: VtexOrderFormShippingData;
19
+ clientProfileData?: any;
20
+ paymentData: VtexOrderFormPaymentData;
21
+ marketingData: VtexOrderFormMarketingData;
22
+ sellers: VtexOrderFormSeller[];
23
+ clientPreferencesData: VtexOrderFormClientPreferencesData;
24
+ commercialConditionData?: any;
25
+ storePreferencesData: VtexOrderFormStorePreferencesData;
26
+ giftRegistryData?: any;
27
+ openTextField?: any;
28
+ invoiceData?: any;
29
+ customData?: any;
30
+ itemMetadata: {
31
+ items: VtexOrderFormItemMetadata[];
32
+ };
33
+ hooksData?: any;
34
+ ratesAndBenefitsData: VtexOrderFormRatesAndBenefitsData;
35
+ subscriptionData?: any;
36
+ merchantContextData?: any;
37
+ itemsOrdination?: any;
38
+ }
39
+ export interface VtexOrderFormRatesAndBenefitsData {
40
+ rateAndBenefitsIdentifiers: VtexOrderFormRatesAndBenefitsIdentifier[];
41
+ teaser: any[];
42
+ }
43
+ export interface VtexOrderFormItemMetadata {
44
+ id: string;
45
+ seller: string;
46
+ name: string;
47
+ skuName: string;
48
+ productId: string;
49
+ refId: string;
50
+ ean?: any;
51
+ imageUrl: string;
52
+ detailUrl: string;
53
+ assemblyOptions: any[];
54
+ }
55
+ export interface VtexOrderFormStorePreferencesData {
56
+ countryCode: string;
57
+ saveUserData: boolean;
58
+ timeZone: string;
59
+ currencyCode: string;
60
+ currencyLocale: number;
61
+ currencySymbol: string;
62
+ currencyFormatInfo: CurrencyFormatInfo;
63
+ }
64
+ interface CurrencyFormatInfo {
65
+ currencyDecimalDigits: number;
66
+ currencyDecimalSeparator: string;
67
+ currencyGroupSeparator: string;
68
+ currencyGroupSize: number;
69
+ startsWithCurrencySymbol: boolean;
70
+ }
71
+ interface VtexOrderFormClientPreferencesData {
72
+ locale: string;
73
+ optinNewsLetter: boolean;
74
+ }
75
+ interface VtexOrderFormSeller {
76
+ id: string;
77
+ name: string;
78
+ logo: string;
79
+ }
80
+ export interface VtexOrderFormMarketingData {
81
+ utmSource: string;
82
+ utmMedium?: any;
83
+ utmCampaign?: any;
84
+ utmipage?: any;
85
+ utmiPart?: any;
86
+ utmiCampaign?: any;
87
+ coupon?: any;
88
+ marketingTags: any[];
89
+ }
90
+ export interface VtexOrderFormPaymentData {
91
+ updateStatus: string;
92
+ installmentOptions: VtexOrderFormInstallmentOption[];
93
+ paymentSystems: VtexOrderFormPaymentSystem[];
94
+ payments: any[];
95
+ giftCards: any[];
96
+ giftCardMessages: any[];
97
+ availableAccounts: any[];
98
+ availableTokens: any[];
99
+ availableAssociations: VtexOrderFormAvailableAssociations;
100
+ }
101
+ export interface VtexOrderFormAvailableAssociations {
102
+ [key: string]: any;
103
+ }
104
+ export interface VtexOrderFormPaymentSystem {
105
+ id: number;
106
+ name: string;
107
+ groupName: string;
108
+ validator: VtexOrderFormValidator;
109
+ stringId: string;
110
+ template: string;
111
+ requiresDocument: boolean;
112
+ displayDocument: boolean;
113
+ isCustom: boolean;
114
+ description?: string;
115
+ requiresAuthentication: boolean;
116
+ dueDate: string;
117
+ availablePayments?: any;
118
+ }
119
+ export interface VtexOrderFormValidator {
120
+ regex?: any;
121
+ mask?: any;
122
+ cardCodeRegex?: any;
123
+ cardCodeMask?: any;
124
+ weights?: any;
125
+ useCvv: boolean;
126
+ useExpirationDate: boolean;
127
+ useCardHolderName: boolean;
128
+ useBillingAddress: boolean;
129
+ }
130
+ export interface VtexOrderFormInstallmentOption {
131
+ paymentSystem: string;
132
+ bin?: any;
133
+ paymentName?: any;
134
+ paymentGroupName?: any;
135
+ value: number;
136
+ installments: VtexOrderFormInstallment[];
137
+ }
138
+ export interface VtexOrderFormInstallment {
139
+ count: number;
140
+ hasInterestRate: boolean;
141
+ interestRate: number;
142
+ value: number;
143
+ total: number;
144
+ sellerMerchantInstallments: SellerMerchantInstallment[];
145
+ }
146
+ interface SellerMerchantInstallment {
147
+ id: string;
148
+ count: number;
149
+ hasInterestRate: boolean;
150
+ interestRate: number;
151
+ value: number;
152
+ total: number;
153
+ }
154
+ export interface VtexOrderFormShippingData {
155
+ address?: any;
156
+ logisticsInfo: VtexOrderFormLogisticsInfo[];
157
+ selectedAddresses: any[];
158
+ availableAddresses: any[];
159
+ pickupPoints: any[];
160
+ }
161
+ export interface VtexOrderFormLogisticsInfo {
162
+ itemIndex: number;
163
+ selectedSla?: any;
164
+ selectedDeliveryChannel?: any;
165
+ addressId?: any;
166
+ slas: any[];
167
+ shipsTo: string[];
168
+ itemId: string;
169
+ deliveryChannels: VtexOrderFormDeliveryChannel[];
170
+ }
171
+ export interface VtexOrderFormDeliveryChannel {
172
+ id: string;
173
+ }
174
+ export interface VtexOrderFormTotalizer {
175
+ id: string;
176
+ name: string;
177
+ value: number;
178
+ }
179
+ export interface VtexOrderFormItem {
180
+ uniqueId: string;
181
+ id: string;
182
+ productId: string;
183
+ productRefId: string;
184
+ refId: string;
185
+ ean?: any;
186
+ name: string;
187
+ skuName: string;
188
+ modalType?: any;
189
+ parentItemIndex?: any;
190
+ parentAssemblyBinding?: any;
191
+ assemblies: any[];
192
+ priceValidUntil: string;
193
+ tax: number;
194
+ price: number;
195
+ listPrice: number;
196
+ manualPrice?: any;
197
+ manualPriceAppliedBy?: any;
198
+ sellingPrice: number;
199
+ rewardValue: number;
200
+ isGift: boolean;
201
+ additionalInfo: VtexOrderFormAdditionalInfo;
202
+ preSaleDate?: any;
203
+ productCategoryIds: string;
204
+ productCategories: VtexOrderFormProductCategories;
205
+ quantity: number;
206
+ seller: string;
207
+ sellerChain: string[];
208
+ imageUrl: string;
209
+ detailUrl: string;
210
+ components: any[];
211
+ bundleItems: any[];
212
+ attachments: any[];
213
+ attachmentOfferings: any[];
214
+ offerings: any[];
215
+ priceTags: VtexOrderFormPriceTag[];
216
+ availability: string;
217
+ measurementUnit: string;
218
+ unitMultiplier: number;
219
+ manufacturerCode?: any;
220
+ priceDefinition: VtexOrderFormPriceDefinition;
221
+ taxCode: string;
222
+ }
223
+ export interface VtexOrderFormPriceDefinition {
224
+ calculatedSellingPrice: number;
225
+ total: number;
226
+ sellingPrices: VtexOrderFormSellingPrice[];
227
+ }
228
+ export interface VtexOrderFormSellingPrice {
229
+ value: number;
230
+ quantity: number;
231
+ }
232
+ export interface VtexOrderFormPriceTag {
233
+ name: string;
234
+ value: number;
235
+ rawValue: number;
236
+ isPercentual: boolean;
237
+ identifier: string;
238
+ owner: string;
239
+ ratesAndBenefitsIdentifier: VtexOrderFormRatesAndBenefitsIdentifier;
240
+ }
241
+ export interface VtexOrderFormRatesAndBenefitsIdentifier {
242
+ id: string;
243
+ name: string;
244
+ featured: boolean;
245
+ description: string;
246
+ matchedParameters: VtexOrderFormMatchedParameters;
247
+ additionalInfo?: any;
248
+ }
249
+ export interface VtexOrderFormMatchedParameters {
250
+ [key: string]: string;
251
+ }
252
+ export interface VtexOrderFormProductCategories {
253
+ [key: string]: string;
254
+ }
255
+ export interface VtexOrderFormAdditionalInfo {
256
+ dimension?: any;
257
+ brandName: string;
258
+ brandId: string;
259
+ offeringInfo?: any;
260
+ offeringType?: any;
261
+ offeringTypeId?: any;
262
+ }
263
+ export {};
@@ -0,0 +1,58 @@
1
+ export interface VtexProduct {
2
+ id: string;
3
+ productId: string;
4
+ productName: string;
5
+ show: boolean;
6
+ image: string;
7
+ brand: string;
8
+ link: string;
9
+ items: VtexItem[];
10
+ skuSpecifications?: VtexSkuSpecification[];
11
+ }
12
+ export interface VtexItem {
13
+ itemId: string;
14
+ name: string;
15
+ ean: string;
16
+ referenceId: Array<{
17
+ Key: string;
18
+ Value: string;
19
+ }>;
20
+ imageUrl: string;
21
+ images: VtexImage[];
22
+ sellers: VtexSeller[];
23
+ }
24
+ export interface VtexSeller {
25
+ sellerDefault: boolean;
26
+ addToCartLink: string;
27
+ commertialOffer: VtexCommertialOffer;
28
+ sellerId: string;
29
+ }
30
+ export interface VtexCommertialOffer {
31
+ IsAvailable: boolean;
32
+ Price: number;
33
+ ListPrice: number;
34
+ Tax?: number;
35
+ }
36
+ export interface VtexSkuSpecification {
37
+ field: VtexSkuSpecificationField;
38
+ values: VtexSkuSpecificationValue[];
39
+ }
40
+ export interface VtexSkuSpecificationValue {
41
+ id: string;
42
+ name: string;
43
+ position: number;
44
+ }
45
+ export interface VtexSkuSpecificationField {
46
+ id: string;
47
+ name: string;
48
+ isActive: boolean;
49
+ position: number;
50
+ type: string;
51
+ }
52
+ export interface VtexImage {
53
+ cacheId: string;
54
+ imageId: string;
55
+ imageTag: string;
56
+ imageUrl: string;
57
+ imageText: string;
58
+ }
@@ -0,0 +1,2 @@
1
+ import { CustomFetchConfig } from '../types';
2
+ export declare function customFetch<T = Response>({ url, method, raw, ...rest }: CustomFetchConfig): Promise<T>;
@@ -1,7 +1,2 @@
1
- export * from './Result';
2
- export * from './apiCall';
3
- export * from './customStorage';
4
- export * from './fingerprint';
1
+ export * from './customFetch';
5
2
  export * from './helpers';
6
- export * from './lazyLoad';
7
- export * from './mobxHooks';
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.1-alpha.1",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.cjs",
@@ -11,11 +11,5 @@
11
11
  ],
12
12
  "scripts": {
13
13
  "clean": "rimraf dist/*"
14
- },
15
- "dependencies": {
16
- "js-cookie": "^3.0.1"
17
- },
18
- "devDependencies": {
19
- "@types/js-cookie": "^3.0.2"
20
14
  }
21
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.1-alpha.1",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.cjs",
@@ -9,12 +9,6 @@
9
9
  "files": [
10
10
  "dist"
11
11
  ],
12
- "dependencies": {
13
- "js-cookie": "^3.0.1"
14
- },
15
- "devDependencies": {
16
- "@types/js-cookie": "^3.0.2"
17
- },
18
12
  "scripts": {
19
13
  "clean": "rimraf dist/*"
20
14
  }
@@ -1 +0,0 @@
1
- export * from './StoreProvider';
@@ -1,12 +0,0 @@
1
- import { NizzaConfiguration, NizzaGlobalObjet } from '../types';
2
- export declare class NizzaStore implements NizzaGlobalObjet {
3
- private static _instance;
4
- private _config;
5
- readonly instanceId: string;
6
- private constructor();
7
- static instance(): NizzaStore;
8
- configure(config: NizzaConfiguration): void;
9
- get config(): NizzaConfiguration | null;
10
- private validateRequiredProps;
11
- }
12
- export declare const nizza: NizzaStore;
@@ -1 +0,0 @@
1
- export * from './NizzaStore';
@@ -1,11 +0,0 @@
1
- import { NizzaProductRepository } from './products';
2
- export interface NizzaGlobalObjet {
3
- config: NizzaConfiguration | null;
4
- configure: (config: NizzaConfiguration) => void;
5
- }
6
- export interface NizzaConfiguration {
7
- account: string;
8
- productRepository?: NizzaProductRepository;
9
- }
10
- export interface NizzaCredentials {
11
- }
@@ -1,2 +0,0 @@
1
- export * from './base';
2
- export * from './product';
@@ -1,16 +0,0 @@
1
- import { NizzaProduct } from './base';
2
- export type NizzaGetProductHandler = (input: NizzaGetProductHandlerInput) => Promise<NizzaProduct>;
3
- export type NizzaGetProductListHandler = (input: NizzaGetProductListHandlerInput) => Promise<NizzaProduct[]>;
4
- type NizzaGetProductHandlerInput = {
5
- productId: string;
6
- };
7
- type NizzaGetProductListHandlerInput = {
8
- search?: string;
9
- page?: number;
10
- limit?: number;
11
- };
12
- export interface NizzaProductRepository {
13
- getProduct: NizzaGetProductHandler;
14
- getProductList: NizzaGetProductListHandler;
15
- }
16
- export {};
@@ -1,26 +0,0 @@
1
- export declare class Result<V, E = string> {
2
- isOk: boolean;
3
- isErr: boolean;
4
- error: E;
5
- private _value;
6
- constructor(isOk: boolean, error?: E, value?: V);
7
- get value(): V;
8
- static ok<U>(value?: U): Result<U, never>;
9
- static fail<F = string>(error: F): Result<never, F>;
10
- static combine(results: Result<any, any>[]): Result<any, any>;
11
- }
12
- export type Either<L, A> = Err<L, A> | Ok<L, A>;
13
- export declare class Err<L, A> {
14
- readonly value: L;
15
- constructor(value: L);
16
- isErr(): this is Err<L, A>;
17
- isOk(): this is Ok<L, A>;
18
- }
19
- export declare class Ok<L, A> {
20
- readonly value: A;
21
- constructor(value: A);
22
- isErr(): this is Err<L, A>;
23
- isOk(): this is Ok<L, A>;
24
- }
25
- export declare const ok: <L, A>(l: L) => Either<L, A>;
26
- export declare const err: <L, A>(a: A) => Either<L, A>;
@@ -1,2 +0,0 @@
1
- import { ApiCall } from '../types';
2
- export declare function apiCall<T = Response>({ url, method, raw, ...rest }: ApiCall): Promise<T>;
@@ -1,12 +0,0 @@
1
- export declare class MemoryStorage implements Storage {
2
- private store;
3
- constructor();
4
- private getStoreFromWindow;
5
- private setStoreToWindow;
6
- setItem(key: string, value: string): void;
7
- getItem(key: string): string | null;
8
- removeItem(key: string): void;
9
- clear(): void;
10
- key(index: number): string | null;
11
- get length(): number;
12
- }
@@ -1,9 +0,0 @@
1
- export declare class CustomStorage {
2
- static init(): CustomStorage;
3
- constructor();
4
- private replaceStorages;
5
- get isAvailable(): {
6
- localStorage: boolean;
7
- sessionStorage: boolean;
8
- };
9
- }
@@ -1,4 +0,0 @@
1
- type StorageType = 'localStorage' | 'sessionStorage';
2
- export declare function isStorageAvailable(type: StorageType): boolean;
3
- export declare function setProperty(obj: unknown, name: string, value: unknown): void;
4
- export {};
@@ -1 +0,0 @@
1
- export declare const getFingerprint: () => string;
@@ -1,7 +0,0 @@
1
- import React, { ComponentProps, ReactNode } from 'react';
2
- interface Opts {
3
- fallback: ReactNode;
4
- }
5
- type Unpromisify<T> = T extends Promise<infer P> ? P : never;
6
- export declare const lazyLoad: <T extends Promise<any>, U extends React.ComponentType<any>>(importFunc: () => T, selectorFunc?: ((s: Unpromisify<T>) => U) | undefined, opts?: Opts) => (props: React.ComponentProps<U>) => import("react/jsx-runtime").JSX.Element;
7
- export {};
File without changes