ui.shipaid.com 0.2.11 → 0.2.12

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.md CHANGED
@@ -33,14 +33,53 @@ Then add the widget element where needed:
33
33
 
34
34
  <!-- With customised text -->
35
35
  <shipaid-widget>
36
- <p>Loading ShipAid Protection</p>
36
+ <p slot="loading">Loading ShipAid Protection</p>
37
+ </shipaid-widget>
38
+ ```
39
+
40
+ #### Test Mode
41
+
42
+ Sometimes, a store won't have activated their subscription before you install the widget - in this case, the widget does not display (you will notice a message in the console reflecting this). So to force the widget to show while you are installing and testing it, you can add this query param to the page URL: `shipaid-test`.
43
+ For example: `https://some-store.myshopify.com/cart?shipaid-text`
44
+
45
+ ### Slots
46
+
47
+ Slots, with the syntax `slot="<slot name>"`, can be used to customise the widgets content - for example, a merchant may want to add a custom subtitle, which can be done like so:
48
+ ```html
49
+ <shipaid-widget>
50
+ <p slot="subtitle">Shipping protection is required to be able to return or refunds items.</p>
37
51
  </shipaid-widget>
38
52
  ```
39
53
 
54
+ The default content will be replaced by any slot content. You can also add inline styles to the slots, if you need to change the text color for example:
55
+ ```html
56
+ <span slot="title" style="color: white; font-weight: 500;">Package Protection</span>
57
+ ```
58
+
59
+ | Name | Description |
60
+ |--------|-------------|
61
+ | `loading` | Replaces the text that is shown whilst the widget is loading - I.e. fetching content from the Shopify or ShipAid API's. |
62
+ | `title` | Replaces the default title. |
63
+ | `subtitle` | Replaces the default subtitle. |
64
+
65
+ ### Props
66
+
67
+ This is a list of props that can be used to configure the widget:
68
+
69
+ | Prop | Description | Value/Type |
70
+ |--------|-------------|---------|
71
+ | `disablePolling` | Sets whether the cart should disable polling (enabled by default) - should be disabled if integrating manually with an ajax cart. | `boolean` |
72
+ | `pollingInterval` | If polling is enabled, it sets the interval (in ms) between API updates. | `number` in milliseconds |
73
+ | `disableRefresh ` | Sets whether the store cart should be updated when the protection item is added/removed. Add if you want to initially hide the protection product from the cart, even if it has just been added. | `boolean` |
40
74
 
41
75
  ### Events
42
76
 
43
- This is a list of the events emitted by the widget:
77
+ This is a list of the events emitted by the widget. You can listen to these events like so:
78
+ ```js
79
+ document.addEventListener('shipaid-protection-status', ({ detail }) => {
80
+ console.log(detail.cart) // ShopifyCart
81
+ })
82
+ ```
44
83
 
45
84
  | Event | Description | Payload |
46
85
  |-------|-------------|---------|
@@ -49,7 +88,12 @@ This is a list of the events emitted by the widget:
49
88
 
50
89
  ### Methods
51
90
 
52
- This is a list of public methods that can be used to change protection settings:
91
+ This is a list of public methods available on the widget HTMLElement that can be used to change protection settings. These can be used by querying the element:
92
+
93
+ ```js
94
+ const shipAidEl = document.querySelector('shipaid-widget')
95
+ if (shipAidEl) await shipAidEl.updateCart()
96
+ ```
53
97
 
54
98
  | Method | Description | Payload |
55
99
  |--------|-------------|---------|
@@ -58,15 +102,6 @@ This is a list of public methods that can be used to change protection settings:
58
102
  | `addProtection` | Adds the relevant protection item to cart. | |
59
103
  | `removeProtection` | Removes the protection item from the cart. | |
60
104
 
61
- ### Props
62
-
63
- This is a list of props that can be used to configure the widget:
64
-
65
- | Prop | Description | Value/Type |
66
- |--------|-------------|---------|
67
- | `disablePolling` | Sets whether the cart should disable polling (enabled by default) - should be disabled if integrating manually with an ajax cart. | `boolean` |
68
- | `pollingInterval` | If polling is enabled, it sets the interval (in ms) between API updates. | `number` in milliseconds |
69
- | `disableRefresh ` | Sets whether the store cart should be updated when the protection item is added/removed. Add if you want to initially hide the protection product from the cart, even if it has just been added. | `boolean` |
70
105
 
71
106
  ## Contributing
72
107
 
package/dist/widget.es.js CHANGED
@@ -1551,10 +1551,11 @@ let ShipAidWidget = class extends s {
1551
1551
  <p class="popup-disclaimer">
1552
1552
  By purchasing this protection, you are agreeing to our Terms Of
1553
1553
  Service and Privacy Policy. You are not obligated to purchase this
1554
- protection. This protection is NOT insurance. Purchasing this
1555
- protection does not guarantee you will be reimbursed for any product
1556
- or shipping costs. The claim process and decision for compensation
1557
- is strictly decided by the brand you a purchasing from.
1554
+ protection. This protection is NOT insurance. The claim process and
1555
+ decision for compensation are strictly decided by the brand you are
1556
+ purchasing from in this transaction. Each claim will be reviewed by
1557
+ their customer service team, and you'll get a response accepting
1558
+ or denying the claim within 2-3 business days.
1558
1559
  </p>
1559
1560
  <div class="popup-footer">
1560
1561
  <div class="footer-links">
@@ -474,10 +474,11 @@ function pt(t,e,i){return t?e():null==i?void 0:i()}const lt=((t,...e)=>{const i=
474
474
  <p class="popup-disclaimer">
475
475
  By purchasing this protection, you are agreeing to our Terms Of
476
476
  Service and Privacy Policy. You are not obligated to purchase this
477
- protection. This protection is NOT insurance. Purchasing this
478
- protection does not guarantee you will be reimbursed for any product
479
- or shipping costs. The claim process and decision for compensation
480
- is strictly decided by the brand you a purchasing from.
477
+ protection. This protection is NOT insurance. The claim process and
478
+ decision for compensation are strictly decided by the brand you are
479
+ purchasing from in this transaction. Each claim will be reviewed by
480
+ their customer service team, and you'll get a response accepting
481
+ or denying the claim within 2-3 business days.
481
482
  </p>
482
483
  <div class="popup-footer">
483
484
  <div class="footer-links">
@@ -474,10 +474,11 @@ function pt(t,e,i){return t?e():null==i?void 0:i()}const lt=((t,...e)=>{const i=
474
474
  <p class="popup-disclaimer">
475
475
  By purchasing this protection, you are agreeing to our Terms Of
476
476
  Service and Privacy Policy. You are not obligated to purchase this
477
- protection. This protection is NOT insurance. Purchasing this
478
- protection does not guarantee you will be reimbursed for any product
479
- or shipping costs. The claim process and decision for compensation
480
- is strictly decided by the brand you a purchasing from.
477
+ protection. This protection is NOT insurance. The claim process and
478
+ decision for compensation are strictly decided by the brand you are
479
+ purchasing from in this transaction. Each claim will be reviewed by
480
+ their customer service team, and you'll get a response accepting
481
+ or denying the claim within 2-3 business days.
481
482
  </p>
482
483
  <div class="popup-footer">
483
484
  <div class="footer-links">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui.shipaid.com",
3
3
  "private": false,
4
- "version": "0.2.11",
4
+ "version": "0.2.12",
5
5
  "type": "module",
6
6
  "main": "dist/widget.umd.js",
7
7
  "unpkg": "dist/widget.iife.js",