@prezly/sdk 17.1.0 → 18.0.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.
- package/README.md +12 -0
- package/dist/api/constants.cjs +1 -1
- package/dist/api/constants.js +1 -1
- package/dist/types/Category.d.ts +1 -1
- package/dist/types/Culture.cjs +4 -0
- package/dist/types/Culture.d.ts +16 -4
- package/dist/types/Culture.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,3 +100,15 @@ const { createPrezlyClient } = require('@prezly/sdk');
|
|
|
100
100
|
|
|
101
101
|
We recommend referring to the [official `cross-fetch` module documentation](https://www.npmjs.com/package/cross-fetch) for more information.
|
|
102
102
|
|
|
103
|
+
#### Custom `fetch` implementation
|
|
104
|
+
|
|
105
|
+
Additionally, you can initialize the API client with your own implementation of `fetch`:
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
import { createPrezlyClient } = from '@prezly/sdk';
|
|
109
|
+
|
|
110
|
+
const prezlyClient = createPrezlyClient({
|
|
111
|
+
accessToken: 'your-access-token',
|
|
112
|
+
fetch: customFetch,
|
|
113
|
+
});
|
|
114
|
+
```
|
package/dist/api/constants.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DEFAULT_USER_AGENT = void 0;
|
|
7
|
-
const VERSION = "17.
|
|
7
|
+
const VERSION = "17.1.0";
|
|
8
8
|
const URL = 'https://github.com/prezly/javascript-sdk';
|
|
9
9
|
const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
|
|
10
10
|
exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT;
|
package/dist/api/constants.js
CHANGED
package/dist/types/Category.d.ts
CHANGED
package/dist/types/Culture.cjs
CHANGED
|
@@ -13,4 +13,8 @@ exports.Culture = Culture;
|
|
|
13
13
|
TextDirection["RTL"] = "rtl";
|
|
14
14
|
})(TextDirection || (TextDirection = {}));
|
|
15
15
|
_Culture.TextDirection = TextDirection;
|
|
16
|
+
function isoCode(code) {
|
|
17
|
+
return code.replace('_', '-');
|
|
18
|
+
}
|
|
19
|
+
_Culture.isoCode = isoCode;
|
|
16
20
|
})(Culture || (exports.Culture = Culture = {}));
|
package/dist/types/Culture.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export interface CultureRef {
|
|
2
|
-
code:
|
|
3
|
-
locale:
|
|
2
|
+
code: Culture.Code;
|
|
3
|
+
locale: Culture.Code;
|
|
4
4
|
name: string;
|
|
5
5
|
native_name: string;
|
|
6
|
-
direction: Culture.TextDirection
|
|
7
|
-
language_code:
|
|
6
|
+
direction: `${Culture.TextDirection}`;
|
|
7
|
+
language_code: Culture.LangCode;
|
|
8
8
|
}
|
|
9
9
|
export declare type Culture = CultureRef;
|
|
10
10
|
export declare namespace Culture {
|
|
@@ -12,4 +12,16 @@ export declare namespace Culture {
|
|
|
12
12
|
LTR = "ltr",
|
|
13
13
|
RTL = "rtl"
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Primary locale code used everywhere in the Prezly app.
|
|
17
|
+
*/
|
|
18
|
+
type Code = `${LangCode}` | `${LangCode}_${RegionCode}` | `${LangCode}_${ScriptCode}` | `${LangCode}_${ScriptCode}_${RegionCode}`;
|
|
19
|
+
/**
|
|
20
|
+
* Locale ISO code to be used in HTML attributes.
|
|
21
|
+
*/
|
|
22
|
+
type IsoCode = `${LangCode}` | `${LangCode}-${RegionCode}` | `${LangCode}-${ScriptCode}` | `${LangCode}-${ScriptCode}-${RegionCode}`;
|
|
23
|
+
type LangCode = `${Lowercase<string>}`;
|
|
24
|
+
type ScriptCode = string;
|
|
25
|
+
type RegionCode = `${Uppercase<string>}`;
|
|
26
|
+
function isoCode(code: Code): IsoCode;
|
|
15
27
|
}
|
package/dist/types/Culture.js
CHANGED
|
@@ -6,4 +6,8 @@ export let Culture;
|
|
|
6
6
|
TextDirection["RTL"] = "rtl";
|
|
7
7
|
})(TextDirection || (TextDirection = {}));
|
|
8
8
|
_Culture.TextDirection = TextDirection;
|
|
9
|
+
function isoCode(code) {
|
|
10
|
+
return code.replace('_', '-');
|
|
11
|
+
}
|
|
12
|
+
_Culture.isoCode = isoCode;
|
|
9
13
|
})(Culture || (Culture = {}));
|