@edx/frontend-plugin-advertisements 1.5.0 → 1.6.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
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
frontend-plugin-advertisements
|
|
2
|
+
##############################
|
|
3
|
+
|
|
4
|
+
|license-badge| |status-badge| |ci-badge| |codecov-badge|
|
|
5
|
+
|
|
6
|
+
.. |license-badge| image:: https://img.shields.io/github/license/edx/frontend-plugin-advertisements.svg
|
|
7
|
+
:target: https://github.com/edx/frontend-plugin-advertisements/blob/main/LICENSE
|
|
8
|
+
:alt: License
|
|
9
|
+
|
|
10
|
+
.. |status-badge| image:: https://img.shields.io/badge/Status-Maintained-brightgreen
|
|
11
|
+
|
|
12
|
+
.. |ci-badge| image:: https://github.com/edx/frontend-plugin-advertisements/actions/workflows/ci.yml/badge.svg
|
|
13
|
+
:target: https://github.com/edx/frontend-plugin-advertisements/actions/workflows/ci.yml
|
|
14
|
+
:alt: Continuous Integration
|
|
15
|
+
|
|
16
|
+
.. |codecov-badge| image:: https://codecov.io/github/edx/frontend-plugin-advertisements/coverage.svg?branch=main
|
|
17
|
+
:target: https://codecov.io/github/edx/frontend-plugin-advertisements?branch=main
|
|
18
|
+
:alt: Codecov
|
|
19
|
+
|
|
20
|
+
Purpose
|
|
21
|
+
=======
|
|
22
|
+
|
|
23
|
+
This repository hosts plugin components intended for use in frontend-app-learning plugin slots. These components are related
|
|
24
|
+
to in course advertising and experimentation around in course advertising.
|
|
25
|
+
|
|
26
|
+
For more on the frontend plugin framework, please see https://github.com/openedx/frontend-plugin-framework/tree/master.
|
|
27
|
+
|
|
28
|
+
Getting Started
|
|
29
|
+
===============
|
|
30
|
+
|
|
31
|
+
Devstack Installation
|
|
32
|
+
---------------------
|
|
33
|
+
This plugin is intended for use with the `Learning MFE`_. Please follow instructions for running the Learning MFE as
|
|
34
|
+
documented in the repository README.
|
|
35
|
+
|
|
36
|
+
.. _Learning MFE: https://github.com/openedx/frontend-app-learning
|
|
37
|
+
|
|
38
|
+
Development
|
|
39
|
+
-----------
|
|
40
|
+
This plugin is intended for use with the `Learning MFE`_, specifically with several plugin slots defined in the MFE.
|
|
41
|
+
In order to install a local checkout of this plugin into the `Learning MFE`_ instead of from npm, follow the
|
|
42
|
+
documentation for `local module development`_ in the `Learning MFE`_. Additionally, if you would like for these
|
|
43
|
+
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
|
+
|
|
46
|
+
If you are planning to run the `Learning MFE`_ in `devstack`_, be sure to clone this repository into a ``src``
|
|
47
|
+
subdirectory of your `devstack`_ workspace directory so that the code is properly mounted into the `Learning MFE`_
|
|
48
|
+
Docker container. You will need to update the ``dir`` key in your ``module.config.js`` file appropriately. See
|
|
49
|
+
the `Mounting frontend packages from src directory`_ ADR in the `devstack`_ repository for further details.
|
|
50
|
+
|
|
51
|
+
If you want to install a local checkout of this plugin for use in your `Learning MFE`_ ``env.config.jsx`` file,
|
|
52
|
+
follow the documentation mentioned above. However, if you want do active development on this plugin and wish to see your
|
|
53
|
+
changes immediately reflected in the `Learning MFE`_, then you will need to modify your ``module.config.js`` to reference
|
|
54
|
+
the ``src`` directory of this ``repository`` in the ``dist`` key instead of the ``dist`` directory. Below is an example
|
|
55
|
+
``module.config.js`` for this use case. If you set up your ``module.config.js`` this way, your changes will be picked
|
|
56
|
+
up by the `Learning MFE`_ via the hot module reloading process.::
|
|
57
|
+
|
|
58
|
+
module.exports = {
|
|
59
|
+
localModules: [
|
|
60
|
+
{ moduleName: '@edx/frontend-plugin-advertisements', dir: '../src/frontend-plugin-advertisements', dist: 'src' },
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
.. _devstack: https://github.com/openedx/devstack
|
|
65
|
+
.. _Learning MFE: https://github.com/openedx/frontend-app-learning
|
|
66
|
+
.. _local module development: https://github.com/openedx/frontend-app-learning#local-module-development
|
|
67
|
+
.. _Mounting frontend packages from src directory: https://github.com/openedx/devstack/blob/master/docs/decisions/0005-frontend-package-mounts.rst
|
|
68
|
+
|
|
69
|
+
Development with Optimizely
|
|
70
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
71
|
+
This repository uses the Optimizely SDK to implement frontend experiments. In order to simplify local development,
|
|
72
|
+
this repository contains a mock Optimizely implementation. Please see the `instructions`_ for further details.
|
|
73
|
+
|
|
74
|
+
.. _instructions: https://github.com/edx/frontend-plugin-advertisements/tree/main/src/mocks/optimizely/README.rst
|
|
75
|
+
|
|
76
|
+
License
|
|
77
|
+
=======
|
|
78
|
+
|
|
79
|
+
The code in this repository is licensed under the AGPLv3 unless otherwise
|
|
80
|
+
noted.
|
|
81
|
+
|
|
82
|
+
Please see `LICENSE <LICENSE>`_ for details.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
People
|
|
86
|
+
======
|
|
87
|
+
|
|
88
|
+
Contact `edx/masters-devs-cosmonauts` if you need help with this repository.
|
|
89
|
+
|
|
90
|
+
Reporting Security Issues
|
|
91
|
+
=========================
|
|
92
|
+
|
|
93
|
+
Please do not report security issues in public. Email security@edx.org instead.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Optimizely Mock Implementation
|
|
2
|
+
##############################
|
|
3
|
+
|
|
4
|
+
Purpose
|
|
5
|
+
=======
|
|
6
|
+
|
|
7
|
+
This repository uses the `Optimizely SDK`_ to implement frontend experiments. Using Optimizely requires the use of an
|
|
8
|
+
SDK key or datafile. This poses a problem for development locally, because it requires that an `Optimizely environment`_
|
|
9
|
+
exists for local environments. When developing locally, it may be preferable not to rely explicitly on Optimizely and
|
|
10
|
+
to reserve testing the Optimizely flow in a staging environment.
|
|
11
|
+
|
|
12
|
+
This module contains a mock Optimizely implementation module that allows engineers to hardcode the return
|
|
13
|
+
values of the functions of the `Optimizely SDK`_, namely the `useDecision hook`_.
|
|
14
|
+
|
|
15
|
+
Usage
|
|
16
|
+
=====
|
|
17
|
+
|
|
18
|
+
The implementations of the `createInstance function`_ and the `OptimizelyProvider component`_ are no-op pass through
|
|
19
|
+
functions. They do not do anything.
|
|
20
|
+
|
|
21
|
+
In order to modify the experiment and how your user is bucketed, you will need to modify the `useDecision hook`_
|
|
22
|
+
implementation. Use the React SDK documentation to determine how to modify this function to suit your needs.
|
|
23
|
+
|
|
24
|
+
In addition, you will need to update your ``module.config.js`` file in your local checkout of the Learning MFE to
|
|
25
|
+
map the ``@optimizely/react-sdk`` module to this mock module.
|
|
26
|
+
|
|
27
|
+
A sample ``module.config.js`` file is shown below, but please refer to the documentation for `local module development`_
|
|
28
|
+
in the `Learning MFE`_ for more information.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
.. code-block::
|
|
32
|
+
|
|
33
|
+
module.exports = {
|
|
34
|
+
localModules: [
|
|
35
|
+
{ moduleName: '@edx/frontend-plugin-advertisements', dir: '../src/frontend-plugin-advertisements', dist: 'src' },
|
|
36
|
+
{ moduleName: '@optimizely/react-sdk', dir: '../src/frontend-plugin-advertisements/src/mocks/optimizely', dist: '.' },
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
.. _createInstance function: https://docs.developers.optimizely.com/feature-experimentation/docs/initialize-sdk-react
|
|
41
|
+
.. _Learning MFE: https://github.com/openedx/frontend-app-learning
|
|
42
|
+
.. _local module development: https://github.com/openedx/frontend-app-learning#local-module-development
|
|
43
|
+
.. _Optimizely environment: https://docs.developers.optimizely.com/feature-experimentation/docs/manage-environments
|
|
44
|
+
.. _OptimizelyProvider component: https://docs.developers.optimizely.com/feature-experimentation/docs/optimizelyprovider
|
|
45
|
+
.. _Optimizely SDK: https://docs.developers.optimizely.com/feature-experimentation/docs/javascript-react-sdk
|
|
46
|
+
.. _useDecision hook: https://docs.developers.optimizely.com/feature-experimentation/docs/usedecision-react
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useDecision = exports.createInstance = exports.OptimizelyProvider = void 0;
|
|
7
|
+
/* eslint-disable no-unused-vars */
|
|
8
|
+
/* eslint-disable react/prop-types */
|
|
9
|
+
|
|
10
|
+
const useDecision = experimentKey => [{
|
|
11
|
+
enabled: false,
|
|
12
|
+
variationKey: 'fill me in'
|
|
13
|
+
}];
|
|
14
|
+
exports.useDecision = useDecision;
|
|
15
|
+
const OptimizelyProvider = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
optimizely,
|
|
18
|
+
user,
|
|
19
|
+
children = null
|
|
20
|
+
} = _ref;
|
|
21
|
+
return children;
|
|
22
|
+
};
|
|
23
|
+
exports.OptimizelyProvider = OptimizelyProvider;
|
|
24
|
+
const createInstance = args => null;
|
|
25
|
+
exports.createInstance = createInstance;
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["useDecision","experimentKey","enabled","variationKey","exports","OptimizelyProvider","_ref","optimizely","user","children","createInstance","args"],"sources":["../../../src/mocks/optimizely/index.jsx"],"sourcesContent":["/* eslint-disable no-unused-vars */\n/* eslint-disable react/prop-types */\n\nconst useDecision = (experimentKey) => (\n [{ enabled: false, variationKey: 'fill me in' }]\n);\n\nconst OptimizelyProvider = ({ optimizely, user, children = null }) => children;\n\nconst createInstance = (args) => (null);\n\nexport { createInstance, useDecision, OptimizelyProvider };\n"],"mappings":";;;;;;AAAA;AACA;;AAEA,MAAMA,WAAW,GAAIC,aAAa,IAChC,CAAC;EAAEC,OAAO,EAAE,KAAK;EAAEC,YAAY,EAAE;AAAa,CAAC,CAChD;AAACC,OAAA,CAAAJ,WAAA,GAAAA,WAAA;AAEF,MAAMK,kBAAkB,GAAGC,IAAA;EAAA,IAAC;IAAEC,UAAU;IAAEC,IAAI;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAAH,IAAA;EAAA,OAAKG,QAAQ;AAAA;AAACL,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAE/E,MAAMK,cAAc,GAAIC,IAAI,IAAM,IAAK;AAACP,OAAA,CAAAM,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "optimizely",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Optimizely mock application for local development",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"author": "edX",
|
|
10
|
+
"license": "AGPL-3.0"
|
|
11
|
+
}
|