@financial-times/cp-content-pipeline-ui 1.4.3 → 2.0.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 (64) hide show
  1. package/.babelrc.json +1 -0
  2. package/CHANGELOG.md +17 -0
  3. package/jest.config.js +18 -1
  4. package/lib/client.d.ts +1 -0
  5. package/lib/client.js +9 -0
  6. package/lib/client.js.map +1 -0
  7. package/lib/components/Clip/client/index.d.ts +117 -0
  8. package/lib/components/Clip/client/index.js +856 -0
  9. package/lib/components/Clip/client/index.js.map +1 -0
  10. package/lib/components/Clip/client/progressBar.d.ts +46 -0
  11. package/lib/components/Clip/client/progressBar.js +205 -0
  12. package/lib/components/Clip/client/progressBar.js.map +1 -0
  13. package/lib/components/Clip/client/utils.d.ts +5 -0
  14. package/lib/components/Clip/client/utils.js +89 -0
  15. package/lib/components/Clip/client/utils.js.map +1 -0
  16. package/lib/components/Clip/index.d.ts +1 -1
  17. package/lib/components/Clip/index.js +5 -2
  18. package/lib/components/Clip/index.js.map +1 -1
  19. package/lib/components/Clip/template/component.d.ts +16 -0
  20. package/lib/components/Clip/template/component.js +74 -0
  21. package/lib/components/Clip/template/component.js.map +1 -0
  22. package/lib/components/Clip/template/index.d.ts +3 -0
  23. package/lib/components/Clip/template/index.js +17 -0
  24. package/lib/components/Clip/template/index.js.map +1 -0
  25. package/lib/components/Clip/test/fixtures.d.ts +2 -0
  26. package/lib/components/Clip/test/fixtures.js +29 -0
  27. package/lib/components/Clip/test/fixtures.js.map +1 -0
  28. package/lib/components/Clip/test/index.spec.d.ts +1 -0
  29. package/lib/components/Clip/test/index.spec.js +793 -0
  30. package/lib/components/Clip/test/index.spec.js.map +1 -0
  31. package/lib/components/Clip/test/progressBar.spec.d.ts +1 -0
  32. package/lib/components/Clip/test/progressBar.spec.js +176 -0
  33. package/lib/components/Clip/test/progressBar.spec.js.map +1 -0
  34. package/lib/components/Clip/test/snapshot.spec.d.ts +1 -0
  35. package/lib/components/Clip/test/snapshot.spec.js +65 -0
  36. package/lib/components/Clip/test/snapshot.spec.js.map +1 -0
  37. package/lib/index.d.ts +1 -0
  38. package/lib/index.js +3 -1
  39. package/lib/index.js.map +1 -1
  40. package/lib/stories/Clip.stories.d.ts +58 -0
  41. package/lib/stories/Clip.stories.js +124 -0
  42. package/lib/stories/Clip.stories.js.map +1 -0
  43. package/package.json +6 -3
  44. package/src/client.ts +1 -0
  45. package/src/components/Clip/client/index.ts +1000 -0
  46. package/src/components/Clip/client/main.scss +356 -0
  47. package/src/components/Clip/client/progressBar.scss +89 -0
  48. package/src/components/Clip/client/progressBar.ts +239 -0
  49. package/src/components/Clip/client/utils.ts +93 -0
  50. package/src/components/Clip/index.tsx +1 -1
  51. package/src/components/Clip/template/component.tsx +191 -0
  52. package/src/components/Clip/template/index.ts +13 -0
  53. package/src/components/Clip/test/__snapshots__/snapshot.spec.tsx.snap +403 -0
  54. package/src/components/Clip/test/fixtures.ts +27 -0
  55. package/src/components/Clip/test/index.spec.ts +905 -0
  56. package/src/components/Clip/test/progressBar.spec.ts +168 -0
  57. package/src/components/Clip/test/snapshot.spec.tsx +103 -0
  58. package/src/index.ts +1 -0
  59. package/src/stories/Clip.stories.scss +311 -1
  60. package/src/stories/Clip.stories.tsx +241 -0
  61. package/src/types/o-types.d.ts +2 -0
  62. package/tsconfig.tsbuildinfo +1 -1
  63. package/src/components/Clip/clip.d.ts +0 -16
  64. package/src/stories/Clip.stories.js +0 -43
