-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update Opticks to support Optimizely's JS SDK v5.3.2 #81
Update Opticks to support Optimizely's JS SDK v5.3.2 #81
Conversation
3c7851c
to
8c7dd43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Vini!
I left a few suggestions.
I also did some QA and everything seems to work as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see some references to booleanToggle
:
- Documentation:
docs/booleanToggles.md
anddocs/dead-code-removal.md
- Logic:
packages/lib/src/integrations/simple.ts
- Type:
BooleanToggleType
Can we clean this up as well? If not, let's mark them as deprecated and create a follow-up story.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. Good catch. I cleaned them up. I think I managed to do so .
toggle, | ||
forceToggles, | ||
getEnabledFeatures | ||
} from './optimizely' | ||
|
||
// During the tests: | ||
// for booleanToggle 'foo' yields true and 'bar' yields false, unless forced | ||
// for toggle 'foo' yields 'b' and 'bar' yields 'a', unless forced | ||
import datafile from './__fixtures__/dataFile' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to update this datafile
to match the new configuration format?
@@ -26,7 +24,11 @@ import Optimizely, { | |||
// @ts-expect-error | |||
getEnabledFeaturesMock, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this mock is not used so we can remove the import (and maybe even the mock declaration).
) => | ||
optimizelyClient.notificationCenter.addNotificationListener( | ||
NOTIFICATION_TYPES.DECISION, | ||
OptimizelyLib.enums.NOTIFICATION_TYPES.DECISION, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, we don't need the NOTIFICATION_TYPES
declaration on line 19 anymore, right?
packages/lib/package.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to bump the version of the opticks
package here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to do this manually - you can run npx changeset
from the root dir which will generate the changeset. Once this PR is merged, another PR will be opened automatically with the version bump + changelog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vlacerda let me know if you face any issues generating the changeset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to run this new version on the mobile app, but found something weird. Will comment here in case someoneelse also found and fixed it.
On the package/mobile-app/package.json
file, I added the line below:
"opticks": "github:viodotcom/opticks#sc-119714-upgrade-optimizely-sdk-and-opticks-to-latest",
After running the install command, this is how the opticks package folder looked like (without the code). Maybe this type of install is not supported?
How do you suggest I install this branch version into the app to test it out?
@luisfmsouza, I'm not sure the best way to run from GitHub. But I QA'ed by pointing to the repo on my local machine:
|
Co-authored-by: Gerrit Burger <[email protected]>
Co-authored-by: Gerrit Burger <[email protected]>
@luisfmsouza I tested with Opticks locally. The steps are roughly:
|
f560af7
to
d750ed2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for those changes, Vini!
It's probably best to do the fix I mentioned here in this PR as well.
return [`${userId}-test-1`, `${userId}-test-2`] | ||
} | ||
export const decideMock = jest.fn((toggleKey) => ({ | ||
enabled: toggleKey === "foo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enabled: toggleKey === "foo" | |
enabled: toggleKey === 'foo' |
README.md
Outdated
as with `booleanToggle`, we specify multiple variants of which one is active at | ||
any time. By convention the variants are named `a` (control), `b`, `c` etc. | ||
Toggles can be used to implement a/b/c style testing and on/off values as well. | ||
We specify multiple variants of which one is active at any time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We specify multiple variants of which one is active at any time. | |
We specify multiple variants of which only one is active at any time. |
README.md
Outdated
Toggles can be used to implement a/b/c style testing, instead of on/off values | ||
as with `booleanToggle`, we specify multiple variants of which one is active at | ||
any time. By convention the variants are named `a` (control), `b`, `c` etc. | ||
Toggles can be used to implement a/b/c style testing and on/off values as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toggles can be used to implement a/b/c style testing and on/off values as well. | |
Toggles can be used to implement a/b/c style MVT testing and on/off feature flags as well. |
) | ||
|
||
return isInAnyAudience || !isEveryoneElseRulePaused | ||
return isInAnyAudience |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're not explicitly checking the last fallback rule as "everyone else", does this construct rely on the fact we always have our own explicit "everyone else" audience rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's supposed to stand on its own. If we don't have any audience rule set this means isInAnyAudience
will be false
. Which matches our expectations. If you don't have any rule set your experiment is always turned off.
927c403
to
9b32a6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Vini! 🚀
https://app.shortcut.com/findhotel/story/119714/upgrade-optimizely-sdk-and-opticks-to-latest-version