@claspo/common 7.3.1-dev.2 → 7.3.1-dev.3

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 (220) hide show
  1. package/package.json +1 -1
  2. package/coverage/lcov-report/block-navigation.js +0 -87
  3. package/coverage/lcov-report/prettify.js +0 -2
  4. package/coverage/lcov-report/sorter.js +0 -196
  5. package/jest.config.ts +0 -204
  6. package/src/DefaultEventEmitter.test.ts +0 -84
  7. package/src/DefaultEventEmitter.ts +0 -96
  8. package/src/HttpAbortableLoader.ts +0 -35
  9. package/src/InAppLayoutType.ts +0 -6
  10. package/src/LayoutType.ts +0 -18
  11. package/src/PrizePool.interface.ts +0 -32
  12. package/src/RenderMode.ts +0 -10
  13. package/src/UuidGenerator.ts +0 -16
  14. package/src/WidgetInitConfig.interface.ts +0 -163
  15. package/src/WidgetType.ts +0 -18
  16. package/src/action/type.ts +0 -7
  17. package/src/async/createAsyncIterator.ts +0 -33
  18. package/src/async/debounce.ts +0 -28
  19. package/src/async/timeout.ts +0 -3
  20. package/src/component-manifest/ComponentManifest.interface.ts +0 -160
  21. package/src/component-manifest/ContextMenuManifest.interface.ts +0 -52
  22. package/src/component-manifest/DisplayCondition.interface.ts +0 -65
  23. package/src/component-manifest/FloatingControlManifest.interface.ts +0 -89
  24. package/src/component-manifest/PropPathCondition.interface.ts +0 -4
  25. package/src/component-manifest/PropertyPaneManifest.interface.ts +0 -614
  26. package/src/converter/time/TimeConverter.spec.ts +0 -11
  27. package/src/converter/time/TimeUnit.spec.ts +0 -12
  28. package/src/converter/time/TimeUnit.ts +0 -34
  29. package/src/converter/time/TimerConverter.ts +0 -29
  30. package/src/document/ComponentInsertType.ts +0 -6
  31. package/src/document/Document.interface.ts +0 -625
  32. package/src/document/DocumentCssVarsReplace.test.ts +0 -2947
  33. package/src/document/DocumentCssVarsReplace.ts +0 -31
  34. package/src/document/DocumentUtils.test.ts +0 -595
  35. package/src/document/DocumentUtils.ts +0 -194
  36. package/src/document/hidden-fields.interface.ts +0 -54
  37. package/src/dom/ViewportSize.ts +0 -61
  38. package/src/dom/copyToClipboard.ts +0 -17
  39. package/src/dom/getMostNestedNode.ts +0 -9
  40. package/src/dom/insertHtmlIntoElement.ts +0 -36
  41. package/src/dom/sanitizeHTML.test.ts +0 -59
  42. package/src/dom/sanitizeHTML.ts +0 -78
  43. package/src/element/BaseElementInViewportHandler.ts +0 -41
  44. package/src/element/CssVarsOperations.ts +0 -37
  45. package/src/element/ThemeCssVars.ts +0 -28
  46. package/src/element/recursiveFindParentNodeByAttribute.test.ts +0 -63
  47. package/src/element/recursiveFindParentNodeByAttribute.ts +0 -25
  48. package/src/flat.ts +0 -16
  49. package/src/handler/HandlerTypes.ts +0 -4
  50. package/src/math/RandomDistributor.test.ts +0 -35
  51. package/src/math/RandomDistributor.ts +0 -58
  52. package/src/math/sum.ts +0 -3
  53. package/src/network/HttpClient.ts +0 -28
  54. package/src/network/HttpStatus.ts +0 -4
  55. package/src/object/isDictionary.test.ts +0 -24
  56. package/src/object/isDictionary.ts +0 -13
  57. package/src/object/omitKeys.test.ts +0 -19
  58. package/src/object/omitKeys.ts +0 -20
  59. package/src/storage/BaseCachingStorage.test.ts +0 -70
  60. package/src/storage/BaseCachingStorage.ts +0 -37
  61. package/src/storage/CachingCookieStorage.test.ts +0 -75
  62. package/src/storage/CachingCookieStorage.ts +0 -36
  63. package/src/storage/CachingLocalStorage.test.ts +0 -59
  64. package/src/storage/CachingLocalStorage.ts +0 -34
  65. package/src/storage/getCookie.test.ts +0 -53
  66. package/src/storage/getCookie.ts +0 -10
  67. package/src/storage/setCookie.test.ts +0 -97
  68. package/src/storage/setCookie.ts +0 -49
  69. package/src/theme/theme.utils.ts +0 -50
  70. package/src/url/sanitizeUrl.test.ts +0 -62
  71. package/src/url/sanitizeUrl.ts +0 -51
  72. package/src/utils/CaseTransformer.test.ts +0 -16
  73. package/src/utils/CaseTransformer.ts +0 -10
  74. package/src/utils/NullishCoalescingOperator.ts +0 -3
  75. package/src/utils/NumericDecline.ts +0 -25
  76. package/src/utils/addEventListener.ts +0 -23
  77. package/src/utils/allSettled.ts +0 -6
  78. package/src/utils/checkTimeZone.spec.ts +0 -18
  79. package/src/utils/checkTimeZone.ts +0 -6
  80. package/src/utils/deviceUtils.ts +0 -12
  81. package/src/utils/flatMap.test.ts +0 -21
  82. package/src/utils/flatMap.ts +0 -3
  83. package/src/utils/fromEntries.ts +0 -6
  84. package/src/utils/generateRandomNumber.test.ts +0 -23
  85. package/src/utils/generateRandomNumber.ts +0 -3
  86. package/src/utils/objectSort.ts +0 -41
  87. package/src/utils/orientationUtils.ts +0 -18
  88. package/src/velocity/SysVelocityContext.spec.ts +0 -88
  89. package/src/velocity/SysVelocityContext.ts +0 -129
  90. package/src/velocity/SysVelocityRenderer.spec.ts +0 -36
  91. package/src/velocity/SysVelocityRenderer.ts +0 -11
  92. package/test/__mocks/jestGlobalMocks.js +0 -1887
  93. /package/{out/DefaultEventEmitter.d.ts → DefaultEventEmitter.d.ts} +0 -0
  94. /package/{out/DefaultEventEmitter.js → DefaultEventEmitter.js} +0 -0
  95. /package/{out/HttpAbortableLoader.d.ts → HttpAbortableLoader.d.ts} +0 -0
  96. /package/{out/HttpAbortableLoader.js → HttpAbortableLoader.js} +0 -0
  97. /package/{out/InAppLayoutType.d.ts → InAppLayoutType.d.ts} +0 -0
  98. /package/{out/InAppLayoutType.js → InAppLayoutType.js} +0 -0
  99. /package/{out/LayoutType.d.ts → LayoutType.d.ts} +0 -0
  100. /package/{out/LayoutType.js → LayoutType.js} +0 -0
  101. /package/{out/PrizePool.interface.d.ts → PrizePool.interface.d.ts} +0 -0
  102. /package/{out/PrizePool.interface.js → PrizePool.interface.js} +0 -0
  103. /package/{out/RenderMode.d.ts → RenderMode.d.ts} +0 -0
  104. /package/{out/RenderMode.js → RenderMode.js} +0 -0
  105. /package/{out/UuidGenerator.d.ts → UuidGenerator.d.ts} +0 -0
  106. /package/{out/UuidGenerator.js → UuidGenerator.js} +0 -0
  107. /package/{out/WidgetInitConfig.interface.d.ts → WidgetInitConfig.interface.d.ts} +0 -0
  108. /package/{out/WidgetInitConfig.interface.js → WidgetInitConfig.interface.js} +0 -0
  109. /package/{out/WidgetType.d.ts → WidgetType.d.ts} +0 -0
  110. /package/{out/WidgetType.js → WidgetType.js} +0 -0
  111. /package/{out/action → action}/type.d.ts +0 -0
  112. /package/{out/action → action}/type.js +0 -0
  113. /package/{out/async → async}/createAsyncIterator.d.ts +0 -0
  114. /package/{out/async → async}/createAsyncIterator.js +0 -0
  115. /package/{out/async → async}/debounce.d.ts +0 -0
  116. /package/{out/async → async}/debounce.js +0 -0
  117. /package/{out/async → async}/timeout.d.ts +0 -0
  118. /package/{out/async → async}/timeout.js +0 -0
  119. /package/{out/component-manifest → component-manifest}/ComponentManifest.interface.d.ts +0 -0
  120. /package/{out/component-manifest → component-manifest}/ComponentManifest.interface.js +0 -0
  121. /package/{out/component-manifest → component-manifest}/ContextMenuManifest.interface.d.ts +0 -0
  122. /package/{out/component-manifest → component-manifest}/ContextMenuManifest.interface.js +0 -0
  123. /package/{out/component-manifest → component-manifest}/DisplayCondition.interface.d.ts +0 -0
  124. /package/{out/component-manifest → component-manifest}/DisplayCondition.interface.js +0 -0
  125. /package/{out/component-manifest → component-manifest}/FloatingControlManifest.interface.d.ts +0 -0
  126. /package/{out/component-manifest → component-manifest}/FloatingControlManifest.interface.js +0 -0
  127. /package/{out/component-manifest → component-manifest}/PropPathCondition.interface.d.ts +0 -0
  128. /package/{out/component-manifest → component-manifest}/PropPathCondition.interface.js +0 -0
  129. /package/{out/component-manifest → component-manifest}/PropertyPaneManifest.interface.d.ts +0 -0
  130. /package/{out/component-manifest → component-manifest}/PropertyPaneManifest.interface.js +0 -0
  131. /package/{out/converter → converter}/time/TimeUnit.d.ts +0 -0
  132. /package/{out/converter → converter}/time/TimeUnit.js +0 -0
  133. /package/{out/converter → converter}/time/TimerConverter.d.ts +0 -0
  134. /package/{out/converter → converter}/time/TimerConverter.js +0 -0
  135. /package/{out/document → document}/ComponentInsertType.d.ts +0 -0
  136. /package/{out/document → document}/ComponentInsertType.js +0 -0
  137. /package/{out/document → document}/Document.interface.d.ts +0 -0
  138. /package/{out/document → document}/Document.interface.js +0 -0
  139. /package/{out/document → document}/DocumentCssVarsReplace.d.ts +0 -0
  140. /package/{out/document → document}/DocumentCssVarsReplace.js +0 -0
  141. /package/{out/document → document}/DocumentUtils.d.ts +0 -0
  142. /package/{out/document → document}/DocumentUtils.js +0 -0
  143. /package/{out/document → document}/hidden-fields.interface.d.ts +0 -0
  144. /package/{out/document → document}/hidden-fields.interface.js +0 -0
  145. /package/{out/dom → dom}/ViewportSize.d.ts +0 -0
  146. /package/{out/dom → dom}/ViewportSize.js +0 -0
  147. /package/{out/dom → dom}/copyToClipboard.d.ts +0 -0
  148. /package/{out/dom → dom}/copyToClipboard.js +0 -0
  149. /package/{out/dom → dom}/getMostNestedNode.d.ts +0 -0
  150. /package/{out/dom → dom}/getMostNestedNode.js +0 -0
  151. /package/{out/dom → dom}/insertHtmlIntoElement.d.ts +0 -0
  152. /package/{out/dom → dom}/insertHtmlIntoElement.js +0 -0
  153. /package/{out/dom → dom}/sanitizeHTML.d.ts +0 -0
  154. /package/{out/dom → dom}/sanitizeHTML.js +0 -0
  155. /package/{out/element → element}/BaseElementInViewportHandler.d.ts +0 -0
  156. /package/{out/element → element}/BaseElementInViewportHandler.js +0 -0
  157. /package/{out/element → element}/CssVarsOperations.d.ts +0 -0
  158. /package/{out/element → element}/CssVarsOperations.js +0 -0
  159. /package/{out/element → element}/ThemeCssVars.d.ts +0 -0
  160. /package/{out/element → element}/ThemeCssVars.js +0 -0
  161. /package/{out/element → element}/recursiveFindParentNodeByAttribute.d.ts +0 -0
  162. /package/{out/element → element}/recursiveFindParentNodeByAttribute.js +0 -0
  163. /package/{out/flat.d.ts → flat.d.ts} +0 -0
  164. /package/{out/flat.js → flat.js} +0 -0
  165. /package/{out/handler → handler}/HandlerTypes.d.ts +0 -0
  166. /package/{out/handler → handler}/HandlerTypes.js +0 -0
  167. /package/{out/math → math}/RandomDistributor.d.ts +0 -0
  168. /package/{out/math → math}/RandomDistributor.js +0 -0
  169. /package/{out/math → math}/sum.d.ts +0 -0
  170. /package/{out/math → math}/sum.js +0 -0
  171. /package/{out/network → network}/HttpClient.d.ts +0 -0
  172. /package/{out/network → network}/HttpClient.js +0 -0
  173. /package/{out/network → network}/HttpStatus.d.ts +0 -0
  174. /package/{out/network → network}/HttpStatus.js +0 -0
  175. /package/{out/object → object}/isDictionary.d.ts +0 -0
  176. /package/{out/object → object}/isDictionary.js +0 -0
  177. /package/{out/object → object}/omitKeys.d.ts +0 -0
  178. /package/{out/object → object}/omitKeys.js +0 -0
  179. /package/{out/storage → storage}/BaseCachingStorage.d.ts +0 -0
  180. /package/{out/storage → storage}/BaseCachingStorage.js +0 -0
  181. /package/{out/storage → storage}/CachingCookieStorage.d.ts +0 -0
  182. /package/{out/storage → storage}/CachingCookieStorage.js +0 -0
  183. /package/{out/storage → storage}/CachingLocalStorage.d.ts +0 -0
  184. /package/{out/storage → storage}/CachingLocalStorage.js +0 -0
  185. /package/{out/storage → storage}/getCookie.d.ts +0 -0
  186. /package/{out/storage → storage}/getCookie.js +0 -0
  187. /package/{out/storage → storage}/setCookie.d.ts +0 -0
  188. /package/{out/storage → storage}/setCookie.js +0 -0
  189. /package/{out/theme → theme}/theme.utils.d.ts +0 -0
  190. /package/{out/theme → theme}/theme.utils.js +0 -0
  191. /package/{out/url → url}/sanitizeUrl.d.ts +0 -0
  192. /package/{out/url → url}/sanitizeUrl.js +0 -0
  193. /package/{out/utils → utils}/CaseTransformer.d.ts +0 -0
  194. /package/{out/utils → utils}/CaseTransformer.js +0 -0
  195. /package/{out/utils → utils}/NullishCoalescingOperator.d.ts +0 -0
  196. /package/{out/utils → utils}/NullishCoalescingOperator.js +0 -0
  197. /package/{out/utils → utils}/NumericDecline.d.ts +0 -0
  198. /package/{out/utils → utils}/NumericDecline.js +0 -0
  199. /package/{out/utils → utils}/addEventListener.d.ts +0 -0
  200. /package/{out/utils → utils}/addEventListener.js +0 -0
  201. /package/{out/utils → utils}/allSettled.d.ts +0 -0
  202. /package/{out/utils → utils}/allSettled.js +0 -0
  203. /package/{out/utils → utils}/checkTimeZone.d.ts +0 -0
  204. /package/{out/utils → utils}/checkTimeZone.js +0 -0
  205. /package/{out/utils → utils}/deviceUtils.d.ts +0 -0
  206. /package/{out/utils → utils}/deviceUtils.js +0 -0
  207. /package/{out/utils → utils}/flatMap.d.ts +0 -0
  208. /package/{out/utils → utils}/flatMap.js +0 -0
  209. /package/{out/utils → utils}/fromEntries.d.ts +0 -0
  210. /package/{out/utils → utils}/fromEntries.js +0 -0
  211. /package/{out/utils → utils}/generateRandomNumber.d.ts +0 -0
  212. /package/{out/utils → utils}/generateRandomNumber.js +0 -0
  213. /package/{out/utils → utils}/objectSort.d.ts +0 -0
  214. /package/{out/utils → utils}/objectSort.js +0 -0
  215. /package/{out/utils → utils}/orientationUtils.d.ts +0 -0
  216. /package/{out/utils → utils}/orientationUtils.js +0 -0
  217. /package/{out/velocity → velocity}/SysVelocityContext.d.ts +0 -0
  218. /package/{out/velocity → velocity}/SysVelocityContext.js +0 -0
  219. /package/{out/velocity → velocity}/SysVelocityRenderer.d.ts +0 -0
  220. /package/{out/velocity → velocity}/SysVelocityRenderer.js +0 -0
