@buddy-technology/offer-component 0.3.1 → 0.3.3

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/API.md CHANGED
@@ -16,6 +16,9 @@
16
16
  <dt><a href="#RemoveFromCartFunction">RemoveFromCartFunction</a> ⇒ <code><a href="#DataObject">DataObject</a></code></dt>
17
17
  <dd><p>A callback to be called with a payload object when users opt out of the offer.</p>
18
18
  </dd>
19
+ <dt><a href="#ScrollToTopFunction">ScrollToTopFunction</a> : <code>function</code></dt>
20
+ <dd><p>A function to override the default scroll to top of offer element behavior when navigating between screens</p>
21
+ </dd>
19
22
  <dt><a href="#OverridesObject">OverridesObject</a> : <code>Object</code></dt>
20
23
  <dd></dd>
21
24
  <dt><a href="#ThemeObject">ThemeObject</a> : <code>Object</code></dt>
@@ -64,6 +67,12 @@ A callback to be called with a payload object when users opt out of the offer.
64
67
 
65
68
  **Kind**: global typedef
66
69
  **Returns**: [<code>DataObject</code>](#DataObject) - the policy payload
70
+ <a name="ScrollToTopFunction"></a>
71
+
72
+ ## ScrollToTopFunction : <code>function</code>
73
+ A function to override the default scroll to top of offer element behavior when navigating between screens
74
+
75
+ **Kind**: global typedef
67
76
  <a name="OverridesObject"></a>
68
77
 
69
78
  ## OverridesObject : <code>Object</code>
@@ -169,6 +178,7 @@ const theme = {
169
178
  | [onUserEvent] | [<code>OnUserEventCallback</code>](#OnUserEventCallback) | | callback function for tracking user behavioral data. Triggers on user interactions such as input focus/blur, in-app navigation, etc. Refer to the docs for more details. |
170
179
  | [onAddToCart] | [<code>AddToCartFunction</code>](#AddToCartFunction) | | callback function triggered when users opt into an offer-only offer. |
171
180
  | [onRemoveFromCart] | [<code>RemoveFromCartFunction</code>](#RemoveFromCartFunction) | | callback function triggered when users opt out of an offer-only offer. |
172
- | includeCheckout | <code>boolean</code> | | toggles whether or not to display the card capture checkout view. Defaults to true. When false, an AddToCart callback must be provided. |
181
+ | [overrideScrollToTop] | [<code>ScrollToTopFunction</code>](#ScrollToTopFunction) | | When present, this overrides the default scroll to top of offer element behavior when navigating between screens. |
182
+ | [includeCheckout] | <code>boolean</code> | | toggles whether or not to display the card capture checkout view. Defaults to true. When false, an AddToCart callback must be provided. |
173
183
  | [logoOverride] | [<code>LogoOverride</code>](#LogoOverride) | | object for overriding Buddy's trust badge. |
174
184
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # CHANGELOG
2
2
 
3
+ ### v0.3.3
4
+ 2023-07-26
5
+
6
+ - added overrideScrollToTop to options
7
+ ---
8
+
9
+
10
+ ### v0.3.2
11
+ 2023-06-27
12
+
13
+ - fix deploy action :crossed_fingers:
14
+ - fix includeCheckout should be optional
15
+ ---
16
+
17
+
3
18
  ### v0.3.1
4
19
  2023-06-27
5
20
 
package/dist/index.js CHANGED
@@ -37,6 +37,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
37
37
  * @returns {DataObject} the policy payload
38
38
  */
39
39
 
40
+ /**
41
+ * @typedef {Function} ScrollToTopFunction
42
+ * @description A function to override the default scroll to top of offer element behavior when navigating between screens
43
+ */
44
+
40
45
  /**
41
46
  * @typedef {Object} OverridesObject
42
47
  * @property {Array<String>} [webFonts] - array of url strings linking to web fonts.
@@ -111,7 +116,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
111
116
  * @property {OnUserEventCallback} [onUserEvent] - callback function for tracking user behavioral data. Triggers on user interactions such as input focus/blur, in-app navigation, etc. Refer to the docs for more details.
112
117
  * @property {AddToCartFunction} [onAddToCart] - callback function triggered when users opt into an offer-only offer.
113
118
  * @property {RemoveFromCartFunction} [onRemoveFromCart] - callback function triggered when users opt out of an offer-only offer.
114
- * @property {boolean} includeCheckout - toggles whether or not to display the card capture checkout view. Defaults to true. When false, an AddToCart callback must be provided.
119
+ * @property {ScrollToTopFunction} [overrideScrollToTop] - When present, this overrides the default scroll to top of offer element behavior when navigating between screens.
120
+ * @property {boolean} [includeCheckout] - toggles whether or not to display the card capture checkout view. Defaults to true. When false, an AddToCart callback must be provided.
115
121
  * @property {LogoOverride} [logoOverride] - object for overriding Buddy's trust badge.
116
122
  */
117
123
 
package/lib/types.d.ts CHANGED
@@ -19,6 +19,11 @@ declare type AddToCartFunction = () => DataObject;
19
19
  */
20
20
  declare type RemoveFromCartFunction = () => DataObject;
21
21
 
22
+ /**
23
+ * A function to override the default scroll to top of offer element behavior when navigating between screens
24
+ */
25
+ declare type ScrollToTopFunction = () => void;
26
+
22
27
  /**
23
28
  * @property [webFonts] - array of url strings linking to web fonts.
24
29
  * @property [styles] - Object Styles object for overriding any css.
@@ -103,7 +108,8 @@ declare type OnUserEventCallback = (type: EventObject) => void;
103
108
  * @property [onUserEvent] - callback function for tracking user behavioral data. Triggers on user interactions such as input focus/blur, in-app navigation, etc. Refer to the docs for more details.
104
109
  * @property [onAddToCart] - callback function triggered when users opt into an offer-only offer.
105
110
  * @property [onRemoveFromCart] - callback function triggered when users opt out of an offer-only offer.
106
- * @property includeCheckout - toggles whether or not to display the card capture checkout view. Defaults to true. When false, an AddToCart callback must be provided.
111
+ * @property [overrideScrollToTop] - When present, this overrides the default scroll to top of offer element behavior when navigating between screens.
112
+ * @property [includeCheckout] - toggles whether or not to display the card capture checkout view. Defaults to true. When false, an AddToCart callback must be provided.
107
113
  * @property [logoOverride] - object for overriding Buddy's trust badge.
108
114
  */
109
115
  declare type BuddyOfferElementProps = {
@@ -116,7 +122,8 @@ declare type BuddyOfferElementProps = {
116
122
  onUserEvent?: OnUserEventCallback;
117
123
  onAddToCart?: AddToCartFunction;
118
124
  onRemoveFromCart?: RemoveFromCartFunction;
119
- includeCheckout: boolean;
125
+ overrideScrollToTop?: ScrollToTopFunction;
126
+ includeCheckout?: boolean;
120
127
  logoOverride?: LogoOverride;
121
128
  };
122
129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buddy-technology/offer-component",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "author": "Buddy Technology",
5
5
  "main": "dist/index.js",
6
6
  "types": "./lib/types.d.ts",