@lmnto/h-mall-shared 1.0.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.
- package/app.css +457 -0
- package/bitbucket-pipelines.yml +223 -0
- package/package.json +43 -0
- package/public/gif/balloon.gif +0 -0
- package/public/gif/gift.gif +0 -0
- package/public/img/ai-dialog.png +0 -0
- package/public/img/ai-x1-banner.png +0 -0
- package/public/img/ai-x1.png +0 -0
- package/public/img/alert-Icon.png +0 -0
- package/public/img/aleta-payment-kyc-require.png +0 -0
- package/public/img/aleta-payment-pending.png +0 -0
- package/public/img/aleta-payment-rejected.png +0 -0
- package/public/img/aleta-payment-subscription-required.png +0 -0
- package/public/img/boost-banner-bg.png +0 -0
- package/public/img/boost-banner-right.png +0 -0
- package/public/img/boost-banner.png +0 -0
- package/public/img/boost-dialog-bg.png +0 -0
- package/public/img/boostPower.png +0 -0
- package/public/img/boostTooltip.png +0 -0
- package/public/img/brand-icon.svg +23 -0
- package/public/img/brand-text.svg +11 -0
- package/public/img/card-icon.png +0 -0
- package/public/img/cashback-Icon.png +0 -0
- package/public/img/crown.svg +9 -0
- package/public/img/empty-box.png +0 -0
- package/public/img/gen3-dialog.png +0 -0
- package/public/img/gen3-home-banner-bg.png +0 -0
- package/public/img/gen3-image.png +0 -0
- package/public/img/gift.png +0 -0
- package/public/img/img-placeholder-illustration.svg +6 -0
- package/public/img/logo.svg +31 -0
- package/public/img/offerBanner.png +0 -0
- package/public/img/pagenotfound.png +0 -0
- package/public/img/partial-pay-payment-successful.png +0 -0
- package/public/img/phoneShippingBG.png +0 -0
- package/public/img/placeholder-image.jpg +0 -0
- package/public/img/powerIcon.png +0 -0
- package/public/img/product-01.png +0 -0
- package/public/img/product-02.jpg +0 -0
- package/public/img/product-03.jpg +0 -0
- package/public/img/product-04.jpg +0 -0
- package/public/img/product-05.png +0 -0
- package/public/img/product-06.png +0 -0
- package/public/img/profile-avatar.svg +12 -0
- package/public/img/promotion-icon.png +0 -0
- package/public/img/session-expired.png +0 -0
- package/public/img/shipping-alert-icon.png +0 -0
- package/public/img/shippingIcon.png +0 -0
- package/public/img/smart-pay-banner-how.png +0 -0
- package/public/img/smart-pay-banner-own.png +0 -0
- package/public/img/smart-pay-chose.png +0 -0
- package/public/img/smart-pay-easy.png +0 -0
- package/public/img/smart-pay-payment.png +0 -0
- package/public/img/smart-plan-fire.gif +0 -0
- package/public/img/smart-plan-sparkle.gif +0 -0
- package/public/img/special.png +0 -0
- package/public/img/specialOfferBg.png +0 -0
- package/public/img/stop-shipping-banner.png +0 -0
- package/public/img/subscriptionBanner.png +0 -0
- package/public/img/subscriptionIcon.png +0 -0
- package/public/img/successIcon.png +0 -0
- package/public/img/wallet-icon.png +0 -0
- package/public/img/world-wide-shipping.png +0 -0
- package/public/next.svg +1 -0
- package/public/vercel.svg +1 -0
- package/shared/components/AddressFormComponent.tsx +215 -0
- package/shared/components/AddressShippingFormComponent.tsx +223 -0
- package/shared/components/AiPaymentDialog.tsx +95 -0
- package/shared/components/AppLoadingComponent.tsx +15 -0
- package/shared/components/AppLoadingComponentV2.tsx +18 -0
- package/shared/components/Button.tsx +48 -0
- package/shared/components/BuySubscriptionDialog.tsx +75 -0
- package/shared/components/CartDrawerComponent.tsx +324 -0
- package/shared/components/CashbackComponent.tsx +48 -0
- package/shared/components/CashbackMigrationComponent.tsx +41 -0
- package/shared/components/CommissionNonEligibleComponent.tsx +27 -0
- package/shared/components/CustomNextImage.tsx +50 -0
- package/shared/components/CustomNextLink.tsx +46 -0
- package/shared/components/EditAddressFormComponent.tsx +254 -0
- package/shared/components/EmptyCartMessageComponent.tsx +25 -0
- package/shared/components/EmptyCartMessageForCartPage.tsx +61 -0
- package/shared/components/EmptyLegacyOrderMessageForOrdersPage.tsx +52 -0
- package/shared/components/EmptyOrderMessageForOrdersPage.tsx +62 -0
- package/shared/components/EmptyOrderMessageForShippingOrdersPage.tsx +62 -0
- package/shared/components/Footer.tsx +71 -0
- package/shared/components/GreetingDialog.tsx +96 -0
- package/shared/components/Header.tsx +106 -0
- package/shared/components/HoldShippingDialog.tsx +165 -0
- package/shared/components/HomeBanners.tsx +298 -0
- package/shared/components/InactiveCartDialog.tsx +69 -0
- package/shared/components/InputCartQuantity.tsx +342 -0
- package/shared/components/Inputfield.tsx +110 -0
- package/shared/components/ListItemComponent.tsx +82 -0
- package/shared/components/LoadingIconComponent.tsx +284 -0
- package/shared/components/OrderNotFoundComponent.tsx +56 -0
- package/shared/components/PageHeader.tsx +42 -0
- package/shared/components/PhoneNumberCountries.tsx +133 -0
- package/shared/components/PhoneShippingDialog.tsx +77 -0
- package/shared/components/PickupDialog.tsx +92 -0
- package/shared/components/ProductNotFoundComponent.tsx +56 -0
- package/shared/components/ProductPriceComponent.tsx +32 -0
- package/shared/components/ProfileMenu.tsx +120 -0
- package/shared/components/RequestCreditNoteInvoiceDialog.tsx +214 -0
- package/shared/components/RequestInvoiceDialog.tsx +194 -0
- package/shared/components/SelectCities.tsx +133 -0
- package/shared/components/SelectComponent.tsx +334 -0
- package/shared/components/SelectCountries.tsx +179 -0
- package/shared/components/SelectPickUpStore.tsx +131 -0
- package/shared/components/SelectStates.tsx +144 -0
- package/shared/components/ServerTime.tsx +68 -0
- package/shared/components/SessionDialogComponent.tsx +60 -0
- package/shared/components/ShippingAddressFormDialogComponent.tsx +51 -0
- package/shared/components/Sidebar.tsx +281 -0
- package/shared/components/SpecialOfferDialog.tsx +193 -0
- package/shared/components/StatusComponents.tsx +25 -0
- package/shared/components/StepperComponent.tsx +79 -0
- package/shared/components/StepperSmartPayComponent.tsx +97 -0
- package/shared/components/SubscriptionPurchaseDialogComponent.tsx +81 -0
- package/shared/components/TableComponent.tsx +144 -0
- package/shared/components/TablePaginationComponent.tsx +151 -0
- package/shared/components/aleta/AletaManagerComponent.tsx +52 -0
- package/shared/components/aleta/KycPendingStatus.tsx +33 -0
- package/shared/components/aleta/KycRejectedStatus.tsx +53 -0
- package/shared/components/aleta/KycRequiredStatus.tsx +53 -0
- package/shared/components/aleta/SubscriptionRequiredStatus.tsx +45 -0
- package/shared/components/icons/AletaWalletIcon.tsx +21 -0
- package/shared/components/icons/BrandIcon.tsx +97 -0
- package/shared/components/icons/BrandText.tsx +47 -0
- package/shared/components/icons/CartIcon.tsx +21 -0
- package/shared/components/icons/DoneIcon.tsx +27 -0
- package/shared/components/icons/HomnifiIcon.tsx +23 -0
- package/shared/components/icons/InfoIcon.tsx +16 -0
- package/shared/components/icons/SmartPayProductIcon.tsx +31 -0
- package/shared/components/payments/DisclaimerAlertDialog.tsx +205 -0
- package/shared/components/payments/EmptyAssets.tsx +23 -0
- package/shared/components/payments/PaybyWalletItemComponent.tsx +116 -0
- package/shared/components/payments/PaymentAssetItemComponent.tsx +101 -0
- package/shared/components/payments/RequestProcessingDialog.tsx +123 -0
- package/shared/components/payments/WalletSectionManager.tsx +82 -0
- package/shared/components/payments/WalletSliderComponent.tsx +326 -0
- package/shared/components/payments/WalletTermsAndConditionComponent.tsx +88 -0
- package/shared/constants/address-shipping.schema.ts +56 -0
- package/shared/constants/address.schema.ts +56 -0
- package/shared/constants/app.ts +323 -0
- package/shared/constants/environment.ts +23 -0
- package/shared/constants/feature-flags.ts +15 -0
- package/shared/constants/query-keys.ts +106 -0
- package/shared/constants/routes.ts +41 -0
- package/shared/constants/socket.ts +15 -0
- package/shared/contexts/HomeProductsContext.tsx +51 -0
- package/shared/contexts/MainWrapperContext.tsx +289 -0
- package/shared/contexts/WebSocketContext.tsx +155 -0
- package/shared/hooks/useAddressForm.ts +169 -0
- package/shared/hooks/useAddresses.ts +28 -0
- package/shared/hooks/useAppForm.ts +39 -0
- package/shared/hooks/useCart.ts +207 -0
- package/shared/hooks/useCopy.ts +45 -0
- package/shared/hooks/useCountries.ts +27 -0
- package/shared/hooks/useCustomRouter.ts +51 -0
- package/shared/hooks/useDebounce.ts +21 -0
- package/shared/hooks/useInvoice.ts +41 -0
- package/shared/hooks/useOnlineUser.ts +38 -0
- package/shared/hooks/usePayments.ts +101 -0
- package/shared/hooks/useShippingAddressForm.ts +70 -0
- package/shared/hooks/useShippingAddresses.ts +33 -0
- package/shared/hooks/useStores.ts +29 -0
- package/shared/hooks/useUserActivity.ts +43 -0
- package/shared/i18n/client.ts +27 -0
- package/shared/i18n/locales/en.ts +383 -0
- package/shared/i18n/locales/it.ts +373 -0
- package/shared/i18n/server.ts +7 -0
- package/shared/services/addresses.service.ts +27 -0
- package/shared/services/api/core/ApiError.ts +29 -0
- package/shared/services/api/core/ApiRequestOptions.ts +25 -0
- package/shared/services/api/core/ApiResult.ts +11 -0
- package/shared/services/api/core/CancelablePromise.ts +130 -0
- package/shared/services/api/core/OpenAPI.ts +37 -0
- package/shared/services/api/core/request.ts +376 -0
- package/shared/services/api/index.ts +64 -0
- package/shared/services/api/models/AddAllProductToShippingCartDto.ts +7 -0
- package/shared/services/api/models/AddProductToCartDto.ts +8 -0
- package/shared/services/api/models/AddProductToShippingCartDto.ts +8 -0
- package/shared/services/api/models/AdminPlaceOrderDto.ts +16 -0
- package/shared/services/api/models/AssignPickupSerialNumberDto.ts +10 -0
- package/shared/services/api/models/CreateUserAddressDto.ts +19 -0
- package/shared/services/api/models/DeletCartProductsArrayDto.ts +7 -0
- package/shared/services/api/models/GenerateInvoiceDto.ts +7 -0
- package/shared/services/api/models/OrderConfirmationEmailDto.ts +8 -0
- package/shared/services/api/models/PlaceOrderDto.ts +9 -0
- package/shared/services/api/models/PlaceShipmentOrderDto.ts +8 -0
- package/shared/services/api/models/ProductBoostDto.ts +18 -0
- package/shared/services/api/models/RemoveAssignedSerialNumberDto.ts +9 -0
- package/shared/services/api/models/RemoveProductToCartDto.ts +8 -0
- package/shared/services/api/models/ShipmentItem.ts +8 -0
- package/shared/services/api/models/ShippingCartUpdateBillingAddressesDto.ts +7 -0
- package/shared/services/api/models/ShippingCartUpdateShippingMethodDto.ts +7 -0
- package/shared/services/api/models/UnfreezeWalletDto.ts +8 -0
- package/shared/services/api/models/UpdateCartBillingAddressesDto.ts +7 -0
- package/shared/services/api/models/UpdateCartPaymentMethodDto.ts +9 -0
- package/shared/services/api/models/UpdateCartShippingMethodDto.ts +7 -0
- package/shared/services/api/models/UpdateCartStoreDto.ts +7 -0
- package/shared/services/api/models/UpdateProductDto.ts +11 -0
- package/shared/services/api/models/UpdateShipmentItemStatusDto.ts +24 -0
- package/shared/services/api/models/UpdateShippingCartPaymentMethodDto.ts +9 -0
- package/shared/services/api/models/UpdateUserAddressDto.ts +19 -0
- package/shared/services/api/models/ValidateAuthCodeDto.ts +8 -0
- package/shared/services/api/models/WithdrawOrderWalletDto.ts +8 -0
- package/shared/services/api/services/AddressesService.ts +160 -0
- package/shared/services/api/services/AdminsDevicesService.ts +28 -0
- package/shared/services/api/services/AdminsOrdersService.ts +117 -0
- package/shared/services/api/services/AdminsPickupsService.ts +57 -0
- package/shared/services/api/services/AdminsProductsService.ts +86 -0
- package/shared/services/api/services/CartsService.ts +190 -0
- package/shared/services/api/services/CashBackQueueService.ts +39 -0
- package/shared/services/api/services/CategoriesService.ts +65 -0
- package/shared/services/api/services/DefaultService.ts +19 -0
- package/shared/services/api/services/FeaturesFlagsService.ts +20 -0
- package/shared/services/api/services/IossQueueService.ts +39 -0
- package/shared/services/api/services/OrderCallbackService.ts +67 -0
- package/shared/services/api/services/OrderEmailsService.ts +40 -0
- package/shared/services/api/services/OrderImportService.ts +228 -0
- package/shared/services/api/services/OrdersService.ts +183 -0
- package/shared/services/api/services/PaymentGatewayService.ts +19 -0
- package/shared/services/api/services/PaymentsService.ts +88 -0
- package/shared/services/api/services/ProductsService.ts +67 -0
- package/shared/services/api/services/ShipmentOrderCallbackService.ts +67 -0
- package/shared/services/api/services/ShipmentOrdersService.ts +88 -0
- package/shared/services/api/services/ShipmentsService.ts +30 -0
- package/shared/services/api/services/ShippingCartService.ts +247 -0
- package/shared/services/api/services/ShippingMethodsService.ts +20 -0
- package/shared/services/api/services/StoresService.ts +25 -0
- package/shared/services/api/services/SyncServiceQueueService.ts +39 -0
- package/shared/services/api/services/UpgradeOrdersService.ts +26 -0
- package/shared/services/api/services/UsersAuthService.ts +45 -0
- package/shared/services/api/services/UsersService.ts +53 -0
- package/shared/services/api/services/XeraQueueService.ts +39 -0
- package/shared/services/index.ts +0 -0
- package/shared/services/payment-method.service.ts +29 -0
- package/shared/stores/cartStore.ts +108 -0
- package/shared/stores/countriesStore.ts +62 -0
- package/shared/stores/formStore.ts +19 -0
- package/shared/stores/loadingStore.ts +12 -0
- package/shared/stores/userStore.ts +32 -0
- package/shared/types/SelectComponent.types.ts +31 -0
- package/shared/types/addressForm.ts +27 -0
- package/shared/types/cart.ts +208 -0
- package/shared/types/category.ts +6 -0
- package/shared/types/creditNote.ts +0 -0
- package/shared/types/feature-flags.ts +5 -0
- package/shared/types/icon.ts +5 -0
- package/shared/types/index.d.ts +84 -0
- package/shared/types/order.ts +332 -0
- package/shared/types/pagination.ts +5 -0
- package/shared/types/payments.ts +68 -0
- package/shared/types/product.ts +54 -0
- package/shared/types/shoppingCart.ts +219 -0
- package/shared/types/upgradeCart.ts +226 -0
- package/shared/types/user.ts +36 -0
- package/shared/utils/app.util.ts +261 -0
- package/shared/utils/notifications.util.ts +39 -0
- package/shared/utils/user-session.util.ts +171 -0
- package/tailwind.config.ts +234 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
import axios from "axios";
|
|
6
|
+
import type {
|
|
7
|
+
AxiosError,
|
|
8
|
+
AxiosRequestConfig,
|
|
9
|
+
AxiosResponse,
|
|
10
|
+
AxiosInstance,
|
|
11
|
+
} from "axios";
|
|
12
|
+
import FormData from "form-data";
|
|
13
|
+
|
|
14
|
+
import { ApiError } from "./ApiError";
|
|
15
|
+
import type { ApiRequestOptions } from "./ApiRequestOptions";
|
|
16
|
+
import type { ApiResult } from "./ApiResult";
|
|
17
|
+
import { CancelablePromise } from "./CancelablePromise";
|
|
18
|
+
import type { OnCancel } from "./CancelablePromise";
|
|
19
|
+
import type { OpenAPIConfig } from "./OpenAPI";
|
|
20
|
+
import { getToken } from "../../../utils/user-session.util";
|
|
21
|
+
|
|
22
|
+
export const isDefined = <T>(
|
|
23
|
+
value: T | null | undefined,
|
|
24
|
+
): value is Exclude<T, null | undefined> => {
|
|
25
|
+
return value !== undefined && value !== null;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const isString = (value: any): value is string => {
|
|
29
|
+
return typeof value === "string";
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const isStringWithValue = (value: any): value is string => {
|
|
33
|
+
return isString(value) && value !== "";
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const isBlob = (value: any): value is Blob => {
|
|
37
|
+
return (
|
|
38
|
+
typeof value === "object" &&
|
|
39
|
+
typeof value.type === "string" &&
|
|
40
|
+
typeof value.stream === "function" &&
|
|
41
|
+
typeof value.arrayBuffer === "function" &&
|
|
42
|
+
typeof value.constructor === "function" &&
|
|
43
|
+
typeof value.constructor.name === "string" &&
|
|
44
|
+
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
45
|
+
/^(Blob|File)$/.test(value[Symbol.toStringTag])
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const isFormData = (value: any): value is FormData => {
|
|
50
|
+
return value instanceof FormData;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const isSuccess = (status: number): boolean => {
|
|
54
|
+
return status >= 200 && status < 300;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const base64 = (str: string): string => {
|
|
58
|
+
try {
|
|
59
|
+
return btoa(str);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
return Buffer.from(str).toString("base64");
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const getQueryString = (params: Record<string, any>): string => {
|
|
67
|
+
const qs: string[] = [];
|
|
68
|
+
|
|
69
|
+
const append = (key: string, value: any) => {
|
|
70
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const process = (key: string, value: any) => {
|
|
74
|
+
if (isDefined(value)) {
|
|
75
|
+
if (Array.isArray(value)) {
|
|
76
|
+
value.forEach((v) => {
|
|
77
|
+
process(key, v);
|
|
78
|
+
});
|
|
79
|
+
} else if (typeof value === "object") {
|
|
80
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
81
|
+
process(`${key}[${k}]`, v);
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
append(key, value);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
90
|
+
process(key, value);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (qs.length > 0) {
|
|
94
|
+
return `?${qs.join("&")}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return "";
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
|
|
101
|
+
const encoder = config.ENCODE_PATH || encodeURI;
|
|
102
|
+
|
|
103
|
+
const path = options.url
|
|
104
|
+
.replace("{api-version}", config.VERSION)
|
|
105
|
+
.replace(/{(.*?)}/g, (substring: string, group: string) => {
|
|
106
|
+
if (options.path?.hasOwnProperty(group)) {
|
|
107
|
+
return encoder(String(options.path[group]));
|
|
108
|
+
}
|
|
109
|
+
return substring;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const url =
|
|
113
|
+
options?.isServerAction === true
|
|
114
|
+
? `${config.SERVER_ACTION_BASE}${path}`
|
|
115
|
+
: `${config.BASE}${path}`;
|
|
116
|
+
if (options.query) {
|
|
117
|
+
return `${url}${getQueryString(options.query)}`;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return url;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const getFormData = (
|
|
124
|
+
options: ApiRequestOptions,
|
|
125
|
+
): FormData | undefined => {
|
|
126
|
+
if (options.formData) {
|
|
127
|
+
const formData = new FormData();
|
|
128
|
+
|
|
129
|
+
const process = (key: string, value: any) => {
|
|
130
|
+
if (isString(value) || isBlob(value)) {
|
|
131
|
+
formData.append(key, value);
|
|
132
|
+
} else {
|
|
133
|
+
formData.append(key, JSON.stringify(value));
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
Object.entries(options.formData)
|
|
138
|
+
.filter(([_, value]) => isDefined(value))
|
|
139
|
+
.forEach(([key, value]) => {
|
|
140
|
+
if (Array.isArray(value)) {
|
|
141
|
+
value.forEach((v) => process(key, v));
|
|
142
|
+
} else {
|
|
143
|
+
process(key, value);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
return formData;
|
|
148
|
+
}
|
|
149
|
+
return undefined;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
153
|
+
|
|
154
|
+
export const resolve = async <T>(
|
|
155
|
+
options: ApiRequestOptions,
|
|
156
|
+
resolver?: T | Resolver<T>,
|
|
157
|
+
): Promise<T | undefined> => {
|
|
158
|
+
if (typeof resolver === "function") {
|
|
159
|
+
return (resolver as Resolver<T>)(options);
|
|
160
|
+
}
|
|
161
|
+
return resolver;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const getHeaders = async (
|
|
165
|
+
config: OpenAPIConfig,
|
|
166
|
+
options: ApiRequestOptions,
|
|
167
|
+
formData?: FormData,
|
|
168
|
+
): Promise<Record<string, string>> => {
|
|
169
|
+
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
170
|
+
resolve(options, config.TOKEN),
|
|
171
|
+
resolve(options, config.USERNAME),
|
|
172
|
+
resolve(options, config.PASSWORD),
|
|
173
|
+
resolve(options, config.HEADERS),
|
|
174
|
+
]);
|
|
175
|
+
|
|
176
|
+
const formHeaders =
|
|
177
|
+
(typeof formData?.getHeaders === "function" && formData?.getHeaders()) ||
|
|
178
|
+
{};
|
|
179
|
+
|
|
180
|
+
const headers = Object.entries({
|
|
181
|
+
Accept: "application/json",
|
|
182
|
+
...additionalHeaders,
|
|
183
|
+
...options.headers,
|
|
184
|
+
...formHeaders,
|
|
185
|
+
})
|
|
186
|
+
.filter(([_, value]) => isDefined(value))
|
|
187
|
+
.reduce(
|
|
188
|
+
(headers, [key, value]) => ({
|
|
189
|
+
...headers,
|
|
190
|
+
[key]: String(value),
|
|
191
|
+
}),
|
|
192
|
+
{} as Record<string, string>,
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const authToken = await getToken();
|
|
196
|
+
if (isStringWithValue(authToken)) {
|
|
197
|
+
headers["Authorization"] = `Bearer ${authToken}`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
201
|
+
const credentials = base64(`${username}:${password}`);
|
|
202
|
+
headers["Authorization"] = `Basic ${credentials}`;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (options.body !== undefined) {
|
|
206
|
+
if (options.mediaType) {
|
|
207
|
+
headers["Content-Type"] = options.mediaType;
|
|
208
|
+
} else if (isBlob(options.body)) {
|
|
209
|
+
headers["Content-Type"] = options.body.type || "application/octet-stream";
|
|
210
|
+
} else if (isString(options.body)) {
|
|
211
|
+
headers["Content-Type"] = "text/plain";
|
|
212
|
+
} else if (!isFormData(options.body)) {
|
|
213
|
+
headers["Content-Type"] = "application/json";
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return headers;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export const getRequestBody = (options: ApiRequestOptions): any => {
|
|
221
|
+
if (options.body) {
|
|
222
|
+
return options.body;
|
|
223
|
+
}
|
|
224
|
+
return undefined;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const sendRequest = async <T>(
|
|
228
|
+
config: OpenAPIConfig,
|
|
229
|
+
options: ApiRequestOptions,
|
|
230
|
+
url: string,
|
|
231
|
+
body: any,
|
|
232
|
+
formData: FormData | undefined,
|
|
233
|
+
headers: Record<string, string>,
|
|
234
|
+
onCancel: OnCancel,
|
|
235
|
+
axiosClient: AxiosInstance,
|
|
236
|
+
): Promise<AxiosResponse<T>> => {
|
|
237
|
+
const source = axios.CancelToken.source();
|
|
238
|
+
|
|
239
|
+
const requestConfig: AxiosRequestConfig = {
|
|
240
|
+
url,
|
|
241
|
+
headers,
|
|
242
|
+
data: body ?? formData,
|
|
243
|
+
method: options.method,
|
|
244
|
+
withCredentials: config.WITH_CREDENTIALS,
|
|
245
|
+
withXSRFToken:
|
|
246
|
+
config.CREDENTIALS === "include" ? config.WITH_CREDENTIALS : false,
|
|
247
|
+
cancelToken: source.token,
|
|
248
|
+
timeout: 30000,
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
onCancel(() => source.cancel("The user aborted a request."));
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
return await axiosClient.request(requestConfig);
|
|
255
|
+
} catch (error) {
|
|
256
|
+
const axiosError = error as AxiosError<T>;
|
|
257
|
+
if (axiosError.response) {
|
|
258
|
+
return axiosError.response;
|
|
259
|
+
}
|
|
260
|
+
throw error;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export const getResponseHeader = (
|
|
265
|
+
response: AxiosResponse<any>,
|
|
266
|
+
responseHeader?: string,
|
|
267
|
+
): string | undefined => {
|
|
268
|
+
if (responseHeader) {
|
|
269
|
+
const content = response.headers[responseHeader];
|
|
270
|
+
if (isString(content)) {
|
|
271
|
+
return content;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return undefined;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export const getResponseBody = (response: AxiosResponse<any>): any => {
|
|
278
|
+
if (response.status !== 204) {
|
|
279
|
+
return response.data;
|
|
280
|
+
}
|
|
281
|
+
return undefined;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
export const catchErrorCodes = (
|
|
285
|
+
options: ApiRequestOptions,
|
|
286
|
+
result: ApiResult,
|
|
287
|
+
): void => {
|
|
288
|
+
const errors: Record<number, string> = {
|
|
289
|
+
400: "Bad Request",
|
|
290
|
+
401: "Unauthorized",
|
|
291
|
+
403: "Forbidden",
|
|
292
|
+
404: "Not Found",
|
|
293
|
+
500: "Internal Server Error",
|
|
294
|
+
502: "Bad Gateway",
|
|
295
|
+
503: "Service Unavailable",
|
|
296
|
+
...options.errors,
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const error = errors[result.status];
|
|
300
|
+
if (error) {
|
|
301
|
+
throw new ApiError(options, result, error);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (!result.ok) {
|
|
305
|
+
const errorStatus = result.status ?? "unknown";
|
|
306
|
+
const errorStatusText = result.statusText ?? "unknown";
|
|
307
|
+
const errorBody = (() => {
|
|
308
|
+
try {
|
|
309
|
+
return JSON.stringify(result.body, null, 2);
|
|
310
|
+
} catch (e) {
|
|
311
|
+
return undefined;
|
|
312
|
+
}
|
|
313
|
+
})();
|
|
314
|
+
|
|
315
|
+
throw new ApiError(
|
|
316
|
+
options,
|
|
317
|
+
result,
|
|
318
|
+
`Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`,
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Request method
|
|
325
|
+
* @param config The OpenAPI configuration object
|
|
326
|
+
* @param options The request options from the service
|
|
327
|
+
* @param axiosClient The axios client instance to use
|
|
328
|
+
* @returns CancelablePromise<T>
|
|
329
|
+
* @throws ApiError
|
|
330
|
+
*/
|
|
331
|
+
export const request = <T>(
|
|
332
|
+
config: OpenAPIConfig,
|
|
333
|
+
options: ApiRequestOptions,
|
|
334
|
+
axiosClient: AxiosInstance = axios,
|
|
335
|
+
): CancelablePromise<T> => {
|
|
336
|
+
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
337
|
+
try {
|
|
338
|
+
const url = getUrl(config, options);
|
|
339
|
+
const formData = getFormData(options);
|
|
340
|
+
const body = getRequestBody(options);
|
|
341
|
+
const headers = await getHeaders(config, options, formData);
|
|
342
|
+
|
|
343
|
+
if (!onCancel.isCancelled) {
|
|
344
|
+
const response = await sendRequest<T>(
|
|
345
|
+
config,
|
|
346
|
+
options,
|
|
347
|
+
url,
|
|
348
|
+
body,
|
|
349
|
+
formData,
|
|
350
|
+
headers,
|
|
351
|
+
onCancel,
|
|
352
|
+
axiosClient,
|
|
353
|
+
);
|
|
354
|
+
const responseBody = getResponseBody(response);
|
|
355
|
+
const responseHeader = getResponseHeader(
|
|
356
|
+
response,
|
|
357
|
+
options.responseHeader,
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
const result: ApiResult = {
|
|
361
|
+
url,
|
|
362
|
+
ok: isSuccess(response.status),
|
|
363
|
+
status: response.status,
|
|
364
|
+
statusText: response.statusText,
|
|
365
|
+
body: responseHeader ?? responseBody,
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
catchErrorCodes(options, result);
|
|
369
|
+
|
|
370
|
+
resolve(result.body);
|
|
371
|
+
}
|
|
372
|
+
} catch (error) {
|
|
373
|
+
reject(error);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export { ApiError } from "./core/ApiError";
|
|
6
|
+
export { CancelablePromise, CancelError } from "./core/CancelablePromise";
|
|
7
|
+
export { OpenAPI } from "./core/OpenAPI";
|
|
8
|
+
export type { OpenAPIConfig } from "./core/OpenAPI";
|
|
9
|
+
|
|
10
|
+
export type { AddProductToCartDto } from "./models/AddProductToCartDto";
|
|
11
|
+
export type { AddProductToShippingCartDto } from "./models/AddProductToShippingCartDto";
|
|
12
|
+
export type { AdminPlaceOrderDto } from "./models/AdminPlaceOrderDto";
|
|
13
|
+
export type { AssignPickupSerialNumberDto } from "./models/AssignPickupSerialNumberDto";
|
|
14
|
+
export type { CreateUserAddressDto } from "./models/CreateUserAddressDto";
|
|
15
|
+
export type { DeletCartProductsArrayDto } from "./models/DeletCartProductsArrayDto";
|
|
16
|
+
export type { GenerateInvoiceDto } from "./models/GenerateInvoiceDto";
|
|
17
|
+
export type { OrderConfirmationEmailDto } from "./models/OrderConfirmationEmailDto";
|
|
18
|
+
export type { PlaceOrderDto } from "./models/PlaceOrderDto";
|
|
19
|
+
export type { PlaceShipmentOrderDto } from "./models/PlaceShipmentOrderDto";
|
|
20
|
+
export type { RemoveAssignedSerialNumberDto } from "./models/RemoveAssignedSerialNumberDto";
|
|
21
|
+
export type { RemoveProductToCartDto } from "./models/RemoveProductToCartDto";
|
|
22
|
+
export type { ShipmentItem } from "./models/ShipmentItem";
|
|
23
|
+
export type { ShippingCartUpdateBillingAddressesDto } from "./models/ShippingCartUpdateBillingAddressesDto";
|
|
24
|
+
export type { ShippingCartUpdateShippingMethodDto } from "./models/ShippingCartUpdateShippingMethodDto";
|
|
25
|
+
export type { UnfreezeWalletDto } from "./models/UnfreezeWalletDto";
|
|
26
|
+
export type { UpdateCartBillingAddressesDto } from "./models/UpdateCartBillingAddressesDto";
|
|
27
|
+
export type { UpdateCartPaymentMethodDto } from "./models/UpdateCartPaymentMethodDto";
|
|
28
|
+
export type { UpdateCartShippingMethodDto } from "./models/UpdateCartShippingMethodDto";
|
|
29
|
+
export type { UpdateCartStoreDto } from "./models/UpdateCartStoreDto";
|
|
30
|
+
export type { UpdateProductDto } from "./models/UpdateProductDto";
|
|
31
|
+
export { UpdateShipmentItemStatusDto } from "./models/UpdateShipmentItemStatusDto";
|
|
32
|
+
export type { UpdateShippingCartPaymentMethodDto } from "./models/UpdateShippingCartPaymentMethodDto";
|
|
33
|
+
export type { UpdateUserAddressDto } from "./models/UpdateUserAddressDto";
|
|
34
|
+
export type { ValidateAuthCodeDto } from "./models/ValidateAuthCodeDto";
|
|
35
|
+
export type { WithdrawOrderWalletDto } from "./models/WithdrawOrderWalletDto";
|
|
36
|
+
|
|
37
|
+
export { AddressesService } from "./services/AddressesService";
|
|
38
|
+
export { AdminsDevicesService } from "./services/AdminsDevicesService";
|
|
39
|
+
export { AdminsOrdersService } from "./services/AdminsOrdersService";
|
|
40
|
+
export { AdminsPickupsService } from "./services/AdminsPickupsService";
|
|
41
|
+
export { AdminsProductsService } from "./services/AdminsProductsService";
|
|
42
|
+
export { CartsService } from "./services/CartsService";
|
|
43
|
+
export { CashBackQueueService } from "./services/CashBackQueueService";
|
|
44
|
+
export { CategoriesService } from "./services/CategoriesService";
|
|
45
|
+
export { DefaultService } from "./services/DefaultService";
|
|
46
|
+
export { IossQueueService } from "./services/IossQueueService";
|
|
47
|
+
export { OrderCallbackService } from "./services/OrderCallbackService";
|
|
48
|
+
export { OrderEmailsService } from "./services/OrderEmailsService";
|
|
49
|
+
export { OrderImportService } from "./services/OrderImportService";
|
|
50
|
+
export { OrdersService } from "./services/OrdersService";
|
|
51
|
+
export { PaymentsService } from "./services/PaymentsService";
|
|
52
|
+
export { ProductsService } from "./services/ProductsService";
|
|
53
|
+
export { ShipmentOrderCallbackService } from "./services/ShipmentOrderCallbackService";
|
|
54
|
+
export { ShipmentOrdersService } from "./services/ShipmentOrdersService";
|
|
55
|
+
export { ShipmentsService } from "./services/ShipmentsService";
|
|
56
|
+
export { ShippingCartService } from "./services/ShippingCartService";
|
|
57
|
+
export { ShippingMethodsService } from "./services/ShippingMethodsService";
|
|
58
|
+
export { StoresService } from "./services/StoresService";
|
|
59
|
+
export { SyncServiceQueueService } from "./services/SyncServiceQueueService";
|
|
60
|
+
export { UpgradeOrdersService } from "./services/UpgradeOrdersService";
|
|
61
|
+
export { UsersService } from "./services/UsersService";
|
|
62
|
+
export { UsersAuthService } from "./services/UsersAuthService";
|
|
63
|
+
export { XeraQueueService } from "./services/XeraQueueService";
|
|
64
|
+
export { FeaturesFlagsService } from "./services/FeaturesFlagsService";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
|
|
5
|
+
import type { ShipmentItem } from "./ShipmentItem";
|
|
6
|
+
export type AddProductToShippingCartDto = {
|
|
7
|
+
shipmentItemsToBeAdded: Array<ShipmentItem>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
|
|
5
|
+
export type AdminPlaceOrderDto = {
|
|
6
|
+
userBID: string;
|
|
7
|
+
products: Array<string>;
|
|
8
|
+
paymentMethodId?: number;
|
|
9
|
+
paymentOptionId: number;
|
|
10
|
+
applyCommissions: boolean;
|
|
11
|
+
applyVat: boolean;
|
|
12
|
+
applyProcessingFee: boolean;
|
|
13
|
+
countryId?: number;
|
|
14
|
+
adminEmail: string;
|
|
15
|
+
adminRemark: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
|
|
5
|
+
export type AssignPickupSerialNumberDto = {
|
|
6
|
+
userBID: string;
|
|
7
|
+
adminEmail: string;
|
|
8
|
+
newSerialNumber: string;
|
|
9
|
+
shipmentItemId: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
|
|
5
|
+
export type CreateUserAddressDto = {
|
|
6
|
+
countryId: number;
|
|
7
|
+
firstName: string;
|
|
8
|
+
lastName: string;
|
|
9
|
+
countryCode: string;
|
|
10
|
+
phone: string;
|
|
11
|
+
postalCode: string;
|
|
12
|
+
city: string;
|
|
13
|
+
state: string;
|
|
14
|
+
address: string;
|
|
15
|
+
buildingInfo: string;
|
|
16
|
+
latitude: string;
|
|
17
|
+
longitude: string;
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
|
|
5
|
+
export type ProductBoostDto = {
|
|
6
|
+
/**
|
|
7
|
+
* Boost percentage or value
|
|
8
|
+
*/
|
|
9
|
+
boost: number;
|
|
10
|
+
/**
|
|
11
|
+
* Start date and time for the boost (must be in the past)
|
|
12
|
+
*/
|
|
13
|
+
validFrom: string;
|
|
14
|
+
/**
|
|
15
|
+
* End date and time for the boost (must be in the future)
|
|
16
|
+
*/
|
|
17
|
+
validTo: string;
|
|
18
|
+
};
|