@@ -1,96 +0,0 @@
1
- import UuidGenerator from './UuidGenerator';
2
-
3
- /**
4
- * Callback function type for event listeners.
5
- * @param value - The emitted event value
6
- * @param eventName - The name of the emitted event
7
- * @param params - Additional parameters passed with the event
8
- */
9
- type EventCallback = (value: any, eventName: string, params: any) => void;
10
-
11
- /**
12
- * Map structure for storing event listeners.
13
- * Keys are event names, values are maps of listener IDs to callbacks.
14
- */
15
- type ListenersMap = Record<string, Record<string, EventCallback>>;
16
-
17
- /**
18
- * A simple event emitter implementation for pub/sub communication.
19
- * Supports named events and wildcard listeners that receive all events.
20
- * @example
21
- * const emitter = new DefaultEventEmitter();
22
- * const subscription = emitter.on('user:login', (data) => console.log(data));
23
- * emitter.emit('user:login', { userId: 123 });
24
- * subscription.off(); // Unsubscribe
25
- */
26
- export default class DefaultEventEmitter {
27
- /**
28
- * Creates the initial listeners state with wildcard listener support.
29
- * @returns Empty listeners map with wildcard entry
30
- */
31
- static createDefaultListenersState = (): ListenersMap => ({
32
- '*': {}
33
- });
34
-
35
- /** Map of event names to their registered listeners */
36
- listeners: ListenersMap;
37
-
38
- /**
39
- * Creates a new DefaultEventEmitter instance.
40
- */
41
- constructor() {
42
- this.listeners = DefaultEventEmitter.createDefaultListenersState();
43
- }
44
-
45
- /**
46
- * Emits an event to all registered listeners.
47
- * Also triggers wildcard listeners that receive all events.
48
- * @param eventName - The name of the event to emit
49
- * @param value - The value to pass to listeners
50
- * @param params - Optional additional parameters
51
- */
52
- emit(eventName: string, value: any, params: any = null): void {
53
- const eventListeners = this.listeners[eventName];
54
-
55
- if (eventListeners) {
56
- Object.values(eventListeners).forEach(cb => cb(value, eventName, params));
57
- }
58
-
59
- Object.values(this.listeners['*']).forEach(cb => cb(value, eventName, params));
60
- }
61
-
62
- /**
63
- * Registers a listener for a specific event.
64
- * Use '*' as event name to listen to all events.
65
- * @param eventName - The event name to listen for
66
- * @param listener - The callback function to invoke when the event is emitted
67
- * @returns An object with an `off` method to unsubscribe
68
- */
69
- on(eventName: string, listener: EventCallback): { off: () => void } {
70
- const uuid = UuidGenerator.generate();
71
- const eventListeners = this.listeners[eventName];
72
-
73
- if (eventListeners) {
74
- eventListeners[uuid] = listener;
75
- } else {
76
- this.listeners[eventName] = {
77
- [uuid]: listener,
78
- };
79
- }
80
-
81
- return {
82
- off: () => {
83
- if (this.listeners?.[eventName]?.[uuid]) {
84
- delete this.listeners[eventName][uuid];
85
- }
86
- }
87
- };
88
- }
89
-
90
- /**
91
- * Removes all event listeners and resets the emitter to initial state.
92
- */
93
- destroy(): void {
94
- this.listeners = DefaultEventEmitter.createDefaultListenersState();
95
- }
96
- }
@@ -1,35 +0,0 @@
1
- export default class HttpAbortableLoader {
2
- url: string;
3
- headers: Record<string, string>;
4
- httpClient: any;
5
- loaded: boolean;
6
- abortController: AbortController | null = null;
7
-
8
- constructor(url: string, headers: Record<string, string>, httpClient: any) {
9
- this.url = url;
10
- this.headers = headers;
11
- this.httpClient = httpClient;
12
- this.loaded = false;
13
- }
14
-
15
- load(): Promise<any> {
16
- if (window.AbortController) {
17
- this.abortController = new AbortController();
18
- }
19
-
20
- return this.httpClient
21
- .execute(this.url, 'GET', null, this.headers, this.abortController && this.abortController.signal)
22
- .then((r: any) => {
23
- this.loaded = true;
24
- return r;
25
- });
26
- }
27
-
28
- isLoaded(): boolean {
29
- return this.loaded;
30
- }
31
-
32
- abortLoading(): void {
33
- this.abortController && this.abortController.abort();
34
- }
35
- }
@@ -1,6 +0,0 @@
1
- export enum InAppLayoutType {
2
- SLIDE_UP = 'SLIDE_UP',
3
- POP_UP = 'POP_UP',
4
- FULL = 'FULL',
5
- BOTTOM_BAR = 'BOTTOM_BAR',
6
- }
package/src/LayoutType.ts DELETED
@@ -1,18 +0,0 @@
1
- /**
2
- * Enumeration of widget layout types.
3
- * Determines how the widget is positioned and displayed on the page.
4
- */
5
- export enum LayoutType {
6
- /** Widget embedded directly in the page content */
7
- BUILT_IN= 'BUILT_IN',
8
- /** Dialog / Popup */
9
- DETACHED = 'DETACHED',
10
- /** Floating box positioned relative to viewport corners */
11
- FLOATING_BOX = 'FLOATING_BOX',
12
- /** Horizontal bar fixed to top or bottom of viewport */
13
- FLOATING_BAR = 'FLOATING_BAR',
14
- /** Launcher trigger element that opens the main widget */
15
- LAUNCHER = 'LAUNCHER',
16
- /** Overlay that locks page content until user interaction */
17
- CONTENT_LOCKER = 'CONTENT_LOCKER',
18
- }
@@ -1,32 +0,0 @@
1
- export interface PrizePoolModelI {
2
- id: string;
3
- sourceType: PrizeSourceType;
4
- distributionType?: PrizeDistributionType;
5
- options?: PrizePoolOptionI[];
6
- }
7
-
8
- export enum PrizeSourceType {
9
- MANUAL = 'MANUAL',
10
- }
11
-
12
- export enum PrizeDistributionType {
13
- PERCENT_CHANCE = 'PERCENT_CHANCE',
14
- }
15
-
16
- export interface PrizePoolOptionI {
17
- valueType: PrizeOptionValueType;
18
- value: string;
19
- code: string;
20
- weight: number;
21
- id?: string;
22
- config?: PrizeOptionConfigI;
23
- }
24
-
25
- export enum PrizeOptionValueType {
26
- DISCOUNT_PERCENTAGE = 'DISCOUNT_PERCENTAGE',
27
- CUSTOM = 'CUSTOM',
28
- }
29
-
30
- export interface PrizeOptionConfigI {
31
- imageUrl?: string;
32
- }
package/src/RenderMode.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * Enumeration of widget rendering modes.
3
- * Determines how the widget responds to model changes.
4
- */
5
- export enum RenderMode {
6
- /** Runtime mode for end users - optimized for performance */
7
- STATIC = 'STATIC',
8
- /** Editor mode with live updates - responds to model changes in real-time */
9
- UPDATING = 'UPDATING'
10
- }
@@ -1,16 +0,0 @@
1
- export default class UuidGenerator {
2
-
3
- static generate(): string {
4
- let result = '';
5
- let i: string;
6
-
7
- for (let j = 0; j < 32; j++) {
8
- if (j === 8 || j === 12 || j === 16 || j === 20) {
9
- result += '-';
10
- }
11
- i = Math.floor(Math.random() * 16).toString(16).toUpperCase();
12
- result += i;
13
- }
14
- return result;
15
- }
16
- }
@@ -1,163 +0,0 @@
1
- import {PrizePoolModelI} from './PrizePool.interface';
2
- import {ClDocumentI} from './document/Document.interface';
3
- import {WidgetType} from './WidgetType';
4
- import {LayoutType} from './LayoutType';
5
- import {RenderMode} from './RenderMode';
6
-
7
- /**
8
- * Configuration interface for initializing a widget.
9
- */
10
- export interface WidgetInitConfigI {
11
- /** Document model containing widget structure and content */
12
- documentModel: ClDocumentI;
13
- /** Layout type */
14
- layoutType: LayoutType;
15
- /** Widget type */
16
- widgetType: WidgetType;
17
- /** Base URL for loading static resources */
18
- staticResourcesUrl: string;
19
- /** Unique identifier for the form variant
20
- * @internal
21
- * */
22
- formVariantId?: string;
23
- /**
24
- * Site identifier for multi-site deployments
25
- * @internal
26
- * */
27
- siteId?: string;
28
- /** Needs for components localization
29
- * */
30
- browserLanguage?: string;
31
- /** Needed for Multi-language widget.
32
- * */
33
- appearanceLanguage?: string;
34
- /** Additional CSS custom properties to apply * */
35
- optionalDocumentStyles?: Record<string, string>;
36
- /** Enables preview mode (disables tracking and submissions)
37
- * @internal
38
- * */
39
- previewMode?: boolean;
40
- /** Enables editor preview mode
41
- * @internal
42
- * */
43
- editorPreviewMode?: boolean;
44
- /** Enables cabinet template preview mode.
45
- * Widgets may render demo content instead of erroring when external data
46
- * (e.g. Shopify store/products) is unavailable.
47
- * @internal
48
- * */
49
- isTemplatePreview?: boolean;
50
- /** Enables demo mode
51
- * @internal
52
- * */
53
- demoMode?: boolean;
54
- /** Shows branding elements
55
- * @internal
56
- * */
57
- branded?: boolean;
58
- /** Shows upgrade plan button
59
- * @internal
60
- * */
61
- upgradePlanButton?: boolean;
62
- /** Initial view (page) index to display */
63
- viewIndex?: number;
64
- /** Forces mobile environment regardless of actual device
65
- * @internal
66
- * */
67
- forceMobileEnv?: boolean;
68
- /** Custom action factory class
69
- * @internal
70
- * */
71
- actionFactoryClass?: any;
72
- /** Unique widget identifier
73
- * @internal
74
- * @deprecated
75
- * */
76
- widgetId?: number;
77
- /** Prize pool models for gamification features */
78
- prizePoolModels?: PrizePoolModelI[];
79
- /** Pre-bundled component classes for static rendering */
80
- bundledComponentClasses?: any[];
81
- /** Needed only for Multi-language widgets.
82
- * Translation strings for internationalization */
83
- translations?: TranslationsI;
84
- /** Service for tracking user interactions (view, click, etc.)
85
- * */
86
- trackingService?: TrackingServiceI;
87
- /** Disables Google Fonts loading
88
- * @internal
89
- * */
90
- disableGoogleFonts?: boolean;
91
- /** Custom layout factory class
92
- * @internal
93
- * */
94
- layoutFactoryClass?: any;
95
- /** CSS z-index value for the widget container */
96
- zIndex?: number;
97
- /** Indicates if running in mobile environment
98
- * @internal
99
- * */
100
- isMobileEnv?: boolean;
101
- /** Disables widget interactions
102
- * @internal
103
- * */
104
- disabled?: boolean;
105
- /** Disables smart positioning logic
106
- * @internal
107
- * */
108
- disableSmartPosition?: boolean;
109
- /** Disables scrollbar width calculation
110
- * @internal
111
- * */
112
- disableScrollbarCalculation?: boolean;
113
- /** Disables layout animations* */
114
- disableLayoutAnimations?: boolean;
115
- /** CSS position value for widget display
116
- * @internal */
117
- displayPosition?: string;
118
- /** Rendering mode
119
- * @internal */
120
- renderMode?: RenderMode;
121
- /** Disables global scroll locking when widget is open */
122
- disableGlobalScroll?: boolean;
123
- /** Host URL for API requests */
124
- hostUrl?: string;
125
- /** URL endpoint for contact subscription
126
- * @internal */
127
- subscribeContactUrl?: string;
128
- /** Enables autosave-style submit flow before closing the widget */
129
- submitOnClose?: SubmitOnCloseConfigI;
130
- /** Prefix for component tag name in order to resolve conflicts between different sources of components on the same page. */
131
- productKeyPrefix?: string;
132
- /**
133
- * Hostname/URL of the user's Shopify store. Consumed by Shopify-integration
134
- * widgets (e.g. SysShopifyProductCollectionComponent) to fetch products in
135
- * editor / preview contexts. Ignored on real Shopify storefronts where the
136
- * component falls back to relative-path requests via isShopifyStorefront().
137
- */
138
- shopifyStoreUrl?: string;
139
- /** Allows additional custom properties */
140
- [key: string]: any;
141
- }
142
-
143
- export interface SubmitOnCloseConfigI {
144
- enabled: boolean;
145
- skipValidation?: boolean;
146
- }
147
-
148
- /**
149
- * Service interface for tracking user interactions and events.
150
- */
151
- export interface TrackingServiceI {
152
- /** Sends a custom event with optional payload */
153
- send: (eventName: string, payload?: any) => void;
154
- /** Tracks a click event on a specific element */
155
- trackClick: (elementId: string, payload?: any) => void;
156
- /** Tracks a target action (conversion, goal completion, etc.) */
157
- trackTargetAction: (actionType: string, payload?: any) => void;
158
- }
159
-
160
- /**
161
- * Translation dictionary mapping language codes to key-value translation pairs.
162
- */
163
- export type TranslationsI = Record<string, Record<string, string>>;
package/src/WidgetType.ts DELETED
@@ -1,18 +0,0 @@
1
- /**
2
- * Enumeration of widget types.
3
- * Defines the primary purpose and behavior of a widget.
4
- */
5
- export enum WidgetType {
6
- /** Form for collecting email subscriptions */
7
- SUBSCRIPTION_FORM = 'SUBSCRIPTION_FORM',
8
- /** Informational popup or notification */
9
- INFORMER = 'INFORMER',
10
- /** General-purpose form for collecting user data */
11
- REQUEST_FORM = 'REQUEST_FORM',
12
- /** Trigger element that opens another widget */
13
- LAUNCHER = 'LAUNCHER',
14
- /** Age verification gate */
15
- AGE_VERIFY = 'AGE_VERIFY',
16
- /** Trigger element that opens the main widget */
17
- TEASER = 'TEASER',
18
- }
@@ -1,7 +0,0 @@
1
- export function successAction(type: string): string {
2
- return `${type}_SUCCESS`;
3
- }
4
-
5
- export function failureAction(type: string): string {
6
- return `${type}_FAILED`;
7
- }
@@ -1,33 +0,0 @@
1
- interface RangeIterator extends Iterator<number> {
2
- current: number;
3
- last: number;
4
- next(): IteratorResult<number>;
5
- }
6
-
7
- interface RangeIterable extends Iterable<number> {
8
- from: number;
9
- to: number;
10
- [Symbol.iterator](): RangeIterator;
11
- }
12
-
13
- export default function createAsyncIterator(times: number): RangeIterable {
14
- return {
15
- from: 0,
16
- to: times - 1,
17
-
18
- [Symbol.iterator](): RangeIterator { // called once, in the beginning of for..of
19
- return {
20
- current: this.from,
21
- last: this.to,
22
-
23
- next(): IteratorResult<number> { // called every iteration, to get the next value
24
- if (this.current <= this.last) {
25
- return {done: false, value: this.current++};
26
- } else {
27
- return {done: true, value: undefined};
28
- }
29
- }
30
- };
31
- }
32
- };
33
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * Type representing a debounced version of a function.
3
- * Preserves the original function's `this` context and parameters.
4
- * @typeParam T - The original function type
5
- */
6
- type DebouncedFunction<T extends (...args: any[]) => any> = (this: ThisParameterType<T>, ...args: Parameters<T>) => void;
7
-
8
- /**
9
- * Creates a debounced version of a function that delays execution
10
- * until after the specified timeout has elapsed since the last call.
11
- * @typeParam T - The function type to debounce
12
- * @param func - The function to debounce
13
- * @param timeout - Delay in milliseconds before executing (default: 300)
14
- * @returns A debounced version of the function
15
- * @example
16
- * const debouncedSearch = debounce((query: string) => {
17
- * fetch(`/api/search?q=${query}`);
18
- * }, 500);
19
- */
20
- export default function debounce<T extends (...args: any[]) => any>(func: T, timeout = 300): DebouncedFunction<T> {
21
- let timer: ReturnType<typeof setTimeout>;
22
- return function(this: ThisParameterType<T>, ...args: Parameters<T>): void {
23
- clearTimeout(timer);
24
- timer = setTimeout(() => {
25
- func.apply(this, args);
26
- }, timeout);
27
- };
28
- }
@@ -1,3 +0,0 @@
1
- export default function timeout(ms: number): Promise<void> {
2
- return new Promise<void>(resolve => setTimeout(resolve, ms));
3
- }
@@ -1,160 +0,0 @@
1
- import {ClBaseComponentI, ClBaseComponentPropsI, ClComponentType} from '../document/Document.interface';
2
- import {BaseContextMenuManifestModelI} from './ContextMenuManifest.interface';
3
- import {BaseFloatingControlManifestModelI} from './FloatingControlManifest.interface';
4
- import {PropertyPaneManifestI} from './PropertyPaneManifest.interface';
5
-
6
- /**
7
- * Component manifest defining component configuration, properties, and editor controls.
8
- */
9
- export interface ComponentManifestI {
10
- /** Component name for registration */
11
- name: string;
12
- /** Component type identifier */
13
- componentType: ClComponentType;
14
- /** Component version */
15
- version: string;
16
- /** Context menu configuration for editor */
17
- contextMenuModel: BaseContextMenuManifestModelI[];
18
- /** Floating controls configuration for editor */
19
- floatingControlsModel: BaseFloatingControlManifestModelI[];
20
- /** Property pane configuration for editor */
21
- propertyPaneModel: PropertyPaneManifestI;
22
- /** Component event definitions
23
- * @internal
24
- * */
25
- events: any;
26
- /** Default component properties */
27
- props: ClBaseComponentPropsI;
28
- /** Component metadata for editor display */
29
- metaDescription: ComponentManifestMetaDescriptionI;
30
- /** Property pane for i18n settings */
31
- i18nPropertyPaneModel?: PropertyPaneManifestI;
32
- /** Property paths that support internationalization for multilingual content.
33
- * The editor extracts values from these paths and sends them to an AI-based translator.
34
- * The renderer then replaces the original values with the translated results using the same paths.
35
- * @example
36
- * [
37
- * "content,label",
38
- * "control,options,[id],label"
39
- * ]
40
- *
41
- * Note: [id] extracts all object keys
42
- * */
43
- i18nPropPaths?: string[];
44
- /** If true, clicking current component focuses it's parent component */
45
- focusParentOnClick?: boolean;
46
- /** If true, prevents drag operations for current component */
47
- preventDraggable?: boolean;
48
- /** If true, removes children when component is removed */
49
- recursiveRemove?: boolean;
50
- /** Translation strings by language. Used by components (e.g. error messages).
51
- * @example
52
- * {
53
- * "en": {
54
- * "control,validation,validationErrors,REQUIRED": "Required field",
55
- * },
56
- * */
57
- i18n?: ComponentManifestTranslationI;
58
- /** Default child components */
59
- children?: ClBaseComponentI[];
60
- /** Field mapping types that component can handle */
61
- mappingTypes?: ManifestMappingType[];
62
- /** Element names that can receive focus and should be highlighted by the editor */
63
- focusableElements?: string[];
64
- /** Auto-contrast configuration for color adjustments */
65
- autoContrast?: AutoContrastI[];
66
- /** If true, keeps general tab open until user interacts */
67
- keepGeneralTabOpenUntilInteracted?: boolean;
68
- /** If true, component can be started externally */
69
- isExternalStartCapable?: boolean;
70
- /** If true, waits for resources to load before showing */
71
- waitForResourcesLoad?: boolean;
72
- /** Paths to properties containing resource URLs
73
- * @internal
74
- * */
75
- resourcesPropPaths?: string[][];
76
- /** @internal */
77
- syncEnabled?: boolean;
78
- /** @internal */
79
- stylesImitationEnabled?: boolean;
80
- /** Opens ClPropertyPaneManifestModelName.COMPONENT_OPTIONS when a component is added to the widget */
81
- showComponentOptionsPropertyPaneOnInsert?: boolean;
82
- /** Opens ClPropertyPaneManifestModelName.INTEGRATION_FIELD_MAPPING when a component is added to the widget */
83
- showIntegrationFieldMappingPropertyPaneOnInsert?: boolean;
84
- }
85
-
86
- /**
87
- * Field mapping types for integration field configuration.
88
- */
89
- export enum ManifestMappingType {
90
- TEXT = 'TEXT',
91
- TEXT_AREA = 'TEXT_AREA',
92
- INTEGER = 'INTEGER',
93
- FLOAT = 'FLOAT',
94
- SELECT = 'SELECT',
95
- CHECKBOX_LIST = 'CHECKBOX_LIST',
96
- CHECKBOX = 'CHECKBOX',
97
- DATE = 'DATE',
98
- DATE_TIME = 'DATE_TIME',
99
- }
100
-
101
- /**
102
- * Translation strings organized by language code.
103
- */
104
- export interface ComponentManifestTranslationI {
105
- [languageCode: string]: ComponentManifestTranslationItemI;
106
- }
107
-
108
- /**
109
- * Translation items mapping property paths to translated values.
110
- */
111
- export interface ComponentManifestTranslationItemI {
112
- [propPath: string]: string;
113
- }
114
-
115
- /**
116
- * Component metadata for editor display and sorting.
117
- */
118
- export interface ComponentManifestMetaDescriptionI {
119
- /** Display labels by language */
120
- label: ComponentManifestDescriptionLabelItemI;
121
- /** Sort weight for ordering in component list */
122
- sortWeight?: number;
123
- /** Icon identifier for component */
124
- icon?: string;
125
- }
126
-
127
- /**
128
- * Component labels by language code.
129
- */
130
- export interface ComponentManifestDescriptionLabelItemI {
131
- [languageCode: string]: string;
132
- }
133
-
134
- /**
135
- * Auto-contrast configuration for automatic color adjustments.
136
- */
137
- export interface AutoContrastI {
138
- /** Master color source */
139
- master: AutoContrastMemberI;
140
- /** Slave color to adjust */
141
- slave: AutoContrastMemberI;
142
- /** Property path to enabled flag */
143
- enabledPropPath: string[];
144
- }
145
-
146
- /**
147
- * Member of an auto-contrast pair.
148
- */
149
- export interface AutoContrastMemberI {
150
- /** Target element name */
151
- element: string;
152
- /** Element property name */
153
- elementProp?: string;
154
- /** Element sub-property name */
155
- elementSubProp?: string;
156
- /** Alternative property path */
157
- propPath?: string[];
158
- /** If true, color is dimmed */
159
- dimmed?: boolean | null;
160
- }
@@ -1,52 +0,0 @@
1
- import {ClComponentType} from '../document/Document.interface';
2
-
3
- /**
4
- * Base interface for context menu manifest items.
5
- */
6
- export interface BaseContextMenuManifestModelI {
7
- /** Item type (group or control) */
8
- type: ContextMenuManifestModelType;
9
- /** Predefined control name */
10
- name?: ContextMenuManifestModelName;
11
- /** Property path in component model */
12
- propPath?: string[];
13
- /** Target element name */
14
- element?: string;
15
- /** Element property name */
16
- elementProp?: string;
17
- /** Element sub-property name */
18
- elementSubProp?: string;
19
- /** Child menu items */
20
- children?: BaseContextMenuManifestModelI[];
21
- }
22
-
23
- /**
24
- * Context menu item types.
25
- */
26
- export enum ContextMenuManifestModelType {
27
- /** Group container for menu items */
28
- GROUP = 'GROUP',
29
- /** Individual control item */
30
- CONTROL = 'CONTROL',
31
- }
32
-
33
- /**
34
- * Predefined context menu control names.
35
- */
36
- export enum ContextMenuManifestModelName {
37
- FOCUS_PARENT_COMPONENT = 'FOCUS_PARENT_COMPONENT',
38
- COMPONENT_OPERATIONS = 'COMPONENT_OPERATIONS',
39
- BRING_BACK_FORWARD = 'BRING_BACK_FORWARD',
40
- }
41
-
42
- export interface GroupContextMenuManifestModelI extends BaseContextMenuManifestModelI {
43
- children: BaseContextMenuManifestModelI[];
44
- }
45
-
46
- export interface FocusParentComponentContextMenuManifestModelI extends BaseContextMenuManifestModelI {
47
- params?: FocusParentComponentContextMenuManifestParamsI;
48
- }
49
-
50
- export interface FocusParentComponentContextMenuManifestParamsI {
51
- hideForEntryType: ClComponentType;
52
- }