From 5c7c86f4ff5a12c9cf020a625bc02bc22e199dbe Mon Sep 17 00:00:00 2001 From: strausr Date: Mon, 6 Jul 2020 11:39:50 +0300 Subject: [PATCH] changed analytics to urlAnalytics (#245) --- src/url.js | 2 +- test/spec/get-sdk-analytics-spec.js | 12 ++++++------ types/cloudinary-core.d.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/url.js b/src/url.js index 0bdd73c9..0639e579 100644 --- a/src/url.js +++ b/src/url.js @@ -367,7 +367,7 @@ export default function url(publicId, options = {}, config = {}) { throw error; } let resultUrl = urlString(publicId, options); - if(options.analytics) { + if(options.urlAnalytics) { let analyticsOptions = getAnalyticsOptions(options); let sdkAnalyticsSignature = getSDKAnalyticsSignature(analyticsOptions); // url might already have a '?' query param diff --git a/test/spec/get-sdk-analytics-spec.js b/test/spec/get-sdk-analytics-spec.js index 0f4e51b4..34fadba8 100644 --- a/test/spec/get-sdk-analytics-spec.js +++ b/test/spec/get-sdk-analytics-spec.js @@ -21,20 +21,20 @@ describe('Tests for sdk analytics util', function () { }); it('should not append analytics if false', function () { - cl = cloudinary.Cloudinary.new({cloud_name: 'sdk-test', analytics: false}); + cl = cloudinary.Cloudinary.new({cloud_name: 'sdk-test', urlAnalytics: false}); let img = cl.url("sample", {techVersion: '12.0.0', sdkSemver: '1.24.0', sdkCode: 'M'}); expect(img).toEqual('http://res.cloudinary.com/sdk-test/image/upload/sample'); }); - it('creates the correct sdk analytics x.y.z', function () { - cl = cloudinary.Cloudinary.new({cloud_name: 'sdk-test', analytics: true}); + it('creates the correct sdk urlAnalytics x.y.z', function () { + cl = cloudinary.Cloudinary.new({cloud_name: 'sdk-test', urlAnalytics: true}); let img = cl.url("sample", {techVersion: '12.0.0', sdkSemver: '1.24.0', sdkCode: 'M'}); expect(img).toEqual('http://res.cloudinary.com/sdk-test/image/upload/sample?_a=AMAlhAM0'); }); - it('creates the correct sdk analytics', function () { - cl = cloudinary.Cloudinary.new({cloud_name: 'sdk-test', analytics: true}); + it('creates the correct sdk urlAnalytics', function () { + cl = cloudinary.Cloudinary.new({cloud_name: 'sdk-test', urlAnalytics: true}); // Sanity check taken from node let img = cl.url("sample", {techVersion: '12.0', sdkSemver: '1.24.0', sdkCode: 'M'}); expect(img).toEqual('http://res.cloudinary.com/sdk-test/image/upload/sample?_a=AMAlhAM0'); @@ -50,7 +50,7 @@ describe('Tests for sdk analytics util', function () { expect(img).toEqual('http://res.cloudinary.com/sdk-test/image/upload/sample?_a=AKABqDJC'); }); it('Handles invalid arguments gracefully', function () { - cl = cloudinary.Cloudinary.new({cloud_name: 'sdk-test', analytics: true}); + cl = cloudinary.Cloudinary.new({cloud_name: 'sdk-test', urlAnalytics: true}); let img = cl.url("sample", {techVersion: 'abcdefg', sdkSemver: 'abcdefg', sdkCode: 'M'}); diff --git a/types/cloudinary-core.d.ts b/types/cloudinary-core.d.ts index 1ca094ea..b278858b 100644 --- a/types/cloudinary-core.d.ts +++ b/types/cloudinary-core.d.ts @@ -38,7 +38,7 @@ type AnalyticsOptionsParameters = { sdkSemver: string; techVersion: string; sdkCode: string; - analytics?: boolean; + urlAnalytics?: boolean; accessibility?: boolean; loading?: string; responsive?: boolean;