@jiggai/kitchen-plugin-marketing 0.3.2 → 0.3.4
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/api/handler.js +10 -8
- package/package.json +1 -1
package/dist/api/handler.js
CHANGED
|
@@ -263,24 +263,26 @@ async function postizPublish(config, integrationId, content, options) {
|
|
|
263
263
|
const defaultSettings = DEFAULT_PLATFORM_SETTINGS[platformId] || { __type: platformId };
|
|
264
264
|
const settings = { ...defaultSettings, ...options?.settings || {} };
|
|
265
265
|
const image = (options?.mediaUrls || []).map((url, i) => ({ id: `img${i}`, path: url }));
|
|
266
|
+
const postDate = options?.scheduledAt || (/* @__PURE__ */ new Date()).toISOString();
|
|
266
267
|
const payload = {
|
|
267
268
|
type: options?.scheduledAt ? "schedule" : "now",
|
|
269
|
+
date: postDate,
|
|
268
270
|
shortLink: false,
|
|
269
271
|
tags: [],
|
|
270
272
|
posts: [
|
|
271
273
|
{
|
|
272
274
|
integration: { id: integrationId },
|
|
273
|
-
value:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
value: [
|
|
276
|
+
{
|
|
277
|
+
content,
|
|
278
|
+
image,
|
|
279
|
+
settings
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
settings
|
|
278
283
|
}
|
|
279
284
|
]
|
|
280
285
|
};
|
|
281
|
-
if (options?.scheduledAt) {
|
|
282
|
-
payload.date = options.scheduledAt;
|
|
283
|
-
}
|
|
284
286
|
const res = await postizFetch(config, "/posts", {
|
|
285
287
|
method: "POST",
|
|
286
288
|
body: JSON.stringify(payload)
|