@postrun/js 2.3.0 → 2.5.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.cjs CHANGED
@@ -1156,6 +1156,7 @@ z__namespace.object({
1156
1156
  "x",
1157
1157
  "linkedin",
1158
1158
  "facebook_page",
1159
+ "instagram",
1159
1160
  "tiktok"
1160
1161
  ])
1161
1162
  });
@@ -2948,6 +2949,13 @@ z__namespace.object({
2948
2949
  got: z__namespace.string().optional(),
2949
2950
  variant_index: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
2950
2951
  path: z__namespace.array(z__namespace.union([z__namespace.string(), z__namespace.number()])),
2952
+ platform: z__namespace.enum([
2953
+ "x",
2954
+ "linkedin",
2955
+ "facebook_page",
2956
+ "instagram",
2957
+ "tiktok"
2958
+ ]).optional(),
2951
2959
  display_error: z__namespace.string()
2952
2960
  }))
2953
2961
  });
@@ -6056,7 +6064,25 @@ function tiktokPrivacyLabel(value) {
6056
6064
  }
6057
6065
  }
6058
6066
 
6067
+ // src/linkedin.ts
6068
+ function linkedinPollDurationLabel(value) {
6069
+ switch (value) {
6070
+ case "ONE_DAY":
6071
+ return "1 day left";
6072
+ case "THREE_DAYS":
6073
+ return "3 days left";
6074
+ case "SEVEN_DAYS":
6075
+ return "1 week left";
6076
+ case "FOURTEEN_DAYS":
6077
+ return "2 weeks left";
6078
+ }
6079
+ }
6080
+
6059
6081
  // src/tiktok-options.ts
6082
+ var TIKTOK_CAPTION_MAX = { video: 2200, photo: 4e3 };
6083
+ function captionMaxFor(postType) {
6084
+ return postType === "video" ? TIKTOK_CAPTION_MAX.video : TIKTOK_CAPTION_MAX.photo;
6085
+ }
6060
6086
  var TIKTOK_MUSIC_CONFIRMATION_URL = "https://www.tiktok.com/legal/page/global/music-usage-confirmation/en";
6061
6087
  var TIKTOK_BRANDED_CONTENT_POLICY_URL = "https://www.tiktok.com/legal/page/global/bc-policy/en";
6062
6088
  var TIKTOK_DISCLOSURE_REQUIRED_HINT = "You need to indicate if your content promotes yourself, a third party, or both.";
@@ -6113,11 +6139,12 @@ function setCommercialDisclosure(value, on) {
6113
6139
  };
6114
6140
  }
6115
6141
  function setBrandKind(value, kind, on) {
6116
- const next = { ...value, [kind]: on };
6117
- if (kind === "branded_content" && on && value.privacy_level === "SELF_ONLY") {
6118
- next.privacy_level = void 0;
6119
- }
6120
- return next;
6142
+ const clearPrivacy = kind === "branded_content" && on && value.privacy_level === "SELF_ONLY";
6143
+ return {
6144
+ ...value,
6145
+ [kind]: on,
6146
+ ...clearPrivacy ? { privacy_level: void 0 } : {}
6147
+ };
6121
6148
  }
6122
6149
  function isInteractionForbidden(info, key) {
6123
6150
  return !info.interaction[key];
@@ -6167,7 +6194,8 @@ function tiktokSettings(value, isVideo) {
6167
6194
  } : base;
6168
6195
  }
6169
6196
  function tiktokOptionsReady(value) {
6170
- return !audienceUnselected(value) && !commercialDisclosureIncomplete(value);
6197
+ const brandedPrivate = discloses(value, "branded_content") && value.privacy_level === "SELF_ONLY";
6198
+ return !audienceUnselected(value) && !commercialDisclosureIncomplete(value) && !brandedPrivate;
6171
6199
  }
6172
6200
 
6173
6201
  // src/compose.ts
@@ -6364,6 +6392,7 @@ exports.POST_PLATFORMS = POST_PLATFORMS;
6364
6392
  exports.PostrunError = PostrunError;
6365
6393
  exports.TIKTOK_AUDIENCE_REQUIRED_HINT = TIKTOK_AUDIENCE_REQUIRED_HINT;
6366
6394
  exports.TIKTOK_BRANDED_CONTENT_POLICY_URL = TIKTOK_BRANDED_CONTENT_POLICY_URL;
6395
+ exports.TIKTOK_CAPTION_MAX = TIKTOK_CAPTION_MAX;
6367
6396
  exports.TIKTOK_DISCLOSURE_REQUIRED_HINT = TIKTOK_DISCLOSURE_REQUIRED_HINT;
6368
6397
  exports.TIKTOK_MUSIC_CONFIRMATION_URL = TIKTOK_MUSIC_CONFIRMATION_URL;
6369
6398
  exports.TIKTOK_PROCESSING_NOTICE = TIKTOK_PROCESSING_NOTICE;
@@ -6372,6 +6401,7 @@ exports.audienceUnselected = audienceUnselected;
6372
6401
  exports.brandedContentDeclared = brandedContentDeclared;
6373
6402
  exports.buildCreatePost = buildCreatePost;
6374
6403
  exports.buildUpdatePost = buildUpdatePost;
6404
+ exports.captionMaxFor = captionMaxFor;
6375
6405
  exports.commercialDisclosureIncomplete = commercialDisclosureIncomplete;
6376
6406
  exports.commercialLabelNotice = commercialLabelNotice;
6377
6407
  exports.connectionsConnect = connectionsConnect;
@@ -6430,6 +6460,7 @@ exports.interactionValueKey = interactionValueKey;
6430
6460
  exports.isInteractionForbidden = isInteractionForbidden;
6431
6461
  exports.isPostPlatform = isPostPlatform;
6432
6462
  exports.isPublished = isPublished;
6463
+ exports.linkedinPollDurationLabel = linkedinPollDurationLabel;
6433
6464
  exports.logsGet = logsGet;
6434
6465
  exports.logsList = logsList;
6435
6466
  exports.mediaCreate = mediaCreate;