Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
6 changes: 6 additions & 0 deletions .cursor/rules/conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
description: Project conventions for PRs and commits
alwaysApply: true
---

Use semantic PR titles following the conventional commits format, e.g. `fix: address bug ...`, `feat: add ...`, `refactor: ...`, `chore: ...`, `build: ...`, `docs: ...`, `test: ...`.
28 changes: 0 additions & 28 deletions .eslintrc.cjs

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ ngrok.log
!.vscode/settings.json
!.vscode/keybindings.json
!.vscode/extensions.json
.cursor/
.cursor/*
!.cursor/rules/

coverage

Expand Down
31 changes: 31 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript"],
"categories": {},
"rules": {},
"settings": {
"jsx-a11y": {
"polymorphicPropName": null,
"components": {},
"attributes": {}
},
"jsdoc": {
"ignorePrivate": false,
"ignoreInternal": false,
"ignoreReplacesDocs": true,
"overrideReplacesDocs": true,
"augmentsExtendsReplacesDocs": false,
"implementsReplacesDocs": false,
"exemptDestructuredRootsFromChecks": false,
"tagNamePreference": {}
},
"vitest": {
"typecheck": false
}
},
"env": {
"builtin": true
},
"globals": {},
"ignorePatterns": []
}
304 changes: 41 additions & 263 deletions bun.lock

Large diffs are not rendered by default.

14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"test": "vitest run --coverage",
"test:watch": "vitest watch --coverage",
"validate:build": "node build/scripts/validate.js",
"lint": "eslint src --ext .js,.jsx,.ts,.tsx; prettylint 'src/**/*' 'test/**/*' '__test__/**/*' --no-editorconfig",
"lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix; prettylint 'src/**/*' 'test/**/*' '__test__/**/*' --no-editorconfig --fix"
"lint": "oxlint src; prettier --check 'src/**/*' '__test__/**/*'",
"lint:fix": "oxlint src --fix; prettier --write 'src/**/*' '__test__/**/*'"
},
"config": {
"sdkVersion": "160600"
Expand All @@ -51,19 +51,15 @@
"@types/jsdom": "^28.0.0",
"@types/jsonp": "^0.2.3",
"@types/uuid": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"@vitest/coverage-v8": "4.0.18",
"concurrently": "^9.2.1",
"deepmerge": "^4.3.1",
"eslint": "^8.23.0",
"eslint-config-prettier": "9.0.0",
"fake-indexeddb": "6.2.5",
"intl-tel-input": "^25.15.1",
"jsdom": "^28.1.0",
"msw": "^2.12.10",
"oxlint": "^1.51.0",
"prettier": "3.8.1",
"prettylint": "^2.0.0",
"terser": "^5.46.0",
"type-fest": "^5.4.4",
"typescript": "^5.9.3",
Expand All @@ -81,12 +77,12 @@
},
{
"path": "./build/releases/OneSignalSDK.page.es6.js",
"limit": "43.75 kB",
"limit": "43.701 kB",
"gzip": true
},
{
"path": "./build/releases/OneSignalSDK.sw.js",
"limit": "12.743 kB",
"limit": "12.701 kB",
"gzip": true
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/core/executors/LoginUserOperationExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
ExecutionResult,
type IOperationExecutor,
} from 'src/core/types/operation';
import { getTimeZoneId } from 'src/shared/helpers/general';
import {
getResponseStatusType,
ResponseStatusType,
Expand Down Expand Up @@ -367,3 +366,5 @@ const getLanguage = () => {
return 'en';
}
};

