Initial commit: Add logistics and order_detail message types
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
155
app/javascript/dashboard/helper/portalHelper.js
Normal file
155
app/javascript/dashboard/helper/portalHelper.js
Normal file
@@ -0,0 +1,155 @@
|
||||
/**
|
||||
* Formats a custom domain with https protocol if needed
|
||||
* @param {string} customDomain - The custom domain to format
|
||||
* @returns {string} Formatted domain with https protocol
|
||||
*/
|
||||
const formatCustomDomain = customDomain =>
|
||||
customDomain.startsWith('https') ? customDomain : `https://${customDomain}`;
|
||||
|
||||
/**
|
||||
* Gets the default base URL from configuration
|
||||
* @returns {string} The default base URL
|
||||
* @throws {Error} If no valid base URL is found
|
||||
*/
|
||||
const getDefaultBaseURL = () => {
|
||||
const { hostURL, helpCenterURL } = window.chatwootConfig || {};
|
||||
const baseURL = helpCenterURL || hostURL || '';
|
||||
|
||||
if (!baseURL) {
|
||||
throw new Error('No valid base URL found in configuration');
|
||||
}
|
||||
|
||||
return baseURL;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the base URL from configuration or custom domain
|
||||
* @param {string} [customDomain] - Optional custom domain for the portal
|
||||
* @returns {string} The base URL for the portal
|
||||
*/
|
||||
const getPortalBaseURL = customDomain =>
|
||||
customDomain ? formatCustomDomain(customDomain) : getDefaultBaseURL();
|
||||
|
||||
/**
|
||||
* Builds a portal URL using the provided portal slug and optional custom domain
|
||||
* @param {string} portalSlug - The slug identifier for the portal
|
||||
* @param {string} [customDomain] - Optional custom domain for the portal
|
||||
* @returns {string} The complete portal URL
|
||||
* @throws {Error} If portalSlug is not provided or invalid
|
||||
*/
|
||||
export const buildPortalURL = (portalSlug, customDomain) => {
|
||||
const baseURL = getPortalBaseURL(customDomain);
|
||||
return `${baseURL}/hc/${portalSlug}`;
|
||||
};
|
||||
|
||||
export const buildPortalArticleURL = (
|
||||
portalSlug,
|
||||
categorySlug,
|
||||
locale,
|
||||
articleSlug,
|
||||
customDomain
|
||||
) => {
|
||||
const portalURL = buildPortalURL(portalSlug, customDomain);
|
||||
return `${portalURL}/articles/${articleSlug}`;
|
||||
};
|
||||
|
||||
export const getArticleStatus = status => {
|
||||
switch (status) {
|
||||
case 'draft':
|
||||
return 0;
|
||||
case 'published':
|
||||
return 1;
|
||||
case 'archived':
|
||||
return 2;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
export const ARTICLE_STATUSES = {
|
||||
DRAFT: 'draft',
|
||||
PUBLISHED: 'published',
|
||||
ARCHIVED: 'archived',
|
||||
};
|
||||
|
||||
export const ARTICLE_MENU_ITEMS = {
|
||||
publish: {
|
||||
label: 'HELP_CENTER.ARTICLES_PAGE.ARTICLE_CARD.CARD.DROPDOWN_MENU.PUBLISH',
|
||||
value: ARTICLE_STATUSES.PUBLISHED,
|
||||
action: 'publish',
|
||||
icon: 'i-lucide-check',
|
||||
},
|
||||
draft: {
|
||||
label: 'HELP_CENTER.ARTICLES_PAGE.ARTICLE_CARD.CARD.DROPDOWN_MENU.DRAFT',
|
||||
value: ARTICLE_STATUSES.DRAFT,
|
||||
action: 'draft',
|
||||
icon: 'i-lucide-pencil-line',
|
||||
},
|
||||
archive: {
|
||||
label: 'HELP_CENTER.ARTICLES_PAGE.ARTICLE_CARD.CARD.DROPDOWN_MENU.ARCHIVE',
|
||||
value: ARTICLE_STATUSES.ARCHIVED,
|
||||
action: 'archive',
|
||||
icon: 'i-lucide-archive-restore',
|
||||
},
|
||||
delete: {
|
||||
label: 'HELP_CENTER.ARTICLES_PAGE.ARTICLE_CARD.CARD.DROPDOWN_MENU.DELETE',
|
||||
value: 'delete',
|
||||
action: 'delete',
|
||||
icon: 'i-lucide-trash',
|
||||
},
|
||||
};
|
||||
|
||||
export const ARTICLE_MENU_OPTIONS = {
|
||||
[ARTICLE_STATUSES.ARCHIVED]: ['publish', 'draft'],
|
||||
[ARTICLE_STATUSES.DRAFT]: ['publish', 'archive'],
|
||||
[ARTICLE_STATUSES.PUBLISHED]: ['draft', 'archive'],
|
||||
};
|
||||
|
||||
export const ARTICLE_TABS = {
|
||||
ALL: 'all',
|
||||
MINE: 'mine',
|
||||
DRAFT: 'draft',
|
||||
ARCHIVED: 'archived',
|
||||
};
|
||||
|
||||
export const CATEGORY_ALL = 'all';
|
||||
|
||||
export const ARTICLE_TABS_OPTIONS = [
|
||||
{
|
||||
key: 'ALL',
|
||||
value: 'all',
|
||||
},
|
||||
{
|
||||
key: 'MINE',
|
||||
value: 'mine',
|
||||
},
|
||||
{
|
||||
key: 'DRAFT',
|
||||
value: 'draft',
|
||||
},
|
||||
{
|
||||
key: 'ARCHIVED',
|
||||
value: 'archived',
|
||||
},
|
||||
];
|
||||
|
||||
export const LOCALE_MENU_ITEMS = [
|
||||
{
|
||||
label: 'HELP_CENTER.LOCALES_PAGE.LOCALE_CARD.DROPDOWN_MENU.MAKE_DEFAULT',
|
||||
action: 'change-default',
|
||||
value: 'default',
|
||||
icon: 'i-lucide-star',
|
||||
},
|
||||
{
|
||||
label: 'HELP_CENTER.LOCALES_PAGE.LOCALE_CARD.DROPDOWN_MENU.DELETE',
|
||||
action: 'delete',
|
||||
value: 'delete',
|
||||
icon: 'i-lucide-trash',
|
||||
},
|
||||
];
|
||||
|
||||
export const ARTICLE_EDITOR_STATUS_OPTIONS = {
|
||||
published: ['archive', 'draft'],
|
||||
archived: ['draft'],
|
||||
draft: ['archive'],
|
||||
};
|
||||
Reference in New Issue
Block a user