@jiggai/kitchen-plugin-marketing 0.5.0 → 0.5.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.
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "5",
3
+ "dialect": "sqlite",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "5",
8
+ "when": 1743811200000,
9
+ "tag": "0001_initial",
10
+ "breakpoints": true
11
+ }
12
+ ]
13
+ }
@@ -219,7 +219,20 @@ function initializeDatabase(teamId) {
219
219
  const migrationsDir = (0, import_path.join)(PLUGIN_ROOT, "db", "migrations");
220
220
  (0, import_migrator.migrate)(db, { migrationsFolder: migrationsDir });
221
221
  } catch (error) {
222
- console.warn("Migration warning:", error?.message);
222
+ try {
223
+ const sqlPath = (0, import_path.join)(PLUGIN_ROOT, "db", "migrations", "0001_initial.sql");
224
+ if ((0, import_fs.existsSync)(sqlPath)) {
225
+ const sql2 = require("fs").readFileSync(sqlPath, "utf8");
226
+ const statements = sql2.split(";").map((s) => s.trim()).filter((s) => s.length > 0);
227
+ for (const stmt of statements) {
228
+ try {
229
+ sqlite.exec(stmt + ";");
230
+ } catch {
231
+ }
232
+ }
233
+ }
234
+ } catch {
235
+ }
223
236
  }
224
237
  return { db, sqlite };
225
238
  }
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "5",
3
+ "dialect": "sqlite",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "5",
8
+ "when": 1743811200000,
9
+ "tag": "0001_initial",
10
+ "breakpoints": true
11
+ }
12
+ ]
13
+ }
package/dist/index.js CHANGED
@@ -204,7 +204,20 @@ function initializeDatabase(teamId) {
204
204
  const migrationsDir = (0, import_path.join)(PLUGIN_ROOT, "db", "migrations");
205
205
  (0, import_migrator.migrate)(db, { migrationsFolder: migrationsDir });
206
206
  } catch (error) {
207
- console.warn("Migration warning:", error?.message);
207
+ try {
208
+ const sqlPath = (0, import_path.join)(PLUGIN_ROOT, "db", "migrations", "0001_initial.sql");
209
+ if ((0, import_fs.existsSync)(sqlPath)) {
210
+ const sql2 = require("fs").readFileSync(sqlPath, "utf8");
211
+ const statements = sql2.split(";").map((s) => s.trim()).filter((s) => s.length > 0);
212
+ for (const stmt of statements) {
213
+ try {
214
+ sqlite.exec(stmt + ";");
215
+ } catch {
216
+ }
217
+ }
218
+ }
219
+ } catch {
220
+ }
208
221
  }
209
222
  return { db, sqlite };
210
223
  }
@@ -185,9 +185,9 @@
185
185
  background: "var(--ck-bg-base, #0b0c10)",
186
186
  border: "1px solid var(--ck-border-subtle)",
187
187
  borderRadius: "14px",
188
- width: "95vw",
189
- maxWidth: "900px",
190
- maxHeight: "90vh",
188
+ width: "96vw",
189
+ maxWidth: "1200px",
190
+ maxHeight: "92vh",
191
191
  overflow: "auto",
192
192
  display: "flex",
193
193
  flexDirection: "column"
@@ -201,7 +201,7 @@
201
201
  },
202
202
  modalBody: { display: "flex", flex: 1, minHeight: 0 },
203
203
  modalLeft: { flex: 1, padding: "1rem 1.25rem", borderRight: "1px solid var(--ck-border-subtle)", display: "flex", flexDirection: "column", gap: "0.75rem" },
204
- modalRight: { width: "280px", padding: "1rem 1.25rem", flexShrink: 0 },
204
+ modalRight: { width: "380px", padding: "1rem 1.25rem", flexShrink: 0 },
205
205
  modalFooter: {
206
206
  display: "flex",
207
207
  alignItems: "center",
@@ -823,12 +823,118 @@
823
823
  placeholder: "Paste image or video URL\u2026"
824
824
  })
825
825
  ),
