Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5030.js (118.4 MB)
134 lines
3.8 KiB
TypeScript
134 lines
3.8 KiB
TypeScript
// Module ID: 16612
|
|
// Function ID: 16613
|
|
// Name: vibegrationsPublishCard
|
|
// Dependencies: [12852, 3714, 2]
|
|
// Exports: isVibegrationsPublishCtaVisible, livePublishCardMessageId, outdatedNoticeRenderId, publishCardServerName, publishNoticeMessage, showsOutdatedNotice, withLivePublishCard
|
|
|
|
// Module 16612 (vibegrationsPublishCard)
|
|
import _modDef3714 from "module_3714" /* 3714 */;
|
|
import VibegrationsChatStore from "VibegrationsChatStore" /* 12852 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const turnSettled = VibegrationsChatStore.turnSettled;
|
|
const result = size.fileFinishedImporting("modules/vibegrations/lib/vibegrationsPublishCard.tsx");
|
|
|
|
export const isVibegrationsPublishCtaVisible = function isVibegrationsPublishCtaVisible(tmp5Result) {
|
|
let tmp = null != tmp5Result;
|
|
if (tmp) {
|
|
const status = tmp5Result.status;
|
|
let state;
|
|
if (status != null) {
|
|
state = status.state;
|
|
}
|
|
tmp = "unpublished" === state;
|
|
}
|
|
return tmp;
|
|
};
|
|
export const publishCardServerName = function publishCardServerName(name) {
|
|
let combined = name;
|
|
const arr = Array.from(name);
|
|
if (arr.length > 24) {
|
|
const substr = arr.slice(0, 23);
|
|
const joined = substr.join("");
|
|
const _HermesInternal = HermesInternal;
|
|
combined = "" + joined.trimEnd() + "\u2026";
|
|
}
|
|
return combined;
|
|
};
|
|
export const livePublishCardMessageId = function livePublishCardMessageId(arg0, arg1) {
|
|
if ("unpublished" !== arg1) {
|
|
return null;
|
|
} else {
|
|
let diff = arg0.length - 1;
|
|
if (0 <= diff) {
|
|
while (null == arg0[diff].publishCta) {
|
|
diff = diff - 1;
|
|
}
|
|
return arg0[diff].id;
|
|
}
|
|
return null;
|
|
}
|
|
};
|
|
export const outdatedNoticeRenderId = function outdatedNoticeRenderId(memo, stateFromStores2) {
|
|
let tmp3;
|
|
if ("changes" !== stateFromStores2) {
|
|
return null;
|
|
} else {
|
|
let diff = memo.length - 1;
|
|
if (0 <= diff) {
|
|
while (true) {
|
|
tmp3 = memo[diff];
|
|
if ("user" !== tmp3.role) {
|
|
if ("publish_notice" !== tmp3.kind) {
|
|
if (true !== tmp3.interrupted) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
diff = diff - 1;
|
|
}
|
|
let render_id = null;
|
|
if (turnSettled(tmp3)) {
|
|
render_id = tmp3.render_id;
|
|
}
|
|
return render_id;
|
|
}
|
|
return null;
|
|
}
|
|
};
|
|
export const showsOutdatedNotice = function showsOutdatedNotice(isUpdate) {
|
|
return null != isUpdate && isUpdate.isUpdate && null == isUpdate.disabledReason;
|
|
};
|
|
export const publishNoticeMessage = function publishNoticeMessage(notice) {
|
|
if (notice.update) {
|
|
const surface = notice.surface;
|
|
if ("bot" === surface) {
|
|
return _modDef3714.ncJb2S;
|
|
} else if ("widget" === surface) {
|
|
return _modDef3714.gSpqdm;
|
|
} else if ("automod" === surface) {
|
|
return _modDef3714.M3cBMT;
|
|
} else {
|
|
return _modDef3714.tg9fgb;
|
|
}
|
|
} else {
|
|
return _modDef3714.ogEl54;
|
|
}
|
|
};
|
|
export const withLivePublishCard = function withLivePublishCard(stateFromStores1, stateFromStores2) {
|
|
let id = null;
|
|
if ("unpublished" === stateFromStores2) {
|
|
let diff = stateFromStores1.length - 1;
|
|
id = null;
|
|
if (0 <= diff) {
|
|
while (null == stateFromStores1[diff].publishCta) {
|
|
diff = diff - 1;
|
|
id = null;
|
|
}
|
|
id = stateFromStores1[diff].id;
|
|
}
|
|
}
|
|
let mapped = stateFromStores1;
|
|
if (!stateFromStores1.every((publishCta) => {
|
|
let tmp = null == publishCta.publishCta;
|
|
if (!tmp) {
|
|
tmp = publishCta.id === id;
|
|
}
|
|
return tmp;
|
|
})) {
|
|
mapped = stateFromStores1.map((publishCta) => {
|
|
let tmp = publishCta;
|
|
if (null != publishCta.publishCta) {
|
|
tmp = publishCta;
|
|
if (publishCta.id !== id) {
|
|
const obj = {};
|
|
const merged = Object.assign(publishCta);
|
|
obj.publishCta = null;
|
|
tmp = obj;
|
|
}
|
|
}
|
|
return tmp;
|
|
});
|
|
}
|
|
return mapped;
|
|
};
|