@ordergroove/offers 2.28.7-alpha-PR-690-14.11 → 2.28.7
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/CHANGELOG.md +11 -0
- package/README.md +122 -117
- package/dist/bundle-report.html +10 -10
- package/dist/examples.js +10 -22
- package/dist/examples.js.map +1 -1
- package/dist/offers.js +30 -35
- package/dist/offers.js.map +3 -3
- package/examples/index.html +0 -2
- package/package.json +2 -2
- package/src/components/OptinStatus.js +2 -7
- package/src/components/OptinToggle.js +2 -2
- package/src/shopify/__tests__/shopifyMiddleware.spec.js +42 -1
- package/src/shopify/__tests__/shopifyTrackingMiddleware.spec.js +125 -0
- package/src/shopify/shopifyMiddleware.ts +9 -3
- package/src/shopify/shopifyTrackingMiddleware.ts +26 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.28.7](https://github.com/ordergroove/plush-toys/compare/@ordergroove/offers@2.28.6...@ordergroove/offers@2.28.7) (2022-11-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **offers:** tracking for shopify default to sub ([46a0366](https://github.com/ordergroove/plush-toys/commit/46a036687e468534a20872a71751bbe897963b33))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.28.6](https://github.com/ordergroove/plush-toys/compare/@ordergroove/offers@2.28.5...@ordergroove/offers@2.28.6) (2022-11-01)
|
|
7
18
|
|
|
8
19
|
|
package/README.md
CHANGED
|
@@ -8,32 +8,31 @@ Ordergroove's offers library allows you to display and track subscription optins
|
|
|
8
8
|
npm install --save @ordergroove/offers
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## Local Development
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
## Local Development
|
|
14
13
|
|
|
14
|
+
To start local development server you can do
|
|
15
15
|
```sh
|
|
16
16
|
cd packages/offers
|
|
17
|
-
npm start
|
|
17
|
+
npm start
|
|
18
18
|
```
|
|
19
|
-
|
|
20
19
|
Browse http://localhost:8080
|
|
21
20
|
|
|
22
21
|
### Merchant specific local development
|
|
23
|
-
|
|
24
22
|
You need to use [http redirector chrome extension](https://chrome.google.com/webstore/detail/redirector/ocgpenflpmgnfapjedencafcfakcekcd?hl=en). And configure it to redirect staging/prod main.js to localhost:8080.
|
|
25
23
|
|
|
26
24
|
**main.js**
|
|
27
|
-
|
|
28
25
|
```
|
|
29
26
|
Pattern: https?://(staging\.)?static.ordergroove.com/\w+/main.js$
|
|
30
27
|
Redirect to: http://localhost:8080/dist/offers.js
|
|
31
28
|
```
|
|
32
29
|
|
|
30
|
+
|
|
33
31
|
**soucemap**
|
|
34
32
|
Pattern: https?://(staging\.)?static.ordergroove.com/\w+/offers.js.map
|
|
35
33
|
Redirect to: http://localhost:8080/dist/offers.js.map
|
|
36
34
|
|
|
35
|
+
|
|
37
36
|
## Configuration
|
|
38
37
|
|
|
39
38
|
## Add og-offer elements
|
|
@@ -57,7 +56,6 @@ The offers library registers a custom element, `<og-offer></og-offer>`, that can
|
|
|
57
56
|
```html
|
|
58
57
|
<og-offer first-order-place-date="2020-12-24"></og-offer>
|
|
59
58
|
```
|
|
60
|
-
|
|
61
59
|
Note supported format is `YY-MM-DD` and needs to be a day in the future. If some of these is missing, will be ignored.
|
|
62
60
|
|
|
63
61
|
4. The `product-to-subscribe` is optional and allows to set an alternative product which the subscription is going to be created with.
|
|
@@ -65,7 +63,6 @@ Note supported format is `YY-MM-DD` and needs to be a day in the future. If some
|
|
|
65
63
|
```html
|
|
66
64
|
<og-offer product="123" product-to-subscribe="678"></og-offer>
|
|
67
65
|
```
|
|
68
|
-
|
|
69
66
|
Even though offer applies to product "123", the subscription is created with product "678"
|
|
70
67
|
|
|
71
68
|
## Behavior & Functionality
|
|
@@ -76,38 +73,42 @@ The state of the offer is maintained for all products. If you set the product at
|
|
|
76
73
|
|
|
77
74
|
The state of opted-in products is stored in local storage, with the key `OG_STATE`. On page load, the offer element reads from local storage to recreate state for opted-in products. For example, if a user opts in to a product on a given page, offers for that same product will appear as opted in on all other pages.
|
|
78
75
|
|
|
76
|
+
|
|
79
77
|
### DOM Events
|
|
80
78
|
|
|
81
|
-
|
|
|
82
|
-
|
|
83
|
-
| og-receive-offer
|
|
84
|
-
| og-optout-product
|
|
85
|
-
| og-optin-product
|
|
86
|
-
| og-product-change-frequency | user has changed the delivery frequency
|
|
87
|
-
| og-cart-updated
|
|
79
|
+
|Event | Description | common scenarios |
|
|
80
|
+
|-|-|-|
|
|
81
|
+
| og-receive-offer | offers is ready to be rendered in the UI | Initialize custom UI logic when offer shows up |
|
|
82
|
+
| og-optout-product | user has opted out the product |
|
|
83
|
+
| og-optin-product | user has opted in the product |
|
|
84
|
+
| og-product-change-frequency | user has changed the delivery frequency |
|
|
85
|
+
| og-cart-updated | offer in the cart page has been changed | Perform side effect such as update the subtotal or total fields |
|
|
86
|
+
|
|
88
87
|
|
|
89
88
|
```js
|
|
90
|
-
document.addEventListener('og-receive-offer', ev => {
|
|
91
|
-
// ocurs when offers is ready to be rendered in the UI
|
|
92
|
-
// initialize custom UI, style shadow dom
|
|
93
|
-
const offer = ev.target;
|
|
94
|
-
});
|
|
95
89
|
|
|
96
|
-
document.addEventListener('og-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
document.addEventListener('og-receive-offer', ev => {
|
|
91
|
+
// ocurs when offers is ready to be rendered in the UI
|
|
92
|
+
// initialize custom UI, style shadow dom
|
|
93
|
+
const offer = ev.target;
|
|
94
|
+
})
|
|
99
95
|
|
|
100
|
-
document.addEventListener('og-
|
|
101
|
-
|
|
102
|
-
})
|
|
96
|
+
document.addEventListener('og-optout-product', ev => {
|
|
97
|
+
// perform a side-effect when OPTOUT_PRODUCT action happens
|
|
98
|
+
})
|
|
103
99
|
|
|
104
|
-
document.addEventListener('og-product
|
|
105
|
-
|
|
106
|
-
})
|
|
107
|
-
|
|
100
|
+
document.addEventListener('og-optin-product', ev => {
|
|
101
|
+
// perform a side-effect when OPTIN_PRODUCT action happens
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
document.addEventListener('og-product-change-frequency', ev => {
|
|
105
|
+
// perform a side-effect when PRODUCT_CHANGE_FREQUENCY action happens
|
|
106
|
+
})
|
|
108
107
|
|
|
108
|
+
```
|
|
109
109
|
### Features
|
|
110
110
|
|
|
111
|
+
|
|
111
112
|
#### Default optin by product
|
|
112
113
|
|
|
113
114
|
The library supports the notion of default optin on a product-by-product basis. If a product is marked as optedin by default, the offer will appear as opted in upon initial load and for as long as the user has not explictly opted out. If a user explicitly opts out, the opt-out selection will be remembered for all offers across all pages for that same product.
|
|
@@ -124,6 +125,7 @@ If a product is marked as opted in by default and the user has not explicitly op
|
|
|
124
125
|
|
|
125
126
|
The library resgisters a global variable, `og.offers`, that contains the following helper methods:
|
|
126
127
|
|
|
128
|
+
|
|
127
129
|
### initialize(merchantId, environment, authUrl);
|
|
128
130
|
|
|
129
131
|
In order to initilize the library you need to call `initialize()` method or shortcut in UMD `og.offers`.
|
|
@@ -203,60 +205,64 @@ Configures the library options for advance usage or customization.
|
|
|
203
205
|
import { config } from '@ordergroove/offers';
|
|
204
206
|
|
|
205
207
|
config({
|
|
206
|
-
frequencies: [
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
208
|
+
"frequencies": [
|
|
209
|
+
{
|
|
210
|
+
"every": 3,
|
|
211
|
+
"period": 2
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"every": 2,
|
|
215
|
+
"period": 2
|
|
216
|
+
}
|
|
215
217
|
],
|
|
216
|
-
defaultFrequency: {
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
"defaultFrequency": {
|
|
219
|
+
"every": 2,
|
|
220
|
+
"period": 2
|
|
219
221
|
},
|
|
220
|
-
offerType:
|
|
222
|
+
"offerType": "radio"
|
|
221
223
|
});
|
|
222
224
|
```
|
|
223
225
|
|
|
224
226
|
#### UMD
|
|
225
227
|
|
|
226
228
|
```javascript
|
|
227
|
-
og.offers('0e5de2bedc5e11e3a2e4bc764e106cf4', 'staging', '/auth')
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
og.offers('0e5de2bedc5e11e3a2e4bc764e106cf4', 'staging', '/auth')
|
|
230
|
+
.config({
|
|
231
|
+
"frequencies": [
|
|
232
|
+
{
|
|
233
|
+
"every": 3,
|
|
234
|
+
"period": 2
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"every": 2,
|
|
238
|
+
"period": 2
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"defaultFrequency": {
|
|
242
|
+
"every": 2,
|
|
243
|
+
"period": 2
|
|
232
244
|
},
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
period: 2
|
|
236
|
-
}
|
|
237
|
-
],
|
|
238
|
-
defaultFrequency: {
|
|
239
|
-
every: 2,
|
|
240
|
-
period: 2
|
|
241
|
-
},
|
|
242
|
-
offerType: 'radio'
|
|
243
|
-
});
|
|
245
|
+
"offerType": "radio"
|
|
246
|
+
})
|
|
244
247
|
```
|
|
245
248
|
|
|
249
|
+
|
|
246
250
|
### setLocale(localeObject);
|
|
247
251
|
|
|
248
252
|
Configures the library locale text copies
|
|
249
253
|
|
|
250
|
-
| Property
|
|
251
|
-
|
|
252
|
-
| **defaultFrequencyCopy**
|
|
253
|
-
| **offerEveryLabel**
|
|
254
|
-
| **offerOptInLabel**
|
|
255
|
-
| **offerOptOutLabel**
|
|
256
|
-
| **offerTooltipContent**
|
|
257
|
-
| **offerTooltipTrigger**
|
|
258
|
-
| **showTooltip**
|
|
259
|
-
| **frequencyPeriods**
|
|
254
|
+
| Property | Description | Default value |
|
|
255
|
+
|----------|-------------|---------------|
|
|
256
|
+
| **defaultFrequencyCopy** *string* | Default frequency copy | Recommended |
|
|
257
|
+
| **offerEveryLabel** *string* | Subscribe frequency label | Ships Every: |
|
|
258
|
+
| **offerOptInLabel** *string* | Subscribe option copy | Subscribe and get 20% off |
|
|
259
|
+
| **offerOptOutLabel** *string* | One-time option copy | One-time |
|
|
260
|
+
| **offerTooltipContent** *string* | Tool tip copy | Subscribe to this product and have it conveniently delivered to you at the frequency you choose. Promotion subject to change. |
|
|
261
|
+
| **offerTooltipTrigger** *string* | Tool tip link copy | More info |
|
|
262
|
+
| **showTooltip** *boolean* | Add a tool tip | false |
|
|
263
|
+
| **frequencyPeriods** *object* | defines the frequency period names | `{1:"days",2:"weeks",3:"months"}` |
|
|
264
|
+
|
|
265
|
+
|
|
260
266
|
|
|
261
267
|
**Returns** Object as offers module to chain method calls.
|
|
262
268
|
|
|
@@ -266,26 +272,24 @@ Configures the library locale text copies
|
|
|
266
272
|
import { setLocale } from '@ordergroove/offers';
|
|
267
273
|
|
|
268
274
|
setLocale({
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
3: 'months'
|
|
288
|
-
}
|
|
275
|
+
defaultFrequencyCopy: "Recommended",
|
|
276
|
+
offerOptInLabel: "Save Lots and Lots of Money",
|
|
277
|
+
offerEveryLabel: "Ships Every: ",
|
|
278
|
+
offerOptOutLabel: "Don't save money",
|
|
279
|
+
showTooltip: !0,
|
|
280
|
+
offerTooltipTrigger: "More info",
|
|
281
|
+
offerTooltipContent: "Subscribe to this product and have it conveniently delivered to you at the frequency you choose. Promotion subject to change.",
|
|
282
|
+
upsellButtonLabel: "Add to upcoming subscription order and receive 20% off",
|
|
283
|
+
upsellButtonContent: "Add to Next Order on ",
|
|
284
|
+
upsellModalContent: "Subscribe to this product and have it conveniently delivered to you at the frequency you choose. Promotion subject to change.",
|
|
285
|
+
upsellModalOptOutLabel: "Get one-time",
|
|
286
|
+
upsellModalOptInLabel: "Subscribe and get 10% off on every order",
|
|
287
|
+
upsellModalConfirmLabel: "Add",
|
|
288
|
+
frequencyPeriods: {
|
|
289
|
+
1: "days",
|
|
290
|
+
2: "weeks",
|
|
291
|
+
3: "months"
|
|
292
|
+
}
|
|
289
293
|
});
|
|
290
294
|
```
|
|
291
295
|
|
|
@@ -321,7 +325,7 @@ An object containing the properties `productId` `components` and `optedIn`
|
|
|
321
325
|
```javascript
|
|
322
326
|
import { addOptinChangedCallback } from '@ordergroove/offers';
|
|
323
327
|
|
|
324
|
-
function onOptinChanged({ productId, components, optedIn }) {}
|
|
328
|
+
function onOptinChanged({ productId, components, optedIn }) {};
|
|
325
329
|
addOptinChangedCallback(onOptinChanged);
|
|
326
330
|
```
|
|
327
331
|
|
|
@@ -428,6 +432,7 @@ og.offers.clear();
|
|
|
428
432
|
Global styling can be styled by using [CSS Variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)
|
|
429
433
|
|
|
430
434
|
```css
|
|
435
|
+
|
|
431
436
|
* {
|
|
432
437
|
--og-global-font-family: Arial, Helvetica, sans-serif;
|
|
433
438
|
--og-global-font-size: 15px;
|
|
@@ -437,7 +442,6 @@ Global styling can be styled by using [CSS Variables](https://developer.mozilla.
|
|
|
437
442
|
--og-tooltip-background: #ececec;
|
|
438
443
|
--og-tooltip-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
|
|
439
444
|
--og-tooltip-font-color: #298266;
|
|
440
|
-
--og-checkbox-border-color: #000000;
|
|
441
445
|
--og-upsell-font-family: Arial, Helvetica, sans-serif;
|
|
442
446
|
--og-upsell-font-size: 13px;
|
|
443
447
|
--og-upsell-font-color: #298266;
|
|
@@ -462,12 +466,12 @@ The offer element supports customized content via slots.
|
|
|
462
466
|
</of-offer>
|
|
463
467
|
```
|
|
464
468
|
|
|
465
|
-
## Date Formating
|
|
466
469
|
|
|
470
|
+
## Date Formating
|
|
467
471
|
Elements such as `<og-next-upcoming-order>` supports date formatting by passing format attribute
|
|
468
472
|
|
|
469
473
|
| {{day}} | Day of the month as a decimal number (range 01 to 31). |
|
|
470
|
-
|
|
474
|
+
|-------------------|--------------------------------------------------------------|
|
|
471
475
|
| {{day-numeric}} | Day of the month as a decimal number (range 1 to 31). |
|
|
472
476
|
| {{day-short}} | Abbreviated name of the day of the week. |
|
|
473
477
|
| {{day-long}} | Full name of the day of the week. |
|
|
@@ -478,16 +482,17 @@ Elements such as `<og-next-upcoming-order>` supports date formatting by passing
|
|
|
478
482
|
| {{year}} | Year as a decimal number without a century (range 00 to 99). |
|
|
479
483
|
| {{year-numeric}} | Year as a decimal number including the century. |
|
|
480
484
|
|
|
485
|
+
|
|
481
486
|
### Examples
|
|
482
487
|
|
|
483
488
|
```html
|
|
484
|
-
<og-next-upcoming-order format="{{month-long}} {{day}}, {{year-numeric}}"></og-next-upcoming-order>
|
|
489
|
+
<og-next-upcoming-order format="{{month-long}} {{day}}, {{year-numeric}}"></og-next-upcoming-order>
|
|
485
490
|
```
|
|
486
491
|
|
|
492
|
+
|
|
487
493
|
## API
|
|
488
494
|
|
|
489
495
|
### og-tooltip
|
|
490
|
-
|
|
491
496
|
Displays a tooltop with some content.
|
|
492
497
|
|
|
493
498
|
```html
|
|
@@ -500,14 +505,12 @@ Displays a tooltop with some content.
|
|
|
500
505
|
```
|
|
501
506
|
|
|
502
507
|
**Options**
|
|
503
|
-
|
|
508
|
+
*placement* top|bottom|left|right
|
|
504
509
|
|
|
505
510
|
**Css customization**
|
|
506
|
-
|
|
507
511
|
#### og-tooltip
|
|
508
512
|
|
|
509
513
|
Suports the following css variables
|
|
510
|
-
|
|
511
514
|
- --og-tooltip-family
|
|
512
515
|
- --og-tooltip-size
|
|
513
516
|
- --og-tooltip-color
|
|
@@ -516,18 +519,18 @@ Suports the following css variables
|
|
|
516
519
|
|
|
517
520
|
The `placement` attribute can be one of top, top-left, top-right, bottom, bottom-left, bottom-right, right or left
|
|
518
521
|
|
|
519
|
-
### og-incentive-text
|
|
520
522
|
|
|
523
|
+
### og-incentive-text
|
|
521
524
|
Display information from dynamic incentives.
|
|
522
|
-
By default the component will search for a ongoing discount class. Attribute
|
|
523
|
-
|
|
524
|
-
Current keys allowed in from clause are:
|
|
525
|
+
By default the component will search for a ongoing discount class. Attribute *initial* can be specified to force search in initial incentives.
|
|
525
526
|
|
|
527
|
+
Current keys allowed in from clause are:
|
|
526
528
|
- DiscountAmount Shows discount amount in dollars
|
|
527
529
|
- DiscountPercent Shows discount amount in percent
|
|
528
530
|
- ShippingDiscountPercent Shows whether or not is free shipping
|
|
529
531
|
|
|
530
|
-
|
|
532
|
+
|
|
533
|
+
#### og-incentive-text examples
|
|
531
534
|
|
|
532
535
|
```html
|
|
533
536
|
<og-incentive-text from="DiscountPercent"></og-incentive-text>
|
|
@@ -535,25 +538,24 @@ Current keys allowed in from clause are:
|
|
|
535
538
|
<og-incentive-text from="ShippingDiscountPercent"></og-incentive-text>
|
|
536
539
|
```
|
|
537
540
|
|
|
541
|
+
|
|
538
542
|
### og-when
|
|
543
|
+
Element that renders it chilren when test condition matches
|
|
539
544
|
|
|
540
|
-
Element that renders it chilren when test condition matches
|
|
541
545
|
|
|
542
|
-
| DESCRIPTOR | SUMMARY | Example
|
|
543
|
-
|
|
544
|
-
| inStock | When the product that offers is linked to is in stock | `<og-when test="inStock"
|
|
545
|
-
| eligible | If product is configured as eligible for subscription program | `<og-when test="eligible"
|
|
546
|
-
| subscriptionEligible | Product is eligible for create a subscription. Is true when inStock and eligible are both true. | `<og-when test="subscriptionEligible"
|
|
547
|
-
| hasUpsellGroup | If product in DB is configure to be eligible for upsell | `<og-when test="hasUpsellGroup"
|
|
548
|
-
| hasUpcomingOrder | If user is authenticated and has an upcoming order | `<og-when test="hasUpcomingOrder"
|
|
549
|
-
| upcomingOrderContainsProduct | If the upcoming order contains the product being offered | `<og-when test="upcomingOrderContainsProduct"
|
|
550
|
-
| upsellEligible | when an offer and product are eligible for upsell and usr has an upcomming order | `<og-when test="upsellEligible"
|
|
551
|
-
| regularEligible | this is similar to subscriptionEligible but it also checks that is not upsellEligible | `<og-when test="regularEligible"
|
|
546
|
+
| DESCRIPTOR | SUMMARY | Example |
|
|
547
|
+
|------------------------------|-------------------------------------------------------------------------------------------------|---------------------------|
|
|
548
|
+
| inStock | When the product that offers is linked to is in stock | `<og-when test="inStock">`|
|
|
549
|
+
| eligible | If product is configured as eligible for subscription program | `<og-when test="eligible">`|
|
|
550
|
+
| subscriptionEligible | Product is eligible for create a subscription. Is true when inStock and eligible are both true. | `<og-when test="subscriptionEligible">`|
|
|
551
|
+
| hasUpsellGroup | If product in DB is configure to be eligible for upsell | `<og-when test="hasUpsellGroup">`|
|
|
552
|
+
| hasUpcomingOrder | If user is authenticated and has an upcoming order | `<og-when test="hasUpcomingOrder">`|
|
|
553
|
+
| upcomingOrderContainsProduct | If the upcoming order contains the product being offered | `<og-when test="upcomingOrderContainsProduct">`|
|
|
554
|
+
| upsellEligible | when an offer and product are eligible for upsell and usr has an upcomming order | `<og-when test="upsellEligible">`|
|
|
555
|
+
| regularEligible | this is similar to subscriptionEligible but it also checks that is not upsellEligible | `<og-when test="regularEligible">`|
|
|
552
556
|
|
|
553
557
|
#### Combine descriptors
|
|
554
|
-
|
|
555
558
|
Supported logical operators
|
|
556
|
-
|
|
557
559
|
```
|
|
558
560
|
| Or
|
|
559
561
|
& And
|
|
@@ -562,13 +564,13 @@ Supported logical operators
|
|
|
562
564
|
```
|
|
563
565
|
|
|
564
566
|
**Examples**
|
|
565
|
-
|
|
566
567
|
```
|
|
567
568
|
!inStock
|
|
568
569
|
inStock&(!eligible)
|
|
569
570
|
regularEligible|upsellEligible
|
|
570
571
|
```
|
|
571
572
|
|
|
573
|
+
|
|
572
574
|
#### 1. Simple use case: show a regular offer
|
|
573
575
|
|
|
574
576
|
The folowing code will show and offer only if regular and it will show nothing if upsell
|
|
@@ -581,6 +583,7 @@ The folowing code will show and offer only if regular and it will show nothing i
|
|
|
581
583
|
</og-offer>
|
|
582
584
|
```
|
|
583
585
|
|
|
586
|
+
|
|
584
587
|
#### 2. Simple use case: show a regular and upsell offer
|
|
585
588
|
|
|
586
589
|
The folowing code will show and offer only if regular and it will show nothing if upsell
|
|
@@ -596,6 +599,8 @@ The folowing code will show and offer only if regular and it will show nothing i
|
|
|
596
599
|
</og-offer>
|
|
597
600
|
```
|
|
598
601
|
|
|
602
|
+
|
|
603
|
+
|
|
599
604
|
#### 3. Advance show same offer for both cases
|
|
600
605
|
|
|
601
606
|
The folowing code will show and offer only if regular and it will show nothing if upsell
|
package/dist/bundle-report.html
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<pre id="esbuild-metadata">
|
|
2
|
-
dist/examples.js ─────────────────────────────────────────── 258.
|
|
3
|
-
├ ../offers-templates/dist/main.js ──────────────────────── 249.
|
|
2
|
+
dist/examples.js ─────────────────────────────────────────── 258.8kb ─ 100.0%
|
|
3
|
+
├ ../offers-templates/dist/main.js ──────────────────────── 249.2kb ── 96.3%
|
|
4
4
|
│ └ examples/index.js
|
|
5
5
|
└ examples/index.js ───────────────────────────────────────── 8.5kb ─── 3.3%
|
|
6
6
|
|
|
7
|
-
dist/offers.js ───────────────────────────────────────────── 127.
|
|
7
|
+
dist/offers.js ───────────────────────────────────────────── 127.5kb ─ 100.0%
|
|
8
8
|
├ src/components/Offer.js ─────────────────────────────────── 8.2kb ─── 6.4%
|
|
9
9
|
│ └ src/make-api.js
|
|
10
10
|
│ └ src/index.js
|
|
11
|
-
├ node_modules/redux/es/redux.js ──────────────────────────── 6.7kb ─── 5.
|
|
11
|
+
├ node_modules/redux/es/redux.js ──────────────────────────── 6.7kb ─── 5.2%
|
|
12
12
|
│ └ src/shopify/shopifyReducer.js
|
|
13
13
|
│ └ src/index.js
|
|
14
14
|
├ src/core/reducer.js ─────────────────────────────────────── 6.1kb ─── 4.8%
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
├ src/components/Modal.js ─────────────────────────────────── 4.7kb ─── 3.7%
|
|
35
35
|
│ └ src/make-api.js
|
|
36
36
|
│ └ src/index.js
|
|
37
|
-
├ src/shopify/shopifyMiddleware.ts ────────────────────────── 4.
|
|
37
|
+
├ src/shopify/shopifyMiddleware.ts ────────────────────────── 4.6kb ─── 3.6%
|
|
38
38
|
│ └ src/index.js
|
|
39
39
|
├ src/components/Tooltip.js ───────────────────────────────── 4.4kb ─── 3.4%
|
|
40
40
|
│ └ src/make-api.js
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
├ node_modules/lodash.memoize/index.js ────────────────────── 4.0kb ─── 3.1%
|
|
43
43
|
│ └ src/shopify/shopifyMiddleware.ts
|
|
44
44
|
│ └ src/index.js
|
|
45
|
-
├ src/core/actions.js ─────────────────────────────────────── 3.8kb ───
|
|
45
|
+
├ src/core/actions.js ─────────────────────────────────────── 3.8kb ─── 2.9%
|
|
46
46
|
│ └ src/shopify/shopifyBootstrap.ts
|
|
47
47
|
│ └ src/index.js
|
|
48
48
|
├ src/core/api.js ─────────────────────────────────────────── 2.6kb ─── 2.0%
|
|
@@ -119,6 +119,8 @@
|
|
|
119
119
|
├ src/components/UpsellButton.js ──────────────────────────── 1.1kb ─── 0.9%
|
|
120
120
|
│ └ src/make-api.js
|
|
121
121
|
│ └ src/index.js
|
|
122
|
+
├ src/shopify/shopifyTrackingMiddleware.ts ────────────────── 1.1kb ─── 0.8%
|
|
123
|
+
│ └ src/index.js
|
|
122
124
|
├ node_modules/lit-html/lib/modify-template.js ────────────── 1.0kb ─── 0.8%
|
|
123
125
|
│ └ node_modules/lit-html/lib/shady-render.js
|
|
124
126
|
│ └ node_modules/lit-element/lit-element.js
|
|
@@ -147,7 +149,7 @@
|
|
|
147
149
|
├ src/components/OptinButton.js ──────────────────────────── 1005b ──── 0.8%
|
|
148
150
|
│ └ src/make-api.js
|
|
149
151
|
│ └ src/index.js
|
|
150
|
-
├ node_modules/lit-element/lib/css-tag.js ─────────────────── 978b ──── 0.
|
|
152
|
+
├ node_modules/lit-element/lib/css-tag.js ─────────────────── 978b ──── 0.7%
|
|
151
153
|
│ └ node_modules/lit-element/lit-element.js
|
|
152
154
|
│ └ src/components/Price.js
|
|
153
155
|
│ └ src/make-api.js
|
|
@@ -179,8 +181,6 @@
|
|
|
179
181
|
│ └ src/components/Price.js
|
|
180
182
|
│ └ src/make-api.js
|
|
181
183
|
│ └ src/index.js
|
|
182
|
-
├ src/shopify/shopifyTrackingMiddleware.ts ────────────────── 620b ──── 0.5%
|
|
183
|
-
│ └ src/index.js
|
|
184
184
|
├ node_modules/logical-expression-parser/polish.js ────────── 594b ──── 0.5%
|
|
185
185
|
│ └ node_modules/logical-expression-parser/index.js
|
|
186
186
|
│ └ src/components/When.js
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
│ └ src/components/When.js
|
|
219
219
|
│ └ src/make-api.js
|
|
220
220
|
│ └ src/index.js
|
|
221
|
-
├ src/core/props.js ───────────────────────────────────────── 326b ──── 0.
|
|
221
|
+
├ src/core/props.js ───────────────────────────────────────── 326b ──── 0.2%
|
|
222
222
|
│ └ src/components/FrequencyStatus.js
|
|
223
223
|
│ └ src/make-api.js
|
|
224
224
|
│ └ src/index.js
|