@edx/frontend-plugin-advertisements 1.16.1 → 1.17.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 +111 -6
- package/package.json +1 -1
package/README.rst
CHANGED
|
@@ -35,13 +35,83 @@ documented in the repository README.
|
|
|
35
35
|
|
|
36
36
|
.. _Learning MFE: https://github.com/openedx/frontend-app-learning
|
|
37
37
|
|
|
38
|
-
Development
|
|
39
|
-
|
|
38
|
+
Local Development
|
|
39
|
+
-----------------
|
|
40
|
+
|
|
40
41
|
This plugin is intended for use with the `Learning MFE`_, specifically with several plugin slots defined in the MFE.
|
|
41
42
|
In order to install a local checkout of this plugin into the `Learning MFE`_ instead of from npm, follow the
|
|
42
43
|
documentation for `local module development`_ in the `Learning MFE`_. Additionally, if you would like for these
|
|
43
44
|
components to appear in the correct plugin slots, you will need a local ``env.config.js`` file in your copy of
|
|
44
|
-
``frontend-app-learning
|
|
45
|
+
``frontend-app-learning`` which includes the following lines::
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
import { UpgradeNotification, LockPaywall } from '@edx/frontend-plugin-advertisements';
|
|
49
|
+
import { PLUGIN_OPERATIONS, DIRECT_PLUGIN } from '@openedx/frontend-plugin-framework';
|
|
50
|
+
|
|
51
|
+
// Insert any other imports here
|
|
52
|
+
|
|
53
|
+
// Load environment variables from .env file
|
|
54
|
+
const config = {
|
|
55
|
+
pluginSlots: {
|
|
56
|
+
|
|
57
|
+
// Insert any other plugins here
|
|
58
|
+
|
|
59
|
+
notification_widget_plugin: {
|
|
60
|
+
plugins: [
|
|
61
|
+
{
|
|
62
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
63
|
+
widget: {
|
|
64
|
+
id: 'notification_widget_plugin',
|
|
65
|
+
type: DIRECT_PLUGIN,
|
|
66
|
+
RenderWidget: UpgradeNotification,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
notification_tray_plugin: {
|
|
72
|
+
plugins: [
|
|
73
|
+
{
|
|
74
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
75
|
+
widget: {
|
|
76
|
+
id: 'notification_tray_plugin',
|
|
77
|
+
type: DIRECT_PLUGIN,
|
|
78
|
+
RenderWidget: UpgradeNotification,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
outline_tab_notifications_plugin: {
|
|
84
|
+
keepDefault: false,
|
|
85
|
+
plugins: [
|
|
86
|
+
{
|
|
87
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
88
|
+
widget: {
|
|
89
|
+
id: 'outline_tab_notifications_plugin',
|
|
90
|
+
type: DIRECT_PLUGIN,
|
|
91
|
+
RenderWidget: UpgradeNotification,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
fbe_message_plugin: { // plugin slot id
|
|
97
|
+
keepDefault: false,
|
|
98
|
+
plugins: [
|
|
99
|
+
{
|
|
100
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
101
|
+
widget: {
|
|
102
|
+
id: 'fbe_message_plugin',
|
|
103
|
+
type: DIRECT_PLUGIN,
|
|
104
|
+
priority: 10,
|
|
105
|
+
RenderWidget: LockPaywall,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
OPTIMIZELY_FULL_STACK_SDK_KEY: 'vtr_upgrade',
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export default config;
|
|
45
115
|
|
|
46
116
|
If you are planning to run the `Learning MFE`_ in `devstack`_, be sure to clone this repository into a ``src``
|
|
47
117
|
subdirectory of your `devstack`_ workspace directory so that the code is properly mounted into the `Learning MFE`_
|
|
@@ -67,12 +137,47 @@ up by the `Learning MFE`_ via the hot module reloading process.::
|
|
|
67
137
|
.. _Mounting frontend packages from src directory: https://github.com/openedx/devstack/blob/master/docs/decisions/0005-frontend-package-mounts.rst
|
|
68
138
|
|
|
69
139
|
Development with Optimizely
|
|
70
|
-
|
|
140
|
+
---------------------------
|
|
71
141
|
This repository uses the Optimizely SDK to implement frontend experiments. In order to simplify local development,
|
|
72
|
-
this repository contains a mock Optimizely implementation.
|
|
142
|
+
this repository contains a mock Optimizely implementation.
|
|
143
|
+
|
|
144
|
+
In order for the mock Optimizely to work, you must map the ``mocks/optimizely/index.jsx`` module to the npm package name
|
|
145
|
+
by creating a ``module.config.js`` file and adding the following line to ``localModules``::
|
|
146
|
+
|
|
147
|
+
{moduleName: '@optimizely/react-sdk', dir: '../src/frontend-plugin-advertisements/src/mocks/optimizely', dist: '.' }
|
|
148
|
+
|
|
149
|
+
If you want a more thorough guide on this, lease see these `instructions`_ for further details.
|
|
73
150
|
|
|
74
151
|
.. _instructions: https://github.com/edx/frontend-plugin-advertisements/tree/main/src/mocks/optimizely/README.rst
|
|
75
152
|
|
|
153
|
+
How To View Experiments Locally
|
|
154
|
+
-------------------------------
|
|
155
|
+
Make sure your devstack is up and running, and sign into the LMS using your audit account (username: ``audit@example.com``,
|
|
156
|
+
password: ``edx``). Navigate to the demo course: http://localhost:2000/course/course-v1:edX+DemoX+Demo_Course/home which
|
|
157
|
+
already has a paywall for the verified track enabled. To select your experiment treatment, go to ``mocks/optimizely/index.jsx``.
|
|
158
|
+
In the ``useDecision`` definition, switch ``enabled`` to "true" and ``variationKey`` to your desired variationKey.
|
|
159
|
+
|
|
160
|
+
The variationKeys can be found within ``data/optimizely.js`` and should look like this::
|
|
161
|
+
|
|
162
|
+
const OPTIMIZELY_VTR_EXPERIMENT_VARIATION_KEYS = {
|
|
163
|
+
WHY_NOT_SURVEY: 'why_not_survey',
|
|
164
|
+
CERTIFICATE_PREVIEW: 'certificate_preview',
|
|
165
|
+
PARTNER_BRANDING: 'partner_branding',
|
|
166
|
+
CONTROL: 'control',
|
|
167
|
+
OFF: 'off',
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
For example, say we want to view the certificate preview. We'd go to mocks/optimizely/index.jsx and do this::
|
|
171
|
+
|
|
172
|
+
const useDecision = (experimentKey) => (
|
|
173
|
+
// To mock optimizely for local smoke testing, set the value of "enabled" to "true" and
|
|
174
|
+
// replace "replace_me" with the desired value from OPTIMIZELY_VTR_EXPERIMENT_VARIATION_KEYS
|
|
175
|
+
// which can be found in src/data/optimizely.js
|
|
176
|
+
[{ enabled: true, variationKey: 'certificate_preview' }]
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
The experimental feature should then appear in the Demo Course.
|
|
180
|
+
|
|
76
181
|
License
|
|
77
182
|
=======
|
|
78
183
|
|
|
@@ -90,4 +195,4 @@ Contact `edx/masters-devs-cosmonauts` if you need help with this repository.
|
|
|
90
195
|
Reporting Security Issues
|
|
91
196
|
=========================
|
|
92
197
|
|
|
93
|
-
Please do not report security issues in public. Email security@edx.org instead.
|
|
198
|
+
Please do not report security issues in public. Email security@edx.org instead.
|