Skip to content

Conversation

@fadi-george
Copy link
Contributor

@fadi-george fadi-george commented Oct 24, 2025

Description

1 Line Summary

  • clean up types usages and add more _ prefix usages
// old
  build/releases/OneSignalSDK.page.js
  Size limit: 420 B
  Size:       420 B gzipped
  
  build/releases/OneSignalSDK.page.es6.js
  Size limit: 45.63 kB
  Size:       45.63 kB gzipped
  
  build/releases/OneSignalSDK.sw.js
  Size limit: 13.44 kB
  Size:       13.44 kB gzipped
  
  build/releases/OneSignalSDK.page.styles.css
  Size limit: 8.81 kB
  Size:       8.8 kB  gzipped

// new
  build/releases/OneSignalSDK.page.js
  Size limit: 420 B
  Size:       420 B gzipped
  
  build/releases/OneSignalSDK.page.es6.js
  Size limit: 45.32 kB
  Size:       45.32 kB gzipped
  
  build/releases/OneSignalSDK.sw.js
  Size limit: 13.3 kB
  Size:       13.3 kB gzipped
  
  build/releases/OneSignalSDK.page.styles.css
  Size limit: 8.81 kB
  Size:       8.8 kB  gzipped

Details

  • break up log class into helpers
  • add unknwonoperror which is reused when validating operations for executors
  • deletes models/Subscription in favor of an interface
  • simplify getLanguage helper

Systems Affected

  • WebSDK
  • Backend
  • Dashboard

Validation

Tests

Info

Checklist

  • All the automated tests pass or I explained why that is not possible
  • I have personally tested this on my machine or explained why that is not possible
  • I have included test coverage for these changes or explained why they are not needed

Programming Checklist
Interfaces:

  • Don't use default export
  • New interfaces are in model files

Functions:

  • Don't use default export
  • All function signatures have return types
  • Helpers should not access any data but rather be given the data to operate on.

Typescript:

  • No Typescript warnings
  • Avoid silencing null/undefined warnings with the exclamation point

Other:

  • Iteration: refrain from using elem of array syntax. Prefer forEach or use map
  • Avoid using global OneSignal accessor for context if possible. Instead, we can pass it to function/constructor so that we don't call OneSignal.context

Screenshots

Info

Checklist

  • I have included screenshots/recordings of the intended results or explained why they are not needed

Related Tickets



This change is Reviewable

@fadi-george fadi-george changed the base branch from main to fg/adjust-events October 24, 2025 18:24
@fadi-george fadi-george force-pushed the fg/size-reduction-6 branch 3 times, most recently from be0b15f to a609dfd Compare October 24, 2025 18:28
rename log
move DeliveryPlatformKindValue

rename files

remove "removeLegacySubscriptionOptions" logic

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const logDebugSpy = vi.spyOn(Log, '_debug');
const logDebugSpy = vi.spyOn(Log, 'debug');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run the test suite locally it fails on this line:

TypeError: Cannot redefine property: mock

new Error(`"${argName}" is reserved`);

export const UnknownOpError = (op: { _name?: string } | { _name?: string }[]) =>
new Error(`Unknown op(s):${op}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new Error(`Unknown op(s):${op}`);
new Error(`Unknown op(s): ${JSON.stringify(op)}`);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why rename this from Log.ts to log.ts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants