@servicetitan/docs-anvil-uikit-contrib 25.8.1 → 25.9.0

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.
Files changed (2) hide show
  1. package/docs/culture.mdx +24 -26
  2. package/package.json +2 -2
package/docs/culture.mdx CHANGED
@@ -37,47 +37,45 @@ const App: React.FC = () => {
37
37
  // Somewhere later in the component tree you can consume culture settings via CULTURE_TOKEN
38
38
  const DisplayCulture: React.FC = () => {
39
39
  const [culture] = useDependencies(CULTURE_TOKEN);
40
- return <span>culture.Name</span>;
40
+ return <span>{culture.Name}</span>;
41
41
  };
42
42
  ```
43
43
 
44
+ ## Automatic provide
45
+
46
+ Could be used in MFEs to automatically fetch culture settings. Uses CultureStore from `@servicetitan/application-data/culture` package
47
+
48
+ ```tsx
49
+ import React from 'react';
50
+ import { useDependencies } from '@servicetitan/react-ioc';
51
+ import { CULTURE_TOKEN, provideWithCulture } from '@servicetitan/culture';
52
+
53
+ const App: React.FC = provideWithCulture()(() => {
54
+ const [culture] = useDependencies(CULTURE_TOKEN);
55
+
56
+ return <span>{culture.Name}</span>;
57
+ });
58
+ ```
59
+
44
60
  ## Package contents
45
61
 
46
62
  ### CultureProvider
47
63
 
48
- React Component that passes culture setttings to `@servicetitan/react-ioc` container.
64
+ React Component that passes culture settings to `@servicetitan/react-ioc` container.
49
65
 
50
66
  #### Props
51
67
 
52
68
  | Name | Type | Description | Required |
53
69
  | :-----: | :-------: | :---------------------: | :------: |
54
- | `value` | `Culture` | Culture settings object | Yes |
70
+ | `value` | `Culture` | Culture settings object | No |
55
71
 
56
72
  ### Culture
57
73
 
58
- TS inteface of culture setttings.
59
-
60
- ```ts
61
- interface Culture {
62
- Name: string;
63
- DateTimeFormat: {
64
- MomentShortDatePattern: string;
65
- MomentShortYearDatePattern: string;
66
- MomentShortYearDateTimePattern: string;
67
- };
68
- NumberFormat: {
69
- NumberDecimalSeparator: string;
70
- NumberGroupSeparator: string;
71
- };
72
- PhoneFormat: {
73
- PhoneFormatInfo: {
74
- Pattern: RegExp;
75
- };
76
- PhoneMask: string;
77
- SimplePhoneMask: string;
78
- };
79
- }
80
- ```
74
+ TS interface of culture settings. See `@servicetitan/application-data/culture`
75
+
76
+ ### provideWithCulture
77
+
78
+ Helper for automatic culture initialization. It adds CultureStore, initialize it and wraps content by CultureProvider. Has the same interface as `provide` from `@servicetitan/react-ioc`.
81
79
 
82
80
  ### CULTURE_TOKEN
83
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/docs-anvil-uikit-contrib",
3
- "version": "25.8.1",
3
+ "version": "25.9.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,5 +16,5 @@
16
16
  "cli": {
17
17
  "webpack": false
18
18
  },
19
- "gitHead": "7ff86e7a40bab18082b6d972addbab9f4b2ff88c"
19
+ "gitHead": "72d081af4ab3deb72dab7d4fc93a4c2e473b726f"
20
20
  }