@redneckz/wildless-cms-uni-blocks 0.14.712 → 0.14.714
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/bundle/api/RetailAPI/getTaskStatus.d.ts +5 -0
- package/bundle/bundle.umd.js +15 -5
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/hooks/useAsyncEffect.d.ts +1 -0
- package/bundle/services/retail/mockLocalStorage.d.ts +1 -0
- package/dist/api/RetailAPI/getTaskStatus.d.ts +5 -0
- package/dist/api/RetailAPI/getTaskStatus.js +5 -0
- package/dist/api/RetailAPI/getTaskStatus.js.map +1 -1
- package/dist/api/RetailAPI/sendCode.js +3 -4
- package/dist/api/RetailAPI/sendCode.js.map +1 -1
- package/dist/components/CreditCardForm/CreditCardFormStatusTracker.js +3 -0
- package/dist/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
- package/dist/components/CreditForm/CreditFormStatusTracker.js +3 -0
- package/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/dist/hooks/useAsyncEffect.d.ts +1 -0
- package/dist/hooks/useAsyncEffect.js +15 -0
- package/dist/hooks/useAsyncEffect.js.map +1 -0
- package/dist/services/retail/mockLocalStorage.d.ts +1 -0
- package/dist/services/retail/mockLocalStorage.js +35 -0
- package/dist/services/retail/mockLocalStorage.js.map +1 -0
- package/dist/setup-fixture.js +11 -0
- package/dist/setup-fixture.js.map +1 -1
- package/lib/api/RetailAPI/getTaskStatus.d.ts +5 -0
- package/lib/api/RetailAPI/getTaskStatus.js +5 -0
- package/lib/api/RetailAPI/getTaskStatus.js.map +1 -1
- package/lib/api/RetailAPI/sendCode.js +4 -5
- package/lib/api/RetailAPI/sendCode.js.map +1 -1
- package/lib/components/CreditCardForm/CreditCardForm.fixture.d.ts +1 -1
- package/lib/components/CreditCardForm/CreditCardForm.fixture.mobile.d.ts +1 -1
- package/lib/components/CreditCardForm/CreditCardFormStatusTracker.js +3 -0
- package/lib/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
- package/lib/components/CreditForm/CreditForm.fixture.d.ts +1 -1
- package/lib/components/CreditForm/CreditForm.fixture.mobile.d.ts +1 -1
- package/lib/components/CreditForm/CreditFormStatusTracker.js +3 -0
- package/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/lib/hooks/useAsyncEffect.d.ts +1 -0
- package/lib/hooks/useAsyncEffect.js +12 -0
- package/lib/hooks/useAsyncEffect.js.map +1 -0
- package/lib/services/retail/mockLocalStorage.d.ts +1 -0
- package/lib/services/retail/mockLocalStorage.js +32 -0
- package/lib/services/retail/mockLocalStorage.js.map +1 -0
- package/lib/setup-fixture.js +11 -0
- package/lib/setup-fixture.js.map +1 -1
- package/mobile/bundle/api/RetailAPI/getTaskStatus.d.ts +5 -0
- package/mobile/bundle/bundle.umd.js +15 -5
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/hooks/useAsyncEffect.d.ts +1 -0
- package/mobile/bundle/services/retail/mockLocalStorage.d.ts +1 -0
- package/mobile/dist/api/RetailAPI/getTaskStatus.d.ts +5 -0
- package/mobile/dist/api/RetailAPI/getTaskStatus.js +5 -0
- package/mobile/dist/api/RetailAPI/getTaskStatus.js.map +1 -1
- package/mobile/dist/api/RetailAPI/sendCode.js +3 -4
- package/mobile/dist/api/RetailAPI/sendCode.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/CreditCardFormStatusTracker.js +3 -0
- package/mobile/dist/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js +3 -0
- package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/mobile/dist/hooks/useAsyncEffect.d.ts +1 -0
- package/mobile/dist/hooks/useAsyncEffect.js +15 -0
- package/mobile/dist/hooks/useAsyncEffect.js.map +1 -0
- package/mobile/dist/services/retail/mockLocalStorage.d.ts +1 -0
- package/mobile/dist/services/retail/mockLocalStorage.js +35 -0
- package/mobile/dist/services/retail/mockLocalStorage.js.map +1 -0
- package/mobile/dist/setup-fixture.js +11 -0
- package/mobile/dist/setup-fixture.js.map +1 -1
- package/mobile/lib/api/RetailAPI/getTaskStatus.d.ts +5 -0
- package/mobile/lib/api/RetailAPI/getTaskStatus.js +5 -0
- package/mobile/lib/api/RetailAPI/getTaskStatus.js.map +1 -1
- package/mobile/lib/api/RetailAPI/sendCode.js +4 -5
- package/mobile/lib/api/RetailAPI/sendCode.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/CreditCardFormStatusTracker.js +3 -0
- package/mobile/lib/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js +3 -0
- package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/mobile/lib/hooks/useAsyncEffect.d.ts +1 -0
- package/mobile/lib/hooks/useAsyncEffect.js +12 -0
- package/mobile/lib/hooks/useAsyncEffect.js.map +1 -0
- package/mobile/lib/services/retail/mockLocalStorage.d.ts +1 -0
- package/mobile/lib/services/retail/mockLocalStorage.js +32 -0
- package/mobile/lib/services/retail/mockLocalStorage.js.map +1 -0
- package/mobile/lib/setup-fixture.js +11 -0
- package/mobile/lib/setup-fixture.js.map +1 -1
- package/mobile/src/api/RetailAPI/getTaskStatus.ts +5 -0
- package/mobile/src/api/RetailAPI/sendCode.ts +4 -15
- package/mobile/src/components/CreditCardForm/CreditCardFormStatusTracker.tsx +3 -0
- package/mobile/src/components/CreditForm/CreditFormStatusTracker.tsx +3 -0
- package/mobile/src/hooks/useAsyncEffect.ts +16 -0
- package/mobile/src/services/retail/mockLocalStorage.ts +40 -0
- package/mobile/src/setup-fixture.ts +12 -0
- package/package.json +1 -1
- package/src/api/RetailAPI/getTaskStatus.ts +5 -0
- package/src/api/RetailAPI/sendCode.ts +4 -15
- package/src/components/CreditCardForm/CreditCardForm.fixture.mobile.tsx +14 -18
- package/src/components/CreditCardForm/CreditCardForm.fixture.tsx +14 -18
- package/src/components/CreditCardForm/CreditCardFormStatusTracker.tsx +3 -0
- package/src/components/CreditForm/CreditForm.fixture.mobile.tsx +19 -23
- package/src/components/CreditForm/CreditForm.fixture.tsx +19 -23
- package/src/components/CreditForm/CreditFormStatusTracker.tsx +3 -0
- package/src/hooks/useAsyncEffect.ts +16 -0
- package/src/services/retail/mockLocalStorage.ts +40 -0
- package/src/setup-fixture.ts +12 -0
|
@@ -1,25 +1,21 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useAsyncEffect } from '../../hooks/useAsyncEffect';
|
|
3
|
+
import { mockLocalStorage } from '../../services/retail/mockLocalStorage';
|
|
1
4
|
import '../../setup-fixture';
|
|
2
5
|
import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
|
|
3
6
|
import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
|
|
4
7
|
import { CreditCardForm } from './CreditCardForm';
|
|
5
8
|
|
|
6
|
-
const MOCK_TOKEN = 'mock-key';
|
|
7
|
-
const MOCK_TASK_ID = '111111';
|
|
8
|
-
|
|
9
|
-
const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
|
|
10
|
-
const accessToken = globalThis.sessionStorage?.getItem('accessToken');
|
|
11
|
-
const taskId = globalThis.localStorage.getItem('taskId');
|
|
12
|
-
|
|
13
|
-
!refreshToken && globalThis.sessionStorage?.setItem('refreshToken', MOCK_TOKEN);
|
|
14
|
-
!accessToken && globalThis.sessionStorage?.setItem('accessToken', MOCK_TOKEN);
|
|
15
|
-
!taskId && globalThis.localStorage.setItem('taskId', MOCK_TASK_ID);
|
|
16
|
-
|
|
17
9
|
export default {
|
|
18
|
-
default: (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
default: JSX(() => {
|
|
11
|
+
useAsyncEffect(async () => await mockLocalStorage(), []);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<CreditCardForm className="col-span-12" />
|
|
16
|
+
<PopupManager />
|
|
17
|
+
<DialogManager />
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}),
|
|
25
21
|
};
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useAsyncEffect } from '../../hooks/useAsyncEffect';
|
|
3
|
+
import { mockLocalStorage } from '../../services/retail/mockLocalStorage';
|
|
1
4
|
import '../../setup-fixture';
|
|
2
5
|
import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
|
|
3
6
|
import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
|
|
4
7
|
import { CreditCardForm } from './CreditCardForm';
|
|
5
8
|
|
|
6
|
-
const MOCK_TOKEN = 'mock-key';
|
|
7
|
-
const MOCK_TASK_ID = '111111';
|
|
8
|
-
|
|
9
|
-
const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
|
|
10
|
-
const accessToken = globalThis.sessionStorage?.getItem('accessToken');
|
|
11
|
-
const taskId = globalThis.localStorage.getItem('taskId');
|
|
12
|
-
|
|
13
|
-
!refreshToken && globalThis.sessionStorage?.setItem('refreshToken', MOCK_TOKEN);
|
|
14
|
-
!accessToken && globalThis.sessionStorage?.setItem('accessToken', MOCK_TOKEN);
|
|
15
|
-
!taskId && globalThis.localStorage.setItem('taskId', MOCK_TASK_ID);
|
|
16
|
-
|
|
17
9
|
export default {
|
|
18
|
-
default: (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
default: JSX(() => {
|
|
11
|
+
useAsyncEffect(async () => await mockLocalStorage(), []);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<CreditCardForm className="col-span-12" />
|
|
16
|
+
<PopupManager />
|
|
17
|
+
<DialogManager />
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}),
|
|
25
21
|
};
|
|
@@ -50,7 +50,10 @@ const renderStatus = (status: STATUS_TYPE, handleExpire: () => void) => {
|
|
|
50
50
|
const statusesMap: Record<STATUS_TYPE, VNode> = {
|
|
51
51
|
IN_PROCESS: <PendingStatusContent handleExpireTimer={handleExpire} />,
|
|
52
52
|
CANCELLED: <FailedStatusContent />,
|
|
53
|
+
FAILED: <FailedStatusContent />,
|
|
54
|
+
DRAFT: <FailedStatusContent />,
|
|
53
55
|
APPROVED: <SuccessStatusContent />,
|
|
56
|
+
PRE_DECISION: <SuccessStatusContent />,
|
|
54
57
|
REVISION: <ReworkStatusContent />,
|
|
55
58
|
};
|
|
56
59
|
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useAsyncEffect } from '../../hooks/useAsyncEffect';
|
|
3
|
+
import { mockLocalStorage } from '../../services/retail/mockLocalStorage';
|
|
1
4
|
import '../../setup-fixture';
|
|
2
5
|
import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
|
|
3
6
|
import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
|
|
4
7
|
import { CreditForm } from './CreditForm';
|
|
5
8
|
|
|
6
|
-
const MOCK_TOKEN = 'mock-key';
|
|
7
|
-
const MOCK_TASK_ID = '111111';
|
|
8
|
-
|
|
9
|
-
const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
|
|
10
|
-
const accessToken = globalThis.sessionStorage?.getItem('accessToken');
|
|
11
|
-
const taskId = globalThis.localStorage.getItem('taskId');
|
|
12
|
-
|
|
13
|
-
!refreshToken && globalThis.sessionStorage?.setItem('refreshToken', MOCK_TOKEN);
|
|
14
|
-
!accessToken && globalThis.sessionStorage?.setItem('accessToken', MOCK_TOKEN);
|
|
15
|
-
!taskId && globalThis.localStorage.setItem('taskId', MOCK_TASK_ID);
|
|
16
|
-
|
|
17
9
|
export default {
|
|
18
|
-
default: (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
default: JSX(() => {
|
|
11
|
+
useAsyncEffect(async () => await mockLocalStorage(), []);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<CreditForm
|
|
16
|
+
className="col-span-12"
|
|
17
|
+
programsSource={{
|
|
18
|
+
$ref: '/wcms-resources/products-credit-calc-data.json',
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
<PopupManager />
|
|
22
|
+
<DialogManager />
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}),
|
|
30
26
|
};
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useAsyncEffect } from '../../hooks/useAsyncEffect';
|
|
3
|
+
import { mockLocalStorage } from '../../services/retail/mockLocalStorage';
|
|
1
4
|
import '../../setup-fixture';
|
|
2
5
|
import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
|
|
3
6
|
import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
|
|
4
7
|
import { CreditForm } from './CreditForm';
|
|
5
8
|
|
|
6
|
-
const MOCK_TOKEN = 'mock-key';
|
|
7
|
-
const MOCK_TASK_ID = '111111';
|
|
8
|
-
|
|
9
|
-
const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
|
|
10
|
-
const accessToken = globalThis.sessionStorage?.getItem('accessToken');
|
|
11
|
-
const taskId = globalThis.localStorage.getItem('taskId');
|
|
12
|
-
|
|
13
|
-
!refreshToken && globalThis.sessionStorage?.setItem('refreshToken', MOCK_TOKEN);
|
|
14
|
-
!accessToken && globalThis.sessionStorage?.setItem('accessToken', MOCK_TOKEN);
|
|
15
|
-
!taskId && globalThis.localStorage.setItem('taskId', MOCK_TASK_ID);
|
|
16
|
-
|
|
17
9
|
export default {
|
|
18
|
-
default: (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
default: JSX(() => {
|
|
11
|
+
useAsyncEffect(async () => await mockLocalStorage(), []);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<CreditForm
|
|
16
|
+
className="col-span-12"
|
|
17
|
+
programsSource={{
|
|
18
|
+
$ref: '/wcms-resources/products-credit-calc-data.json',
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
<PopupManager />
|
|
22
|
+
<DialogManager />
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}),
|
|
30
26
|
};
|
|
@@ -49,7 +49,10 @@ const renderStatus = (status: STATUS_TYPE, handleExpire: () => void) => {
|
|
|
49
49
|
const statusesMap: Record<STATUS_TYPE, VNode> = {
|
|
50
50
|
IN_PROCESS: <PendingStatusContent handleExpireTimer={handleExpire} />,
|
|
51
51
|
CANCELLED: <FailedStatusContent />,
|
|
52
|
+
FAILED: <FailedStatusContent />,
|
|
53
|
+
DRAFT: <FailedStatusContent />,
|
|
52
54
|
APPROVED: <SuccessStatusContent />,
|
|
55
|
+
PRE_DECISION: <SuccessStatusContent />,
|
|
53
56
|
REVISION: <ReworkStatusContent />,
|
|
54
57
|
};
|
|
55
58
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
|
|
3
|
+
export function useAsyncEffect<Deps extends any[], R>(
|
|
4
|
+
effect: () => Promise<R | (() => void)>,
|
|
5
|
+
deps: Deps,
|
|
6
|
+
): void {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const free = effect();
|
|
9
|
+
|
|
10
|
+
return () => {
|
|
11
|
+
free.then((_) => {
|
|
12
|
+
_ instanceof Function && _();
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
}, deps);
|
|
16
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { checkCode } from '../../api/RetailAPI/checkCode';
|
|
2
|
+
import { createDraftTask } from '../../api/RetailAPI/createDraftTask';
|
|
3
|
+
import { createUserProfile } from '../../api/RetailAPI/createUserProfile';
|
|
4
|
+
import { sendCode } from '../../api/RetailAPI/sendCode';
|
|
5
|
+
|
|
6
|
+
const PHONE = '+11111111111';
|
|
7
|
+
const PROGRAM_ID = '13';
|
|
8
|
+
|
|
9
|
+
export const mockLocalStorage = async () => {
|
|
10
|
+
const programId = globalThis.localStorage.getItem('programId') ?? PROGRAM_ID;
|
|
11
|
+
|
|
12
|
+
const profileId =
|
|
13
|
+
globalThis.localStorage.getItem('profileId') ??
|
|
14
|
+
(await createUserProfile({ profile: { phone: PHONE } }));
|
|
15
|
+
|
|
16
|
+
await sendCode({
|
|
17
|
+
phoneNumber: PHONE,
|
|
18
|
+
smsCodesSetName: { key: 'AUTHENTICATION' },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
await checkCode({
|
|
22
|
+
smsCodesSetName: { key: 'AUTHENTICATION' },
|
|
23
|
+
smsText: '1234',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const task = {
|
|
27
|
+
taskId: globalThis.localStorage.getItem('taskId'),
|
|
28
|
+
participantId: globalThis.localStorage.getItem('participantId'),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
if (!task.taskId || !task.participantId) {
|
|
32
|
+
const draft = await createDraftTask({ profileId: Number(profileId), programId });
|
|
33
|
+
Object.assign(task, draft);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
globalThis.localStorage.setItem('programId', programId);
|
|
37
|
+
globalThis.localStorage.setItem('profileId', String(profileId));
|
|
38
|
+
globalThis.localStorage.setItem('taskId', String(task.taskId));
|
|
39
|
+
globalThis.localStorage.setItem('participantId', String(task.participantId));
|
|
40
|
+
};
|
package/src/setup-fixture.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import '@redneckz/uni-jsx/lib/setup.react';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { handlerDecorator } from './external/handlerDecorator';
|
|
4
|
+
import { locationNavigator } from './external/locationNavigator';
|
|
4
5
|
import { useRouter } from './external/useRouter';
|
|
5
6
|
import { projectSettings } from './ProjectSettings';
|
|
7
|
+
import { noop } from './utils/noop';
|
|
6
8
|
import { joinPath } from './utils/url';
|
|
7
9
|
import wlc from './wlc.json';
|
|
8
10
|
|
|
@@ -49,3 +51,13 @@ handlerDecorator.setup((handler): any => (ev) => {
|
|
|
49
51
|
|
|
50
52
|
handler(ev);
|
|
51
53
|
});
|
|
54
|
+
|
|
55
|
+
locationNavigator.setup(() => ({
|
|
56
|
+
assign: noop,
|
|
57
|
+
get href() {
|
|
58
|
+
return globalThis.location.href;
|
|
59
|
+
},
|
|
60
|
+
get origin() {
|
|
61
|
+
return globalThis.location.origin;
|
|
62
|
+
},
|
|
63
|
+
}));
|