@saasquatch/mint-components 1.3.2-12 → 1.3.2-13
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/dist/cjs/sqm-divided-layout_30.cjs.entry.js +348 -430
- package/dist/collection/components/sqm-portal-register/sqm-portal-register.js +1 -1
- package/dist/collection/components/sqm-reward-exchange-list/RewardExchangeListData.js +2 -2
- package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.js +30 -30
- package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list.js +4 -7
- package/dist/collection/components/sqm-reward-exchange-list/useRewardExchangeList.js +7 -31
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +0 -2
- package/dist/collection/components/sqm-task-card/TaskCard.stories.js +167 -222
- package/dist/collection/components/sqm-task-card/progress-bar/progress-bar-view.js +12 -5
- package/dist/collection/components/sqm-task-card/sqm-task-card-view.js +82 -50
- package/dist/collection/components/sqm-task-card/sqm-task-card.js +10 -2
- package/dist/esm/sqm-divided-layout_30.entry.js +348 -430
- package/dist/esm-es5/sqm-divided-layout_30.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-16f5a7cb.system.js +1 -1
- package/dist/mint-components/{p-d2e71fe0.entry.js → p-3f7218fb.entry.js} +10 -10
- package/dist/mint-components/p-b6b4022a.system.entry.js +1 -0
- package/dist/types/components/sqm-reward-exchange-list/RewardExchangeListData.d.ts +2 -2
- package/dist/types/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.d.ts +2 -2
- package/dist/types/components/sqm-task-card/TaskCard.stories.d.ts +9 -4
- package/dist/types/components/sqm-task-card/progress-bar/progress-bar-view.d.ts +1 -0
- package/dist/types/components/sqm-task-card/sqm-task-card-view.d.ts +1 -1
- package/dist/types/components/sqm-task-card/sqm-task-card.d.ts +2 -1
- package/dist/types/components.d.ts +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/collection/components/sqm-task-card/progress-bar/progress-bar.stories.js +0 -53
- package/dist/mint-components/p-b47179b8.system.entry.js +0 -1
- package/dist/types/components/sqm-task-card/progress-bar/progress-bar.stories.d.ts +0 -12
|
@@ -287,7 +287,7 @@ export class PortalRegister {
|
|
|
287
287
|
"mutable": false,
|
|
288
288
|
"complexType": {
|
|
289
289
|
"original": "DemoData<PortalRegisterViewProps>",
|
|
290
|
-
"resolved": "{ states?: { error: string; loading: boolean; confirmPassword: boolean; hideInputs: boolean; validationState?: FormState; enablePasswordValidation?: boolean; };
|
|
290
|
+
"resolved": "{ states?: { error: string; loading: boolean; confirmPassword: boolean; hideInputs: boolean; validationState?: FormState; enablePasswordValidation?: boolean; }; content?: { formData?: any; passwordField?: any; secondaryButton?: any; emailLabel?: string; passwordLabel?: string; submitLabel?: string; pageLabel?: string; confirmPasswordLabel: string; }; refs?: { formRef: any; }; }",
|
|
291
291
|
"references": {
|
|
292
292
|
"DemoData": {
|
|
293
293
|
"location": "import",
|
|
@@ -13,7 +13,7 @@ const baseResponse = (data) => ({
|
|
|
13
13
|
},
|
|
14
14
|
callbacks: {
|
|
15
15
|
exchangeReward: null,
|
|
16
|
-
|
|
16
|
+
resetState: null,
|
|
17
17
|
setStage: null,
|
|
18
18
|
setExchangeState: null,
|
|
19
19
|
refs: null,
|
|
@@ -207,7 +207,7 @@ export const test2 = {
|
|
|
207
207
|
},
|
|
208
208
|
callbacks: {
|
|
209
209
|
exchangeReward: null,
|
|
210
|
-
|
|
210
|
+
resetState: null,
|
|
211
211
|
setStage: null,
|
|
212
212
|
setExchangeState: null,
|
|
213
213
|
refs: {
|
package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getAssetPath, h } from "@stencil/core";
|
|
|
2
2
|
import jss from "jss";
|
|
3
3
|
import preset from "jss-preset-default";
|
|
4
4
|
import { ProgressBar } from "./progressBar";
|
|
5
|
-
import {
|
|
5
|
+
import { ExchangeArrows, CheckMark } from "./SVGs";
|
|
6
6
|
const stageList = ["chooseReward", "chooseAmount", "confirmation", "success"];
|
|
7
7
|
const stageProgressList = {
|
|
8
8
|
chooseReward: "Choose reward",
|
|
@@ -113,7 +113,7 @@ export function RewardExchangeView(props) {
|
|
|
113
113
|
flexWrap: "wrap",
|
|
114
114
|
margin: "var(--sl-spacing-medium) 0",
|
|
115
115
|
"& .cancel": {
|
|
116
|
-
width: "
|
|
116
|
+
width: "20%",
|
|
117
117
|
marginLeft: "auto",
|
|
118
118
|
marginRight: "var(--sl-spacing-medium)",
|
|
119
119
|
"&::part(base)": {
|
|
@@ -122,7 +122,7 @@ export function RewardExchangeView(props) {
|
|
|
122
122
|
},
|
|
123
123
|
},
|
|
124
124
|
"& .continue": {
|
|
125
|
-
width: "
|
|
125
|
+
width: "20%",
|
|
126
126
|
"&::part(base)": {
|
|
127
127
|
background: "var(--sl-color-neutral-500)",
|
|
128
128
|
fontWeight: "var(--sl-font-weight-normal)",
|
|
@@ -135,7 +135,7 @@ export function RewardExchangeView(props) {
|
|
|
135
135
|
jss.setup(preset());
|
|
136
136
|
const sheet = jss.createStyleSheet(style);
|
|
137
137
|
const styleString = sheet.toString();
|
|
138
|
-
const { states, data, callbacks
|
|
138
|
+
const { states, data, callbacks } = props;
|
|
139
139
|
const { selectedItem, selectedStep } = states;
|
|
140
140
|
function getInput() {
|
|
141
141
|
var _a, _b;
|
|
@@ -162,8 +162,6 @@ export function RewardExchangeView(props) {
|
|
|
162
162
|
}
|
|
163
163
|
function chooseReward() {
|
|
164
164
|
var _a;
|
|
165
|
-
const nextStage = "chooseAmount";
|
|
166
|
-
// console.log({ nextStage, ruleType: selectedItem?.ruleType });
|
|
167
165
|
return [
|
|
168
166
|
h("div", { style: {
|
|
169
167
|
display: "grid",
|
|
@@ -219,7 +217,8 @@ export function RewardExchangeView(props) {
|
|
|
219
217
|
: item.unavailableReasonCode))))));
|
|
220
218
|
})),
|
|
221
219
|
h("div", { class: sheet.classes.KutayButton },
|
|
222
|
-
h("sl-button", { class: "
|
|
220
|
+
h("sl-button", { class: "cancel", size: "large", type: "text" }, "Cancel"),
|
|
221
|
+
h("sl-button", { class: "continue", size: "large", onClick: () => callbacks.setStage("chooseAmount"), disabled: !states.selectedItem }, "Continue")),
|
|
223
222
|
];
|
|
224
223
|
}
|
|
225
224
|
function chooseAmount() {
|
|
@@ -229,13 +228,10 @@ export function RewardExchangeView(props) {
|
|
|
229
228
|
h("p", null, selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.description),
|
|
230
229
|
h("div", { class: sheet.classes.InputBox }, input),
|
|
231
230
|
h("div", { class: sheet.classes.KutayButton },
|
|
232
|
-
h("sl-button", { class: "cancel", size: "large", type: "text", onClick: () => callbacks.
|
|
233
|
-
h("sl-button", { class: "continue", size: "large", onClick: () => callbacks.setStage("confirmation"), disabled: states.
|
|
234
|
-
(input && !states.amount) }, "Continue to confirmation"))));
|
|
231
|
+
h("sl-button", { class: "cancel", size: "large", type: "text", onClick: () => callbacks.resetState() }, "Cancel"),
|
|
232
|
+
h("sl-button", { class: "continue", size: "large", onClick: () => callbacks.setStage("confirmation"), disabled: input && !states.amount }, "Continue to confirmation"))));
|
|
235
233
|
}
|
|
236
|
-
// console.log({ selectedItem, selectedStep });
|
|
237
234
|
function confirmation() {
|
|
238
|
-
const previousStage = "chooseAmount";
|
|
239
235
|
return (h("div", null,
|
|
240
236
|
h("h2", null, "Confirm and redeem"),
|
|
241
237
|
h("div", { style: { textAlign: "center" } },
|
|
@@ -255,13 +251,14 @@ export function RewardExchangeView(props) {
|
|
|
255
251
|
h("p", { style: { marginBottom: "0", flex: "1" } }, selectedStep === null || selectedStep === void 0 ? void 0 : selectedStep.prettyDestinationValue)))),
|
|
256
252
|
h("div", { class: sheet.classes.Buttons },
|
|
257
253
|
h("sl-button", { onClick: callbacks.exchangeReward, style: { display: "block" }, class: sheet.classes.Button }, "Redeem"),
|
|
258
|
-
h("a", { onClick: () => callbacks.setStage(
|
|
254
|
+
h("a", { onClick: () => callbacks.setStage("chooseAmount"), style: { display: "block" }, class: sheet.classes.Button }, "Back"))));
|
|
259
255
|
}
|
|
260
256
|
function success() {
|
|
261
257
|
return (h("div", { style: { textAlign: "center" } },
|
|
262
258
|
h("img", { class: sheet.classes.FullImage, src: getAssetPath("./assets/Reward-icon.png") }),
|
|
263
259
|
h("p", { style: { color: "forestgreen" } }, "Reward Redeemed"),
|
|
264
|
-
(data === null || data === void 0 ? void 0 : data.fuelTankCode) && h("pre", null, data === null || data === void 0 ? void 0 : data.fuelTankCode)
|
|
260
|
+
(data === null || data === void 0 ? void 0 : data.fuelTankCode) && h("pre", null, data === null || data === void 0 ? void 0 : data.fuelTankCode),
|
|
261
|
+
h("sl-button", { onClick: () => callbacks.resetState(true) }, "Done")));
|
|
265
262
|
}
|
|
266
263
|
const stages = {
|
|
267
264
|
chooseReward: () => chooseReward(),
|
|
@@ -283,22 +280,25 @@ export function RewardExchangeView(props) {
|
|
|
283
280
|
})),
|
|
284
281
|
h(ProgressBar, { stageCount: 3, currentStage: stageNumber })));
|
|
285
282
|
}
|
|
286
|
-
const BackButton = () => {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
283
|
+
// const BackButton = () => {
|
|
284
|
+
// if (states.redeemStage === "success") return "";
|
|
285
|
+
// let previousStage: Stages = "";
|
|
286
|
+
// if (states.redeemStage === "confirmation") {
|
|
287
|
+
// previousStage = "chooseAmount";
|
|
288
|
+
// } else if (states.redeemStage === "chooseAmount") {
|
|
289
|
+
// previousStage = "chooseReward";
|
|
290
|
+
// }
|
|
291
|
+
// return (
|
|
292
|
+
// <div slot="label">
|
|
293
|
+
// <a
|
|
294
|
+
// style={{ cursor: "pointer", fontSize: "80%", color: "#858585" }}
|
|
295
|
+
// onClick={() => callbacks.setStage(previousStage)}
|
|
296
|
+
// >
|
|
297
|
+
// <LeftArrow /> Back
|
|
298
|
+
// </a>
|
|
299
|
+
// </div>
|
|
300
|
+
// );
|
|
301
|
+
// };
|
|
302
302
|
return (h("div", { class: sheet.classes.Container },
|
|
303
303
|
h("style", { type: "text/css" }, styleString),
|
|
304
304
|
h("div", null,
|
|
@@ -28,11 +28,11 @@ export class SqmRewardExchangeList {
|
|
|
28
28
|
// if (missingProps) {
|
|
29
29
|
// return <RequiredPropsError missingProps={missingProps} />;
|
|
30
30
|
// }
|
|
31
|
-
const { states, data, callbacks
|
|
31
|
+
const { states, data, callbacks } = isDemo()
|
|
32
32
|
? useRewardExchangeListDemo(getProps(this))
|
|
33
33
|
: useRewardExchangeList(getProps(this));
|
|
34
34
|
return (h(Host, { style: { display: "contents" } },
|
|
35
|
-
h(RewardExchangeView, { states: states, data: data, callbacks: callbacks
|
|
35
|
+
h(RewardExchangeView, { states: states, data: data, callbacks: callbacks })));
|
|
36
36
|
}
|
|
37
37
|
static get is() { return "sqm-reward-exchange-list"; }
|
|
38
38
|
static get assetsDirs() { return ["assets"]; }
|
|
@@ -63,7 +63,7 @@ export class SqmRewardExchangeList {
|
|
|
63
63
|
"mutable": false,
|
|
64
64
|
"complexType": {
|
|
65
65
|
"original": "DemoData<RewardExchangeViewProps>",
|
|
66
|
-
"resolved": "{ states?: { selectedItem: ExchangeItem; selectedStep: ExchangeStep; redeemStage: string; amount: number; exchangeError?: boolean; loading: boolean; content: { text: any; }; }; data?: { exchangeList: any;
|
|
66
|
+
"resolved": "{ states?: { selectedItem: ExchangeItem; selectedStep: ExchangeStep; redeemStage: string; amount: number; exchangeError?: boolean; loading: boolean; content: { text: any; }; }; data?: { exchangeList: any; fuelTankCode?: string; }; }",
|
|
67
67
|
"references": {
|
|
68
68
|
"DemoData": {
|
|
69
69
|
"location": "import",
|
|
@@ -110,12 +110,9 @@ function useRewardExchangeListDemo(props) {
|
|
|
110
110
|
},
|
|
111
111
|
callbacks: {
|
|
112
112
|
exchangeReward: () => { },
|
|
113
|
-
openDrawer: () => { },
|
|
114
113
|
setExchangeState: (_) => { },
|
|
115
114
|
setStage: (_) => { },
|
|
116
|
-
|
|
117
|
-
refs: {
|
|
118
|
-
drawerRef: {},
|
|
115
|
+
resetState: () => { }
|
|
119
116
|
},
|
|
120
117
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
121
118
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useUserIdentity, useQuery, useMutation, } from "@saasquatch/component-boilerplate";
|
|
2
2
|
import { gql } from "graphql-request";
|
|
3
|
-
import {
|
|
3
|
+
import { useEffect, useReducer, } from "@saasquatch/universal-hooks";
|
|
4
4
|
const GET_EXCHANGE_LIST = gql `
|
|
5
5
|
query getExchangeList {
|
|
6
6
|
viewer {
|
|
@@ -55,7 +55,6 @@ const EXCHANGE = gql `
|
|
|
55
55
|
`;
|
|
56
56
|
export function useRewardExchangeList(props) {
|
|
57
57
|
var _a, _b, _c, _d;
|
|
58
|
-
const drawerRef = useRef();
|
|
59
58
|
const [exchangeState, setExchangeState] = useReducer((state, next) => ({
|
|
60
59
|
...state,
|
|
61
60
|
...next,
|
|
@@ -69,22 +68,16 @@ export function useRewardExchangeList(props) {
|
|
|
69
68
|
const { selectedItem, selectedStep, redeemStage, amount, exchangeError } = exchangeState;
|
|
70
69
|
const user = useUserIdentity();
|
|
71
70
|
const [exchange, { data: exchangeResponse, errors }] = useMutation(EXCHANGE);
|
|
72
|
-
const { data, loading } = useQuery(GET_EXCHANGE_LIST, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
71
|
+
const { data, loading, refetch } = useQuery(GET_EXCHANGE_LIST, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
73
72
|
useEffect(() => {
|
|
74
73
|
var _a, _b;
|
|
75
74
|
if ((_b = (_a = exchangeResponse === null || exchangeResponse === void 0 ? void 0 : exchangeResponse.exchangeReward) === null || _a === void 0 ? void 0 : _a.reward) === null || _b === void 0 ? void 0 : _b.id) {
|
|
76
75
|
setExchangeState({ redeemStage: "success" });
|
|
77
76
|
}
|
|
78
77
|
if (!!errors) {
|
|
79
|
-
console.log("YEA");
|
|
80
78
|
setExchangeState({ exchangeError: true });
|
|
81
79
|
}
|
|
82
80
|
}, [exchangeResponse, errors]);
|
|
83
|
-
function openDrawer() {
|
|
84
|
-
var _a;
|
|
85
|
-
setExchangeState({ redeemStage: "chooseReward" });
|
|
86
|
-
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.show();
|
|
87
|
-
}
|
|
88
81
|
function exchangeReward() {
|
|
89
82
|
if (!selectedItem)
|
|
90
83
|
return;
|
|
@@ -142,29 +135,16 @@ export function useRewardExchangeList(props) {
|
|
|
142
135
|
}
|
|
143
136
|
exchange({ exchangeRewardInput: exchangeVariables });
|
|
144
137
|
}
|
|
145
|
-
const resetState =
|
|
146
|
-
|
|
147
|
-
// selects also trigger an sl-hide event :(
|
|
148
|
-
//@ts-ignore - componentId is not private here
|
|
149
|
-
if (((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.componentId) !== ((_b = drawerRef.current) === null || _b === void 0 ? void 0 : _b.componentId))
|
|
150
|
-
return;
|
|
138
|
+
const resetState = (refresh) => {
|
|
139
|
+
refresh && refetch();
|
|
151
140
|
setExchangeState({
|
|
152
141
|
amount: 0,
|
|
153
142
|
selectedStep: undefined,
|
|
154
143
|
selectedItem: undefined,
|
|
155
144
|
exchangeError: false,
|
|
145
|
+
redeemStage: "chooseReward",
|
|
156
146
|
});
|
|
157
|
-
}
|
|
158
|
-
useEffect(() => {
|
|
159
|
-
if (!(drawerRef === null || drawerRef === void 0 ? void 0 : drawerRef.current))
|
|
160
|
-
return;
|
|
161
|
-
const drawer = drawerRef.current;
|
|
162
|
-
// Clear input value when drawer is closed
|
|
163
|
-
drawer.addEventListener("sl-hide", resetState);
|
|
164
|
-
return () => {
|
|
165
|
-
drawer.removeEventListener("sl-hide", resetState);
|
|
166
|
-
};
|
|
167
|
-
}, [drawerRef.current]);
|
|
147
|
+
};
|
|
168
148
|
function setStage(stage) {
|
|
169
149
|
setExchangeState({ redeemStage: stage });
|
|
170
150
|
}
|
|
@@ -182,17 +162,13 @@ export function useRewardExchangeList(props) {
|
|
|
182
162
|
},
|
|
183
163
|
data: {
|
|
184
164
|
exchangeList: (_b = (_a = data === null || data === void 0 ? void 0 : data.viewer) === null || _a === void 0 ? void 0 : _a.visibleRewardExchangeItems) === null || _b === void 0 ? void 0 : _b.data,
|
|
185
|
-
//@ts-ignore
|
|
186
165
|
fuelTankCode: (_d = (_c = exchangeResponse === null || exchangeResponse === void 0 ? void 0 : exchangeResponse.exchangeReward) === null || _c === void 0 ? void 0 : _c.reward) === null || _d === void 0 ? void 0 : _d.fuelTankCode,
|
|
187
166
|
},
|
|
188
167
|
callbacks: {
|
|
189
168
|
exchangeReward,
|
|
190
|
-
openDrawer,
|
|
191
169
|
setExchangeState,
|
|
192
170
|
setStage,
|
|
193
|
-
|
|
194
|
-
refs: {
|
|
195
|
-
drawerRef,
|
|
171
|
+
resetState,
|
|
196
172
|
},
|
|
197
173
|
};
|
|
198
174
|
}
|
|
@@ -37,7 +37,6 @@ import * as ReferralTableRewardsCell from "../sqm-referral-table/ReferralTableRe
|
|
|
37
37
|
import * as UserName from "../sqm-user-name/UserName.stories";
|
|
38
38
|
import * as PasswordField from "../sqm-password-field/PasswordField.stories";
|
|
39
39
|
import * as TaskCard from "../sqm-task-card/TaskCard.stories";
|
|
40
|
-
import * as TaskCardProgressBar from "../sqm-task-card/progress-bar/progress-bar.stories";
|
|
41
40
|
import * as PortalTemplates from "../../stories/PortalTemplates.stories";
|
|
42
41
|
import * as ProgramMenu from "../sqm-program-menu/ProgramMenu.stories";
|
|
43
42
|
import * as PoweredByImg from "../../stories/PoweredByImg.stories";
|
|
@@ -83,7 +82,6 @@ const stories = [
|
|
|
83
82
|
UserName,
|
|
84
83
|
PasswordField,
|
|
85
84
|
TaskCard,
|
|
86
|
-
TaskCardProgressBar,
|
|
87
85
|
PortalTemplates,
|
|
88
86
|
ProgramMenu,
|
|
89
87
|
PoweredByImg,
|