@edx/frontend-plugin-advertisements 1.15.3 → 1.16.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.
- package/README.rst +122 -0
- package/package.json +1 -1
package/README.rst
CHANGED
|
@@ -35,6 +35,128 @@ documented in the repository README.
|
|
|
35
35
|
|
|
36
36
|
.. _Learning MFE: https://github.com/openedx/frontend-app-learning
|
|
37
37
|
|
|
38
|
+
Local Setup and Installation
|
|
39
|
+
----------------------------
|
|
40
|
+
|
|
41
|
+
- Navigate to whichever parent folder holds your edx devstack folders
|
|
42
|
+
- Navigate to the src folder, and clone this repo by running: `git clone git@github.com:edx/frontend-plugin-advertisements.git`
|
|
43
|
+
- In `frontend-app-learning`, Add these lines to your `env.config.js` file:
|
|
44
|
+
```
|
|
45
|
+
import { UpgradeNotification, LockPaywall } from '@edx/frontend-plugin-advertisements';
|
|
46
|
+
import { PLUGIN_OPERATIONS, DIRECT_PLUGIN } from '@openedx/frontend-plugin-framework';
|
|
47
|
+
|
|
48
|
+
// Insert any other imports here
|
|
49
|
+
|
|
50
|
+
// Load environment variables from .env file
|
|
51
|
+
const config = {
|
|
52
|
+
pluginSlots: {
|
|
53
|
+
|
|
54
|
+
// Insert any other plugins here
|
|
55
|
+
|
|
56
|
+
notification_widget_plugin: {
|
|
57
|
+
plugins: [
|
|
58
|
+
{
|
|
59
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
60
|
+
widget: {
|
|
61
|
+
id: 'notification_widget_plugin',
|
|
62
|
+
type: DIRECT_PLUGIN,
|
|
63
|
+
RenderWidget: UpgradeNotification,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
notification_tray_plugin: {
|
|
69
|
+
plugins: [
|
|
70
|
+
{
|
|
71
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
72
|
+
widget: {
|
|
73
|
+
id: 'notification_tray_plugin',
|
|
74
|
+
type: DIRECT_PLUGIN,
|
|
75
|
+
RenderWidget: UpgradeNotification,
|
|
76
|
+
// RenderWidget: DefaultUpgradeNotification,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
outline_tab_notifications_plugin: {
|
|
82
|
+
keepDefault: false,
|
|
83
|
+
plugins: [
|
|
84
|
+
{
|
|
85
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
86
|
+
widget: {
|
|
87
|
+
id: 'outline_tab_notifications_plugin',
|
|
88
|
+
type: DIRECT_PLUGIN,
|
|
89
|
+
RenderWidget: UpgradeNotification,
|
|
90
|
+
// RenderWidget: DefaultUpgradeNotification,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
fbe_message_plugin: { // plugin slot id
|
|
96
|
+
keepDefault: false,
|
|
97
|
+
plugins: [
|
|
98
|
+
{
|
|
99
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
100
|
+
widget: {
|
|
101
|
+
id: 'fbe_message_plugin',
|
|
102
|
+
type: DIRECT_PLUGIN,
|
|
103
|
+
priority: 10,
|
|
104
|
+
RenderWidget: LockPaywall,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
OPTIMIZELY_FULL_STACK_SDK_KEY: 'vtr_upgrade',
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export default config;
|
|
114
|
+
```
|
|
115
|
+
- Restart frontend-app-learning
|
|
116
|
+
|
|
117
|
+
Experiments
|
|
118
|
+
-----------
|
|
119
|
+
- In order to view experiments locally:
|
|
120
|
+
- Make sure your devstack is up and running.
|
|
121
|
+
- Sign into the LMS using your audit account (username: `audit@example.com`, password: `edx`).
|
|
122
|
+
- Navigate to the demo course: http://localhost:2000/course/course-v1:edX+DemoX+Demo_Course/home
|
|
123
|
+
- The demo course already has a paywall for the verified track enabled
|
|
124
|
+
|
|
125
|
+
- The experiments present in this repo as of 05-29-2025 can be tested as such:
|
|
126
|
+
- In mocks/optimizely/index.jsx, switch enabled to "true" and variationKey to your desired variationKey
|
|
127
|
+
- These variationKeys can be found in data/optimizely.js:
|
|
128
|
+
|
|
129
|
+
- NOTE: Please update this whenever an experiment is created or modified.
|
|
130
|
+
```
|
|
131
|
+
OPTIMIZELY_VTR_EXPERIMENT_VARIATION_KEYS
|
|
132
|
+
WHY_NOT_SURVEY: 'why_not_survey',
|
|
133
|
+
- A survey to ask what would motivate you to upgrade if you say no
|
|
134
|
+
- NOTE: This experimental feature only appears in-sequence within graded sequences.
|
|
135
|
+
CERTIFICATE_PREVIEW: 'certificate_preview',
|
|
136
|
+
- Preview a mockup of the certificate that you will receive at the end of the course in the upgrade notification
|
|
137
|
+
PARTNER_BRANDING: 'partner_branding',
|
|
138
|
+
- Show the logo of the partner associated with the course (e.g. Harvard, MIT)
|
|
139
|
+
CONTROL: 'control',
|
|
140
|
+
- The default user experience
|
|
141
|
+
OFF: 'off',
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- Note that incourse paywall = in squenece
|
|
145
|
+
- upgrade notification = in sidebar notification
|
|
146
|
+
|
|
147
|
+
Example:
|
|
148
|
+
- Say we want to view the certificate preview. We'd go to mocks/optimizely/index.jsx and do this:
|
|
149
|
+
```
|
|
150
|
+
const useDecision = (experimentKey) => (
|
|
151
|
+
// To mock optimizely for local smoke testing, set the value of "enabled" to "true" and
|
|
152
|
+
// replace "replace_me" with the desired value from OPTIMIZELY_VTR_EXPERIMENT_VARIATION_KEYS
|
|
153
|
+
// which can be found in src/data/optimizely.js
|
|
154
|
+
[{ enabled: true, variationKey: 'certificate_preview' }]
|
|
155
|
+
);
|
|
156
|
+
```
|
|
157
|
+
- The experimental feature should then appear in the Demo Course.
|
|
158
|
+
|
|
159
|
+
|
|
38
160
|
Development
|
|
39
161
|
-----------
|
|
40
162
|
This plugin is intended for use with the `Learning MFE`_, specifically with several plugin slots defined in the MFE.
|