@saasquatch/mint-components 1.5.0-1 → 1.5.0-5
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/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/{sqm-divided-layout_30.cjs.entry.js → sqm-brand_31.cjs.entry.js} +27105 -26694
- package/dist/cjs/sqm-program-explainer-step-view-6a01cda0.js +70 -0
- package/dist/cjs/sqm-program-explainer-step.cjs.entry.js +22 -0
- package/dist/cjs/sqm-program-explainer-view-8a4af972.js +45 -0
- package/dist/cjs/sqm-program-explainer.cjs.entry.js +23 -0
- package/dist/cjs/sqm-share-code.cjs.entry.js +19 -0
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/sqm-brand/SqmBrand.stories.js +93 -0
- package/dist/collection/components/sqm-brand/sqm-brand.js +97 -0
- package/dist/collection/components/sqm-program-explainer/ProgramExplainer.stories.js +49 -0
- package/dist/collection/components/sqm-program-explainer/sqm-program-explainer-view.js +41 -0
- package/dist/collection/components/sqm-program-explainer/sqm-program-explainer.js +131 -0
- package/dist/collection/components/sqm-program-explainer-step/ProgramExplainerStep.stories.js +22 -0
- package/dist/collection/components/sqm-program-explainer-step/sqm-program-explainer-step-view.js +66 -0
- package/dist/collection/components/sqm-program-explainer-step/sqm-program-explainer-step.js +123 -0
- package/dist/collection/components/sqm-reward-exchange-list/RewardExchangeList.stories.js +5 -3
- package/dist/collection/components/sqm-reward-exchange-list/RewardExchangeListData.js +38 -19
- package/dist/collection/components/sqm-reward-exchange-list/SVGs.js +3 -0
- package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.js +141 -103
- package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list.js +349 -3
- package/dist/collection/components/sqm-reward-exchange-list/useRewardExchangeList.js +20 -13
- package/dist/collection/components/sqm-rewards-table/useRewardsTable.js +0 -1
- package/dist/collection/components/sqm-share-code/useShareCode.js +20 -1
- package/dist/collection/components/sqm-share-link/useShareLink.js +20 -1
- package/dist/collection/components/sqm-stencilbook/AutoColor.js +32 -4
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +6 -0
- package/dist/collection/components/sqm-task-card/TaskCard.stories.js +15 -3
- package/dist/collection/components/sqm-task-card/sqm-task-card.js +5 -6
- package/dist/collection/fonts/GoogleFonts.js +12 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/{sqm-divided-layout_30.entry.js → sqm-brand_31.entry.js} +27080 -26670
- package/dist/esm/sqm-program-explainer-step-view-41c1eecd.js +68 -0
- package/dist/esm/sqm-program-explainer-step.entry.js +18 -0
- package/dist/esm/sqm-program-explainer-view-098a64a9.js +43 -0
- package/dist/esm/sqm-program-explainer.entry.js +19 -0
- package/dist/esm/sqm-share-code.entry.js +20 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-brand_31.entry.js +58 -0
- package/dist/esm-es5/sqm-program-explainer-step-view-41c1eecd.js +1 -0
- package/dist/esm-es5/sqm-program-explainer-step.entry.js +1 -0
- package/dist/esm-es5/sqm-program-explainer-view-098a64a9.js +1 -0
- package/dist/esm-es5/sqm-program-explainer.entry.js +1 -0
- package/dist/esm-es5/sqm-share-code.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-10103ce2.system.js +1 -0
- package/dist/mint-components/p-1b5b5928.system.js +1 -0
- package/dist/mint-components/p-21df3f85.system.entry.js +1 -0
- package/dist/mint-components/p-29ee7d11.system.entry.js +1 -0
- package/dist/mint-components/p-748ad4f5.entry.js +1 -0
- package/dist/mint-components/p-760762d3.entry.js +13 -0
- package/dist/mint-components/p-7cec5098.entry.js +398 -0
- package/dist/mint-components/p-81786aa0.js +1 -0
- package/dist/mint-components/p-8ec5127e.system.entry.js +1 -0
- package/dist/mint-components/p-a4bd0778.system.entry.js +58 -0
- package/dist/mint-components/p-a88a08bb.system.js +1 -1
- package/dist/mint-components/p-ee684b5f.js +1 -0
- package/dist/mint-components/p-f5cfc52a.entry.js +1 -0
- package/dist/types/components/sqm-brand/SqmBrand.stories.d.ts +7 -0
- package/dist/types/components/sqm-brand/sqm-brand.d.ts +23 -0
- package/dist/types/components/sqm-program-explainer/ProgramExplainer.stories.d.ts +7 -0
- package/dist/types/components/sqm-program-explainer/sqm-program-explainer-view.d.ts +9 -0
- package/dist/types/components/sqm-program-explainer/sqm-program-explainer.d.ts +31 -0
- package/dist/types/components/sqm-program-explainer-step/ProgramExplainerStep.stories.d.ts +5 -0
- package/dist/types/components/sqm-program-explainer-step/sqm-program-explainer-step-view.d.ts +8 -0
- package/dist/types/components/sqm-program-explainer-step/sqm-program-explainer-step.d.ts +29 -0
- package/dist/types/components/sqm-reward-exchange-list/RewardExchangeList.stories.d.ts +2 -0
- package/dist/types/components/sqm-reward-exchange-list/RewardExchangeListData.d.ts +85 -0
- package/dist/types/components/sqm-reward-exchange-list/SVGs.d.ts +1 -0
- package/dist/types/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.d.ts +3 -0
- package/dist/types/components/sqm-reward-exchange-list/sqm-reward-exchange-list.d.ts +53 -0
- package/dist/types/components/sqm-reward-exchange-list/useRewardExchangeList.d.ts +16 -0
- package/dist/types/components/sqm-stencilbook/AutoColor.d.ts +15 -0
- package/dist/types/components/sqm-task-card/TaskCard.stories.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 +1 -1
- package/dist/types/components.d.ts +253 -2
- package/dist/types/fonts/GoogleFonts.d.ts +9 -0
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/sqm-divided-layout_30.entry.js +0 -58
- package/dist/mint-components/p-0029a386.system.entry.js +0 -1
- package/dist/mint-components/p-03a6becf.entry.js +0 -9
- package/dist/mint-components/p-58ffe936.system.entry.js +0 -58
- package/dist/mint-components/p-88d9bd59.entry.js +0 -393
- package/dist/types/global/android.d.ts +0 -7
- package/dist/types/global/demo.d.ts +0 -1
- package/dist/types/stories/features.d.ts +0 -4
- package/dist/types/stories/templates.d.ts +0 -4
package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.js
CHANGED
|
@@ -4,15 +4,17 @@ import preset from "jss-preset-default";
|
|
|
4
4
|
import { intl } from "../../global/global";
|
|
5
5
|
import { HostBlock } from "../../global/mixins";
|
|
6
6
|
import { ProgressBar } from "./progressBar";
|
|
7
|
-
import {
|
|
7
|
+
import { ShareLinkView } from "../sqm-share-link/sqm-share-link-view";
|
|
8
|
+
import { ExchangeArrows, Gift, CheckmarkFilled, } from "./SVGs";
|
|
8
9
|
const stageList = ["chooseReward", "chooseAmount", "confirmation", "success"];
|
|
9
|
-
const stageProgressList = {
|
|
10
|
-
chooseReward: "Choose reward",
|
|
11
|
-
chooseAmount: "Amount",
|
|
12
|
-
confirmation: "Confirm",
|
|
13
|
-
};
|
|
14
10
|
export function RewardExchangeView(props) {
|
|
15
|
-
|
|
11
|
+
const { states, data, callbacks } = props;
|
|
12
|
+
const { selectedItem, selectedStep } = states;
|
|
13
|
+
const stageProgressList = {
|
|
14
|
+
chooseReward: states.content.text.chooseRewardTitle,
|
|
15
|
+
chooseAmount: states.content.text.chooseAmountTitle,
|
|
16
|
+
confirmation: states.content.text.confirmationTitle,
|
|
17
|
+
};
|
|
16
18
|
const style = {
|
|
17
19
|
HostBlock: HostBlock,
|
|
18
20
|
Container: {
|
|
@@ -72,24 +74,10 @@ export function RewardExchangeView(props) {
|
|
|
72
74
|
marginBottom: "20px",
|
|
73
75
|
},
|
|
74
76
|
Select: {
|
|
75
|
-
"&::part(
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
"&::part(menu)": {
|
|
79
|
-
maxHeight: "40vh",
|
|
77
|
+
"&::part(label)": {
|
|
78
|
+
color: "var(--sl-color-primary-500)",
|
|
80
79
|
},
|
|
81
80
|
},
|
|
82
|
-
Buttons: {
|
|
83
|
-
marginLeft: "auto",
|
|
84
|
-
width: "100%",
|
|
85
|
-
maxWidth: "300px",
|
|
86
|
-
},
|
|
87
|
-
Button: {
|
|
88
|
-
margin: "10px 0",
|
|
89
|
-
display: "block",
|
|
90
|
-
textAlign: "center",
|
|
91
|
-
cursor: "pointer",
|
|
92
|
-
},
|
|
93
81
|
ProgressBar: {
|
|
94
82
|
maxWidth: "350px",
|
|
95
83
|
width: "100%",
|
|
@@ -111,7 +99,13 @@ export function RewardExchangeView(props) {
|
|
|
111
99
|
},
|
|
112
100
|
},
|
|
113
101
|
},
|
|
114
|
-
|
|
102
|
+
CardLayout: {
|
|
103
|
+
display: "flex",
|
|
104
|
+
width: "100%",
|
|
105
|
+
borderRadius: "3px",
|
|
106
|
+
background: "rgba(0, 0, 0, 0)",
|
|
107
|
+
},
|
|
108
|
+
Card: {
|
|
115
109
|
display: "flex",
|
|
116
110
|
userSelect: "none",
|
|
117
111
|
height: "120px",
|
|
@@ -123,21 +117,12 @@ export function RewardExchangeView(props) {
|
|
|
123
117
|
display: "flex",
|
|
124
118
|
padding: 0,
|
|
125
119
|
},
|
|
126
|
-
"& .selected
|
|
127
|
-
width: "18px",
|
|
128
|
-
height: "18px",
|
|
129
|
-
minWidth: "18px",
|
|
130
|
-
borderRadius: "50%",
|
|
131
|
-
background: "var(--sl-color-primary-500)",
|
|
120
|
+
"& .selected": {
|
|
132
121
|
position: "relative",
|
|
133
|
-
|
|
122
|
+
top: "-2%",
|
|
134
123
|
left: "100%",
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
position: "relative",
|
|
138
|
-
left: "12%",
|
|
139
|
-
top: "-29%",
|
|
140
|
-
transform: "scale(0.8)",
|
|
124
|
+
color: "var(--sl-color-primary-500)",
|
|
125
|
+
margin: "-9px",
|
|
141
126
|
},
|
|
142
127
|
},
|
|
143
128
|
Square: {
|
|
@@ -156,14 +141,18 @@ export function RewardExchangeView(props) {
|
|
|
156
141
|
},
|
|
157
142
|
},
|
|
158
143
|
Image: {
|
|
144
|
+
padding: "8px",
|
|
145
|
+
minWidth: "96px",
|
|
146
|
+
maxWidth: "96px",
|
|
159
147
|
"& .image": {
|
|
148
|
+
width: "100%",
|
|
149
|
+
height: "100%",
|
|
160
150
|
objectFit: "contain",
|
|
161
|
-
|
|
162
|
-
height: "118px",
|
|
163
|
-
flex: 0.33,
|
|
151
|
+
borderRadius: "4px",
|
|
164
152
|
},
|
|
165
|
-
"& .image.
|
|
166
|
-
filter: "brightness(
|
|
153
|
+
"& .image.subdued": {
|
|
154
|
+
filter: "brightness(0.95)",
|
|
155
|
+
opacity: "0.5",
|
|
167
156
|
},
|
|
168
157
|
},
|
|
169
158
|
TextArea: {
|
|
@@ -174,12 +163,20 @@ export function RewardExchangeView(props) {
|
|
|
174
163
|
lineHeight: "20px",
|
|
175
164
|
fontWeight: "600",
|
|
176
165
|
color: "var(--sl-color-neutral-1000)",
|
|
166
|
+
display: "-webkit-box",
|
|
167
|
+
"-webkit-line-clamp": "1",
|
|
168
|
+
"-webkit-box-orient": "vertical",
|
|
169
|
+
overflow: "hidden",
|
|
177
170
|
},
|
|
178
171
|
"& .amount": {
|
|
179
172
|
fontSize: "14px",
|
|
180
173
|
lineHeight: "18px",
|
|
181
174
|
marginTop: "8px",
|
|
182
175
|
color: "var(--sl-color-neutral-500)",
|
|
176
|
+
display: "-webkit-box",
|
|
177
|
+
"-webkit-line-clamp": "1",
|
|
178
|
+
"-webkit-box-orient": "vertical",
|
|
179
|
+
overflow: "hidden",
|
|
183
180
|
},
|
|
184
181
|
"& .error": {
|
|
185
182
|
fontSize: "14px",
|
|
@@ -187,6 +184,10 @@ export function RewardExchangeView(props) {
|
|
|
187
184
|
marginTop: "8px",
|
|
188
185
|
fontWeight: "600",
|
|
189
186
|
color: "var(--sl-color-warning-500)",
|
|
187
|
+
display: "-webkit-box",
|
|
188
|
+
"-webkit-line-clamp": "1",
|
|
189
|
+
"-webkit-box-orient": "vertical",
|
|
190
|
+
overflow: "hidden",
|
|
190
191
|
},
|
|
191
192
|
},
|
|
192
193
|
ChooseAmount: {
|
|
@@ -201,7 +202,7 @@ export function RewardExchangeView(props) {
|
|
|
201
202
|
//fontSize: "var(--sl-font-size-large)",
|
|
202
203
|
fontSize: "113%",
|
|
203
204
|
fontWeight: "var(--sl-font-weight-semibold)",
|
|
204
|
-
color: "var(--sl-color-
|
|
205
|
+
color: "var(--sl-color-primary-500)",
|
|
205
206
|
},
|
|
206
207
|
"& .description": {
|
|
207
208
|
fontSize: "var(--sl-font-size-medium)",
|
|
@@ -232,7 +233,13 @@ export function RewardExchangeView(props) {
|
|
|
232
233
|
marginTop: "var(--sl-spacing-xx-small)",
|
|
233
234
|
},
|
|
234
235
|
},
|
|
235
|
-
|
|
236
|
+
Grid: {
|
|
237
|
+
display: "grid",
|
|
238
|
+
justifyContent: "center",
|
|
239
|
+
gap: "20px",
|
|
240
|
+
gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
|
|
241
|
+
},
|
|
242
|
+
Button: {
|
|
236
243
|
display: "flex",
|
|
237
244
|
flexWrap: "wrap-reverse",
|
|
238
245
|
margin: "var(--sl-spacing-medium) 0",
|
|
@@ -271,18 +278,18 @@ export function RewardExchangeView(props) {
|
|
|
271
278
|
jss.setup(preset());
|
|
272
279
|
const sheet = jss.createStyleSheet(style);
|
|
273
280
|
const styleString = sheet.toString();
|
|
274
|
-
const { states, data, callbacks } = props;
|
|
275
|
-
const { selectedItem, selectedStep } = states;
|
|
276
281
|
function getInput() {
|
|
277
282
|
var _a, _b;
|
|
278
283
|
const item = states.selectedItem;
|
|
279
284
|
if (!item || (item === null || item === void 0 ? void 0 : item.ruleType) === "FIXED_GLOBAL_REWARD")
|
|
280
285
|
return h("span", null, item === null || item === void 0 ? void 0 : item.prettySourceValue);
|
|
281
286
|
if (!((_a = item.steps) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
282
|
-
return h("p", null,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
287
|
+
return (h("p", null, intl.formatMessage({
|
|
288
|
+
id: "notEnoughError",
|
|
289
|
+
defaultMessage: states.content.text.notEnoughError,
|
|
290
|
+
}, {
|
|
291
|
+
sourceUnit: item.sourceUnit,
|
|
292
|
+
})));
|
|
286
293
|
}
|
|
287
294
|
return (h("sl-select", { style: { width: "auto" }, label: "Select amount to receive", class: sheet.classes.Select, value: states.selectedStep, "onSl-select": (e) => {
|
|
288
295
|
var _a, _b, _c, _d, _e;
|
|
@@ -301,74 +308,78 @@ export function RewardExchangeView(props) {
|
|
|
301
308
|
defaultMessage: (_b = (_a = states.content) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.notAvailableError,
|
|
302
309
|
}, {
|
|
303
310
|
unavailableReason: step.unavailableReasonCode,
|
|
311
|
+
sourceValue: step.prettySourceValue || item.prettySourceMinValue,
|
|
304
312
|
}))))));
|
|
305
313
|
})));
|
|
306
314
|
}
|
|
307
315
|
function chooseReward() {
|
|
308
316
|
var _a;
|
|
309
317
|
return [
|
|
310
|
-
h("div", {
|
|
311
|
-
|
|
312
|
-
justifyContent: "center",
|
|
313
|
-
gap: "20px",
|
|
314
|
-
gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
|
|
315
|
-
} }, (_a = data.exchangeList) === null || _a === void 0 ? void 0 : _a.map((item) => {
|
|
316
|
-
var _a, _b, _c;
|
|
318
|
+
h("div", { class: sheet.classes.Grid }, (_a = data.exchangeList) === null || _a === void 0 ? void 0 : _a.map((item) => {
|
|
319
|
+
var _a, _b, _c, _d, _e;
|
|
317
320
|
const style = {
|
|
318
321
|
boxShadow: item.key === (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.key)
|
|
319
322
|
? "0 0 0 2px var(--sl-color-primary-500)"
|
|
320
323
|
: "none",
|
|
321
|
-
|
|
322
|
-
borderRadius: "var(--sl-border-radius-medium)",
|
|
323
|
-
flex: "1",
|
|
324
|
-
minWidth: "100%",
|
|
325
|
-
color: !item.available && "#eee",
|
|
324
|
+
borderRadius: "4px",
|
|
326
325
|
};
|
|
327
326
|
const amount = item.ruleType === "FIXED_GLOBAL_REWARD"
|
|
328
327
|
? item.prettySourceValue
|
|
329
328
|
: item.ruleType === "STEPPED_FIXED_GLOBAL_REWARD"
|
|
330
|
-
? `${(_a = item.steps[0]) === null || _a === void 0 ? void 0 : _a.sourceValue} to ${item.steps.slice(-1).pop().prettySourceValue}`
|
|
331
|
-
: `${item.
|
|
329
|
+
? `${(_a = item.steps[0]) === null || _a === void 0 ? void 0 : _a.sourceValue} to ${(_b = item.steps.slice(-1).pop()) === null || _b === void 0 ? void 0 : _b.prettySourceValue}`
|
|
330
|
+
: `${item.prettySourceMinValue} to ${item.prettySourceMaxValue}`;
|
|
332
331
|
return (h("div", { key: item.key, class: item.available ? sheet.classes.CardContainer : "", style: style },
|
|
333
|
-
h("sl-card", { class: sheet.classes.
|
|
332
|
+
h("sl-card", { class: sheet.classes.Card, style: {
|
|
334
333
|
cursor: item.unavailableReasonCode
|
|
335
334
|
? "not-allowed"
|
|
336
335
|
: "pointer",
|
|
337
336
|
}, onClick: () => item.available &&
|
|
338
337
|
callbacks.setExchangeState({ selectedItem: item }) },
|
|
339
|
-
item.key === (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.key) && (h("div", { class: "selected
|
|
340
|
-
h(
|
|
341
|
-
h(CheckMark, null)))),
|
|
338
|
+
item.key === (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.key) && (h("div", { class: "selected" },
|
|
339
|
+
h(CheckmarkFilled, null))),
|
|
342
340
|
h("div", { style: {
|
|
343
341
|
display: "flex",
|
|
344
342
|
width: "100%",
|
|
343
|
+
height: "120px",
|
|
345
344
|
borderRadius: "3px",
|
|
346
345
|
background: item.unavailableReasonCode
|
|
347
346
|
? "rgba(0, 0, 0, 0.05)"
|
|
348
347
|
: "rgba(0, 0, 0, 0)",
|
|
349
348
|
} },
|
|
350
|
-
h("div", { class: sheet.classes.
|
|
349
|
+
h("div", { class: sheet.classes.Image, style: {
|
|
350
|
+
opacity: item.unavailableReasonCode ? "0.5" : "1",
|
|
351
|
+
} },
|
|
351
352
|
h("img", { class: item.unavailableReasonCode ? "image subdued" : "image", src: (item === null || item === void 0 ? void 0 : item.imageUrl) ||
|
|
352
353
|
getAssetPath("./assets/placeholder.png") })),
|
|
353
354
|
h("div", { class: sheet.classes.TextArea, style: {
|
|
354
355
|
opacity: item.unavailableReasonCode ? "0.5" : "1",
|
|
355
356
|
} },
|
|
356
|
-
h("div", { class: "title"
|
|
357
|
-
|
|
357
|
+
h("div", { class: "title", style: {
|
|
358
|
+
"-webkit-line-clamp": item.unavailableReasonCode
|
|
359
|
+
? "1"
|
|
360
|
+
: "2",
|
|
361
|
+
} }, (_c = item.name) !== null && _c !== void 0 ? _c : ""),
|
|
362
|
+
h("div", { class: "amount", style: {
|
|
363
|
+
"-webkit-line-clamp": item.unavailableReasonCode
|
|
364
|
+
? "1"
|
|
365
|
+
: "2",
|
|
366
|
+
} }, amount),
|
|
358
367
|
item.unavailableReasonCode && (h("div", { class: "error" }, intl.formatMessage({
|
|
359
368
|
id: "unavailableCode",
|
|
360
|
-
defaultMessage: (
|
|
369
|
+
defaultMessage: (_e = (_d = states.content) === null || _d === void 0 ? void 0 : _d.text) === null || _e === void 0 ? void 0 : _e.notAvailableError,
|
|
361
370
|
}, {
|
|
362
371
|
unavailableReason: item.unavailableReason ||
|
|
363
372
|
item.unavailableReasonCode,
|
|
373
|
+
sourceValue: item.prettySourceValue ||
|
|
374
|
+
item.prettySourceMinValue,
|
|
364
375
|
}))))))));
|
|
365
376
|
})),
|
|
366
|
-
h("div", { class: sheet.classes.
|
|
367
|
-
h("sl-button", { class: "continue right", size: "large", onClick: () => callbacks.setStage("chooseAmount"), disabled: !states.selectedItem },
|
|
377
|
+
h("div", { class: sheet.classes.Button },
|
|
378
|
+
h("sl-button", { class: "continue right", size: "large", onClick: () => callbacks.setStage("chooseAmount"), loading: states.loading, disabled: !states.selectedItem }, states.content.text.continueText)),
|
|
368
379
|
];
|
|
369
380
|
}
|
|
370
381
|
function chooseAmount() {
|
|
371
|
-
var _a, _b, _c;
|
|
382
|
+
var _a, _b, _c, _d;
|
|
372
383
|
const input = getInput();
|
|
373
384
|
const isDisabled = ((_a = states.selectedItem) === null || _a === void 0 ? void 0 : _a.ruleType) === "FIXED_GLOBAL_REWARD"
|
|
374
385
|
? false
|
|
@@ -377,17 +388,18 @@ export function RewardExchangeView(props) {
|
|
|
377
388
|
h("div", null, h("img", { class: sheet.classes.FullImage, src: (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.imageUrl) ||
|
|
378
389
|
getAssetPath("./assets/placeholder.png") })),
|
|
379
390
|
h("div", { class: sheet.classes.ChooseAmount },
|
|
380
|
-
h("div", { class: "title" }, (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name)
|
|
381
|
-
((
|
|
382
|
-
((
|
|
391
|
+
h("div", { class: "title" }, (_b = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _b !== void 0 ? _b : ""),
|
|
392
|
+
((_c = states.selectedItem) === null || _c === void 0 ? void 0 : _c.ruleType) === "FIXED_GLOBAL_REWARD" ? (h("div", { class: "points" }, input)) : (h("div", { class: "description" }, selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.description)),
|
|
393
|
+
((_d = states.selectedItem) === null || _d === void 0 ? void 0 : _d.ruleType) === "FIXED_GLOBAL_REWARD" ? (h("div", { class: "description" }, selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.description)) : (h("div", { class: "points" }, input)),
|
|
383
394
|
h("div", { class: "space" })),
|
|
384
|
-
h("div", { class: sheet.classes.
|
|
385
|
-
h("sl-button", { class: "cancel", size: "large", type: "text", onClick: () => callbacks.resetState() },
|
|
386
|
-
h("sl-button", { class: "continue", size: "large", onClick: () => callbacks.setStage("confirmation"), disabled: isDisabled },
|
|
395
|
+
h("div", { class: sheet.classes.Button },
|
|
396
|
+
h("sl-button", { class: "cancel", size: "large", type: "text", onClick: () => callbacks.resetState() }, states.content.text.cancelText),
|
|
397
|
+
h("sl-button", { class: "continue", size: "large", onClick: () => callbacks.setStage("confirmation"), disabled: isDisabled }, states.content.text.continueToConfirmationText))));
|
|
387
398
|
}
|
|
388
399
|
function confirmation() {
|
|
400
|
+
var _a, _b;
|
|
389
401
|
return (h("div", null,
|
|
390
|
-
h("h2", { style: { margin: "20px 0" } },
|
|
402
|
+
h("h2", { style: { margin: "20px 0" } }, states.content.text.redeemTitle),
|
|
391
403
|
h("div", { style: {
|
|
392
404
|
textAlign: "center",
|
|
393
405
|
marginBottom: "var(--sl-spacing-xxx-large)",
|
|
@@ -402,27 +414,39 @@ export function RewardExchangeView(props) {
|
|
|
402
414
|
flex: "1",
|
|
403
415
|
minWidth: "100%",
|
|
404
416
|
} },
|
|
405
|
-
h("sl-card", { style: { width: "auto", maxWidth: "350px", margin: "auto" }, class: sheet.classes.
|
|
417
|
+
h("sl-card", { style: { width: "auto", maxWidth: "350px", margin: "auto" }, class: sheet.classes.Card },
|
|
406
418
|
h("div", { class: sheet.classes.Square },
|
|
407
419
|
h("img", { class: "image", src: (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.imageUrl) ||
|
|
408
420
|
getAssetPath("./assets/placeholder.png") })),
|
|
409
421
|
h("div", { class: sheet.classes.TextArea, style: {
|
|
410
422
|
lineHeight: "18px",
|
|
411
423
|
alignSelf: "center",
|
|
412
|
-
} }, (selectedStep === null || selectedStep === void 0 ? void 0 : selectedStep.prettyDestinationValue) ? (selectedStep === null || selectedStep === void 0 ? void 0 : selectedStep.prettyDestinationValue) +
|
|
413
|
-
" " + (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) || ""
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
h("sl-button", { class: "
|
|
417
|
-
h("sl-button", { class: "continue", size: "large", onClick: callbacks.exchangeReward }, "Redeem"))));
|
|
424
|
+
} }, (selectedStep === null || selectedStep === void 0 ? void 0 : selectedStep.prettyDestinationValue) ? (_a = (selectedStep === null || selectedStep === void 0 ? void 0 : selectedStep.prettyDestinationValue) +
|
|
425
|
+
" " + (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name)) !== null && _a !== void 0 ? _a : "" : (_b = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) !== null && _b !== void 0 ? _b : "")))),
|
|
426
|
+
h("div", { class: sheet.classes.Button },
|
|
427
|
+
h("sl-button", { class: "cancel", type: "text", size: "large", onClick: () => callbacks.setStage("chooseAmount") }, states.content.text.backText),
|
|
428
|
+
h("sl-button", { class: "continue", size: "large", loading: states.loading, onClick: callbacks.exchangeReward }, states.content.text.redeemText))));
|
|
418
429
|
}
|
|
419
430
|
function success() {
|
|
431
|
+
var _a, _b, _c;
|
|
420
432
|
return (h("div", { class: sheet.classes.Success },
|
|
421
433
|
h(Gift, null),
|
|
422
|
-
h("div", { class: "title" },
|
|
423
|
-
h("div", { class: "description" },
|
|
424
|
-
|
|
425
|
-
|
|
434
|
+
h("div", { class: "title" }, states.content.text.rewardRedeemedText),
|
|
435
|
+
h("div", { class: "description" }, intl.formatMessage({
|
|
436
|
+
id: "successMessage",
|
|
437
|
+
defaultMessage: states.content.text.redemptionSuccessText,
|
|
438
|
+
}, {
|
|
439
|
+
sourceValue: (_a = states.selectedItem.prettySourceValue) !== null && _a !== void 0 ? _a : (_b = states.selectedStep) === null || _b === void 0 ? void 0 : _b.prettySourceValue,
|
|
440
|
+
destinationValue: ((_c = states.selectedStep) === null || _c === void 0 ? void 0 : _c.prettyDestinationValue) ||
|
|
441
|
+
states.selectedItem.globalRewardKey,
|
|
442
|
+
})),
|
|
443
|
+
(data === null || data === void 0 ? void 0 : data.fuelTankCode) && (h("div", { style: {
|
|
444
|
+
width: "40%",
|
|
445
|
+
margin: "-30px auto var(--sl-spacing-xxx-large) auto",
|
|
446
|
+
} },
|
|
447
|
+
h(ShareLinkView, { shareString: data.fuelTankCode, tooltiptext: "Copied", open: states.open, onClick: callbacks.copyFuelTankCode }))),
|
|
448
|
+
h("div", { class: sheet.classes.Button },
|
|
449
|
+
h("sl-button", { class: "continue center", type: "primary", size: "large", onClick: () => callbacks.resetState(true) }, states.content.text.doneText))));
|
|
426
450
|
}
|
|
427
451
|
const stages = {
|
|
428
452
|
chooseReward: () => chooseReward(),
|
|
@@ -445,25 +469,39 @@ export function RewardExchangeView(props) {
|
|
|
445
469
|
h(ProgressBar, { stageCount: 3, currentStage: stageNumber })));
|
|
446
470
|
}
|
|
447
471
|
function loading() {
|
|
448
|
-
return (h("div", {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
472
|
+
return (h("div", { class: sheet.classes.Grid }, [...Array(8)].map(() => {
|
|
473
|
+
return (h("div", { class: sheet.classes.CardContainer },
|
|
474
|
+
h("sl-card", { class: sheet.classes.Card },
|
|
475
|
+
h("div", { class: sheet.classes.CardLayout },
|
|
476
|
+
h("div", null,
|
|
477
|
+
h("sl-skeleton", { style: {
|
|
478
|
+
width: "100px",
|
|
479
|
+
height: "100px",
|
|
480
|
+
margin: "9px",
|
|
481
|
+
"--border-radius": "4px",
|
|
482
|
+
} })),
|
|
483
|
+
h("div", { style: { margin: "12px 12px 0 0", width: "100%" } },
|
|
484
|
+
h("sl-skeleton", { style: { marginBottom: "12px" } }),
|
|
485
|
+
h("sl-skeleton", { style: { marginBottom: "12px" } }),
|
|
486
|
+
h("sl-skeleton", { style: { width: "45%" } }))))));
|
|
487
|
+
})));
|
|
456
488
|
}
|
|
457
489
|
function errorMessage() {
|
|
458
490
|
return (h("sl-alert", { type: "danger", open: true },
|
|
459
491
|
h("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
460
|
-
|
|
492
|
+
states.content.text.redemptionError));
|
|
493
|
+
}
|
|
494
|
+
function queryErrorMessage() {
|
|
495
|
+
return (h("sl-alert", { type: "danger", open: true },
|
|
496
|
+
h("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
497
|
+
states.content.text.queryError));
|
|
461
498
|
}
|
|
462
499
|
return (h("div", { class: sheet.classes.Container },
|
|
463
500
|
h("style", { type: "text/css" }, styleString),
|
|
464
501
|
h("div", null,
|
|
465
502
|
stageMap(),
|
|
466
|
-
states.loading && loading(),
|
|
503
|
+
states.redeemStage === "chooseReward" && states.loading && loading(),
|
|
467
504
|
states.exchangeError && errorMessage(),
|
|
505
|
+
states.queryError && queryErrorMessage(),
|
|
468
506
|
currentStage && currentStage())));
|
|
469
507
|
}
|