@guardian/ophan-tracker-js 2.1.0 → 2.1.1-next.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.
Files changed (112) hide show
  1. package/dist/assets/adblock-detection.d.ts +5 -0
  2. package/dist/assets/adblock-detection.js +20 -0
  3. package/dist/assets/attention.d.ts +10 -0
  4. package/dist/assets/attention.js +126 -0
  5. package/dist/assets/campaign.d.ts +2 -0
  6. package/dist/assets/campaign.js +23 -0
  7. package/dist/assets/click-path-capture.d.ts +15 -0
  8. package/dist/assets/click-path-capture.js +68 -0
  9. package/dist/assets/components.d.ts +61 -0
  10. package/dist/assets/components.js +168 -0
  11. package/dist/assets/contribution.d.ts +6 -0
  12. package/{assets → dist/assets}/contribution.js +3 -12
  13. package/dist/assets/core.d.ts +65 -0
  14. package/dist/assets/core.js +230 -0
  15. package/dist/assets/embed.d.ts +6 -0
  16. package/{assets → dist/assets}/embed.js +2 -5
  17. package/dist/assets/fb-instant.d.ts +5 -0
  18. package/{assets → dist/assets}/fb-instant.js +1 -4
  19. package/dist/assets/heatmap.d.ts +6 -0
  20. package/dist/assets/heatmap.js +34 -0
  21. package/dist/assets/holidays.d.ts +6 -0
  22. package/{assets → dist/assets}/holidays.js +2 -5
  23. package/dist/assets/http-status.d.ts +6 -0
  24. package/{assets → dist/assets}/http-status.js +3 -5
  25. package/dist/assets/iframe-tracking.d.ts +2 -0
  26. package/dist/assets/iframe-tracking.js +80 -0
  27. package/dist/assets/interactive.d.ts +2 -0
  28. package/dist/assets/interactive.js +17 -0
  29. package/dist/assets/jobs-courses.d.ts +6 -0
  30. package/{assets → dist/assets}/jobs-courses.js +2 -5
  31. package/dist/assets/jobs.d.ts +6 -0
  32. package/{assets → dist/assets}/jobs.js +2 -5
  33. package/dist/assets/manage-my-account.d.ts +8 -0
  34. package/{assets → dist/assets}/manage-my-account.js +13 -22
  35. package/dist/assets/membership.d.ts +6 -0
  36. package/{assets → dist/assets}/membership.js +3 -12
  37. package/dist/assets/ng.d.ts +25 -0
  38. package/dist/assets/ng.js +53 -0
  39. package/dist/assets/perf.d.ts +3 -0
  40. package/dist/assets/perf.js +36 -0
  41. package/dist/assets/privatebrowsing.d.ts +7 -0
  42. package/dist/assets/privatebrowsing.js +66 -0
  43. package/dist/assets/r2.d.ts +5 -0
  44. package/{assets → dist/assets}/r2.js +2 -11
  45. package/dist/assets/smart-news.d.ts +6 -0
  46. package/{assets → dist/assets}/smart-news.js +3 -9
  47. package/dist/assets/support.d.ts +10 -0
  48. package/dist/assets/support.js +28 -0
  49. package/dist/assets/tests/click-path-capture.test.d.ts +2 -0
  50. package/dist/assets/tests/click-path-capture.test.js +44 -0
  51. package/dist/assets/tests/components.test.d.ts +2 -0
  52. package/dist/assets/tests/components.test.js +47 -0
  53. package/dist/assets/tests/core.test.d.ts +2 -0
  54. package/dist/assets/tests/core.test.js +161 -0
  55. package/dist/assets/tests/heatmap.test.d.ts +2 -0
  56. package/dist/assets/tests/heatmap.test.js +45 -0
  57. package/dist/assets/tests/transmit.test.d.ts +2 -0
  58. package/dist/assets/tests/transmit.test.js +118 -0
  59. package/dist/assets/transmit.d.ts +54 -0
  60. package/dist/assets/transmit.js +130 -0
  61. package/dist/assets/vendor/adBlockDetectionLib.d.ts +5 -0
  62. package/dist/assets/vendor/adBlockDetectionLib.js +312 -0
  63. package/dist/assets/visibility.d.ts +6 -0
  64. package/dist/assets/visibility.js +22 -0
  65. package/dist/assets/witness.d.ts +6 -0
  66. package/{assets → dist/assets}/witness.js +2 -5
  67. package/dist/types/abtest.d.ts +29 -0
  68. package/dist/types/abtest.js +0 -0
  69. package/dist/types/acquisition.d.ts +148 -0
  70. package/dist/types/acquisition.js +35 -0
  71. package/dist/types/component-event.d.ts +92 -0
  72. package/dist/types/component-event.js +67 -0
  73. package/dist/types/component-type.d.ts +58 -0
  74. package/dist/types/component-type.js +56 -0
  75. package/dist/types/consent.d.ts +47 -0
  76. package/dist/types/consent.js +15 -0
  77. package/dist/types/event.d.ts +115 -0
  78. package/dist/types/event.js +7 -0
  79. package/dist/types/inpageclick.d.ts +12 -0
  80. package/dist/types/inpageclick.js +0 -0
  81. package/dist/types/interaction.d.ts +18 -0
  82. package/dist/types/interaction.js +0 -0
  83. package/dist/types/link.d.ts +15 -0
  84. package/dist/types/link.js +0 -0
  85. package/dist/types/media.d.ts +103 -0
  86. package/dist/types/media.js +70 -0
  87. package/dist/types/platform.d.ts +33 -0
  88. package/dist/types/platform.js +33 -0
  89. package/dist/types/printproduct.d.ts +54 -0
  90. package/dist/types/printproduct.js +39 -0
  91. package/dist/types/product.d.ts +56 -0
  92. package/dist/types/product.js +54 -0
  93. package/dist/types/subscription.d.ts +65 -0
  94. package/dist/types/subscription.js +63 -0
  95. package/package.json +8 -5
  96. package/readme.md +98 -11
  97. package/assets/adblock-detection.js +0 -19
  98. package/assets/attention.js +0 -160
  99. package/assets/campaign.js +0 -25
  100. package/assets/click-path-capture.js +0 -80
  101. package/assets/components.js +0 -199
  102. package/assets/core.js +0 -282
  103. package/assets/heatmap.js +0 -53
  104. package/assets/iframe-tracking.js +0 -88
  105. package/assets/interactive.js +0 -17
  106. package/assets/ng.js +0 -41
  107. package/assets/perf.js +0 -40
  108. package/assets/privatebrowsing.js +0 -71
  109. package/assets/support.js +0 -34
  110. package/assets/transmit.js +0 -143
  111. package/assets/vendor/adBlockDetectionLib.js +0 -366
  112. package/assets/visibility.js +0 -23