826
- // Right — preview
826
+ // Right — social-post-style preview
827
827
  h(
828
828
  "div",
829
829
  { style: s.modalRight },
830
- h("div", { style: { fontWeight: 600, fontSize: "0.9rem", color: "var(--ck-text-primary)", marginBottom: "0.5rem" } }, "Post Preview"),
831
- modalContent.trim() ? h("div", { style: { ...s.previewPanel, whiteSpace: "pre-wrap", fontSize: "0.85rem", color: "var(--ck-text-secondary)" } }, modalContent) : h("div", { style: { color: "var(--ck-text-tertiary)", fontSize: "0.85rem" } }, "Start writing your post for a preview")
830
+ h("div", { style: { fontWeight: 600, fontSize: "0.85rem", color: "var(--ck-text-secondary)", marginBottom: "0.75rem" } }, "Post Preview"),
831
+ h(
832
+ "div",
833
+ {
834
+ style: {
835
+ background: "rgba(22,22,28,0.95)",
836
+ borderRadius: "12px",
837
+ border: "1px solid rgba(255,255,255,0.08)",
838
+ overflow: "hidden"
839
+ }
840
+ },
841
+ // Header
842
+ h(
843
+ "div",
844
+ { style: { display: "flex", alignItems: "center", gap: "0.65rem", padding: "0.85rem 1rem 0" } },
845
+ h("div", {
846
+ style: {
847
+ width: "40px",
848
+ height: "40px",
849
+ borderRadius: "50%",
850
+ background: "rgba(127,90,240,0.25)",
851
+ display: "flex",
852
+ alignItems: "center",
853
+ justifyContent: "center",
854
+ fontSize: "1.1rem",
855
+ color: "rgba(127,90,240,0.9)",
856
+ flexShrink: 0
857
+ }
858
+ }, "\u{1F464}"),
859
+ h(
860
+ "div",
861
+ null,
862
+ h(
863
+ "div",
864
+ { style: { display: "flex", alignItems: "center", gap: "0.3rem" } },
865
+ h("span", { style: { fontWeight: 700, fontSize: "0.9rem", color: "var(--ck-text-primary)" } }, "Your Brand"),
866
+ h("span", { style: { color: "rgba(99,179,237,0.9)", fontSize: "0.85rem" } }, "\u2713")
867
+ ),
868
+ h(
869
+ "div",
870
+ { style: { fontSize: "0.75rem", color: "var(--ck-text-tertiary)" } },
871
+ modalDate ? new Date(modalDate).toLocaleDateString(void 0, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }) : "Just now"
872
+ )
873
+ )
874
+ ),
875
+ // Body
876
+ h(
877
+ "div",
878
+ { style: { padding: "0.65rem 1rem 0.75rem" } },
879
+ modalContent.trim() ? h("div", {
880
+ style: {
881
+ whiteSpace: "pre-wrap",
882
+ fontSize: "0.9rem",
883
+ color: "var(--ck-text-primary)",
884
+ lineHeight: "1.5",
885
+ maxHeight: "300px",
886
+ overflowY: "auto",
887
+ wordBreak: "break-word"
888
+ }
889
+ }, modalContent) : h("div", {
890
+ style: { color: "var(--ck-text-tertiary)", fontSize: "0.85rem", fontStyle: "italic", padding: "1.5rem 0", textAlign: "center" }
891
+ }, "Start writing to see a preview")
892
+ ),
893
+ // Media preview
894
+ modalMediaUrl && h("img", {
895
+ src: modalMediaUrl,
896
+ style: { width: "100%", display: "block" },
897
+ onError: (e) => {
898
+ e.target.style.display = "none";
899
+ }
900
+ }),
901
+ // Engagement bar
902
+ h(
903
+ "div",
904
+ {
905
+ style: {
906
+ display: "flex",
907
+ justifyContent: "space-around",
908
+ padding: "0.6rem 1rem",
909
+ borderTop: "1px solid rgba(255,255,255,0.06)",
910
+ fontSize: "0.8rem",
911
+ color: "var(--ck-text-tertiary)"
912
+ }
913
+ },
914
+ h("span", null, "\u2764\uFE0F 0"),
915
+ h("span", null, "\u{1F4AC} 0"),
916
+ h("span", null, "\u{1F501} 0"),
917
+ h("span", null, "\u{1F4CA} 0")
918
+ )
919
+ ),
920
+ // Platform pills
921
+ modalPlatforms.length > 0 && h(
922
+ "div",
923
+ {
924
+ style: { display: "flex", flexWrap: "wrap", gap: "0.35rem", marginTop: "0.65rem" }
925
+ },
926
+ ...modalPlatforms.map((pl) => h("span", {
927
+ key: pl,
928
+ style: {
929
+ background: "rgba(127,90,240,0.12)",
930
+ border: "1px solid rgba(127,90,240,0.25)",
931
+ borderRadius: "999px",
932
+ padding: "0.1rem 0.4rem",
933
+ fontSize: "0.7rem",
934
+ color: "var(--ck-text-secondary)"
935
+ }
936
+ }, pl))
937
+ )
832
938
  )
