@wise/dynamic-flow-client-internal 3.9.1-experimental-152372b → 3.9.2-experimental-535221d

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.
@@ -0,0 +1,89 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { jsx as _jsx } from "react/jsx-runtime";
49
+ import { waitFor } from '@testing-library/react';
50
+ import { renderWithProviders } from '../test-utils/rtl-utils';
51
+ import { DynamicFlowLegacy, DynamicFlowRevamp, DynamicFragment } from './DynamicFlow';
52
+ describe.each([
53
+ { name: 'DynamicFlowLegacy', DFComponent: DynamicFlowLegacy },
54
+ { name: 'DynamicFlowRevamp', DFComponent: DynamicFlowRevamp },
55
+ { name: 'DynamicFragment', DFComponent: DynamicFragment },
56
+ ])('Wise-Specific Headers', function (_a) {
57
+ var name = _a.name, DFComponent = _a.DFComponent;
58
+ it("".concat(name, " - makes an initial request with additional RequestInit parameters, as specified in the wise-specific fetcher"), function () { return __awaiter(void 0, void 0, void 0, function () {
59
+ var props, customFetch, requestInit, credentials, headersEntries;
60
+ return __generator(this, function (_a) {
61
+ switch (_a.label) {
62
+ case 0:
63
+ props = {
64
+ flowId: 'test',
65
+ customFetch: jest.fn(),
66
+ initialAction: { url: '/initial' },
67
+ onCompletion: jest.fn(),
68
+ onError: jest.fn(),
69
+ };
70
+ customFetch = jest.fn();
71
+ renderWithProviders(_jsx(DFComponent, __assign({}, props, { customFetch: customFetch })));
72
+ return [4 /*yield*/, waitFor(function () {
73
+ expect(customFetch).toHaveBeenCalledWith('/initial', expect.anything());
74
+ })];
75
+ case 1:
76
+ _a.sent();
77
+ requestInit = customFetch.mock.calls[0][1];
78
+ credentials = requestInit === null || requestInit === void 0 ? void 0 : requestInit.credentials;
79
+ headersEntries = Array.from((requestInit === null || requestInit === void 0 ? void 0 : requestInit.headers).entries());
80
+ expect(credentials).toBe('include');
81
+ expect(headersEntries).toEqual([
82
+ ['content-type', 'application/json'],
83
+ ['accept-language', 'en-GB'],
84
+ ]);
85
+ return [2 /*return*/];
86
+ }
87
+ });
88
+ }); });
89
+ });
@@ -0,0 +1,29 @@
1
+ import { mergeRequestInit } from './mergeRequestInit';
2
+ describe('mergeRequestInit', function () {
3
+ describe('when called with two RequestInit objects', function () {
4
+ it('merges the two objects and the headers', function () {
5
+ var result = mergeRequestInit({ credentials: 'include', headers: { 'X-DF-Response-Type': 'true' } }, { method: 'POST', headers: { 'X-Access-Token': 'QWERTYUIOP' } });
6
+ expect(result).toMatchObject({
7
+ credentials: 'include',
8
+ method: 'POST',
9
+ headers: expect.any(Headers),
10
+ });
11
+ expect(Object.fromEntries(result.headers.entries())).toMatchObject({
12
+ 'x-df-response-type': 'true',
13
+ 'x-access-token': 'QWERTYUIOP',
14
+ });
15
+ });
16
+ });
17
+ describe('when called with undefined as a first argument', function () {
18
+ it('returns the second argument and empty headers', function () {
19
+ var result = mergeRequestInit(undefined, { method: 'POST' });
20
+ expect(result).toEqual({ method: 'POST', headers: {} });
21
+ });
22
+ });
23
+ describe('when called with null as a first argument', function () {
24
+ it('returns the second argument and empty headers', function () {
25
+ var result = mergeRequestInit(null, { method: 'POST' });
26
+ expect(result).toEqual({ method: 'POST', headers: {} });
27
+ });
28
+ });
29
+ });
@@ -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.1-experimental-152372b",
3
+ "version": "3.9.2-experimental-535221d",
4
4
  "description": "Dynamic Flow web client for Wise",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -73,7 +73,7 @@
73
73
  "typescript": "5.1.6",
74
74
  "webpack": "5.91.0",
75
75
  "@wise/dynamic-flow-fixtures": "0.0.1",
76
- "@wise/dynamic-flow-types": "2.15.0-experimental-152372b"
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.1-experimental-152372b"
84
+ "@wise/dynamic-flow-client": "3.9.2-experimental-535221d"
85
85
  },
86
86
  "scripts": {
87
87
  "dev": "storybook dev -p 3005",