@@ -0,0 +1,12 @@
1
+ import { LinkName } from "./link";
2
+ export interface InPageClick {
3
+ /**
4
+ * the component that contained the item clicked on
5
+ */
6
+ component?: string;
7
+ /**
8
+ * The link name associated with the element clicked.
9
+ */
10
+ linkName?: LinkName;
11
+ }
12
+ //# sourceMappingURL=inpageclick.d.ts.map
File without changes
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Represents an interaction on the web or apps
3
+ */
4
+ export interface Interaction {
5
+ /**
6
+ * Key for the interaction.
7
+ */
8
+ component: string;
9
+ /**
10
+ * Value associated with the interaction
11
+ */
12
+ value?: string;
13
+ /**
14
+ * The id of the atom that the interaction has come from
15
+ */
16
+ atomId?: string;
17
+ }
18
+ //# sourceMappingURL=interaction.d.ts.map
File without changes
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Represents the position and location of a link within the Guardian site.
3
+ * We hope to enhance this structure to include a better representation of what the links
4
+ * actually mean, but for now we just report exactly what the web site tells us,
5
+ * which is a hierarchical list of named items e.g.
6
+ * "more","container-2 | highlights","Front | /uk"
7
+ * "article","news | group-1+ | card-3","container-1 | headlines","Front | /uk"
8
+ */
9
+ export type LinkName = {
10
+ /**
11
+ * List of link names, most specific first
12
+ */
13
+ raw?: string[];
14
+ };
15
+ //# sourceMappingURL=link.d.ts.map
File without changes
@@ -0,0 +1,103 @@
1
+ export declare const VideoEventType: {
2
+ /**
3
+ * The media has been requested.
4
+ * Currently, it appears this event is only received for pre-roll videos.
5
+ */
6
+ readonly REQUEST: "video:content:request";
7
+ /**
8
+ * The media is ready to play.
9
+ */
10
+ readonly READY: "video:content:ready";
11
+ /**
12
+ * The media has started playing.
13
+ */
14
+ readonly PLAY: "video:content:play";
15
+ /**
16
+ * The media has played a quarter of the way through.
17
+ * Currently, it appears that pre-roll videos do not send this event.
18
+ */
19
+ readonly PERCENT25: "video:content:25";
20
+ /**
21
+ * The media has played half way though.
22
+ * Currently, it appears that pre-roll videos do not send this event.
23
+ */
24
+ readonly PERCENT50: "video:content:50";
25
+ /**
26
+ * The media has played three quarters of the way though.
27
+ * Currently, it appears that pre-roll videos do not send this event.
28
+ */
29
+ readonly PERCENT75: "video:content:75";
30
+ /**
31
+ * The media has played to the end.
32
+ * NB: "END" is a reserved word in thrift apparently
33
+ */
34
+ readonly THE_END: "video:content:end";
35
+ };
36
+ export type TVideoEventType = typeof VideoEventType[keyof typeof VideoEventType];
37
+ /**
38
+ * Details about media playback progress
39
+ * Note: currently only guardian-hosted videos are reported.
40
+ */
41
+ export interface AudioEvent {
42
+ /**
43
+ * The id of the media asset, e.g. gu-audio-454297906
44
+ * This matches up with the media id within the content api.
45
+ */
46
+ id: string;
47
+ /**
48
+ * The event type.
49
+ */
50
+ eventType: TAudioEventType;
51
+ }
52
+ export declare const AudioEventType: {
53
+ /**
54
+ * The media has been requested.
55
+ * Currently, it appears this event is only received for pre-roll videos.
56
+ */
57
+ readonly REQUEST: "audio:content:request";
58
+ /**
59
+ * The media is ready to play.
60
+ */
61
+ readonly READY: "audio:content:ready";
62
+ /**
63
+ * The media has started playing.
64
+ */
65
+ readonly PLAY: "audio:content:play";
66
+ /**
67
+ * The media has played a quarter of the way through.
68
+ * Currently, it appears that pre-roll videos do not send this event.
69
+ */
70
+ readonly PERCENT25: "audio:content:25";
71
+ /**
72
+ * The media has played half way though.
73
+ * Currently, it appears that pre-roll videos do not send this event.
74
+ */
75
+ readonly PERCENT50: "audio:content:50";
76
+ /**
77
+ * The media has played three quarters of the way though.
78
+ * Currently, it appears that pre-roll videos do not send this event.
79
+ */
80
+ readonly PERCENT75: "audio:content:75";
81
+ /**
82
+ * The media has played to the end.
83
+ * NB: "END" is a reserved word in thrift apparently
84
+ */
85
+ readonly THE_END: "audio:content:end";
86
+ };
87
+ export type TAudioEventType = typeof AudioEventType[keyof typeof AudioEventType];
88
+ /**
89
+ * Details about media playback progress
90
+ * Note: currently only guardian-hosted videos are reported.
91
+ */
92
+ export interface VideoEvent {
93
+ /**
94
+ * The id of the media asset, e.g. gu-video-454297906
95
+ * This matches up with the media id within the content api.
96
+ */
97
+ id: string;
98
+ /**
99
+ * The event type.
100
+ */
101
+ eventType: TVideoEventType;
102
+ }
103
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1,70 @@
1
+ export const VideoEventType = {
2
+ /**
3
+ * The media has been requested.
4
+ * Currently, it appears this event is only received for pre-roll videos.
5
+ */
6
+ REQUEST: "video:content:request",
7
+ /**
8
+ * The media is ready to play.
9
+ */
10
+ READY: "video:content:ready",
11
+ /**
12
+ * The media has started playing.
13
+ */
14
+ PLAY: "video:content:play",
15
+ /**
16
+ * The media has played a quarter of the way through.
17
+ * Currently, it appears that pre-roll videos do not send this event.
18
+ */
19
+ PERCENT25: "video:content:25",
20
+ /**
21
+ * The media has played half way though.
22
+ * Currently, it appears that pre-roll videos do not send this event.
23
+ */
24
+ PERCENT50: "video:content:50",
25
+ /**
26
+ * The media has played three quarters of the way though.
27
+ * Currently, it appears that pre-roll videos do not send this event.
28
+ */
29
+ PERCENT75: "video:content:75",
30
+ /**
31
+ * The media has played to the end.
32
+ * NB: "END" is a reserved word in thrift apparently
33
+ */
34
+ THE_END: "video:content:end",
35
+ };
36
+ export const AudioEventType = {
37
+ /**
38
+ * The media has been requested.
39
+ * Currently, it appears this event is only received for pre-roll videos.
40
+ */
41
+ REQUEST: "audio:content:request",
42
+ /**
43
+ * The media is ready to play.
44
+ */
45
+ READY: "audio:content:ready",
46
+ /**
47
+ * The media has started playing.
48
+ */
49
+ PLAY: "audio:content:play",
50
+ /**
51
+ * The media has played a quarter of the way through.
52
+ * Currently, it appears that pre-roll videos do not send this event.
53
+ */
54
+ PERCENT25: "audio:content:25",
55
+ /**
56
+ * The media has played half way though.
57
+ * Currently, it appears that pre-roll videos do not send this event.
58
+ */
59
+ PERCENT50: "audio:content:50",
60
+ /**
61
+ * The media has played three quarters of the way though.
62
+ * Currently, it appears that pre-roll videos do not send this event.
63
+ */
64
+ PERCENT75: "audio:content:75",
65
+ /**
66
+ * The media has played to the end.
67
+ * NB: "END" is a reserved word in thrift apparently
68
+ */
69
+ THE_END: "audio:content:end",
70
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The platform that served this request to the reader.
3
+ **/
4
+ export declare const Platform: {
5
+ readonly R2: "r2";
6
+ readonly NEXT_GEN: "next-gen";
7
+ readonly IOS_NATIVE_APP: "ios-native-app";
8
+ readonly ANDROID_NATIVE_APP: "android-native-app";
9
+ /**
10
+ * Served as a result of embedding a media item on a third party site.
11
+ * Note therefore you should not typically include this as a guardian
12
+ * "page view".
13
+ **/
14
+ readonly EMBED: "embed";
15
+ readonly MEMBERSHIP: "membership";
16
+ readonly FACEBOOK_INSTANT_ARTICLE: "facebook-instant-article";
17
+ readonly AMP: "amp";
18
+ readonly WITNESS: "witness";
19
+ readonly JOBS: "jobs";
20
+ readonly CONTRIBUTION: "contribution";
21
+ readonly YAHOO: "yahoo";
22
+ readonly AMAZON_ECHO: "amazon-echo";
23
+ readonly APPLE_NEWS: "apple-news";
24
+ readonly WINDOWS_NATIVE_APP: "windows-native-app";
25
+ readonly SCRIBD: "scribd";
26
+ readonly SUPPORT: "support";
27
+ readonly SUBSCRIBE: "subscribe";
28
+ readonly MANAGE_MY_ACCOUNT: "manage-my-account";
29
+ readonly SMART_NEWS: "smart-news";
30
+ readonly EDITIONS: "editions";
31
+ };
32
+ export type TPlatform = typeof Platform[keyof typeof Platform];
33
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The platform that served this request to the reader.
3
+ **/
4
+ export const Platform = {
5
+ R2: "r2",
6
+ NEXT_GEN: "next-gen",
7
+ IOS_NATIVE_APP: "ios-native-app",
8
+ ANDROID_NATIVE_APP: "android-native-app",
9
+ /**
10
+ * Served as a result of embedding a media item on a third party site.
11
+ * Note therefore you should not typically include this as a guardian
12
+ * "page view".
13
+ **/
14
+ EMBED: "embed",
15
+ MEMBERSHIP: "membership",
16
+ FACEBOOK_INSTANT_ARTICLE: "facebook-instant-article",
17
+ /* https://www.ampproject.org/ */
18
+ AMP: "amp",
19
+ WITNESS: "witness",
20
+ JOBS: "jobs",
21
+ CONTRIBUTION: "contribution",
22
+ YAHOO: "yahoo",
23
+ AMAZON_ECHO: "amazon-echo",
24
+ APPLE_NEWS: "apple-news",
25
+ WINDOWS_NATIVE_APP: "windows-native-app",
26
+ SCRIBD: "scribd",
27
+ SUPPORT: "support",
28
+ SUBSCRIBE: "subscribe",
29
+ MANAGE_MY_ACCOUNT: "manage-my-account",
30
+ SMART_NEWS: "smart-news",
31
+ /* also called "The Daily Edition" and other names */
32
+ EDITIONS: "editions"
33
+ };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Differentiates between the (many) different types of print product
3
+ **/
4
+ export declare const PrintProduct: {
5
+ readonly VOUCHER_SATURDAY: "voucher-saturday";
6
+ readonly VOUCHER_SATURDAY_PLUS: "voucher-saturday-plus";
7
+ readonly VOUCHER_WEEKLY_AND_SATURDAY: "voucher-weekly-and-saturday";
8
+ readonly VOUCHER_WEEKLY_AND_SATURDAY_PLUS: "voucher-weekly-and-saturday-plus";
9
+ readonly VOUCHER_SUNDAY: "voucher-sunday";
10
+ readonly VOUCHER_SUNDAY_PLUS: "voucher-sunday-plus";
11
+ /**
12
+ * DEPRECATED DO NOT USE
13
+ * This enum has a spelling mistake. Use VOUCHER_WEEKEND (27) instead
14
+ **/
15
+ readonly VOUCHER_WEEKEND: "voucher-weekend";
16
+ /**
17
+ * DEPRECATED DO NOT USE
18
+ * This enum has a spelling mistake. Use VOUCHER_WEEKEND_PLUS (28) instead
19
+ **/
20
+ readonly VOUCHER_WEEKEND_PLUS: "voucher-weekend-plus";
21
+ readonly VOUCHER_SIXDAY: "voucher-sixday";
22
+ readonly VOUCHER_SIXDAY_PLUS: "voucher-sixday-plus";
23
+ readonly VOUCHER_EVERYDAY: "voucher-everyday";
24
+ readonly VOUCHER_EVERYDAY_PLUS: "voucher-everyday-plus";
25
+ readonly HOME_DELIVERY_SATURDAY: "home-delivery-saturday";
26
+ readonly HOME_DELIVERY_SATURDAY_PLUS: "home-delivery-saturday-plus";
27
+ readonly HOME_DELIVERY_WEEKLY_AND_SATURDAY: "home-delivery-weekly-and-saturday";
28
+ readonly HOME_DELIVERY_WEEKLY_AND_SATURDAY_PLUS: "home-delivery-weekly-and-saturday-plus";
29
+ readonly HOME_DELIVERY_SUNDAY: "home-delivery-sunday";
30
+ readonly HOME_DELIVERY_SUNDAY_PLUS: "home-delivery-sunday-plus";
31
+ readonly HOME_DELIVERY_WEEKEND: "home-delivery-weekend";
32
+ readonly HOME_DELIVERY_WEEKEND_PLUS: "home-delivery-weekend-plus";
33
+ readonly HOME_DELIVERY_SIXDAY: "home-delivery-sixday";
34
+ readonly HOME_DELIVERY_SIXDAY_PLUS: "home-delivery-sixday-plus";
35
+ readonly HOME_DELIVERY_EVERYDAY: "home-delivery-everyday";
36
+ readonly HOME_DELIVERY_EVERYDAY_PLUS: "home-delivery-everyday-plus";
37
+ readonly GUARDIAN_WEEKLY: "guardian-weekly";
38
+ readonly GUARDIAN_WEEKLY_PLUS: "guardian-weekly-plus";
39
+ };
40
+ export type TPrintProduct = typeof PrintProduct[keyof typeof PrintProduct];
41
+ /**
42
+ * Extra parameters only applicable to print products
43
+ */
44
+ export interface PrintOptions {
45
+ /**
46
+ * Differentiates between the (many) different types of print product
47
+ */
48
+ product: TPrintProduct;
49
+ /**
50
+ * The deliver country of the print subscription
51
+ */
52
+ deliveryCountryCode: string;
53
+ }
54
+ //# sourceMappingURL=printproduct.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Differentiates between the (many) different types of print product
3
+ **/
4
+ export const PrintProduct = {
5
+ VOUCHER_SATURDAY: "voucher-saturday",
6
+ VOUCHER_SATURDAY_PLUS: "voucher-saturday-plus",
7
+ VOUCHER_WEEKLY_AND_SATURDAY: "voucher-weekly-and-saturday",
8
+ VOUCHER_WEEKLY_AND_SATURDAY_PLUS: "voucher-weekly-and-saturday-plus",
9
+ VOUCHER_SUNDAY: "voucher-sunday",
10
+ VOUCHER_SUNDAY_PLUS: "voucher-sunday-plus",
11
+ /**
12
+ * DEPRECATED DO NOT USE
13
+ * This enum has a spelling mistake. Use VOUCHER_WEEKEND (27) instead
14
+ **/
15
+ VOUCHER_WEEKEND: "voucher-weekend", // Original: VOUCER_WEEKEND - Corrected spelling and adapted to TS syntax
16
+ /**
17
+ * DEPRECATED DO NOT USE
18
+ * This enum has a spelling mistake. Use VOUCHER_WEEKEND_PLUS (28) instead
19
+ **/
20
+ VOUCHER_WEEKEND_PLUS: "voucher-weekend-plus", // Original: VOUCER_WEEKEND_PLUS - Corrected spelling and adapted to TS syntax
21
+ VOUCHER_SIXDAY: "voucher-sixday",
22
+ VOUCHER_SIXDAY_PLUS: "voucher-sixday-plus",
23
+ VOUCHER_EVERYDAY: "voucher-everyday",
24
+ VOUCHER_EVERYDAY_PLUS: "voucher-everyday-plus",
25
+ HOME_DELIVERY_SATURDAY: "home-delivery-saturday",
26
+ HOME_DELIVERY_SATURDAY_PLUS: "home-delivery-saturday-plus",
27
+ HOME_DELIVERY_WEEKLY_AND_SATURDAY: "home-delivery-weekly-and-saturday",
28
+ HOME_DELIVERY_WEEKLY_AND_SATURDAY_PLUS: "home-delivery-weekly-and-saturday-plus",
29
+ HOME_DELIVERY_SUNDAY: "home-delivery-sunday",
30
+ HOME_DELIVERY_SUNDAY_PLUS: "home-delivery-sunday-plus",
31
+ HOME_DELIVERY_WEEKEND: "home-delivery-weekend",
32
+ HOME_DELIVERY_WEEKEND_PLUS: "home-delivery-weekend-plus",
33
+ HOME_DELIVERY_SIXDAY: "home-delivery-sixday",
34
+ HOME_DELIVERY_SIXDAY_PLUS: "home-delivery-sixday-plus",
35
+ HOME_DELIVERY_EVERYDAY: "home-delivery-everyday",
36
+ HOME_DELIVERY_EVERYDAY_PLUS: "home-delivery-everyday-plus",
37
+ GUARDIAN_WEEKLY: "guardian-weekly",
38
+ GUARDIAN_WEEKLY_PLUS: "guardian-weekly-plus"
39
+ };
@@ -0,0 +1,56 @@
1
+ export declare const Product: {
2
+ /**
3
+ * A one-off contribution
4
+ */
5
+ readonly CONTRIBUTION: "CONTRIBUTION";
6
+ /**
7
+ * A recurring contribution
8
+ */
9
+ readonly RECURRING_CONTRIBUTION: "RECURRING_CONTRIBUTION";
10
+ /**
11
+ * A Membership Supporter signup
12
+ */
13
+ readonly MEMBERSHIP_SUPPORTER: "MEMBERSHIP_SUPPORTER";
14
+ /**
15
+ * A Membership Patron signup
16
+ */
17
+ readonly MEMBERSHIP_PATRON: "MEMBERSHIP_PATRON";
18
+ /**
19
+ * A Membership Partner signup
20
+ */
21
+ readonly MEMBERSHIP_PARTNER: "MEMBERSHIP_PARTNER";
22
+ /**
23
+ * A digital subscription
24
+ */
25
+ readonly DIGITAL_SUBSCRIPTION: "DIGITAL_SUBSCRIPTION";
26
+ /**
27
+ * DEPRECATED DO NOT USE
28
+ */
29
+ readonly PAPER_SUBSCRIPTION_EVERYDAY: "PAPER_SUBSCRIPTION_EVERYDAY";
30
+ /**
31
+ * DEPRECATED DO NOT USE
32
+ */
33
+ readonly PAPER_SUBSCRIPTION_SIXDAY: "PAPER_SUBSCRIPTION_SIXDAY";
34
+ /**
35
+ * DEPRECATED DO NOT USE
36
+ */
37
+ readonly PAPER_SUBSCRIPTION_WEEKEND: "PAPER_SUBSCRIPTION_WEEKEND";
38
+ /**
39
+ * DEPRECATED DO NOT USE
40
+ */
41
+ readonly PAPER_SUBSCRIPTION_SUNDAY: "PAPER_SUBSCRIPTION_SUNDAY";
42
+ /**
43
+ * A paper subscription
44
+ */
45
+ readonly PRINT_SUBSCRIPTION: "PRINT_SUBSCRIPTION";
46
+ /**
47
+ * An app premium tier signup
48
+ */
49
+ readonly APP_PREMIUM_TIER: "APP_PREMIUM_TIER";
50
+ /**
51
+ * Supporter plus tier.
52
+ */
53
+ readonly SUPPORTER_PLUS: "SUPPORTER_PLUS";
54
+ };
55
+ export type TProduct = typeof Product[keyof typeof Product];
56
+ //# sourceMappingURL=product.d.ts.map
@@ -0,0 +1,54 @@
1
+ export const Product = {
2
+ /**
3
+ * A one-off contribution
4
+ */
5
+ CONTRIBUTION: "CONTRIBUTION",
6
+ /**
7
+ * A recurring contribution
8
+ */
9
+ RECURRING_CONTRIBUTION: "RECURRING_CONTRIBUTION",
10
+ /**
11
+ * A Membership Supporter signup
12
+ */
13
+ MEMBERSHIP_SUPPORTER: "MEMBERSHIP_SUPPORTER",
14
+ /**
15
+ * A Membership Patron signup
16
+ */
17
+ MEMBERSHIP_PATRON: "MEMBERSHIP_PATRON",
18
+ /**
19
+ * A Membership Partner signup
20
+ */
21
+ MEMBERSHIP_PARTNER: "MEMBERSHIP_PARTNER",
22
+ /**
23
+ * A digital subscription
24
+ */
25
+ DIGITAL_SUBSCRIPTION: "DIGITAL_SUBSCRIPTION",
26
+ /**
27
+ * DEPRECATED DO NOT USE
28
+ */
29
+ PAPER_SUBSCRIPTION_EVERYDAY: "PAPER_SUBSCRIPTION_EVERYDAY",
30
+ /**
31
+ * DEPRECATED DO NOT USE
32
+ */
33
+ PAPER_SUBSCRIPTION_SIXDAY: "PAPER_SUBSCRIPTION_SIXDAY",
34
+ /**
35
+ * DEPRECATED DO NOT USE
36
+ */
37
+ PAPER_SUBSCRIPTION_WEEKEND: "PAPER_SUBSCRIPTION_WEEKEND",
38
+ /**
39
+ * DEPRECATED DO NOT USE
40
+ */
41
+ PAPER_SUBSCRIPTION_SUNDAY: "PAPER_SUBSCRIPTION_SUNDAY",
42
+ /**
43
+ * A paper subscription
44
+ */
45
+ PRINT_SUBSCRIPTION: "PRINT_SUBSCRIPTION",
46
+ /**
47
+ * An app premium tier signup
48
+ */
49
+ APP_PREMIUM_TIER: "APP_PREMIUM_TIER",
50
+ /**
51
+ * Supporter plus tier.
52
+ */
53
+ SUPPORTER_PLUS: "SUPPORTER_PLUS",
54
+ };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * What type of subscription the user has (or had) for the app
3
+ */
4
+ export declare const SubscriptionType: {
5
+ /**
6
+ * No subscription in place, and no previous record of a subscription on this device.
7
+ */
8
+ readonly FREE: 1;
9
+ /**
10
+ * User has an active subscription via the device's store.
11
+ *
12
+ * In json, "play" or "apple" are supported as synonyms of this value.
13
+ */
14
+ readonly STORE: 2;
15
+ /**
16
+ * User as an active subscription as part of a print bundle
17
+ */
18
+ readonly PRINT: 4;
19
+ /**
20
+ * No subscription in place, but user did previously have a subscription via the
21
+ * device's store which is now expired.
22
+ *
23
+ * In json, "play:expired" and "apple:expired" are supported as synonyms of this value.
24
+ */
25
+ readonly FREE_WITH_EXPIRED_STORE: 3;
26
+ /**
27
+ * No subscription in place, but user did previously have a subscription as
28
+ * part of a print bundle which is now expired.
29
+ *
30
+ * In json, "print:expired" is supported as a synonym of this value.
31
+ */
32
+ readonly FREE_WITH_EXPIRED_PRINT: 5;
33
+ /**
34
+ * User has an active digital pack subscription.
35
+ */
36
+ readonly DIGITAL_PACK: 6;
37
+ };
38
+ export type TSubscriptionType = typeof SubscriptionType[keyof typeof SubscriptionType];
39
+ /**
40
+ * What tier of membership the user is currently part of.
41
+ */
42
+ export declare const MembershipTier: {
43
+ /**
44
+ * The user is a friend.
45
+ */
46
+ readonly FRIEND: 1;
47
+ /**
48
+ * The user is a Guardian employee.
49
+ */
50
+ readonly STAFF: 2;
51
+ /**
52
+ * The user is a supporter.
53
+ */
54
+ readonly SUPPORTER: 3;
55
+ /**
56
+ * The user is a partner.
57
+ */
58
+ readonly PARTNER: 4;
59
+ /**
60
+ * The user is a patron.
61
+ */
62
+ readonly PATRON: 5;
63
+ };
64
+ export type TMembershipTier = typeof MembershipTier[keyof typeof MembershipTier];
65
+ //# sourceMappingURL=subscription.d.ts.map
@@ -0,0 +1,63 @@
1
+ // TypeScript definition file
2
+ /**
3
+ * What type of subscription the user has (or had) for the app
4
+ */
5
+ export const SubscriptionType = {
6
+ /**
7
+ * No subscription in place, and no previous record of a subscription on this device.
8
+ */
9
+ FREE: 1,
10
+ /**
11
+ * User has an active subscription via the device's store.
12
+ *
13
+ * In json, "play" or "apple" are supported as synonyms of this value.
14
+ */
15
+ STORE: 2,
16
+ /**
17
+ * User as an active subscription as part of a print bundle
18
+ */
19
+ PRINT: 4,
20
+ /**
21
+ * No subscription in place, but user did previously have a subscription via the
22
+ * device's store which is now expired.
23
+ *
24
+ * In json, "play:expired" and "apple:expired" are supported as synonyms of this value.
25
+ */
26
+ FREE_WITH_EXPIRED_STORE: 3,
27
+ /**
28
+ * No subscription in place, but user did previously have a subscription as
29
+ * part of a print bundle which is now expired.
30
+ *
31
+ * In json, "print:expired" is supported as a synonym of this value.
32
+ */
33
+ FREE_WITH_EXPIRED_PRINT: 5,
34
+ /**
35
+ * User has an active digital pack subscription.
36
+ */
37
+ DIGITAL_PACK: 6,
38
+ };
39
+ /**
40
+ * What tier of membership the user is currently part of.
41
+ */
42
+ export const MembershipTier = {
43
+ /**
44
+ * The user is a friend.
45
+ */
46
+ FRIEND: 1,
47
+ /**
48
+ * The user is a Guardian employee.
49
+ */
50
+ STAFF: 2,
51
+ /**
52
+ * The user is a supporter.
53
+ */
54
+ SUPPORTER: 3,
55
+ /**
56
+ * The user is a partner.
57
+ */
58
+ PARTNER: 4,
59
+ /**
60
+ * The user is a patron.
61
+ */
62
+ PATRON: 5,
63
+ };
package/package.json CHANGED
@@ -1,29 +1,32 @@
1
1
  {
2
2
  "name": "@guardian/ophan-tracker-js",
3
- "version": "2.1.0",
3
+ "version": "2.1.1-next.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=16"
7
7
  },
8
8
  "files": [
9
- "assets/*.js",
10
- "assets/vendor/*.js"
9
+ "dist/**/*.js",
10
+ "dist/**/*.d.ts"
11
11
  ],
12
- "main": "assets/ng.js",
12
+ "main": "dist/assets/ng.js",
13
13
  "devDependencies": {
14
14
  "@babel/preset-env": "7.22.10",
15
15
  "@changesets/cli": "^2.26.2",
16
16
  "@guardian/prettier": "^7.0.0",
17
17
  "@rollup/plugin-babel": "6.0.3",
18
18
  "@rollup/plugin-terser": "0.4.3",
19
+ "@rollup/plugin-typescript": "^11.1.6",
19
20
  "jest": "^29.7.0",
20
21
  "jest-environment-jsdom": "^29.7.0",
21
22
  "rollup": "3.28.0",
22
- "rollup-jest": "^3.1.0"
23
+ "rollup-jest": "^3.1.0",
24
+ "typescript": "^5.4.4"
23
25
  },
24
26
  "scripts": {
25
27
  "build": "NODE_ENV=production npx rollup -c",
26
28
  "build:test": "NODE_ENV=test npx rollup -c",
29
+ "build-types": "tsc",
27
30
  "test": "jest",
28
31
  "format": "npx prettier --write ."
29
32
  }