@web-lite/api-types
Advanced tools
Comparing version 1.2.0-1 to 1.2.0-2
import { MessageContent, ChatInfo, IMock } from './index'; | ||
/******************************************************************************/ | ||
export declare let GLOBALS: IMock; | ||
export declare let debug: { | ||
(...data: any[]): void; | ||
(message?: any, ...optionalParams: any[]): void; | ||
}; | ||
export declare const scopeInitiation: () => void; | ||
@@ -8,3 +12,6 @@ /******************************************************************************/ | ||
export declare const globalUpdatePath: (path: string[], update: Record<string, any>) => void; | ||
export declare const setDefaultValueForMissingProps: (mock: Partial<IMock>) => void; | ||
export declare type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends {} ? DeepPartial<T[P]> : T[P]; | ||
}; | ||
export declare const setDefaultValueForMissingProps: (mock: DeepPartial<IMock>) => void; | ||
export declare const setHooks: (hooks?: {}) => void; | ||
@@ -11,0 +18,0 @@ export declare const initializeAsync: () => Promise<[() => Promise<{ |
@@ -74,3 +74,3 @@ "use strict"; | ||
exports.__esModule = true; | ||
exports.getShareDBMock = exports.getImageMock = exports.getAnalyticsMock = exports.getAudioMock = exports.getMessageMock = exports.getChatMock = exports.getWappsMock = exports.getUsersMock = exports.getUserMock = exports.initializeAsync = exports.setHooks = exports.setDefaultValueForMissingProps = exports.globalUpdatePath = exports.globalLensView = exports.scopeInitiation = exports.GLOBALS = void 0; | ||
exports.getShareDBMock = exports.getImageMock = exports.getAnalyticsMock = exports.getAudioMock = exports.getMessageMock = exports.getChatMock = exports.getWappsMock = exports.getUsersMock = exports.getUserMock = exports.initializeAsync = exports.setHooks = exports.setDefaultValueForMissingProps = exports.globalUpdatePath = exports.globalLensView = exports.scopeInitiation = exports.debug = exports.GLOBALS = void 0; | ||
var R = __importStar(require("ramda")); | ||
@@ -131,6 +131,6 @@ var Storage = /** @class */ (function () { | ||
var sleep = function (ms) { return new Promise(function (resolve) { return setTimeout(resolve, ms); }); }; | ||
var debug = exports.GLOBALS.config.debug ? console.log : noop; | ||
exports.debug = exports.GLOBALS.config.debug ? console.log : noop; | ||
var shareDBStorage = new Storage('share-db', 'sessionStorage'); | ||
var scopeInitiation = function () { | ||
debug = exports.GLOBALS.config.debug ? console.log : noop; | ||
exports.debug = exports.GLOBALS.config.debug ? console.log : noop; | ||
shareDBStorage = new Storage('share-db', exports.GLOBALS.config.storage); | ||
@@ -171,3 +171,3 @@ exports.GLOBALS.__db__ = shareDBStorage.get(); | ||
} | ||
debug.apply(void 0, __spreadArray(["callbacks[" + key + "]"], args)); | ||
exports.debug.apply(void 0, __spreadArray(["callbacks[" + key + "]"], args)); | ||
callback.apply(void 0, args); | ||
@@ -178,3 +178,3 @@ }; | ||
if (hooks === void 0) { hooks = {}; } | ||
debug('send(wappCommunicateCoreApiInitiated())'); | ||
exports.debug('send(wappCommunicateCoreApiInitiated())'); | ||
// @ts-ignore | ||
@@ -190,3 +190,3 @@ Object.entries(hooks).forEach(function (_a) { | ||
return __generator(this, function (_a) { | ||
debug('request(wappCommunicateCoreInitializeWappData())'); | ||
exports.debug('request(wappCommunicateCoreInitializeWappData())'); | ||
return [2 /*return*/, exports.GLOBALS.wapps]; | ||
@@ -197,3 +197,3 @@ }); | ||
return __generator(this, function (_a) { | ||
debug('request(wappCommunicateCoreGetUserInfo())'); | ||
exports.debug('request(wappCommunicateCoreGetUserInfo())'); | ||
return [2 /*return*/, exports.GLOBALS.user]; | ||
@@ -236,3 +236,3 @@ }); | ||
if (developerInput === null) { | ||
debug('Role Changed to other, your profile is undefined now'); | ||
exports.debug('Role Changed to other, your profile is undefined now'); | ||
return; | ||
@@ -242,7 +242,7 @@ } | ||
exports.globalUpdatePath(['profile', section], exports.GLOBALS.__profile__[developerInput]); | ||
debug("Role Changed to __profile_roles__[" + developerInput + "], your profile is undefined now"); | ||
exports.debug("Role Changed to __profile_roles__[" + developerInput + "], your profile is undefined now"); | ||
return exports.GLOBALS.__profile__[developerInput]; | ||
} | ||
else { | ||
debug(developerInput + " doesn't exist in __profile_roles__, check for possible typos"); | ||
exports.debug(developerInput + " doesn't exist in __profile_roles__, check for possible typos"); | ||
return; | ||
@@ -275,3 +275,3 @@ } | ||
else | ||
debug("[No user exist] userId: " + userId + " in your __users__"); | ||
exports.debug("[No user exist] userId: " + userId + " in your __users__"); | ||
}, userIds); | ||
@@ -295,3 +295,3 @@ return [2 /*return*/, users]; | ||
else | ||
debug("[No user exist] username: " + username + " in your __users__"); | ||
exports.debug("[No user exist] username: " + username + " in your __users__"); | ||
}, usernames); | ||
@@ -303,3 +303,3 @@ return [2 /*return*/, users]; | ||
openProfile: function (userId) { | ||
debug("Weblite will open the profile of " + userId + " if it Exists"); | ||
exports.debug("Weblite will open the profile of " + userId + " if it Exists"); | ||
} | ||
@@ -314,13 +314,13 @@ }); }; | ||
start: function () { | ||
debug('wapp starts!'); | ||
exports.debug('wapp starts!'); | ||
}, | ||
close: function () { | ||
debug('wapp closes!'); | ||
exports.debug('wapp closes!'); | ||
}, | ||
/** Restart wapp */ | ||
restart: function () { | ||
debug('wapp re-starts!'); | ||
exports.debug('wapp re-starts!'); | ||
}, | ||
throwError: function (error) { | ||
debug('wapp throw new Error'); | ||
exports.debug('wapp throw new Error'); | ||
throw new Error(error); | ||
@@ -331,3 +331,3 @@ }, | ||
exports.GLOBALS.__wapps__.mode = 'fullscreen'; | ||
debug('Set wapp full screen mode'); | ||
exports.debug('Set wapp full screen mode'); | ||
} | ||
@@ -338,12 +338,12 @@ }, | ||
exports.GLOBALS.wapps.inputs = input; | ||
debug("Mode has been change to " + mode + " and your given input will be passed to wapp", input); | ||
exports.debug("Mode has been change to " + mode + " and your given input will be passed to wapp", input); | ||
}, | ||
setOutput: function (output) { | ||
debug('this output will be passed to the parent wapp.', output); | ||
exports.debug('this output will be passed to the parent wapp.', output); | ||
}, | ||
donePopup: function (output) { | ||
debug('Closes the popup and resolves the popup mode request in parent wapp by given output.', output); | ||
exports.debug('Closes the popup and resolves the popup mode request in parent wapp by given output.', output); | ||
}, | ||
cancelPopup: function () { | ||
debug('Closes the popup and rejects the popup mode request in parent wapp.'); | ||
exports.debug('Closes the popup and rejects the popup mode request in parent wapp.'); | ||
}, | ||
@@ -377,3 +377,3 @@ getInput: function () { return exports.GLOBALS.wapps.inputs; }, | ||
join: function (chatId) { | ||
debug("Joins current user in specified chat with chatId=\"" + chatId + "\""); | ||
exports.debug("Joins current user in specified chat with chatId=\"" + chatId + "\""); | ||
} | ||
@@ -390,3 +390,3 @@ }); }; | ||
_a.sent(); | ||
debug('Sends message to all chats that running wapp exists in and has permission to send message.'); | ||
exports.debug('Sends message to all chats that running wapp exists in and has permission to send message.'); | ||
if (type === 'text') | ||
@@ -409,3 +409,3 @@ return [2 /*return*/]; | ||
_a.sent(); | ||
debug('Sends message only to the current chat if user has the permission.'); | ||
exports.debug('Sends message only to the current chat if user has the permission.'); | ||
if (type === 'text') | ||
@@ -428,15 +428,15 @@ return [2 /*return*/]; | ||
play: function (src) { | ||
debug("Start playing audio with src=\"" + src + "\""); | ||
exports.debug("Start playing audio with src=\"" + src + "\""); | ||
}, | ||
pause: function (src) { | ||
debug("Pause audio with src=\"" + src + "\""); | ||
exports.debug("Pause audio with src=\"" + src + "\""); | ||
}, | ||
stop: function (src) { | ||
debug("Stop audio with src=\"" + src + "\""); | ||
exports.debug("Stop audio with src=\"" + src + "\""); | ||
}, | ||
setSeek: function (src, seek) { | ||
debug("Seeked the playing audio with src=\"" + src + "\" to " + seek + " position"); | ||
exports.debug("Seeked the playing audio with src=\"" + src + "\" to " + seek + " position"); | ||
}, | ||
setVolume: function (src, volume) { | ||
debug("Set the volume of playing audio with src=\"" + src + "\" to " + volume); | ||
exports.debug("Set the volume of playing audio with src=\"" + src + "\" to " + volume); | ||
} | ||
@@ -447,3 +447,3 @@ }); }; | ||
var getAnalyticsMock = function () { return function (type, data) { | ||
debug("Send analytics event for [" + type + "] with te following data", data); | ||
exports.debug("Send analytics event for [" + type + "] with te following data", data); | ||
}; }; | ||
@@ -454,3 +454,3 @@ exports.getAnalyticsMock = getAnalyticsMock; | ||
openModal: function (options) { | ||
debug("Open Image with the src=\"" + options.src + "\" the following config will be applied to enhance image"); | ||
exports.debug("Open Image with the src=\"" + options.src + "\" the following config will be applied to enhance image"); | ||
} | ||
@@ -461,3 +461,4 @@ }); }; | ||
var db; | ||
var subscription; | ||
// @ts-ignore | ||
var subscription = noop; | ||
var parserFunction = function (R) { | ||
@@ -464,0 +465,0 @@ var isFunction = function (x) { |
import { IMock } from './index'; | ||
export declare const mockWebliteApi: (mock: Partial<IMock>) => void; | ||
import { DeepPartial } from './core'; | ||
export declare const mockWebliteApi: (mock: DeepPartial<IMock>) => void; |
@@ -11,3 +11,3 @@ "use strict"; | ||
core_1.scopeInitiation(); | ||
console.log('send(wappCommunicateCoreLoaded())'); | ||
core_1.debug('send(wappCommunicateCoreLoaded())'); | ||
window.W = { | ||
@@ -14,0 +14,0 @@ setHooks: core_1.setHooks, |
@@ -7,3 +7,3 @@ { | ||
"author": "Weblite Team", | ||
"version": "1.2.0-1", | ||
"version": "1.2.0-2", | ||
"description": "Use W with type checking and mock out of the box.", | ||
@@ -10,0 +10,0 @@ "license": "BSD-3-Clause", |
@@ -72,3 +72,3 @@ import * as R from 'ramda'; | ||
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); | ||
let debug = GLOBALS.config.debug ? console.log : noop; | ||
export let debug = GLOBALS.config.debug ? console.log : noop; | ||
let shareDBStorage = new Storage('share-db', 'sessionStorage'); | ||
@@ -97,3 +97,6 @@ | ||
type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> }; | ||
export type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends {} ? DeepPartial<T[P]> : T[P]; | ||
}; | ||
export const setDefaultValueForMissingProps = (mock: DeepPartial<IMock>) => { | ||
@@ -100,0 +103,0 @@ mock = R.mergeDeepLeft(mock, GLOBALS); |
@@ -17,2 +17,4 @@ import IWindow, { IMock } from './index'; | ||
getShareDBMock, | ||
debug, | ||
DeepPartial, | ||
} from './core'; | ||
@@ -22,4 +24,2 @@ | ||
type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> }; | ||
export const mockWebliteApi = (mock: DeepPartial<IMock>) => { | ||
@@ -29,4 +29,5 @@ if (process.env.NODE_ENV !== 'development' || W) return; | ||
scopeInitiation(); | ||
console.log('send(wappCommunicateCoreLoaded())'); | ||
debug('send(wappCommunicateCoreLoaded())'); | ||
(window as any).W = { | ||
@@ -33,0 +34,0 @@ setHooks, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63092
11
1583