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