@lmnto/h-mall-shared 1.0.15 → 1.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmnto/h-mall-shared",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "scripts": {
@@ -17,12 +17,14 @@ export type AddressFormComponentProps = {
17
17
  isLoading: boolean;
18
18
  proceedSubmit: FormEventHandler<HTMLButtonElement>;
19
19
  onCancel?: () => void;
20
+ enforceCheckoutEnabled?: boolean;
20
21
  };
21
22
 
22
23
  export default function AddressFormComponent({
23
24
  formId,
24
25
  isLoading,
25
26
  proceedSubmit,
27
+ enforceCheckoutEnabled = false,
26
28
  }: AddressFormComponentProps) {
27
29
  //
28
30
  const scopeT = _useScopedI18n("sharedComponents.addressFormComponent");
@@ -126,6 +128,7 @@ export default function AddressFormComponent({
126
128
  name="countryId"
127
129
  formId={formId}
128
130
  onCountrySelected={handleGetState}
131
+ enforceCheckoutEnabled={enforceCheckoutEnabled}
129
132
  />
130
133
  </div>
131
134
  <div className="col-span-12 md:col-span-6 relative">
@@ -18,12 +18,14 @@ export type AddressShippingFormComponentProps = {
18
18
  isLoading: boolean;
19
19
  proceedSubmit: FormEventHandler<HTMLButtonElement>;
20
20
  onCancel?: () => void;
21
+ enforceCheckoutEnabled?: boolean;
21
22
  };
22
23
 
23
24
  export default function AddressShippingFormComponent({
24
25
  formId,
25
26
  isLoading,
26
27
  proceedSubmit,
28
+ enforceCheckoutEnabled = false,
27
29
  }: AddressShippingFormComponentProps) {
28
30
  //
29
31
  const scopeT = _useScopedI18n("sharedComponents.addressFormComponent");
@@ -134,6 +136,7 @@ export default function AddressShippingFormComponent({
134
136
  formId={formId}
135
137
  onCountrySelected={handleGetState}
136
138
  forShipping={true}
139
+ enforceCheckoutEnabled={enforceCheckoutEnabled}
137
140
  />
138
141
  </div>
139
142
  <div className="col-span-12 md:col-span-6 relative">
@@ -18,6 +18,8 @@ export interface InputFieldProps {
18
18
  formId: string;
19
19
  forShipping?: boolean;
20
20
  forPickUp?: boolean;
21
+ /** When true, only countries with isCheckoutEnabled are shown (checkout flows). */
22
+ enforceCheckoutEnabled?: boolean;
21
23
  onCountrySelected?: (value: string | number) => void;
22
24
  }
23
25
 
@@ -29,10 +31,12 @@ export function SelectCountries({
29
31
  formId,
30
32
  forShipping = true,
31
33
  forPickUp = false,
34
+ enforceCheckoutEnabled = false,
32
35
  onCountrySelected,
33
36
  }: InputFieldProps) {
34
37
  const {
35
38
  countries,
39
+ shippingCountries,
36
40
  setStates,
37
41
  setShippingStates,
38
42
  setCities,
@@ -50,8 +54,14 @@ export function SelectCountries({
50
54
  const [error, setError] = useState<any>(null);
51
55
  const [search, setSearch] = useState<string>("");
52
56
 
53
- const countriesType = countries;
54
- const filteredCountries = countriesType?.filter((country) =>
57
+ const baseCountries =
58
+ forShipping && shippingCountries?.length
59
+ ? shippingCountries
60
+ : countries;
61
+ const checkoutFiltered = enforceCheckoutEnabled
62
+ ? baseCountries?.filter((country) => country.isCheckoutEnabled !== false)
63
+ : baseCountries;
64
+ const filteredCountries = checkoutFiltered?.filter((country) =>
55
65
  country.name.toLowerCase().includes(search.toLowerCase()),
56
66
  );
57
67
 
@@ -73,7 +83,7 @@ export function SelectCountries({
73
83
  // Handle change logic for country selection
74
84
  const handleOnChange = (value: any) => {
75
85
  const countryId = +value.id; // Ensure it's a number
76
- const selectedCountry = countries.find((c) => c.id === countryId);
86
+ const selectedCountry = checkoutFiltered?.find((c) => c.id === countryId);
77
87
 
78
88
  if (!selectedCountry) return; // Handle invalid selection safely
79
89
 
@@ -138,7 +148,7 @@ export function SelectCountries({
138
148
  focus:bg-offWhite
139
149
  shadow-none ${className}
140
150
  `}
141
- items={filteredCountries}
151
+ items={filteredCountries ?? []}
142
152
  searchKey="name"
143
153
  placeholder={placeholder}
144
154
  renderOption={(_item, country) => {
@@ -34,6 +34,7 @@ export const QUANTITY_ACTIONS: { add: string; minus: string } = {
34
34
 
35
35
  export const METHOD_TO_PAY = {
36
36
  card: "card",
37
+ card_v2: "card_v2",
37
38
  wallet: "wallet",
38
39
  aleta: "aleta",
39
40
  nowpayments: "nowpayments",
@@ -24,4 +24,6 @@ export interface ICountries {
24
24
  zipCodeExists: boolean;
25
25
  zipCodeRegex: string;
26
26
  zipCodeExample: string;
27
+ /** Partner Hub checkout eligibility; used to filter checkout country pickers only. */
28
+ isCheckoutEnabled?: boolean;
27
29
  }