@select-org/select-post-builder 1.2.8 → 1.3.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/dist/index.d.ts +11 -11
- package/dist/post-builder.cjs.js +47 -47
- package/dist/post-builder.js +27 -30
- package/package.json +1 -1
package/dist/post-builder.js
CHANGED
|
@@ -20540,8 +20540,8 @@ const ANALYTICS_EVENTS = {
|
|
|
20540
20540
|
},
|
|
20541
20541
|
// Editor interaction
|
|
20542
20542
|
EDITOR: {
|
|
20543
|
-
FOCUSED: "
|
|
20544
|
-
TAB_SWITCHED: "
|
|
20543
|
+
FOCUSED: "post_builder_focused",
|
|
20544
|
+
TAB_SWITCHED: "post_builder_tab_switched"
|
|
20545
20545
|
},
|
|
20546
20546
|
// Feature discovery
|
|
20547
20547
|
FEATURE: {
|
|
@@ -20578,11 +20578,6 @@ const ANALYTICS_EVENTS = {
|
|
|
20578
20578
|
ATTEMPTED: "post_builder_publish_attempted",
|
|
20579
20579
|
SUCCESS: "post_builder_publish_success",
|
|
20580
20580
|
FAILED: "post_builder_publish_failed"
|
|
20581
|
-
},
|
|
20582
|
-
// NEW: Validation
|
|
20583
|
-
VALIDATION: {
|
|
20584
|
-
ERROR: "post_builder_validation_error"
|
|
20585
|
-
// NEW
|
|
20586
20581
|
}
|
|
20587
20582
|
}, FEATURE_NAME_MAP = {
|
|
20588
20583
|
// Tiptap Marks (inline formatting)
|
|
@@ -21804,6 +21799,7 @@ const analyticsStore = createStore((u, n) => ({
|
|
|
21804
21799
|
enabled: !1,
|
|
21805
21800
|
debug: !1,
|
|
21806
21801
|
logEventFn: null,
|
|
21802
|
+
publishCrosspost: /* @__PURE__ */ new Map(),
|
|
21807
21803
|
initialize: (d, p = {}) => {
|
|
21808
21804
|
u({
|
|
21809
21805
|
logEventFn: d,
|
|
@@ -21811,16 +21807,18 @@ const analyticsStore = createStore((u, n) => ({
|
|
|
21811
21807
|
debug: p.debug ?? !1
|
|
21812
21808
|
}), p.debug;
|
|
21813
21809
|
},
|
|
21814
|
-
createSession: (d, p) => {
|
|
21810
|
+
createSession: (d, p = EditorPlacement.Feed) => {
|
|
21815
21811
|
const { sessionManager: m, logEventFn: g, enabled: y, debug: b } = n(), S = m.createSession(d, p);
|
|
21816
21812
|
if (y && g) {
|
|
21817
|
-
const E =
|
|
21818
|
-
|
|
21819
|
-
|
|
21820
|
-
|
|
21821
|
-
|
|
21822
|
-
|
|
21823
|
-
|
|
21813
|
+
const E = pickBy(
|
|
21814
|
+
{
|
|
21815
|
+
compose_session_id: S,
|
|
21816
|
+
timestamp: Date.now(),
|
|
21817
|
+
editor_type: d,
|
|
21818
|
+
editor_placement: p
|
|
21819
|
+
},
|
|
21820
|
+
(T) => T != null
|
|
21821
|
+
);
|
|
21824
21822
|
g(ANALYTICS_EVENTS.SESSION.STARTED, E);
|
|
21825
21823
|
}
|
|
21826
21824
|
return S;
|
|
@@ -21838,7 +21836,7 @@ const analyticsStore = createStore((u, n) => ({
|
|
|
21838
21836
|
if (!E)
|
|
21839
21837
|
return;
|
|
21840
21838
|
const T = {
|
|
21841
|
-
|
|
21839
|
+
compose_session_id: d,
|
|
21842
21840
|
timestamp: Date.now(),
|
|
21843
21841
|
editor_type: E.editorType,
|
|
21844
21842
|
editor_placement: E.placement,
|
|
@@ -21847,32 +21845,35 @@ const analyticsStore = createStore((u, n) => ({
|
|
|
21847
21845
|
y(p, C);
|
|
21848
21846
|
},
|
|
21849
21847
|
trackPublish: (d, p) => {
|
|
21850
|
-
const { trackEvent: m, sessionManager: g } = n(),
|
|
21851
|
-
p.status === "attempted" ? m(d, ANALYTICS_EVENTS.PUBLISH.ATTEMPTED, {
|
|
21848
|
+
const { trackEvent: m, sessionManager: g, publishCrosspost: y } = n(), b = g.getSession(d), S = p.isCrosspost ?? y.get(p.postId) ?? !1;
|
|
21849
|
+
p.status === "attempted" ? (y.set(p.postId, S), m(d, ANALYTICS_EVENTS.PUBLISH.ATTEMPTED, {
|
|
21852
21850
|
editor_type: p.editorType,
|
|
21853
21851
|
post_id: p.postId,
|
|
21854
21852
|
group_id: p.groupId,
|
|
21855
21853
|
post_type: p.postType,
|
|
21854
|
+
is_crosspost: S,
|
|
21856
21855
|
word_count: p.wordCount,
|
|
21857
21856
|
media_count: p.mediaCount,
|
|
21858
21857
|
link_count: p.linkCount,
|
|
21859
21858
|
formatting_features: p.formattingFeatures
|
|
21860
|
-
}) : p.status === "success" ? m(d, ANALYTICS_EVENTS.PUBLISH.SUCCESS, {
|
|
21859
|
+
})) : p.status === "success" ? (y.delete(p.postId), m(d, ANALYTICS_EVENTS.PUBLISH.SUCCESS, {
|
|
21861
21860
|
editor_type: p.editorType,
|
|
21862
21861
|
post_id: p.postId,
|
|
21863
21862
|
group_id: p.groupId,
|
|
21864
21863
|
post_type: p.postType,
|
|
21864
|
+
is_crosspost: S,
|
|
21865
21865
|
word_count: p.wordCount,
|
|
21866
21866
|
media_count: p.mediaCount,
|
|
21867
21867
|
link_count: p.linkCount,
|
|
21868
21868
|
formatting_features: p.formattingFeatures,
|
|
21869
21869
|
// NEW
|
|
21870
|
-
session_duration_ms:
|
|
21871
|
-
}) : (g.setLastError(d, p.failureReason || "unknown"), m(d, ANALYTICS_EVENTS.PUBLISH.FAILED, {
|
|
21870
|
+
session_duration_ms: b ? Date.now() - b.startTime : void 0
|
|
21871
|
+
})) : (y.delete(p.postId), g.setLastError(d, p.failureReason || "unknown"), m(d, ANALYTICS_EVENTS.PUBLISH.FAILED, {
|
|
21872
21872
|
editor_type: p.editorType,
|
|
21873
21873
|
post_id: p.postId,
|
|
21874
21874
|
group_id: p.groupId,
|
|
21875
21875
|
post_type: p.postType,
|
|
21876
|
+
is_crosspost: S,
|
|
21876
21877
|
error_type: p.failureReason,
|
|
21877
21878
|
word_count: p.wordCount,
|
|
21878
21879
|
media_count: p.mediaCount,
|
|
@@ -21908,12 +21909,14 @@ const analyticsStore = createStore((u, n) => ({
|
|
|
21908
21909
|
p.markFocused(d);
|
|
21909
21910
|
const g = p.getSession(d), y = g?.focusTime ? g.focusTime - g.startTime : null;
|
|
21910
21911
|
m(d, ANALYTICS_EVENTS.EDITOR.FOCUSED, {
|
|
21912
|
+
surface: "editor",
|
|
21911
21913
|
time_to_focus_ms: y || void 0
|
|
21912
21914
|
});
|
|
21913
21915
|
},
|
|
21914
21916
|
trackTabSwitch: (d, p, m) => {
|
|
21915
21917
|
const { trackEvent: g } = n();
|
|
21916
21918
|
g(d, ANALYTICS_EVENTS.EDITOR.TAB_SWITCHED, {
|
|
21919
|
+
surface: "editor",
|
|
21917
21920
|
from_tab: p,
|
|
21918
21921
|
to_tab: m
|
|
21919
21922
|
});
|
|
@@ -21986,14 +21989,6 @@ const analyticsStore = createStore((u, n) => ({
|
|
|
21986
21989
|
option_count: p.option_count,
|
|
21987
21990
|
option_type: p.option_type
|
|
21988
21991
|
});
|
|
21989
|
-
},
|
|
21990
|
-
trackValidationError: (d, p) => {
|
|
21991
|
-
const { trackEvent: m } = n();
|
|
21992
|
-
m(d, ANALYTICS_EVENTS.VALIDATION.ERROR, {
|
|
21993
|
-
field: p.field,
|
|
21994
|
-
error_type: p.errorType,
|
|
21995
|
-
error_message: p.errorMessage
|
|
21996
|
-
});
|
|
21997
21992
|
}
|
|
21998
21993
|
}));
|
|
21999
21994
|
function useAnalyticsStore(u) {
|
|
@@ -22018,7 +22013,6 @@ function useAnalyticsTracking() {
|
|
|
22018
22013
|
trackLinkUnfurlFailed: (d) => n.trackLinkUnfurlFailed(u, d),
|
|
22019
22014
|
trackPollOptionAdded: (d) => n.trackPollOptionAdded(u, d),
|
|
22020
22015
|
trackPollOptionRemoved: (d) => n.trackPollOptionRemoved(u, d),
|
|
22021
|
-
trackValidationError: (d) => n.trackValidationError(u, d),
|
|
22022
22016
|
// Direct access to sessionId if needed
|
|
22023
22017
|
sessionId: u
|
|
22024
22018
|
}),
|
|
@@ -60779,6 +60773,9 @@ const PostBuilderEditorInstance = ({
|
|
|
60779
60773
|
status: "attempted",
|
|
60780
60774
|
postId: he?.postId,
|
|
60781
60775
|
postType: he?.type,
|
|
60776
|
+
// Same flag that just went into the backend payload above, so the row
|
|
60777
|
+
// says what was actually sent, not the checkbox at some earlier moment.
|
|
60778
|
+
isCrosspost: Q,
|
|
60782
60779
|
...ve
|
|
60783
60780
|
});
|
|
60784
60781
|
let be;
|
package/package.json
CHANGED