package/.babelrc.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "sourceType": "unambiguous",
3
3
  "presets": [
4
+ "@babel/preset-typescript",
4
5
  [
5
6
  "@babel/preset-env",
6
7
  {
package/CHANGELOG.md CHANGED
@@ -342,6 +342,23 @@
342
342
  * @financial-times/cp-content-pipeline-client bumped from ^1.3.7 to ^1.3.8
343
343
  * @financial-times/cp-content-pipeline-schema bumped from ^1.3.4 to ^1.3.5
344
344
 
345
+ ## [2.0.0](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v1.4.3...cp-content-pipeline-ui-v2.0.0) (2023-09-20)
346
+
347
+
348
+ ### ⚠ BREAKING CHANGES
349
+
350
+ * add new Clip version
351
+
352
+ ### Features
353
+
354
+ * add new Clip version ([77dfd13](https://github.com/Financial-Times/cp-content-pipeline/commit/77dfd13f1f67884abb53ec7f5585df9cbb611f8d))
355
+
356
+
357
+ ### Bug Fixes
358
+
359
+ * autoplay progress ([6b58f69](https://github.com/Financial-Times/cp-content-pipeline/commit/6b58f693d263cd904a74c6181030c560c7ca68c1))
360
+ * transcript icon not cut ([44d67c8](https://github.com/Financial-Times/cp-content-pipeline/commit/44d67c86df3734d9d8179d7751f4c528e407f169))
361
+
345
362
  ## [1.4.2](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v1.3.6...cp-content-pipeline-ui-v1.4.2) (2023-09-18)
346
363
 
347
364
 
package/jest.config.js CHANGED
@@ -1,6 +1,23 @@
1
1
  const base = require('../../jest.config.base.js')
2
-
3
2
  module.exports = {
4
3
  ...base,
5
4
  testEnvironment: 'jsdom',
5
+ transformIgnorePatterns: [
6
+ // Need to transform all node from the FT
7
+ "/node_modules/(?!@financial-times)"
8
+ ],
9
+ transform: {
10
+ ...base.transform,
11
+ '.(js)': '@sucrase/jest-plugin'
12
+ },
13
+ moduleNameMapper: {
14
+ ...base.moduleNameMapper,
15
+ '^@financial-times/o-expander$':
16
+ '<rootDir>/../../node_modules/@financial-times/o-expander/main.js',
17
+ '^@financial-times/o-viewport$':
18
+ '<rootDir>/../../node_modules/@financial-times/o-viewport/main.js',
19
+ }
20
+ ,
21
+ maxWorkers: '50%', // Adjust the number based on your CircleCI resources
22
+
6
23
  }
@@ -0,0 +1 @@
1
+ export { default as Clip } from './components/Clip/client/index';
package/lib/client.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Clip = void 0;
7
+ var index_1 = require("./components/Clip/client/index");
8
+ Object.defineProperty(exports, "Clip", { enumerable: true, get: function () { return __importDefault(index_1).default; } });
9
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgE;AAAvD,8GAAA,OAAO,OAAQ"}
@@ -0,0 +1,117 @@
1
+ /// <reference types="node" />
2
+ import ProgressBar from './progressBar';
3
+ interface Opts {
4
+ autorender?: boolean;
5
+ autoplay?: boolean | string;
6
+ id?: string;
7
+ layout?: string;
8
+ fallbackImage?: boolean;
9
+ mute?: boolean | string;
10
+ noAudio?: boolean | string;
11
+ fadeOutDelay?: number;
12
+ progressBarTimeTriggerTap?: number;
13
+ progressBarTapDelay?: number;
14
+ progressTimeStepSeconds?: number;
15
+ }
16
+ declare class ClipInterface {
17
+ constructor(el: HTMLElement, opts: any);
18
+ init(): void;
19
+ unload(): void;
20
+ destroy(): void;
21
+ }
22
+ declare class Clip extends ClipInterface {
23
+ containerEl: HTMLElement;
24
+ videoEl: HTMLVideoElement;
25
+ amountWatched: number;
26
+ loop: number;
27
+ canAutoplay: boolean;
28
+ useCustomPlayer: boolean;
29
+ started: boolean;
30
+ playStart: number | undefined;
31
+ opts: Opts;
32
+ private isInViewPort;
33
+ private fireWatchedEvent;
34
+ private onResizeEvent;
35
+ private onClickOutsideEvent;
36
+ private onOfflineEvent;
37
+ private onOnlineEvent;
38
+ private onKeyFocusEvent;
39
+ private observer;
40
+ private lastQuarter;
41
+ dispatchedProgress: any;
42
+ private expander;
43
+ private autoplayPaused;
44
+ private offlineMessageEl;
45
+ private progressRing;
46
+ private lastTimeUpdate;
47
+ private muteIcon;
48
+ private controls;
49
+ private playText;
50
+ private progressBar;
51
+ private isMobileDevice;
52
+ constructor(el: HTMLElement, opts: Opts);
53
+ get autoplay(): boolean;
54
+ get muted(): boolean;
55
+ set muted(value: boolean);
56
+ unload(): void;
57
+ init(): Promise<void>;
58
+ checkLoop(progress?: null | number): void;
59
+ checkIfElementInDOM(): boolean;
60
+ fireEvent(action: string, extraDetail?: {}): void;
61
+ getTrackingData(eventType: string): any;
62
+ getProgress(rounded?: boolean): number;
63
+ getRelevantProgress(): number;
64
+ getDuration(): number;
65
+ getAmountWatched(decimalPoints?: number | undefined): number;
66
+ getAmountWatchedPercentage(decimalPoints: number | undefined): number;
67
+ markPlayStart(): void;
68
+ updateAmountWatched(): void;
69
+ destroy(): void;
70
+ hasEnoughBufferToPlay(): boolean;
71
+ isVideoPlaying(): boolean;
72
+ createCustomPlayer(): void;
73
+ createOfflineMessage(): void;
74
+ showOffLineMessage(): void;
75
+ hideOffLineMessage(): void;
76
+ createNoAudioIcon(): HTMLButtonElement;
77
+ visibilityListener([observed]: IntersectionObserverEntry[]): void;
78
+ addEvents(events: Array<string>): void;
79
+ eventListener(ev: Event): void;
80
+ fadeIn(): void;
81
+ fadeOut(immediate?: boolean): NodeJS.Timeout | undefined;
82
+ getClipPathStringFromProgress(percentage: number): string;
83
+ isDirectPauseEvent(): boolean;
84
+ shouldDispatch(): boolean;
85
+ videoHasAudio(): any;
86
+ videoHasNoAudio(hasNoAudio?: boolean): string | boolean | undefined;
87
+ descriptionToggle(): void;
88
+ showDescription(): void;
89
+ onClickOutside(event: MouseEvent): void;
90
+ onKeyFocus: (event: KeyboardEvent) => void;
91
+ resizeControls(): void;
92
+ isFocused(): boolean;
93
+ togglePlay(): void;
94
+ createProgressBar(): ProgressBar;
95
+ static init(rootElParam?: HTMLElement | string | null, config?: Opts): ClipInterface[];
96
+ }
97
+ export declare class ClipFallbackImage extends ClipInterface {
98
+ containerEl: HTMLElement;
99
+ posterUrl: string;
100
+ dataLayout: string;
101
+ opts: Opts;
102
+ private fallbackImage;
103
+ constructor(clipWithPoster: HTMLElement, opts?: {});
104
+ init(): void;
105
+ fireEvent(action: string, extraDetail?: {}): void;
106
+ getTrackingData(eventType: string): {
107
+ category: string;
108
+ action: string;
109
+ video: {
110
+ type: string;
111
+ source_url: string | undefined;
112
+ layout: string | undefined;
113
+ };
114
+ };
115
+ }
116
+ export declare function showImageInsteadOfClipInClient(): void;
117
+ export default Clip;