@ordergroove/offers 2.23.1 → 2.24.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 (58) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/build.js +5 -0
  3. package/dist/bundle-report.html +220 -63
  4. package/dist/examples.js +385 -1897
  5. package/dist/examples.js.map +7 -1
  6. package/dist/offers.js +251 -214
  7. package/dist/offers.js.map +7 -1
  8. package/examples/index.html +3 -0
  9. package/examples/index.js +4 -4
  10. package/karma-functional.conf.js +12 -10
  11. package/karma.conf.js +20 -10
  12. package/package.json +10 -15
  13. package/src/{_tests_ → __tests__}/offers.spec.js +3 -5
  14. package/src/__tests__/test-mode.spec.js +16 -0
  15. package/src/components/FrequencyStatus.js +2 -2
  16. package/src/components/IncentiveText.js +1 -1
  17. package/src/components/Offer.js +11 -14
  18. package/src/components/OptinButton.js +2 -5
  19. package/src/components/OptinSelect.js +2 -2
  20. package/src/components/OptinToggle.js +1 -4
  21. package/src/components/OptoutButton.js +1 -4
  22. package/src/components/SelectFrequency.js +4 -8
  23. package/src/components/UpsellButton.js +2 -5
  24. package/src/components/UpsellModal.js +6 -10
  25. package/src/components/__tests__/FrequencyStatus.spec.js +33 -38
  26. package/src/components/__tests__/IncentiveText.spec.js +1 -1
  27. package/src/components/__tests__/Modal.spec.js +1 -1
  28. package/src/components/__tests__/NextUpcomingOrder.spec.js +1 -1
  29. package/src/components/__tests__/Offer.spec.js +5 -7
  30. package/src/components/__tests__/OptinButton.spec.js +1 -1
  31. package/src/components/__tests__/OptinSelect.spec.js +1 -1
  32. package/src/components/__tests__/OptinStatus.spec.js +1 -1
  33. package/src/components/__tests__/Select.spec.js +1 -1
  34. package/src/components/__tests__/SelectFrequency.spec.js +17 -6
  35. package/src/components/__tests__/Text.spec.js +1 -1
  36. package/src/components/__tests__/Tooltip.spec.js +1 -1
  37. package/src/components/__tests__/UpsellButton.spec.js +4 -6
  38. package/src/components/__tests__/When.spec.js +1 -1
  39. package/src/core/__tests__/api.spec.js +10 -3
  40. package/src/core/__tests__/base.spec.js +8 -2
  41. package/src/core/__tests__/reducer.spec.js +1 -1
  42. package/src/core/actions.js +9 -6
  43. package/src/core/adapters.js +3 -3
  44. package/src/core/api.js +4 -1
  45. package/src/core/localStorage.js +1 -1
  46. package/src/core/middleware.js +9 -7
  47. package/src/core/selectors.js +19 -33
  48. package/src/index.js +1 -4
  49. package/src/init-func-tests.js +1 -2
  50. package/src/init-test.js +3 -0
  51. package/src/test-mode.js +5 -3
  52. package/dist/index.html +0 -125
  53. package/dist/offers-preview-mode.bundle.js +0 -2
  54. package/dist/offers-preview-mode.bundle.js.map +0 -1
  55. package/dist/offers-test-mode.bundle.js +0 -100
  56. package/dist/offers-test-mode.bundle.js.map +0 -1
  57. package/src/_tests_/test-mode.spec.js +0 -15
  58. package/webpack.config.js +0 -43
