Skip to content

feat: Convert event_tag_utils module to TS #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

yavorona
Copy link
Contributor

@yavorona yavorona commented Jul 30, 2020

Summary

  • Convert event_tag_utils module from JS to TS.

Test plan

  • Existing unit tests

@yavorona yavorona requested a review from a team as a code owner July 30, 2020 00:50
@yavorona yavorona self-assigned this Jul 30, 2020
@yavorona yavorona force-pushed the pnguen/convert-event-tags-utils-to-ts branch 2 times, most recently from 6f5d89e to a1cbc3d Compare July 30, 2020 00:58
@yavorona yavorona assigned yavorona and unassigned yavorona Jul 30, 2020
@yavorona yavorona force-pushed the pnguen/convert-event-tags-utils-to-ts branch from a1cbc3d to 172b7ae Compare July 30, 2020 01:16
…izely/javascript-sdk into mcarroll/optimizely-sdk-typescript
@yavorona yavorona force-pushed the pnguen/convert-event-tags-utils-to-ts branch 2 times, most recently from 2512009 to c5ed708 Compare July 30, 2020 01:40
@yavorona yavorona removed their assignment Jul 30, 2020
@yavorona yavorona force-pushed the pnguen/convert-event-tags-utils-to-ts branch from c5ed708 to f99e533 Compare July 30, 2020 17:10
@yavorona yavorona self-assigned this Jul 30, 2020
@yavorona yavorona force-pushed the pnguen/convert-event-tags-utils-to-ts branch from f99e533 to 7caeddd Compare July 30, 2020 17:51
@yavorona yavorona removed their assignment Jul 30, 2020
@yavorona yavorona requested a review from mjc1283 July 30, 2020 17:54
@@ -15,6 +15,9 @@
*/
import { sprintf } from '@optimizely/js-sdk-utils';

import { EventTags } from '../../../../event-processor/src/events';
import { LoggerFacade } from '../../../../logging/src/models';
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
import { LoggerFacade } from '../../../../logging/src/models';
import { LoggerFacade } from '@optimizely/js-sdk-logging';

@yavorona yavorona force-pushed the pnguen/convert-event-tags-utils-to-ts branch from 034f8db to f69fd61 Compare July 30, 2020 19:06
let revenue = null;
let eventValue = null;

if (eventTags) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mjc1283 FYI if (eventTags) {...} already exists in event_builder/index.js, so this is the only place where we need to put it.

@yavorona yavorona removed their assignment Jul 30, 2020
*/
import { sprintf } from '@optimizely/js-sdk-utils';

import { EventTags } from '../../../../event-processor/src/events';
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, I missed this one last time.

Just like the logging import - we can't reach into other packages. They are published separately.

Suggested change
import { EventTags } from '../../../../event-processor/src/events';
import { EventTags } from '@optimizely/js-sdk-event-processor';

Comment on lines 34 to 35
let parsedRevenueValue;
let parsedEventValue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally I would suggest declaring these inside the functions where they're used. Let me know your thoughts on declaring them here vs. inside.

Copy link
Contributor Author

@yavorona yavorona Jul 30, 2020

Choose a reason for hiding this comment

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

You are absolutely right, we should keep them inside the code block where they are being used. :)

@yavorona yavorona force-pushed the pnguen/convert-event-tags-utils-to-ts branch from 75ab813 to a61a375 Compare July 30, 2020 23:23
@yavorona yavorona removed their assignment Jul 30, 2020
@yavorona yavorona merged commit b9a4210 into mcarroll/optimizely-sdk-typescript Jul 30, 2020
@yavorona yavorona deleted the pnguen/convert-event-tags-utils-to-ts branch July 30, 2020 23:31
yavorona added a commit that referenced this pull request Aug 1, 2020
* Convert event_tag_utils module to TS

* Convert event_tag_utils module to TS

* Add type guard to avoid using any

* Move 'if (eventTags)' to top level functions

* Move let variables to inside the functions
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.

2 participants