@creopse/react 0.0.9 → 0.0.10

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-CJtxQKA-.cjs");
3
+ const index = require("../index-ZewuA4XM.cjs");
4
4
  const React = require("react");
5
5
  const react = require("@inertiajs/react");
6
6
  const useProps = () => {
@@ -1,5 +1,5 @@
1
- import { P as PropsContext, b as useApi, u as useHelper, a as ResolveSectionsContext, c as cloneDeep } from "../index-DAEkiy4W.js";
2
- import { d } from "../index-DAEkiy4W.js";
1
+ import { P as PropsContext, b as useApi, u as useHelper, a as ResolveSectionsContext, c as cloneDeep } from "../index-4XGApE5d.js";
2
+ import { d } from "../index-4XGApE5d.js";
3
3
  import { useContext, useState, useEffect, useCallback, useMemo } from "react";
4
4
  import { usePage } from "@inertiajs/react";
5
5
  const useProps = () => {
@@ -6949,7 +6949,7 @@ const useMediaQuery = (query) => {
6949
6949
  const useHelper = () => {
6950
6950
  const page = usePage();
6951
6951
  const { request } = useApi();
6952
- const { apiBaseUrl, langKey } = useConfig();
6952
+ const { apiBaseUrl } = useConfig();
6953
6953
  const currentRoutePath = useMemo(() => page.url, [page.url]);
6954
6954
  const resolveUrl = useCallback(
6955
6955
  (path) => {
@@ -7074,9 +7074,8 @@ const useHelper = () => {
7074
7074
  (label) => languages.find((l) => l.label === label)?.value,
7075
7075
  [languages]
7076
7076
  );
7077
- const updateLang = useCallback(
7077
+ const updateUserLang = useCallback(
7078
7078
  async (val, reload = true, updateUserPrefs = true) => {
7079
- localStorage.setItem(langKey, val);
7080
7079
  if (page.props.isUserLoggedIn && updateUserPrefs) {
7081
7080
  const userPrefs = page.props.userData?.preferences || {
7082
7081
  inAppNotifEnabled: Bool.TRUE,
@@ -7094,7 +7093,7 @@ const useHelper = () => {
7094
7093
  }
7095
7094
  if (reload) location.reload();
7096
7095
  },
7097
- [langKey, page.props, request]
7096
+ [page.props, request]
7098
7097
  );
7099
7098
  const displayFormErrors = useCallback(
7100
7099
  (errors, displayError) => {
@@ -7184,7 +7183,7 @@ const useHelper = () => {
7184
7183
  displayFormErrors,
7185
7184
  resolveHtmlLinks,
7186
7185
  resolveUrl,
7187
- updateLang,
7186
+ updateUserLang,
7188
7187
  languages,
7189
7188
  getImage,
7190
7189
  fileUrl,
@@ -6950,7 +6950,7 @@ const useMediaQuery = (query) => {
6950
6950
  const useHelper = () => {
6951
6951
  const page = react.usePage();
6952
6952
  const { request } = useApi();
6953
- const { apiBaseUrl, langKey } = useConfig();
6953
+ const { apiBaseUrl } = useConfig();
6954
6954
  const currentRoutePath = React.useMemo(() => page.url, [page.url]);
6955
6955
  const resolveUrl = React.useCallback(
6956
6956
  (path) => {
@@ -7075,9 +7075,8 @@ const useHelper = () => {
7075
7075
  (label) => languages.find((l) => l.label === label)?.value,
7076
7076
  [languages]
7077
7077
  );
7078
- const updateLang = React.useCallback(
7078
+ const updateUserLang = React.useCallback(
7079
7079
  async (val, reload = true, updateUserPrefs = true) => {
7080
- localStorage.setItem(langKey, val);
7081
7080
  if (page.props.isUserLoggedIn && updateUserPrefs) {
7082
7081
  const userPrefs = page.props.userData?.preferences || {
7083
7082
  inAppNotifEnabled: Bool.TRUE,
@@ -7095,7 +7094,7 @@ const useHelper = () => {
7095
7094
  }
7096
7095
  if (reload) location.reload();
7097
7096
  },
7098
- [langKey, page.props, request]
7097
+ [page.props, request]
7099
7098
  );
7100
7099
  const displayFormErrors = React.useCallback(
7101
7100
  (errors, displayError) => {
@@ -7185,7 +7184,7 @@ const useHelper = () => {
7185
7184
  displayFormErrors,
7186
7185
  resolveHtmlLinks,
7187
7186
  resolveUrl,
7188
- updateLang,
7187
+ updateUserLang,
7189
7188
  languages,
7190
7189
  getImage,
7191
7190
  fileUrl,
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
- const index = require("./index-CJtxQKA-.cjs");
4
+ const index = require("./index-ZewuA4XM.cjs");
5
5
  require("@inertiajs/react");
6
6
  const reactDom = require("react-dom");
7
7
  function _interopNamespaceDefault(e) {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import React__default, { useState, useEffect, createContext, useRef, useLayoutEffect, useId, useContext, useInsertionEffect, useMemo, useCallback, Children, isValidElement, Fragment, createElement, forwardRef, Component } from "react";
3
- import { u as useHelper, s as slideToId, E as EditorMessageType, R as RouterContext, C as ConfigContext, a as ResolveSectionsContext, P as PropsContext } from "./index-DAEkiy4W.js";
3
+ import { u as useHelper, s as slideToId, E as EditorMessageType, R as RouterContext, C as ConfigContext, a as ResolveSectionsContext, P as PropsContext } from "./index-4XGApE5d.js";
4
4
  import "@inertiajs/react";
5
5
  import { createPortal } from "react-dom";
6
6
  var jsxRuntime = { exports: {} };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@creopse/react",
3
3
  "description": "Creopse React Toolkit",
4
- "version": "0.0.9",
4
+ "version": "0.0.10",
5
5
  "private": false,
6
6
  "author": "Noé Gnanih <noegnanih@gmail.com>",
7
7
  "license": "MIT",
@@ -17,5 +17,4 @@ export declare const useConfig: () => {
17
17
  appUrl: string;
18
18
  xApiKey: string;
19
19
  encryptionKey: string;
20
- langKey: string;
21
20
  };
@@ -17,7 +17,7 @@ export declare const useHelper: () => {
17
17
  displayFormErrors: (errors: any, displayError: (message: string) => void) => void;
18
18
  resolveHtmlLinks: (data: string | null | undefined, lang: string) => string;
19
19
  resolveUrl: (path: string) => string;
20
- updateLang: (val: string, reload?: boolean, updateUserPrefs?: boolean) => Promise<void>;
20
+ updateUserLang: (val: string, reload?: boolean, updateUserPrefs?: boolean) => Promise<void>;
21
21
  languages: Language[];
22
22
  getImage: (path: string, size?: "small" | "medium" | "large" | "original") => Promise<string>;
23
23
  fileUrl: (path: string) => string;
@@ -4,7 +4,6 @@ export interface PluginConfig {
4
4
  appUrl: string;
5
5
  xApiKey: string;
6
6
  encryptionKey: string;
7
- langKey: string;
8
7
  }
9
8
  export interface PluginOptions {
10
9
  initialProps: Record<string, any>;