@series-inc/venus-sdk 2.2.0

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.
@@ -0,0 +1,82 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
5
+ // src/venus-api/systems/core.js
6
+ function createProxiedMethod(methodName, mockImpl) {
7
+ return function(...args) {
8
+ if (methodName.startsWith("on") && typeof args[0] === "function") {
9
+ if (!this._bootstrap._localHandlers) {
10
+ this._bootstrap._localHandlers = {};
11
+ }
12
+ this._bootstrap._localHandlers[methodName] = args[0];
13
+ if (this._bootstrap.venus && typeof this._bootstrap.venus[methodName] === "function") {
14
+ return this._bootstrap.venus[methodName](...args);
15
+ }
16
+ return true;
17
+ }
18
+ if (this._bootstrap.venus && typeof this._bootstrap.venus[methodName] === "function") {
19
+ return this._bootstrap.venus[methodName](...args);
20
+ }
21
+ return mockImpl.apply(this, args);
22
+ };
23
+ }
24
+ function createProxiedObject(objectName, mockImpl) {
25
+ const self = this;
26
+ function createNestedProxy(target, realApiPath) {
27
+ const handler = {
28
+ get: function(targetObj, prop, receiver) {
29
+ if (self._bootstrap.venus && realApiPath) {
30
+ let realApiValue = self._bootstrap.venus;
31
+ const pathParts = realApiPath.split(".");
32
+ for (const part of pathParts) {
33
+ if (realApiValue && realApiValue[part]) {
34
+ realApiValue = realApiValue[part];
35
+ } else {
36
+ realApiValue = null;
37
+ break;
38
+ }
39
+ }
40
+ if (realApiValue && prop in realApiValue) {
41
+ const realValue = Reflect.get(realApiValue, prop, receiver);
42
+ if (realValue && typeof realValue === "object" && typeof realValue !== "function") {
43
+ return createNestedProxy(realValue, `${realApiPath}.${prop}`);
44
+ }
45
+ return realValue;
46
+ }
47
+ }
48
+ const value = Reflect.get(targetObj, prop);
49
+ if (typeof value === "function") {
50
+ return function(...args) {
51
+ return value.apply(self, args);
52
+ };
53
+ }
54
+ if (value && typeof value === "object" && !Array.isArray(value)) {
55
+ const nestedPath = realApiPath ? `${realApiPath}.${prop}` : prop;
56
+ return createNestedProxy(value, nestedPath);
57
+ }
58
+ return value;
59
+ }
60
+ };
61
+ return new Proxy(target, handler);
62
+ }
63
+ return createNestedProxy(mockImpl, objectName);
64
+ }
65
+ function isWebPlatform() {
66
+ return typeof window !== "undefined" && !window.ReactNativeWebView;
67
+ }
68
+ var MOCK_DELAYS = {
69
+ short: 100,
70
+ // Quick operations (get/set preferences, etc.)
71
+ medium: 500,
72
+ // Medium operations (network-like calls)
73
+ long: 1e3
74
+ // Long operations (ads, AI, etc.)
75
+ };
76
+ function createMockDelay(ms = MOCK_DELAYS.short) {
77
+ return new Promise((resolve) => setTimeout(resolve, ms));
78
+ }
79
+
80
+ export { MOCK_DELAYS, __publicField, createMockDelay, createProxiedMethod, createProxiedObject, isWebPlatform };
81
+ //# sourceMappingURL=chunk-D4JRVWNC.mjs.map
82
+ //# sourceMappingURL=chunk-D4JRVWNC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/venus-api/systems/core.js"],"names":[],"mappings":";;;;;AAIO,SAAS,mBAAA,CAAoB,YAAY,QAAA,EAAU;AACxD,EAAA,OAAO,YAAa,IAAA,EAAM;AAExB,IAAA,IAAI,UAAA,CAAW,WAAW,IAAI,CAAA,IAAK,OAAO,IAAA,CAAK,CAAC,MAAM,UAAA,EAAY;AAChE,MAAA,IAAI,CAAC,IAAA,CAAK,UAAA,CAAW,cAAA,EAAgB;AACnC,QAAA,IAAA,CAAK,UAAA,CAAW,iBAAiB,EAAC;AAAA,MACpC;AAGA,MAAA,IAAA,CAAK,UAAA,CAAW,cAAA,CAAe,UAAU,CAAA,GAAI,KAAK,CAAC,CAAA;AAGnD,MAAA,IACE,IAAA,CAAK,WAAW,KAAA,IAChB,OAAO,KAAK,U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AAA,CAAgB,EAAA,GAAK,WAAA,CAAY,KAAA,EAAO;AACtD,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,YAAY,UAAA,CAAW,OAAA,EAAS,EAAE,CAAC,CAAA;AACzD","file":"chunk-D4JRVWNC.mjs","sourcesContent":["// Core utility functions for the Venus API system\n// These functions are used across multiple modules to handle real vs mock API delegation\n\n// Helper function to create proxied methods that delegate to real API when available\nexport function createProxiedMethod(methodName, mockImpl) {\n return function (...args) {\n // For lifecycle handlers (methods that start with 'on'), store them locally\n if (methodName.startsWith('on') && typeof args[0] === 'function') {\n if (!this._bootstrap._localHandlers) {\n this._bootstrap._localHandlers = {}\n }\n\n // Store the handler locally\n this._bootstrap._localHandlers[methodName] = args[0]\n\n // If the real API is available, also register with it\n if (\n this._bootstrap.venus &&\n typeof this._bootstrap.venus[methodName] === 'function'\n ) {\n return this._bootstrap.venus[methodName](...args)\n }\n\n return true\n }\n\n // For all other methods, if the real API is available and has the method, use it\n if (\n this._bootstrap.venus &&\n typeof this._bootstrap.venus[methodName] === 'function'\n ) {\n return this._bootstrap.venus[methodName](...args)\n }\n\n // Otherwise, fall back to the mock implementation\n return mockImpl.apply(this, args)\n }\n}\n\n// Helper function to create proxied objects with methods and getters that delegate to real API\nexport function createProxiedObject(objectName, mockImpl) {\n const self = this // Store reference to 'this' for use in handlers\n\n // Helper to create recursive proxies\n function createNestedProxy(target, realApiPath) {\n const handler = {\n get: function (targetObj, prop, receiver) {\n // If the real API is available, use it\n if (self._bootstrap.venus && realApiPath) {\n // Navigate to the correct path in the real API\n let realApiValue = self._bootstrap.venus\n const pathParts = realApiPath.split('.')\n\n for (const part of pathParts) {\n if (realApiValue && realApiValue[part]) {\n realApiValue = realApiValue[part]\n } else {\n realApiValue = null\n break\n }\n }\n\n if (realApiValue && prop in realApiValue) {\n const realValue = Reflect.get(realApiValue, prop, receiver)\n\n // If the real value is an object (but not a function), create a nested proxy\n if (\n realValue &&\n typeof realValue === 'object' &&\n typeof realValue !== 'function'\n ) {\n return createNestedProxy(realValue, `${realApiPath}.${prop}`)\n }\n\n return realValue\n }\n }\n\n // Otherwise, get from the mock implementation\n const value = Reflect.get(targetObj, prop)\n\n // If it's a method, bind it to the VenusAPI instance\n if (typeof value === 'function') {\n return function (...args) {\n return value.apply(self, args)\n }\n }\n\n // If it's an object (but not null or array), create a nested proxy\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n const nestedPath = realApiPath ? `${realApiPath}.${prop}` : prop\n return createNestedProxy(value, nestedPath)\n }\n\n return value\n },\n }\n\n return new Proxy(target, handler)\n }\n\n return createNestedProxy(mockImpl, objectName)\n}\n\n// Helper function to check if we're on web platform (for feature detection)\nexport function isWebPlatform() {\n return typeof window !== 'undefined' && !window.ReactNativeWebView\n}\n\n// Standard mock delay (100ms for most operations, 1000ms for longer ones like ads/AI)\nexport const MOCK_DELAYS = {\n short: 100, // Quick operations (get/set preferences, etc.)\n medium: 500, // Medium operations (network-like calls)\n long: 1000, // Long operations (ads, AI, etc.)\n}\n\n// Centralized mock delay function\nexport function createMockDelay(ms = MOCK_DELAYS.short) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export { MOCK_DELAYS, createMockDelay, createProxiedMethod, createProxiedObject, isWebPlatform } from './chunk-D4JRVWNC.mjs';
2
+ //# sourceMappingURL=core-BTXL5C6G.mjs.map
3
+ //# sourceMappingURL=core-BTXL5C6G.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"core-BTXL5C6G.mjs"}