A simple, generic package selector for broadband providers, written in JavaScript.
npm install
npm start
- Navigate your browser to http://localhost:10203
Running this application gives you a bare-bones package selection screen. Clicking on the coloured box in front of each product will select or deselect it.
The products.json
file specifies which products should be displayed and how each product relates to another.
When a product is displayed initially, selected, or deselected, rules are applied based on what's specified
in products.json
.
What follows is a list of supported package selection rules. For each rule, an example is given
based on products.json
included in this repository.
Rule: Only one product per group
can be chosen simultaneously.
Example: Selecting "internet-10-mb" will deselect "internet-20-mb" and "internet-30-mb".
Rule: A BASE GROUP consists of products which have an equal group
and supergroup
.
Example: "internet-10-mb" is in the base group of "internet".
Rule: If no product from the BASE GROUP is selected, other products in the same supergroup
are disabled.
Example: "internet-bonus-pack" can only be selected if one of "internet-10-mb", "internet-20-mb" or "internet-30-mb"
are selected.
Rule: If a product is selected, the first product in its requires-group
is automatically selected as well.
Example: "tv-regular" requires group "hardware-1", so selecting it automatically selects "decoder-1-no-recorder"
(the necessary TV decoder.)
Rule: A product cannot be deselected if it is in another SELECTED product's requires-group
.
Example: "decoder-1-no-recorder" cannot be deselected while "tv-regular" is still selected.
Rule: A product with the disabled
attribute can be enabled by a product which references it
in its enables
attribute.
Example: "decoder-3" is only enabled once "decoder-2-no-recorder" or "decoder-2-recorder" are selected.
Rule: A product with the disabled
attribute can be enabled by a product
which references the disabled product's group
in its enables-group
attribute.
Example: "decoder-2-no-recorder" and "decoder-2-recorder" are only enabled
once "decoder-1-no-recorder" or "decoder-1-recorder" are selected.