@pontalabs/baileys 1.1.8 → 1.1.9

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.
@@ -591,6 +591,10 @@ export const generateWAMessageContent = async (message, options) => {
591
591
  hasNonNullishProperty(message, 'richPost') ||
592
592
  hasNonNullishProperty(message, 'tip') ||
593
593
  hasNonNullishProperty(message, 'suggest') ||
594
+ hasNonNullishProperty(message, 'widget') ||
595
+ hasNonNullishProperty(message, 'footerAction') ||
596
+ hasNonNullishProperty(message, 'metadata') ||
597
+ hasNonNullishProperty(message, 'foaText') ||
594
598
  hasNonNullishProperty(message, 'contentText')) {
595
599
  m = prepareRichResponseMessage(message);
596
600
  }
@@ -46,4 +46,5 @@ export function wrapToBotForwardedMessage(richResponseMessage: any): {
46
46
  };
47
47
  };
48
48
  };
49
- //# sourceMappingURL=rich-message-utils.d.ts.map
49
+ //# sourceMappingURL=rich-message-utils.d.ts.map
50
+ export declare function applyReadmeRichAliases(message: any): any;
@@ -770,6 +770,27 @@ const makeSuggestSection = (suggestion) => {
770
770
  };
771
771
  };
772
772
 
773
+ /** Rich AI primitives tambahan dari builder 4.7. */
774
+ const makeMetadataSub = (text, typename = 'GenAIMetadataTextPrimitive', prefix = '') => ({
775
+ sub: { messageType: RichSubMessageType.TEXT, messageText: text },
776
+ section: { view_model: { primitive: { text: prefix + text, __typename: typename }, __typename: 'GenAISingleLayoutViewModel' } }
777
+ });
778
+ const makeWidgetSection = (data) => {
779
+ const items = Array.isArray(data) ? data : [data];
780
+ const widgets = items.map(item => ({
781
+ __typename: 'GenAI3PExtWidgetPrimitive',
782
+ header: { __typename: 'GenAI3PExtWidgetStandardHeader', title: item?.title ?? '', ...(item?.header ?? {}) },
783
+ body: { __typename: 'GenAI3PExtCalendarEventList', sections: item?.sections ?? [],
784
+ ctas: (item?.actions ?? []).map(action => ({ __typename: 'GenAI3PExtWidgetCTA', label: action?.label ?? '', state: action?.state ?? 'PENDING', kind: action?.kind ?? 'OTHER', tool_call_id: action?.tool_call_id ?? action?.id ?? '', ...(action?.toast ? { toast: { __typename: 'GenAI3PExtWidgetToast', label: action.toast.label ?? action.label ?? '' } } : {}) })), ...(item?.body ?? {}) }
785
+ }));
786
+ return { view_model: widgets.length > 1 ? { primitives: widgets, __typename: 'GenAIHScrollLayoutViewModel' } : { primitive: widgets[0], __typename: 'GenAISingleLayoutViewModel' } };
787
+ };
788
+ const makeFooterActionSection = (data) => {
789
+ const items = Array.isArray(data) ? data : [data];
790
+ const actions = items.map(item => ({ __typename: 'GenAIFooterActionPrimitive', cta_text: item?.text ?? item?.cta_text ?? '', cta_type: item?.type ?? item?.cta_type ?? 'OPEN_URL', cta_url: item?.url ?? item?.cta_url ?? '' }));
791
+ return { view_model: actions.length > 1 ? { primitives: actions, __typename: 'GenAIHScrollLayoutViewModel' } : { primitive: actions[0], __typename: 'GenAISingleLayoutViewModel' } };
792
+ };
793
+
773
794
  /** Normalize input tabel: terima array 2D biasa (native ponta) ATAU
774
795
  * shorthand README/1.1.5-style { title?, headers?, rows }. */
