Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion packages/client/src/clients/guide/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,11 @@ export class KnockGuideClient {

this.store.setState((state) => ({
...state,
debug: { ...debugOpts, debugging: true },
debug: {
skipEngagementTracking: true,
...debugOpts,
debugging: true,
},
}));

if (shouldRefetch) {
Expand Down Expand Up @@ -970,6 +974,13 @@ export class KnockGuideClient {
});
if (!updatedStep) return;

if (this.shouldSkipEngagementApi()) {
this.knock.log(
"[Guide] Skipping engagement API call for markAsSeen (debug mode)",
);
return updatedStep;
}

const params = {
...this.buildEngagementEventBaseParams(guide, updatedStep),
content: updatedStep.content,
Expand Down Expand Up @@ -1000,6 +1011,13 @@ export class KnockGuideClient {
});
if (!updatedStep) return;

if (this.shouldSkipEngagementApi()) {
this.knock.log(
"[Guide] Skipping engagement API call for markAsInteracted (debug mode)",
);
return updatedStep;
}

const params = {
...this.buildEngagementEventBaseParams(guide, updatedStep),
metadata,
Expand All @@ -1025,6 +1043,13 @@ export class KnockGuideClient {
});
if (!updatedStep) return;

if (this.shouldSkipEngagementApi()) {
this.knock.log(
"[Guide] Skipping engagement API call for markAsArchived (debug mode)",
);
return updatedStep;
}

const params = this.buildEngagementEventBaseParams(guide, updatedStep);

this.knock.user.markGuideStepAs<MarkAsArchivedParams, MarkGuideAsResponse>(
Expand All @@ -1038,6 +1063,10 @@ export class KnockGuideClient {
return updatedStep;
}

private shouldSkipEngagementApi(): boolean {
return !!this.store.state.debug?.skipEngagementTracking;
}

//
// Helpers
//
Expand Down
1 change: 1 addition & 0 deletions packages/client/src/clients/guide/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export type DebugState = {
debugging?: boolean;
forcedGuideKey?: string | null;
previewSessionId?: string | null;
skipEngagementTracking?: boolean;
};

export type StoreState = {
Expand Down
Loading
Loading