@lmnto/h-mall-shared 1.0.1 → 1.0.3

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.
@@ -1,223 +1,61 @@
1
- steps:
2
- - step: &build
3
- name: "CI (Build & Validate)"
4
- image: node:18-alpine3.18
5
- script:
6
- - npm cache clean --force
7
- - rm -rf node_modules
8
- - MONGOMS_DISABLE_POSTINSTALL=true npm install --force --loglevel verbose
9
- - echo "✓ Dependencies validated successfully"
10
-
11
- - step: &copy_shared_library
12
- name: "Copy Shared Library to CI Server"
13
- runs-on:
14
- - self.hosted
15
- - linux.shell
16
- - common.ci
17
- script:
18
- - |
19
- # Copy to common CI server for h-mall-web builds
20
- # This location is used by h-mall-web Dockerfile during build (COPY h-mall-shared)
21
- SHARED_LIB_PATH_CI="${HOME}/with-zone/h-mall-shared"
22
-
23
- # Ensure directory exists
24
- mkdir -p ${SHARED_LIB_PATH_CI}
25
-
26
- # Deploy shared library to CI server
27
- set +e
28
- rm -rf ${SHARED_LIB_PATH_CI}
29
- set -e
30
- mkdir -p ${SHARED_LIB_PATH_CI}
31
- cp -r ./ ${SHARED_LIB_PATH_CI}/
32
- rm -rf ${SHARED_LIB_PATH_CI}/node_modules ${SHARED_LIB_PATH_CI}/.git
33
- rm -f ${SHARED_LIB_PATH_CI}/.env*
34
-
35
- echo "✓ Shared library copied to CI server: ${SHARED_LIB_PATH_CI}"
36
- echo " This path is used by h-mall-web Dockerfile during build"
37
-
38
- - step: &preview_deploy
39
- name: "CD (Deploy Shared Library to Preview)"
40
- runs-on:
41
- - self.hosted
42
- - linux.shell
43
- - preview.runner
44
- script:
45
- - |
46
- # Standard deployment location - user-writable directory
47
- # Note: This path must match docker-compose.yml volume mount in h-mall-web
48
- SHARED_LIB_PATH="${HOME}/with-zone/h-mall-shared"
49
-
50
- # Ensure directory exists (user home directory is always writable)
51
- mkdir -p ${SHARED_LIB_PATH}
52
-
53
- # Deploy shared library
54
- set +e
55
- rm -rf ${SHARED_LIB_PATH}
56
- set -e
57
- mkdir -p ${SHARED_LIB_PATH}
58
- cp -r ./ ${SHARED_LIB_PATH}/
59
- rm -rf ${SHARED_LIB_PATH}/node_modules ${SHARED_LIB_PATH}/.git
60
- rm -f ${SHARED_LIB_PATH}/.env*
61
-
62
- echo "✓ Shared library deployed to: ${SHARED_LIB_PATH}"
63
- echo " This path is mounted in h-mall-web docker-compose.yml"
64
-
65
- - step: &dev_deploy
66
- name: "CD (Deploy Shared Library to Dev)"
67
- runs-on:
68
- - self.hosted
69
- - linux.shell
70
- - dev.runner
71
- script:
72
- - |
73
- # Standard deployment location - user-writable directory
74
- # Note: This path must match docker-compose.yml volume mount in h-mall-web
75
- SHARED_LIB_PATH="${HOME}/with-zone/h-mall-shared"
76
-
77
- # Ensure directory exists (user home directory is always writable)
78
- mkdir -p ${SHARED_LIB_PATH}
79
-
80
- # Deploy shared library
81
- set +e
82
- rm -rf ${SHARED_LIB_PATH}
83
- set -e
84
- mkdir -p ${SHARED_LIB_PATH}
85
- cp -r ./ ${SHARED_LIB_PATH}/
86
- rm -rf ${SHARED_LIB_PATH}/node_modules ${SHARED_LIB_PATH}/.git
87
- rm -f ${SHARED_LIB_PATH}/.env*
88
-
89
- echo "✓ Shared library deployed to: ${SHARED_LIB_PATH}"
90
- echo " This path is mounted in h-mall-web docker-compose.yml"
91
-
92
- - step: &uat_deploy
93
- name: "CD (Deploy Shared Library to UAT)"
94
- runs-on:
95
- - self.hosted
96
- - linux.shell
97
- - uat.runner
98
- script:
99
- - |
100
- # Standard deployment location - user-writable directory
101
- # Note: This path must match docker-compose.yml volume mount in h-mall-web
102
- SHARED_LIB_PATH="${HOME}/with-zone/h-mall-shared"
103
-
104
- # Ensure directory exists (user home directory is always writable)
105
- mkdir -p ${SHARED_LIB_PATH}
106
-
107
- # Deploy shared library
108
- set +e
109
- rm -rf ${SHARED_LIB_PATH}
110
- set -e
111
- mkdir -p ${SHARED_LIB_PATH}
112
- cp -r ./ ${SHARED_LIB_PATH}/
113
- rm -rf ${SHARED_LIB_PATH}/node_modules ${SHARED_LIB_PATH}/.git
114
- rm -f ${SHARED_LIB_PATH}/.env*
115
-
116
- echo "✓ Shared library deployed to: ${SHARED_LIB_PATH}"
117
- echo " This path is mounted in h-mall-web docker-compose.yml"
118
-
119
- - step: &prod_deploy
120
- name: "CD (Deploy Shared Library to Prod)"
121
- runs-on:
122
- - self.hosted
123
- - linux.shell
124
- - prod.runner
125
- script:
126
- - |
127
- # Standard deployment location - user-writable directory
128
- # Note: This path must match docker-compose.yml volume mount in h-mall-web
129
- SHARED_LIB_PATH="${HOME}/with-zone/h-mall-shared"
130
-
131
- # Ensure directory exists (user home directory is always writable)
132
- mkdir -p ${SHARED_LIB_PATH}
133
-
134
- # Deploy shared library
135
- set +e
136
- rm -rf ${SHARED_LIB_PATH}
137
- set -e
138
- mkdir -p ${SHARED_LIB_PATH}
139
- cp -r ./ ${SHARED_LIB_PATH}/
140
- rm -rf ${SHARED_LIB_PATH}/node_modules ${SHARED_LIB_PATH}/.git
141
- rm -f ${SHARED_LIB_PATH}/.env*
142
-
143
- echo "✓ Shared library deployed to: ${SHARED_LIB_PATH}"
144
- echo " This path is mounted in h-mall-web docker-compose.yml"
1
+ # =============================================================================
2
+ # h-mall-shared Bitbucket Pipelines
3
+ # =============================================================================
4
+ # Auth: Repository variables → NPM_TOKEN (secured). Granular token: publish +
5
+ # bypass 2FA for @lmnto.
6
+ #
7
+ # main: each push runs CI automatically; open that pipeline run and press
8
+ # Deploy (or Continue) on the manual "Publish to npm" stage to publish.
9
+ # Optional: Pipelines Run pipeline → custom "publish-to-npm" (any branch).
10
+ #
11
+ # Previous self-hosted pipeline: bitbucket-pipelines.yml.backup
12
+ # =============================================================================
13
+
14
+ image: node:22
145
15
 
