@fctc/interface-logic 4.8.1 → 4.8.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.
- package/dist/hooks.d.mts +17 -1
- package/dist/hooks.d.ts +17 -1
- package/dist/hooks.js +104 -3
- package/dist/hooks.mjs +102 -3
- package/dist/provider.d.mts +3 -1
- package/dist/provider.d.ts +3 -1
- package/dist/provider.js +124 -25
- package/dist/provider.mjs +113 -14
- package/dist/services.d.mts +16 -0
- package/dist/services.d.ts +16 -0
- package/dist/services.js +180 -97
- package/dist/services.mjs +177 -94
- package/package.json +1 -1
package/dist/provider.js
CHANGED
|
@@ -700,7 +700,7 @@ var MainProvider = ({ children }) => {
|
|
|
700
700
|
};
|
|
701
701
|
|
|
702
702
|
// src/provider/version-gate-provider.tsx
|
|
703
|
-
var
|
|
703
|
+
var import_react63 = require("react");
|
|
704
704
|
var import_react_query2 = require("@tanstack/react-query");
|
|
705
705
|
|
|
706
706
|
// src/services/action-service/index.ts
|
|
@@ -7024,6 +7024,81 @@ var addPaymentMethodSupabaseService = () => {
|
|
|
7024
7024
|
};
|
|
7025
7025
|
};
|
|
7026
7026
|
|
|
7027
|
+
// src/services/pos-service/supabase/update-session-payment-methods.ts
|
|
7028
|
+
var import_react61 = require("react");
|
|
7029
|
+
var updateSessionPaymentMethodsSupabaseService = () => {
|
|
7030
|
+
const supabase = useSupabaseOptional();
|
|
7031
|
+
const updateSessionPaymentMethodsSupabase = (0, import_react61.useCallback)(
|
|
7032
|
+
async (values) => {
|
|
7033
|
+
if (!supabase) {
|
|
7034
|
+
console.error("Supabase client not initialized");
|
|
7035
|
+
return null;
|
|
7036
|
+
}
|
|
7037
|
+
try {
|
|
7038
|
+
const { data, error } = await supabase.from("pos_sessions" /* POS_SESSIONS */).update({
|
|
7039
|
+
payment_method_ids: values.payment_method_ids,
|
|
7040
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7041
|
+
}).eq("id", values.session_id).select("id").single();
|
|
7042
|
+
if (error) {
|
|
7043
|
+
console.error("Error updating session payment methods:", error);
|
|
7044
|
+
return null;
|
|
7045
|
+
}
|
|
7046
|
+
return [data.id];
|
|
7047
|
+
} catch (error) {
|
|
7048
|
+
console.error("Error updating session payment methods:", error);
|
|
7049
|
+
return null;
|
|
7050
|
+
}
|
|
7051
|
+
},
|
|
7052
|
+
[supabase]
|
|
7053
|
+
);
|
|
7054
|
+
return {
|
|
7055
|
+
updateSessionPaymentMethodsSupabase
|
|
7056
|
+
};
|
|
7057
|
+
};
|
|
7058
|
+
|
|
7059
|
+
// src/services/pos-service/supabase/create-payment.ts
|
|
7060
|
+
var import_react62 = require("react");
|
|
7061
|
+
var createPaymentSupabaseService = () => {
|
|
7062
|
+
const supabase = useSupabaseOptional();
|
|
7063
|
+
const createPaymentSupabase = (0, import_react62.useCallback)(
|
|
7064
|
+
async (values) => {
|
|
7065
|
+
if (!supabase) {
|
|
7066
|
+
console.error("Supabase client not initialized");
|
|
7067
|
+
return null;
|
|
7068
|
+
}
|
|
7069
|
+
try {
|
|
7070
|
+
const { data: paymentData, error: paymentError } = await supabase.from("payments" /* PAYMENTS */).insert({
|
|
7071
|
+
pos_order_id: values.pos_order_id,
|
|
7072
|
+
payment_method_id: values.payment_method_id,
|
|
7073
|
+
session_id: values.session_id,
|
|
7074
|
+
amount: values.amount
|
|
7075
|
+
}).select("id, amount").single();
|
|
7076
|
+
if (paymentError) {
|
|
7077
|
+
console.error("Error creating payment:", paymentError);
|
|
7078
|
+
return null;
|
|
7079
|
+
}
|
|
7080
|
+
const { data: orderData, error: orderError } = await supabase.from("orders" /* ORDERS */).select("amount_paid").eq("id", values.pos_order_id).single();
|
|
7081
|
+
if (orderError) {
|
|
7082
|
+
console.error("Error fetching order:", orderError);
|
|
7083
|
+
return null;
|
|
7084
|
+
}
|
|
7085
|
+
return {
|
|
7086
|
+
id: paymentData.id,
|
|
7087
|
+
amount: paymentData.amount,
|
|
7088
|
+
amount_paid: orderData.amount_paid
|
|
7089
|
+
};
|
|
7090
|
+
} catch (error) {
|
|
7091
|
+
console.error("Error creating payment:", error);
|
|
7092
|
+
return null;
|
|
7093
|
+
}
|
|
7094
|
+
},
|
|
7095
|
+
[supabase]
|
|
7096
|
+
);
|
|
7097
|
+
return {
|
|
7098
|
+
createPaymentSupabase
|
|
7099
|
+
};
|
|
7100
|
+
};
|
|
7101
|
+
|
|
7027
7102
|
// src/services/pos-service/index.ts
|
|
7028
7103
|
var serviceFactories = [
|
|
7029
7104
|
addEntityService,
|
|
@@ -7072,7 +7147,9 @@ var serviceFactories = [
|
|
|
7072
7147
|
deleteOrderLineSupabaseService,
|
|
7073
7148
|
addProductSupabaseService,
|
|
7074
7149
|
getFunctionalModulesService,
|
|
7075
|
-
addPaymentMethodSupabaseService
|
|
7150
|
+
addPaymentMethodSupabaseService,
|
|
7151
|
+
updateSessionPaymentMethodsSupabaseService,
|
|
7152
|
+
createPaymentSupabaseService
|
|
7076
7153
|
];
|
|
7077
7154
|
var usePosService = () => {
|
|
7078
7155
|
const { env } = useEnv();
|
|
@@ -7088,9 +7165,9 @@ var usePosService = () => {
|
|
|
7088
7165
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
7089
7166
|
var VersionGate = ({ children }) => {
|
|
7090
7167
|
const queryClient = (0, import_react_query2.useQueryClient)();
|
|
7091
|
-
const [ready, setReady] = (0,
|
|
7168
|
+
const [ready, setReady] = (0, import_react63.useState)(false);
|
|
7092
7169
|
const { getVersion } = useViewService();
|
|
7093
|
-
(0,
|
|
7170
|
+
(0, import_react63.useEffect)(() => {
|
|
7094
7171
|
const clearVersion = () => {
|
|
7095
7172
|
queryClient.clear();
|
|
7096
7173
|
localStorage.removeItem("__api_version__");
|
|
@@ -7121,7 +7198,7 @@ var VersionGate = ({ children }) => {
|
|
|
7121
7198
|
};
|
|
7122
7199
|
|
|
7123
7200
|
// src/provider/env-provider.tsx
|
|
7124
|
-
var
|
|
7201
|
+
var import_react64 = require("react");
|
|
7125
7202
|
|
|
7126
7203
|
// src/configs/axios-client.ts
|
|
7127
7204
|
var import_axios = __toESM(require("axios"));
|
|
@@ -7474,18 +7551,18 @@ var initialEnvState = {
|
|
|
7474
7551
|
excludeLanguages: [],
|
|
7475
7552
|
isSupaMode: false
|
|
7476
7553
|
};
|
|
7477
|
-
var EnvContext = (0,
|
|
7554
|
+
var EnvContext = (0, import_react64.createContext)(null);
|
|
7478
7555
|
function EnvProvider({
|
|
7479
7556
|
children,
|
|
7480
7557
|
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
7481
7558
|
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils
|
|
7482
7559
|
}) {
|
|
7483
|
-
const [env, setEnvState] = (0,
|
|
7560
|
+
const [env, setEnvState] = (0, import_react64.useState)({
|
|
7484
7561
|
...initialEnvState,
|
|
7485
7562
|
localStorageUtils: localStorageUtil,
|
|
7486
7563
|
sessionStorageUtils: sessionStorageUtil
|
|
7487
7564
|
});
|
|
7488
|
-
const setupEnv = (0,
|
|
7565
|
+
const setupEnv = (0, import_react64.useCallback)(
|
|
7489
7566
|
(envConfig) => {
|
|
7490
7567
|
const updatedEnv = {
|
|
7491
7568
|
...env,
|
|
@@ -7499,31 +7576,31 @@ function EnvProvider({
|
|
|
7499
7576
|
},
|
|
7500
7577
|
[env, localStorageUtil, sessionStorageUtil]
|
|
7501
7578
|
);
|
|
7502
|
-
const setUid2 = (0,
|
|
7579
|
+
const setUid2 = (0, import_react64.useCallback)((uid) => {
|
|
7503
7580
|
setEnvState((prev) => ({
|
|
7504
7581
|
...prev,
|
|
7505
7582
|
context: { ...prev.context, uid }
|
|
7506
7583
|
}));
|
|
7507
7584
|
}, []);
|
|
7508
|
-
const setLang2 = (0,
|
|
7585
|
+
const setLang2 = (0, import_react64.useCallback)((lang) => {
|
|
7509
7586
|
setEnvState((prev) => ({
|
|
7510
7587
|
...prev,
|
|
7511
7588
|
context: { ...prev.context, lang }
|
|
7512
7589
|
}));
|
|
7513
7590
|
}, []);
|
|
7514
|
-
const setAllowCompanies2 = (0,
|
|
7591
|
+
const setAllowCompanies2 = (0, import_react64.useCallback)((allowed_company_ids) => {
|
|
7515
7592
|
setEnvState((prev) => ({
|
|
7516
7593
|
...prev,
|
|
7517
7594
|
context: { ...prev.context, allowed_company_ids }
|
|
7518
7595
|
}));
|
|
7519
7596
|
}, []);
|
|
7520
|
-
const setCompanies2 = (0,
|
|
7597
|
+
const setCompanies2 = (0, import_react64.useCallback)((companies) => {
|
|
7521
7598
|
setEnvState((prev) => ({
|
|
7522
7599
|
...prev,
|
|
7523
7600
|
companies
|
|
7524
7601
|
}));
|
|
7525
7602
|
}, []);
|
|
7526
|
-
const setDefaultCompany2 = (0,
|
|
7603
|
+
const setDefaultCompany2 = (0, import_react64.useCallback)(
|
|
7527
7604
|
(defaultCompany) => {
|
|
7528
7605
|
setEnvState((prev) => ({
|
|
7529
7606
|
...prev,
|
|
@@ -7532,19 +7609,19 @@ function EnvProvider({
|
|
|
7532
7609
|
},
|
|
7533
7610
|
[]
|
|
7534
7611
|
);
|
|
7535
|
-
const setUserInfo = (0,
|
|
7612
|
+
const setUserInfo = (0, import_react64.useCallback)((user) => {
|
|
7536
7613
|
setEnvState((prev) => ({
|
|
7537
7614
|
...prev,
|
|
7538
7615
|
user
|
|
7539
7616
|
}));
|
|
7540
7617
|
}, []);
|
|
7541
|
-
const setConfig2 = (0,
|
|
7618
|
+
const setConfig2 = (0, import_react64.useCallback)((config) => {
|
|
7542
7619
|
setEnvState((prev) => ({
|
|
7543
7620
|
...prev,
|
|
7544
7621
|
config
|
|
7545
7622
|
}));
|
|
7546
7623
|
}, []);
|
|
7547
|
-
const setEnvFile2 = (0,
|
|
7624
|
+
const setEnvFile2 = (0, import_react64.useCallback)((envFile) => {
|
|
7548
7625
|
setEnvState((prev) => ({
|
|
7549
7626
|
...prev,
|
|
7550
7627
|
envFile
|
|
@@ -7570,7 +7647,7 @@ function EnvProvider({
|
|
|
7570
7647
|
);
|
|
7571
7648
|
}
|
|
7572
7649
|
function useEnv() {
|
|
7573
|
-
const context = (0,
|
|
7650
|
+
const context = (0, import_react64.useContext)(EnvContext);
|
|
7574
7651
|
if (!context) {
|
|
7575
7652
|
throw new Error("useEnv must be used within an EnvProvider");
|
|
7576
7653
|
}
|
|
@@ -7578,7 +7655,7 @@ function useEnv() {
|
|
|
7578
7655
|
}
|
|
7579
7656
|
|
|
7580
7657
|
// src/provider/service-provider.tsx
|
|
7581
|
-
var
|
|
7658
|
+
var import_react66 = require("react");
|
|
7582
7659
|
|
|
7583
7660
|
// src/hooks/auth/use-forgot-password.ts
|
|
7584
7661
|
var import_react_query3 = require("@tanstack/react-query");
|
|
@@ -8465,9 +8542,9 @@ var BaseModel = class {
|
|
|
8465
8542
|
};
|
|
8466
8543
|
|
|
8467
8544
|
// src/hooks/model/use-model.ts
|
|
8468
|
-
var
|
|
8545
|
+
var import_react65 = require("react");
|
|
8469
8546
|
var useModel = () => {
|
|
8470
|
-
const initModel = (0,
|
|
8547
|
+
const initModel = (0, import_react65.useCallback)((modelData) => {
|
|
8471
8548
|
switch (modelData?.name) {
|
|
8472
8549
|
default:
|
|
8473
8550
|
return new BaseModel(modelData);
|
|
@@ -9751,9 +9828,29 @@ var useAddPaymentMethod = () => {
|
|
|
9751
9828
|
};
|
|
9752
9829
|
var use_add_payment_method_default = useAddPaymentMethod;
|
|
9753
9830
|
|
|
9831
|
+
// src/hooks/pos/supabase/use-update-session-payment-methods.ts
|
|
9832
|
+
var import_react_query132 = require("@tanstack/react-query");
|
|
9833
|
+
var useUpdateSessionPaymentMethods = () => {
|
|
9834
|
+
const { updateSessionPaymentMethodsSupabase } = updateSessionPaymentMethodsSupabaseService();
|
|
9835
|
+
return (0, import_react_query132.useMutation)({
|
|
9836
|
+
mutationFn: updateSessionPaymentMethodsSupabase
|
|
9837
|
+
});
|
|
9838
|
+
};
|
|
9839
|
+
var use_update_session_payment_methods_default = useUpdateSessionPaymentMethods;
|
|
9840
|
+
|
|
9841
|
+
// src/hooks/pos/supabase/use-create-payment.ts
|
|
9842
|
+
var import_react_query133 = require("@tanstack/react-query");
|
|
9843
|
+
var useCreatePayment = () => {
|
|
9844
|
+
const { createPaymentSupabase } = createPaymentSupabaseService();
|
|
9845
|
+
return (0, import_react_query133.useMutation)({
|
|
9846
|
+
mutationFn: createPaymentSupabase
|
|
9847
|
+
});
|
|
9848
|
+
};
|
|
9849
|
+
var use_create_payment_default = useCreatePayment;
|
|
9850
|
+
|
|
9754
9851
|
// src/provider/service-provider.tsx
|
|
9755
9852
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
9756
|
-
var ServiceContext = (0,
|
|
9853
|
+
var ServiceContext = (0, import_react66.createContext)(null);
|
|
9757
9854
|
var ServiceProvider = ({
|
|
9758
9855
|
children
|
|
9759
9856
|
}) => {
|
|
@@ -9888,12 +9985,14 @@ var ServiceProvider = ({
|
|
|
9888
9985
|
useDeleteOrderLine: use_delete_order_line_default,
|
|
9889
9986
|
useAddProduct: use_add_product_default,
|
|
9890
9987
|
useGetFunctionalModules: use_get_functional_modules_default,
|
|
9891
|
-
useAddPaymentMethod: use_add_payment_method_default
|
|
9988
|
+
useAddPaymentMethod: use_add_payment_method_default,
|
|
9989
|
+
useUpdateSessionPaymentMethods: use_update_session_payment_methods_default,
|
|
9990
|
+
useCreatePayment: use_create_payment_default
|
|
9892
9991
|
};
|
|
9893
9992
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ServiceContext.Provider, { value: services, children });
|
|
9894
9993
|
};
|
|
9895
9994
|
var useService = () => {
|
|
9896
|
-
const context = (0,
|
|
9995
|
+
const context = (0, import_react66.useContext)(ServiceContext);
|
|
9897
9996
|
if (!context) {
|
|
9898
9997
|
throw new Error("useService must be used within a ServiceProvider");
|
|
9899
9998
|
}
|
|
@@ -9901,7 +10000,7 @@ var useService = () => {
|
|
|
9901
10000
|
};
|
|
9902
10001
|
|
|
9903
10002
|
// src/provider/meta-provider.tsx
|
|
9904
|
-
var
|
|
10003
|
+
var import_react67 = require("react");
|
|
9905
10004
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
9906
10005
|
var MetaProvider = ({ children }) => {
|
|
9907
10006
|
const { env } = useEnv();
|
|
@@ -9950,7 +10049,7 @@ var MetaProvider = ({ children }) => {
|
|
|
9950
10049
|
}
|
|
9951
10050
|
}
|
|
9952
10051
|
}
|
|
9953
|
-
(0,
|
|
10052
|
+
(0, import_react67.useEffect)(() => {
|
|
9954
10053
|
updateMetadata();
|
|
9955
10054
|
}, [env?.defaultCompany]);
|
|
9956
10055
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children });
|
package/dist/provider.mjs
CHANGED
|
@@ -6979,6 +6979,81 @@ var addPaymentMethodSupabaseService = () => {
|
|
|
6979
6979
|
};
|
|
6980
6980
|
};
|
|
6981
6981
|
|
|
6982
|
+
// src/services/pos-service/supabase/update-session-payment-methods.ts
|
|
6983
|
+
import { useCallback as useCallback58 } from "react";
|
|
6984
|
+
var updateSessionPaymentMethodsSupabaseService = () => {
|
|
6985
|
+
const supabase = useSupabaseOptional();
|
|
6986
|
+
const updateSessionPaymentMethodsSupabase = useCallback58(
|
|
6987
|
+
async (values) => {
|
|
6988
|
+
if (!supabase) {
|
|
6989
|
+
console.error("Supabase client not initialized");
|
|
6990
|
+
return null;
|
|
6991
|
+
}
|
|
6992
|
+
try {
|
|
6993
|
+
const { data, error } = await supabase.from("pos_sessions" /* POS_SESSIONS */).update({
|
|
6994
|
+
payment_method_ids: values.payment_method_ids,
|
|
6995
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
6996
|
+
}).eq("id", values.session_id).select("id").single();
|
|
6997
|
+
if (error) {
|
|
6998
|
+
console.error("Error updating session payment methods:", error);
|
|
6999
|
+
return null;
|
|
7000
|
+
}
|
|
7001
|
+
return [data.id];
|
|
7002
|
+
} catch (error) {
|
|
7003
|
+
console.error("Error updating session payment methods:", error);
|
|
7004
|
+
return null;
|
|
7005
|
+
}
|
|
7006
|
+
},
|
|
7007
|
+
[supabase]
|
|
7008
|
+
);
|
|
7009
|
+
return {
|
|
7010
|
+
updateSessionPaymentMethodsSupabase
|
|
7011
|
+
};
|
|
7012
|
+
};
|
|
7013
|
+
|
|
7014
|
+
// src/services/pos-service/supabase/create-payment.ts
|
|
7015
|
+
import { useCallback as useCallback59 } from "react";
|
|
7016
|
+
var createPaymentSupabaseService = () => {
|
|
7017
|
+
const supabase = useSupabaseOptional();
|
|
7018
|
+
const createPaymentSupabase = useCallback59(
|
|
7019
|
+
async (values) => {
|
|
7020
|
+
if (!supabase) {
|
|
7021
|
+
console.error("Supabase client not initialized");
|
|
7022
|
+
return null;
|
|
7023
|
+
}
|
|
7024
|
+
try {
|
|
7025
|
+
const { data: paymentData, error: paymentError } = await supabase.from("payments" /* PAYMENTS */).insert({
|
|
7026
|
+
pos_order_id: values.pos_order_id,
|
|
7027
|
+
payment_method_id: values.payment_method_id,
|
|
7028
|
+
session_id: values.session_id,
|
|
7029
|
+
amount: values.amount
|
|
7030
|
+
}).select("id, amount").single();
|
|
7031
|
+
if (paymentError) {
|
|
7032
|
+
console.error("Error creating payment:", paymentError);
|
|
7033
|
+
return null;
|
|
7034
|
+
}
|
|
7035
|
+
const { data: orderData, error: orderError } = await supabase.from("orders" /* ORDERS */).select("amount_paid").eq("id", values.pos_order_id).single();
|
|
7036
|
+
if (orderError) {
|
|
7037
|
+
console.error("Error fetching order:", orderError);
|
|
7038
|
+
return null;
|
|
7039
|
+
}
|
|
7040
|
+
return {
|
|
7041
|
+
id: paymentData.id,
|
|
7042
|
+
amount: paymentData.amount,
|
|
7043
|
+
amount_paid: orderData.amount_paid
|
|
7044
|
+
};
|
|
7045
|
+
} catch (error) {
|
|
7046
|
+
console.error("Error creating payment:", error);
|
|
7047
|
+
return null;
|
|
7048
|
+
}
|
|
7049
|
+
},
|
|
7050
|
+
[supabase]
|
|
7051
|
+
);
|
|
7052
|
+
return {
|
|
7053
|
+
createPaymentSupabase
|
|
7054
|
+
};
|
|
7055
|
+
};
|
|
7056
|
+
|
|
6982
7057
|
// src/services/pos-service/index.ts
|
|
6983
7058
|
var serviceFactories = [
|
|
6984
7059
|
addEntityService,
|
|
@@ -7027,7 +7102,9 @@ var serviceFactories = [
|
|
|
7027
7102
|
deleteOrderLineSupabaseService,
|
|
7028
7103
|
addProductSupabaseService,
|
|
7029
7104
|
getFunctionalModulesService,
|
|
7030
|
-
addPaymentMethodSupabaseService
|
|
7105
|
+
addPaymentMethodSupabaseService,
|
|
7106
|
+
updateSessionPaymentMethodsSupabaseService,
|
|
7107
|
+
createPaymentSupabaseService
|
|
7031
7108
|
];
|
|
7032
7109
|
var usePosService = () => {
|
|
7033
7110
|
const { env } = useEnv();
|
|
@@ -7076,7 +7153,7 @@ var VersionGate = ({ children }) => {
|
|
|
7076
7153
|
};
|
|
7077
7154
|
|
|
7078
7155
|
// src/provider/env-provider.tsx
|
|
7079
|
-
import { createContext as createContext2, useContext as useContext2, useState as useState4, useCallback as
|
|
7156
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState4, useCallback as useCallback60 } from "react";
|
|
7080
7157
|
|
|
7081
7158
|
// src/configs/axios-client.ts
|
|
7082
7159
|
import axios from "axios";
|
|
@@ -7440,7 +7517,7 @@ function EnvProvider({
|
|
|
7440
7517
|
localStorageUtils: localStorageUtil,
|
|
7441
7518
|
sessionStorageUtils: sessionStorageUtil
|
|
7442
7519
|
});
|
|
7443
|
-
const setupEnv =
|
|
7520
|
+
const setupEnv = useCallback60(
|
|
7444
7521
|
(envConfig) => {
|
|
7445
7522
|
const updatedEnv = {
|
|
7446
7523
|
...env,
|
|
@@ -7454,31 +7531,31 @@ function EnvProvider({
|
|
|
7454
7531
|
},
|
|
7455
7532
|
[env, localStorageUtil, sessionStorageUtil]
|
|
7456
7533
|
);
|
|
7457
|
-
const setUid2 =
|
|
7534
|
+
const setUid2 = useCallback60((uid) => {
|
|
7458
7535
|
setEnvState((prev) => ({
|
|
7459
7536
|
...prev,
|
|
7460
7537
|
context: { ...prev.context, uid }
|
|
7461
7538
|
}));
|
|
7462
7539
|
}, []);
|
|
7463
|
-
const setLang2 =
|
|
7540
|
+
const setLang2 = useCallback60((lang) => {
|
|
7464
7541
|
setEnvState((prev) => ({
|
|
7465
7542
|
...prev,
|
|
7466
7543
|
context: { ...prev.context, lang }
|
|
7467
7544
|
}));
|
|
7468
7545
|
}, []);
|
|
7469
|
-
const setAllowCompanies2 =
|
|
7546
|
+
const setAllowCompanies2 = useCallback60((allowed_company_ids) => {
|
|
7470
7547
|
setEnvState((prev) => ({
|
|
7471
7548
|
...prev,
|
|
7472
7549
|
context: { ...prev.context, allowed_company_ids }
|
|
7473
7550
|
}));
|
|
7474
7551
|
}, []);
|
|
7475
|
-
const setCompanies2 =
|
|
7552
|
+
const setCompanies2 = useCallback60((companies) => {
|
|
7476
7553
|
setEnvState((prev) => ({
|
|
7477
7554
|
...prev,
|
|
7478
7555
|
companies
|
|
7479
7556
|
}));
|
|
7480
7557
|
}, []);
|
|
7481
|
-
const setDefaultCompany2 =
|
|
7558
|
+
const setDefaultCompany2 = useCallback60(
|
|
7482
7559
|
(defaultCompany) => {
|
|
7483
7560
|
setEnvState((prev) => ({
|
|
7484
7561
|
...prev,
|
|
@@ -7487,19 +7564,19 @@ function EnvProvider({
|
|
|
7487
7564
|
},
|
|
7488
7565
|
[]
|
|
7489
7566
|
);
|
|
7490
|
-
const setUserInfo =
|
|
7567
|
+
const setUserInfo = useCallback60((user) => {
|
|
7491
7568
|
setEnvState((prev) => ({
|
|
7492
7569
|
...prev,
|
|
7493
7570
|
user
|
|
7494
7571
|
}));
|
|
7495
7572
|
}, []);
|
|
7496
|
-
const setConfig2 =
|
|
7573
|
+
const setConfig2 = useCallback60((config) => {
|
|
7497
7574
|
setEnvState((prev) => ({
|
|
7498
7575
|
...prev,
|
|
7499
7576
|
config
|
|
7500
7577
|
}));
|
|
7501
7578
|
}, []);
|
|
7502
|
-
const setEnvFile2 =
|
|
7579
|
+
const setEnvFile2 = useCallback60((envFile) => {
|
|
7503
7580
|
setEnvState((prev) => ({
|
|
7504
7581
|
...prev,
|
|
7505
7582
|
envFile
|
|
@@ -8420,9 +8497,9 @@ var BaseModel = class {
|
|
|
8420
8497
|
};
|
|
8421
8498
|
|
|
8422
8499
|
// src/hooks/model/use-model.ts
|
|
8423
|
-
import { useCallback as
|
|
8500
|
+
import { useCallback as useCallback61 } from "react";
|
|
8424
8501
|
var useModel = () => {
|
|
8425
|
-
const initModel =
|
|
8502
|
+
const initModel = useCallback61((modelData) => {
|
|
8426
8503
|
switch (modelData?.name) {
|
|
8427
8504
|
default:
|
|
8428
8505
|
return new BaseModel(modelData);
|
|
@@ -9706,6 +9783,26 @@ var useAddPaymentMethod = () => {
|
|
|
9706
9783
|
};
|
|
9707
9784
|
var use_add_payment_method_default = useAddPaymentMethod;
|
|
9708
9785
|
|
|
9786
|
+
// src/hooks/pos/supabase/use-update-session-payment-methods.ts
|
|
9787
|
+
import { useMutation as useMutation105 } from "@tanstack/react-query";
|
|
9788
|
+
var useUpdateSessionPaymentMethods = () => {
|
|
9789
|
+
const { updateSessionPaymentMethodsSupabase } = updateSessionPaymentMethodsSupabaseService();
|
|
9790
|
+
return useMutation105({
|
|
9791
|
+
mutationFn: updateSessionPaymentMethodsSupabase
|
|
9792
|
+
});
|
|
9793
|
+
};
|
|
9794
|
+
var use_update_session_payment_methods_default = useUpdateSessionPaymentMethods;
|
|
9795
|
+
|
|
9796
|
+
// src/hooks/pos/supabase/use-create-payment.ts
|
|
9797
|
+
import { useMutation as useMutation106 } from "@tanstack/react-query";
|
|
9798
|
+
var useCreatePayment = () => {
|
|
9799
|
+
const { createPaymentSupabase } = createPaymentSupabaseService();
|
|
9800
|
+
return useMutation106({
|
|
9801
|
+
mutationFn: createPaymentSupabase
|
|
9802
|
+
});
|
|
9803
|
+
};
|
|
9804
|
+
var use_create_payment_default = useCreatePayment;
|
|
9805
|
+
|
|
9709
9806
|
// src/provider/service-provider.tsx
|
|
9710
9807
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
9711
9808
|
var ServiceContext = createContext3(null);
|
|
@@ -9843,7 +9940,9 @@ var ServiceProvider = ({
|
|
|
9843
9940
|
useDeleteOrderLine: use_delete_order_line_default,
|
|
9844
9941
|
useAddProduct: use_add_product_default,
|
|
9845
9942
|
useGetFunctionalModules: use_get_functional_modules_default,
|
|
9846
|
-
useAddPaymentMethod: use_add_payment_method_default
|
|
9943
|
+
useAddPaymentMethod: use_add_payment_method_default,
|
|
9944
|
+
useUpdateSessionPaymentMethods: use_update_session_payment_methods_default,
|
|
9945
|
+
useCreatePayment: use_create_payment_default
|
|
9847
9946
|
};
|
|
9848
9947
|
return /* @__PURE__ */ jsx7(ServiceContext.Provider, { value: services, children });
|
|
9849
9948
|
};
|
package/dist/services.d.mts
CHANGED
|
@@ -780,6 +780,22 @@ declare const serviceFactories: readonly [(env: any) => {
|
|
|
780
780
|
sequence?: number;
|
|
781
781
|
active?: boolean;
|
|
782
782
|
}) => Promise<[number, string][] | null>;
|
|
783
|
+
}, () => {
|
|
784
|
+
updateSessionPaymentMethodsSupabase: (values: {
|
|
785
|
+
session_id: number;
|
|
786
|
+
payment_method_ids: number[];
|
|
787
|
+
}) => Promise<number[] | null>;
|
|
788
|
+
}, () => {
|
|
789
|
+
createPaymentSupabase: (values: {
|
|
790
|
+
pos_order_id: number;
|
|
791
|
+
payment_method_id: number;
|
|
792
|
+
session_id: number;
|
|
793
|
+
amount: number;
|
|
794
|
+
}) => Promise<{
|
|
795
|
+
id: number;
|
|
796
|
+
amount: number;
|
|
797
|
+
amount_paid: number;
|
|
798
|
+
} | null>;
|
|
783
799
|
}];
|
|
784
800
|
type ServiceFactories = (typeof serviceFactories)[number];
|
|
785
801
|
type ServiceReturn<T extends ServiceFactories> = ReturnType<T>;
|
package/dist/services.d.ts
CHANGED
|
@@ -780,6 +780,22 @@ declare const serviceFactories: readonly [(env: any) => {
|
|
|
780
780
|
sequence?: number;
|
|
781
781
|
active?: boolean;
|
|
782
782
|
}) => Promise<[number, string][] | null>;
|
|
783
|
+
}, () => {
|
|
784
|
+
updateSessionPaymentMethodsSupabase: (values: {
|
|
785
|
+
session_id: number;
|
|
786
|
+
payment_method_ids: number[];
|
|
787
|
+
}) => Promise<number[] | null>;
|
|
788
|
+
}, () => {
|
|
789
|
+
createPaymentSupabase: (values: {
|
|
790
|
+
pos_order_id: number;
|
|
791
|
+
payment_method_id: number;
|
|
792
|
+
session_id: number;
|
|
793
|
+
amount: number;
|
|
794
|
+
}) => Promise<{
|
|
795
|
+
id: number;
|
|
796
|
+
amount: number;
|
|
797
|
+
amount_paid: number;
|
|
798
|
+
} | null>;
|
|
783
799
|
}];
|
|
784
800
|
type ServiceFactories = (typeof serviceFactories)[number];
|
|
785
801
|
type ServiceReturn<T extends ServiceFactories> = ReturnType<T>;
|