@indexnetwork/protocol 66.0.0-rc.624.1 → 66.0.0-rc.628.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Added
6
+
7
+ - `OpportunityDetection.source` gains `'introducer'`, stamped on opportunities a third party opens.
8
+
3
9
  ## 66.0.0
4
10
 
5
11
  ### Breaking changes
@@ -60,8 +60,9 @@ export declare function presentOpportunityCard(deps: OpportunityCardsDeps, oppor
60
60
  }): Promise<OpportunityCard | null>;
61
61
  /**
62
62
  * List the viewer's opportunities in the given statuses as presented cards,
63
- * newest first, one card per counterpart. Cards whose presentation fails are
64
- * dropped.
63
+ * newest first, one card per counterpart. A not-a-fit (rejected) row never
64
+ * takes that slot from another status for the same person. Cards whose
65
+ * presentation fails are dropped.
65
66
  *
66
67
  * @param deps - Database, cache, and presenter.
67
68
  * @param input - Viewer, statuses, optional network/intent scope, limit, cache bypass, skeleton mode.
@@ -113,8 +113,9 @@ export async function presentOpportunityCard(deps, opportunity, viewerId, option
113
113
  }
114
114
  /**
115
115
  * List the viewer's opportunities in the given statuses as presented cards,
116
- * newest first, one card per counterpart. Cards whose presentation fails are
117
- * dropped.
116
+ * newest first, one card per counterpart. A not-a-fit (rejected) row never
117
+ * takes that slot from another status for the same person. Cards whose
118
+ * presentation fails are dropped.
118
119
  *
119
120
  * @param deps - Database, cache, and presenter.
120
121
  * @param input - Viewer, statuses, optional network/intent scope, limit, cache bypass, skeleton mode.
@@ -131,7 +132,12 @@ export async function listOpportunityCards(deps, input) {
131
132
  const requested = new Set(input.statuses);
132
133
  const visible = raw
133
134
  .filter((opp) => requested.has(opp.status) && canUserSeeOpportunity(opp.actors, opp.status, viewerId))
134
- .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
135
+ .sort((a, b) => {
136
+ const failed = Number(a.status === 'rejected') - Number(b.status === 'rejected');
137
+ if (failed !== 0)
138
+ return failed;
139
+ return b.createdAt.getTime() - a.createdAt.getTime();
140
+ });
135
141
  const seen = new Set();
136
142
  const opportunities = visible.filter((opp) => {
137
143
  const ids = counterpartUserIds(opp, viewerId);
@@ -78,7 +78,7 @@ export interface UserSocial {
78
78
  }
79
79
  /** Detection metadata recorded when an opportunity is created. */
80
80
  export interface OpportunityDetection {
81
- source: 'opportunity_graph' | 'chat' | 'cron' | 'member_added';
81
+ source: 'opportunity_graph' | 'chat' | 'cron' | 'member_added' | 'introducer';
82
82
  createdBy?: Id<'users'> | string;
83
83
  createdByName?: string;
84
84
  triggeredBy?: Id<'intents'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "66.0.0-rc.624.1",
3
+ "version": "66.0.0-rc.628.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",