sme-pos-package 1.0.13 → 1.0.15
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/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -0
- package/package.json +4 -1
- package/dist/index.css.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/tailwind.preset.mjs.map +0 -1
- package/public/assets/images/bank-logos.png +0 -0
- package/public/assets/images/banner1.png +0 -0
- package/public/assets/images/banner2.png +0 -0
- package/public/assets/images/banner3.png +0 -0
- package/public/assets/images/banner4.png +0 -0
- package/public/assets/images/cashier.svg +0 -9
- package/public/assets/images/empty-cart.png +0 -0
- package/public/assets/images/empty-table-state.png +0 -0
- package/public/assets/images/layout-display/left-layout.png +0 -0
- package/public/assets/images/layout-display/right-layout.png +0 -0
- package/public/assets/images/modal-illustration.png +0 -0
- package/public/assets/images/order-empty-state.png +0 -0
- package/public/assets/images/order.png +0 -0
- package/public/assets/images/payment-success-label.png +0 -0
- package/public/assets/images/table-empty.png +0 -0
- package/public/assets/images/take-away.png +0 -0
- package/public/assets/lottie/loading.json +0 -1
- package/public/assets/lottie/soft_pos.json +0 -1
- package/public/assets/lottie/success.json +0 -1
- package/public/config.json +0 -27
- package/public/env.json +0 -17
- package/src/animations/success.json +0 -9730
- package/src/assets/icons/breadcrumbs-icon.tsx +0 -85
- package/src/assets/icons/cart-icon.tsx +0 -14
- package/src/assets/icons/common.tsx +0 -270
- package/src/assets/icons/customer-view-icon.tsx +0 -20
- package/src/assets/icons/dining-table.tsx +0 -34
- package/src/assets/icons/edit-line-icon.tsx +0 -18
- package/src/assets/icons/emenu-icon.tsx +0 -39
- package/src/assets/icons/file-close-line-icon.tsx +0 -18
- package/src/assets/icons/helper-icon.tsx +0 -84
- package/src/assets/icons/home-gear-line-icon.tsx +0 -18
- package/src/assets/icons/kanban-icon.tsx +0 -16
- package/src/assets/icons/loading-icon.tsx +0 -45
- package/src/assets/icons/logout-box-line-icon.tsx +0 -18
- package/src/assets/icons/order-icon.tsx +0 -92
- package/src/assets/icons/payment-icon.tsx +0 -429
- package/src/assets/icons/pincode.tsx +0 -196
- package/src/assets/icons/pos-connect-icon.tsx +0 -67
- package/src/assets/icons/pos-device-icon.tsx +0 -52
- package/src/assets/icons/pos-icon.tsx +0 -75
- package/src/assets/icons/printer-line-icon.tsx +0 -18
- package/src/assets/icons/star-icon.tsx +0 -174
- package/src/assets/icons/table-icon.tsx +0 -77
- package/src/assets/icons/user-add-line-icon.tsx +0 -33
- package/src/assets/icons/user-icon.tsx +0 -65
- package/src/components/common/button-action.tsx +0 -46
- package/src/components/common/button-icon.tsx +0 -23
- package/src/components/common/dropdown/index.tsx +0 -79
- package/src/components/common/empty-state.tsx +0 -60
- package/src/components/common/header/index.tsx +0 -89
- package/src/components/common/header/tabs.tsx +0 -119
- package/src/components/common/image.tsx +0 -20
- package/src/components/common/input/index.tsx +0 -55
- package/src/components/common/input/radio-group.tsx +0 -75
- package/src/components/common/input/text-area.tsx +0 -28
- package/src/components/common/modal/delete-confirm-modal-container.tsx +0 -65
- package/src/components/common/modal/index.ts +0 -2
- package/src/components/common/modal/modal-direction.tsx +0 -125
- package/src/components/common/modal/modal-header.tsx +0 -37
- package/src/components/common/modal/modal-wrapper.tsx +0 -56
- package/src/components/common/modal/modal-zoom.tsx +0 -61
- package/src/components/common/pagination.tsx +0 -95
- package/src/components/common/refresh-button.tsx +0 -28
- package/src/components/common/search-bar.tsx +0 -27
- package/src/components/common/search.tsx +0 -59
- package/src/components/common/skeleton.tsx +0 -7
- package/src/components/common/tabs-layout.tsx +0 -98
- package/src/components/common/use-check-session.tsx +0 -19
- package/src/components/customer-management/add-customer/add-customer-drawer.tsx +0 -286
- package/src/components/customer-management/add-customer/address-select.tsx +0 -51
- package/src/components/customer-management/choose-customer-drawer.tsx +0 -177
- package/src/components/customer-management/customer-info-drawer.tsx +0 -166
- package/src/components/customer-management/customer-no-data.tsx +0 -18
- package/src/components/emenu/emenu-qr-code.tsx +0 -59
- package/src/components/emenu/menu-link.tsx +0 -67
- package/src/components/index.ts +0 -8
- package/src/components/kanban-template/kitchen-template.tsx +0 -60
- package/src/components/kanban-template/pos-order-template.tsx +0 -77
- package/src/components/kanban-template/pos-template.tsx +0 -170
- package/src/components/kitchen-management/change-status-confirm-modal.tsx +0 -61
- package/src/components/kitchen-management/index.ts +0 -1
- package/src/components/kitchen-management/kitchen-order/index.tsx +0 -153
- package/src/components/kitchen-management/kitchen-order/line.tsx +0 -78
- package/src/components/kitchen-management/kitchen-order/state.tsx +0 -52
- package/src/components/kitchen-management/kitchen-status.tsx +0 -69
- package/src/components/kitchen-management/orders-kitchen-management.tsx +0 -113
- package/src/components/order-management/index.tsx +0 -128
- package/src/components/order-management/order-actions.tsx +0 -46
- package/src/components/order-management/order-detail/header.tsx +0 -37
- package/src/components/order-management/order-detail/index.ts +0 -3
- package/src/components/order-management/order-detail/information.tsx +0 -96
- package/src/components/order-management/order-detail/order-detail.tsx +0 -84
- package/src/components/order-management/order-detail/order-line.tsx +0 -56
- package/src/components/order-management/order-detail/summary.tsx +0 -221
- package/src/components/order-management/order-header.tsx +0 -113
- package/src/components/order-management/order-pagination.tsx +0 -49
- package/src/components/order-management/order-status.tsx +0 -58
- package/src/components/order-management/order-table.tsx +0 -179
- package/src/components/order-management/order-tabs.tsx +0 -48
- package/src/components/pos-management/add-product-from-barcode/index.tsx +0 -97
- package/src/components/pos-management/cart-content/action-line.tsx +0 -81
- package/src/components/pos-management/cart-content/cancel-order-line-modal.tsx +0 -41
- package/src/components/pos-management/cart-content/cart-item.tsx +0 -173
- package/src/components/pos-management/cart-content/cart-items.tsx +0 -130
- package/src/components/pos-management/cart-content/draft-orders/draft-order-line.tsx +0 -67
- package/src/components/pos-management/cart-content/draft-orders/index.tsx +0 -40
- package/src/components/pos-management/cart-content/edit-cart-modal.tsx +0 -11
- package/src/components/pos-management/cart-content/index.tsx +0 -260
- package/src/components/pos-management/cart-content/no-select-order.tsx +0 -26
- package/src/components/pos-management/cart-content/order-info/customer-info.tsx +0 -53
- package/src/components/pos-management/cart-content/order-info/index.tsx +0 -109
- package/src/components/pos-management/cart-content/order-total.tsx +0 -36
- package/src/components/pos-management/cart-content/orders-line.tsx +0 -72
- package/src/components/pos-management/menu-content/category-tab.tsx +0 -38
- package/src/components/pos-management/menu-content/create-order-modal.tsx +0 -65
- package/src/components/pos-management/menu-content/product-content.tsx +0 -93
- package/src/components/pos-management/menu-content/product-detail/info.tsx +0 -28
- package/src/components/pos-management/menu-content/product-detail/modal.tsx +0 -148
- package/src/components/pos-management/menu-content/product-detail/option.tsx +0 -87
- package/src/components/pos-management/menu-content/product-detail/quantity-control.tsx +0 -155
- package/src/components/pos-management/menu-content/product-detail/sale-keypad.tsx +0 -100
- package/src/components/pos-management/menu-content/product-item.tsx +0 -65
- package/src/components/pos-management/order-helper/cancel-order-confirm.tsx +0 -43
- package/src/components/pos-management/order-helper/history-call.tsx +0 -105
- package/src/components/pos-management/order-helper/order-helper-modal.tsx +0 -116
- package/src/components/pos-management/payment-content/bill/actions.tsx +0 -46
- package/src/components/pos-management/payment-content/bill/content.tsx +0 -207
- package/src/components/pos-management/payment-content/bill/index.tsx +0 -18
- package/src/components/pos-management/payment-content/card-payment/index.tsx +0 -124
- package/src/components/pos-management/payment-content/card-payment/pos-payment/pos-connect.tsx +0 -183
- package/src/components/pos-management/payment-content/card-payment/pos-payment/qr-connect.tsx +0 -185
- package/src/components/pos-management/payment-content/card-payment/waiting-for-payment-pos-modal.tsx +0 -37
- package/src/components/pos-management/payment-content/cash-payment/index.tsx +0 -216
- package/src/components/pos-management/payment-content/index.tsx +0 -70
- package/src/components/pos-management/payment-content/payment-info.tsx +0 -67
- package/src/components/pos-management/payment-content/payment-layout.tsx +0 -16
- package/src/components/pos-management/payment-content/payment-method-cards.tsx +0 -99
- package/src/components/pos-management/payment-content/qr-payment/index.tsx +0 -118
- package/src/components/pos-management/payment-content/qr-payment/qr_code.js +0 -29
- package/src/components/pos-management/payment-content/qr-payment/vietqr.js +0 -436
- package/src/components/pos-management/payment-content/session-close-modal.tsx +0 -35
- package/src/components/pos-management/payment-content/soft-pos-payment/index.tsx +0 -48
- package/src/components/pos-management/pos-helpers/back-confirm.tsx +0 -45
- package/src/components/pos-management/pos-helpers/index.tsx +0 -135
- package/src/components/pos-management/pos-helpers/layout-display-modal.tsx +0 -99
- package/src/components/pos-management/search.tsx +0 -48
- package/src/components/pos-management/table-content/filtered-tables.tsx +0 -59
- package/src/components/pos-management/table-content/floor-tabs.tsx +0 -65
- package/src/components/pos-management/table-content/index.tsx +0 -76
- package/src/components/pos-management/table-content/table-item.tsx +0 -127
- package/src/components/pos-management/table-content/tables.tsx +0 -96
- package/src/components/restaurant-management/add-floor-modal.tsx +0 -133
- package/src/components/restaurant-management/add-table-modal.tsx +0 -198
- package/src/components/restaurant-management/delete-floor-confirm-modal.tsx +0 -42
- package/src/components/restaurant-management/delete-table-confirm-modal.tsx +0 -51
- package/src/components/restaurant-management/header.tsx +0 -22
- package/src/components/restaurant-management/index.tsx +0 -54
- package/src/components/restaurant-management/left-side.tsx +0 -51
- package/src/components/restaurant-management/right-side.tsx +0 -179
- package/src/components/restaurant-management/table-empty.tsx +0 -43
- package/src/components/session-management/close-session-modal/actions.tsx +0 -45
- package/src/components/session-management/close-session-modal/close-session-confirm.tsx +0 -157
- package/src/components/session-management/close-session-modal/close-session-ticket.tsx +0 -218
- package/src/components/session-management/close-session-modal/container.tsx +0 -25
- package/src/components/session-management/close-session-modal/draft-orders-confirm.tsx +0 -53
- package/src/components/session-management/close-session-modal/draft-orders-summary.tsx +0 -82
- package/src/components/session-management/close-session-modal/draft-orders.tsx +0 -34
- package/src/components/session-management/close-session-modal/index.tsx +0 -35
- package/src/components/session-management/close-session-modal/order/index.ts +0 -1
- package/src/components/session-management/close-session-modal/order/order-line.tsx +0 -64
- package/src/components/session-management/close-session-modal/order/orders-in-draft.tsx +0 -31
- package/src/components/session-management/close-session-modal/session-summary.tsx +0 -165
- package/src/components/session-management/index.ts +0 -1
- package/src/components/session-management/open-shift/index.tsx +0 -172
- package/src/components/table-management/index.tsx +0 -0
- package/src/constants/api/index.ts +0 -1
- package/src/constants/headers.constant.tsx +0 -24
- package/src/constants/index.ts +0 -1
- package/src/constants/language.store.ts +0 -21
- package/src/constants/methods.constant.ts +0 -10
- package/src/constants/order-state.ts +0 -8
- package/src/constants/payment-color.constant.ts +0 -26
- package/src/constants/query.constant.ts +0 -14
- package/src/constants/routes.constants.ts +0 -23
- package/src/constants/template-name.constant.ts +0 -9
- package/src/hooks/bill/use-get-bill-information.ts +0 -49
- package/src/hooks/bill/use-print-bill.tsx +0 -0
- package/src/hooks/common/load-env-config.ts +0 -98
- package/src/hooks/common/use-back.ts +0 -13
- package/src/hooks/common/use-broadcast.ts +0 -22
- package/src/hooks/common/use-click-outside.ts +0 -58
- package/src/hooks/common/use-get-base64-photo.ts +0 -71
- package/src/hooks/common/use-get-query.ts +0 -25
- package/src/hooks/common/use-pos.ts +0 -21
- package/src/hooks/common/use-query-params.ts +0 -89
- package/src/hooks/common/use-speech.ts +0 -36
- package/src/hooks/customer/use-customer-provider.ts +0 -247
- package/src/hooks/floor/use-floor-provider.ts +0 -172
- package/src/hooks/kitchen/use-kitchen-provider.ts +0 -80
- package/src/hooks/order/use-get-point-reward.ts +0 -50
- package/src/hooks/order/use-loop-fetch-order.ts +0 -30
- package/src/hooks/order/use-order-items.ts +0 -61
- package/src/hooks/order/use-orders.ts +0 -76
- package/src/hooks/payment/use-payment-provider.ts +0 -221
- package/src/hooks/product/use-product-provider.ts +0 -87
- package/src/hooks/session/use-check-session.tsx +0 -19
- package/src/hooks/session/use-session-provider.ts +0 -79
- package/src/hooks/table/use-pos-table-provider.ts +0 -193
- package/src/index.css +0 -5
- package/src/index.ts +0 -10
- package/src/layouts/common.tsx +0 -15
- package/src/layouts/index.ts +0 -4
- package/src/layouts/pos-layout.tsx +0 -33
- package/src/layouts/pos-order-layout.tsx +0 -43
- package/src/layouts/sale-layout.tsx +0 -25
- package/src/locales/en.json +0 -394
- package/src/locales/vi.json +0 -400
- package/src/pages/index.ts +0 -4
- package/src/pages/login/index.tsx +0 -128
- package/src/pages/pincode/index.tsx +0 -198
- package/src/pages/pos/kitchen-management/layout.tsx +0 -18
- package/src/pages/pos/management-floor/index.tsx +0 -7
- package/src/pages/pos/management-order/index.tsx +0 -7
- package/src/pages/pos/management-order/order-detail/index.tsx +0 -7
- package/src/pages/pos/management-table/index.tsx +0 -0
- package/src/pages/pos/payment-success/index.tsx +0 -75
- package/src/provider/app-provider.tsx +0 -56
- package/src/provider/fallback/custom-error.tsx +0 -26
- package/src/provider/main-provider.tsx +0 -41
- package/src/provider/meta-provider.tsx +0 -72
- package/src/provider/modal-provider.tsx +0 -48
- package/src/provider/notification-provider.tsx +0 -64
- package/src/provider/pos-provider/close-session-provider/index.tsx +0 -207
- package/src/provider/pos-provider/customer-provider/index.tsx +0 -30
- package/src/provider/pos-provider/floor-provider/index.tsx +0 -39
- package/src/provider/pos-provider/index.ts +0 -6
- package/src/provider/pos-provider/kitchen-provider/index.tsx +0 -30
- package/src/provider/pos-provider/order-detail-provider/index.tsx +0 -233
- package/src/provider/pos-provider/order-provider/index.tsx +0 -803
- package/src/provider/pos-provider/payment-provider/index.tsx +0 -30
- package/src/provider/pos-provider/product-provider/index.tsx +0 -30
- package/src/provider/pos-provider/sale-provider/index.tsx +0 -168
- package/src/provider/pos-provider/session-provider/index.tsx +0 -30
- package/src/provider/pos-provider/socket-provider/index.tsx +0 -118
- package/src/provider/pos-provider/table-provider/index.tsx +0 -30
- package/src/provider/public-provider.tsx +0 -104
- package/src/provider/use-session-provider.ts +0 -79
- package/src/router/app-router.tsx +0 -38
- package/src/router/index.tsx +0 -26
- package/src/router/pos-route.tsx +0 -75
- package/src/router/protected-route.tsx +0 -16
- package/src/router/public-route.tsx +0 -11
- package/src/store/header/index.ts +0 -21
- package/src/store/session/index.ts +0 -25
- package/src/store/states/cart.state.ts +0 -135
- package/src/store/states/close-session.state.ts +0 -20
- package/src/store/states/customer.state.ts +0 -19
- package/src/store/states/payment.state.ts +0 -14
- package/src/styles/base.css +0 -212
- package/src/styles/common.css +0 -65
- package/src/styles/lib/tailwind.css +0 -0
- package/src/styles/lib/tailwind.theme.css +0 -34
- package/src/styles/loading.css +0 -72
- package/src/styles/main.css +0 -5
- package/src/styles/refreshing-content.css +0 -55
- package/src/styles/text.css +0 -44
- package/src/types/account.ts +0 -61
- package/src/types/branch.ts +0 -6
- package/src/types/category.ts +0 -13
- package/src/types/common.ts +0 -4
- package/src/types/customer.ts +0 -52
- package/src/types/dashboard.ts +0 -18
- package/src/types/edc.ts +0 -37
- package/src/types/export-e-invoice.ts +0 -17
- package/src/types/filter.d.ts +0 -12
- package/src/types/floor/floor.ts +0 -16
- package/src/types/floor.d.ts +0 -36
- package/src/types/index.ts +0 -127
- package/src/types/invoice.ts +0 -32
- package/src/types/modal.ts +0 -15
- package/src/types/notification.ts +0 -12
- package/src/types/order.ts +0 -182
- package/src/types/payment.ts +0 -44
- package/src/types/product/product.ts +0 -47
- package/src/types/product.ts +0 -137
- package/src/types/provider-info.d.ts +0 -14
- package/src/types/qr.d.ts +0 -25
- package/src/types/report.d.ts +0 -43
- package/src/types/sale.d.ts +0 -68
- package/src/types/search.d.ts +0 -7
- package/src/types/session.d.ts +0 -30
- package/src/types/shop-qr.d.ts +0 -89
- package/src/types/staff.d.ts +0 -35
- package/src/types/store.d.ts +0 -25
- package/src/types/table.d.ts +0 -57
- package/src/utils/close-session-ticket.tsx +0 -129
- package/src/utils/functions.ts +0 -299
- package/src/utils/i18n.ts +0 -25
- package/src/utils/pos/bill.ts +0 -156
- package/src/utils/pos/convert-order.ts +0 -58
- package/src/utils/pos/helpers.ts +0 -48
- package/src/utils/pos/session.ts +0 -44
- package/src/utils/storages/index.ts +0 -1
- package/src/utils/storages/local-storage.ts +0 -72
- package/tailwind.preset.ts +0 -25
- package/tsconfig.json +0 -30
- package/tsup.config.ts +0 -30
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface ILanguage {
|
|
2
|
-
value: string;
|
|
3
|
-
label: string;
|
|
4
|
-
subLabel: string;
|
|
5
|
-
id: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const languages: ILanguage[] = [
|
|
9
|
-
{
|
|
10
|
-
id: "vi_VN",
|
|
11
|
-
value: "vi",
|
|
12
|
-
label: "Tiếng Việt",
|
|
13
|
-
subLabel: "Tiếng Việt",
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: "en_US",
|
|
17
|
-
value: "en",
|
|
18
|
-
label: "English",
|
|
19
|
-
subLabel: "United Kingdom",
|
|
20
|
-
},
|
|
21
|
-
];
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const METHOD = {
|
|
2
|
-
ACTION_POS_ORDER_CANCEL: "action_pos_order_cancel",
|
|
3
|
-
UNLINK: "unlink",
|
|
4
|
-
GET_CLOSING_CONTROL_DATA: "get_closing_control_data",
|
|
5
|
-
POST_CLOSING_CASH_DETAILS: "post_closing_cash_details",
|
|
6
|
-
UPDATE_CLOSING_CONTROL_STATE_SESSION: "update_closing_control_state_session",
|
|
7
|
-
ACTION_POS_SESSION_CLOSING_CONTROL: "action_pos_session_closing_control",
|
|
8
|
-
ACTION_POS_SESSION_CLOSE: "action_pos_session_close",
|
|
9
|
-
NAME_SEARCH: "name_search",
|
|
10
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const PAYMENT_COLORS = [
|
|
2
|
-
{
|
|
3
|
-
type: "card",
|
|
4
|
-
activeBorder: "border-[#6BCE00]",
|
|
5
|
-
background: "bg-[#F1FFE2]",
|
|
6
|
-
iconBackground: "bg-[#6BCE00]",
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
type: "qr",
|
|
10
|
-
activeBorder: "border-[#FFD207]",
|
|
11
|
-
background: "bg-[#FFF5C7]",
|
|
12
|
-
iconBackground: "bg-[#FFD207]",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
type: "cash",
|
|
16
|
-
activeBorder: "border-[#004FD3]",
|
|
17
|
-
background: "bg-[#CEE1FF]",
|
|
18
|
-
iconBackground: "bg-[#004FD3]",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
type: "soft_pos",
|
|
22
|
-
activeBorder: "border-[#1FC163]",
|
|
23
|
-
background: "bg-[#E0FAEB]",
|
|
24
|
-
iconBackground: "bg-[#1FC163]",
|
|
25
|
-
},
|
|
26
|
-
];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const QUERY_KEYS = {
|
|
2
|
-
POS_ID: "pos_id",
|
|
3
|
-
FLOOR: "floor",
|
|
4
|
-
SESSION_ID: "session-id",
|
|
5
|
-
ORDER_ID: "order-id",
|
|
6
|
-
CATEGORY_ID: "category-id",
|
|
7
|
-
OPEN: "open",
|
|
8
|
-
CUSTOMER_INFO: "customer-info",
|
|
9
|
-
CUSTOMER_ID: "customer-id",
|
|
10
|
-
TABLE_ID: "table-id",
|
|
11
|
-
KITCHEN_ORDER_STATUS: "kitchen-order-status",
|
|
12
|
-
CLOSE_SESSION: "close-session",
|
|
13
|
-
SHOW_SCREEN: "show-screen",
|
|
14
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const ROUTES = {
|
|
2
|
-
home: "/",
|
|
3
|
-
login: "/login",
|
|
4
|
-
pinCode: "/pin-code",
|
|
5
|
-
independentForm: "/independent-form",
|
|
6
|
-
} as const;
|
|
7
|
-
|
|
8
|
-
enum POSPath {
|
|
9
|
-
POS = "/pos",
|
|
10
|
-
TABLES = "/pos/tables",
|
|
11
|
-
MENUS = "/pos/menus",
|
|
12
|
-
ORDERS = "/pos/orders",
|
|
13
|
-
PAYMENTS = "/pos/payments",
|
|
14
|
-
BILL = "/pos/bill",
|
|
15
|
-
SUCCESS = "/pos/success",
|
|
16
|
-
MANAGEMENT_FLOOR = "/pos/management-floor",
|
|
17
|
-
ORDER_DETAIL = "/pos/management-order/order-detail",
|
|
18
|
-
ORDERS_KITCHEN_MANAGEMENT = "/pos/kitchens/:kitchenId/orders",
|
|
19
|
-
CUSTOMER_VIEW = "/pos/customer-view",
|
|
20
|
-
SETTING = "setting/single-form",
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default POSPath;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const TEMPLATE_NAME = {
|
|
2
|
-
PARTNER_TEMPLATE: "partner_template",
|
|
3
|
-
PRODUCT_TEMPLATE: "product_template",
|
|
4
|
-
POS_TEMPLATE: "pos_template",
|
|
5
|
-
PREPARATION_TEMPLATE: "preparation_template",
|
|
6
|
-
POS_ORDER_TEMPLATE: "pos_order_template",
|
|
7
|
-
CUSTOMER_PROFILE_TEMPLATE: "customer_profile_template",
|
|
8
|
-
CATEGORY_PRODUCT_TEMPLATE: "category_product_template",
|
|
9
|
-
} as const;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useGetBase64Photo } from "@hooks/common/use-get-base64-photo";
|
|
2
|
-
import { usePosAppProvider } from "@provider/app-provider";
|
|
3
|
-
import { useOrderDetail } from "@provider/pos-provider/order-detail-provider";
|
|
4
|
-
import { useMemo } from "react";
|
|
5
|
-
|
|
6
|
-
const useGetBillInformation = () => {
|
|
7
|
-
const { items } = useOrderDetail();
|
|
8
|
-
const { taxAmount, totalAmount } = useOrderDetail();
|
|
9
|
-
const { company, userProfile } = usePosAppProvider();
|
|
10
|
-
|
|
11
|
-
const { data: brandLogo } = useGetBase64Photo(
|
|
12
|
-
company?.companyInfo.data[0]?.logo
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
// const data: any = convertOrderDetail(orderDetailById);
|
|
16
|
-
|
|
17
|
-
const address = useMemo(() => {
|
|
18
|
-
return userProfile?.company?.address;
|
|
19
|
-
}, [userProfile?.company]);
|
|
20
|
-
|
|
21
|
-
const addressFormat = useMemo(() => {
|
|
22
|
-
return `${address?.street} ${address?.street2}, ${
|
|
23
|
-
address?.ward ?? ""
|
|
24
|
-
}, Tỉnh ${address?.state} `;
|
|
25
|
-
}, [userProfile?.company]);
|
|
26
|
-
|
|
27
|
-
// const paymentMethod = useMemo(() => {
|
|
28
|
-
// return (
|
|
29
|
-
// orderDetailData?.payment_ids?.[0]?.payment_method_id?.display_name ||
|
|
30
|
-
// "Chưa xác định"
|
|
31
|
-
// );
|
|
32
|
-
// }, [orderDetailData]);
|
|
33
|
-
|
|
34
|
-
const amountTotalWithoutTax = useMemo(() => {
|
|
35
|
-
return totalAmount - taxAmount;
|
|
36
|
-
}, [totalAmount, taxAmount]);
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
items,
|
|
40
|
-
company,
|
|
41
|
-
userProfile,
|
|
42
|
-
addressFormat,
|
|
43
|
-
brandLogo,
|
|
44
|
-
paymentMethod: "Tiền mặt",
|
|
45
|
-
amountTotalWithoutTax,
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default useGetBillInformation;
|
|
File without changes
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { useEnv } from "@fctc/widget-logic/provider";
|
|
2
|
-
|
|
3
|
-
export const loadEnvConfig = () => {
|
|
4
|
-
const { setupEnv, env, setEnvFile } = useEnv();
|
|
5
|
-
async function loadEnvAndConfig() {
|
|
6
|
-
try {
|
|
7
|
-
const envResponse = await fetch("/env.json");
|
|
8
|
-
const envConfig = await envResponse.json();
|
|
9
|
-
const configResponse = await fetch("/config.json");
|
|
10
|
-
const config = await configResponse.json();
|
|
11
|
-
setupEnv({
|
|
12
|
-
baseUrl: envConfig.baseUrl,
|
|
13
|
-
default_service: "mms",
|
|
14
|
-
config: {
|
|
15
|
-
grantType: envConfig.config?.grantType,
|
|
16
|
-
clientId: window.location.hostname.includes("mms")
|
|
17
|
-
? envConfig.config?.mmsClientId
|
|
18
|
-
: envConfig.config?.mpClientId,
|
|
19
|
-
clientSecret: envConfig.config?.clientSecret,
|
|
20
|
-
redirectUri: window.location.hostname.includes("mms")
|
|
21
|
-
? envConfig.config?.mmsRedirectUrl
|
|
22
|
-
: envConfig.config?.mpRedirectUrl,
|
|
23
|
-
websiteCode: window.location.hostname.includes("mms")
|
|
24
|
-
? envConfig.config?.websiteMmscode
|
|
25
|
-
: envConfig.config?.websiteMpcode,
|
|
26
|
-
},
|
|
27
|
-
refreshTokenEndpoint: "/id/api/v2/token",
|
|
28
|
-
// xNode: service === "wesap" ? dataUser?.x_node : "",
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
setEnvFile(config);
|
|
32
|
-
|
|
33
|
-
document.documentElement.style.setProperty(
|
|
34
|
-
"--background-button",
|
|
35
|
-
config?.VITE_BG_BUTTON
|
|
36
|
-
);
|
|
37
|
-
document.documentElement.style.setProperty(
|
|
38
|
-
"--primary",
|
|
39
|
-
config?.VITE_BG_BUTTON
|
|
40
|
-
);
|
|
41
|
-
document.documentElement.style.setProperty(
|
|
42
|
-
"--background-page",
|
|
43
|
-
config?.VITE_BACKGROUND_PAGE
|
|
44
|
-
);
|
|
45
|
-
document.documentElement.style.setProperty(
|
|
46
|
-
"--text-color",
|
|
47
|
-
config?.TEXT_COLOR
|
|
48
|
-
);
|
|
49
|
-
document.documentElement.style.setProperty(
|
|
50
|
-
"--stroke-default",
|
|
51
|
-
config?.STROKE_DEFAULT
|
|
52
|
-
);
|
|
53
|
-
document.documentElement.style.setProperty(
|
|
54
|
-
"--selected-color",
|
|
55
|
-
config?.SELECTED_COLOR
|
|
56
|
-
);
|
|
57
|
-
document.documentElement.style.setProperty(
|
|
58
|
-
"--active-menu-bg-color",
|
|
59
|
-
config?.SIDEBAR_ACTIVE_MENU_BACKGROUND
|
|
60
|
-
);
|
|
61
|
-
document.documentElement.style.setProperty(
|
|
62
|
-
"--active-menu-text-color",
|
|
63
|
-
config?.SIDEBAR_ACTIVE_MENU_TEXT
|
|
64
|
-
);
|
|
65
|
-
document.documentElement.style.setProperty(
|
|
66
|
-
"--active-border-color",
|
|
67
|
-
config?.BORDER_ACTIVE_COLOR
|
|
68
|
-
);
|
|
69
|
-
document.documentElement.style.setProperty(
|
|
70
|
-
"--text-button",
|
|
71
|
-
config?.TEXT_BUTTON
|
|
72
|
-
);
|
|
73
|
-
document.documentElement.style.setProperty(
|
|
74
|
-
"--text-active-primary",
|
|
75
|
-
config?.ACTIVE_PRIMARY_COLOR
|
|
76
|
-
);
|
|
77
|
-
document.documentElement.style.setProperty(
|
|
78
|
-
"--text-active-secondary",
|
|
79
|
-
config?.ACTIVE_SECONDARY_COLOR
|
|
80
|
-
);
|
|
81
|
-
document.documentElement.style.setProperty(
|
|
82
|
-
"--text-take-away-color",
|
|
83
|
-
config?.TAKE_AWAY_COLOR
|
|
84
|
-
);
|
|
85
|
-
document.documentElement.style.setProperty(
|
|
86
|
-
"--text-unavailable-table-color",
|
|
87
|
-
config?.UNAVAILABLE_TABLE_COLOR
|
|
88
|
-
);
|
|
89
|
-
document.documentElement.style.setProperty(
|
|
90
|
-
"--text-surface-primary",
|
|
91
|
-
config?.SURFACE_PRIMARY_COLOR
|
|
92
|
-
);
|
|
93
|
-
} catch (error) {
|
|
94
|
-
console.error("Error loading env or config:", error);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return { loadEnvAndConfig };
|
|
98
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { startTransition } from "react";
|
|
2
|
-
import { useNavigate } from "react-router-dom";
|
|
3
|
-
|
|
4
|
-
const useBack = () => {
|
|
5
|
-
const navigate = useNavigate();
|
|
6
|
-
return () => {
|
|
7
|
-
startTransition(() => {
|
|
8
|
-
navigate(-1);
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default useBack;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
|
|
3
|
-
export function useBroadcast<T>(
|
|
4
|
-
channelName: string,
|
|
5
|
-
onMessage: (msg: T) => void
|
|
6
|
-
) {
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
const bc = new BroadcastChannel(channelName);
|
|
9
|
-
bc.onmessage = (event) => {
|
|
10
|
-
onMessage(event.data);
|
|
11
|
-
};
|
|
12
|
-
return () => bc.close();
|
|
13
|
-
}, [channelName, onMessage]);
|
|
14
|
-
|
|
15
|
-
const postMessage = (msg: T) => {
|
|
16
|
-
const bc = new BroadcastChannel(channelName);
|
|
17
|
-
bc.postMessage(msg);
|
|
18
|
-
bc.close();
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return { postMessage };
|
|
22
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, type RefObject } from "react";
|
|
2
|
-
|
|
3
|
-
const DEFAULT_EVENTS = ["mousedown", "touchstart"] as const;
|
|
4
|
-
|
|
5
|
-
type EventType = (typeof DEFAULT_EVENTS)[number];
|
|
6
|
-
|
|
7
|
-
interface UseClickOutsideOptions {
|
|
8
|
-
handler: (event?: Event) => void;
|
|
9
|
-
events?: readonly EventType[];
|
|
10
|
-
nodes?: (HTMLDivElement | null)[]; // Ensure consistency with HTMLDivElement
|
|
11
|
-
refs?: any;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const useClickOutside = ({
|
|
15
|
-
handler,
|
|
16
|
-
events = DEFAULT_EVENTS,
|
|
17
|
-
nodes = [], // Default to empty array to avoid undefined errors
|
|
18
|
-
refs,
|
|
19
|
-
}: UseClickOutsideOptions): RefObject<HTMLDivElement | null> => {
|
|
20
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
const listener = (event: Event) => {
|
|
24
|
-
const { target } = event as MouseEvent | TouchEvent;
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
refs &&
|
|
28
|
-
refs?.length > 0 &&
|
|
29
|
-
refs?.some((r: any) => r.current?.contains(target as Node))
|
|
30
|
-
) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (!(target instanceof HTMLElement)) return;
|
|
35
|
-
|
|
36
|
-
const shouldIgnore =
|
|
37
|
-
target.hasAttribute("data-ignore-outside-clicks") ||
|
|
38
|
-
(!document.body.contains(target) && target.tagName !== "HTML");
|
|
39
|
-
|
|
40
|
-
const shouldTrigger =
|
|
41
|
-
nodes.length > 0
|
|
42
|
-
? nodes.every((node) => node && !event.composedPath().includes(node))
|
|
43
|
-
: ref.current && !ref.current.contains(target);
|
|
44
|
-
|
|
45
|
-
if (shouldTrigger && !shouldIgnore) {
|
|
46
|
-
handler(event);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
events.forEach((event) => document.addEventListener(event, listener));
|
|
51
|
-
|
|
52
|
-
return () => {
|
|
53
|
-
events.forEach((event) => document.removeEventListener(event, listener));
|
|
54
|
-
};
|
|
55
|
-
}, [handler, nodes, events]);
|
|
56
|
-
|
|
57
|
-
return ref;
|
|
58
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
|
|
3
|
-
export const useGetBase64Photo = (src?: string) => {
|
|
4
|
-
const queryResult = useQuery({
|
|
5
|
-
queryKey: ["photo-base64", src],
|
|
6
|
-
queryFn: () => urlToBase64(src ?? ""),
|
|
7
|
-
enabled: !!src,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
isLoading: queryResult.isLoading,
|
|
12
|
-
data: src ? queryResult.data : undefined,
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
async function urlToBase64(url: string): Promise<string> {
|
|
17
|
-
try {
|
|
18
|
-
// 1️⃣ Fetch ảnh (binary)
|
|
19
|
-
const response = await fetch(url, { mode: "cors" });
|
|
20
|
-
if (!response.ok) throw new Error(`Fetch failed: ${response.statusText}`);
|
|
21
|
-
|
|
22
|
-
const contentType = response.headers.get("content-type") || "";
|
|
23
|
-
|
|
24
|
-
// 2️⃣ Nếu là SVG
|
|
25
|
-
if (contentType.includes("image/svg")) {
|
|
26
|
-
const svgText = await response.text();
|
|
27
|
-
const svgBlob = new Blob([svgText], { type: "image/svg+xml" });
|
|
28
|
-
const svgUrl = URL.createObjectURL(svgBlob);
|
|
29
|
-
const pngBase64 = await convertSvgToPngBase64(svgUrl);
|
|
30
|
-
URL.revokeObjectURL(svgUrl);
|
|
31
|
-
return pngBase64;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// 3️⃣ Nếu là ảnh thường (png/jpg/webp)
|
|
35
|
-
const blob = await response.blob();
|
|
36
|
-
const imgUrl = URL.createObjectURL(blob);
|
|
37
|
-
const pngBase64 = await convertSvgToPngBase64(imgUrl);
|
|
38
|
-
URL.revokeObjectURL(imgUrl);
|
|
39
|
-
return pngBase64;
|
|
40
|
-
} catch (err) {
|
|
41
|
-
console.error("urlToBase64 error:", err);
|
|
42
|
-
throw err;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Ảnh SVG hoặc PNG → PNG base64
|
|
47
|
-
function convertSvgToPngBase64(imageUrl: string): Promise<string> {
|
|
48
|
-
return new Promise((resolve, reject) => {
|
|
49
|
-
const img = new Image();
|
|
50
|
-
img.crossOrigin = "anonymous";
|
|
51
|
-
img.onload = () => {
|
|
52
|
-
const canvas = document.createElement("canvas");
|
|
53
|
-
const width = img.naturalWidth || img.width || 512;
|
|
54
|
-
const height = img.naturalHeight || img.height || 512;
|
|
55
|
-
canvas.width = width;
|
|
56
|
-
canvas.height = height;
|
|
57
|
-
|
|
58
|
-
const ctx = canvas.getContext("2d");
|
|
59
|
-
ctx?.drawImage(img, 0, 0, width, height);
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
const base64 = canvas.toDataURL("image/png");
|
|
63
|
-
resolve(base64);
|
|
64
|
-
} catch (err) {
|
|
65
|
-
reject(err);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
img.onerror = reject;
|
|
69
|
-
img.src = imageUrl;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { QUERY_KEYS } from "@constants/query.constant"
|
|
2
|
-
import { useMemo } from "react"
|
|
3
|
-
import { useQueryParams } from "./use-query-params"
|
|
4
|
-
|
|
5
|
-
const useGetQuery = () => {
|
|
6
|
-
const { getQuery } = useQueryParams()
|
|
7
|
-
|
|
8
|
-
return useMemo(() => {
|
|
9
|
-
const orderId = getQuery(QUERY_KEYS.ORDER_ID)
|
|
10
|
-
const sessionId = getQuery(QUERY_KEYS.SESSION_ID)
|
|
11
|
-
const posId = Number(getQuery(QUERY_KEYS.POS_ID)) || 5
|
|
12
|
-
const kitchenOrderStatus = Number(getQuery(QUERY_KEYS.KITCHEN_ORDER_STATUS))
|
|
13
|
-
const floorId = Number(getQuery(QUERY_KEYS.FLOOR))
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
orderId,
|
|
17
|
-
sessionId,
|
|
18
|
-
posId,
|
|
19
|
-
kitchenOrderStatus,
|
|
20
|
-
floorId,
|
|
21
|
-
}
|
|
22
|
-
}, [getQuery])
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default useGetQuery
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { sessionStorageUtils } from "@fctc/widget-logic/utils";
|
|
2
|
-
import { usePosAppProvider } from "@provider/app-provider";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
|
|
5
|
-
const usePos = () => {
|
|
6
|
-
const { user } = usePosAppProvider();
|
|
7
|
-
|
|
8
|
-
return useMemo(() => {
|
|
9
|
-
const dataUser = user?.userProfile?.data;
|
|
10
|
-
const service = sessionStorageUtils.getMenuFocus().service || `wesap`;
|
|
11
|
-
const xNode = dataUser?.x_node || "";
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
dataUser,
|
|
15
|
-
service,
|
|
16
|
-
xNode,
|
|
17
|
-
};
|
|
18
|
-
}, [user]);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default usePos;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { useSearchParams } from "react-router-dom";
|
|
2
|
-
|
|
3
|
-
export const useQueryParams = () => {
|
|
4
|
-
const [searchParams, setSearchParams] = useSearchParams();
|
|
5
|
-
|
|
6
|
-
const getQuery = (key: string) => {
|
|
7
|
-
return searchParams.get(key);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const updateQuery = (key: string, value: string) => {
|
|
11
|
-
setSearchParams(
|
|
12
|
-
(prev) => {
|
|
13
|
-
const params = new URLSearchParams(prev);
|
|
14
|
-
params.set(key, value);
|
|
15
|
-
return params;
|
|
16
|
-
},
|
|
17
|
-
{ replace: true }
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const updateMultipleQuery = (query: QueryObject[]) => {
|
|
22
|
-
setSearchParams(
|
|
23
|
-
(prev) => {
|
|
24
|
-
const params = new URLSearchParams(prev);
|
|
25
|
-
query.forEach((q) => {
|
|
26
|
-
if (q.value) params.set(q.key, q.value);
|
|
27
|
-
else params.delete(q.key);
|
|
28
|
-
});
|
|
29
|
-
return params;
|
|
30
|
-
},
|
|
31
|
-
{ replace: true }
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
function removeParam(keys: string[]) {
|
|
36
|
-
setSearchParams(
|
|
37
|
-
(prev) => {
|
|
38
|
-
const params = new URLSearchParams(prev.toString());
|
|
39
|
-
|
|
40
|
-
keys.forEach((key) => {
|
|
41
|
-
params.delete(key);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return params;
|
|
45
|
-
},
|
|
46
|
-
{ replace: true }
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function removeParams(keys: string[]) {
|
|
51
|
-
setSearchParams(
|
|
52
|
-
(prev) => {
|
|
53
|
-
const params = new URLSearchParams(prev);
|
|
54
|
-
keys.forEach((key) => {
|
|
55
|
-
params.delete(key);
|
|
56
|
-
});
|
|
57
|
-
return params;
|
|
58
|
-
},
|
|
59
|
-
{ replace: true }
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function formatQuery(allowedKeys: string[]) {
|
|
64
|
-
const params = new URLSearchParams(searchParams.toString());
|
|
65
|
-
const filtered = new URLSearchParams();
|
|
66
|
-
|
|
67
|
-
for (const key of allowedKeys) {
|
|
68
|
-
const value = params.get(key);
|
|
69
|
-
if (value !== null) {
|
|
70
|
-
filtered.set(key, value);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return filtered.toString();
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
getQuery,
|
|
78
|
-
formatQuery,
|
|
79
|
-
updateQuery,
|
|
80
|
-
removeParam,
|
|
81
|
-
updateMultipleQuery,
|
|
82
|
-
removeParams,
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
interface QueryObject {
|
|
87
|
-
key: string;
|
|
88
|
-
value?: string;
|
|
89
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export const useSpeech = () => {
|
|
2
|
-
const speak = async (text: string, lang: string = "vi-VN") => {
|
|
3
|
-
try {
|
|
4
|
-
const envResponse = await fetch("/env.json");
|
|
5
|
-
const envConfig = await envResponse.json();
|
|
6
|
-
const res = await fetch(
|
|
7
|
-
`https://texttospeech.googleapis.com/v1/text:synthesize?key=${envConfig.config.googleKey}`,
|
|
8
|
-
{
|
|
9
|
-
method: "POST",
|
|
10
|
-
headers: { "Content-Type": "application/json" },
|
|
11
|
-
body: JSON.stringify({
|
|
12
|
-
input: { text },
|
|
13
|
-
voice: { languageCode: lang, name: "vi-VN-Wavenet-A" },
|
|
14
|
-
audioConfig: { audioEncoding: "MP3" },
|
|
15
|
-
}),
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const data = await res.json();
|
|
20
|
-
const audioContent = data.audioContent;
|
|
21
|
-
const audio = new Audio("data:audio/mp3;base64," + audioContent);
|
|
22
|
-
await audio.play();
|
|
23
|
-
} catch (err) {
|
|
24
|
-
console.error("❌ Google TTS lỗi:", err);
|
|
25
|
-
// await TextToSpeech.speak({ text, lang });
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// const stop = async () => {
|
|
30
|
-
// await TextToSpeech.stop();
|
|
31
|
-
// };
|
|
32
|
-
return {
|
|
33
|
-
speak,
|
|
34
|
-
stop,
|
|
35
|
-
};
|
|
36
|
-
};
|