@wise/dynamic-flow-client 3.11.2-experimental-26093dd → 3.11.2-experimental-revert-2-1b1276e

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.
@@ -20,12 +20,7 @@ export var makeHttpClient = function (baseUrl, additionalHeaders) {
20
20
  var applyBaseUrl = function (input, baseUrl) {
21
21
  return typeof input === 'string' && isRelativePath(input) ? baseUrl + input : input;
22
22
  };
23
- export var mergeRequestInit = function (init, additionalInit) { return (__assign(__assign(__assign({}, init), additionalInit), {
24
- // initHeaders takes priority over additionalHeaders, so must come last!
25
- // DF Core knows what content-type it's requesting (often JSON, sometimes images)
26
- // so we should trust the init headers instead of the additionalInit headers from
27
- // when the httpClient is created.
28
- headers: mergeHeaders(additionalInit === null || additionalInit === void 0 ? void 0 : additionalInit.headers, init === null || init === void 0 ? void 0 : init.headers) })); };
23
+ export var mergeRequestInit = function (init, additionalInit) { return (__assign(__assign(__assign({}, init), additionalInit), { headers: mergeHeaders(init === null || init === void 0 ? void 0 : init.headers, additionalInit === null || additionalInit === void 0 ? void 0 : additionalInit.headers) })); };
29
24
  var mergeHeaders = function () {
30
25
  var headersInits = [];
31
26
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -125,32 +125,6 @@ describe('mergeRequestInit', function () {
125
125
  });
126
126
  });
127
127
  });
128
- it('merges the two objects and the headers, prioritising the init headers in case they match', function () {
129
- var result = mergeRequestInit({ headers: { 'Content-Type': 'application/json' } }, { headers: { 'Content-Type': 'application/json,application/json' } });
130
- expect(result.headers).toMatchObject({
131
- 'content-type': 'application/json',
132
- });
133
- });
134
- describe('when called with RequestInits with Headers instances', function () {
135
- it('merges the two objects and the headers, prioritising the init headers in case they match', function () {
136
- var result = mergeRequestInit({ headers: new Headers([['Content-Type', 'application/json']]) }, {
137
- headers: new Headers([['Content-Type', 'application/json,application/json']]),
138
- });
139
- expect(result.headers).toMatchObject({
140
- 'content-type': 'application/json',
141
- });
142
- });
143
- });
144
- describe('when called with RequestInits with Array headers', function () {
145
- it('merges the two objects and the headers, prioritising the init headers in case they match', function () {
146
- var result = mergeRequestInit({ headers: [['Content-Type', 'application/json']] }, {
147
- headers: [['Content-Type', 'application/json,application/json']],
148
- });
149
- expect(result.headers).toMatchObject({
150
- 'content-type': 'application/json',
151
- });
152
- });
153
- });
154
128
  describe('when called with undefined as a first argument', function () {
155
129
  it('returns the second argument and empty headers', function () {
156
130
  var result = mergeRequestInit(undefined, { method: 'POST' });
@@ -88,7 +88,8 @@ var DynamicFlowComponent = function (_a) {
88
88
  var url = action.url, _b = action.method, method = _b === void 0 ? 'POST' : _b;
89
89
  return httpClient(url !== null && url !== void 0 ? url : '', {
90
90
  method: method,
91
- headers: __assign({ 'Content-Type': 'application/json' }, (etag ? { 'If-None-Match': etag } : {})),
91
+ credentials: 'include',
92
+ headers: __assign({ 'Content-Type': 'application/json', 'accept-language': 'en-GB' }, (etag ? { 'If-None-Match': etag } : {})),
92
93
  body: method === 'GET' ? undefined : JSON.stringify(data),
93
94
  });
94
95
  }, [httpClient]);
package/build/main.js CHANGED
@@ -317,11 +317,7 @@ var makeHttpClient = (baseUrl, additionalHeaders) => (
317
317
  );
318
318
  var applyBaseUrl = (input, baseUrl) => typeof input === "string" && isRelativePath(input) ? baseUrl + input : input;
319
319
  var mergeRequestInit = (init, additionalInit) => __spreadProps(__spreadValues(__spreadValues({}, init), additionalInit), {
320
- // initHeaders takes priority over additionalHeaders, so must come last!
321
- // DF Core knows what content-type it's requesting (often JSON, sometimes images)
322
- // so we should trust the init headers instead of the additionalInit headers from
323
- // when the httpClient is created.
324
- headers: mergeHeaders(additionalInit == null ? void 0 : additionalInit.headers, init == null ? void 0 : init.headers)
320
+ headers: mergeHeaders(init == null ? void 0 : init.headers, additionalInit == null ? void 0 : additionalInit.headers)
325
321
  });
326
322
  var mergeHeaders = (...headersInits) => headersInits.reduce(
327
323
  (acc, headers2) => __spreadValues(__spreadValues({}, acc), Object.fromEntries(new Headers(headers2).entries())),
@@ -19030,8 +19026,10 @@ var DynamicFlowComponent = ({
19030
19026
  const { url, method = "POST" } = action;
19031
19027
  return httpClient(url != null ? url : "", {
19032
19028
  method,
19029
+ credentials: "include",
19033
19030
  headers: __spreadValues({
19034
- "Content-Type": "application/json"
19031
+ "Content-Type": "application/json",
19032
+ "accept-language": "en-GB"
19035
19033
  }, etag2 ? { "If-None-Match": etag2 } : {}),
19036
19034
  body: method === "GET" ? void 0 : JSON.stringify(data)
19037
19035
  });