@hogsend/plugin-discord 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hogsend/plugin-discord",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@hogsend/engine": "^0.22.0"
26
+ "@hogsend/engine": "^0.23.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "discord.js": ">=14.0.0"
@@ -2,10 +2,11 @@ import type { DiscordCurrentUser } from "./oauth.js";
2
2
 
3
3
  /**
4
4
  * The shape a per-member link reduces to: the args for a single
5
- * `resolveOrCreateContact({ email?, discordId })` call (the consumer's
5
+ * `client.identity.linkContact({ email?, discordId })` call (the consumer's
6
6
  * `resolveContact` callback forwards it). No bespoke merge path — the engine's
7
7
  * existing identity machinery folds the Discord-only contact onto the
8
- * email/identified one (or fills `discord_id` in when only the email resolves).
8
+ * email/identified one (or fills `discord_id` in when only the email resolves),
9
+ * and `linkContact` propagates the resulting analytics merge (§7).
9
10
  */
10
11
  export interface DiscordMemberLink {
11
12
  /** The Discord user the member linked. */
package/src/connector.ts CHANGED
@@ -251,13 +251,20 @@ export interface CreateDiscordConnectorConfig {
251
251
  /** Persist server-derived Discord config (kind="derived"). */
252
252
  saveDerived: (patch: Record<string, unknown>) => Promise<void>;
253
253
  /**
254
- * Resolve / merge the member-linked contact (the consumer wires this to the
255
- * engine's `resolveOrCreateContact`). The ONLY correct wiring is
256
- * `resolveOrCreateContact({ discordId: patch.discordId, email: patch.email,
257
- * contactProperties: patch.contactProperties })` — routing the raw snowflake
258
- * through the `discord` identity Kind so the `discord_id` column is
259
- * load-bearing. `email` is the AUTHORITATIVE address the link was issued for
260
- * (from the engine-verified state), NOT the OAuth-reported Discord email.
254
+ * Resolve / merge the member-linked contact. The consumer wires this to the
255
+ * engine's identity-attach helper `client.identity.linkContact({ discordId:
256
+ * patch.discordId, email: patch.email, contactProperties:
257
+ * patch.contactProperties })` — routing the raw snowflake through the `discord`
258
+ * identity Kind so the `discord_id` column is load-bearing. `email` is the
259
+ * AUTHORITATIVE address the link was issued for (from the engine-verified
260
+ * state), NOT the OAuth-reported Discord email.
261
+ *
262
+ * Use `client.identity.linkContact` (NOT bare `resolveOrCreateContact`): on a
263
+ * successful `/link` contact-merge it propagates the analytics merge through
264
+ * the SAME engine emission ingest uses (§7), folding the discord-keyed loser
265
+ * into the canonical (email/external) survivor so Discord-platform events stop
266
+ * landing on a separate PostHog person. `resolveOrCreateContact` alone merges
267
+ * the rows but emits no PostHog merge.
261
268
  */
262
269
  resolveContact: (patch: {
263
270
  discordId: string;