From 8834b686e00f6600309c99408c99b24f181d96a5 Mon Sep 17 00:00:00 2001 From: Pooya Jaferian Date: Thu, 17 Jun 2021 16:48:21 -0700 Subject: [PATCH 1/2] Add profitwell destination --- integrations/profitwell/.eslintrc | 9 ++ integrations/profitwell/.gitignore | 3 + integrations/profitwell/HISTORY.md | 4 + integrations/profitwell/LICENSE | 7 + integrations/profitwell/Makefile | 80 +++++++++++ integrations/profitwell/README.md | 10 ++ integrations/profitwell/karma.conf-ci.js | 1 + integrations/profitwell/karma.conf.js | 1 + integrations/profitwell/lib/index.js | 52 +++++++ integrations/profitwell/package.json | 54 ++++++++ integrations/profitwell/test/.eslintrc | 3 + integrations/profitwell/test/index.test.js | 153 +++++++++++++++++++++ 12 files changed, 377 insertions(+) create mode 100755 integrations/profitwell/.eslintrc create mode 100755 integrations/profitwell/.gitignore create mode 100755 integrations/profitwell/HISTORY.md create mode 100755 integrations/profitwell/LICENSE create mode 100755 integrations/profitwell/Makefile create mode 100755 integrations/profitwell/README.md create mode 100644 integrations/profitwell/karma.conf-ci.js create mode 100755 integrations/profitwell/karma.conf.js create mode 100644 integrations/profitwell/lib/index.js create mode 100755 integrations/profitwell/package.json create mode 100755 integrations/profitwell/test/.eslintrc create mode 100755 integrations/profitwell/test/index.test.js diff --git a/integrations/profitwell/.eslintrc b/integrations/profitwell/.eslintrc new file mode 100755 index 000000000..8f60c5ef8 --- /dev/null +++ b/integrations/profitwell/.eslintrc @@ -0,0 +1,9 @@ +{ + "parserOptions": { + "ecmaVersion": 6 + }, + "env": { + "browser": true + }, + "extends": "@segment/eslint-config/browser/legacy" +} diff --git a/integrations/profitwell/.gitignore b/integrations/profitwell/.gitignore new file mode 100755 index 000000000..3cf4b162c --- /dev/null +++ b/integrations/profitwell/.gitignore @@ -0,0 +1,3 @@ +coverage +node_modules +.idea diff --git a/integrations/profitwell/HISTORY.md b/integrations/profitwell/HISTORY.md new file mode 100755 index 000000000..06a8df035 --- /dev/null +++ b/integrations/profitwell/HISTORY.md @@ -0,0 +1,4 @@ +1.0.0 / 2019-05-10 +================== + + * First stab at Profitwell DotJS diff --git a/integrations/profitwell/LICENSE b/integrations/profitwell/LICENSE new file mode 100755 index 000000000..267460df1 --- /dev/null +++ b/integrations/profitwell/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2019 Chris Sperandio, Segment chris.sperandio@segment.com + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/integrations/profitwell/Makefile b/integrations/profitwell/Makefile new file mode 100755 index 000000000..86eb29bbc --- /dev/null +++ b/integrations/profitwell/Makefile @@ -0,0 +1,80 @@ +## +# Binaries +## + +ESLINT := node_modules/.bin/eslint +KARMA := node_modules/.bin/karma + +## +# Files +## + +LIBS = $(shell find lib -type f -name "*.js") +TESTS = $(shell find test -type f -name "*.test.js") +SUPPORT = $(wildcard karma.conf*.js) +ALL_FILES = $(LIBS) $(TESTS) $(SUPPORT) + +## +# Program options/flags +## + +# A list of options to pass to Karma +# Overriding this overwrites all options specified in this file (e.g. BROWSERS) +KARMA_FLAGS ?= + +# A list of Karma browser launchers to run +# http://karma-runner.github.io/0.13/config/browsers.html +BROWSERS ?= +ifdef BROWSERS +KARMA_FLAGS += --browsers $(BROWSERS) +endif + +ifdef CI +KARMA_CONF ?= karma.conf.ci.js +else +KARMA_CONF ?= karma.conf.js +endif + +# Mocha flags. +GREP ?= . + +## +# Tasks +## + +# Install node modules. +node_modules: package.json $(wildcard node_modules/*/package.json) + @npm install + @touch $@ + +# Install dependencies. +install: node_modules + +# Remove temporary files and build artifacts. +clean: + rm -rf *.log coverage +.PHONY: clean + +# Remove temporary files, build artifacts, and vendor dependencies. +distclean: clean + rm -rf node_modules +.PHONY: distclean + +# Lint JavaScript source files. +lint: install + @$(ESLINT) $(ALL_FILES) +.PHONY: lint + +# Attempt to fix linting errors. +fmt: install + @$(ESLINT) --fix $(ALL_FILES) +.PHONY: fmt + +# Run browser unit tests in a browser. +test-browser: install + @$(KARMA) start $(KARMA_FLAGS) $(KARMA_CONF) + +# Default test target. +test: lint test-browser +.PHONY: test +.DEFAULT_GOAL = test diff --git a/integrations/profitwell/README.md b/integrations/profitwell/README.md new file mode 100755 index 000000000..87e040df3 --- /dev/null +++ b/integrations/profitwell/README.md @@ -0,0 +1,10 @@ +# analytics.js-integration-profitwell-dotjs + +Profitwell DotJS integration for [Analytics.js][]. + +## License + +Released under the [MIT license](LICENSE). + +[Analytics.js]: https://segment.com/docs/libraries/analytics.js/ + diff --git a/integrations/profitwell/karma.conf-ci.js b/integrations/profitwell/karma.conf-ci.js new file mode 100644 index 000000000..2ba15b707 --- /dev/null +++ b/integrations/profitwell/karma.conf-ci.js @@ -0,0 +1 @@ +module.exports = require('../../karma.conf-ci.js'); diff --git a/integrations/profitwell/karma.conf.js b/integrations/profitwell/karma.conf.js new file mode 100755 index 000000000..8605180af --- /dev/null +++ b/integrations/profitwell/karma.conf.js @@ -0,0 +1 @@ +module.exports = require('../../karma.conf'); diff --git a/integrations/profitwell/lib/index.js b/integrations/profitwell/lib/index.js new file mode 100644 index 000000000..60138b609 --- /dev/null +++ b/integrations/profitwell/lib/index.js @@ -0,0 +1,52 @@ +'use strict'; + +var integration = require('@segment/analytics.js-integration'); +var Identify = require('segmentio-facade').Identify; + +var ProfitWell = module.exports = integration('ProfitWell') + .global('profitwell') + .option('publicApiToken') + .option('siteType', 'marketing') + .tag('