@jingx/lottery-components-react-jsx 1.0.31 → 1.0.33
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.cjs.js +74 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +74 -33
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -59021,9 +59021,9 @@ var axios_1 = axios;
|
|
|
59021
59021
|
|
|
59022
59022
|
var axios$1 = /*@__PURE__*/getDefaultExportFromCjs(axios_1);
|
|
59023
59023
|
|
|
59024
|
-
const ProtestApi = "api/v1.0.0/order/protest";
|
|
59024
|
+
const ProtestApi = (isSystem) => isSystem ? "api/v1.0.0/protest-ticket" : "api/v1.0.0/order/protest";
|
|
59025
59025
|
const RemoveReasonApi = "api/v1.0.0/order/remove-reason";
|
|
59026
|
-
const DeleteApi = "api/v1.0.0/order/remove";
|
|
59026
|
+
const DeleteApi = (isSystem) => isSystem ? "api/v1.0.0/cancel-ticket" : "api/v1.0.0/order/remove";
|
|
59027
59027
|
const RemarkApi = "api/v1.0.0/order/remark";
|
|
59028
59028
|
const PaidApi = "api/v1.0.0/order/paid";
|
|
59029
59029
|
const PayoutApi = "api/v1.0.0/order/payout";
|
|
@@ -59068,7 +59068,8 @@ function DeleteModal(_a) {
|
|
|
59068
59068
|
Env = {},
|
|
59069
59069
|
isSubmitting: externalSubmitting = false,
|
|
59070
59070
|
accessToken,
|
|
59071
|
-
isRemoveReason
|
|
59071
|
+
isRemoveReason,
|
|
59072
|
+
isSystem = false
|
|
59072
59073
|
} = _b; __objRest$2(_b, [
|
|
59073
59074
|
"ticket",
|
|
59074
59075
|
"isOpen",
|
|
@@ -59079,7 +59080,8 @@ function DeleteModal(_a) {
|
|
|
59079
59080
|
"Env",
|
|
59080
59081
|
"isSubmitting",
|
|
59081
59082
|
"accessToken",
|
|
59082
|
-
"isRemoveReason"
|
|
59083
|
+
"isRemoveReason",
|
|
59084
|
+
"isSystem"
|
|
59083
59085
|
]);
|
|
59084
59086
|
const [options, setOptions] = React.useState([]);
|
|
59085
59087
|
const [selectedReason, setSelectedReason] = React.useState(null);
|
|
@@ -59092,7 +59094,7 @@ function DeleteModal(_a) {
|
|
|
59092
59094
|
"X-DeviceType": "WEB"
|
|
59093
59095
|
}, token ? { Authorization: `Bearer ${token}` } : {});
|
|
59094
59096
|
React.useEffect(() => {
|
|
59095
|
-
if (!ticket) return void 0;
|
|
59097
|
+
if (!ticket || isSystem) return void 0;
|
|
59096
59098
|
setSelectedReason(null);
|
|
59097
59099
|
const fetchReasons = async () => {
|
|
59098
59100
|
var _a2, _b2, _c;
|
|
@@ -59121,7 +59123,7 @@ function DeleteModal(_a) {
|
|
|
59121
59123
|
}
|
|
59122
59124
|
};
|
|
59123
59125
|
fetchReasons();
|
|
59124
|
-
}, [Env.REACT_APP_API_BASE_URL, Env.REACT_APP_BASIC_TOKEN, ticket]);
|
|
59126
|
+
}, [Env.REACT_APP_API_BASE_URL, Env.REACT_APP_BASIC_TOKEN, isSystem, ticket]);
|
|
59125
59127
|
const handleReasonChange = (option) => {
|
|
59126
59128
|
setSelectedReason(option);
|
|
59127
59129
|
if (typeof onChange === "function") {
|
|
@@ -59144,13 +59146,16 @@ function DeleteModal(_a) {
|
|
|
59144
59146
|
ticketNumber: ticket == null ? void 0 : ticket.ticketNumber,
|
|
59145
59147
|
message: (_a2 = selectedReason == null ? void 0 : selectedReason.value) != null ? _a2 : ""
|
|
59146
59148
|
};
|
|
59147
|
-
const
|
|
59148
|
-
|
|
59149
|
-
|
|
59150
|
-
|
|
59151
|
-
|
|
59152
|
-
|
|
59153
|
-
)
|
|
59149
|
+
const payloadSystem = {
|
|
59150
|
+
lotteryType: ticket == null ? void 0 : ticket.lotteryType,
|
|
59151
|
+
id: ticket == null ? void 0 : ticket.ticketNumber,
|
|
59152
|
+
drawCode: ticket == null ? void 0 : ticket.drawCode
|
|
59153
|
+
};
|
|
59154
|
+
const url = `${Env.REACT_APP_API_BASE_URL || DEFAULT_API_BASE_URL$3}${DeleteApi(isSystem)}`;
|
|
59155
|
+
const res = isSystem ? await axios$1.post(url, payloadSystem, { headers }) : await axios$1.delete(url, {
|
|
59156
|
+
headers,
|
|
59157
|
+
data: payload
|
|
59158
|
+
});
|
|
59154
59159
|
if (typeof onSuccess === "function") {
|
|
59155
59160
|
onSuccess(res.data, payload);
|
|
59156
59161
|
}
|
|
@@ -59173,7 +59178,6 @@ function DeleteModal(_a) {
|
|
|
59173
59178
|
}
|
|
59174
59179
|
};
|
|
59175
59180
|
if (!ticket) return null;
|
|
59176
|
-
console.log(ticket, "ticket");
|
|
59177
59181
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ScopeHost, { children: (container) => {
|
|
59178
59182
|
var _a2, _b2;
|
|
59179
59183
|
return container && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -59365,11 +59369,13 @@ const ProtestModal = ({
|
|
|
59365
59369
|
Env = {},
|
|
59366
59370
|
accessToken,
|
|
59367
59371
|
onChange,
|
|
59372
|
+
isSystem,
|
|
59368
59373
|
isSubmitting: externalSubmitting = false
|
|
59369
59374
|
}) => {
|
|
59370
59375
|
const [selectedTransferIds, setSelectedTransferIds] = React.useState([]);
|
|
59371
59376
|
const [options, setOptions] = React.useState([]);
|
|
59372
59377
|
const [selectedReason, setSelectedReason] = React.useState(null);
|
|
59378
|
+
const [systemReason, setSystemReason] = React.useState("");
|
|
59373
59379
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
59374
59380
|
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
59375
59381
|
const activeLotteryType = lotteryType || (ticket == null ? void 0 : ticket.lotteryType);
|
|
@@ -59380,9 +59386,10 @@ const ProtestModal = ({
|
|
|
59380
59386
|
"X-DeviceType": "WEB"
|
|
59381
59387
|
}, token ? { Authorization: `Bearer ${token}` } : {});
|
|
59382
59388
|
React.useEffect(() => {
|
|
59383
|
-
if (!ticket) return void 0;
|
|
59384
59389
|
setSelectedTransferIds([]);
|
|
59385
59390
|
setSelectedReason(null);
|
|
59391
|
+
setSystemReason("");
|
|
59392
|
+
if (!ticket || isSystem) return void 0;
|
|
59386
59393
|
const fetchReasons = async () => {
|
|
59387
59394
|
var _a, _b, _c;
|
|
59388
59395
|
try {
|
|
@@ -59411,7 +59418,7 @@ const ProtestModal = ({
|
|
|
59411
59418
|
}
|
|
59412
59419
|
};
|
|
59413
59420
|
fetchReasons();
|
|
59414
|
-
}, [Env.REACT_APP_API_BASE_URL, ticket]);
|
|
59421
|
+
}, [Env.REACT_APP_API_BASE_URL, isSystem, ticket]);
|
|
59415
59422
|
const handleSelectedIdsChange = React.useCallback((ids) => {
|
|
59416
59423
|
setSelectedTransferIds(ids);
|
|
59417
59424
|
}, []);
|
|
@@ -59421,9 +59428,24 @@ const ProtestModal = ({
|
|
|
59421
59428
|
onChange(option);
|
|
59422
59429
|
}
|
|
59423
59430
|
};
|
|
59431
|
+
const handleSystemReasonChange = (event) => {
|
|
59432
|
+
const value = event.target.value;
|
|
59433
|
+
setSystemReason(value);
|
|
59434
|
+
if (typeof onChange === "function") {
|
|
59435
|
+
onChange(value);
|
|
59436
|
+
}
|
|
59437
|
+
};
|
|
59424
59438
|
const handleSubmit = React.useCallback(async () => {
|
|
59425
|
-
var _a, _b, _c;
|
|
59426
|
-
if (!
|
|
59439
|
+
var _a, _b, _c, _d;
|
|
59440
|
+
if (isSystem && !systemReason.trim()) {
|
|
59441
|
+
const message = "\u179F\u17BC\u1798\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17BC\u179B\u17A0\u17C1\u178F\u17BB\u178F\u179C\u17C9\u17B6";
|
|
59442
|
+
PNotify_1.alert({
|
|
59443
|
+
text: message,
|
|
59444
|
+
type: "error"
|
|
59445
|
+
});
|
|
59446
|
+
return;
|
|
59447
|
+
}
|
|
59448
|
+
if (!isSystem && !selectedReason) {
|
|
59427
59449
|
const message = "\u179F\u17BC\u1798\u1787\u17D2\u179A\u17BE\u179F\u179A\u17BE\u179F\u1798\u17BC\u179B\u17A0\u17C1\u178F\u17BB\u178F\u179C\u17C9\u17B6";
|
|
59428
59450
|
PNotify_1.alert({
|
|
59429
59451
|
text: message,
|
|
@@ -59445,23 +59467,29 @@ const ProtestModal = ({
|
|
|
59445
59467
|
lotteryType: activeLotteryType,
|
|
59446
59468
|
ticketNumber: ticket == null ? void 0 : ticket.ticketNumber,
|
|
59447
59469
|
orderItemsIds: selectedTransferIds,
|
|
59448
|
-
message: selectedReason.value
|
|
59470
|
+
message: (_a = selectedReason == null ? void 0 : selectedReason.value) != null ? _a : ""
|
|
59449
59471
|
};
|
|
59472
|
+
const payloadSystem = {
|
|
59473
|
+
lotteryType: activeLotteryType,
|
|
59474
|
+
orderItemsIds: selectedTransferIds,
|
|
59475
|
+
reason: systemReason.trim()
|
|
59476
|
+
};
|
|
59477
|
+
const requestPayload = isSystem ? payloadSystem : payload;
|
|
59450
59478
|
const res = await axios$1.post(
|
|
59451
|
-
`${Env.REACT_APP_API_BASE_URL || DEFAULT_API_BASE_URL$2}${ProtestApi}`,
|
|
59452
|
-
|
|
59479
|
+
`${Env.REACT_APP_API_BASE_URL || DEFAULT_API_BASE_URL$2}${ProtestApi(isSystem)}`,
|
|
59480
|
+
requestPayload,
|
|
59453
59481
|
{ headers }
|
|
59454
59482
|
);
|
|
59455
59483
|
if (typeof onSuccessProtest === "function") {
|
|
59456
|
-
onSuccessProtest(res.data,
|
|
59484
|
+
onSuccessProtest(res.data, requestPayload);
|
|
59457
59485
|
}
|
|
59458
59486
|
PNotify_1.alert({
|
|
59459
|
-
text: ((
|
|
59487
|
+
text: ((_b = res.data) == null ? void 0 : _b.message) || "\u1780\u17B6\u179A\u178F\u179C\u17C9\u17B6\u1787\u17C4\u1782\u1787\u17D0\u1799 !",
|
|
59460
59488
|
type: "success"
|
|
59461
59489
|
});
|
|
59462
59490
|
onClose == null ? void 0 : onClose();
|
|
59463
59491
|
} catch (err) {
|
|
59464
|
-
const message = ((
|
|
59492
|
+
const message = ((_d = (_c = err.response) == null ? void 0 : _c.data) == null ? void 0 : _d.message) || err.message || "\u1780\u17B6\u179A\u178F\u179C\u17C9\u17B6\u1794\u179A\u17B6\u1787\u17D0\u1799 !";
|
|
59465
59493
|
PNotify_1.alert({
|
|
59466
59494
|
text: message,
|
|
59467
59495
|
type: "error"
|
|
@@ -59472,7 +59500,7 @@ const ProtestModal = ({
|
|
|
59472
59500
|
} finally {
|
|
59473
59501
|
setIsSubmitting(false);
|
|
59474
59502
|
}
|
|
59475
|
-
}, [Env.REACT_APP_API_BASE_URL, activeLotteryType,
|
|
59503
|
+
}, [Env.REACT_APP_API_BASE_URL, activeLotteryType, headers, isSystem, onClose, onError, onSuccessProtest, selectedReason, selectedTransferIds, systemReason, ticket]);
|
|
59476
59504
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ScopeHost, { children: (container) => container && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
59477
59505
|
Modal,
|
|
59478
59506
|
{
|
|
@@ -59487,7 +59515,17 @@ const ProtestModal = ({
|
|
|
59487
59515
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(ModalBody, { children: [
|
|
59488
59516
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-3", children: [
|
|
59489
59517
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "f-bold custom-label", children: "Protest Reason" }),
|
|
59490
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
59518
|
+
isSystem ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
59519
|
+
"textarea",
|
|
59520
|
+
{
|
|
59521
|
+
className: "form-control",
|
|
59522
|
+
rows: "2",
|
|
59523
|
+
value: systemReason,
|
|
59524
|
+
disabled: isSubmitting || externalSubmitting,
|
|
59525
|
+
onChange: handleSystemReasonChange,
|
|
59526
|
+
placeholder: "\u1798\u17BC\u179B\u17A0\u17C1\u178F\u17BB \u178F\u179C\u17C9\u17B6..."
|
|
59527
|
+
}
|
|
59528
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
59491
59529
|
StateManagedSelect$1,
|
|
59492
59530
|
{
|
|
59493
59531
|
options,
|
|
@@ -59685,7 +59723,7 @@ function RemarkModal(_a) {
|
|
|
59685
59723
|
ticketNumber: object == null ? void 0 : object.ticketNumber,
|
|
59686
59724
|
message: remark
|
|
59687
59725
|
};
|
|
59688
|
-
const res = await axios$1.
|
|
59726
|
+
const res = await axios$1.post(
|
|
59689
59727
|
`${Env.REACT_APP_API_BASE_URL || DEFAULT_API_BASE_URL$1}${RemarkApi}`,
|
|
59690
59728
|
{
|
|
59691
59729
|
headers,
|
|
@@ -59818,7 +59856,8 @@ function MoreMenu(_a) {
|
|
|
59818
59856
|
accessToken,
|
|
59819
59857
|
openCallback,
|
|
59820
59858
|
closeCallback,
|
|
59821
|
-
DropdownButton
|
|
59859
|
+
DropdownButton,
|
|
59860
|
+
isSystem
|
|
59822
59861
|
} = _b, props = __objRest(_b, [
|
|
59823
59862
|
"id",
|
|
59824
59863
|
"object",
|
|
@@ -59835,7 +59874,8 @@ function MoreMenu(_a) {
|
|
|
59835
59874
|
"accessToken",
|
|
59836
59875
|
"openCallback",
|
|
59837
59876
|
"closeCallback",
|
|
59838
|
-
"DropdownButton"
|
|
59877
|
+
"DropdownButton",
|
|
59878
|
+
"isSystem"
|
|
59839
59879
|
]);
|
|
59840
59880
|
var _a2, _b2;
|
|
59841
59881
|
const [activeModal, setActiveModal] = React.useState(null);
|
|
@@ -59843,7 +59883,7 @@ function MoreMenu(_a) {
|
|
|
59843
59883
|
const [isPayout, setIsPayout] = React.useState(Boolean(ticket == null ? void 0 : ticket.isPayout));
|
|
59844
59884
|
const [isLoadingPaid, setLoadingPaid] = React.useState(false);
|
|
59845
59885
|
const [isLoadingPayout, setLoadingPayout] = React.useState(false);
|
|
59846
|
-
const isShowPayout = ((_a2 = ticket == null ? void 0 : ticket.totalKhr) == null ? void 0 : _a2.winAmount) > 0 || ((_b2 = ticket == null ? void 0 : ticket.totalUsd) == null ? void 0 : _b2.winAmount) > 0;
|
|
59886
|
+
const isShowPayout = !isSystem && (((_a2 = ticket == null ? void 0 : ticket.totalKhr) == null ? void 0 : _a2.winAmount) > 0 || ((_b2 = ticket == null ? void 0 : ticket.totalUsd) == null ? void 0 : _b2.winAmount) > 0);
|
|
59847
59887
|
React.useEffect(() => {
|
|
59848
59888
|
setIsPaid(Boolean(ticket == null ? void 0 : ticket.isPaid));
|
|
59849
59889
|
setIsPayout(Boolean(ticket == null ? void 0 : ticket.isPayout));
|
|
@@ -59990,7 +60030,7 @@ function MoreMenu(_a) {
|
|
|
59990
60030
|
]
|
|
59991
60031
|
}
|
|
59992
60032
|
),
|
|
59993
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
60033
|
+
!isSystem && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
59994
60034
|
DropdownItem,
|
|
59995
60035
|
{
|
|
59996
60036
|
type: "button",
|
|
@@ -60002,7 +60042,7 @@ function MoreMenu(_a) {
|
|
|
60002
60042
|
]
|
|
60003
60043
|
}
|
|
60004
60044
|
),
|
|
60005
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
60045
|
+
!isSystem && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
60006
60046
|
DropdownItem,
|
|
60007
60047
|
{
|
|
60008
60048
|
tag: "div",
|
|
@@ -60054,7 +60094,8 @@ function MoreMenu(_a) {
|
|
|
60054
60094
|
onChange,
|
|
60055
60095
|
onSuccessProtest: onSuccessProtest != null ? onSuccessProtest : onSuccess,
|
|
60056
60096
|
onError,
|
|
60057
|
-
isSubmitting: externalSubmitting
|
|
60097
|
+
isSubmitting: externalSubmitting,
|
|
60098
|
+
isSystem
|
|
60058
60099
|
}
|
|
60059
60100
|
),
|
|
60060
60101
|
object && activeModal === "remark" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|