Skip to content
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

Add load options #66

Merged
merged 5 commits into from
Jul 6, 2021
Merged

Add load options #66

merged 5 commits into from
Jul 6, 2021

Conversation

mzogheib
Copy link
Contributor

@mzogheib mzogheib commented Jun 12, 2021

Reference: #65

Usage

  const content = snippet.min({
    apiKey,
    load: {
      integrations: {
        All: false,
        'Google Analytics': true,
        AdRoll: true,
        Hotjar: true,
      },
    },
  });
  • I don't believe the snippet tests need to be updated but please advise if I'm mistaken
  • I npm-linked these changes to my own project and all working as expected
    image

@juliofarah
Copy link
Contributor

juliofarah commented Jun 29, 2021

@mzogheib Thank you so much for your contribution and I'm sorry we didn't have time to take a look at it earlier!
The changes look good to me, just left a small comment!

I npm-linked these changes to my own project and all working as expected

Would you mind adding a screenshot showing the analytics.Integrations object, or any other screenshot showing the changes working end-to-end? I'll merge these and ship a new version as soon as you get back to me!

Cheers

Comment on lines +90 to +94
if (typeof settings.load !== 'boolean') {
// eslint-disable-next-line no-restricted-globals
var loadOptions = JSON.stringify(settings.load);
return 'analytics.load("' + settings.apiKey + '", ' + loadOptions + ');';
}
Copy link
Contributor

@juliofarah juliofarah Jun 30, 2021

Choose a reason for hiding this comment

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

In order to be fully compliant with the typescript definitions added on #55 it'd be great if we could change the type of load?: boolean to something like

type LoadOptions = boolean | { ... }

// ...
load?: LoadOptions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added LoadOptions. Here is my IDE suggesting the All member. I added this one explicitly as it's a known property but can be omitted if preferred.

image

@mzogheib
Copy link
Contributor Author

mzogheib commented Jul 4, 2021

@mzogheib Thank you so much for your contribution and I'm sorry we didn't have time to take a look at it earlier!
The changes look good to me, just left a small comment!

I npm-linked these changes to my own project and all working as expected

Would you mind adding a screenshot showing the analytics.Integrations object, or any other screenshot showing the changes working end-to-end? I'll merge these and ship a new version as soon as you get back to me!

Cheers

Thanks @juliofarah and no problem! I'll provide this soon and address your other comments too.

@mzogheib mzogheib requested a review from juliofarah July 4, 2021 01:29
@codecov-commenter
Copy link

Codecov Report

Merging #66 (cef1348) into master (caf07ab) will not change coverage.
The diff coverage is 100.00%.

❗ Current head cef1348 differs from pull request most recent head c071127. Consider uploading reports for the commit c071127 to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##            master       #66   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           33        36    +3     
  Branches        11        12    +1     
=========================================
+ Hits            33        36    +3     
Impacted Files Coverage Δ
lib/index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update caf07ab...c071127. Read the comment docs.

@juliofarah juliofarah merged commit 0b29331 into segmentio:master Jul 6, 2021
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