@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.
Files changed (262) hide show
  1. package/app.css +457 -0
  2. package/bitbucket-pipelines.yml +223 -0
  3. package/package.json +43 -0
  4. package/public/gif/balloon.gif +0 -0
  5. package/public/gif/gift.gif +0 -0
  6. package/public/img/ai-dialog.png +0 -0
  7. package/public/img/ai-x1-banner.png +0 -0
  8. package/public/img/ai-x1.png +0 -0
  9. package/public/img/alert-Icon.png +0 -0
  10. package/public/img/aleta-payment-kyc-require.png +0 -0
  11. package/public/img/aleta-payment-pending.png +0 -0
  12. package/public/img/aleta-payment-rejected.png +0 -0
  13. package/public/img/aleta-payment-subscription-required.png +0 -0
  14. package/public/img/boost-banner-bg.png +0 -0
  15. package/public/img/boost-banner-right.png +0 -0
  16. package/public/img/boost-banner.png +0 -0
  17. package/public/img/boost-dialog-bg.png +0 -0
  18. package/public/img/boostPower.png +0 -0
  19. package/public/img/boostTooltip.png +0 -0
  20. package/public/img/brand-icon.svg +23 -0
  21. package/public/img/brand-text.svg +11 -0
  22. package/public/img/card-icon.png +0 -0
  23. package/public/img/cashback-Icon.png +0 -0
  24. package/public/img/crown.svg +9 -0
  25. package/public/img/empty-box.png +0 -0
  26. package/public/img/gen3-dialog.png +0 -0
  27. package/public/img/gen3-home-banner-bg.png +0 -0
  28. package/public/img/gen3-image.png +0 -0
  29. package/public/img/gift.png +0 -0
  30. package/public/img/img-placeholder-illustration.svg +6 -0
  31. package/public/img/logo.svg +31 -0
  32. package/public/img/offerBanner.png +0 -0
  33. package/public/img/pagenotfound.png +0 -0
  34. package/public/img/partial-pay-payment-successful.png +0 -0
  35. package/public/img/phoneShippingBG.png +0 -0
  36. package/public/img/placeholder-image.jpg +0 -0
  37. package/public/img/powerIcon.png +0 -0
  38. package/public/img/product-01.png +0 -0
  39. package/public/img/product-02.jpg +0 -0
  40. package/public/img/product-03.jpg +0 -0
  41. package/public/img/product-04.jpg +0 -0
  42. package/public/img/product-05.png +0 -0
  43. package/public/img/product-06.png +0 -0
  44. package/public/img/profile-avatar.svg +12 -0
  45. package/public/img/promotion-icon.png +0 -0
  46. package/public/img/session-expired.png +0 -0
  47. package/public/img/shipping-alert-icon.png +0 -0
  48. package/public/img/shippingIcon.png +0 -0
  49. package/public/img/smart-pay-banner-how.png +0 -0
  50. package/public/img/smart-pay-banner-own.png +0 -0
  51. package/public/img/smart-pay-chose.png +0 -0
  52. package/public/img/smart-pay-easy.png +0 -0
  53. package/public/img/smart-pay-payment.png +0 -0
  54. package/public/img/smart-plan-fire.gif +0 -0
  55. package/public/img/smart-plan-sparkle.gif +0 -0
  56. package/public/img/special.png +0 -0
  57. package/public/img/specialOfferBg.png +0 -0
  58. package/public/img/stop-shipping-banner.png +0 -0
  59. package/public/img/subscriptionBanner.png +0 -0
  60. package/public/img/subscriptionIcon.png +0 -0
  61. package/public/img/successIcon.png +0 -0
  62. package/public/img/wallet-icon.png +0 -0
  63. package/public/img/world-wide-shipping.png +0 -0
  64. package/public/next.svg +1 -0
  65. package/public/vercel.svg +1 -0
  66. package/shared/components/AddressFormComponent.tsx +215 -0
  67. package/shared/components/AddressShippingFormComponent.tsx +223 -0
  68. package/shared/components/AiPaymentDialog.tsx +95 -0
  69. package/shared/components/AppLoadingComponent.tsx +15 -0
  70. package/shared/components/AppLoadingComponentV2.tsx +18 -0
  71. package/shared/components/Button.tsx +48 -0
  72. package/shared/components/BuySubscriptionDialog.tsx +75 -0
  73. package/shared/components/CartDrawerComponent.tsx +324 -0
  74. package/shared/components/CashbackComponent.tsx +48 -0
  75. package/shared/components/CashbackMigrationComponent.tsx +41 -0
  76. package/shared/components/CommissionNonEligibleComponent.tsx +27 -0
  77. package/shared/components/CustomNextImage.tsx +50 -0
  78. package/shared/components/CustomNextLink.tsx +46 -0
  79. package/shared/components/EditAddressFormComponent.tsx +254 -0
  80. package/shared/components/EmptyCartMessageComponent.tsx +25 -0
  81. package/shared/components/EmptyCartMessageForCartPage.tsx +61 -0
  82. package/shared/components/EmptyLegacyOrderMessageForOrdersPage.tsx +52 -0
  83. package/shared/components/EmptyOrderMessageForOrdersPage.tsx +62 -0
  84. package/shared/components/EmptyOrderMessageForShippingOrdersPage.tsx +62 -0
  85. package/shared/components/Footer.tsx +71 -0
  86. package/shared/components/GreetingDialog.tsx +96 -0
  87. package/shared/components/Header.tsx +106 -0
  88. package/shared/components/HoldShippingDialog.tsx +165 -0
  89. package/shared/components/HomeBanners.tsx +298 -0
  90. package/shared/components/InactiveCartDialog.tsx +69 -0
  91. package/shared/components/InputCartQuantity.tsx +342 -0
  92. package/shared/components/Inputfield.tsx +110 -0
  93. package/shared/components/ListItemComponent.tsx +82 -0
  94. package/shared/components/LoadingIconComponent.tsx +284 -0
  95. package/shared/components/OrderNotFoundComponent.tsx +56 -0
  96. package/shared/components/PageHeader.tsx +42 -0
  97. package/shared/components/PhoneNumberCountries.tsx +133 -0
  98. package/shared/components/PhoneShippingDialog.tsx +77 -0
  99. package/shared/components/PickupDialog.tsx +92 -0
  100. package/shared/components/ProductNotFoundComponent.tsx +56 -0
  101. package/shared/components/ProductPriceComponent.tsx +32 -0
  102. package/shared/components/ProfileMenu.tsx +120 -0
  103. package/shared/components/RequestCreditNoteInvoiceDialog.tsx +214 -0
  104. package/shared/components/RequestInvoiceDialog.tsx +194 -0
  105. package/shared/components/SelectCities.tsx +133 -0
  106. package/shared/components/SelectComponent.tsx +334 -0
  107. package/shared/components/SelectCountries.tsx +179 -0
  108. package/shared/components/SelectPickUpStore.tsx +131 -0
  109. package/shared/components/SelectStates.tsx +144 -0
  110. package/shared/components/ServerTime.tsx +68 -0
  111. package/shared/components/SessionDialogComponent.tsx +60 -0
  112. package/shared/components/ShippingAddressFormDialogComponent.tsx +51 -0
  113. package/shared/components/Sidebar.tsx +281 -0
  114. package/shared/components/SpecialOfferDialog.tsx +193 -0
  115. package/shared/components/StatusComponents.tsx +25 -0
  116. package/shared/components/StepperComponent.tsx +79 -0
  117. package/shared/components/StepperSmartPayComponent.tsx +97 -0
  118. package/shared/components/SubscriptionPurchaseDialogComponent.tsx +81 -0
  119. package/shared/components/TableComponent.tsx +144 -0
  120. package/shared/components/TablePaginationComponent.tsx +151 -0
  121. package/shared/components/aleta/AletaManagerComponent.tsx +52 -0
  122. package/shared/components/aleta/KycPendingStatus.tsx +33 -0
  123. package/shared/components/aleta/KycRejectedStatus.tsx +53 -0
  124. package/shared/components/aleta/KycRequiredStatus.tsx +53 -0
  125. package/shared/components/aleta/SubscriptionRequiredStatus.tsx +45 -0
  126. package/shared/components/icons/AletaWalletIcon.tsx +21 -0
  127. package/shared/components/icons/BrandIcon.tsx +97 -0
  128. package/shared/components/icons/BrandText.tsx +47 -0
  129. package/shared/components/icons/CartIcon.tsx +21 -0
  130. package/shared/components/icons/DoneIcon.tsx +27 -0
  131. package/shared/components/icons/HomnifiIcon.tsx +23 -0
  132. package/shared/components/icons/InfoIcon.tsx +16 -0
  133. package/shared/components/icons/SmartPayProductIcon.tsx +31 -0
  134. package/shared/components/payments/DisclaimerAlertDialog.tsx +205 -0
  135. package/shared/components/payments/EmptyAssets.tsx +23 -0
  136. package/shared/components/payments/PaybyWalletItemComponent.tsx +116 -0
  137. package/shared/components/payments/PaymentAssetItemComponent.tsx +101 -0
  138. package/shared/components/payments/RequestProcessingDialog.tsx +123 -0
  139. package/shared/components/payments/WalletSectionManager.tsx +82 -0
  140. package/shared/components/payments/WalletSliderComponent.tsx +326 -0
  141. package/shared/components/payments/WalletTermsAndConditionComponent.tsx +88 -0
  142. package/shared/constants/address-shipping.schema.ts +56 -0
  143. package/shared/constants/address.schema.ts +56 -0
  144. package/shared/constants/app.ts +323 -0
  145. package/shared/constants/environment.ts +23 -0
  146. package/shared/constants/feature-flags.ts +15 -0
  147. package/shared/constants/query-keys.ts +106 -0
  148. package/shared/constants/routes.ts +41 -0
  149. package/shared/constants/socket.ts +15 -0
  150. package/shared/contexts/HomeProductsContext.tsx +51 -0
  151. package/shared/contexts/MainWrapperContext.tsx +289 -0
  152. package/shared/contexts/WebSocketContext.tsx +155 -0
  153. package/shared/hooks/useAddressForm.ts +169 -0
  154. package/shared/hooks/useAddresses.ts +28 -0
  155. package/shared/hooks/useAppForm.ts +39 -0
  156. package/shared/hooks/useCart.ts +207 -0
  157. package/shared/hooks/useCopy.ts +45 -0
  158. package/shared/hooks/useCountries.ts +27 -0
  159. package/shared/hooks/useCustomRouter.ts +51 -0
  160. package/shared/hooks/useDebounce.ts +21 -0
  161. package/shared/hooks/useInvoice.ts +41 -0
  162. package/shared/hooks/useOnlineUser.ts +38 -0
  163. package/shared/hooks/usePayments.ts +101 -0
  164. package/shared/hooks/useShippingAddressForm.ts +70 -0
  165. package/shared/hooks/useShippingAddresses.ts +33 -0
  166. package/shared/hooks/useStores.ts +29 -0
  167. package/shared/hooks/useUserActivity.ts +43 -0
  168. package/shared/i18n/client.ts +27 -0
  169. package/shared/i18n/locales/en.ts +383 -0
  170. package/shared/i18n/locales/it.ts +373 -0
  171. package/shared/i18n/server.ts +7 -0
  172. package/shared/services/addresses.service.ts +27 -0
  173. package/shared/services/api/core/ApiError.ts +29 -0
  174. package/shared/services/api/core/ApiRequestOptions.ts +25 -0
  175. package/shared/services/api/core/ApiResult.ts +11 -0
  176. package/shared/services/api/core/CancelablePromise.ts +130 -0
  177. package/shared/services/api/core/OpenAPI.ts +37 -0
  178. package/shared/services/api/core/request.ts +376 -0
  179. package/shared/services/api/index.ts +64 -0
  180. package/shared/services/api/models/AddAllProductToShippingCartDto.ts +7 -0
  181. package/shared/services/api/models/AddProductToCartDto.ts +8 -0
  182. package/shared/services/api/models/AddProductToShippingCartDto.ts +8 -0
  183. package/shared/services/api/models/AdminPlaceOrderDto.ts +16 -0
  184. package/shared/services/api/models/AssignPickupSerialNumberDto.ts +10 -0
  185. package/shared/services/api/models/CreateUserAddressDto.ts +19 -0
  186. package/shared/services/api/models/DeletCartProductsArrayDto.ts +7 -0
  187. package/shared/services/api/models/GenerateInvoiceDto.ts +7 -0
  188. package/shared/services/api/models/OrderConfirmationEmailDto.ts +8 -0
  189. package/shared/services/api/models/PlaceOrderDto.ts +9 -0
  190. package/shared/services/api/models/PlaceShipmentOrderDto.ts +8 -0
  191. package/shared/services/api/models/ProductBoostDto.ts +18 -0
  192. package/shared/services/api/models/RemoveAssignedSerialNumberDto.ts +9 -0
  193. package/shared/services/api/models/RemoveProductToCartDto.ts +8 -0
  194. package/shared/services/api/models/ShipmentItem.ts +8 -0
  195. package/shared/services/api/models/ShippingCartUpdateBillingAddressesDto.ts +7 -0
  196. package/shared/services/api/models/ShippingCartUpdateShippingMethodDto.ts +7 -0
  197. package/shared/services/api/models/UnfreezeWalletDto.ts +8 -0
  198. package/shared/services/api/models/UpdateCartBillingAddressesDto.ts +7 -0
  199. package/shared/services/api/models/UpdateCartPaymentMethodDto.ts +9 -0
  200. package/shared/services/api/models/UpdateCartShippingMethodDto.ts +7 -0
  201. package/shared/services/api/models/UpdateCartStoreDto.ts +7 -0
  202. package/shared/services/api/models/UpdateProductDto.ts +11 -0
  203. package/shared/services/api/models/UpdateShipmentItemStatusDto.ts +24 -0
  204. package/shared/services/api/models/UpdateShippingCartPaymentMethodDto.ts +9 -0
  205. package/shared/services/api/models/UpdateUserAddressDto.ts +19 -0
  206. package/shared/services/api/models/ValidateAuthCodeDto.ts +8 -0
  207. package/shared/services/api/models/WithdrawOrderWalletDto.ts +8 -0
  208. package/shared/services/api/services/AddressesService.ts +160 -0
  209. package/shared/services/api/services/AdminsDevicesService.ts +28 -0
  210. package/shared/services/api/services/AdminsOrdersService.ts +117 -0
  211. package/shared/services/api/services/AdminsPickupsService.ts +57 -0
  212. package/shared/services/api/services/AdminsProductsService.ts +86 -0
  213. package/shared/services/api/services/CartsService.ts +190 -0
  214. package/shared/services/api/services/CashBackQueueService.ts +39 -0
  215. package/shared/services/api/services/CategoriesService.ts +65 -0
  216. package/shared/services/api/services/DefaultService.ts +19 -0
  217. package/shared/services/api/services/FeaturesFlagsService.ts +20 -0
  218. package/shared/services/api/services/IossQueueService.ts +39 -0
  219. package/shared/services/api/services/OrderCallbackService.ts +67 -0
  220. package/shared/services/api/services/OrderEmailsService.ts +40 -0
  221. package/shared/services/api/services/OrderImportService.ts +228 -0
  222. package/shared/services/api/services/OrdersService.ts +183 -0
  223. package/shared/services/api/services/PaymentGatewayService.ts +19 -0
  224. package/shared/services/api/services/PaymentsService.ts +88 -0
  225. package/shared/services/api/services/ProductsService.ts +67 -0
  226. package/shared/services/api/services/ShipmentOrderCallbackService.ts +67 -0
  227. package/shared/services/api/services/ShipmentOrdersService.ts +88 -0
  228. package/shared/services/api/services/ShipmentsService.ts +30 -0
  229. package/shared/services/api/services/ShippingCartService.ts +247 -0
  230. package/shared/services/api/services/ShippingMethodsService.ts +20 -0
  231. package/shared/services/api/services/StoresService.ts +25 -0
  232. package/shared/services/api/services/SyncServiceQueueService.ts +39 -0
  233. package/shared/services/api/services/UpgradeOrdersService.ts +26 -0
  234. package/shared/services/api/services/UsersAuthService.ts +45 -0
  235. package/shared/services/api/services/UsersService.ts +53 -0
  236. package/shared/services/api/services/XeraQueueService.ts +39 -0
  237. package/shared/services/index.ts +0 -0
  238. package/shared/services/payment-method.service.ts +29 -0
  239. package/shared/stores/cartStore.ts +108 -0
  240. package/shared/stores/countriesStore.ts +62 -0
  241. package/shared/stores/formStore.ts +19 -0
  242. package/shared/stores/loadingStore.ts +12 -0
  243. package/shared/stores/userStore.ts +32 -0
  244. package/shared/types/SelectComponent.types.ts +31 -0
  245. package/shared/types/addressForm.ts +27 -0
  246. package/shared/types/cart.ts +208 -0
  247. package/shared/types/category.ts +6 -0
  248. package/shared/types/creditNote.ts +0 -0
  249. package/shared/types/feature-flags.ts +5 -0
  250. package/shared/types/icon.ts +5 -0
  251. package/shared/types/index.d.ts +84 -0
  252. package/shared/types/order.ts +332 -0
  253. package/shared/types/pagination.ts +5 -0
  254. package/shared/types/payments.ts +68 -0
  255. package/shared/types/product.ts +54 -0
  256. package/shared/types/shoppingCart.ts +219 -0
  257. package/shared/types/upgradeCart.ts +226 -0
  258. package/shared/types/user.ts +36 -0
  259. package/shared/utils/app.util.ts +261 -0
  260. package/shared/utils/notifications.util.ts +39 -0
  261. package/shared/utils/user-session.util.ts +171 -0
  262. package/tailwind.config.ts +234 -0
