@wise/dynamic-flow-client-internal 3.9.0 → 3.9.1
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/build/main.js +38 -4
- package/build/main.min.js +1 -1
- package/build/main.mjs +39 -5
- package/build/types/dynamicFlow/DynamicFlow.test.d.ts +1 -0
- package/build/types/dynamicFlow/utils/mergeRequestInit.d.ts +1 -0
- package/build/types/dynamicFlow/utils/mergeRequestInit.test.d.ts +1 -0
- package/package.json +4 -4
package/build/main.js
CHANGED
|
@@ -51,24 +51,58 @@ var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
|
51
51
|
var import_dynamic_flow_client3 = require("@wise/dynamic-flow-client");
|
|
52
52
|
|
|
53
53
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
54
|
-
var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
|
|
55
54
|
var import_react = require("react");
|
|
55
|
+
var import_react_intl = require("react-intl");
|
|
56
|
+
var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
|
|
57
|
+
|
|
58
|
+
// src/dynamicFlow/utils/mergeRequestInit.ts
|
|
59
|
+
var mergeRequestInit = (init, additionalInit) => __spreadProps(__spreadValues(__spreadValues({}, init), additionalInit), {
|
|
60
|
+
headers: mergeHeaders(init == null ? void 0 : init.headers, additionalInit == null ? void 0 : additionalInit.headers)
|
|
61
|
+
});
|
|
62
|
+
var mergeHeaders = (initHeaders, additionalHeaders) => {
|
|
63
|
+
if (!initHeaders && !additionalHeaders) {
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
const headers = new Headers(initHeaders);
|
|
67
|
+
for (const [key, value] of Object.entries(additionalHeaders != null ? additionalHeaders : {})) {
|
|
68
|
+
headers.set(key, value);
|
|
69
|
+
}
|
|
70
|
+
return headers;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/dynamicFlow/DynamicFlow.tsx
|
|
56
74
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
57
75
|
function DynamicFlowLegacy(props) {
|
|
58
76
|
const { customFetch = globalThis.fetch } = props;
|
|
59
|
-
const
|
|
77
|
+
const httpClient = useWiseHttpClient(customFetch);
|
|
78
|
+
const coreProps = __spreadProps(__spreadValues({}, props), { httpClient });
|
|
60
79
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dynamic_flow_client.DynamicFlow, __spreadValues({}, coreProps));
|
|
61
80
|
}
|
|
62
81
|
function DynamicFlowRevamp(props) {
|
|
63
82
|
const { customFetch = globalThis.fetch } = props;
|
|
64
|
-
const
|
|
83
|
+
const httpClient = useWiseHttpClient(customFetch);
|
|
84
|
+
const coreProps = __spreadProps(__spreadValues({}, props), { httpClient });
|
|
65
85
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dynamic_flow_client.DynamicFlowRevamp, __spreadValues({}, coreProps));
|
|
66
86
|
}
|
|
67
87
|
var DynamicFragment = (0, import_react.forwardRef)(function DynamicFragment2(props, ref) {
|
|
68
88
|
const { customFetch = globalThis.fetch } = props;
|
|
69
|
-
const
|
|
89
|
+
const httpClient = useWiseHttpClient(customFetch);
|
|
90
|
+
const coreProps = __spreadProps(__spreadValues({}, props), { httpClient });
|
|
70
91
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dynamic_flow_client.DynamicFragmentWise, __spreadProps(__spreadValues({}, coreProps), { ref }));
|
|
71
92
|
});
|
|
93
|
+
var useWiseHttpClient = (httpClient) => {
|
|
94
|
+
const { locale } = (0, import_react_intl.useIntl)();
|
|
95
|
+
return (0, import_react.useCallback)(
|
|
96
|
+
async (input, init) => httpClient(
|
|
97
|
+
input,
|
|
98
|
+
mergeRequestInit(init, {
|
|
99
|
+
credentials: "include",
|
|
100
|
+
headers: { "accept-language": locale }
|
|
101
|
+
})
|
|
102
|
+
),
|
|
103
|
+
[httpClient, locale]
|
|
104
|
+
);
|
|
105
|
+
};
|
|
72
106
|
|
|
73
107
|
// src/index.ts
|
|
74
108
|
var makeCustomFetch = import_dynamic_flow_client2.makeHttpClient;
|
package/build/main.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=Object.defineProperty,v=Object.defineProperties,I=Object.getOwnPropertyDescriptor,W=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertyNames,w=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var D=(t,e,o)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,n=(t,e)=>{for(var o in e||(e={}))h.call(e,o)&&D(t,o,e[o]);if(w)for(var o of w(e))L.call(e,o)&&D(t,o,e[o]);return t},r=(t,e)=>v(t,W(e));var b=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},S=(t,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of x(e))!h.call(t,a)&&a!==o&&s(t,a,{get:()=>e[a],enumerable:!(c=I(e,a))||c.enumerable});return t};var q=t=>S(s({},"__esModule",{value:!0}),t);var T={};b(T,{DynamicFlow:()=>y,DynamicFlowLegacy:()=>y,DynamicFlowRevamp:()=>u,DynamicFragment:()=>P,JsonSchemaForm:()=>i.JsonSchemaForm,isValidSchema:()=>i.isValidSchema,makeCustomFetch:()=>O,translations:()=>i.translations});module.exports=q(T);var R=require("@wise/dynamic-flow-client"),i=require("@wise/dynamic-flow-client");var p=require("react"),g=require("react-intl"),m=require("@wise/dynamic-flow-client");var f=(t,e)=>r(n(n({},t),e),{headers:A(t==null?void 0:t.headers,e==null?void 0:e.headers)}),A=(t,e)=>{if(!t&&!e)return{};let o=new Headers(t);for(let[c,a]of Object.entries(e!=null?e:{}))o.set(c,a);return o};var l=require("react/jsx-runtime");function y(t){let{customFetch:e=globalThis.fetch}=t,o=F(e),c=r(n({},t),{httpClient:o});return(0,l.jsx)(m.DynamicFlow,n({},c))}function u(t){let{customFetch:e=globalThis.fetch}=t,o=F(e),c=r(n({},t),{httpClient:o});return(0,l.jsx)(m.DynamicFlowRevamp,n({},c))}var P=(0,p.forwardRef)(function(e,o){let{customFetch:c=globalThis.fetch}=e,a=F(c),C=r(n({},e),{httpClient:a});return(0,l.jsx)(m.DynamicFragmentWise,r(n({},C),{ref:o}))}),F=t=>{let{locale:e}=(0,g.useIntl)();return(0,p.useCallback)(async(o,c)=>t(o,f(c,{credentials:"include",headers:{"accept-language":e}})),[t,e])};var O=R.makeHttpClient;
|
package/build/main.mjs
CHANGED
|
@@ -23,28 +23,62 @@ import { makeHttpClient } from "@wise/dynamic-flow-client";
|
|
|
23
23
|
import { translations, JsonSchemaForm, isValidSchema } from "@wise/dynamic-flow-client";
|
|
24
24
|
|
|
25
25
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
26
|
+
import { forwardRef, useCallback } from "react";
|
|
27
|
+
import { useIntl } from "react-intl";
|
|
26
28
|
import {
|
|
27
|
-
DynamicFlowRevamp as DynamicFlowCoreRevamp,
|
|
28
29
|
DynamicFlow as DynamicFlowCoreLegacy,
|
|
30
|
+
DynamicFlowRevamp as DynamicFlowCoreRevamp,
|
|
29
31
|
DynamicFragmentWise
|
|
30
32
|
} from "@wise/dynamic-flow-client";
|
|
31
|
-
|
|
33
|
+
|
|
34
|
+
// src/dynamicFlow/utils/mergeRequestInit.ts
|
|
35
|
+
var mergeRequestInit = (init, additionalInit) => __spreadProps(__spreadValues(__spreadValues({}, init), additionalInit), {
|
|
36
|
+
headers: mergeHeaders(init == null ? void 0 : init.headers, additionalInit == null ? void 0 : additionalInit.headers)
|
|
37
|
+
});
|
|
38
|
+
var mergeHeaders = (initHeaders, additionalHeaders) => {
|
|
39
|
+
if (!initHeaders && !additionalHeaders) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
const headers = new Headers(initHeaders);
|
|
43
|
+
for (const [key, value] of Object.entries(additionalHeaders != null ? additionalHeaders : {})) {
|
|
44
|
+
headers.set(key, value);
|
|
45
|
+
}
|
|
46
|
+
return headers;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// src/dynamicFlow/DynamicFlow.tsx
|
|
32
50
|
import { jsx } from "react/jsx-runtime";
|
|
33
51
|
function DynamicFlowLegacy(props) {
|
|
34
52
|
const { customFetch = globalThis.fetch } = props;
|
|
35
|
-
const
|
|
53
|
+
const httpClient = useWiseHttpClient(customFetch);
|
|
54
|
+
const coreProps = __spreadProps(__spreadValues({}, props), { httpClient });
|
|
36
55
|
return /* @__PURE__ */ jsx(DynamicFlowCoreLegacy, __spreadValues({}, coreProps));
|
|
37
56
|
}
|
|
38
57
|
function DynamicFlowRevamp(props) {
|
|
39
58
|
const { customFetch = globalThis.fetch } = props;
|
|
40
|
-
const
|
|
59
|
+
const httpClient = useWiseHttpClient(customFetch);
|
|
60
|
+
const coreProps = __spreadProps(__spreadValues({}, props), { httpClient });
|
|
41
61
|
return /* @__PURE__ */ jsx(DynamicFlowCoreRevamp, __spreadValues({}, coreProps));
|
|
42
62
|
}
|
|
43
63
|
var DynamicFragment = forwardRef(function DynamicFragment2(props, ref) {
|
|
44
64
|
const { customFetch = globalThis.fetch } = props;
|
|
45
|
-
const
|
|
65
|
+
const httpClient = useWiseHttpClient(customFetch);
|
|
66
|
+
const coreProps = __spreadProps(__spreadValues({}, props), { httpClient });
|
|
46
67
|
return /* @__PURE__ */ jsx(DynamicFragmentWise, __spreadProps(__spreadValues({}, coreProps), { ref }));
|
|
47
68
|
});
|
|
69
|
+
var useWiseHttpClient = (httpClient) => {
|
|
70
|
+
const { locale } = useIntl();
|
|
71
|
+
return useCallback(
|
|
72
|
+
async (input, init) => httpClient(
|
|
73
|
+
input,
|
|
74
|
+
mergeRequestInit(init, {
|
|
75
|
+
credentials: "include",
|
|
76
|
+
headers: { "accept-language": locale }
|
|
77
|
+
})
|
|
78
|
+
),
|
|
79
|
+
[httpClient, locale]
|
|
80
|
+
);
|
|
81
|
+
};
|
|
48
82
|
|
|
49
83
|
// src/index.ts
|
|
50
84
|
var makeCustomFetch = makeHttpClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mergeRequestInit: (init?: RequestInit, additionalInit?: RequestInit) => RequestInit;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client-internal",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "Dynamic Flow web client for Wise",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.min.js",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"stylelint-value-no-unknown-custom-properties": "6.0.1",
|
|
73
73
|
"typescript": "5.1.6",
|
|
74
74
|
"webpack": "5.91.0",
|
|
75
|
-
"@wise/dynamic-flow-
|
|
76
|
-
"@wise/dynamic-flow-
|
|
75
|
+
"@wise/dynamic-flow-fixtures": "0.0.1",
|
|
76
|
+
"@wise/dynamic-flow-types": "2.15.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "^18",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"react-intl": "^6"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@wise/dynamic-flow-client": "3.9.
|
|
84
|
+
"@wise/dynamic-flow-client": "3.9.1"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"dev": "storybook dev -p 3005",
|