@hebcal/rest-api
Advanced tools
Comparing version 3.12.0 to 3.13.0
@@ -1,2 +0,2 @@ | ||
/*! @hebcal/rest-api v3.12.0 */ | ||
/*! @hebcal/rest-api v3.13.0 */ | ||
'use strict'; | ||
@@ -348,12 +348,56 @@ | ||
function appendIsraelAndTracking(url, il, utmSource, utmMedium, utmCampaign) { | ||
if (url.substring(0, 22) !== 'https://www.hebcal.com') { | ||
utmSource = 'hebcal.com'; | ||
} else if (il && url.indexOf('?') === -1) { | ||
url += '?i=on'; | ||
const u = new URL(url); | ||
const isHebcal = u.host === 'www.hebcal.com'; | ||
if (isHebcal) { | ||
if (il) { | ||
u.searchParams.set('i', 'on'); | ||
} | ||
const path = u.pathname; | ||
const isHolidays = path.startsWith('/holidays/'); | ||
const isSedrot = path.startsWith('/sedrot/'); | ||
if (isHolidays || isSedrot) { | ||
u.host = 'hebcal.com'; | ||
if (isHolidays) { | ||
u.pathname = '/h/' + path.substring(10); | ||
} else { | ||
u.pathname = '/s/' + path.substring(8); | ||
} | ||
if (!utmCampaign || !(utmCampaign.startsWith('ical-') || utmCampaign.startsWith('pdf-'))) { | ||
if (utmSource) { | ||
u.searchParams.set('us', utmSource); | ||
} | ||
if (utmMedium) { | ||
u.searchParams.set('um', utmMedium); | ||
} | ||
} | ||
if (utmCampaign) { | ||
u.searchParams.set('uc', utmCampaign); | ||
} | ||
return u.toString(); | ||
} | ||
} | ||
const sep = url.indexOf('?') === -1 ? '?' : '&'; | ||
const utm = `utm_source=${utmSource}&utm_medium=${utmMedium}`; | ||
const campaign = utmCampaign ? `&utm_campaign=${utmCampaign}` : ''; | ||
return url + sep + utm + campaign; | ||
utmSource = isHebcal ? utmSource : 'hebcal.com'; | ||
if (utmSource) { | ||
u.searchParams.set('utm_source', utmSource); | ||
} | ||
if (utmMedium) { | ||
u.searchParams.set('utm_medium', utmMedium); | ||
} | ||
if (utmCampaign) { | ||
u.searchParams.set('utm_campaign', utmCampaign); | ||
} | ||
return u.toString(); | ||
} | ||
@@ -498,3 +542,3 @@ /** | ||
}; | ||
['admin1', 'asciiname', 'geo', 'zip', 'state', 'geonameid'].forEach(k => { | ||
['admin1', 'asciiname', 'geo', 'zip', 'state', 'stateName', 'geonameid'].forEach(k => { | ||
if (location[k]) { | ||
@@ -501,0 +545,0 @@ result.location[k] = location[k]; |
{ | ||
"name": "@hebcal/rest-api", | ||
"version": "3.12.0", | ||
"version": "3.13.0", | ||
"author": "Michael J. Radwin (https://github.com/mjradwin)", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@hebcal/core": "^3.33.1", | ||
"@hebcal/core": "^3.33.3", | ||
"@hebcal/leyning": "^4.12.1" | ||
@@ -43,9 +43,2 @@ }, | ||
], | ||
"babel": { | ||
"testOptions": { | ||
"presets": [ | ||
"@babel/env" | ||
] | ||
} | ||
}, | ||
"inherit": true, | ||
@@ -55,19 +48,18 @@ "verbose": true | ||
"devDependencies": { | ||
"@ava/babel": "^2.0.0", | ||
"@babel/core": "^7.16.10", | ||
"@babel/core": "^7.17.5", | ||
"@babel/preset-env": "^7.16.11", | ||
"@babel/register": "^7.16.9", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^21.0.1", | ||
"@babel/register": "^7.17.0", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"@rollup/plugin-commonjs": "^21.0.2", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^13.1.3", | ||
"ava": "^3.15.0", | ||
"core-js": "^3.20.3", | ||
"eslint": "^8.7.0", | ||
"ava": "^4.1.0", | ||
"core-js": "^3.21.1", | ||
"eslint": "^8.10.0", | ||
"eslint-config-google": "^0.14.0", | ||
"jsdoc": "^3.6.7", | ||
"jsdoc-to-markdown": "^7.1.0", | ||
"rollup": "^2.64.0", | ||
"jsdoc": "^3.6.10", | ||
"jsdoc-to-markdown": "^7.1.1", | ||
"rollup": "^2.70.0", | ||
"rollup-plugin-terser": "^7.0.2" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
332451
15
6313
Updated@hebcal/core@^3.33.3