775
796
  const normalizeTableInput = (t, fallbackTitle, fallbackNoHeading) => {
@@ -804,6 +825,7 @@ export const prepareRichResponseMessage = (content) => {
804
825
  map: mapContent, latex, contentItems,
805
826
  // sub-types baru (prefixed 'rich' agar tidak konflik dengan media biasa)
806
827
  richImage, richVideo, reels, source, richProduct, richPost, tip, suggest,
828
+ richWidget, widget, richFooterAction, footerAction, richMetadata, metadata, richFOAText, foaText,
807
829
  // opsi tambahan (belum ada di versi ponta.zip semula)
808
830
  aiForwarded
809
831
  } = content;
@@ -888,6 +910,10 @@ export const prepareRichResponseMessage = (content) => {
888
910
  if (sub.suggest != null) {
889
911
  return push(null, makeSuggestSection(sub.suggest));
890
912
  }
913
+ if (sub.widget != null) return push(null, makeWidgetSection(sub.widget));
914
+ if (sub.footerAction != null) return push(null, makeFooterActionSection(sub.footerAction));
915
+ if (sub.metadata != null) { const built = makeMetadataSub(sub.metadata); return push(built.sub, built.section); }
916
+ if (sub.foaText != null) { const built = makeMetadataSub(sub.foaText, 'FOATextPrimitive'); return push(built.sub, built.section); }
891
917
  // passthrough — kalau sudah bentuk proto submessage manual
892
918
  return push(sub, buildUnifiedSection(sub));
893
919
  };
@@ -921,6 +947,10 @@ export const prepareRichResponseMessage = (content) => {
921
947
  if (contentText) buildOne({ text: contentText }); // ← setelah produk/post, tampil di bawah card
922
948
  if (tip) buildOne({ tip });
923
949
  if (suggest) buildOne({ suggest });
950
+ if (richWidget ?? widget) buildOne({ widget: richWidget ?? widget });
951
+ if (richFooterAction ?? footerAction) buildOne({ footerAction: richFooterAction ?? footerAction });
952
+ if (richMetadata ?? metadata) buildOne({ metadata: richMetadata ?? metadata });
953
+ if (richFOAText ?? foaText) buildOne({ foaText: richFOAText ?? foaText });
924
954
 
925
955
  /* links — bisa dikombinasi dengan tipe lain di atas */
926
956
  if (links && Array.isArray(links)) {
@@ -1577,6 +1607,11 @@ export const applyReadmeRichAliases = (message) => {
1577
1607
  message.tip = message.richTip;
1578
1608
  delete message.richTip;
1579
1609
  }
1610
+ // Builder 4.7 aliases; shortcut lama tidak diubah.
1611
+ if (message.richWidget != null && message.widget == null) { message.widget = message.richWidget; delete message.richWidget; }
1612
+ if (message.richFooterAction != null && message.footerAction == null) { message.footerAction = message.richFooterAction; delete message.richFooterAction; }
1613
+ if (message.richMetadata != null && message.metadata == null) { message.metadata = message.richMetadata; delete message.richMetadata; }
1614
+ if (message.richFOAText != null && message.foaText == null) { message.foaText = message.richFOAText; delete message.richFOAText; }
1580
1615
  // richFooter -> footerText
1581
1616
  if (message.richFooter != null && message.footerText == null) {
1582
1617
  message.footerText = message.richFooter;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pontalabs/baileys",
3
3
  "type": "module",
4
- "version": "1.1.8",
4
+ "version": "1.1.9",
5
5
  "description": "PontaLabs Baileys is a lightweight, modern, and customizable WhatsApp Web API library built on Baileys.",
6
6
  "keywords": [
7
7
  "whatsapp",
@@ -53,7 +53,9 @@
53
53
  "pino": "^9.6",
54
54
  "protobufjs": "^7.5.6",
55
55
  "whatsapp-rust-bridge": "0.5.4",
56
- "ws": "^8.13.0"
56
+ "ws": "^8.13.0",
57
+ "sharp": "^0.34.3",
58
+ "fluent-ffmpeg": "^2.1.3"
57
59
  },
58
60
  "devDependencies": {
59
61
  "@eslint/eslintrc": "^3.3.1",