@fctc/interface-logic 4.4.1 → 4.4.2

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.js CHANGED
@@ -3075,14 +3075,8 @@ var import_react7 = require("react");
3075
3075
  var import_supabase_js = require("@supabase/supabase-js");
3076
3076
  var import_jsx_runtime8 = require("react/jsx-runtime");
3077
3077
  var SupabaseContext = (0, import_react7.createContext)(null);
3078
- var useSupabase = () => {
3079
- const context = (0, import_react7.useContext)(SupabaseContext);
3080
- if (!context) {
3081
- throw new Error(
3082
- "useSupabase must be used within a SupabaseProvider or check your env config"
3083
- );
3084
- }
3085
- return context;
3078
+ var useSupabaseOptional = () => {
3079
+ return (0, import_react7.useContext)(SupabaseContext);
3086
3080
  };
3087
3081
 
3088
3082
  // src/services/action-service/index.ts
@@ -6025,7 +6019,7 @@ var MODEL_TO_TABLE = {
6025
6019
  ["restaurant.table" /* RESTAURANT_TABLE */]: "restaurant_tables"
6026
6020
  };
6027
6021
  var loadDataPosSessionService = (env) => {
6028
- const supabase = useSupabase();
6022
+ const supabase = useSupabaseOptional();
6029
6023
  const loadDataPosSession = (0, import_react38.useCallback)(
6030
6024
  async ({
6031
6025
  model,
@@ -6077,6 +6071,14 @@ var loadDataPosSessionService = (env) => {
6077
6071
  relations: {}
6078
6072
  };
6079
6073
  }
6074
+ if (!supabase) {
6075
+ return {
6076
+ modelName,
6077
+ data: [],
6078
+ fields: {},
6079
+ relations: {}
6080
+ };
6081
+ }
6080
6082
  const { data, error } = await supabase.from(tableName).select("*");
6081
6083
  if (error) {
6082
6084
  console.error(`Error loading ${modelName}:`, error);
package/dist/hooks.mjs CHANGED
@@ -2927,14 +2927,8 @@ import { createContext as createContext3, useContext as useContext3, useMemo } f
2927
2927
  import { createClient } from "@supabase/supabase-js";
2928
2928
  import { jsx as jsx8 } from "react/jsx-runtime";
2929
2929
  var SupabaseContext = createContext3(null);
2930
- var useSupabase = () => {
2931
- const context = useContext3(SupabaseContext);
2932
- if (!context) {
2933
- throw new Error(
2934
- "useSupabase must be used within a SupabaseProvider or check your env config"
2935
- );
2936
- }
2937
- return context;
2930
+ var useSupabaseOptional = () => {
2931
+ return useContext3(SupabaseContext);
2938
2932
  };
2939
2933
 
2940
2934
  // src/services/action-service/index.ts
@@ -5877,7 +5871,7 @@ var MODEL_TO_TABLE = {
5877
5871
  ["restaurant.table" /* RESTAURANT_TABLE */]: "restaurant_tables"
5878
5872
  };
5879
5873
  var loadDataPosSessionService = (env) => {
5880
- const supabase = useSupabase();
5874
+ const supabase = useSupabaseOptional();
5881
5875
  const loadDataPosSession = useCallback32(
5882
5876
  async ({
5883
5877
  model,
@@ -5929,6 +5923,14 @@ var loadDataPosSessionService = (env) => {
5929
5923
  relations: {}
5930
5924
  };
5931
5925
  }
5926
+ if (!supabase) {
5927
+ return {
5928
+ modelName,
5929
+ data: [],
5930
+ fields: {},
5931
+ relations: {}
5932
+ };
5933
+ }
5932
5934
  const { data, error } = await supabase.from(tableName).select("*");
5933
5935
  if (error) {
5934
5936
  console.error(`Error loading ${modelName}:`, error);
package/dist/provider.js CHANGED
@@ -6003,6 +6003,9 @@ var useSupabase = () => {
6003
6003
  }
6004
6004
  return context;
6005
6005
  };
6006
+ var useSupabaseOptional = () => {
6007
+ return (0, import_react33.useContext)(SupabaseContext);
6008
+ };
6006
6009
 
6007
6010
  // src/services/pos-service/load-data-pos-session.ts
6008
6011
  var MODEL_TO_TABLE = {
@@ -6022,7 +6025,7 @@ var MODEL_TO_TABLE = {
6022
6025
  ["restaurant.table" /* RESTAURANT_TABLE */]: "restaurant_tables"
6023
6026
  };
6024
6027
  var loadDataPosSessionService = (env) => {
6025
- const supabase = useSupabase();
6028
+ const supabase = useSupabaseOptional();
6026
6029
  const loadDataPosSession = (0, import_react34.useCallback)(
6027
6030
  async ({
6028
6031
  model,
@@ -6074,6 +6077,14 @@ var loadDataPosSessionService = (env) => {
6074
6077
  relations: {}
6075
6078
  };
6076
6079
  }
6080
+ if (!supabase) {
6081
+ return {
6082
+ modelName,
6083
+ data: [],
6084
+ fields: {},
6085
+ relations: {}
6086
+ };
6087
+ }
6077
6088
  const { data, error } = await supabase.from(tableName).select("*");
6078
6089
  if (error) {
6079
6090
  console.error(`Error loading ${modelName}:`, error);
package/dist/provider.mjs CHANGED
@@ -5958,6 +5958,9 @@ var useSupabase = () => {
5958
5958
  }
5959
5959
  return context;
5960
5960
  };
5961
+ var useSupabaseOptional = () => {
5962
+ return useContext(SupabaseContext);
5963
+ };
5961
5964
 
5962
5965
  // src/services/pos-service/load-data-pos-session.ts
5963
5966
  var MODEL_TO_TABLE = {
@@ -5977,7 +5980,7 @@ var MODEL_TO_TABLE = {
5977
5980
  ["restaurant.table" /* RESTAURANT_TABLE */]: "restaurant_tables"
5978
5981
  };
5979
5982
  var loadDataPosSessionService = (env) => {
5980
- const supabase = useSupabase();
5983
+ const supabase = useSupabaseOptional();
5981
5984
  const loadDataPosSession = useCallback31(
5982
5985
  async ({
5983
5986
  model,
@@ -6029,6 +6032,14 @@ var loadDataPosSessionService = (env) => {
6029
6032
  relations: {}
6030
6033
  };
6031
6034
  }
6035
+ if (!supabase) {
6036
+ return {
6037
+ modelName,
6038
+ data: [],
6039
+ fields: {},
6040
+ relations: {}
6041
+ };
6042
+ }
6032
6043
  const { data, error } = await supabase.from(tableName).select("*");
6033
6044
  if (error) {
6034
6045
  console.error(`Error loading ${modelName}:`, error);
package/dist/services.js CHANGED
@@ -3964,14 +3964,8 @@ var import_react26 = require("react");
3964
3964
  var import_supabase_js = require("@supabase/supabase-js");
3965
3965
  var import_jsx_runtime6 = require("react/jsx-runtime");
3966
3966
  var SupabaseContext = (0, import_react26.createContext)(null);
3967
- var useSupabase = () => {
3968
- const context = (0, import_react26.useContext)(SupabaseContext);
3969
- if (!context) {
3970
- throw new Error(
3971
- "useSupabase must be used within a SupabaseProvider or check your env config"
3972
- );
3973
- }
3974
- return context;
3967
+ var useSupabaseOptional = () => {
3968
+ return (0, import_react26.useContext)(SupabaseContext);
3975
3969
  };
3976
3970
 
3977
3971
  // src/services/pos-service/load-data-pos-session.ts
@@ -3992,7 +3986,7 @@ var MODEL_TO_TABLE = {
3992
3986
  ["restaurant.table" /* RESTAURANT_TABLE */]: "restaurant_tables"
3993
3987
  };
3994
3988
  var loadDataPosSessionService = (env) => {
3995
- const supabase = useSupabase();
3989
+ const supabase = useSupabaseOptional();
3996
3990
  const loadDataPosSession = (0, import_react27.useCallback)(
3997
3991
  async ({
3998
3992
  model,
@@ -4044,6 +4038,14 @@ var loadDataPosSessionService = (env) => {
4044
4038
  relations: {}
4045
4039
  };
4046
4040
  }
4041
+ if (!supabase) {
4042
+ return {
4043
+ modelName,
4044
+ data: [],
4045
+ fields: {},
4046
+ relations: {}
4047
+ };
4048
+ }
4047
4049
  const { data, error } = await supabase.from(tableName).select("*");
4048
4050
  if (error) {
4049
4051
  console.error(`Error loading ${modelName}:`, error);
package/dist/services.mjs CHANGED
@@ -3918,14 +3918,8 @@ import { createContext as createContext2, useContext as useContext2, useMemo } f
3918
3918
  import { createClient } from "@supabase/supabase-js";
3919
3919
  import { jsx as jsx6 } from "react/jsx-runtime";
3920
3920
  var SupabaseContext = createContext2(null);
3921
- var useSupabase = () => {
3922
- const context = useContext2(SupabaseContext);
3923
- if (!context) {
3924
- throw new Error(
3925
- "useSupabase must be used within a SupabaseProvider or check your env config"
3926
- );
3927
- }
3928
- return context;
3921
+ var useSupabaseOptional = () => {
3922
+ return useContext2(SupabaseContext);
3929
3923
  };
3930
3924
 
3931
3925
  // src/services/pos-service/load-data-pos-session.ts
@@ -3946,7 +3940,7 @@ var MODEL_TO_TABLE = {
3946
3940
  ["restaurant.table" /* RESTAURANT_TABLE */]: "restaurant_tables"
3947
3941
  };
3948
3942
  var loadDataPosSessionService = (env) => {
3949
- const supabase = useSupabase();
3943
+ const supabase = useSupabaseOptional();
3950
3944
  const loadDataPosSession = useCallback23(
3951
3945
  async ({
3952
3946
  model,
@@ -3998,6 +3992,14 @@ var loadDataPosSessionService = (env) => {
3998
3992
  relations: {}
3999
3993
  };
4000
3994
  }
3995
+ if (!supabase) {
3996
+ return {
3997
+ modelName,
3998
+ data: [],
3999
+ fields: {},
4000
+ relations: {}
4001
+ };
4002
+ }
4001
4003
  const { data, error } = await supabase.from(tableName).select("*");
4002
4004
  if (error) {
4003
4005
  console.error(`Error loading ${modelName}:`, error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/interface-logic",
3
- "version": "4.4.1",
3
+ "version": "4.4.2",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",