@engagently/types 3.1.6 → 4.0.1
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/common/_types/ConfigDefinition.d.ts +7 -4
- package/dist/common/_types/WidgetDefinitions.d.ts +143 -5
- package/dist/common/lib/api/enums.d.ts +19 -3
- package/dist/i18n/i18n.d.ts +2 -12
- package/dist/main/lib/engagently.d.ts +2 -0
- package/dist/types/engagently.d.ts +24 -0
- package/dist/ui/core/_types.d.ts +40 -0
- package/dist/ui/themes/config/palette.d.ts +0 -4
- package/package.json +1 -1
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { defaultResources } from '../../i18n/i18n';
|
|
2
2
|
import type { AvailableThemes, ColorSchemesConfig } from '../../ui/themes/_types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ThemeSettings } from '../../ui/themes/config';
|
|
4
4
|
import type { CombinedError, Operation } from '@urql/preact';
|
|
5
5
|
import type { EgyEntities, MessageEvents } from './WidgetDefinitions';
|
|
6
|
-
import type { DsmFeatureName
|
|
6
|
+
import type { DsmFeatureName } from '../lib/api/enums';
|
|
7
|
+
export declare enum ExperienceCallBackNames {
|
|
8
|
+
POLL_BAR = "POLL_BAR",
|
|
9
|
+
POLL_SLIDER = "POLL_SLIDER"
|
|
10
|
+
}
|
|
7
11
|
export type CallbackFn = (data: {
|
|
8
12
|
from: EgyEntities;
|
|
9
13
|
type?: string;
|
|
@@ -21,14 +25,13 @@ export interface EngageConfig {
|
|
|
21
25
|
communityId: string;
|
|
22
26
|
token?: string | null;
|
|
23
27
|
strategy?: string;
|
|
24
|
-
palette?: PaletteConfig;
|
|
25
28
|
theme?: `${AvailableThemes}`;
|
|
26
29
|
themeSettings?: Partial<ThemeSettings>;
|
|
27
30
|
defaultLanguage?: string;
|
|
28
31
|
translations?: Translations;
|
|
29
32
|
dev?: boolean;
|
|
30
33
|
colorScheme?: `${ColorSchemesConfig}`;
|
|
31
|
-
cta?: Partial<Record<DsmFeatureName |
|
|
34
|
+
cta?: Partial<Record<DsmFeatureName | ExperienceCallBackNames, CallbackFn>>;
|
|
32
35
|
error?: ErrorCallbackFn;
|
|
33
36
|
events?: Partial<Record<EventHooks, CallbackFn>>;
|
|
34
37
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { VNode } from 'preact';
|
|
2
|
+
import type { ExperienceParticipationFragment } from '../../widgets/src/poll/data/ExperienceFragments.generated';
|
|
3
|
+
import type { PollBarData, ChartData } from '../../ui/core/_types';
|
|
2
4
|
/**
|
|
3
5
|
* Type Definitions for all available entities
|
|
4
6
|
*
|
|
@@ -11,9 +13,14 @@ import type { VNode } from 'preact';
|
|
|
11
13
|
export declare enum EgyEntities {
|
|
12
14
|
EGY_TS = "engagently.ts",
|
|
13
15
|
EGY_DISCUSSION = "egy-discussion",
|
|
14
|
-
EGY_POLL = "egy-poll"
|
|
16
|
+
EGY_POLL = "egy-poll",
|
|
17
|
+
EGY_POLL_BAR = "egy-poll-bar",
|
|
18
|
+
EGY_POLL_SLIDER = "egy-poll-slider"
|
|
15
19
|
}
|
|
16
20
|
export type EgyEntitiesValues = `${EgyEntities}`;
|
|
21
|
+
export declare enum SharedSlots {
|
|
22
|
+
CTA_HEADER = "ctaHeader"
|
|
23
|
+
}
|
|
17
24
|
/**
|
|
18
25
|
* MAKE SURE TO UPDATE THE TYPES IN THE FOLLOWING PLACES WHEN CHANGING ATTRS:
|
|
19
26
|
* - DiscussionAttributesHTMLElement
|
|
@@ -82,7 +89,7 @@ export declare enum DiscussionIconSlots {
|
|
|
82
89
|
export declare enum DiscussionSlots {
|
|
83
90
|
CUSTOM_CALL_TO_ACTION = "customCallToAction"
|
|
84
91
|
}
|
|
85
|
-
export type DiscussionSlotValues = `${DiscussionSlots}` | `${DiscussionIconSlots}` | `${DiscussionMessagesSlots}`;
|
|
92
|
+
export type DiscussionSlotValues = `${SharedSlots}` | `${DiscussionSlots}` | `${DiscussionIconSlots}` | `${DiscussionMessagesSlots}`;
|
|
86
93
|
export interface DiscussionWidget {
|
|
87
94
|
name: EgyEntities.EGY_DISCUSSION;
|
|
88
95
|
slots: Array<DiscussionSlotValues>;
|
|
@@ -123,13 +130,144 @@ export type PollAttributesComponent = {
|
|
|
123
130
|
pollId: string;
|
|
124
131
|
type?: string;
|
|
125
132
|
};
|
|
126
|
-
export declare enum
|
|
127
|
-
|
|
133
|
+
export declare enum PollEvents {
|
|
134
|
+
INIT = "egy-poll:init",
|
|
135
|
+
VOTE = "egy-poll:vote"
|
|
136
|
+
}
|
|
137
|
+
export interface PollWidgetEvents {
|
|
138
|
+
[PollEvents.INIT]: CustomEvent<{
|
|
139
|
+
entity: EgyEntities;
|
|
140
|
+
}>;
|
|
141
|
+
[PollEvents.VOTE]: CustomEvent<{
|
|
142
|
+
optionId?: string;
|
|
143
|
+
value?: number;
|
|
144
|
+
entity: EgyEntities;
|
|
145
|
+
}>;
|
|
128
146
|
}
|
|
147
|
+
export type PollSlotValues = `${SharedSlots}`;
|
|
129
148
|
export interface PollWidget {
|
|
130
149
|
name: EgyEntities.EGY_POLL;
|
|
131
150
|
attributes: Array<`${PollAttributes}`>;
|
|
132
|
-
slots: Array
|
|
151
|
+
slots: Array<PollSlotValues>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* MAKE SURE TO UPDATE THE TYPES IN THE FOLLOWING PLACES WHEN CHANGING ATTRS:
|
|
155
|
+
* - PollBarAttributesHTMLElement
|
|
156
|
+
* - PollBarAttributesComponent
|
|
157
|
+
*
|
|
158
|
+
* also make sure to update the assignment in the PollBarPortal component, and
|
|
159
|
+
* extend the PollBar Widget!
|
|
160
|
+
*/
|
|
161
|
+
export declare enum PollBarAttributes {
|
|
162
|
+
POLL_DATA = "poll-data",
|
|
163
|
+
CURRENT_USER_PARTICIPATION = "current-user-participation",
|
|
164
|
+
SHOW_SKELETON = "show-skeleton",
|
|
165
|
+
IS_LOADING = "is-loading",
|
|
166
|
+
IS_DISABLED = "is-disabled",
|
|
167
|
+
VOTE_ACTION_ENABLED = "vote-action-enabled",
|
|
168
|
+
VOTE_DISPLAY = "vote-display",
|
|
169
|
+
VOTE_CTA_ENABLED = "vote-cta-enabled",
|
|
170
|
+
VOTE_CTA_MESSAGE = "vote-cta-message",
|
|
171
|
+
RESULT_ACTION_ENABLED = "result-action-enabled",
|
|
172
|
+
RESULT_DISPLAY = "result-display",
|
|
173
|
+
RESULT_CTA_ENABLED = "result-cta-enabled",
|
|
174
|
+
RESULT_CTA_MESSAGE = "result-cta-message",
|
|
175
|
+
DISPLAY_STATS = "display-stats"
|
|
176
|
+
}
|
|
177
|
+
export interface PollBarAttributesHTMLElement {
|
|
178
|
+
['poll-data']?: PollBarData | null;
|
|
179
|
+
['current-user-participation']?: ExperienceParticipationFragment | null;
|
|
180
|
+
['show-skeleton']?: boolean | string;
|
|
181
|
+
['is-loading']?: boolean | string;
|
|
182
|
+
['is-disabled']?: boolean | string;
|
|
183
|
+
['vote-action-enabled']?: boolean | string;
|
|
184
|
+
['vote-display']?: boolean | string;
|
|
185
|
+
['vote-cta-enabled']?: boolean | string;
|
|
186
|
+
['vote-cta-message']?: string | null;
|
|
187
|
+
['result-action-enabled']?: boolean | string;
|
|
188
|
+
['result-display']?: boolean | string;
|
|
189
|
+
['result-cta-enabled']?: boolean | string;
|
|
190
|
+
['result-cta-message']?: string | null;
|
|
191
|
+
['display-stats']?: boolean | string;
|
|
192
|
+
}
|
|
193
|
+
export interface PollBarAttributesComponent {
|
|
194
|
+
pollData?: PollBarData | null;
|
|
195
|
+
currentUserParticipation?: ExperienceParticipationFragment | null;
|
|
196
|
+
showSkeleton?: boolean;
|
|
197
|
+
isLoading?: boolean;
|
|
198
|
+
isDisabled?: boolean;
|
|
199
|
+
voteActionEnabled?: boolean;
|
|
200
|
+
voteDisplay?: boolean;
|
|
201
|
+
voteCtaEnabled?: boolean;
|
|
202
|
+
voteCtaMessage?: string | null;
|
|
203
|
+
resultActionEnabled?: boolean;
|
|
204
|
+
resultDisplay?: boolean;
|
|
205
|
+
resultCtaEnabled?: boolean;
|
|
206
|
+
resultCtaMessage?: string | null;
|
|
207
|
+
displayStats?: boolean;
|
|
208
|
+
}
|
|
209
|
+
export interface PollBarWidget {
|
|
210
|
+
name: EgyEntities.EGY_POLL_BAR;
|
|
211
|
+
slots: Array<PollSlotValues>;
|
|
212
|
+
attributes: Array<`${PollBarAttributes}`>;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* MAKE SURE TO UPDATE THE TYPES IN THE FOLLOWING PLACES WHEN CHANGING ATTRS:
|
|
216
|
+
* - PollSliderAttributesHTMLElement
|
|
217
|
+
* - PollSliderAttributesComponent
|
|
218
|
+
*
|
|
219
|
+
* also make sure to update the assignment in the PollSliderPortal component,
|
|
220
|
+
* and extend the PollSlider Widget!
|
|
221
|
+
*/
|
|
222
|
+
export declare enum PollSliderAttributes {
|
|
223
|
+
POLL_DATA = "poll-data",
|
|
224
|
+
CURRENT_USER_PARTICIPATION = "current-user-participation",
|
|
225
|
+
IS_LOADING = "is-loading",
|
|
226
|
+
IS_DISABLED = "is-disabled",
|
|
227
|
+
VOTE_ACTION_ENABLED = "vote-action-enabled",
|
|
228
|
+
VOTE_DISPLAY = "vote-display",
|
|
229
|
+
VOTE_CTA_ENABLED = "vote-cta-enabled",
|
|
230
|
+
VOTE_CTA_MESSAGE = "vote-cta-message",
|
|
231
|
+
RESULT_ACTION_ENABLED = "result-action-enabled",
|
|
232
|
+
USER_NAME = "user-name",
|
|
233
|
+
USER_THUMBNAIL_URL = "user-thumbnail-url",
|
|
234
|
+
REFRESH_KEY = "refresh-key",
|
|
235
|
+
DISPLAY_STATS = "display-stats"
|
|
236
|
+
}
|
|
237
|
+
export interface PollSliderAttributesHTMLElement {
|
|
238
|
+
['poll-data']?: ChartData | null;
|
|
239
|
+
['current-user-participation']?: ExperienceParticipationFragment | null;
|
|
240
|
+
['is-loading']?: boolean | string;
|
|
241
|
+
['is-disabled']?: boolean | string;
|
|
242
|
+
['vote-action-enabled']?: boolean | string;
|
|
243
|
+
['vote-display']?: boolean | string;
|
|
244
|
+
['vote-cta-enabled']?: boolean | string;
|
|
245
|
+
['vote-cta-message']?: string | null;
|
|
246
|
+
['result-action-enabled']?: boolean | string;
|
|
247
|
+
['user-name']?: string | null;
|
|
248
|
+
['user-thumbnail-url']?: string | null;
|
|
249
|
+
['refresh-key']?: string;
|
|
250
|
+
['display-stats']?: boolean | string;
|
|
251
|
+
}
|
|
252
|
+
export interface PollSliderAttributesComponent {
|
|
253
|
+
pollData?: ChartData | null;
|
|
254
|
+
currentUserParticipation?: ExperienceParticipationFragment | null;
|
|
255
|
+
isLoading?: boolean;
|
|
256
|
+
isDisabled?: boolean;
|
|
257
|
+
voteActionEnabled?: boolean;
|
|
258
|
+
voteDisplay?: boolean;
|
|
259
|
+
voteCtaEnabled?: boolean;
|
|
260
|
+
voteCtaMessage?: string | null;
|
|
261
|
+
resultActionEnabled?: boolean;
|
|
262
|
+
userName?: string | null;
|
|
263
|
+
userThumbnailUrl?: string | null;
|
|
264
|
+
refreshKey?: string;
|
|
265
|
+
displayStats?: boolean;
|
|
266
|
+
}
|
|
267
|
+
export interface PollSliderWidget {
|
|
268
|
+
name: EgyEntities.EGY_POLL_SLIDER;
|
|
269
|
+
slots: Array<PollSlotValues>;
|
|
270
|
+
attributes: Array<`${PollSliderAttributes}`>;
|
|
133
271
|
}
|
|
134
272
|
/**
|
|
135
273
|
* Events that can be used by the pub/sub implementation for window.postMessage
|
|
@@ -42,9 +42,25 @@ export declare enum DsmViewName {
|
|
|
42
42
|
Share = "SHARE",
|
|
43
43
|
Thread = "THREAD"
|
|
44
44
|
}
|
|
45
|
-
export declare enum
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
export declare enum ExmExperienceParticipation {
|
|
46
|
+
Anonymous = "ANONYMOUS",
|
|
47
|
+
Any = "ANY",
|
|
48
|
+
Authenticated = "AUTHENTICATED",
|
|
49
|
+
Paid = "PAID"
|
|
50
|
+
}
|
|
51
|
+
export declare enum ExmExperienceTypeName {
|
|
52
|
+
Poll = "POLL",
|
|
53
|
+
Quiz = "QUIZ",
|
|
54
|
+
Survey = "SURVEY"
|
|
55
|
+
}
|
|
56
|
+
export declare enum ExmQuestionChoiceType {
|
|
57
|
+
Bucket = "BUCKET",
|
|
58
|
+
Choice = "CHOICE",
|
|
59
|
+
Input = "INPUT"
|
|
60
|
+
}
|
|
61
|
+
export declare enum ExmQuestionType {
|
|
62
|
+
Bar = "BAR",
|
|
63
|
+
Slider = "SLIDER"
|
|
48
64
|
}
|
|
49
65
|
export declare enum PageStatus {
|
|
50
66
|
Empty = "EMPTY",
|
package/dist/i18n/i18n.d.ts
CHANGED
|
@@ -221,12 +221,6 @@ export declare const defaultResources: {
|
|
|
221
221
|
SHARE: {
|
|
222
222
|
"call-to-action": string;
|
|
223
223
|
};
|
|
224
|
-
SIMPLE_RESULT: {
|
|
225
|
-
"call-to-action": string;
|
|
226
|
-
};
|
|
227
|
-
SIMPLE_VOTE: {
|
|
228
|
-
"call-to-action": string;
|
|
229
|
-
};
|
|
230
224
|
};
|
|
231
225
|
interpolation: {
|
|
232
226
|
comment: string;
|
|
@@ -263,6 +257,7 @@ export declare const defaultResources: {
|
|
|
263
257
|
};
|
|
264
258
|
poll: {
|
|
265
259
|
"thank-you-for-vote": string;
|
|
260
|
+
"call-to-action": string;
|
|
266
261
|
};
|
|
267
262
|
};
|
|
268
263
|
en: {
|
|
@@ -484,12 +479,6 @@ export declare const defaultResources: {
|
|
|
484
479
|
SHARE: {
|
|
485
480
|
"call-to-action": string;
|
|
486
481
|
};
|
|
487
|
-
SIMPLE_RESULT: {
|
|
488
|
-
"call-to-action": string;
|
|
489
|
-
};
|
|
490
|
-
SIMPLE_VOTE: {
|
|
491
|
-
"call-to-action": string;
|
|
492
|
-
};
|
|
493
482
|
};
|
|
494
483
|
interpolation: {
|
|
495
484
|
comment: string;
|
|
@@ -526,6 +515,7 @@ export declare const defaultResources: {
|
|
|
526
515
|
};
|
|
527
516
|
poll: {
|
|
528
517
|
"thank-you-for-vote": string;
|
|
518
|
+
"call-to-action": string;
|
|
529
519
|
};
|
|
530
520
|
};
|
|
531
521
|
};
|
|
@@ -4,6 +4,8 @@ import type { Exchange } from '@urql/preact';
|
|
|
4
4
|
type SignInOptions = Partial<{
|
|
5
5
|
token: string | null;
|
|
6
6
|
}>;
|
|
7
|
+
export declare const reinit: (partialConfig?: Partial<EngageConfig>) => Promise<void>;
|
|
8
|
+
export declare const signOut: ({ anonymousSession }?: SignOutOptions) => Promise<void>;
|
|
7
9
|
export type Engagently = {
|
|
8
10
|
config?: EngageConfig;
|
|
9
11
|
communityConfig?: DeepPartial<CommunityConfig>;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'vue';
|
|
2
2
|
|
|
3
3
|
import type { Engagently } from '../main/lib/engagently';
|
|
4
|
+
import { PollEvents } from '../common/_types/WidgetDefinitions';
|
|
4
5
|
import type {
|
|
6
|
+
PollWidgetEvents,
|
|
5
7
|
DiscussionAttributesHTMLElement,
|
|
6
8
|
PollAttributesHTMLElement,
|
|
7
9
|
DiscussionAttributesComponent,
|
|
8
10
|
PollAttributesComponent,
|
|
11
|
+
PollBarAttributesHTMLElement,
|
|
12
|
+
PollSliderAttributesHTMLElement,
|
|
9
13
|
} from '../common/_types/WidgetDefinitions';
|
|
10
14
|
|
|
11
15
|
////// exposed types package exports
|
|
@@ -13,6 +17,16 @@ import type {
|
|
|
13
17
|
declare const webkit: Webkit;
|
|
14
18
|
export { EngageConfig } from '../common/_types/ConfigDefinition';
|
|
15
19
|
|
|
20
|
+
export { PollEvents, PollWidgetEvents };
|
|
21
|
+
export {
|
|
22
|
+
DiscussionAttributesHTMLElement,
|
|
23
|
+
PollAttributesHTMLElement,
|
|
24
|
+
DiscussionAttributesComponent,
|
|
25
|
+
PollAttributesComponent,
|
|
26
|
+
PollBarAttributesHTMLElement,
|
|
27
|
+
PollSliderAttributesHTMLElement,
|
|
28
|
+
};
|
|
29
|
+
|
|
16
30
|
//////
|
|
17
31
|
declare module 'vue' {
|
|
18
32
|
export interface GlobalComponents {
|
|
@@ -38,9 +52,19 @@ declare global {
|
|
|
38
52
|
React.HTMLAttributes<HTMLElement> & PollAttributesHTMLElement,
|
|
39
53
|
HTMLElement
|
|
40
54
|
>;
|
|
55
|
+
'egy-poll-bar': React.DetailedHTMLProps<
|
|
56
|
+
React.HTMLAttributes<HTMLElement> & PollBarAttributesHTMLElement,
|
|
57
|
+
HTMLElement
|
|
58
|
+
>;
|
|
59
|
+
'egy-poll-slider': React.DetailedHTMLProps<
|
|
60
|
+
React.HTMLAttributes<HTMLElement> & PollSliderAttributesHTMLElement,
|
|
61
|
+
HTMLElement
|
|
62
|
+
>;
|
|
41
63
|
}
|
|
42
64
|
}
|
|
43
65
|
|
|
66
|
+
interface HTMLElementEventMap extends PollWidgetEvents {}
|
|
67
|
+
|
|
44
68
|
interface Window {
|
|
45
69
|
engagently?: Engagently;
|
|
46
70
|
initEngagently?: () => void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These types will be shared with the ts package
|
|
3
|
+
*/
|
|
4
|
+
/** Poll Data for the PollBar widget */
|
|
5
|
+
export type PollBarData = {
|
|
6
|
+
question?: {
|
|
7
|
+
id?: string | null;
|
|
8
|
+
text?: string | null;
|
|
9
|
+
};
|
|
10
|
+
choices?: Array<PollBarChoice> | null;
|
|
11
|
+
stats: {
|
|
12
|
+
clicks: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type PollBarChoice = {
|
|
16
|
+
id?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
imageUrl?: string | null;
|
|
19
|
+
stats: {
|
|
20
|
+
clicks: number;
|
|
21
|
+
};
|
|
22
|
+
} | null;
|
|
23
|
+
/** Poll Data for the PollSlider widget */
|
|
24
|
+
export type ChartData = {
|
|
25
|
+
question?: {
|
|
26
|
+
id?: string | null;
|
|
27
|
+
text?: string | null;
|
|
28
|
+
};
|
|
29
|
+
choices?: Array<{
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
stats: {
|
|
33
|
+
clicks: number;
|
|
34
|
+
buckets?: Array<{
|
|
35
|
+
bucket: string;
|
|
36
|
+
clicks: number;
|
|
37
|
+
}> | null;
|
|
38
|
+
};
|
|
39
|
+
} | null> | null;
|
|
40
|
+
};
|
|
@@ -49,10 +49,6 @@ export type ThemePalette = {
|
|
|
49
49
|
white: string;
|
|
50
50
|
mode: 'light' | 'dark';
|
|
51
51
|
};
|
|
52
|
-
export type PaletteConfig = {
|
|
53
|
-
dark: DeepPartial<Omit<ThemePalette, 'mode'>>;
|
|
54
|
-
light: DeepPartial<Omit<ThemePalette, 'mode'>>;
|
|
55
|
-
};
|
|
56
52
|
declare const generateDefaultPalette: () => Omit<ThemePalette, 'background' | 'text' | 'mode' | 'elements' | 'default'>;
|
|
57
53
|
declare const generatePaletteLight: () => ThemePalette;
|
|
58
54
|
declare const generatePaletteDark: () => ThemePalette;
|