@pega/cosmos-react-demos 4.0.0-dev.17.1 → 4.0.0-dev.18.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.
Files changed (43) hide show
  1. package/jsx/cs/Article/Article.mocks.js +4 -4
  2. package/jsx/cs/Article/Article.mocks.js.map +1 -1
  3. package/jsx/cs/Article/Article.stories.d.ts +13 -2
  4. package/jsx/cs/Article/Article.stories.d.ts.map +1 -1
  5. package/jsx/cs/Article/Article.stories.jsx +167 -92
  6. package/jsx/cs/Article/Article.stories.jsx.map +1 -1
  7. package/jsx/cs/ArticleList/ArticleList.mocks.d.ts +129 -10
  8. package/jsx/cs/ArticleList/ArticleList.mocks.d.ts.map +1 -1
  9. package/jsx/cs/ArticleList/ArticleList.mocks.js +362 -50
  10. package/jsx/cs/ArticleList/ArticleList.mocks.js.map +1 -1
  11. package/jsx/cs/ArticleList/ArticleList.stories.d.ts +10 -2
  12. package/jsx/cs/ArticleList/ArticleList.stories.d.ts.map +1 -1
  13. package/jsx/cs/ArticleList/ArticleList.stories.jsx +243 -92
  14. package/jsx/cs/ArticleList/ArticleList.stories.jsx.map +1 -1
  15. package/jsx/social/Chat/Chat.mocks.d.ts.map +1 -1
  16. package/jsx/social/Chat/Chat.mocks.js +5 -0
  17. package/jsx/social/Chat/Chat.mocks.js.map +1 -1
  18. package/jsx/social/Chat/Chat.stories.d.ts +5 -1
  19. package/jsx/social/Chat/Chat.stories.d.ts.map +1 -1
  20. package/jsx/social/Chat/Chat.stories.jsx +23 -10
  21. package/jsx/social/Chat/Chat.stories.jsx.map +1 -1
  22. package/lib/cs/Article/Article.mocks.js +4 -4
  23. package/lib/cs/Article/Article.mocks.js.map +1 -1
  24. package/lib/cs/Article/Article.stories.d.ts +13 -2
  25. package/lib/cs/Article/Article.stories.d.ts.map +1 -1
  26. package/lib/cs/Article/Article.stories.js +168 -53
  27. package/lib/cs/Article/Article.stories.js.map +1 -1
  28. package/lib/cs/ArticleList/ArticleList.mocks.d.ts +129 -10
  29. package/lib/cs/ArticleList/ArticleList.mocks.d.ts.map +1 -1
  30. package/lib/cs/ArticleList/ArticleList.mocks.js +362 -50
  31. package/lib/cs/ArticleList/ArticleList.mocks.js.map +1 -1
  32. package/lib/cs/ArticleList/ArticleList.stories.d.ts +10 -2
  33. package/lib/cs/ArticleList/ArticleList.stories.d.ts.map +1 -1
  34. package/lib/cs/ArticleList/ArticleList.stories.js +245 -70
  35. package/lib/cs/ArticleList/ArticleList.stories.js.map +1 -1
  36. package/lib/social/Chat/Chat.mocks.d.ts.map +1 -1
  37. package/lib/social/Chat/Chat.mocks.js +5 -0
  38. package/lib/social/Chat/Chat.mocks.js.map +1 -1
  39. package/lib/social/Chat/Chat.stories.d.ts +5 -1
  40. package/lib/social/Chat/Chat.stories.d.ts.map +1 -1
  41. package/lib/social/Chat/Chat.stories.js +23 -12
  42. package/lib/social/Chat/Chat.stories.js.map +1 -1
  43. package/package.json +9 -9
