@betterstore/react 0.3.19 → 0.3.21

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.21
4
+
5
+ ### Patch Changes
6
+
7
+ - bug fixes
8
+
9
+ ## 0.3.20
10
+
11
+ ### Patch Changes
12
+
13
+ - bug fixes
14
+
3
15
  ## 0.3.19
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -94,10 +94,7 @@ function createJSONStorage(getStorage, options) {
94
94
  }
95
95
  return parse(str);
96
96
  },
97
- setItem: (name, newValue) => storage.setItem(
98
- name,
99
- JSON.stringify(newValue, void 0 )
100
- ),
97
+ setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0 )),
101
98
  removeItem: (name) => storage.removeItem(name)
102
99
  };
103
100
  return persistStorage;
@@ -8237,12 +8234,10 @@ class JSAnimation extends WithPromise {
8237
8234
  * This method is bound to the instance to fix a pattern where
8238
8235
  * animation.stop is returned as a reference from a useEffect.
8239
8236
  */
8240
- this.stop = (sync = true) => {
8241
- if (sync) {
8242
- const { motionValue } = this.options;
8243
- if (motionValue && motionValue.updatedAt !== time.now()) {
8244
- this.tick(time.now());
8245
- }
8237
+ this.stop = () => {
8238
+ const { motionValue } = this.options;
8239
+ if (motionValue && motionValue.updatedAt !== time.now()) {
8240
+ this.tick(time.now());
8246
8241
  }
8247
8242
  this.isStopped = true;
8248
8243
  if (this.state === "idle")
@@ -12125,7 +12120,6 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
12125
12120
  this.resumingFrom = this.resumeFrom;
12126
12121
  this.resumingFrom.resumingFrom = undefined;
12127
12122
  }
12128
- this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
12129
12123
  const animationOptions = {
12130
12124
  ...getValueTransition(layoutTransition, "layout"),
12131
12125
  onPlay: onLayoutAnimationStart,
@@ -12137,6 +12131,11 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
12137
12131
  animationOptions.type = false;
12138
12132
  }
12139
12133
  this.startAnimation(animationOptions);
12134
+ /**
12135
+ * Set animation origin after starting animation to avoid layout jump
12136
+ * caused by stopping previous layout animation
12137
+ */
12138
+ this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
12140
12139
  }
12141
12140
  else {
12142
12141
  /**
@@ -12860,8 +12859,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
12860
12859
  }
12861
12860
  startAnimation(options) {
12862
12861
  this.notifyListeners("animationStart");
12863
- this.currentAnimation?.stop(false);
12864
- this.resumingFrom?.currentAnimation?.stop(false);
12862
+ this.currentAnimation?.stop();
12863
+ this.resumingFrom?.currentAnimation?.stop();
12865
12864
  if (this.pendingAnimation) {
12866
12865
  cancelFrame(this.pendingAnimation);
12867
12866
  this.pendingAnimation = undefined;
@@ -12910,7 +12909,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
12910
12909
  finishAnimation() {
12911
12910
  if (this.currentAnimation) {
12912
12911
  this.mixTargetDelta && this.mixTargetDelta(animationTarget);
12913
- this.currentAnimation.stop(false);
12912
+ this.currentAnimation.stop();
12914
12913
  }
12915
12914
  this.completeAnimation();
12916
12915
  }
@@ -13175,7 +13174,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
13175
13174
  }
13176
13175
  // Only run on root
13177
13176
  resetTree() {
13178
- this.root.nodes.forEach((node) => node.currentAnimation?.stop(false));
13177
+ this.root.nodes.forEach((node) => node.currentAnimation?.stop());
13179
13178
  this.root.nodes.forEach(clearMeasurements);
13180
13179
  this.root.sharedNodes.clear();
13181
13180
  }
@@ -35057,7 +35056,7 @@ function DiscountCode({ applyDiscountCode, revalidateDiscounts, }) {
35057
35056
  setIsLoading(true);
35058
35057
  try {
35059
35058
  yield applyDiscountCode(discountCode);
35060
- yield revalidateDiscounts();
35059
+ // await revalidateDiscounts();
35061
35060
  setDiscountCode("");
35062
35061
  toast.success(t("CheckoutEmbed.Summary.discountCodeSuccess"));
35063
35062
  }
package/dist/index.mjs CHANGED
@@ -71,10 +71,7 @@ function createJSONStorage(getStorage, options) {
71
71
  }
72
72
  return parse(str);
73
73
  },
74
- setItem: (name, newValue) => storage.setItem(
75
- name,
76
- JSON.stringify(newValue, void 0 )
77
- ),
74
+ setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0 )),
78
75
  removeItem: (name) => storage.removeItem(name)
79
76
  };
80
77
  return persistStorage;
@@ -8214,12 +8211,10 @@ class JSAnimation extends WithPromise {
8214
8211
  * This method is bound to the instance to fix a pattern where
8215
8212
  * animation.stop is returned as a reference from a useEffect.
8216
8213
  */
8217
- this.stop = (sync = true) => {
8218
- if (sync) {
8219
- const { motionValue } = this.options;
8220
- if (motionValue && motionValue.updatedAt !== time.now()) {
8221
- this.tick(time.now());
8222
- }
8214
+ this.stop = () => {
8215
+ const { motionValue } = this.options;
8216
+ if (motionValue && motionValue.updatedAt !== time.now()) {
8217
+ this.tick(time.now());
8223
8218
  }
8224
8219
  this.isStopped = true;
8225
8220
  if (this.state === "idle")
@@ -12102,7 +12097,6 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
12102
12097
  this.resumingFrom = this.resumeFrom;
12103
12098
  this.resumingFrom.resumingFrom = undefined;
12104
12099
  }
12105
- this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
12106
12100
  const animationOptions = {
12107
12101
  ...getValueTransition(layoutTransition, "layout"),
12108
12102
  onPlay: onLayoutAnimationStart,
@@ -12114,6 +12108,11 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
12114
12108
  animationOptions.type = false;
12115
12109
  }
12116
12110
  this.startAnimation(animationOptions);
12111
+ /**
12112
+ * Set animation origin after starting animation to avoid layout jump
12113
+ * caused by stopping previous layout animation
12114
+ */
12115
+ this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
12117
12116
  }
12118
12117
  else {
12119
12118
  /**
@@ -12837,8 +12836,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
12837
12836
  }
12838
12837
  startAnimation(options) {
12839
12838
  this.notifyListeners("animationStart");
12840
- this.currentAnimation?.stop(false);
12841
- this.resumingFrom?.currentAnimation?.stop(false);
12839
+ this.currentAnimation?.stop();
12840
+ this.resumingFrom?.currentAnimation?.stop();
12842
12841
  if (this.pendingAnimation) {
12843
12842
  cancelFrame(this.pendingAnimation);
12844
12843
  this.pendingAnimation = undefined;
@@ -12887,7 +12886,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
12887
12886
  finishAnimation() {
12888
12887
  if (this.currentAnimation) {
12889
12888
  this.mixTargetDelta && this.mixTargetDelta(animationTarget);
12890
- this.currentAnimation.stop(false);
12889
+ this.currentAnimation.stop();
12891
12890
  }
12892
12891
  this.completeAnimation();
12893
12892
  }
@@ -13152,7 +13151,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
13152
13151
  }
13153
13152
  // Only run on root
13154
13153
  resetTree() {
13155
- this.root.nodes.forEach((node) => node.currentAnimation?.stop(false));
13154
+ this.root.nodes.forEach((node) => node.currentAnimation?.stop());
13156
13155
  this.root.nodes.forEach(clearMeasurements);
13157
13156
  this.root.sharedNodes.clear();
13158
13157
  }
@@ -35034,7 +35033,7 @@ function DiscountCode({ applyDiscountCode, revalidateDiscounts, }) {
35034
35033
  setIsLoading(true);
35035
35034
  try {
35036
35035
  yield applyDiscountCode(discountCode);
35037
- yield revalidateDiscounts();
35036
+ // await revalidateDiscounts();
35038
35037
  setDiscountCode("");
35039
35038
  toast.success(t("CheckoutEmbed.Summary.discountCodeSuccess"));
35040
35039
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/react",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -19,7 +19,7 @@
19
19
  "author": "Better Store",
20
20
  "license": "MIT",
21
21
  "devDependencies": {
22
- "@betterstore/sdk": "^0.3.66",
22
+ "@betterstore/sdk": "^0.3.75",
23
23
  "@changesets/cli": "^2.28.1",
24
24
  "@rollup/plugin-commonjs": "^28.0.3",
25
25
  "@rollup/plugin-json": "^6.1.0",
@@ -0,0 +1,13 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ prefix: "betterstore-",
4
+ content: ["./src/**/*.{js,jsx,ts,tsx}"],
5
+ corePlugins: {
6
+ preflight: false, // Disable Tailwind's base styles to prevent conflicts
7
+ },
8
+ important: true, // This ensures your styles take precedence
9
+ theme: {
10
+ extend: {},
11
+ },
12
+ plugins: [],
13
+ };