@oxyhq/services 5.6.4 → 5.6.6

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.
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  OxyServices: true,
8
- Models: true,
9
- DeviceManager: true
8
+ DeviceManager: true,
9
+ toast: true
10
10
  };
11
11
  Object.defineProperty(exports, "DeviceManager", {
12
12
  enumerable: true,
@@ -14,7 +14,6 @@ Object.defineProperty(exports, "DeviceManager", {
14
14
  return _utils.DeviceManager;
15
15
  }
16
16
  });
17
- exports.Models = void 0;
18
17
  Object.defineProperty(exports, "OxyServices", {
19
18
  enumerable: true,
20
19
  get: function () {
@@ -22,6 +21,12 @@ Object.defineProperty(exports, "OxyServices", {
22
21
  }
23
22
  });
24
23
  exports.default = void 0;
24
+ Object.defineProperty(exports, "toast", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _sonnerSafe.toast;
28
+ }
29
+ });
25
30
  var _core = _interopRequireWildcard(require("./core"));
26
31
  Object.keys(_core).forEach(function (key) {
27
32
  if (key === "default" || key === "__esModule") return;
@@ -34,20 +39,19 @@ Object.keys(_core).forEach(function (key) {
34
39
  }
35
40
  });
36
41
  });
37
- var Models = _interopRequireWildcard(require("./models/interfaces"));
38
- exports.Models = Models;
39
- Object.keys(Models).forEach(function (key) {
42
+ var _utils = require("./utils");
43
+ var _interfaces = require("./models/interfaces");
44
+ Object.keys(_interfaces).forEach(function (key) {
40
45
  if (key === "default" || key === "__esModule") return;
41
46
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
42
- if (key in exports && exports[key] === Models[key]) return;
47
+ if (key in exports && exports[key] === _interfaces[key]) return;
43
48
  Object.defineProperty(exports, key, {
44
49
  enumerable: true,
45
50
  get: function () {
46
- return Models[key];
51
+ return _interfaces[key];
47
52
  }
48
53
  });
49
54
  });
50
- var _utils = require("./utils");
51
55
  var _secureSession = require("./models/secureSession");
52
56
  Object.keys(_secureSession).forEach(function (key) {
53
57
  if (key === "default" || key === "__esModule") return;
@@ -60,21 +64,56 @@ Object.keys(_secureSession).forEach(function (key) {
60
64
  }
61
65
  });
62
66
  });
67
+ var _sonnerSafe = require("./lib/sonner-safe");
63
68
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
64
69
  /**
65
- * OxyHQServices Main Export File - Backend Compatible
70
+ * OxyHQServices Main Export File - Universal (Frontend + Backend)
66
71
  *
67
- * This is the main entry point that exports only backend-safe code.
68
- * For UI components, use @oxyhq/services/ui
72
+ * This exports everything but uses environment detection to avoid crashes.
73
+ * - Frontend: Full UI + Core functionality
74
+ * - Backend: Core functionality only (UI components are no-ops)
69
75
  */
70
- // ------------- Core Imports -------------
71
- // ------------- Utility Imports -------------
72
- // ------------- Type Imports -------------
73
- // ------------- Core Exports -------------
74
- var _default = exports.default = _core.default; // Default export for backward compatibility
75
- // ------------- Utility Exports -------------
76
- // ------------- Model Exports -------------
77
- // Export all models as a namespace
78
- // Export all models directly
79
- // ------------- Type Exports -------------
76
+
77
+ // ------------- Core Imports (Always Safe) -------------
78
+
79
+ // ------------- Environment Detection -------------
80
+ const isFrontend = typeof window !== 'undefined' || typeof global !== 'undefined' && global.navigator || typeof process !== 'undefined' && process.env.NODE_ENV === 'development' && typeof document !== 'undefined';
81
+
82
+ // ------------- Core Exports (Always Available) -------------
83
+ var _default = exports.default = _core.default; // ------------- Safe Toast Export -------------
84
+ // ------------- UI Exports (Conditional) -------------
85
+ if (isFrontend) {
86
+ // Frontend: Export all UI components
87
+ try {
88
+ const ui = require('./ui');
89
+ Object.keys(ui).forEach(key => {
90
+ exports[key] = ui[key];
91
+ });
92
+ } catch (e) {
93
+ // UI import failed, continue without UI
94
+ }
95
+ } else {
96
+ // Backend: Export no-op UI components
97
+ const noopComponent = () => null;
98
+ const noopHook = () => ({});
99
+ exports.OxyProvider = noopComponent;
100
+ exports.OxySignInButton = noopComponent;
101
+ exports.OxyLogo = noopComponent;
102
+ exports.Avatar = noopComponent;
103
+ exports.FollowButton = noopComponent;
104
+ exports.OxyPayButton = noopComponent;
105
+ exports.FontLoader = {
106
+ setupFonts: () => {}
107
+ };
108
+ exports.useOxy = noopHook;
109
+ exports.useOxyAuth = noopHook;
110
+ exports.useOxyUser = noopHook;
111
+ exports.useOxyKarma = noopHook;
112
+ exports.useOxyPayments = noopHook;
113
+ exports.useOxyDevices = noopHook;
114
+ exports.useOxyNotifications = noopHook;
115
+ exports.useOxySocket = noopHook;
116
+ exports.useOxyQR = noopHook;
117
+ exports.useOxyIAP = noopHook;
118
+ }
80
119
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_core","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","Models","_utils","_secureSession","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","set","getOwnPropertyDescriptor","_default","OxyCore"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAYAC,MAAA,CAAAC,IAAA,CAAAJ,KAAA,EAAAK,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IA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A,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAnB,uBAAA,YAAAA,CAAAiB,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAV,GAAA,CAAAI,CAAA,GAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAX,cAAA,CAAAC,IAAA,CAAAS,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAArB,MAAA,CAAAS,cAAA,KAAAT,MAAA,CAAA4B,wBAAA,CAAAb,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAK,GAAA,IAAAN,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AA/BvC;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA;AAGA;AAGA;AAAA,IAAAa,QAAA,GAAArB,OAAA,CAAAiB,OAAA,GACeK,aAAO,EAAE;AAIxB;AAIA;AACoB;AACkB;AAEtC","ignoreList":[]}
1
+ {"version":3,"names":["_core","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_utils","_interfaces","_secureSession","_sonnerSafe","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","set","getOwnPropertyDescriptor","isFrontend","window","global","navigator","process","env","NODE_ENV","document","_default","OxyCore","ui","noopComponent","noopHook","OxyProvider","OxySignInButton","OxyLogo","Avatar","FollowButton","OxyPayButton","FontLoader","setupFonts","useOxy","useOxyAuth","useOxyUser","useOxyKarma","useOxyPayments","useOxyDevices","useOxyNotifications","useOxySocket","useOxyQR","useOxyIAP"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAaAC,MAAA,CAAAC,IAAA,CAAAJ,KAAA,EAAAK,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAN,KAAA,CAAAM,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAd,KAAA,CAAAM,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,MAAA,GAAAb,OAAA;AAEA,IAAAc,WAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,WAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,WAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,WAAA,CAAA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AO,CAACwC,YAAY,GAAGP,aAAa;EACpCjC,OAAO,CAACyC,UAAU,GAAG;IAAEC,UAAU,EAAEA,CAAA,KAAM,CAAC;EAAE,CAAC;EAC7C1C,OAAO,CAAC2C,MAAM,GAAGT,QAAQ;EACzBlC,OAAO,CAAC4C,UAAU,GAAGV,QAAQ;EAC7BlC,OAAO,CAAC6C,UAAU,GAAGX,QAAQ;EAC7BlC,OAAO,CAAC8C,WAAW,GAAGZ,QAAQ;EAC9BlC,OAAO,CAAC+C,cAAc,GAAGb,QAAQ;EACjClC,OAAO,CAACgD,aAAa,GAAGd,QAAQ;EAChClC,OAAO,CAACiD,mBAAmB,GAAGf,QAAQ;EACtClC,OAAO,CAACkD,YAAY,GAAGhB,QAAQ;EAC/BlC,OAAO,CAACmD,QAAQ,GAAGjB,QAAQ;EAC3BlC,OAAO,CAACoD,SAAS,GAAGlB,QAAQ;AAC9B","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.toast = void 0;
7
+ /**
8
+ * Safe sonner export that works in both frontend and backend
9
+ * In frontend: exports the actual toast function
10
+ * In backend: exports a no-op function
11
+ */
12
+
13
+ let toast = exports.toast = void 0;
14
+
15
+ // Environment detection
16
+ const isFrontend = typeof window !== 'undefined' || typeof global !== 'undefined' && global.navigator || typeof process !== 'undefined' && process.env.NODE_ENV === 'development' && typeof document !== 'undefined';
17
+ if (isFrontend) {
18
+ try {
19
+ // Try to import the actual sonner
20
+ const sonnerModule = require('./sonner');
21
+ exports.toast = toast = sonnerModule.toast;
22
+ } catch (e) {
23
+ // Fallback to no-op if import fails
24
+ exports.toast = toast = () => {};
25
+ }
26
+ } else {
27
+ // Backend environment - no-op function
28
+ exports.toast = toast = () => {};
29
+ }
30
+ //# sourceMappingURL=sonner-safe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["toast","exports","isFrontend","window","global","navigator","process","env","NODE_ENV","document","sonnerModule","require","e"],"sourceRoot":"../../../src","sources":["lib/sonner-safe.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,KAAU,GAAAC,OAAA,CAAAD,KAAA;;AAEd;AACA,MAAME,UAAU,GAAG,OAAOC,MAAM,KAAK,WAAW,IAC5B,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,SAAU,IAClD,OAAOC,OAAO,KAAK,WAAW,IAAIA,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,IAAI,OAAOC,QAAQ,KAAK,WAAY;AAEhI,IAAIP,UAAU,EAAE;EACd,IAAI;IACF;IACA,MAAMQ,YAAY,GAAGC,OAAO,CAAC,UAAU,CAAC;IACxCV,OAAA,CAAAD,KAAA,GAAAA,KAAK,GAAGU,YAAY,CAACV,KAAK;EAC5B,CAAC,CAAC,OAAOY,CAAC,EAAE;IACV;IACAX,OAAA,CAAAD,KAAA,GAAAA,KAAK,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClB;AACF,CAAC,MAAM;EACL;EACAC,OAAA,CAAAD,KAAA,GAAAA,KAAK,GAAGA,CAAA,KAAM,CAAC,CAAC;AAClB","ignoreList":[]}
@@ -1,32 +1,63 @@
1
1
  "use strict";
2
2
 
3
3
  /**
4
- * OxyHQServices Main Export File - Backend Compatible
4
+ * OxyHQServices Main Export File - Universal (Frontend + Backend)
5
5
  *
6
- * This is the main entry point that exports only backend-safe code.
7
- * For UI components, use @oxyhq/services/ui
6
+ * This exports everything but uses environment detection to avoid crashes.
7
+ * - Frontend: Full UI + Core functionality
8
+ * - Backend: Core functionality only (UI components are no-ops)
8
9
  */
9
10
 
10
- // ------------- Core Imports -------------
11
+ // ------------- Core Imports (Always Safe) -------------
11
12
  import OxyCore from './core';
12
13
  import { OxyServices } from './core';
14
+ // ------------- Environment Detection -------------
15
+ const isFrontend = typeof window !== 'undefined' || typeof global !== 'undefined' && global.navigator || typeof process !== 'undefined' && process.env.NODE_ENV === 'development' && typeof document !== 'undefined';
13
16
 
14
- // ------------- Utility Imports -------------
15
-
16
- // ------------- Type Imports -------------
17
- import * as Models from './models/interfaces';
18
-
19
- // ------------- Core Exports -------------
20
- export default OxyCore; // Default export for backward compatibility
17
+ // ------------- Core Exports (Always Available) -------------
18
+ export default OxyCore;
21
19
  export { OxyServices };
22
20
  export * from './core';
23
-
24
- // ------------- Utility Exports -------------
25
21
  export { DeviceManager } from './utils';
26
- // ------------- Model Exports -------------
27
- export { Models }; // Export all models as a namespace
28
- export * from './models/interfaces'; // Export all models directly
29
-
30
- // ------------- Type Exports -------------
22
+ export * from './models/interfaces';
31
23
  export * from './models/secureSession';
24
+
25
+ // ------------- Safe Toast Export -------------
26
+ export { toast } from './lib/sonner-safe';
27
+
28
+ // ------------- UI Exports (Conditional) -------------
29
+ if (isFrontend) {
30
+ // Frontend: Export all UI components
31
+ try {
32
+ const ui = require('./ui');
33
+ Object.keys(ui).forEach(key => {
34
+ exports[key] = ui[key];
35
+ });
36
+ } catch (e) {
37
+ // UI import failed, continue without UI
38
+ }
39
+ } else {
40
+ // Backend: Export no-op UI components
41
+ const noopComponent = () => null;
42
+ const noopHook = () => ({});
43
+ exports.OxyProvider = noopComponent;
44
+ exports.OxySignInButton = noopComponent;
45
+ exports.OxyLogo = noopComponent;
46
+ exports.Avatar = noopComponent;
47
+ exports.FollowButton = noopComponent;
48
+ exports.OxyPayButton = noopComponent;
49
+ exports.FontLoader = {
50
+ setupFonts: () => {}
51
+ };
52
+ exports.useOxy = noopHook;
53
+ exports.useOxyAuth = noopHook;
54
+ exports.useOxyUser = noopHook;
55
+ exports.useOxyKarma = noopHook;
56
+ exports.useOxyPayments = noopHook;
57
+ exports.useOxyDevices = noopHook;
58
+ exports.useOxyNotifications = noopHook;
59
+ exports.useOxySocket = noopHook;
60
+ exports.useOxyQR = noopHook;
61
+ exports.useOxyIAP = noopHook;
62
+ }
32
63
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["OxyCore","OxyServices","Models","DeviceManager"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAOA,OAAO,MAAM,QAAQ;AAC5B,SAASC,WAAW,QAAQ,QAAQ;;AAEpC;;AAGA;AACA,OAAO,KAAKC,MAAM,MAAM,qBAAqB;;AAE7C;AACA,eAAeF,OAAO,CAAC,CAAC;AACxB,SAASC,WAAW;AACpB,cAAc,QAAQ;;AAEtB;AACA,SAASE,aAAa,QAAQ,SAAS;AAGvC;AACA,SAASD,MAAM,GAAG,CAAE;AACpB,cAAc,qBAAqB,CAAC,CAAE;;AAEtC;AACA,cAAc,wBAAwB","ignoreList":[]}
1
+ {"version":3,"names":["OxyCore","OxyServices","isFrontend","window","global","navigator","process","env","NODE_ENV","document","DeviceManager","toast","ui","require","Object","keys","forEach","key","exports","e","noopComponent","noopHook","OxyProvider","OxySignInButton","OxyLogo","Avatar","FollowButton","OxyPayButton","FontLoader","setupFonts","useOxy","useOxyAuth","useOxyUser","useOxyKarma","useOxyPayments","useOxyDevices","useOxyNotifications","useOxySocket","useOxyQR","useOxyIAP"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAOA,OAAO,MAAM,QAAQ;AAC5B,SAASC,WAAW,QAAQ,QAAQ;AAIpC;AACA,MAAMC,UAAU,GAAG,OAAOC,MAAM,KAAK,WAAW,IAC5B,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,SAAU,IAClD,OAAOC,OAAO,KAAK,WAAW,IAAIA,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,IAAI,OAAOC,QAAQ,KAAK,WAAY;;AAEhI;AACA,eAAeT,OAAO;AACtB,SAASC,WAAW;AACpB,cAAc,QAAQ;AACtB,SAASS,aAAa,QAAQ,SAAS;AAEvC,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;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,0 +1,27 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Safe sonner export that works in both frontend and backend
5
+ * In frontend: exports the actual toast function
6
+ * In backend: exports a no-op function
7
+ */
8
+
9
+ let toast;
10
+
11
+ // Environment detection
12
+ const isFrontend = typeof window !== 'undefined' || typeof global !== 'undefined' && global.navigator || typeof process !== 'undefined' && process.env.NODE_ENV === 'development' && typeof document !== 'undefined';
13
+ if (isFrontend) {
14
+ try {
15
+ // Try to import the actual sonner
16
+ const sonnerModule = require('./sonner');
17
+ toast = sonnerModule.toast;
18
+ } catch (e) {
19
+ // Fallback to no-op if import fails
20
+ toast = () => {};
21
+ }
22
+ } else {
23
+ // Backend environment - no-op function
24
+ toast = () => {};
25
+ }
26
+ export { toast };
27
+ //# sourceMappingURL=sonner-safe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["toast","isFrontend","window","global","navigator","process","env","NODE_ENV","document","sonnerModule","require","e"],"sourceRoot":"../../../src","sources":["lib/sonner-safe.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,KAAU;;AAEd;AACA,MAAMC,UAAU,GAAG,OAAOC,MAAM,KAAK,WAAW,IAC5B,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,SAAU,IAClD,OAAOC,OAAO,KAAK,WAAW,IAAIA,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,IAAI,OAAOC,QAAQ,KAAK,WAAY;AAEhI,IAAIP,UAAU,EAAE;EACd,IAAI;IACF;IACA,MAAMQ,YAAY,GAAGC,OAAO,CAAC,UAAU,CAAC;IACxCV,KAAK,GAAGS,YAAY,CAACT,KAAK;EAC5B,CAAC,CAAC,OAAOW,CAAC,EAAE;IACV;IACAX,KAAK,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClB;AACF,CAAC,MAAM;EACL;EACAA,KAAK,GAAGA,CAAA,KAAM,CAAC,CAAC;AAClB;AAEA,SAASA,KAAK","ignoreList":[]}
@@ -1,18 +1,18 @@
1
1
  /**
2
- * OxyHQServices Main Export File - Backend Compatible
2
+ * OxyHQServices Main Export File - Universal (Frontend + Backend)
3
3
  *
4
- * This is the main entry point that exports only backend-safe code.
5
- * For UI components, use @oxyhq/services/ui
4
+ * This exports everything but uses environment detection to avoid crashes.
5
+ * - Frontend: Full UI + Core functionality
6
+ * - Backend: Core functionality only (UI components are no-ops)
6
7
  */
7
8
  import OxyCore from './core';
8
9
  import { OxyServices } from './core';
9
- import * as Models from './models/interfaces';
10
10
  export default OxyCore;
11
11
  export { OxyServices };
12
12
  export * from './core';
13
13
  export { DeviceManager } from './utils';
14
14
  export type { DeviceFingerprint, StoredDeviceInfo } from './utils';
15
- export { Models };
16
15
  export * from './models/interfaces';
17
16
  export * from './models/secureSession';
17
+ export { toast } from './lib/sonner-safe';
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,OAAO,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAMrC,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAG9C,eAAe,OAAO,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,cAAc,QAAQ,CAAC;AAGvB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,OAAO,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAUrC,eAAe,OAAO,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACnE,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AAGvC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Safe sonner export that works in both frontend and backend
3
+ * In frontend: exports the actual toast function
4
+ * In backend: exports a no-op function
5
+ */
6
+ declare let toast: any;
7
+ export { toast };
8
+ //# sourceMappingURL=sonner-safe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sonner-safe.d.ts","sourceRoot":"","sources":["../../../src/lib/sonner-safe.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,QAAA,IAAI,KAAK,EAAE,GAAG,CAAC;AAqBf,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/services",
3
- "version": "5.6.4",
3
+ "version": "5.6.6",
4
4
  "description": "Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
package/src/index.ts CHANGED
@@ -1,32 +1,65 @@
1
1
  /**
2
- * OxyHQServices Main Export File - Backend Compatible
2
+ * OxyHQServices Main Export File - Universal (Frontend + Backend)
3
3
  *
4
- * This is the main entry point that exports only backend-safe code.
5
- * For UI components, use @oxyhq/services/ui
4
+ * This exports everything but uses environment detection to avoid crashes.
5
+ * - Frontend: Full UI + Core functionality
6
+ * - Backend: Core functionality only (UI components are no-ops)
6
7
  */
7
8
 
8
- // ------------- Core Imports -------------
9
+ // ------------- Core Imports (Always Safe) -------------
9
10
  import OxyCore from './core';
10
11
  import { OxyServices } from './core';
11
-
12
- // ------------- Utility Imports -------------
13
12
  import { DeviceManager } from './utils/deviceManager';
14
-
15
- // ------------- Type Imports -------------
16
13
  import * as Models from './models/interfaces';
17
14
 
18
- // ------------- Core Exports -------------
19
- export default OxyCore; // Default export for backward compatibility
15
+ // ------------- Environment Detection -------------
16
+ const isFrontend = typeof window !== 'undefined' ||
17
+ (typeof global !== 'undefined' && global.navigator) ||
18
+ (typeof process !== 'undefined' && process.env.NODE_ENV === 'development' && typeof document !== 'undefined');
19
+
20
+ // ------------- Core Exports (Always Available) -------------
21
+ export default OxyCore;
20
22
  export { OxyServices };
21
23
  export * from './core';
22
-
23
- // ------------- Utility Exports -------------
24
24
  export { DeviceManager } from './utils';
25
25
  export type { DeviceFingerprint, StoredDeviceInfo } from './utils';
26
+ export * from './models/interfaces';
27
+ export * from './models/secureSession';
26
28
 
27
- // ------------- Model Exports -------------
28
- export { Models }; // Export all models as a namespace
29
- export * from './models/interfaces'; // Export all models directly
29
+ // ------------- Safe Toast Export -------------
30
+ export { toast } from './lib/sonner-safe';
30
31
 
31
- // ------------- Type Exports -------------
32
- export * from './models/secureSession';
32
+ // ------------- UI Exports (Conditional) -------------
33
+ if (isFrontend) {
34
+ // Frontend: Export all UI components
35
+ try {
36
+ const ui = require('./ui');
37
+ Object.keys(ui).forEach(key => {
38
+ exports[key] = ui[key];
39
+ });
40
+ } catch (e) {
41
+ // UI import failed, continue without UI
42
+ }
43
+ } else {
44
+ // Backend: Export no-op UI components
45
+ const noopComponent = () => null;
46
+ const noopHook = () => ({});
47
+
48
+ exports.OxyProvider = noopComponent;
49
+ exports.OxySignInButton = noopComponent;
50
+ exports.OxyLogo = noopComponent;
51
+ exports.Avatar = noopComponent;
52
+ exports.FollowButton = noopComponent;
53
+ exports.OxyPayButton = noopComponent;
54
+ exports.FontLoader = { setupFonts: () => {} };
55
+ exports.useOxy = noopHook;
56
+ exports.useOxyAuth = noopHook;
57
+ exports.useOxyUser = noopHook;
58
+ exports.useOxyKarma = noopHook;
59
+ exports.useOxyPayments = noopHook;
60
+ exports.useOxyDevices = noopHook;
61
+ exports.useOxyNotifications = noopHook;
62
+ exports.useOxySocket = noopHook;
63
+ exports.useOxyQR = noopHook;
64
+ exports.useOxyIAP = noopHook;
65
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Safe sonner export that works in both frontend and backend
3
+ * In frontend: exports the actual toast function
4
+ * In backend: exports a no-op function
5
+ */
6
+
7
+ let toast: any;
8
+
9
+ // Environment detection
10
+ const isFrontend = typeof window !== 'undefined' ||
11
+ (typeof global !== 'undefined' && global.navigator) ||
12
+ (typeof process !== 'undefined' && process.env.NODE_ENV === 'development' && typeof document !== 'undefined');
13
+
14
+ if (isFrontend) {
15
+ try {
16
+ // Try to import the actual sonner
17
+ const sonnerModule = require('./sonner');
18
+ toast = sonnerModule.toast;
19
+ } catch (e) {
20
+ // Fallback to no-op if import fails
21
+ toast = () => {};
22
+ }
23
+ } else {
24
+ // Backend environment - no-op function
25
+ toast = () => {};
26
+ }
27
+
28
+ export { toast };