cohere-js
Advanced tools
Comparing version 1.0.13 to 1.0.14
@@ -22,3 +22,5 @@ const hookInputSetter = (target, key) => { | ||
if (typeof userId === "string") { | ||
const traits = typeof args[1] === "object" ? args[1] : {}; | ||
const traits = args[1] && typeof args[1] === "object" | ||
? args[1] | ||
: {}; | ||
// Rename name to displayName | ||
@@ -52,7 +54,3 @@ const { name: displayName, ...rest } = traits; | ||
const noopModule = { | ||
init: (_, options) => { | ||
if (options === null || options === void 0 ? void 0 : options.segmentIntegration) { | ||
hookSegment(); | ||
} | ||
}, | ||
init: noop, | ||
identify: noop, | ||
@@ -70,3 +68,3 @@ stop: noop, | ||
Cohere.invoked = true; | ||
Cohere.snippet = "0.5"; | ||
Cohere.snippet = "0.6"; | ||
Cohere.valhook = true; | ||
@@ -77,2 +75,8 @@ Cohere.methods = bridgedMethods; | ||
Cohere[method] = (...args) => { | ||
if (method === "init") { | ||
const options = args[1]; | ||
if (options === null || options === void 0 ? void 0 : options.segmentIntegration) { | ||
hookSegment(); | ||
} | ||
} | ||
args.unshift(method); | ||
@@ -79,0 +83,0 @@ Cohere.push(args); |
@@ -24,3 +24,5 @@ 'use strict'; | ||
if (typeof userId === "string") { | ||
const traits = typeof args[1] === "object" ? args[1] : {}; | ||
const traits = args[1] && typeof args[1] === "object" | ||
? args[1] | ||
: {}; | ||
// Rename name to displayName | ||
@@ -54,7 +56,3 @@ const { name: displayName, ...rest } = traits; | ||
const noopModule = { | ||
init: (_, options) => { | ||
if (options === null || options === void 0 ? void 0 : options.segmentIntegration) { | ||
hookSegment(); | ||
} | ||
}, | ||
init: noop, | ||
identify: noop, | ||
@@ -72,3 +70,3 @@ stop: noop, | ||
Cohere.invoked = true; | ||
Cohere.snippet = "0.5"; | ||
Cohere.snippet = "0.6"; | ||
Cohere.valhook = true; | ||
@@ -79,2 +77,8 @@ Cohere.methods = bridgedMethods; | ||
Cohere[method] = (...args) => { | ||
if (method === "init") { | ||
const options = args[1]; | ||
if (options === null || options === void 0 ? void 0 : options.segmentIntegration) { | ||
hookSegment(); | ||
} | ||
} | ||
args.unshift(method); | ||
@@ -81,0 +85,0 @@ Cohere.push(args); |
{ | ||
"name": "cohere-js", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "Cohere.so JS SDK", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
7817
208