@betterstore/react 0.5.2 → 0.5.4

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/dist/index.cjs.js CHANGED
@@ -7494,6 +7494,18 @@ var Helpers = class {
7494
7494
  }
7495
7495
  return rate;
7496
7496
  }
7497
+ async getAutocompleteAddressResults(query, locale) {
7498
+ const apiClient = createApiClient("", this.proxy);
7499
+ const { data } = await apiClient.get(
7500
+ `/helpers/autocomplete-address/${query}`,
7501
+ {
7502
+ params: {
7503
+ locale
7504
+ }
7505
+ }
7506
+ );
7507
+ return data;
7508
+ }
7497
7509
  };
7498
7510
  var helpers_default = Helpers;
7499
7511
  function createStoreClient(config) {
@@ -8252,6 +8264,7 @@ const Toast = (props)=>{
8252
8264
  pointerStartRef.current = null;
8253
8265
  },
8254
8266
  onPointerDown: (event)=>{
8267
+ if (event.button === 2) return; // Return early on right click
8255
8268
  if (disabled || !dismissible) return;
8256
8269
  dragStartTime.current = new Date();
8257
8270
  setOffsetBeforeRemove(offset.current);
@@ -9172,8 +9185,9 @@ class ZodError extends Error {
9172
9185
  const formErrors = [];
9173
9186
  for (const sub of this.issues) {
9174
9187
  if (sub.path.length > 0) {
9175
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
9176
- fieldErrors[sub.path[0]].push(mapper(sub));
9188
+ const firstEl = sub.path[0];
9189
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
9190
+ fieldErrors[firstEl].push(mapper(sub));
9177
9191
  }
9178
9192
  else {
9179
9193
  formErrors.push(mapper(sub));
@@ -9257,6 +9271,8 @@ const errorMap = (issue, _ctx) => {
9257
9271
  message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
9258
9272
  else if (issue.type === "number")
9259
9273
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
9274
+ else if (issue.type === "bigint")
9275
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
9260
9276
  else if (issue.type === "date")
9261
9277
  message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
9262
9278
  else
@@ -9854,6 +9870,8 @@ function isValidJWT(jwt, alg) {
9854
9870
  return false;
9855
9871
  try {
9856
9872
  const [header] = jwt.split(".");
9873
+ if (!header)
9874
+ return false;
9857
9875
  // Convert base64url to base64
9858
9876
  const base64 = header
9859
9877
  .replace(/-/g, "+")
package/dist/index.mjs CHANGED
@@ -7474,6 +7474,18 @@ var Helpers = class {
7474
7474
  }
7475
7475
  return rate;
7476
7476
  }
7477
+ async getAutocompleteAddressResults(query, locale) {
7478
+ const apiClient = createApiClient("", this.proxy);
7479
+ const { data } = await apiClient.get(
7480
+ `/helpers/autocomplete-address/${query}`,
7481
+ {
7482
+ params: {
7483
+ locale
7484
+ }
7485
+ }
7486
+ );
7487
+ return data;
7488
+ }
7477
7489
  };
7478
7490
  var helpers_default = Helpers;
7479
7491
  function createStoreClient(config) {
@@ -8232,6 +8244,7 @@ const Toast = (props)=>{
8232
8244
  pointerStartRef.current = null;
8233
8245
  },
8234
8246
  onPointerDown: (event)=>{
8247
+ if (event.button === 2) return; // Return early on right click
8235
8248
  if (disabled || !dismissible) return;
8236
8249
  dragStartTime.current = new Date();
8237
8250
  setOffsetBeforeRemove(offset.current);
@@ -9152,8 +9165,9 @@ class ZodError extends Error {
9152
9165
  const formErrors = [];
9153
9166
  for (const sub of this.issues) {
9154
9167
  if (sub.path.length > 0) {
9155
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
9156
- fieldErrors[sub.path[0]].push(mapper(sub));
9168
+ const firstEl = sub.path[0];
9169
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
9170
+ fieldErrors[firstEl].push(mapper(sub));
9157
9171
  }
9158
9172
  else {
9159
9173
  formErrors.push(mapper(sub));
@@ -9237,6 +9251,8 @@ const errorMap = (issue, _ctx) => {
9237
9251
  message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
9238
9252
  else if (issue.type === "number")
9239
9253
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
9254
+ else if (issue.type === "bigint")
9255
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
9240
9256
  else if (issue.type === "date")
9241
9257
  message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
9242
9258
  else
@@ -9834,6 +9850,8 @@ function isValidJWT(jwt, alg) {
9834
9850
  return false;
9835
9851
  try {
9836
9852
  const [header] = jwt.split(".");
9853
+ if (!header)
9854
+ return false;
9837
9855
  // Convert base64url to base64
9838
9856
  const base64 = header
9839
9857
  .replace(/-/g, "+")
@@ -3,5 +3,6 @@ export declare const storeHelpers: {
3
3
  formatCurrency(currency: string): string;
4
4
  formatPrice(priceInCents: number, currency: string, exchangeRate?: number | null): string;
5
5
  getExchangeRate(baseCurrency: string, targetCurrency: string): Promise<number>;
6
+ getAutocompleteAddressResults(query: string, locale?: string): Promise<import("@betterstore/sdk").AutocompleteResult[]>;
6
7
  };
7
8
  //# sourceMappingURL=betterstore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"betterstore.d.ts","sourceRoot":"","sources":["../../src/lib/betterstore.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;;CAAuB,CAAC"}
1
+ {"version":3,"file":"betterstore.d.ts","sourceRoot":"","sources":["../../src/lib/betterstore.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;;;CAAuB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/react",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -29,7 +29,7 @@
29
29
  "typescript": "5.8.2",
30
30
  "vite": "^6.3.5",
31
31
  "@betterstore/eslint-config": "0.0.0",
32
- "@betterstore/sdk": "0.5.2",
32
+ "@betterstore/sdk": "0.5.4",
33
33
  "@betterstore/typescript-config": "0.0.0"
34
34
  },
35
35
  "peerDependencies": {