@bucketco/tracking-sdk
Advanced tools
Comparing version 2.2.0 to 2.2.1
{ | ||
"name": "@bucketco/tracking-sdk", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -103,9 +103,11 @@ "use strict"; | ||
function resolveUser(userId) { | ||
if (userId) { | ||
return userId; | ||
} | ||
if (persistUser) { | ||
return getSessionUser(); | ||
} | ||
else if (!userId) { | ||
else { | ||
err("No userId provided and persistUser is disabled"); | ||
} | ||
return userId; | ||
} | ||
@@ -439,8 +441,3 @@ /** | ||
} | ||
if (persistUser) { | ||
options.userId = getSessionUser(); | ||
} | ||
else if (!options.userId) { | ||
err("No userId provided and persistUser is disabled"); | ||
} | ||
const userId = resolveUser(options.userId); | ||
// Wait a tick before opening the feedback form, | ||
@@ -459,3 +456,3 @@ // to prevent the same click from closing it. | ||
onScoreSubmit: (data) => __awaiter(this, void 0, void 0, function* () { | ||
const res = yield feedback(Object.assign({ featureId: options.featureId, userId: options.userId, companyId: options.companyId, source: "widget" }, data)); | ||
const res = yield feedback(Object.assign({ featureId: options.featureId, userId, companyId: options.companyId, source: "widget" }, data)); | ||
const json = yield res.json(); | ||
@@ -467,3 +464,3 @@ return { feedbackId: json.feedbackId }; | ||
// Default onSubmit handler | ||
yield feedback(Object.assign({ featureId: options.featureId, userId: options.userId, companyId: options.companyId, source: "widget" }, data)); | ||
yield feedback(Object.assign({ featureId: options.featureId, userId, companyId: options.companyId, source: "widget" }, data)); | ||
(_c = options.onAfterSubmit) === null || _c === void 0 ? void 0 : _c.call(options, data); | ||
@@ -470,0 +467,0 @@ }), |
@@ -5,13 +5,5 @@ declare const _default: { | ||
version: string; | ||
user: (userId: string, attributes?: { | ||
[key: string]: any; | ||
name?: string | undefined; | ||
} | undefined, context?: import("./types").Context | undefined) => Promise<Response>; | ||
company: (companyId: string, attributes?: { | ||
[key: string]: any; | ||
name?: string | undefined; | ||
} | null | undefined, userId?: string | undefined, context?: import("./types").Context | undefined) => Promise<Response>; | ||
track: (eventName: string, attributes?: { | ||
[key: string]: any; | ||
} | null | undefined, userId?: string | undefined, companyId?: string | undefined, context?: import("./types").Context | undefined) => Promise<Response>; | ||
user: (userId: string, attributes?: Record<string, any> | undefined, context?: import("./types").Context | undefined) => Promise<Response>; | ||
company: (companyId: string, attributes?: Record<string, any> | null | undefined, userId?: string | undefined, context?: import("./types").Context | undefined) => Promise<Response>; | ||
track: (eventName: string, attributes?: Record<string, any> | null | undefined, userId?: string | undefined, companyId?: string | undefined, context?: import("./types").Context | undefined) => Promise<Response>; | ||
feedback: ({ feedbackId, featureId, question, score, userId, companyId, comment, promptId, promptedQuestion, source, }: import("./types").Feedback) => Promise<Response>; | ||
@@ -18,0 +10,0 @@ requestFeedback: (options: import("./types").RequestFeedbackOptions) => void; |
@@ -1,2 +0,2 @@ | ||
import type { Company, Context, Feedback, Key, Options, RequestFeedbackOptions, TrackedEvent, User } from "./types"; | ||
import type { Context, Feedback, Key, Options, RequestFeedbackOptions } from "./types"; | ||
export default function main(): { | ||
@@ -6,9 +6,9 @@ init: (key: Key, options?: Options) => void; | ||
version: string; | ||
user: (userId: User["userId"], attributes?: User["attributes"], context?: Context) => Promise<Response>; | ||
company: (companyId: Company["companyId"], attributes?: Company["attributes"] | null, userId?: Company["userId"], context?: Context) => Promise<Response>; | ||
track: (eventName: TrackedEvent["event"], attributes?: TrackedEvent["attributes"] | null, userId?: Company["userId"], companyId?: Company["companyId"], context?: Context) => Promise<Response>; | ||
user: (userId: string, attributes?: Record<string, any>, context?: Context) => Promise<Response>; | ||
company: (companyId: string, attributes?: Record<string, any> | null, userId?: string, context?: Context) => Promise<Response>; | ||
track: (eventName: string, attributes?: Record<string, any> | null, userId?: string, companyId?: string, context?: Context) => Promise<Response>; | ||
feedback: ({ feedbackId, featureId, question, score, userId, companyId, comment, promptId, promptedQuestion, source, }: Feedback) => Promise<Response>; | ||
requestFeedback: (options: RequestFeedbackOptions) => void; | ||
initLiveSatisfaction: (userId?: User["userId"]) => Promise<string | Response | undefined>; | ||
initLiveFeedback: (userId?: User["userId"]) => Promise<string | Response | undefined>; | ||
initLiveSatisfaction: (userId?: string) => Promise<string | Response | undefined>; | ||
initLiveFeedback: (userId?: string) => Promise<string | Response | undefined>; | ||
}; |
@@ -1,5 +0,5 @@ | ||
import { FeedbackPrompt, User } from "./types"; | ||
import { FeedbackPrompt } from "./types"; | ||
export declare const parsePromptMessage: (message: any) => FeedbackPrompt | undefined; | ||
export type FeedbackPromptCompletionHandler = () => void; | ||
export type FeedbackPromptDisplayHandler = (userId: User["userId"], prompt: FeedbackPrompt, completionHandler: FeedbackPromptCompletionHandler) => void; | ||
export declare const processPromptMessage: (userId: User["userId"], prompt: FeedbackPrompt, displayHandler: FeedbackPromptDisplayHandler) => boolean; | ||
export type FeedbackPromptDisplayHandler = (userId: string, prompt: FeedbackPrompt, completionHandler: FeedbackPromptCompletionHandler) => void; | ||
export declare const processPromptMessage: (userId: string, prompt: FeedbackPrompt, displayHandler: FeedbackPromptDisplayHandler) => boolean; |
@@ -41,3 +41,3 @@ import { FeedbackPosition, FeedbackSubmission, FeedbackTranslations, OpenFeedbackFormOptions } from "./feedback/types"; | ||
export type Company = { | ||
userId: User["userId"]; | ||
userId: string; | ||
companyId: string; | ||
@@ -52,7 +52,5 @@ attributes?: { | ||
event: string; | ||
userId: User["userId"]; | ||
companyId?: Company["companyId"]; | ||
attributes?: { | ||
[key: string]: any; | ||
}; | ||
userId: string; | ||
companyId?: string; | ||
attributes?: Record<string, any>; | ||
context?: Context; | ||
@@ -97,7 +95,7 @@ }; | ||
*/ | ||
userId?: User["userId"]; | ||
userId?: string; | ||
/** | ||
* Company ID from your own application. | ||
*/ | ||
companyId?: Company["companyId"]; | ||
companyId?: string; | ||
/** | ||
@@ -143,9 +141,9 @@ * The question that was presented to the user. | ||
promptId: string; | ||
featureId: Feedback["featureId"]; | ||
featureId: string; | ||
}; | ||
export type FeedbackPromptReply = { | ||
question: string; | ||
companyId?: Company["companyId"]; | ||
score?: FeedbackSubmission["score"]; | ||
comment?: FeedbackSubmission["comment"]; | ||
companyId?: string; | ||
score?: number; | ||
comment?: string; | ||
}; | ||
@@ -152,0 +150,0 @@ export type FeedbackPromptReplyHandler = <T extends FeedbackPromptReply | null>(reply: T) => T extends null ? Promise<void> : Promise<{ |
{ | ||
"name": "@bucketco/tracking-sdk", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "private": false, |
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
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
363656
2455