const getTimeZoneId = () => Intl.DateTimeFormat().resolvedOptions().timeZone;
2 changes: 1 addition & 1 deletion src/onesignal/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function isObjectSerializable(value: unknown): boolean {
try {
JSON.stringify(value);
return true;
} catch (e) {
} catch {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export const mockPhoneLibraryLoading = () => {
OneSignal._didLoadITILibrary = true;

// @ts-expect-error - mock intl-tel-input
window.intlTelInput = vi.fn().mockImplementation((input) => ({
window.intlTelInput = vi.fn().mockImplementation((_input) => ({
getNumber: () => '+1234567890', // Return formatted number
isValidNumber: () => true,
getNumberType: () => 0,
Expand Down
6 changes: 3 additions & 3 deletions src/page/managers/slidedownManager/SlidedownManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class SlidedownManager {

let _isSlidedownPushDependent = false;

if (!!slidedownType) {
if (slidedownType) {
_isSlidedownPushDependent = isSlidedownPushDependent(slidedownType);
}

Expand Down Expand Up @@ -332,7 +332,7 @@ export class SlidedownManager {
): Promise<void> {
logMethodCall('mountChannelCaptureContainer');
try {
if (!!options.slidedownPromptOptions) {
if (options.slidedownPromptOptions) {
const channelCaptureContainer = new ChannelCaptureContainer(
options.slidedownPromptOptions,
);
Expand Down Expand Up @@ -425,7 +425,7 @@ export class SlidedownManager {
if (this._slidedownQueue.length > 0) {
const options = this._dequeue();

if (!!options) {
if (options) {
await this._createSlidedown(options);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/page/modules/timedStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function isLocalStorageSupported(): boolean {
}
localStorage.getItem('test');
return true;
} catch (e) {
} catch {
return false;
}
}
Expand Down Expand Up @@ -59,7 +59,7 @@ export function getItem(key: string): any | null {
try {
// @ts-expect-error - we have this in a try catch
parsedRecord = JSON.parse(record);
} catch (e) {
} catch {
return null;
}
if (parsedRecord === null) {
Expand All @@ -77,7 +77,7 @@ export function getItem(key: string): any | null {
let parsedRecordValue = parsedRecord.value;
try {
parsedRecordValue = JSON.parse(parsedRecord.value);
} catch (e) {
} catch {
return parsedRecordValue;
}
return parsedRecordValue;
Expand Down
2 changes: 1 addition & 1 deletion src/page/services/DynamicResourceLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class DynamicResourceLoader {
document.querySelector('head')?.appendChild(domElement);
});
return ResourceLoadState._Loaded;
} catch (e) {
} catch {
return ResourceLoadState._Failed;
}
}
Expand Down
15 changes: 6 additions & 9 deletions src/page/slidedown/Slidedown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
removeCssClass,
removeDomElement,
} from 'src/shared/helpers/dom';
import { getValueOrDefault } from 'src/shared/helpers/general';
import { getNotificationIcons } from 'src/shared/helpers/main';
import type { NotificationIcons } from 'src/shared/notifications/types';
import {
Expand Down Expand Up @@ -72,18 +71,16 @@ export default class Slidedown {
90,
);
this._tagCategories = options.categories;
this._errorButton = getValueOrDefault(
this._options.text.positiveUpdateButton,
SERVER_CONFIG_DEFAULTS_SLIDEDOWN.errorButton,
);
this._errorButton =
this._options.text.positiveUpdateButton ??
SERVER_CONFIG_DEFAULTS_SLIDEDOWN.errorButton;
break;
case DelayedPromptType._Sms:
case DelayedPromptType._Email:
case DelayedPromptType._SmsAndEmail:
this._errorButton = getValueOrDefault(
this._options.text.acceptButton,
SERVER_CONFIG_DEFAULTS_SLIDEDOWN.errorButton,
);
this._errorButton =
this._options.text.acceptButton ??
SERVER_CONFIG_DEFAULTS_SLIDEDOWN.errorButton;
break;
default:
break;
Expand Down
16 changes: 6 additions & 10 deletions src/shared/config/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { downloadServerAppConfig } from '../api/page';
import { InvalidAppIdError } from '../errors/common';
import { getValueOrDefault } from '../helpers/general';
import { isValidUuid } from '../helpers/validators';
import { checkRestrictedOrigin, checkUnsupportedSubdomain } from './domain';
import {
Expand Down Expand Up @@ -88,17 +87,14 @@ export function getMergedConfig(
vapidPublicKey: serverConfig.config.vapid_public_key,
onesignalVapidPublicKey: serverConfig.config.onesignal_vapid_public_key,
userConfig: mergedUserConfig,
enableOnSession: getValueOrDefault(
serverConfig.features.enable_on_session,
enableOnSession:
serverConfig.features.enable_on_session ??
SERVER_CONFIG_DEFAULTS_SESSION.enableOnSessionForUnsubcribed,
),
sessionThreshold: getValueOrDefault(
serverConfig.features.session_threshold,
sessionThreshold:
serverConfig.features.session_threshold ??
SERVER_CONFIG_DEFAULTS_SESSION.reportingThreshold,
),
enableSessionDuration: getValueOrDefault(
serverConfig.features.web_on_focus_enabled,
enableSessionDuration:
serverConfig.features.web_on_focus_enabled ??
SERVER_CONFIG_DEFAULTS_SESSION.enableOnFocus,
),
};
}
2 changes: 1 addition & 1 deletion src/shared/config/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function checkRestrictedOrigin(appConfig: AppConfig) {
function doesCurrentOriginMatchConfigOrigin(configOrigin: string): boolean {
try {
return location.origin === new URL(configOrigin).origin;
} catch (e) {
} catch {
return false;
}
}
Loading
Loading