833
939
  ),
834
940
  // Footer
@@ -683,118 +683,181 @@
683
683
  error && h("div", { className: "text-xs", style: { color: "rgba(248,113,113,0.95)" } }, error),
684
684
  success && h("div", { className: "text-xs", style: { color: "rgba(74,222,128,0.9)" } }, success)
685
685
  ),
686
- // RIGHT — live preview pane
686
+ // RIGHT — social-post-style preview
687
687
  h(
688
688
  "div",
689
689
  {
690
690
  style: {
691
- width: "320px",
691
+ width: "380px",
692
692
  flexShrink: 0,
693
- background: "rgba(255,255,255,0.02)",
693
+ background: "rgba(0,0,0,0.25)",
694
694
  border: "1px solid var(--ck-border-subtle)",
695
- borderRadius: "10px",
696
- padding: "1rem",
695
+ borderRadius: "16px",
696
+ padding: "1.25rem",
697
697
  display: "flex",
698
698
  flexDirection: "column",
699
699
  alignSelf: "flex-start"
700
700
  }
701
701
  },
702
- h("div", { className: "text-sm font-medium mb-3", style: t.text }, "Post Preview"),
703
- // Selected platforms
702
+ h("div", {
703
+ style: { fontSize: "0.85rem", fontWeight: 600, color: "var(--ck-text-secondary)", marginBottom: "1rem" }
704
+ }, "Post Preview"),
705
+ // Social post card
706
+ h(
707
+ "div",
708
+ {
709
+ style: {
710
+ background: "rgba(22,22,28,0.95)",
711
+ borderRadius: "12px",
712
+ border: "1px solid rgba(255,255,255,0.08)",
713
+ overflow: "hidden"
714
+ }
715
+ },
716
+ // Post header (avatar + name + handle)
717
+ h(
718
+ "div",
719
+ {
720
+ style: {
721
+ display: "flex",
722
+ alignItems: "center",
723
+ gap: "0.65rem",
724
+ padding: "0.85rem 1rem 0"
725
+ }
726
+ },
727
+ // Avatar circle
728
+ h("div", {
729
+ style: {
730
+ width: "40px",
731
+ height: "40px",
732
+ borderRadius: "50%",
733
+ background: "rgba(127,90,240,0.25)",
734
+ display: "flex",
735
+ alignItems: "center",
736
+ justifyContent: "center",
737
+ fontSize: "1.1rem",
738
+ color: "rgba(127,90,240,0.9)",
739
+ flexShrink: 0
740
+ }
741
+ }, "\u{1F464}"),
742
+ h(
743
+ "div",
744
+ null,
745
+ h(
746
+ "div",
747
+ { style: { display: "flex", alignItems: "center", gap: "0.3rem" } },
748
+ h("span", {
749
+ style: { fontWeight: 700, fontSize: "0.9rem", color: "var(--ck-text-primary)" }
750
+ }, "Your Brand"),
751
+ h("span", { style: { color: "rgba(99,179,237,0.9)", fontSize: "0.85rem" } }, "\u2713")
752
+ ),
753
+ h("div", {
754
+ style: { fontSize: "0.75rem", color: "var(--ck-text-tertiary)" }
755
+ }, scheduledAt ? `Scheduled \xB7 ${new Date(scheduledAt).toLocaleDateString(void 0, { month: "short", day: "numeric" })}` : "Just now")
756
+ )
757
+ ),
758
+ // Post body
759
+ h(
760
+ "div",
761
+ { style: { padding: "0.65rem 1rem 0.75rem" } },
762
+ content.trim() ? h("div", {
763
+ style: {
764
+ whiteSpace: "pre-wrap",
765
+ fontSize: "0.9rem",
766
+ color: "var(--ck-text-primary)",
767
+ lineHeight: "1.5",
768
+ maxHeight: "260px",
769
+ overflowY: "auto",
770
+ wordBreak: "break-word"
771
+ }
772
+ }, content) : h("div", {
773
+ style: {
774
+ color: "var(--ck-text-tertiary)",
775
+ fontSize: "0.85rem",
776
+ fontStyle: "italic",
777
+ padding: "1.5rem 0",
778
+ textAlign: "center"
779
+ }
780
+ }, "Start writing to see a preview")
781
+ ),
782
+ // Media preview
783
+ (selectedMediaIds.length > 0 || mediaUrl && showMedia) && h(
784
+ "div",
785
+ {
786
+ style: { padding: "0 0 0" }
787
+ },
788
+ ...selectedMediaIds.map((id) => {
789
+ const item = mediaLibrary.find((m) => m.id === id);
790
+ if (!item) return null;
791
+ return item.mimeType?.startsWith("video/") ? h("div", {
792
+ key: id,
793
+ style: {
794
+ background: "rgba(0,0,0,0.4)",
795
+ padding: "1.5rem",
796
+ textAlign: "center",
797
+ color: "var(--ck-text-secondary)",
798
+ fontSize: "0.85rem"
799
+ }
800
+ }, `\u{1F3A5} ${item.filename}`) : h("img", {
801
+ key: id,
802
+ src: item.thumbnailDataUrl || item.url,
803
+ style: { width: "100%", display: "block" }
804
+ });
805
+ }),
806
+ mediaUrl && showMedia && h("img", {
807
+ src: mediaUrl,
808
+ style: { width: "100%", display: "block" },
809
+ onError: (e) => {
810
+ e.target.style.display = "none";
811
+ }
812
+ })
813
+ ),
814
+ // Engagement bar (fake social actions)
815
+ h(
816
+ "div",
817
+ {
818
+ style: {
819
+ display: "flex",
820
+ justifyContent: "space-around",
821
+ padding: "0.6rem 1rem",
822
+ borderTop: "1px solid rgba(255,255,255,0.06)",
823
+ fontSize: "0.8rem",
824
+ color: "var(--ck-text-tertiary)"
825
+ }
826
+ },
827
+ h("span", null, "\u2764\uFE0F 0"),
828
+ h("span", null, "\u{1F4AC} 0"),
829
+ h("span", null, "\u{1F501} 0"),
830
+ h("span", null, "\u{1F4CA} 0")
831
+ )
832
+ ),
833
+ // Platform pills below card
704
834
  selectedPlatforms.length > 0 && h(
705
835
  "div",
706
- { className: "flex flex-wrap gap-1 mb-3" },
836
+ {
837
+ style: { display: "flex", flexWrap: "wrap", gap: "0.35rem", marginTop: "0.75rem" }
838
+ },
707
839
  ...selectedPlatforms.map((pl) => {
708
840
  const drv = drivers.find((d) => d.platform === pl);
709
841
  return h("span", {
710
842
  key: pl,
711
843
  style: {
712
- background: "rgba(127,90,240,0.15)",
713
- border: "1px solid rgba(127,90,240,0.3)",
844
+ background: "rgba(127,90,240,0.12)",
845
+ border: "1px solid rgba(127,90,240,0.25)",
714
846
  borderRadius: "999px",
715
- padding: "0.12rem 0.45rem",
716
- fontSize: "0.72rem",
847
+ padding: "0.1rem 0.4rem",
848
+ fontSize: "0.7rem",
717
849
  color: "var(--ck-text-secondary)"
718
850
  }
719
851
  }, drv ? `${drv.icon} ${drv.label}` : pl);
720
852
  })
721
853
  ),
722
- // Scheduling info
723
- scheduledAt && h("div", {
724
- className: "text-xs mb-3",
725
- style: { color: "rgba(251,191,36,0.85)" }
726
- }, `\u23F1 Scheduled: ${new Date(scheduledAt).toLocaleString()}`),
727
- // Content preview
728
- content.trim() ? h("div", {
729
- style: {
730
- background: "rgba(255,255,255,0.03)",
731
- border: "1px solid var(--ck-border-subtle)",
732
- borderRadius: "10px",
733
- padding: "0.85rem",
734
- whiteSpace: "pre-wrap",
735
- fontSize: "0.85rem",
736
- color: "var(--ck-text-primary)",
737
- lineHeight: "1.55",
738
- maxHeight: "300px",
739
- overflowY: "auto",
740
- wordBreak: "break-word"
741
- }
742
- }, content) : h("div", {
743
- style: {
744
- color: "var(--ck-text-tertiary)",
745
- fontSize: "0.85rem",
746
- fontStyle: "italic",
747
- padding: "2rem 0.5rem",
748
- textAlign: "center"
749
- }
750
- }, "Start writing to see a preview"),
751
- // Media preview (selected library items + URL)
752
- (selectedMediaIds.length > 0 || mediaUrl && showMedia) && h(
753
- "div",
754
- { className: "mt-3 space-y-2" },
755
- ...selectedMediaIds.map((id) => {
756
- const item = mediaLibrary.find((m) => m.id === id);
757
- if (!item) return null;
758
- return item.mimeType?.startsWith("video/") ? h("div", {
759
- key: id,
760
- style: {
761
- background: "rgba(0,0,0,0.3)",
762
- borderRadius: "8px",
763
- border: "1px solid var(--ck-border-subtle)",
764
- padding: "1rem",
765
- textAlign: "center",
766
- color: "var(--ck-text-secondary)",
767
- fontSize: "0.8rem"
768
- }
769
- }, `\u{1F3A5} ${item.filename}`) : h("img", {
770
- key: id,
771
- src: item.thumbnailDataUrl || item.url,
772
- style: {
773
- maxWidth: "100%",
774
- borderRadius: "8px",
775
- border: "1px solid var(--ck-border-subtle)"
776
- }
777
- });
778
- }),
779
- mediaUrl && showMedia && h("img", {
780
- src: mediaUrl,
781
- style: {
782
- maxWidth: "100%",
783
- borderRadius: "8px",
784
- border: "1px solid var(--ck-border-subtle)"
785
- },
786
- onError: (e) => {
787
- e.target.style.display = "none";
788
- }
789
- })
790
- ),
791
854
  // Character limit bar
792
855
  charLimit && content.length > 0 && h(
793
856
  "div",
794
- { className: "mt-3" },
857
+ { style: { marginTop: "0.75rem" } },
795
858
  h(
796
859
  "div",
797
- { style: { height: "4px", borderRadius: "2px", background: "rgba(255,255,255,0.06)", overflow: "hidden" } },
860
+ { style: { height: "3px", borderRadius: "2px", background: "rgba(255,255,255,0.06)", overflow: "hidden" } },
798
861
  h("div", {
799
862
  style: {
800
863
  height: "100%",
@@ -806,10 +869,11 @@
806
869
  })
807
870
  ),
808
871
  h("div", {
809
- className: "text-xs mt-1",
810
872
  style: {
811
- color: content.length > charLimit ? "rgba(248,113,113,0.9)" : "var(--ck-text-tertiary)",
812
- textAlign: "right"
873
+ fontSize: "0.7rem",
874
+ marginTop: "0.2rem",
875
+ textAlign: "right",
876
+ color: content.length > charLimit ? "rgba(248,113,113,0.9)" : "var(--ck-text-tertiary)"
813
877
  }
814
878
  }, `${content.length} / ${charLimit}`)
815
879
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jiggai/kitchen-plugin-marketing",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Marketing Suite plugin for ClawKitchen",
5
5
  "main": "dist/index.js",
6
6
  "files": [