@@ -0,0 +1,88 @@
1
+ import ButtonCustom from "@hms/packages/shared/components/Button";
2
+ import { usePayments } from "@hms/packages/shared/hooks/usePayments";
3
+ import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
4
+ import { notification } from "@hms/packages/shared/utils/notifications.util";
5
+ import { Checkbox, Typography } from "@material-tailwind/react";
6
+ import React, { useState } from "react";
7
+
8
+ type WalletTermsAndConditionComponentProps = {
9
+ onConsentAccepted: () => void; // Prop to accept the consent
10
+ };
11
+
12
+ export default function WalletTermsAndConditionComponent({
13
+ onConsentAccepted,
14
+ }: WalletTermsAndConditionComponentProps) {
15
+ //
16
+ const scopeT = _useScopedI18n("payment.walletTermsAndConditionComponent");
17
+
18
+ const [acceptTerms, setAcceptTerms] = useState(false);
19
+
20
+ const { acceptWalletConsent } = usePayments({});
21
+
22
+ const handleAcceptConsent = async () => {
23
+ try {
24
+ await acceptWalletConsent.mutateAsync();
25
+
26
+ notification.apiNotify({
27
+ status: true,
28
+ message: scopeT("consentAcceptedMsg"),
29
+ });
30
+ onConsentAccepted();
31
+ } catch (error) {
32
+ console.log("🚀 ~ handleAcceptConsent ~ error:", error);
33
+ notification.apiNotify({
34
+ status: false,
35
+ message: scopeT("consentErrorMsg"),
36
+ });
37
+ }
38
+ };
39
+
40
+ return (
41
+ <React.Fragment>
42
+ <div className="flex flex-col justify-center items-center p-2 gap-4">
43
+ <Checkbox
44
+ color="green"
45
+ label={
46
+ <Typography className="font-normal text-sm text-center">
47
+ {scopeT("consentClickMsg")}
48
+ <Typography
49
+ target="_blank"
50
+ as="a"
51
+ href="https://docs.horysmall.com/legal-docs/terms-and-conditions"
52
+ color="purple"
53
+ className="inline text-sm font-medium transition-colors hover:text-purple-600"
54
+ >
55
+ &nbsp; {scopeT("termsAndC")} &nbsp;
56
+ </Typography>
57
+ {scopeT("and")}
58
+ <Typography
59
+ target="_blank"
60
+ as="a"
61
+ href="https://docs.horysmall.com/legal-docs/privacy-policy"
62
+ color="purple"
63
+ className="inline text-sm font-medium transition-colors hover:text-purple-600"
64
+ >
65
+ &nbsp; {scopeT("privacyP")}
66
+ </Typography>
67
+ .
68
+ </Typography>
69
+ }
70
+ crossOrigin={undefined}
71
+ checked={acceptTerms}
72
+ onChange={() => {
73
+ setAcceptTerms((prev) => !prev);
74
+ }}
75
+ />
76
+
77
+ <ButtonCustom
78
+ disabled={!acceptTerms}
79
+ onClick={handleAcceptConsent}
80
+ className="inline-block"
81
+ icon={undefined}
82
+ >
83
+ {scopeT("importBtn")}
84
+ </ButtonCustom>
85
+ </div>
86
+ </React.Fragment>
87
+ );
88
+ }
@@ -0,0 +1,56 @@
1
+ import * as yup from "yup";
2
+
3
+ export const isValidPhoneNumber = (value: string, context: any) => {
4
+ const minLength = context.parent.minPhoneLength;
5
+
6
+ if (!value || value.length == 0 || value.length < minLength) return false;
7
+
8
+ return true;
9
+ };
10
+
11
+ export const isValidPostalCode = (value: string, context: any) => {
12
+ const { parent } = context;
13
+ const zipCodeRegex = parent.zipCodeRegex;
14
+
15
+ // Ensure the regex exists and is valid
16
+ if (zipCodeRegex.length == 0) {
17
+ return true;
18
+ }
19
+
20
+ const regex = new RegExp(zipCodeRegex);
21
+ return regex.test(value);
22
+ };
23
+
24
+ export const AddressShippingSchema = () => {
25
+ return yup.object({
26
+ firstName: yup
27
+ .string()
28
+ .min(2, "First Name is required")
29
+ .required("First Name is required"),
30
+ lastName: yup.string().min(2).required("Last Name is required"),
31
+ address: yup.string().min(2).max(35).required("Address is required"),
32
+ buildingInfo: yup.string().max(100),
33
+ countryId: yup.number().required("Select country is required"),
34
+ state: yup.string().required("Select state is required"),
35
+ city: yup.string().required("Select city is required"),
36
+ postalCode: yup
37
+ .string()
38
+ .min(4)
39
+ .max(10)
40
+ .required("Zipcode field is required")
41
+ .test("is-postal-code-valid", "Invalid Postal Code", (value, context) =>
42
+ isValidPostalCode(value, context),
43
+ ),
44
+ phone: yup
45
+ .string()
46
+ .min(2)
47
+ .max(12)
48
+ .required("Enter Mobile Number it is required")
49
+ .test("is-phone-number-valid", "Invalid Phone Number", (value, context) =>
50
+ isValidPhoneNumber(value, context),
51
+ ),
52
+ // zipCodeRegex: yup.string(),
53
+ // zipCodeExample: yup.string(),
54
+ minPhoneLength: yup.string(),
55
+ });
56
+ };
@@ -0,0 +1,56 @@
1
+ import * as yup from "yup";
2
+
3
+ export const isValidPhoneNumber = (value: string, context: any) => {
4
+ const minLength = context.parent.minPhoneLength;
5
+
6
+ if (!value || value.length == 0 || value.length < minLength) return false;
7
+
8
+ return true;
9
+ };
10
+
11
+ export const isValidPostalCode = (value: string, context: any) => {
12
+ const { parent } = context;
13
+ const zipCodeRegex = parent.zipCodeRegex;
14
+
15
+ // Ensure the regex exists and is valid
16
+ if (zipCodeRegex.length == 0) {
17
+ return true;
18
+ }
19
+
20
+ const regex = new RegExp(zipCodeRegex);
21
+ return regex.test(value);
22
+ };
23
+
24
+ export const AddressSchema = () => {
25
+ return yup.object({
26
+ firstName: yup
27
+ .string()
28
+ .min(2, "First Name is required")
29
+ .required("First Name is required"),
30
+ lastName: yup.string().min(2).required("Last Name is required"),
31
+ address: yup.string().min(2).max(20).required("Address is required"),
32
+ buildingInfo: yup.string().max(100),
33
+ countryId: yup.number().required("Select country is required"),
34
+ state: yup.string().required("Select state is required"),
35
+ city: yup.string().required("Select city is required"),
36
+ postalCode: yup
37
+ .string()
38
+ .min(4)
39
+ .max(10)
40
+ .required("Zipcode field is required")
41
+ .test("is-postal-code-valid", "Invalid Postal Code", (value, context) =>
42
+ isValidPostalCode(value, context),
43
+ ),
44
+ phone: yup
45
+ .string()
46
+ .min(2)
47
+ .max(12)
48
+ .required("Enter Mobile Number it is required")
49
+ .test("is-phone-number-valid", "Invalid Phone Number", (value, context) =>
50
+ isValidPhoneNumber(value, context),
51
+ ),
52
+ // zipCodeRegex: yup.string(),
53
+ // zipCodeExample: yup.string(),
54
+ minPhoneLength: yup.string(),
55
+ });
56
+ };
@@ -0,0 +1,323 @@
1
+ export const APP_NAME = "HMall";
2
+
3
+ export const COOKIES_NAME = {
4
+ authToken: "horys-mall-token",
5
+ userSessionId: "horys-mall-session",
6
+ requestUrl: "requestUrl",
7
+ aletaPaymentToken: "aleta-payment-token",
8
+ };
9
+
10
+ export const DEFAULT_CURRENCY = "$";
11
+ export const EURO_CURRENCY = "€";
12
+
13
+ export const PLACEHOLDER_IMAGE = "/img/img-placeholder-illustration.svg";
14
+
15
+ export const PROFILE_PLACEHOLDER_IMAGE = "/img/profile-avatar.svg";
16
+
17
+ export const CROWN_IMAGE = "/img/crown.svg";
18
+
19
+ export const CATEGORY_FOR_SMART_PAY = "smart-pay";
20
+ export const CATEGORY_FOR_AI_COMPUTING = "ai-computing";
21
+ export const CATEGORY_FOR_LICENSE = "license";
22
+
23
+ export const CART_STATUS = {
24
+ checkout: "checkout",
25
+ payment: "payment",
26
+ shopping: "shopping",
27
+ review: "review",
28
+ deliveryPayment: "delivery-payment",
29
+ };
30
+ export const QUANTITY_ACTIONS: { add: string; minus: string } = {
31
+ add: "add",
32
+ minus: "minus",
33
+ };
34
+
35
+ export const METHOD_TO_PAY = {
36
+ card: "card",
37
+ wallet: "wallet",
38
+ aleta: "aleta",
39
+ };
40
+
41
+ export const ORDER_STATUS = {
42
+ PENDING: "pending",
43
+ PROCESSING: "processing",
44
+ COMPLETED: "completed",
45
+ FAILED: "failed",
46
+ PARTIALLY_PAID: "partially-paid",
47
+ RETURNED: "refunded",
48
+ };
49
+
50
+ export const ORDER_ITEM_STATUS = {
51
+ PENDING: "pending",
52
+ PURCHASED: "purchased",
53
+ CANCELLED: "cancelled",
54
+ FAILED: "failed",
55
+ };
56
+
57
+ export const paymentStatusTheme = {
58
+ [ORDER_STATUS.COMPLETED]: {
59
+ color: "green",
60
+ className: "text-green-500 bg-green-100",
61
+ },
62
+ [ORDER_STATUS.PROCESSING]: {
63
+ color: "#FA7731",
64
+ className: "text-orange-500 bg-orange-100",
65
+ },
66
+ [ORDER_STATUS.PENDING]: {
67
+ color: "#FA7731",
68
+ className: "text-orange-500 bg-orange-100",
69
+ },
70
+ [ORDER_STATUS.FAILED]: {
71
+ color: "red",
72
+ className: "text-red-500 bg-red-100",
73
+ },
74
+ };
75
+
76
+ export const SHIPPING_STATUS = {
77
+ IN_HOUSE: "in-house",
78
+ IN_PROCESS: "in-process",
79
+ READY_FOR_SHIPPING: "ready-for-shipping",
80
+ READY_FOR_PICKUP: "ready-for-pickup",
81
+ DELIVERED: "delivered",
82
+ PICKED_UP: "picked-up",
83
+ CANCELLED: "cancelled",
84
+ ORDER_REFUNDED: "order-refunded",
85
+ SHIPPING_REFUNDED: "shipping-refunded",
86
+ IN_TRANSIT: "in-transit",
87
+ OUT_FOR_DELIVERY: "out-for-delivery",
88
+ NO_LONGER_AVAILABLE: "no-longer-available",
89
+ RETURNED: "returned",
90
+ SHIPPING_NOT_PAID: "shipping_not_paid",
91
+ SHIPPING_PAID_DELIVERED: "shipping_paid_delivered",
92
+ SHIPPING_PAID_NOT_DELIVERED: "shipping_paid_not_delivered",
93
+ REFUNDABLE: "refundable",
94
+ NONE_REFUNDABLE: "none-refundable",
95
+ };
96
+
97
+ export const shippingStatusTheme = {
98
+ [SHIPPING_STATUS.IN_HOUSE]: {
99
+ color: "blue",
100
+ className: "text-info-500 bg-info-100",
101
+ label: "In House",
102
+ },
103
+ [SHIPPING_STATUS.RETURNED]: {
104
+ color: "red",
105
+ className: "text-red-500 bg-red-100",
106
+ label: "Returned",
107
+ },
108
+ [ORDER_STATUS.PENDING]: {
109
+ color: "#FA7731",
110
+ className: "text-orange-500 bg-orange-100",
111
+ label: "Pending",
112
+ },
113
+ [SHIPPING_STATUS.IN_PROCESS]: {
114
+ color: "#FA7731",
115
+ className: "text-orange-500 bg-orange-100",
116
+ label: "In Process",
117
+ },
118
+ [SHIPPING_STATUS.READY_FOR_SHIPPING]: {
119
+ color: "orange",
120
+ className: "text-[#DC9700] bg-yellow-50",
121
+ label: "Ready For Shipping",
122
+ },
123
+ [SHIPPING_STATUS.READY_FOR_PICKUP]: {
124
+ color: "orange",
125
+ className: "text-[#DC9700] bg-yellow-50",
126
+ label: "Ready For Pickup",
127
+ },
128
+ [SHIPPING_STATUS.DELIVERED]: {
129
+ color: "green",
130
+ className: "text-green-500 bg-green-100",
131
+ label: "Delivered",
132
+ },
133
+ [SHIPPING_STATUS.PICKED_UP]: {
134
+ color: "green",
135
+ className: "text-green-500 bg-green-100",
136
+ label: "Picked Up",
137
+ },
138
+ [SHIPPING_STATUS.CANCELLED]: {
139
+ color: "red",
140
+ className: "text-red-500 bg-red-100",
141
+ label: "Cancelled",
142
+ },
143
+ [SHIPPING_STATUS.SHIPPING_NOT_PAID]: {
144
+ color: "red",
145
+ className: "text-red-500 bg-red-100",
146
+ label: "Shipping Not Paid",
147
+ },
148
+ [SHIPPING_STATUS.NO_LONGER_AVAILABLE]: {
149
+ color: "red",
150
+ className: "text-red-500 bg-red-100",
151
+ label: "No Longer Available",
152
+ },
153
+ [SHIPPING_STATUS.ORDER_REFUNDED]: {
154
+ color: "red",
155
+ className: "text-red-500 bg-red-100",
156
+ label: "Order Refunded",
157
+ },
158
+ [SHIPPING_STATUS.SHIPPING_REFUNDED]: {
159
+ color: "red",
160
+ className: "text-red-500 bg-red-100",
161
+ label: "Shipping Refunded",
162
+ },
163
+ [SHIPPING_STATUS.OUT_FOR_DELIVERY]: {
164
+ color: "blue",
165
+ className: "text-info-500 bg-info-100",
166
+ label: "Out For Delivery",
167
+ },
168
+ [SHIPPING_STATUS.IN_TRANSIT]: {
169
+ color: "#FA7731",
170
+ className: "text-orange-500 bg-orange-100",
171
+ label: "In Transit",
172
+ },
173
+ [SHIPPING_STATUS.REFUNDABLE]: {
174
+ color: "green",
175
+ className: "text-green-500 bg-green-100",
176
+ label: "Refundable",
177
+ },
178
+ [SHIPPING_STATUS.NONE_REFUNDABLE]: {
179
+ color: "red",
180
+ className: "text-red-500 bg-red-100",
181
+ label: "Non-Refundable",
182
+ },
183
+ [SHIPPING_STATUS.SHIPPING_PAID_DELIVERED]: {
184
+ color: "green",
185
+ className: "text-green-500 bg-green-100",
186
+ label: "Shipping Paid Delivered",
187
+ },
188
+ [SHIPPING_STATUS.SHIPPING_PAID_NOT_DELIVERED]: {
189
+ color: "orange",
190
+ className: "text-[#DC9700] bg-yellow-50",
191
+ label: "Shipping Paid Not Delivered",
192
+ },
193
+ default: {
194
+ color: "green",
195
+ className: "text-green-500 bg-green-100",
196
+ label: "Purchased",
197
+ },
198
+ };
199
+
200
+ export const APP_LANG = ["en", "it"];
201
+ export const SHIPPING_CART_STATUS = {
202
+ initiateDelivery: "initiate_delivery",
203
+ methods: "delivery-mode",
204
+ payments: "payment",
205
+ review: "review",
206
+ deliveryConfirmation: "shipping_delivery_confirmation",
207
+ };
208
+
209
+ export const UPGRADE_STATUS = {
210
+ upgradeProduct: "upgrade_product",
211
+ methods: "checkout",
212
+ payments: "payment",
213
+ review: "review",
214
+ deliveryConfirmation: "upgrade_delivery_confirmation",
215
+ };
216
+
217
+ export const SHIPPING_METHOD = {
218
+ shipping: {
219
+ value: "shipping",
220
+ label: "Shipping",
221
+ },
222
+ pickup: {
223
+ value: "pickup",
224
+ label: "Pickup",
225
+ },
226
+ };
227
+ export const GREETING_DIALOG_STATUS_KEY = "greetingPopupSeen";
228
+ export const GREETING_DIALOG_STATUS = {
229
+ seen: "seen",
230
+ unSeen: "unSeen",
231
+ };
232
+
233
+ export const SHIPPING_ORDER_ID_KEY = "shippingOrderIdKey";
234
+ export const SMART_PAY_PARTIAL_PAY_SUCCESS = "SmartPayPartialPaySuccess";
235
+ export const SMART_PAY_PARTIAL_PAY_SUCCESS_VALUE = {
236
+ SUCCESS: "success",
237
+ FAILED: "failed",
238
+ };
239
+
240
+ export const ADDRESS_TYPES = {
241
+ shipping: {
242
+ value: "shipping",
243
+ label: "Shipping",
244
+ },
245
+ billing: {
246
+ value: "billing",
247
+ label: "Billing",
248
+ },
249
+ };
250
+
251
+ export const SMLYK = {
252
+ value: "smLYK",
253
+ label: "smLYK",
254
+ };
255
+
256
+ export const CASHBACK_TOKEN = new Proxy(
257
+ {
258
+ mlykgen3cashback: { value: "mlyk", label: "mlyk" },
259
+ smlykgen3cashback: { value: "smlyk", label: "smlyk" },
260
+ usdkgen3cashback: { value: "usdk", label: "usdk-old" },
261
+ mlyk: { value: "mlyk", label: "mlyk" },
262
+ },
263
+ {
264
+ get: (target, prop) => {
265
+ return (
266
+ target[prop as keyof typeof target] ?? {
267
+ value: prop,
268
+ label: prop,
269
+ }
270
+ );
271
+ },
272
+ },
273
+ );
274
+
275
+ export const ORDERS_TABLE_DEFAULTS = {
276
+ page: 1,
277
+ limit: 15,
278
+ };
279
+
280
+ export const SHIPPING_ORDERS_TABLE_DEFAULTS = {
281
+ page: 1,
282
+ limit: 15,
283
+ };
284
+
285
+ export const LEGACY_ORDERS_TABLE_DEFAULTS = {
286
+ page: 1,
287
+ limit: 15,
288
+ };
289
+
290
+ export const KYC_STATUS = {
291
+ SUBSCRIPTION_REQUIRED: "subscription-required",
292
+ KYC_REQUIRED: "kyc-required",
293
+ KYC_PENDING: "kyc-pending",
294
+ KYC_REJECTED: "kyc-rejected",
295
+ ACTIVE: "active",
296
+ } as const;
297
+
298
+ export const MIGRATION_ORDER_ID_KEY = "migrationOrderIdKey";
299
+
300
+ export const MIGRATE_STATUS = {
301
+ methods: "checkout",
302
+ payments: "payment",
303
+ review: "review",
304
+ deliveryConfirmation: "migrate_delivery_confirmation",
305
+ };
306
+
307
+ export const EXTENSIONS_STATUS = {
308
+ methods: "checkout",
309
+ payments: "payment",
310
+ review: "review",
311
+ deliveryConfirmation: "migrate_delivery_confirmation",
312
+ };
313
+
314
+ export const GEN_3_EXTENSION_HOME_DIALOG_STATUS_KEY =
315
+ "gen3ExtensionHomeDialogSeen";
316
+
317
+ export const PAYMENTS_TYPE = {
318
+ UPGRADE: "upgrade",
319
+ gen2Migration: "gen2Migration",
320
+ NORMAL: "normal",
321
+ SHIPPING: "shipping",
322
+ SMART_PAY: "smart-pay",
323
+ };
@@ -0,0 +1,23 @@
1
+ export const Environments = {
2
+ APP_ENV: process.env.NEXT_PUBLIC_APP_ENV,
3
+
4
+ GOOGLE_TAG_MANAGER: process.env.NEXT_PUBLIC_GOOGLE_TAG_MANAGER,
5
+
6
+ API: {
7
+ hostname: process.env.NEXT_PUBLIC_API_HOST,
8
+ },
9
+ SOCKET: {
10
+ hostname: process.env.NEXT_PUBLIC_SOCKET_HOST,
11
+ },
12
+ NODE_LINK: {
13
+ profileUrl: process.env.NEXT_PUBLIC_NODE_LINK_PROFILE_URL,
14
+ depositUrl: process.env.NEXT_PUBLIC_NODE_LINK_DEPOSIT_URL,
15
+ },
16
+ SERVER_ACTION: {
17
+ APP_ENV: process.env.APP_ENV,
18
+ API: {
19
+ hostname: process.env.API_HOST,
20
+ },
21
+ },
22
+ TEST_AUTH_URL: process.env.TEST_AUTH_URL,
23
+ };
@@ -0,0 +1,15 @@
1
+ export const FeatureCodes = {
2
+ LEGACY_ORDERS_UPGRADE: "legacy-order-upgrade",
3
+ LEGACY_ORDERS_PHONE_SHIPPING: "legacy-order-phone-shipping",
4
+ LEGACY_ORDERS: "legacy-orders",
5
+ INITIATE_DELIVERY: "initiate-delivery",
6
+ DOWNLOAD_ORDER_INVOICE: "download-order-invoice",
7
+ DOWNLOAD_SHIPPING_ORDER_INVOICE: "download-shipping-order-invoice",
8
+ SMART_PAY_PLAN: "smart-plan-pay",
9
+ ALETA_PAYMENT: "aleta",
10
+ AI_CATEGORY: "ai-category",
11
+ GEN_3_EXTENSION_HOME_DIALOG: "gen2-to-gen3-migration",
12
+ ORDER_V2_API: "order-v2-api",
13
+ ENABLE_GEN_3_ORDER_INVOICE: "enable-gen-3-order-invoices",
14
+ ENABLE_EXTENSION_FLOW: "enable-extension-flow",
15
+ };
@@ -0,0 +1,106 @@
1
+ export const QueryKeys = {
2
+ auth: {
3
+ GET_SSO_LINK: "GET_SSO_LINK",
4
+ VALIDATE_AUTH_CODE: "VALIDATE_AUTH_CODE",
5
+ },
6
+ products: {
7
+ GET_CATEGORIES: "GET_CATEGORIES",
8
+ GET_PRODUCTS: "GET_PRODUCTS",
9
+ GET_PRODUCT: "GET_PRODUCT",
10
+ BOOST_PRODUCTS: "BOOST_PRODUCTS",
11
+ },
12
+ users: {
13
+ GET_USER: "GET_USER",
14
+ GET_PURCHASE_QUANTITY: "GET_PURCHASE_QUANTITY",
15
+ GET_COUNTRIES: "GET_COUNTRIES",
16
+ GET_COUNTRIES_BY_SHIPPING_METHOD: "GET_COUNTRIES_BY_SHIPPING_METHOD",
17
+ GET_STATE_BY_COUNTRY: "GET_STATE_BY_COUNTRY",
18
+ GET_SHIPPING_STATE_BY_COUNTRY: "GET_SHIPPING_STATE_BY_COUNTRY",
19
+ GET_STORE_BY_COUNTRY: "GET_STORE_BY_COUNTRY",
20
+ GET_SHIPPING_CITY_BY_STATE_AND_COUNTRY:
21
+ "GET_SHIPPING_CITY_BY_STATE_AND_COUNTRY",
22
+ ADD_NEW_ADDRESS: "ADD_NEW_ADDRESS",
23
+ UPDATE_ADDRESS: "UPDATE_ADDRESS",
24
+ DELETE_ADDRESS: "DELETE_ADDRESS",
25
+ GET_ADDRESSES: "GET_ADDRESSES",
26
+ GET_SHIPPING_ADDRESSES: "GET_SHIPPING_ADDRESSES",
27
+ },
28
+ cart: {
29
+ GET_CART: "GET_CART",
30
+ ADD_TO_CART: "ADD_TO_CART",
31
+ DELETE_CART: "DELETE_CART",
32
+ REMOVE_FROM_CART: "REMOVE_FROM_CART",
33
+ REMOVE_PRODUCT_FROM_CART: "REMOVE_PRODUCT_FROM_CART",
34
+ DELETE_FROM_CART: "DELETE_FROM_CART",
35
+ UPDATE_ADDRESSES: "UPDATE_ADDRESSES",
36
+ UPDATE_PAYMENT_METHOD: "UPDATE_PAYMENT_METHOD",
37
+ UPDATE_CART_STATE: "UPDATE_CART_STATE",
38
+ REFRESH_CART: "REFRESH_CART",
39
+ UPDATE_SHIPPING_ADDRESSES: "UPDATE_SHIPPING_ADDRESSES",
40
+ RESET_CART_ADDRESS: "UPDATE_SHIPPING_CART_STATE",
41
+ },
42
+ shippingCart: {
43
+ GET_SHIPPING_CART: "GET_SHIPPING_CART",
44
+ UPDATE_SHIPPING_CART_STATE: "UPDATE_SHIPPING_CART_STATE",
45
+ GET_SHIPPING_METHODS: "GET_SHIPPING_METHODS",
46
+ UPDATE_SHIPPING_ADDRESSES: "UPDATE_SHIPPING_ADDRESSES",
47
+ UPDATE_SHIPPING_PAYMENT: "UPDATE_SHIPPING_PAYMENT",
48
+ UPDATE_SHIPPING_PICKUP: "UPDATE_SHIPPING_PICKUP",
49
+ CLEAR_PAYMENT_METHOD: "CLEAR_PAYMENT_METHOD",
50
+ REFRESH_SHIPPING_CART: "REFRESH_SHIPPING_CART",
51
+ RESET_SHIPPING_CART_ADDRESS: "UPDATE_SHIPPING_CART_STATE",
52
+ },
53
+ upgradeCart: {
54
+ GET_UPGRADE_CART: "GET_SHIPPING_CART",
55
+ UPDATE_Upgrade_CART_STATE: "UPDATE_Upgrade_CART_STATE",
56
+ GET_SHIPPING_METHODS: "GET_SHIPPING_METHODS",
57
+ GET_MIGRATION_SHIPPING_METHODS: "GET_MIGRATION_SHIPPING_METHODS",
58
+ UPDATE_UPGRADE_ADDRESSES: "UPDATE_UPGRADE_ADDRESSES",
59
+ UPDATE_UPGRADE_SHIPPING_ADDRESSES: "UPDATE_UPGRADE_SHIPPING_ADDRESSES",
60
+ UPDATE_UPGRADE_PAYMENT: "UPDATE_UPGRADE_PAYMENT",
61
+ UPDATE_UPGRADE_PICKUP: "UPDATE_UPGRADE_PICKUP",
62
+ CLEAR_PAYMENT_METHOD: "CLEAR_PAYMENT_METHOD",
63
+ UPDATE_UPGRADE_CART_METHOD_ID: "UPDATE_UPGRADE_CART_METHOD_ID",
64
+ GET_COUNTRIES_BY_SHIPPING_METHOD: "GET_COUNTRIES_BY_SHIPPING_METHOD",
65
+ },
66
+ payments: {
67
+ GET_PAYMENTS: "GET_PAYMENTS",
68
+ PLACE_ORDER: "PLACE_ORDER",
69
+ PLACE_UPGRADE_ORDER: "PLACE_UPGRADE_ORDER",
70
+ GET_ASSETS: "GET_ASSETS",
71
+ ACCEPT_WALLET_CONSENT: "GET_ADDRESSES",
72
+ GET_MIGRATION_PAYMENTS: "GET_MIGRATION_PAYMENTS",
73
+ },
74
+ orders: {
75
+ GET_ORDERS: "GET_ORDERS",
76
+ GET_ORDER: "GET_ORDER",
77
+ GET_SHIPPING_ORDERS_ITEMS: "GET_SHIPPING_ORDERS_ITEMS",
78
+ GET_LEGACY_ORDERS_ITEMS: "GET_LEGACY_ORDERS_ITEMS",
79
+ ADD_SHIPPING_CART_PRODUCT: "ADD_SHIPPING_CART_PRODUCT",
80
+ ADD_SHIPPING_CART_ALL_PRODUCTS: "ADD_SHIPPING_CART_ALL_PRODUCTS",
81
+ UPGRADE_CART_ADD_PRODUCT: "UPGRADE_CART_ADD_PRODUCT",
82
+ },
83
+ invoices: {
84
+ GENERATE_INVOICES: "GENERATE_INVOICES",
85
+ GENERATE_SHIPPING_INVOICES: "GENERATE_SHIPPING_INVOICES",
86
+ },
87
+ migrationCart: {
88
+ ADD_PRODUCTS_TO_MIGRATION_CART: "ADD_PRODUCTS_TO_MIGRATION_CART",
89
+ GET_MIGRATE_CART: "GET_MIGRATE_CART",
90
+ UPDATE_Migrate_CART_STATE: "UPDATE_Migrate_CART_STATE",
91
+ GET_PAYMENTS: "GET_MIGRATION_PAYMENTS",
92
+ },
93
+ extensionsCart: {
94
+ GET_EXTENSIONS_CART: "GET_EXTENSIONS_CART",
95
+ UPDATE_EXTENSIONS_CART_STATE: "UPDATE_EXTENSIONS_CART_STATE",
96
+ GET_EXTENSIONS_SHIPPING_METHODS: "GET_EXTENSIONS_SHIPPING_METHODS",
97
+ UPDATE_EXTENSIONS_ADDRESSES: "UPDATE_EXTENSIONS_ADDRESSES",
98
+ UPDATE_EXTENSIONS_SHIPPING_ADDRESSES:
99
+ "UPDATE_EXTENSIONS_SHIPPING_ADDRESSES",
100
+ UPDATE_EXTENSIONS_PAYMENT: "UPDATE_EXTENSIONS_PAYMENT",
101
+ UPDATE_EXTENSIONS_CART_METHOD_ID: "UPDATE_EXTENSIONS_CART_METHOD_ID",
102
+ GET_COUNTRIES_BY_SHIPPING_METHOD: "GET_COUNTRIES_BY_SHIPPING_METHOD",
103
+ RESET_EXTENSIONS_CART_ADDRESS: "RESET_EXTENSIONS_CART_ADDRESS",
104
+ ADD_EXTENSIONS_FOR_CART: "ADD_EXTENSIONS_FOR_CART",
105
+ },
106
+ };