@@ -1,100 +0,0 @@
1
- (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{22:function(e,t,o){"use strict";o.r(t);const{TestWizard:r}=o(28);t.default=function(){const e="og-test-wizard";customElements.get(e)||customElements.define(e,r);const t=document.createElement(e);document.body.appendChild(t)}},28:function(e,t,o){"use strict";o.r(t),o.d(t,"TestWizard",(function(){return i}));var r=o(1),s=o(3);class i extends r.a{static get styles(){return r.b`
2
- :host {
3
- position: fixed;
4
- top: 5em;
5
- right: 5em;
6
- background-color: rgba(255, 255, 255, 0.7);
7
- width: 400px;
8
- padding: 1em;
9
- border-radius: 5px;
10
- border: 1px solid #ccc;
11
- box-shadow: 2px 2px 0 0 #000;
12
- }
13
-
14
- button {
15
- margin: 0 0.5em 0.5em;
16
- background-color: gray;
17
- color: white;
18
- border: 0;
19
- border-radius: 3px;
20
- cursor: pointer;
21
- padding: 0.5em;
22
- }
23
-
24
- button.primary {
25
- background-color: blue;
26
- padding: 1em;
27
- color: white;
28
- border: 0;
29
- border-radius: 3px;
30
- }
31
-
32
- button[disabled] {
33
- background-color: #777;
34
- }
35
-
36
- div {
37
- margin-bottom: 0.5em;
38
- }
39
-
40
- .message {
41
- margin-left: 0.5em;
42
- margin: 1em;
43
- }
44
-
45
- .success {
46
- color: green;
47
- }
48
-
49
- .error {
50
- color: red;
51
- }
52
-
53
- .warning {
54
- color: orange;
55
- }
56
- a {
57
- color: white;
58
- }
59
- `}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(e=>{const t=e.store.getState(),o=e.getAttribute("product"),r=e.getAttribute("location"),s={messages:this.getOfferAttributeMessages(o,r).concat(this.getOfferRequestMessages(o,t)),product:o};this.results.push(s)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,t){const o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),t||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&t&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,t){const o=t.inStock[e],r=t.autoshipEligible[e],s=[];return e&&!1===o&&s.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&!1===r&&s.push({name:"This product is not eligible for autoship",type:"warning"}),e&&null===o&&null===r&&s.push({name:"This product does not exist in our database",type:"error"}),s}resultsCodeBlock(){return 0===this.results.length?r.c`
60
- <div class="message error">No offer element found on the page</div>
61
- `:this.results.map((e,t)=>r.c`
62
- <div>For offer tag with product = "${e.product}"</div>
63
- ${e.messages.map(e=>r.c`
64
- <div class="message ${e.type}">
65
- ${e.name}
66
- </div>
67
- `)}
68
- <button @click=${this.toggleProductFlags(t,{})}>
69
- Set inStock and eligible
70
- </button>
71
- <br />
72
- <button @click=${this.toggleProductFlags(t,{inStock:!1})}>
73
- Set to not inStock
74
- </button>
75
- <br />
76
- <button @click=${this.toggleProductFlags(t,{autoship:!1})}>
77
- Set to not eligible
78
- </button>
79
- <br />
80
- <button @click=${this.toggleProductFlags(t,{autoship:!1,inStock:!1})}>
81
- Set to not eligible and not in stock
82
- </button>
83
- <br />
84
- <button @click=${this.toggleUpsellPreview(t)}>
85
- Toggle upsell/regular in this offer
86
- </button>
87
- <br />
88
- <button @click=${this.toggleUpsellNextOrder(t)}>
89
- upsell product is in next order
90
- </button>
91
- <br />
92
- `)}toggleUpsellPreview(e){return t=>{t.preventDefault();const o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:t=!0,autoship:o=!0,groups:r=["subscription","upsell"]}){return i=>{i.preventDefault();const n=document.querySelectorAll("og-offer")[e],c=n.product.id;n.store.dispatch(s.receiveOffer({in_stock:{[c]:t},eligibility_groups:{[c]:r},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return t=>{const o=document.querySelectorAll("og-offer")[e],r=o.product.id;t.preventDefault(),o.store.dispatch(s.receiveItems({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:r,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return r.c`
93
- <div>
94
- ${this.testsRan?this.resultsCodeBlock():r.c`
95
- <div>Click the button to run tests</div>
96
- `}
97
- <button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
98
- </div>
99
- `}}t.default=i}}]);
100
- //# sourceMappingURL=offers-test-mode.bundle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["webpack://og.[name]/./src/run-tests.js","webpack://og.[name]/./src/components/TestWizard.js"],"names":["TestWizard","name","customElements","get","define","modal","document","createElement","body","appendChild","this","results","disabled","requestUpdate","querySelectorAll","forEach","element","state","store","getState","productAttribute","getAttribute","locationAttribute","result","messages","getOfferAttributeMessages","concat","getOfferRequestMessages","product","push","testsRan","type","inStock","autoshipEligible","length","map","ix","message","toggleProductFlags","autoship","toggleUpsellPreview","toggleUpsellNextOrder","ev","preventDefault","offer","removeAttribute","setAttribute","runTests","groups","productId","id","dispatch","in_stock","eligibility_groups","module_view","regular","modifiers","incentives_display","field","object","value","e6534b9d877f41e586c37b7d8abc3a58","f35e842710b24929922db4a529eecd40","incentives","initial","ongoing","count","next","previous","order","subscription","components","quantity","public_id","product_attribute","price","extra_cost","total_price","one_time","frozen","first_placed","resultsCodeBlock","bind"],"mappings":"yFAAA,aAAM,WAAEA,GAAe,EAAQ,IAEhB,qBACb,MAAMC,EAAO,iBACRC,eAAeC,IAAIF,IACtBC,eAAeE,OAAOH,EAAMD,GAE9B,MAAMK,EAAQC,SAASC,cAAcN,GACrCK,SAASE,KAAKC,YAAYJ,K,gCCR5B,oEAIO,MAAML,UAAmB,IAC9B,oBACE,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6DZ,WACEU,KAAKC,QAAU,GACfD,KAAKE,UAAW,EAChBF,KAAKG,gBAEiBP,SAASQ,iBAAiB,YAClCC,QAAQC,IACpB,MAAMC,EAAQD,EAAQE,MAAMC,WACtBC,EAAmBJ,EAAQK,aAAa,WACxCC,EAAoBN,EAAQK,aAAa,YACzC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mCACd1C,QAASqB,EACTsB,WAAY,GACZC,SAAU,EACVC,UAAW,mCACXC,kBAAmB,KACnBC,MAAO,QACPC,WAAY,OACZC,YAAa,QACbC,UAAU,EACVC,QAAQ,EACRC,aAAc,UAKtBtE,KAAKqC,YAIT,SACE,OAAO,GAAI;;UAELrC,KAAKoB,SACHpB,KAAKuE,mBACL,GAAI;;;4BAGYvE,KAAKE,oBAAoBF,KAAKqC,SAASmC,KAAKxE;;OAMzD","file":"offers-test-mode.bundle.js","sourcesContent":["const { TestWizard } = require('./components/TestWizard');\n\nexport default function() {\n const name = 'og-test-wizard';\n if (!customElements.get(name)) {\n customElements.define(name, TestWizard);\n }\n const modal = document.createElement(name);\n document.body.appendChild(modal);\n}\n","import { LitElement, html, css } from 'lit-element';\n\nimport * as actions from '../core/actions';\n\nexport class TestWizard extends LitElement {\n static get styles() {\n return css`\n :host {\n position: fixed;\n top: 5em;\n right: 5em;\n background-color: rgba(255, 255, 255, 0.7);\n width: 400px;\n padding: 1em;\n border-radius: 5px;\n border: 1px solid #ccc;\n box-shadow: 2px 2px 0 0 #000;\n }\n\n button {\n margin: 0 0.5em 0.5em;\n background-color: gray;\n color: white;\n border: 0;\n border-radius: 3px;\n cursor: pointer;\n padding: 0.5em;\n }\n\n button.primary {\n background-color: blue;\n padding: 1em;\n color: white;\n border: 0;\n border-radius: 3px;\n }\n\n button[disabled] {\n background-color: #777;\n }\n\n div {\n margin-bottom: 0.5em;\n }\n\n .message {\n margin-left: 0.5em;\n margin: 1em;\n }\n\n .success {\n color: green;\n }\n\n .error {\n color: red;\n }\n\n .warning {\n color: orange;\n }\n a {\n color: white;\n }\n `;\n }\n\n runTests() {\n this.results = [];\n this.disabled = true;\n this.requestUpdate();\n\n const offerElements = document.querySelectorAll('og-offer');\n offerElements.forEach(element => {\n const state = element.store.getState();\n const productAttribute = element.getAttribute('product');\n const locationAttribute = element.getAttribute('location');\n const result = {\n messages: this.getOfferAttributeMessages(productAttribute, locationAttribute).concat(\n this.getOfferRequestMessages(productAttribute, state)\n ),\n product: productAttribute\n };\n this.results.push(result);\n });\n this.testsRan = true;\n this.disabled = false;\n this.requestUpdate();\n }\n\n getOfferAttributeMessages(productAttribute, locationAttribute) {\n const messages = [];\n\n if (!productAttribute) {\n messages.push({\n name: 'Offer element found but missing product attribute',\n type: 'error'\n });\n }\n\n if (!locationAttribute) {\n messages.push({\n name: 'Offer element found but missing location attribute',\n type: 'warning'\n });\n }\n\n if (productAttribute && locationAttribute) {\n messages.push({\n name: 'Offer element found and properly tagged',\n type: 'success'\n });\n }\n\n return messages;\n }\n\n getOfferRequestMessages(productAttribute, state) {\n const inStock = state.inStock[productAttribute];\n const autoshipEligible = state.autoshipEligible[productAttribute];\n const messages = [];\n\n if (productAttribute && inStock === false) {\n messages.push({\n name: 'This product is marked as out of stock in the OG database',\n type: 'warning'\n });\n }\n\n if (productAttribute && autoshipEligible === false) {\n messages.push({\n name: 'This product is not eligible for autoship',\n type: 'warning'\n });\n }\n\n if (productAttribute && inStock === null && autoshipEligible === null) {\n messages.push({\n name: 'This product does not exist in our database',\n type: 'error'\n });\n }\n\n return messages;\n }\n\n resultsCodeBlock() {\n return this.results.length === 0\n ? html`\n <div class=\"message error\">No offer element found on the page</div>\n `\n : this.results.map(\n (result, ix) =>\n html`\n <div>For offer tag with product = \"${result.product}\"</div>\n ${result.messages.map(\n message => html`\n <div class=\"message ${message.type}\">\n ${message.name}\n </div>\n `\n )}\n <button @click=${this.toggleProductFlags(ix, {})}>\n Set inStock and eligible\n </button>\n <br />\n <button @click=${this.toggleProductFlags(ix, { inStock: false })}>\n Set to not inStock\n </button>\n <br />\n <button @click=${this.toggleProductFlags(ix, { autoship: false })}>\n Set to not eligible\n </button>\n <br />\n <button @click=${this.toggleProductFlags(ix, { autoship: false, inStock: false })}>\n Set to not eligible and not in stock\n </button>\n <br />\n <button @click=${this.toggleUpsellPreview(ix)}>\n Toggle upsell/regular in this offer\n </button>\n <br />\n <button @click=${this.toggleUpsellNextOrder(ix)}>\n upsell product is in next order\n </button>\n <br />\n `\n );\n }\n\n toggleUpsellPreview(ix) {\n return ev => {\n ev.preventDefault();\n const offer = document.querySelectorAll('og-offer')[ix];\n if (!offer.getAttribute('preview-upsell-offer')) {\n offer.setAttribute('preview-upsell-offer', true);\n } else {\n offer.removeAttribute('preview-upsell-offer');\n }\n this.runTests();\n };\n }\n\n toggleProductFlags(ix, { inStock = true, autoship = true, groups = ['subscription', 'upsell'] }) {\n return ev => {\n ev.preventDefault();\n const offer = document.querySelectorAll('og-offer')[ix];\n const productId = offer.product.id;\n offer.store.dispatch(\n actions.receiveOffer({\n in_stock: { [productId]: inStock },\n eligibility_groups: { [productId]: groups },\n result: 'success',\n autoship: { [productId]: autoship },\n module_view: { regular: '58a01e9aacbe40389b5c7325d79091bb' },\n modifiers: {},\n incentives_display: {\n '47c01e9aacbe40389b5c7325d79091aa': {\n field: 'sub_total',\n object: 'order',\n type: 'Discount Percent',\n value: 5\n },\n e6534b9d877f41e586c37b7d8abc3a58: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 5\n },\n f35e842710b24929922db4a529eecd40: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n '5be321d7c17f4e18a757212b9a20bfcc': {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 1\n }\n },\n incentives: {\n [productId]: {\n initial: ['5be321d7c17f4e18a757212b9a20bfcc'],\n ongoing: [\n 'e6534b9d877f41e586c37b7d8abc3a58',\n '47c01e9aacbe40389b5c7325d79091aa',\n 'f35e842710b24929922db4a529eecd40'\n ]\n }\n }\n })\n );\n this.runTests();\n };\n }\n\n toggleUpsellNextOrder(ix) {\n return ev => {\n const offer = document.querySelectorAll('og-offer')[ix];\n const productId = offer.product.id;\n\n ev.preventDefault();\n offer.store.dispatch(\n actions.receiveItems({\n count: 1,\n next: null,\n previous: null,\n results: [\n {\n order: '24d50352579511ea806cbc764e100cfd',\n offer: null,\n subscription: '8a076b7a0ea011e7a5bcbc764e105eda',\n product: productId,\n components: [],\n quantity: 1,\n public_id: '24d6901e579511ea806cbc764e100cfd',\n product_attribute: null,\n price: '14.99',\n extra_cost: '0.00',\n total_price: '13.49',\n one_time: false,\n frozen: false,\n first_placed: null\n }\n ]\n })\n );\n this.runTests();\n };\n }\n\n render() {\n return html`\n <div>\n ${this.testsRan\n ? this.resultsCodeBlock()\n : html`\n <div>Click the button to run tests</div>\n `}\n <button ?disabled=${this.disabled} @click=\"${this.runTests.bind(this)}\" class=\"primary\">Run Test</button>\n </div>\n `;\n }\n}\n\nexport default TestWizard;\n"],"sourceRoot":""}
@@ -1,15 +0,0 @@
1
- import { keys, enable } from '../test-mode';
2
-
3
- describe('TestMode', () => {
4
- it('should add the element if correct key stroke is keyed in', done => {
5
- enable();
6
- keys.forEach(keyCode => {
7
- document.dispatchEvent(new KeyboardEvent('keyup', { keyCode }));
8
- });
9
- spyOn(document, 'createElement');
10
- setTimeout(() => {
11
- expect(document.createElement).toHaveBeenCalledWith('og-test-wizard');
12
- done();
13
- }, 500);
14
- });
15
- });
package/webpack.config.js DELETED
@@ -1,43 +0,0 @@
1
- const HtmlWebpackPlugin = require('html-webpack-plugin');
2
- const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
3
- const { auth } = require('@ordergroove/js-utils');
4
-
5
- module.exports = {
6
- devtool: 'sourcemap',
7
- entry: {
8
- offers: './src/index.js',
9
- examples: './examples/index.js'
10
- },
11
- output: {
12
- filename: '[name].js',
13
- chunkFilename: '[name].bundle.js',
14
- libraryTarget: 'umd',
15
- library: ['og', '[name]'],
16
- chunkCallbackName: 'OG_CHUNK_CB'
17
- },
18
- devServer: {
19
- before: app =>
20
- app.get('/auth', (req, res) =>
21
- res.json(
22
- auth.hmac({
23
- user: 'TestCust',
24
- secret: '8Koh[4=fczzcW&z]BwHdT~J+P_NOPiR_Pb&^56M?M0N&',
25
- merchantId: '0e5de2bedc5e11e3a2e4bc764e106cf4'
26
- })
27
- )
28
- )
29
- },
30
-
31
- plugins: [
32
- new HtmlWebpackPlugin({
33
- filename: `index.html`,
34
- template: `examples/index.html`
35
- }),
36
- new BundleAnalyzerPlugin({
37
- analyzerMode: 'static',
38
- reportFilename: 'bundle-report.html',
39
- openAnalyzer: false,
40
- logLevel: 'error'
41
- })
42
- ]
43
- };