146
16
  definitions:
147
- services:
148
- docker:
149
- memory: 3072
17
+ steps:
18
+ - step: &ci-install
19
+ name: CI — install dependencies
20
+ caches:
21
+ - node
22
+ script:
23
+ - node -v
24
+ - npm install
25
+ - echo "✓ Dependencies install OK"
26
+
27
+ - step: &publish-npm
28
+ name: Publish @lmnto/h-mall-shared to npm
29
+ caches:
30
+ - node
31
+ script:
32
+ - |
33
+ if [ -z "${NPM_TOKEN}" ]; then
34
+ echo "ERROR: Set secured repository variable NPM_TOKEN (Repository settings → Repository variables)."
35
+ exit 1
36
+ fi
37
+ - echo "registry=https://registry.npmjs.org/" > .npmrc
38
+ - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
39
+ - npm install
40
+ - npm whoami
41
+ - npm publish --access public
150
42
 
151
43
  pipelines:
152
44
  default:
153
- - step: *build
154
- - step: *copy_shared_library
45
+ - step: *ci-install
155
46
 
156
47
  branches:
157
- feature/*:
158
- - stage:
159
- name: CI
160
- steps:
161
- - step: *build
162
- - step: *copy_shared_library
163
- - stage:
164
- name: CD
165
- trigger: manual
166
- steps:
167
- - step: *preview_deploy
168
-
169
- pull-requests:
170
- - stage:
171
- name: CI
172
- steps:
173
- - step: *build
174
- - step: *copy_shared_library
175
- - stage:
176
- name: CD
177
- condition:
178
- or:
179
- - equals:
180
- - ${BITBUCKET_PR_DESTINATION_BRANCH}
181
- - dev
182
- - equals:
183
- - ${BITBUCKET_PR_DESTINATION_BRANCH}
184
- - develop
185
-
186
- steps:
187
- - step: *preview_deploy
188
-
189
- develop:
190
- - stage:
191
- name: CI
192
- steps:
193
- - step: *build
194
- - step: *copy_shared_library
195
- - stage:
196
- name: CD
197
- trigger: manual
198
- steps:
199
- - step: *dev_deploy
200
-
201
- release/*:
202
- - stage:
203
- name: CI
204
- steps:
205
- - step: *build
206
- - step: *copy_shared_library
207
- - stage:
208
- name: CD
209
- trigger: manual
210
- steps:
211
- - step: *uat_deploy
212
-
213
48
  main:
214
49
  - stage:
215
50
  name: CI
216
51
  steps:
217
- - step: *build
218
- - step: *copy_shared_library
52
+ - step: *ci-install
219
53
  - stage:
220
- name: CD
54
+ name: Publish to npm
221
55
  trigger: manual
222
56
  steps:
223
- - step: *prod_deploy
57
+ - step: *publish-npm
58
+
59
+ custom:
60
+ publish-to-npm:
61
+ - step: *publish-npm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmnto/h-mall-shared",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "scripts": {
@@ -33,7 +33,7 @@ export default function ListItemComponent({
33
33
 
34
34
  return (
35
35
  <ListItem
36
- className={`p-3 lg:p-2.5 xl:p-3 text-slate-600 rounded-lg
36
+ className={`relative p-3 lg:p-2.5 xl:p-3 text-slate-600 rounded-lg
37
37
  hover:text-purple-500 hover:bg-purple-100
38
38
  focus:text-purple-500 focus:bg-purple-200
39
39
  active:text-purple-500 active:bg-purple-50
@@ -1,7 +1,3 @@
1
- import alertIcon from "@hms/packages/public/img/alert-Icon.png";
2
- import ButtonCustom from "@hms/packages/shared/components/Button";
3
- import CustomNextImage from "@hms/packages/shared/components/CustomNextImage";
4
- import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
5
1
  import {
6
2
  Checkbox,
7
3
  Dialog,
@@ -13,7 +9,11 @@ import {
13
9
  } from "@material-tailwind/react";
14
10
  import React, { useEffect, useState } from "react";
15
11
 
12
+ import alertIcon from "../../../public/img/alert-Icon.png";
13
+ import ButtonCustom from "../../components/Button";
14
+ import CustomNextImage from "../../components/CustomNextImage";
16
15
  import { ROUTES } from "../../constants/routes";
16
+ import { _useScopedI18n } from "../../i18n/client";
17
17
 
18
18
  type DisclaimerAlertDialogProps = {
19
19
  open: boolean;
@@ -1,6 +1,7 @@
1
- import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
2
1
  import { Typography } from "@material-tailwind/react";
3
2
 
3
+ import { _useScopedI18n } from "../../i18n/client";
4
+
4
5
  export default function EmptyAssets() {
5
6
  const scopeT = _useScopedI18n("sharedComponents.emptyAssets");
6
7
 
@@ -1,14 +1,10 @@
1
- import CustomNextImage from "@hms/packages/shared/components/CustomNextImage";
2
- import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
3
- import {
4
- Asset,
5
- Option,
6
- PaymentsMethod,
7
- } from "@hms/packages/shared/types/payments";
8
- import { displayExactWalletBalance } from "@hms/packages/shared/utils/app.util";
9
1
  import { Tooltip, Typography } from "@material-tailwind/react";
10
2
 
11
3
  import walletIcon from "../../../public/img/wallet-icon.png";
4
+ import { _useScopedI18n } from "../../i18n/client";
5
+ import { Asset, Option, PaymentsMethod } from "../../types/payments";
6
+ import { displayExactWalletBalance } from "../../utils/app.util";
7
+ import CustomNextImage from "../CustomNextImage";
12
8
 
13
9
  export type PaybyWalletItemComponentProps = {
14
10
  paymentMethodData: PaymentsMethod;
@@ -1,12 +1,8 @@
1
- import CustomNextImage from "@hms/packages/shared/components/CustomNextImage";
2
- import {
3
- Asset,
4
- Option,
5
- PaymentsMethod,
6
- } from "@hms/packages/shared/types/payments";
7
1
  import { Tooltip, Typography } from "@material-tailwind/react";
8
2
 
9
3
  import cardIcon from "../../../public/img/card-icon.png";
4
+ import { Asset, Option, PaymentsMethod } from "../../types/payments";
5
+ import CustomNextImage from "../CustomNextImage";
10
6
 
11
7
  export type PaymentAssetItemComponentProps = {
12
8
  paymentMethodData: PaymentsMethod;
@@ -1,6 +1,4 @@
1
- // import AppLoadingComponent from "@hms/packages/shared/components/AppLoadingComponent";
2
- import ButtonCustom from "@hms/packages/shared/components/Button";
3
- import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
1
+ // import AppLoadingComponent from "../AppLoadingComponent";
4
2
  import {
5
3
  Dialog,
6
4
  DialogBody,
@@ -11,6 +9,8 @@ import {
11
9
  import React from "react";
12
10
  import { IoRefresh } from "react-icons/io5";
13
11
 
12
+ import { _useScopedI18n } from "../../i18n/client";
13
+ import ButtonCustom from "../Button";
14
14
  import LoadingIconComponent from "../LoadingIconComponent";
15
15
 
16
16
  type RequestProcessingDialogProps = {
@@ -1,13 +1,10 @@
1
- import WalletTermsAndConditionComponent from "@hms/packages/shared/components/payments/WalletTermsAndConditionComponent";
2
- import { usePayments } from "@hms/packages/shared/hooks/usePayments";
3
- import { useUserStore } from "@hms/packages/shared/stores/userStore";
4
- import {
5
- PaymentsMethod,
6
- PaymentType,
7
- } from "@hms/packages/shared/types/payments";
8
1
  import React, { useCallback, useEffect, useState } from "react";
9
2
 
10
3
  import { PAYMENTS_TYPE } from "../../constants/app";
4
+ import { usePayments } from "../../hooks/usePayments";
5
+ import { useUserStore } from "../../stores/userStore";
6
+ import { PaymentsMethod, PaymentType } from "../../types/payments";
7
+ import WalletTermsAndConditionComponent from "./WalletTermsAndConditionComponent";
11
8
 
12
9
  type WalletSectionManagerProps = {
13
10
  paymentMethodData: PaymentsMethod;
@@ -1,9 +1,3 @@
1
- import ButtonCustom from "@hms/packages/shared/components/Button";
2
- import CustomNextLink from "@hms/packages/shared/components/CustomNextLink";
3
- import { ROUTES } from "@hms/packages/shared/constants/routes";
4
- import { useGlobalDebounce } from "@hms/packages/shared/hooks/useDebounce";
5
- import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
6
- import { Asset, Commission, Option } from "@hms/packages/shared/types/payments";
7
1
  import {
8
2
  Button,
9
3
  Menu,
@@ -17,6 +11,13 @@ import React, { Dispatch, useEffect, useMemo, useState } from "react";
17
11
  import { GoChevronDown } from "react-icons/go";
18
12
  import { HiOutlineArrowSmLeft } from "react-icons/hi";
19
13
 
14
+ import { ROUTES } from "../../constants/routes";
15
+ import { useGlobalDebounce } from "../../hooks/useDebounce";
16
+ import { _useScopedI18n } from "../../i18n/client";
17
+ import { Asset, Commission, Option } from "../../types/payments";
18
+ import ButtonCustom from "../Button";
19
+ import CustomNextLink from "../CustomNextLink";
20
+
20
21
  // Payment method update function type
21
22
  type PaymentUpdateFunction = (params: any) => Promise<void> | void;
22
23
 
@@ -1,10 +1,11 @@
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
1
  import { Checkbox, Typography } from "@material-tailwind/react";
6
2
  import React, { useState } from "react";
7
3
 
4
+ import { usePayments } from "../../hooks/usePayments";
5
+ import { _useScopedI18n } from "../../i18n/client";
6
+ import { notification } from "../../utils/notifications.util";
7
+ import ButtonCustom from "../Button";
8
+
8
9
  type WalletTermsAndConditionComponentProps = {
9
10
  onConsentAccepted: () => void; // Prop to accept the consent
10
11
  };
@@ -1,9 +1,9 @@
1
- import { QueryKeys } from "@hms/packages/shared/constants/query-keys";
2
- import { UsersService } from "@hms/packages/shared/services/api";
3
1
  import { useMutation, useQuery } from "@tanstack/react-query";
4
2
  import { useMemo, useState } from "react";
5
3
 
6
4
  import { PAYMENTS_TYPE } from "../constants/app";
5
+ import { QueryKeys } from "../constants/query-keys";
6
+ import { UsersService } from "../services/api";
7
7
  import {
8
8
  proceedGetPaymentMethodAssetsAsync,
9
9
  proceedGetPaymentMethodsAsync,
@@ -1,4 +1,4 @@
1
- import { PAYMENTS_TYPE } from "@hms/packages/shared/constants/app";
1
+ import { PAYMENTS_TYPE } from "../constants/app";
2
2
 
3
3
  export type PaymentsMethod = {
4
4
  code: string;
@@ -1,8 +1,11 @@
1
+ import path from "node:path";
2
+
1
3
  import withMT from "@material-tailwind/react/utils/withMT";
2
4
  import type { Config } from "tailwindcss";
3
5
 
4
6
  export const sharedConfig: Config = {
5
- content: ["../h-mall-shared/shared/**/*.{js,ts,jsx,tsx,mdx}"],
7
+ // Absolute glob so when web-app imports this config, paths are not resolved from web-app/.
8
+ content: [path.join(__dirname, "shared/**/*.{js,ts,jsx,tsx,mdx}")],
6
9
  safelist: [
7
10
  "bg-yellow-50",
8
11
  "bg-red-100",