@@ -1,11 +1,11 @@
1
1
  export const ArticleMockData = {
2
2
  fullArticleContent: {
3
- header: '5 Tips for handling a Difficult customer',
4
- abstract: '5 Tips for handling a Difficult customer. This will give you clear guidelines to deal with a customer',
5
- content: "<p>Changing your monthly billing cycle can help you better manage your monthly bills and when you pay them. U+Comm offers 3 main billing cycles with due dates falling on the 1st, 15th, or the 28th of each month. This provides our customers with flexibility when choosing a billing cycle and corresponding due date that matches your personal finance planning.If you change an existing bill cycle, there will generally be a number of days prorated to compensate from the gap from the end of the previous bill cycle to when the new bill cycle is started. This proration will be included in your next (new) billing cycle statement, and will cause an increase in that month’s payment due. But rest assured, you’re not being charged ‘extra’, but paying for the days that were between the old and new billing cycle dates.</p><br/><div>Find more details from this article <a data-article-id='5' href='#'>How to sell a product</a></div><br/><div>Find some suggestions from this article <a data-article-id='8' href='#'>How to convince a customer</a></div><br/><div><b>Before you change your billing cycle, be aware that:</b> </div><br/><ul><li>Your billing cycle can't be changed if your account is in a delinquent status, or if the account will fall delinquent before the requested change date.</li><li>If you have a payment arrangement set up, the payment arrangement must be made before the billing cycle is changed.</li><li>If you have AutoPay, you may see two AutoPay drafts in one month due to the billing cycle change.</li><li>When a billing cycle change is made, prorated charges will occur.</li><li>Your billing cycle can't be changed if your account is in a delinquent status, or if the account will fall delinquent before the requested change date.</li><li>If you have a payment arrangement set up, the payment arrangement must be made before the billing cycle is changed.</li><li>If you have AutoPay, you may see two AutoPay drafts in one month due to the billing cycle change.</li><li>When a billing cycle change is made, prorated charges will occur.</li></ul><br/><p>If you change an existing bill cycle, there will generally be a number of days prorated to compensate from the gap from the end of the previous bill cycle to when the new bill cycle is started. This proration will be included in your next (new) billing cycle statement, and will cause an increase in that month’s payment due. But rest assured, you’re not being charged ‘extra’, but paying for the days that were between the old and new billing cycle dates.</p>",
3
+ header: 'How to change monthly billing cycle',
4
+ abstract: 'How to change monthly billing cycle. This will give you clear guidelines to change billing cycle',
5
+ content: "<p>Changing your monthly billing cycle can help you better manage your monthly bills and when you pay them. U+Comm offers 3 main billing cycles with due dates falling on the 1st, 15th, or the 28th of each month. This provides our customers with flexibility when choosing a billing cycle and corresponding due date that matches your personal finance planning.If you change an existing bill cycle, there will generally be a number of days prorated to compensate from the gap from the end of the previous bill cycle to when the new bill cycle is started. This proration will be included in your next (new) billing cycle statement, and will cause an increase in that month’s payment due. But rest assured, you’re not being charged ‘extra’, but paying for the days that were between the old and new billing cycle dates.</p><div>Find more details from this article <a data-article-id='5' href='#'>How to sell a product</a></div><div>Find some suggestions from this article <a data-article-id='8' href='#'>How to convince a customer</a></div><div><b>Before you change your billing cycle, be aware that:</b> </div><ul><li>Your billing cycle can't be changed if your account is in a delinquent status, or if the account will fall delinquent before the requested change date.</li><li>If you have a payment arrangement set up, the payment arrangement must be made before the billing cycle is changed.</li><li>If you have AutoPay, you may see two AutoPay drafts in one month due to the billing cycle change.</li><li>When a billing cycle change is made, prorated charges will occur.</li><li>Your billing cycle can't be changed if your account is in a delinquent status, or if the account will fall delinquent before the requested change date.</li><li>If you have a payment arrangement set up, the payment arrangement must be made before the billing cycle is changed.</li><li>If you have AutoPay, you may see two AutoPay drafts in one month due to the billing cycle change.</li><li>When a billing cycle change is made, prorated charges will occur.</li></ul><p>If you change an existing bill cycle, there will generally be a number of days prorated to compensate from the gap from the end of the previous bill cycle to when the new bill cycle is started. This proration will be included in your next (new) billing cycle statement, and will cause an increase in that month’s payment due. But rest assured, you’re not being charged ‘extra’, but paying for the days that were between the old and new billing cycle dates.</p>",
6
6
  meta: {
7
7
  category: 'Banking and Retail',
8
- publishedDate: '12/12/2019',
8
+ publishedDate: '2023-04-06',
9
9
  likes: 124,
10
10
  disLikes: 47
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Article.mocks.js","sourceRoot":"","sources":["../../../src/cs/Article/Article.mocks.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,kBAAkB,EAAE;QAClB,MAAM,EAAE,0CAA0C;QAClD,QAAQ,EACN,uGAAuG;QACzG,OAAO,EACL,2+EAA2+E;QAC7+E,IAAI,EAAE;YACJ,QAAQ,EAAE,oBAAoB;YAC9B,aAAa,EAAE,YAAY;YAC3B,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAC","sourcesContent":["export const ArticleMockData = {\n fullArticleContent: {\n header: '5 Tips for handling a Difficult customer',\n abstract:\n '5 Tips for handling a Difficult customer. This will give you clear guidelines to deal with a customer',\n content:\n \"<p>Changing your monthly billing cycle can help you better manage your monthly bills and when you pay them. U+Comm offers 3 main billing cycles with due dates falling on the 1st, 15th, or the 28th of each month. This provides our customers with flexibility when choosing a billing cycle and corresponding due date that matches your personal finance planning.If you change an existing bill cycle, there will generally be a number of days prorated to compensate from the gap from the end of the previous bill cycle to when the new bill cycle is started. This proration will be included in your next (new) billing cycle statement, and will cause an increase in that month’s payment due. But rest assured, you’re not being charged ‘extra’, but paying for the days that were between the old and new billing cycle dates.</p><br/><div>Find more details from this article <a data-article-id='5' href='#'>How to sell a product</a></div><br/><div>Find some suggestions from this article <a data-article-id='8' href='#'>How to convince a customer</a></div><br/><div><b>Before you change your billing cycle, be aware that:</b> </div><br/><ul><li>Your billing cycle can't be changed if your account is in a delinquent status, or if the account will fall delinquent before the requested change date.</li><li>If you have a payment arrangement set up, the payment arrangement must be made before the billing cycle is changed.</li><li>If you have AutoPay, you may see two AutoPay drafts in one month due to the billing cycle change.</li><li>When a billing cycle change is made, prorated charges will occur.</li><li>Your billing cycle can't be changed if your account is in a delinquent status, or if the account will fall delinquent before the requested change date.</li><li>If you have a payment arrangement set up, the payment arrangement must be made before the billing cycle is changed.</li><li>If you have AutoPay, you may see two AutoPay drafts in one month due to the billing cycle change.</li><li>When a billing cycle change is made, prorated charges will occur.</li></ul><br/><p>If you change an existing bill cycle, there will generally be a number of days prorated to compensate from the gap from the end of the previous bill cycle to when the new bill cycle is started. This proration will be included in your next (new) billing cycle statement, and will cause an increase in that month’s payment due. But rest assured, you’re not being charged ‘extra’, but paying for the days that were between the old and new billing cycle dates.</p>\",\n meta: {\n category: 'Banking and Retail',\n publishedDate: '12/12/2019',\n likes: 124,\n disLikes: 47\n }\n }\n};\n"]}
1
+ {"version":3,"file":"Article.mocks.js","sourceRoot":"","sources":["../../../src/cs/Article/Article.mocks.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,kBAAkB,EAAE;QAClB,MAAM,EAAE,qCAAqC;QAC7C,QAAQ,EACN,kGAAkG;QACpG,OAAO,EACL,k9EAAk9E;QACp9E,IAAI,EAAE;YACJ,QAAQ,EAAE,oBAAoB;YAC9B,aAAa,EAAE,YAAY;YAC3B,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAC","sourcesContent":["export const ArticleMockData = {\n fullArticleContent: {\n header: 'How to change monthly billing cycle',\n abstract:\n 'How to change monthly billing cycle. This will give you clear guidelines to change billing cycle',\n content:\n \"<p>Changing your monthly billing cycle can help you better manage your monthly bills and when you pay them. U+Comm offers 3 main billing cycles with due dates falling on the 1st, 15th, or the 28th of each month. This provides our customers with flexibility when choosing a billing cycle and corresponding due date that matches your personal finance planning.If you change an existing bill cycle, there will generally be a number of days prorated to compensate from the gap from the end of the previous bill cycle to when the new bill cycle is started. This proration will be included in your next (new) billing cycle statement, and will cause an increase in that month’s payment due. But rest assured, you’re not being charged ‘extra’, but paying for the days that were between the old and new billing cycle dates.</p><div>Find more details from this article <a data-article-id='5' href='#'>How to sell a product</a></div><div>Find some suggestions from this article <a data-article-id='8' href='#'>How to convince a customer</a></div><div><b>Before you change your billing cycle, be aware that:</b> </div><ul><li>Your billing cycle can't be changed if your account is in a delinquent status, or if the account will fall delinquent before the requested change date.</li><li>If you have a payment arrangement set up, the payment arrangement must be made before the billing cycle is changed.</li><li>If you have AutoPay, you may see two AutoPay drafts in one month due to the billing cycle change.</li><li>When a billing cycle change is made, prorated charges will occur.</li><li>Your billing cycle can't be changed if your account is in a delinquent status, or if the account will fall delinquent before the requested change date.</li><li>If you have a payment arrangement set up, the payment arrangement must be made before the billing cycle is changed.</li><li>If you have AutoPay, you may see two AutoPay drafts in one month due to the billing cycle change.</li><li>When a billing cycle change is made, prorated charges will occur.</li></ul><p>If you change an existing bill cycle, there will generally be a number of days prorated to compensate from the gap from the end of the previous bill cycle to when the new bill cycle is started. This proration will be included in your next (new) billing cycle statement, and will cause an increase in that month’s payment due. But rest assured, you’re not being charged ‘extra’, but paying for the days that were between the old and new billing cycle dates.</p>\",\n meta: {\n category: 'Banking and Retail',\n publishedDate: '2023-04-06',\n likes: 124,\n disLikes: 47\n }\n }\n};\n"]}
@@ -1,6 +1,17 @@
1
1
  import { Meta, Story } from '@storybook/react';
2
2
  declare const _default: Meta;
3
3
  export default _default;
4
- export declare const ArticleStory: Story;
5
- export declare const ArticleStorySkeletonize: Story;
4
+ export interface ArticleDemoProps {
5
+ showHeader: boolean;
6
+ backButtonText: string;
7
+ showPrimaryActions: boolean;
8
+ showSecondaryActions: boolean;
9
+ showFooter: boolean;
10
+ enableFeedback: boolean;
11
+ showTags: boolean;
12
+ showRelatedLinks: boolean;
13
+ showMoreLikeThis: boolean;
14
+ showAttachments: boolean;
15
+ }
16
+ export declare const ArticleStory: Story<ArticleDemoProps>;
6
17
  //# sourceMappingURL=Article.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Article.stories.d.ts","sourceRoot":"","sources":["../../../src/cs/Article/Article.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;;AAc/C,wBAOU;AAEV,eAAO,MAAM,YAAY,EAAE,KA2G1B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAwCrC,CAAC"}
1
+ {"version":3,"file":"Article.stories.d.ts","sourceRoot":"","sources":["../../../src/cs/Article/Article.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;;AAc/C,wBAOU;AAEV,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAgMhD,CAAC"}
@@ -1,5 +1,6 @@
1
+ import { useEffect, useState } from 'react';
1
2
  import { action } from '@storybook/addon-actions';
2
- import { Button, Flex, Icon, registerIcon, Link, Text } from '@pega/cosmos-react-core';
3
+ import { registerIcon, createUID, HTML } from '@pega/cosmos-react-core';
3
4
  import * as openIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/open.icon';
4
5
  import * as starIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star.icon';
5
6
  import * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';
@@ -16,111 +17,185 @@ export default {
16
17
  layout: 'fullscreen'
17
18
  }
18
19
  };
19
- export const ArticleStory = () => {
20
+ export const ArticleStory = (args) => {
21
+ const [feedbackStatus, setFeedbackStatus] = useState();
22
+ const [showFeedbackThanks, setShowFeedbackThanks] = useState(false);
23
+ const [loading, setLoading] = useState(true);
24
+ const { showHeader, backButtonText, showPrimaryActions, showSecondaryActions, showFooter, enableFeedback, showTags, showRelatedLinks, showMoreLikeThis, showAttachments } = args;
20
25
  const onBackToArticlesClick = (event) => {
21
26
  event.preventDefault();
22
27
  };
28
+ const onFeedbackClick = button => {
29
+ if (button === 'like') {
30
+ if (feedbackStatus === 'liked') {
31
+ setFeedbackStatus(undefined);
32
+ }
33
+ else {
34
+ setFeedbackStatus('liked');
35
+ setShowFeedbackThanks(true);
36
+ }
37
+ }
38
+ else if (feedbackStatus === 'disliked') {
39
+ setFeedbackStatus(undefined);
40
+ }
41
+ else {
42
+ setFeedbackStatus('disliked');
43
+ setShowFeedbackThanks(true);
44
+ }
45
+ };
46
+ useEffect(() => {
47
+ setTimeout(() => {
48
+ setLoading(false);
49
+ }, 2000);
50
+ }, []);
23
51
  return (<div style={{
24
- maxWidth: '31.25rem',
25
- maxHeight: '100vh'
52
+ maxWidth: '25rem'
26
53
  }}>
27
- <Article navigation={<Link href='/' onClick={onBackToArticlesClick}>
28
- <Flex container={{ alignItems: 'center', gap: 1 }}>
29
- <Icon name='caret-left'/>
30
- <Text>Back to all articles</Text>
31
- </Flex>
32
- </Link>} primaryActions={<>
33
- <Button aria-label='star' variant='simple' icon>
34
- <Icon name='star'/>
35
- </Button>
36
- <Button aria-label='open' variant='simple' icon>
37
- <Icon name='open'/>
38
- </Button>
39
- </>} secondaryActions={[
40
- {
41
- text: 'Filter 1',
42
- id: 'f1a'
43
- },
44
- {
45
- text: 'Filter 2',
46
- id: 'f2a'
54
+ <Article header={showHeader
55
+ ? {
56
+ title: 'Knowledge articles',
57
+ icon: 'book-open'
47
58
  }
48
- ]} content={<div dangerouslySetInnerHTML={{ __html: ArticleMockData.fullArticleContent.content }}/>} skeletonize={false} title={ArticleMockData.fullArticleContent.header} meta={[
49
- <Text variant='secondary' aria-label='category'>
50
- {ArticleMockData.fullArticleContent.meta.category}
51
- </Text>,
52
- <Text variant='secondary' aria-label='published date'>
53
- {ArticleMockData.fullArticleContent.meta.publishedDate}
54
- </Text>,
55
- <Flex container={{ gap: 2, alignItems: 'center' }}>
56
- <Flex container={{ gap: 1, alignItems: 'center' }}>
57
- <Icon name='thumbs-up-solid'/>
58
- <Text aria-label='likes'>({ArticleMockData.fullArticleContent.meta.likes})</Text>
59
- </Flex>
60
- <Flex container={{ gap: 1, alignItems: 'center' }}>
61
- <Icon name='thumbs-down-solid'/>
62
- <Text aria-label='dislikes'>
63
- ({ArticleMockData.fullArticleContent.meta.disLikes})
64
- </Text>
65
- </Flex>
66
- </Flex>
67
- ]} footer={<ArticleFooter content={<Flex container={{ gap: 1 }}>
68
- <Text>Was this helpful ?</Text> <Button>Yes</Button> <Button>No</Button>
69
- </Flex>} tags={[
70
- {
71
- id: 'Retail banking',
72
- tagName: '#Retail_banking'
73
- },
59
+ : undefined} backNavigation={{
60
+ title: backButtonText,
61
+ onClick: onBackToArticlesClick
62
+ }} primaryActions={showPrimaryActions
63
+ ? [
74
64
  {
75
- id: 'difficult_customers',
76
- tagName: '#Difficult_customers'
65
+ icon: 'star',
66
+ label: 'Follow',
67
+ id: createUID(),
68
+ onClick: id => {
69
+ action('Follow')(id);
70
+ }
77
71
  },
78
72
  {
79
- id: '223444',
80
- tagName: '#CSR_Skills'
81
- },
82
- {
83
- id: '223446',
84
- tagName: '#Premium_Customers'
85
- },
73
+ icon: 'open',
74
+ label: 'Open',
75
+ id: createUID(),
76
+ onClick: id => {
77
+ action('Open')(id);
78
+ }
79
+ }
80
+ ]
81
+ : undefined} secondaryActions={showSecondaryActions
82
+ ? [
86
83
  {
87
- id: '223447',
88
- tagName: '#Rare_Customers'
84
+ text: 'Send in email',
85
+ id: 'action1',
86
+ onClick: action('Action')
89
87
  },
90
88
  {
91
- id: '223448',
92
- tagName: '#Finance_Customers'
89
+ text: 'Send in chat',
90
+ id: 'action2',
91
+ onClick: action('Action')
93
92
  }
94
- ]} onTagClick={action('Tag clicked')}/>}/>
95
- </div>);
96
- };
97
- export const ArticleStorySkeletonize = () => {
98
- const onBackToArticlesClick = (event) => {
99
- event.preventDefault();
100
- };
101
- return (<div style={{ maxWidth: '31.25rem', maxHeight: '100vh' }}>
102
- <Article skeletonize navigation={<Link href='/' onClick={onBackToArticlesClick}>
103
- <Flex container={{ alignItems: 'center', gap: 1 }}>
104
- <Icon name='caret-left'/>
105
- <Text>Back to articles</Text>
106
- </Flex>
107
- </Link>} primaryActions={<>
108
- <Button variant='simple' icon>
109
- <Icon name='star'/>
110
- </Button>
111
- <Button variant='simple' icon>
112
- <Icon name='open'/>
113
- </Button>
114
- </>} secondaryActions={[
115
- {
116
- text: 'Filter 1',
117
- id: 'f1a'
118
- },
119
- {
120
- text: 'Filter 2',
121
- id: 'f2a'
93
+ ]
94
+ : undefined} content={<HTML content={ArticleMockData.fullArticleContent.content}/>} title={ArticleMockData.fullArticleContent.header} meta={{
95
+ category: ArticleMockData.fullArticleContent.meta.category,
96
+ publishedDate: ArticleMockData.fullArticleContent.meta.publishedDate,
97
+ feedback: {
98
+ likes: ArticleMockData.fullArticleContent.meta.likes,
99
+ dislikes: ArticleMockData.fullArticleContent.meta.disLikes
100
+ }
101
+ }} footer={showFooter
102
+ ? {
103
+ feedback: enableFeedback
104
+ ? {
105
+ showThanksMessage: showFeedbackThanks,
106
+ status: feedbackStatus,
107
+ onFeedbackClick
108
+ }
109
+ : undefined,
110
+ tags: showTags
111
+ ? {
112
+ list: [
113
+ {
114
+ id: 'Retail banking',
115
+ tagName: '#Retail_banking'
116
+ },
117
+ {
118
+ id: 'Billing',
119
+ tagName: '#Billing'
120
+ },
121
+ {
122
+ id: '223444',
123
+ tagName: '#CSR_Skills'
124
+ },
125
+ {
126
+ id: '223446',
127
+ tagName: '#Premium_Customers'
128
+ },
129
+ {
130
+ id: '223447',
131
+ tagName: '#Rare_Customers'
132
+ },
133
+ {
134
+ id: '223448',
135
+ tagName: '#Finance_Customers'
136
+ }
137
+ ],
138
+ onTagClick: action('Tag clicked')
139
+ }
140
+ : undefined,
141
+ relatedLinks: showRelatedLinks
142
+ ? [
143
+ { title: 'Retail banking for beginners', href: 'https://pega.com' },
144
+ { title: 'How to handle premium customers', href: 'https://pega.com' }
145
+ ]
146
+ : undefined,
147
+ relatedArticles: showMoreLikeThis
148
+ ? [
149
+ {
150
+ title: 'What are the implications of change in billing cycle',
151
+ onClick: action('Related article'),
152
+ id: createUID()
153
+ },
154
+ {
155
+ title: 'What is the best billing cycle for premium customers',
156
+ onClick: action('Related article'),
157
+ id: createUID()
158
+ },
159
+ {
160
+ title: 'How to enable automatic bill payment',
161
+ onClick: action('Related article'),
162
+ id: createUID()
163
+ }
164
+ ]
165
+ : undefined,
166
+ attachments: showAttachments
167
+ ? [
168
+ { name: 'Billing cycle FAQ.doc', onDownload: action('On Download') },
169
+ { name: 'Training video.mp4', onDownload: action('On Download') },
170
+ { name: 'Terms and conditions.pdf', onDownload: action('On Download') }
171
+ ]
172
+ : undefined
122
173
  }
123
- ]}/>
174
+ : undefined} loading={loading}/>
124
175
  </div>);
125
176
  };
177
+ ArticleStory.args = {
178
+ showHeader: true,
179
+ backButtonText: 'Back to all articles',
180
+ showPrimaryActions: true,
181
+ showSecondaryActions: true,
182
+ showFooter: true,
183
+ enableFeedback: true,
184
+ showTags: true,
185
+ showRelatedLinks: true,
186
+ showMoreLikeThis: true,
187
+ showAttachments: true
188
+ };
189
+ ArticleStory.argTypes = {
190
+ showHeader: { control: { type: 'boolean' } },
191
+ backButtonText: { control: { type: 'text' } },
192
+ showPrimaryActions: { control: { type: 'boolean' } },
193
+ showSecondaryActions: { control: { type: 'boolean' } },
194
+ showFooter: { control: { type: 'boolean' } },
195
+ enableFeedback: { control: { type: 'boolean' } },
196
+ showTags: { control: { type: 'boolean' } },
197
+ showRelatedLinks: { control: { type: 'boolean' } },
198
+ showMoreLikeThis: { control: { type: 'boolean' } },
199
+ showAttachments: { control: { type: 'boolean' } }
200
+ };
126
201
  //# sourceMappingURL=Article.stories.jsx.map
@@ -1 +1 @@
1
- {"version":3,"file":"Article.stories.jsx","sourceRoot":"","sources":["../../../src/cs/Article/Article.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,iBAAiB,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK,mBAAmB,MAAM,0EAA0E,CAAC;AAChH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;AAExF,eAAe;IACb,KAAK,EAAE,0BAA0B;IACjC,SAAS,EAAE,OAAO;IAClB,aAAa,EAAE,EAAE,aAAa,EAAE;IAChC,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;KACrB;CACM,CAAC;AAEV,MAAM,CAAC,MA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,CAAC,CACT,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAC5C;YAAA,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAChD;cAAA,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EACvB;cAAA,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAC9B;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,IAAI,CAAC,CACR,CACD,cAAc,CAAC,CACb,EACE;YAAA,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAC3B;cAAA,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EACnB;YAAA,EAAE,MAAM,CACR;YAAA,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAC3B;cAAA,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EACnB;YAAA,EAAE,MAAM,CACV;UAAA,GAAG,CACJ,CACD,gBAAgB,CAAC,CAAC;YAChB;gBACE,IAAI,EAAE,UAAU;gBAChB,EAAE,EAAE,KAAK;aACV;YACD;gBACE,IAAI,EAAE,UAAU;gBAChB,EAAE,EAAE,KAAK;aACV;SACF,CAAC,EAEN;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { MouseEvent } from 'react';\nimport { action } from '@storybook/addon-actions';\nimport { Meta, Story } from '@storybook/react';\n\nimport { Button, Flex, Icon, registerIcon, Link, Text } from '@pega/cosmos-react-core';\nimport * as openIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/open.icon';\nimport * as starIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down-solid.icon';\nimport { Article, ArticleFooter } from '@pega/cosmos-react-cs';\n\nimport { ArticleMockData } from './Article.mocks';\n\nregisterIcon(openIcon, starIcon, caretLeftIcon, thumbsUpSolidIcon, thumbsDownSolidIcon);\n\nexport default {\n title: 'Customer Service/Article',\n component: Article,\n subcomponents: { ArticleFooter },\n parameters: {\n layout: 'fullscreen'\n }\n} as Meta;\n\nexport const ArticleStory: Story = () => {\n const onBackToArticlesClick = (event: MouseEvent) => {\n event.preventDefault();\n };\n\n return (\n <div\n style={{\n maxWidth: '31.25rem',\n maxHeight: '100vh'\n }}\n >\n <Article\n navigation={\n <Link href='/' onClick={onBackToArticlesClick}>\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n <Icon name='caret-left' />\n <Text>Back to all articles</Text>\n </Flex>\n </Link>\n }\n primaryActions={\n <>\n <Button aria-label='star' variant='simple' icon>\n <Icon name='star' />\n </Button>\n <Button aria-label='open' variant='simple' icon>\n <Icon name='open' />\n </Button>\n </>\n }\n secondaryActions={[\n {\n text: 'Filter 1',\n id: 'f1a'\n },\n {\n text: 'Filter 2',\n id: 'f2a'\n }\n ]}\n content={\n // TODO : Container components need to ensure that html being sent to the __html below needs to be free from XSS attack\n // eslint-disable-next-line react/no-danger\n <div dangerouslySetInnerHTML={{ __html: ArticleMockData.fullArticleContent.content }} />\n }\n skeletonize={false}\n title={ArticleMockData.fullArticleContent.header}\n meta={[\n <Text variant='secondary' aria-label='category'>\n {ArticleMockData.fullArticleContent.meta.category}\n </Text>,\n <Text variant='secondary' aria-label='published date'>\n {ArticleMockData.fullArticleContent.meta.publishedDate}\n </Text>,\n <Flex container={{ gap: 2, alignItems: 'center' }}>\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Icon name='thumbs-up-solid' />\n <Text aria-label='likes'>({ArticleMockData.fullArticleContent.meta.likes})</Text>\n </Flex>\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Icon name='thumbs-down-solid' />\n <Text aria-label='dislikes'>\n ({ArticleMockData.fullArticleContent.meta.disLikes})\n </Text>\n </Flex>\n </Flex>\n ]}\n footer={\n <ArticleFooter\n content={\n <Flex container={{ gap: 1 }}>\n <Text>Was this helpful ?</Text> <Button>Yes</Button> <Button>No</Button>\n </Flex>\n }\n tags={[\n {\n id: 'Retail banking',\n tagName: '#Retail_banking'\n },\n {\n id: 'difficult_customers',\n tagName: '#Difficult_customers'\n },\n {\n id: '223444',\n tagName: '#CSR_Skills'\n },\n {\n id: '223446',\n tagName: '#Premium_Customers'\n },\n {\n id: '223447',\n tagName: '#Rare_Customers'\n },\n {\n id: '223448',\n tagName: '#Finance_Customers'\n }\n ]}\n onTagClick={action('Tag clicked')}\n />\n }\n />\n </div>\n );\n};\n\nexport const ArticleStorySkeletonize: Story = () => {\n const onBackToArticlesClick = (event: MouseEvent) => {\n event.preventDefault();\n };\n\n return (\n <div style={{ maxWidth: '31.25rem', maxHeight: '100vh' }}>\n <Article\n skeletonize\n navigation={\n <Link href='/' onClick={onBackToArticlesClick}>\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n <Icon name='caret-left' />\n <Text>Back to articles</Text>\n </Flex>\n </Link>\n }\n primaryActions={\n <>\n <Button variant='simple' icon>\n <Icon name='star' />\n </Button>\n <Button variant='simple' icon>\n <Icon name='open' />\n </Button>\n </>\n }\n secondaryActions={[\n {\n text: 'Filter 1',\n id: 'f1a'\n },\n {\n text: 'Filter 2',\n id: 'f2a'\n }\n ]}\n />\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"Article.stories.jsx","sourceRoot":"","sources":["../../../src/cs/Article/Article.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,IAA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,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAClD,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;CAClD,CAAC","sourcesContent":["import { MouseEvent, useEffect, useState } from 'react';\nimport { action } from '@storybook/addon-actions';\nimport { Meta, Story } from '@storybook/react';\n\nimport { registerIcon, createUID, HTML } from '@pega/cosmos-react-core';\nimport * as openIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/open.icon';\nimport * as starIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down-solid.icon';\nimport { Article, ArticleFooter, ArticleFooterProps } from '@pega/cosmos-react-cs';\n\nimport { ArticleMockData } from './Article.mocks';\n\nregisterIcon(openIcon, starIcon, caretLeftIcon, thumbsUpSolidIcon, thumbsDownSolidIcon);\n\nexport default {\n title: 'Customer Service/Article',\n component: Article,\n subcomponents: { ArticleFooter },\n parameters: {\n layout: 'fullscreen'\n }\n} as Meta;\n\nexport interface ArticleDemoProps {\n showHeader: boolean;\n backButtonText: string;\n showPrimaryActions: boolean;\n showSecondaryActions: boolean;\n showFooter: boolean;\n enableFeedback: boolean;\n showTags: boolean;\n showRelatedLinks: boolean;\n showMoreLikeThis: boolean;\n showAttachments: boolean;\n}\n\nexport const ArticleStory: Story<ArticleDemoProps> = (args: ArticleDemoProps) => {\n const [feedbackStatus, setFeedbackStatus] =\n useState<Required<ArticleFooterProps>['feedback']['status']>();\n const [showFeedbackThanks, setShowFeedbackThanks] = useState<boolean>(false);\n const [loading, setLoading] = useState<boolean>(true);\n\n const {\n showHeader,\n backButtonText,\n showPrimaryActions,\n showSecondaryActions,\n showFooter,\n enableFeedback,\n showTags,\n showRelatedLinks,\n showMoreLikeThis,\n showAttachments\n } = args;\n\n const onBackToArticlesClick = (event: MouseEvent) => {\n event.preventDefault();\n };\n\n const onFeedbackClick: Required<ArticleFooterProps>['feedback']['onFeedbackClick'] = button => {\n if (button === 'like') {\n if (feedbackStatus === 'liked') {\n setFeedbackStatus(undefined);\n } else {\n setFeedbackStatus('liked');\n setShowFeedbackThanks(true);\n }\n } else if (feedbackStatus === 'disliked') {\n setFeedbackStatus(undefined);\n } else {\n setFeedbackStatus('disliked');\n setShowFeedbackThanks(true);\n }\n };\n\n useEffect(() => {\n setTimeout(() => {\n setLoading(false);\n }, 2000);\n }, []);\n\n return (\n <div\n style={{\n maxWidth: '25rem'\n }}\n >\n <Article\n header={\n showHeader\n ? {\n title: 'Knowledge articles',\n icon: 'book-open'\n }\n : undefined\n }\n backNavigation={{\n title: backButtonText,\n onClick: onBackToArticlesClick\n }}\n primaryActions={\n showPrimaryActions\n ? [\n {\n icon: 'star',\n label: 'Follow',\n id: createUID(),\n onClick: id => {\n action('Follow')(id);\n }\n },\n {\n icon: 'open',\n label: 'Open',\n id: createUID(),\n onClick: id => {\n action('Open')(id);\n }\n }\n ]\n : undefined\n }\n secondaryActions={\n showSecondaryActions\n ? [\n {\n text: 'Send in email',\n id: 'action1',\n onClick: action('Action')\n },\n {\n text: 'Send in chat',\n id: 'action2',\n onClick: action('Action')\n }\n ]\n : undefined\n }\n content={<HTML content={ArticleMockData.fullArticleContent.content} />}\n title={ArticleMockData.fullArticleContent.header}\n meta={{\n category: ArticleMockData.fullArticleContent.meta.category,\n publishedDate: ArticleMockData.fullArticleContent.meta.publishedDate,\n feedback: {\n likes: ArticleMockData.fullArticleContent.meta.likes,\n dislikes: ArticleMockData.fullArticleContent.meta.disLikes\n }\n }}\n footer={\n showFooter\n ? {\n feedback: enableFeedback\n ? {\n showThanksMessage: showFeedbackThanks,\n status: feedbackStatus,\n onFeedbackClick\n }\n : undefined,\n tags: showTags\n ? {\n list: [\n {\n id: 'Retail banking',\n tagName: '#Retail_banking'\n },\n {\n id: 'Billing',\n tagName: '#Billing'\n },\n {\n id: '223444',\n tagName: '#CSR_Skills'\n },\n {\n id: '223446',\n tagName: '#Premium_Customers'\n },\n {\n id: '223447',\n tagName: '#Rare_Customers'\n },\n {\n id: '223448',\n tagName: '#Finance_Customers'\n }\n ],\n onTagClick: action('Tag clicked')\n }\n : undefined,\n relatedLinks: showRelatedLinks\n ? [\n { title: 'Retail banking for beginners', href: 'https://pega.com' },\n { title: 'How to handle premium customers', href: 'https://pega.com' }\n ]\n : undefined,\n relatedArticles: showMoreLikeThis\n ? [\n {\n title: 'What are the implications of change in billing cycle',\n onClick: action('Related article'),\n id: createUID()\n },\n {\n title: 'What is the best billing cycle for premium customers',\n onClick: action('Related article'),\n id: createUID()\n },\n {\n title: 'How to enable automatic bill payment',\n onClick: action('Related article'),\n id: createUID()\n }\n ]\n : undefined,\n attachments: showAttachments\n ? [\n { name: 'Billing cycle FAQ.doc', onDownload: action('On Download') },\n { name: 'Training video.mp4', onDownload: action('On Download') },\n { name: 'Terms and conditions.pdf', onDownload: action('On Download') }\n ]\n : undefined\n }\n : undefined\n }\n loading={loading}\n />\n </div>\n );\n};\n\nArticleStory.args = {\n showHeader: true,\n backButtonText: 'Back to all articles',\n showPrimaryActions: true,\n showSecondaryActions: true,\n showFooter: true,\n enableFeedback: true,\n showTags: true,\n showRelatedLinks: true,\n showMoreLikeThis: true,\n showAttachments: true\n};\n\nArticleStory.argTypes = {\n showHeader: { control: { type: 'boolean' } },\n backButtonText: { control: { type: 'text' } },\n showPrimaryActions: { control: { type: 'boolean' } },\n showSecondaryActions: { control: { type: 'boolean' } },\n showFooter: { control: { type: 'boolean' } },\n enableFeedback: { control: { type: 'boolean' } },\n showTags: { control: { type: 'boolean' } },\n showRelatedLinks: { control: { type: 'boolean' } },\n showMoreLikeThis: { control: { type: 'boolean' } },\n showAttachments: { control: { type: 'boolean' } }\n};\n"]}
@@ -1,21 +1,140 @@
1
- export declare const ArticleListMockData: {
2
- articleList: {
1
+ export declare const suggestedMock: {
2
+ count: number;
3
+ articles: ({
3
4
  articleId: string;
4
- header: string;
5
+ title: string;
6
+ href: string;
5
7
  abstract: string;
6
8
  meta: {
7
9
  category: string;
8
10
  publishedDate: string;
9
- likes: number;
10
- disLikes: number;
11
+ feedback: {
12
+ likes: number;
13
+ dislikes: number;
14
+ };
11
15
  };
16
+ isFollowed: boolean;
17
+ isLiked: boolean;
18
+ quickFilters?: undefined;
19
+ } | {
20
+ articleId: string;
21
+ title: string;
22
+ href: string;
23
+ abstract: string;
24
+ meta: {
25
+ category: string;
26
+ publishedDate: string;
27
+ feedback: {
28
+ likes: number;
29
+ dislikes: number;
30
+ };
31
+ };
32
+ isFollowed: boolean;
33
+ isLiked: boolean;
34
+ quickFilters: {
35
+ id: string;
36
+ name: string;
37
+ }[];
38
+ })[];
39
+ };
40
+ export declare const followedMock: {
41
+ count: number;
42
+ articles: ({
43
+ articleId: string;
44
+ title: string;
45
+ href: string;
46
+ abstract: string;
47
+ meta: {
48
+ category: string;
49
+ publishedDate: string;
50
+ feedback: {
51
+ likes: number;
52
+ dislikes: number;
53
+ };
54
+ };
55
+ isFollowed: boolean;
56
+ isLiked: boolean;
57
+ quickFilters: {
58
+ id: string;
59
+ name: string;
60
+ }[];
61
+ } | {
62
+ articleId: string;
63
+ title: string;
64
+ href: string;
65
+ abstract: string;
66
+ meta: {
67
+ category: string;
68
+ publishedDate: string;
69
+ feedback: {
70
+ likes: number;
71
+ dislikes: number;
72
+ };
73
+ };
74
+ isFollowed: boolean;
75
+ isLiked: boolean;
76
+ quickFilters?: undefined;
77
+ })[];
78
+ category: ({
79
+ id: string;
80
+ primary: string;
81
+ secondary: string[];
82
+ items: {
83
+ id: string;
84
+ primary: string;
85
+ secondary: string[];
86
+ }[];
87
+ } | {
88
+ id: string;
89
+ primary: string;
90
+ secondary: string[];
91
+ items?: undefined;
92
+ })[];
93
+ sortBy: {
94
+ id: string;
95
+ primary: string;
96
+ }[];
97
+ };
98
+ export declare const searchMock: {
99
+ count: number;
100
+ articles: {
101
+ articleId: string;
102
+ title: string;
103
+ href: string;
104
+ abstract: string;
105
+ meta: {
106
+ category: string;
107
+ publishedDate: string;
108
+ feedback: {
109
+ likes: number;
110
+ dislikes: number;
111
+ };
112
+ };
113
+ isFollowed: boolean;
114
+ isLiked: boolean;
115
+ quickFilters: {
116
+ id: string;
117
+ name: string;
118
+ }[];
12
119
  }[];
13
- categoriesList: {
120
+ category: ({
121
+ id: string;
122
+ primary: string;
123
+ secondary: string[];
124
+ items: {
125
+ id: string;
126
+ primary: string;
127
+ secondary: string[];
128
+ }[];
129
+ } | {
130
+ id: string;
131
+ primary: string;
132
+ secondary: string[];
133
+ items?: undefined;
134
+ })[];
135
+ sortBy: {
14
136
  id: string;
15
- name: string;
16
- level: string;
17
- category: string;
137
+ primary: string;
18
138
  }[];
19
- sortByOptions: string[];
20
139
  };
21
140
  //# sourceMappingURL=ArticleList.mocks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleList.mocks.d.ts","sourceRoot":"","sources":["../../../src/cs/ArticleList/ArticleList.mocks.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;CA4G/B,CAAC"}
1
+ {"version":3,"file":"ArticleList.mocks.d.ts","sourceRoot":"","sources":["../../../src/cs/ArticleList/ArticleList.mocks.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwJzB,CAAC;AACF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgKxB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwHtB,CAAC"}