@saasquatch/mint-components 2.1.13 → 2.1.14-1
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/{ShadowViewAddon-3b477e58.js → ShadowViewAddon-c97e80de.js} +7 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/{sqm-big-stat_45.cjs.entry.js → sqm-big-stat_46.cjs.entry.js} +75 -3
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +55 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/sqm-big-stat/useBigStat.js +6 -5
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +1 -1
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +3 -2
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
- package/dist/collection/components/sqm-user-attribute/UserAttribute.stories.js +43 -0
- package/dist/collection/components/sqm-user-attribute/sqm-user-attribute-view.js +19 -0
- package/dist/collection/components/sqm-user-attribute/sqm-user-attribute.js +175 -0
- package/dist/collection/components/sqm-user-attribute/useUserAttribute.js +30 -0
- package/dist/esm/{ShadowViewAddon-0b980200.js → ShadowViewAddon-33f1a8f7.js} +7 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/{sqm-big-stat_45.entry.js → sqm-big-stat_46.entry.js} +75 -4
- package/dist/esm/sqm-stencilbook.entry.js +55 -1
- package/dist/esm-es5/ShadowViewAddon-33f1a8f7.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-big-stat_46.entry.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-c8a3f3b0.js → p-08930b83.js} +13 -13
- package/dist/mint-components/{p-b4fa20ce.entry.js → p-7462403c.entry.js} +2 -2
- package/dist/mint-components/p-78b40f71.system.js +1 -0
- package/dist/mint-components/{p-3ca77515.system.entry.js → p-9de4d6d1.system.entry.js} +1 -1
- package/dist/mint-components/p-ca098be1.system.js +1 -1
- package/dist/mint-components/{p-bbbd6e44.entry.js → p-e43a8421.entry.js} +29 -21
- package/dist/mint-components/p-fb637e0a.system.entry.js +1 -0
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +1 -1
- package/dist/types/components/sqm-user-attribute/UserAttribute.stories.d.ts +11 -0
- package/dist/types/components/sqm-user-attribute/sqm-user-attribute-view.d.ts +8 -0
- package/dist/types/components/sqm-user-attribute/sqm-user-attribute.d.ts +45 -0
- package/dist/types/components/sqm-user-attribute/useUserAttribute.d.ts +3 -0
- package/dist/types/components.d.ts +80 -2
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/ShadowViewAddon-0b980200.js +0 -1
- package/dist/esm-es5/sqm-big-stat_45.entry.js +0 -1
- package/dist/mint-components/p-044f930a.system.js +0 -1
- package/dist/mint-components/p-37883f0c.system.entry.js +0 -1
|
@@ -33,7 +33,7 @@ require('./utilities-fcdb9504.js');
|
|
|
33
33
|
const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-a767b044.js');
|
|
34
34
|
require('./ErrorView-ee7b0f36.js');
|
|
35
35
|
const sqmQrCodeView = require('./sqm-qr-code-view-1f2daa76.js');
|
|
36
|
-
const ShadowViewAddon = require('./ShadowViewAddon-
|
|
36
|
+
const ShadowViewAddon = require('./ShadowViewAddon-c97e80de.js');
|
|
37
37
|
const sqmPortalContainerView = require('./sqm-portal-container-view-757f921b.js');
|
|
38
38
|
const sqmUserInfoFormView = require('./sqm-user-info-form-view-53306f6e.js');
|
|
39
39
|
const data = require('./data-8c8a08f6.js');
|
|
@@ -18844,6 +18844,59 @@ const UserInfoFormView = /*#__PURE__*/Object.freeze({
|
|
|
18844
18844
|
DisabledForm: DisabledForm
|
|
18845
18845
|
});
|
|
18846
18846
|
|
|
18847
|
+
const scenario$G = "@owner:zach @author:zach\nFeature: User Attribute\n Displays a user's custom field value.\n\n Background: A user exists\n Given a user is logged in\n And the user has custom fields\n\n @motivating\n Scenario: A custom field value is displayed\n Given the component has prop \"value\" with value \"firstName\"\n And the user has a custom field \"firstName\" with value \"John\"\n When the component is rendered\n Then the text \"John\" is displayed\n\n @landmine\n Scenario: Nothing is rendered when the custom field does not exist\n Given the component has prop \"value\" with value \"nonExistentField\"\n And the user does not have a custom field \"nonExistentField\"\n Then component is not rendered\n And nothing is displayed\n\n @motivating\n Scenario: A loading skeleton is shown while data is loading\n Given the component is loading user data\n When the component is rendered\n Then a loading skeleton is displayed\n\n @motivating\n Scenario Outline: Optional styling props can be applied to customize the text appearance\n Given the component has prop <prop> with value <value>\n When the component is rendered\n Then the text is displayed with <cssProperty> set to <value>\n\n Examples:\n | prop | value | cssProperty |\n | fontSize | 24 | font-size |\n | color | #E91E63 | color |\n | fontWeight | 700 | font-weight |\n\n @minutia\n Scenario: Style props are optional and default to no custom styling\n Given the component has no style props set\n When the component is rendered\n Then the text is displayed with default browser styles\n";
|
|
18848
|
+
|
|
18849
|
+
const UserAttribute_stories = {
|
|
18850
|
+
title: "Components/User Attribute",
|
|
18851
|
+
parameters: {
|
|
18852
|
+
scenario: scenario$G,
|
|
18853
|
+
},
|
|
18854
|
+
};
|
|
18855
|
+
const Default$x = () => {
|
|
18856
|
+
return (index.h("sqm-user-attribute", { demoData: {
|
|
18857
|
+
loading: false,
|
|
18858
|
+
value: "impact.com",
|
|
18859
|
+
} }));
|
|
18860
|
+
};
|
|
18861
|
+
/*
|
|
18862
|
+
Verifies that an sqm-user-attribute with no valid value
|
|
18863
|
+
collapses completely and does not create extra space
|
|
18864
|
+
(e.g. a double gap) in a flex layout.
|
|
18865
|
+
*/
|
|
18866
|
+
const InvalidValue = () => {
|
|
18867
|
+
return (index.h("div", { style: { display: "flex", flexDirection: "column", gap: "16px" } },
|
|
18868
|
+
index.h("div", { style: { background: "#e0e0e0", padding: "8px" } }, "Above"),
|
|
18869
|
+
index.h("sqm-user-attribute", { demoData: {
|
|
18870
|
+
loading: false,
|
|
18871
|
+
value: null,
|
|
18872
|
+
} }),
|
|
18873
|
+
index.h("div", { style: { background: "#e0e0e0", padding: "8px" } }, "Below")));
|
|
18874
|
+
};
|
|
18875
|
+
const Loading$h = () => {
|
|
18876
|
+
return (index.h("sqm-user-attribute", { demoData: {
|
|
18877
|
+
loading: true,
|
|
18878
|
+
value: "impact.com",
|
|
18879
|
+
} }));
|
|
18880
|
+
};
|
|
18881
|
+
const WithCustomStyles = () => {
|
|
18882
|
+
return (index.h("sqm-user-attribute", { demoData: {
|
|
18883
|
+
loading: false,
|
|
18884
|
+
value: "impact.com",
|
|
18885
|
+
fontSize: 24,
|
|
18886
|
+
color: "#4CAF50",
|
|
18887
|
+
fontWeight: 700,
|
|
18888
|
+
} }));
|
|
18889
|
+
};
|
|
18890
|
+
|
|
18891
|
+
const UserAttribute = /*#__PURE__*/Object.freeze({
|
|
18892
|
+
__proto__: null,
|
|
18893
|
+
'default': UserAttribute_stories,
|
|
18894
|
+
Default: Default$x,
|
|
18895
|
+
InvalidValue: InvalidValue,
|
|
18896
|
+
Loading: Loading$h,
|
|
18897
|
+
WithCustomStyles: WithCustomStyles
|
|
18898
|
+
});
|
|
18899
|
+
|
|
18847
18900
|
function deepFreeze(obj) {
|
|
18848
18901
|
if (obj instanceof Map) {
|
|
18849
18902
|
obj.clear = obj.delete = obj.set = function () {
|
|
@@ -21537,6 +21590,7 @@ const stories = [
|
|
|
21537
21590
|
TaxAndCashRewardsTable,
|
|
21538
21591
|
TaxAndCashReferralTableRewardsCell,
|
|
21539
21592
|
TaxAndCashReferralTable$1,
|
|
21593
|
+
UserAttribute,
|
|
21540
21594
|
];
|
|
21541
21595
|
const StencilStorybook = class {
|
|
21542
21596
|
constructor(hostRef) {
|
|
@@ -121,6 +121,7 @@
|
|
|
121
121
|
"./components/sqm-timeline/sqm-timeline-entry.js",
|
|
122
122
|
"./components/sqm-timeline/sqm-timeline.js",
|
|
123
123
|
"./components/sqm-titled-section/sqm-titled-section.js",
|
|
124
|
+
"./components/sqm-user-attribute/sqm-user-attribute.js",
|
|
124
125
|
"./components/sqm-user-name/sqm-user-name.js",
|
|
125
126
|
"./components/sqm-widget-verification/sqm-widget-verification-controller.js",
|
|
126
127
|
"./components/sqm-widget-verification/sqm-widget-verification.js",
|
|
@@ -188,7 +188,7 @@ _, type, unit, status, global = "") => {
|
|
|
188
188
|
$programId: ID
|
|
189
189
|
$unit: String
|
|
190
190
|
$type: RewardType
|
|
191
|
-
$
|
|
191
|
+
$statusFilter: RewardStatusFilterInput
|
|
192
192
|
) {
|
|
193
193
|
viewer {
|
|
194
194
|
... on User {
|
|
@@ -197,7 +197,7 @@ _, type, unit, status, global = "") => {
|
|
|
197
197
|
programId_eq: $programId
|
|
198
198
|
type_eq: $type
|
|
199
199
|
unit_eq: $unit
|
|
200
|
-
|
|
200
|
+
statuses_eq: $statusFilter
|
|
201
201
|
}
|
|
202
202
|
) {
|
|
203
203
|
totalCount
|
|
@@ -223,14 +223,14 @@ const integrationRewardsCountFilteredQuery = (programId,
|
|
|
223
223
|
_, status, global = "") => {
|
|
224
224
|
const statusFilter = status ? { status } : null;
|
|
225
225
|
return debugQuery(gql `
|
|
226
|
-
query ($programId: ID, $
|
|
226
|
+
query ($programId: ID, $statusFilter: RewardStatusFilterInput) {
|
|
227
227
|
viewer {
|
|
228
228
|
... on User {
|
|
229
229
|
rewards(
|
|
230
230
|
filter: {
|
|
231
231
|
programId_eq: $programId
|
|
232
232
|
type_eq: INTEGRATION
|
|
233
|
-
|
|
233
|
+
statuses_eq: $statusFilter
|
|
234
234
|
}
|
|
235
235
|
) {
|
|
236
236
|
totalCount
|
|
@@ -729,7 +729,8 @@ const rewardsBalanceQuery = (programId, locale, type, unit, format = "prettyValu
|
|
|
729
729
|
const fallback = (_c = res.data) === null || _c === void 0 ? void 0 : _c.fallback;
|
|
730
730
|
const balance = arr === null || arr === void 0 ? void 0 : arr[0];
|
|
731
731
|
const totalEarned = balance
|
|
732
|
-
? (balance.totalAssignedCredit || 0) +
|
|
732
|
+
? (balance.totalAssignedCredit || 0) +
|
|
733
|
+
(balance.totalPendingCredit || 0)
|
|
733
734
|
: 0;
|
|
734
735
|
const result = useQuery(gql `
|
|
735
736
|
query (
|
|
@@ -60,7 +60,7 @@ export function CheckboxFieldView(props) {
|
|
|
60
60
|
h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
|
|
61
61
|
e.target.value = e.target.checked;
|
|
62
62
|
callbacks.setChecked(e.target.value);
|
|
63
|
-
} }, (!content.checkboxOptional ? { required:
|
|
63
|
+
} }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
|
|
64
64
|
if (!value && !content.checkboxOptional) {
|
|
65
65
|
return content.errorMessage;
|
|
66
66
|
}
|
|
@@ -27,7 +27,7 @@ export class CheckboxField {
|
|
|
27
27
|
*/
|
|
28
28
|
this.checkboxLabelLink = "https://example.com";
|
|
29
29
|
/**
|
|
30
|
-
* @uiName Checkbox label link
|
|
30
|
+
* @uiName Checkbox label link lext
|
|
31
31
|
*/
|
|
32
32
|
this.checkboxLabelLinkText = "Terms and Conditions";
|
|
33
33
|
/**
|
|
@@ -60,6 +60,7 @@ export class CheckboxField {
|
|
|
60
60
|
return (h(CheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
|
|
61
61
|
}
|
|
62
62
|
static get is() { return "sqm-checkbox-field"; }
|
|
63
|
+
static get encapsulation() { return "shadow"; }
|
|
63
64
|
static get properties() { return {
|
|
64
65
|
"checkboxName": {
|
|
65
66
|
"type": "string",
|
|
@@ -141,7 +142,7 @@ export class CheckboxField {
|
|
|
141
142
|
"optional": true,
|
|
142
143
|
"docs": {
|
|
143
144
|
"tags": [{
|
|
144
|
-
"text": "Checkbox label link
|
|
145
|
+
"text": "Checkbox label link lext",
|
|
145
146
|
"name": "uiName"
|
|
146
147
|
}],
|
|
147
148
|
"text": ""
|
|
@@ -107,6 +107,7 @@ import * as LeadFormDropdownField from "../sqm-lead-form/LeadFormDropdownField.s
|
|
|
107
107
|
import * as LeadCheckboxField from "../sqm-lead-form/LeadCheckboxField.stories";
|
|
108
108
|
import * as Skeleton from "../sqm-skeleton/Skeleton.stories";
|
|
109
109
|
import * as UserInfoFormView from "../tax-and-cash/sqm-user-info-form/UserInfoFormView.stories";
|
|
110
|
+
import * as UserAttribute from "../sqm-user-attribute/UserAttribute.stories";
|
|
110
111
|
import { ShadowViewAddon } from "../../ShadowViewAddon";
|
|
111
112
|
import { CucumberAddon } from "./CucumberAddon";
|
|
112
113
|
import { HookStoryAddon } from "./HookStoryAddon";
|
|
@@ -218,6 +219,7 @@ const stories = [
|
|
|
218
219
|
TaxAndCashRewardsTable,
|
|
219
220
|
TaxAndCashReferralTableRewardsCell,
|
|
220
221
|
TaxAndCashReferralTable,
|
|
222
|
+
UserAttribute,
|
|
221
223
|
];
|
|
222
224
|
/**
|
|
223
225
|
* For internal documentation
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import scenario from "./user-attribute.feature";
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/User Attribute",
|
|
5
|
+
parameters: {
|
|
6
|
+
scenario,
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
export const Default = () => {
|
|
10
|
+
return (h("sqm-user-attribute", { demoData: {
|
|
11
|
+
loading: false,
|
|
12
|
+
value: "impact.com",
|
|
13
|
+
} }));
|
|
14
|
+
};
|
|
15
|
+
/*
|
|
16
|
+
Verifies that an sqm-user-attribute with no valid value
|
|
17
|
+
collapses completely and does not create extra space
|
|
18
|
+
(e.g. a double gap) in a flex layout.
|
|
19
|
+
*/
|
|
20
|
+
export const InvalidValue = () => {
|
|
21
|
+
return (h("div", { style: { display: "flex", flexDirection: "column", gap: "16px" } },
|
|
22
|
+
h("div", { style: { background: "#e0e0e0", padding: "8px" } }, "Above"),
|
|
23
|
+
h("sqm-user-attribute", { demoData: {
|
|
24
|
+
loading: false,
|
|
25
|
+
value: null,
|
|
26
|
+
} }),
|
|
27
|
+
h("div", { style: { background: "#e0e0e0", padding: "8px" } }, "Below")));
|
|
28
|
+
};
|
|
29
|
+
export const Loading = () => {
|
|
30
|
+
return (h("sqm-user-attribute", { demoData: {
|
|
31
|
+
loading: true,
|
|
32
|
+
value: "impact.com",
|
|
33
|
+
} }));
|
|
34
|
+
};
|
|
35
|
+
export const WithCustomStyles = () => {
|
|
36
|
+
return (h("sqm-user-attribute", { demoData: {
|
|
37
|
+
loading: false,
|
|
38
|
+
value: "impact.com",
|
|
39
|
+
fontSize: 24,
|
|
40
|
+
color: "#4CAF50",
|
|
41
|
+
fontWeight: 700,
|
|
42
|
+
} }));
|
|
43
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
import { createStyleSheet } from "../../styling/JSS";
|
|
3
|
+
export function UserAttributeView(props) {
|
|
4
|
+
const style = {
|
|
5
|
+
P: {
|
|
6
|
+
margin: "0",
|
|
7
|
+
padding: "0",
|
|
8
|
+
fontSize: props.fontSize ? `${props.fontSize}px` : "inherit",
|
|
9
|
+
fontWeight: props.fontWeight || "inherit",
|
|
10
|
+
color: props.color || "var(--sqm-text)",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
const sheet = createStyleSheet(style);
|
|
14
|
+
const styleString = sheet.toString();
|
|
15
|
+
const loadingSkeleton = (h("sqm-skeleton", { width: "200px", height: "20px" }));
|
|
16
|
+
return (h(Host, null,
|
|
17
|
+
h("style", null, styleString),
|
|
18
|
+
h("p", { class: sheet.classes.P, part: "sqm-base" }, props.loading ? loadingSkeleton : props.value)));
|
|
19
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { isDemo } from "@saasquatch/component-boilerplate";
|
|
2
|
+
import { withHooks } from "@saasquatch/stencil-hooks";
|
|
3
|
+
import { Component, h, Host, Prop, State } from "@stencil/core";
|
|
4
|
+
import deepmerge from "deepmerge";
|
|
5
|
+
import { UserAttributeView, } from "./sqm-user-attribute-view";
|
|
6
|
+
import { useUserAttribute } from "./useUserAttribute";
|
|
7
|
+
/**
|
|
8
|
+
* @uiName User Attribute
|
|
9
|
+
* @exampleGroup Advanced
|
|
10
|
+
* @example User Attribute - <sqm-user-attribute value="lastSeenDate"></sqm-user-attribute>
|
|
11
|
+
*/
|
|
12
|
+
export class UserAttribute {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.ignored = true;
|
|
15
|
+
withHooks(this);
|
|
16
|
+
}
|
|
17
|
+
disconnectedCallback() { }
|
|
18
|
+
render() {
|
|
19
|
+
const props = isDemo() ? useCustomFieldsDemo(this) : useUserAttribute(this);
|
|
20
|
+
if (props.value == null) {
|
|
21
|
+
return h(Host, { style: { display: "none" } });
|
|
22
|
+
}
|
|
23
|
+
return h(UserAttributeView, Object.assign({}, props));
|
|
24
|
+
}
|
|
25
|
+
static get is() { return "sqm-user-attribute"; }
|
|
26
|
+
static get encapsulation() { return "shadow"; }
|
|
27
|
+
static get properties() { return {
|
|
28
|
+
"value": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"mutable": false,
|
|
31
|
+
"complexType": {
|
|
32
|
+
"original": "string",
|
|
33
|
+
"resolved": "string",
|
|
34
|
+
"references": {}
|
|
35
|
+
},
|
|
36
|
+
"required": false,
|
|
37
|
+
"optional": false,
|
|
38
|
+
"docs": {
|
|
39
|
+
"tags": [{
|
|
40
|
+
"text": "Custom field key",
|
|
41
|
+
"name": "uiName"
|
|
42
|
+
}, {
|
|
43
|
+
"text": "customFieldSelector",
|
|
44
|
+
"name": "uiWidget"
|
|
45
|
+
}],
|
|
46
|
+
"text": "The custom field key to display."
|
|
47
|
+
},
|
|
48
|
+
"attribute": "value",
|
|
49
|
+
"reflect": false
|
|
50
|
+
},
|
|
51
|
+
"fontSize": {
|
|
52
|
+
"type": "number",
|
|
53
|
+
"mutable": false,
|
|
54
|
+
"complexType": {
|
|
55
|
+
"original": "number",
|
|
56
|
+
"resolved": "number",
|
|
57
|
+
"references": {}
|
|
58
|
+
},
|
|
59
|
+
"required": false,
|
|
60
|
+
"optional": true,
|
|
61
|
+
"docs": {
|
|
62
|
+
"tags": [{
|
|
63
|
+
"text": "Font size",
|
|
64
|
+
"name": "uiName"
|
|
65
|
+
}, {
|
|
66
|
+
"text": "Style",
|
|
67
|
+
"name": "uiGroup"
|
|
68
|
+
}],
|
|
69
|
+
"text": "Number in pixels."
|
|
70
|
+
},
|
|
71
|
+
"attribute": "font-size",
|
|
72
|
+
"reflect": false
|
|
73
|
+
},
|
|
74
|
+
"color": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"mutable": false,
|
|
77
|
+
"complexType": {
|
|
78
|
+
"original": "string",
|
|
79
|
+
"resolved": "string",
|
|
80
|
+
"references": {}
|
|
81
|
+
},
|
|
82
|
+
"required": false,
|
|
83
|
+
"optional": true,
|
|
84
|
+
"docs": {
|
|
85
|
+
"tags": [{
|
|
86
|
+
"text": "Color",
|
|
87
|
+
"name": "uiName"
|
|
88
|
+
}, {
|
|
89
|
+
"text": "color",
|
|
90
|
+
"name": "uiWidget"
|
|
91
|
+
}, {
|
|
92
|
+
"text": "color",
|
|
93
|
+
"name": "format"
|
|
94
|
+
}, {
|
|
95
|
+
"text": "Style",
|
|
96
|
+
"name": "uiGroup"
|
|
97
|
+
}],
|
|
98
|
+
"text": ""
|
|
99
|
+
},
|
|
100
|
+
"attribute": "color",
|
|
101
|
+
"reflect": false
|
|
102
|
+
},
|
|
103
|
+
"fontWeight": {
|
|
104
|
+
"type": "number",
|
|
105
|
+
"mutable": false,
|
|
106
|
+
"complexType": {
|
|
107
|
+
"original": "number",
|
|
108
|
+
"resolved": "number",
|
|
109
|
+
"references": {}
|
|
110
|
+
},
|
|
111
|
+
"required": false,
|
|
112
|
+
"optional": true,
|
|
113
|
+
"docs": {
|
|
114
|
+
"tags": [{
|
|
115
|
+
"text": "Font weight",
|
|
116
|
+
"name": "uiName"
|
|
117
|
+
}, {
|
|
118
|
+
"text": "Style",
|
|
119
|
+
"name": "uiGroup"
|
|
120
|
+
}, {
|
|
121
|
+
"text": "[100, 200, 300, 400, 500, 600, 700, 800, 900]",
|
|
122
|
+
"name": "uiEnum"
|
|
123
|
+
}, {
|
|
124
|
+
"text": "[\"Thin\", \"Extra Light\", \"Light\", \"Normal\", \"Medium\", \"Semi Bold\", \"Bold\", \"Extra Bold\", \"Heavy\"]",
|
|
125
|
+
"name": "uiEnumNames"
|
|
126
|
+
}],
|
|
127
|
+
"text": "Font weight"
|
|
128
|
+
},
|
|
129
|
+
"attribute": "font-weight",
|
|
130
|
+
"reflect": false
|
|
131
|
+
},
|
|
132
|
+
"demoData": {
|
|
133
|
+
"type": "unknown",
|
|
134
|
+
"mutable": false,
|
|
135
|
+
"complexType": {
|
|
136
|
+
"original": "DemoData<UserAttributeViewProps>",
|
|
137
|
+
"resolved": "{ loading?: boolean; value?: string; fontSize?: number; color?: string; fontWeight?: number; }",
|
|
138
|
+
"references": {
|
|
139
|
+
"DemoData": {
|
|
140
|
+
"location": "import",
|
|
141
|
+
"path": "../../global/demo"
|
|
142
|
+
},
|
|
143
|
+
"UserAttributeViewProps": {
|
|
144
|
+
"location": "import",
|
|
145
|
+
"path": "./sqm-user-attribute-view"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"required": false,
|
|
150
|
+
"optional": true,
|
|
151
|
+
"docs": {
|
|
152
|
+
"tags": [{
|
|
153
|
+
"text": undefined,
|
|
154
|
+
"name": "undocumented"
|
|
155
|
+
}, {
|
|
156
|
+
"text": "object",
|
|
157
|
+
"name": "uiType"
|
|
158
|
+
}],
|
|
159
|
+
"text": ""
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}; }
|
|
163
|
+
static get states() { return {
|
|
164
|
+
"ignored": {}
|
|
165
|
+
}; }
|
|
166
|
+
}
|
|
167
|
+
function useCustomFieldsDemo(props) {
|
|
168
|
+
return deepmerge({
|
|
169
|
+
loading: false,
|
|
170
|
+
value: "Custom Field Value",
|
|
171
|
+
fontSize: props.fontSize,
|
|
172
|
+
color: props.color,
|
|
173
|
+
fontWeight: props.fontWeight,
|
|
174
|
+
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
175
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useQuery, useUserIdentity } from "@saasquatch/component-boilerplate";
|
|
2
|
+
import { gql } from "graphql-request";
|
|
3
|
+
import { DateTime } from "luxon";
|
|
4
|
+
const GET_CUSTOM_FIELDS = gql `
|
|
5
|
+
query getCustomFields {
|
|
6
|
+
viewer {
|
|
7
|
+
... on User {
|
|
8
|
+
customFields
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
export function useUserAttribute(props) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const user = useUserIdentity();
|
|
16
|
+
const res = useQuery(GET_CUSTOM_FIELDS, {}, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
17
|
+
const loading = res.loading;
|
|
18
|
+
const customFields = (_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.viewer) === null || _b === void 0 ? void 0 : _b.customFields;
|
|
19
|
+
let value = customFields === null || customFields === void 0 ? void 0 : customFields[props.value];
|
|
20
|
+
if (props.value === "lastSeenDate" && typeof value === "number") {
|
|
21
|
+
value = DateTime.fromMillis(value).toLocaleString(DateTime.DATE_MED);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
loading,
|
|
25
|
+
value,
|
|
26
|
+
fontSize: props.fontSize,
|
|
27
|
+
color: props.color,
|
|
28
|
+
fontWeight: props.fontWeight,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -540,7 +540,7 @@ _, type, unit, status, global = "") => {
|
|
|
540
540
|
$programId: ID
|
|
541
541
|
$unit: String
|
|
542
542
|
$type: RewardType
|
|
543
|
-
$
|
|
543
|
+
$statusFilter: RewardStatusFilterInput
|
|
544
544
|
) {
|
|
545
545
|
viewer {
|
|
546
546
|
... on User {
|
|
@@ -549,7 +549,7 @@ _, type, unit, status, global = "") => {
|
|
|
549
549
|
programId_eq: $programId
|
|
550
550
|
type_eq: $type
|
|
551
551
|
unit_eq: $unit
|
|
552
|
-
|
|
552
|
+
statuses_eq: $statusFilter
|
|
553
553
|
}
|
|
554
554
|
) {
|
|
555
555
|
totalCount
|
|
@@ -575,14 +575,14 @@ const integrationRewardsCountFilteredQuery = (programId,
|
|
|
575
575
|
_, status, global = "") => {
|
|
576
576
|
const statusFilter = status ? { status } : null;
|
|
577
577
|
return debugQuery(dist.gql `
|
|
578
|
-
query ($programId: ID, $
|
|
578
|
+
query ($programId: ID, $statusFilter: RewardStatusFilterInput) {
|
|
579
579
|
viewer {
|
|
580
580
|
... on User {
|
|
581
581
|
rewards(
|
|
582
582
|
filter: {
|
|
583
583
|
programId_eq: $programId
|
|
584
584
|
type_eq: INTEGRATION
|
|
585
|
-
|
|
585
|
+
statuses_eq: $statusFilter
|
|
586
586
|
}
|
|
587
587
|
) {
|
|
588
588
|
totalCount
|
|
@@ -1081,7 +1081,8 @@ const rewardsBalanceQuery = (programId, locale, type, unit, format = "prettyValu
|
|
|
1081
1081
|
const fallback = (_c = res.data) === null || _c === void 0 ? void 0 : _c.fallback;
|
|
1082
1082
|
const balance = arr === null || arr === void 0 ? void 0 : arr[0];
|
|
1083
1083
|
const totalEarned = balance
|
|
1084
|
-
? (balance.totalAssignedCredit || 0) +
|
|
1084
|
+
? (balance.totalAssignedCredit || 0) +
|
|
1085
|
+
(balance.totalPendingCredit || 0)
|
|
1085
1086
|
: 0;
|
|
1086
1087
|
const result = wn(dist.gql `
|
|
1087
1088
|
query (
|
|
@@ -2300,7 +2301,7 @@ function CheckboxFieldView(props) {
|
|
|
2300
2301
|
h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
|
|
2301
2302
|
e.target.value = e.target.checked;
|
|
2302
2303
|
callbacks.setChecked(e.target.value);
|
|
2303
|
-
} }, (!content.checkboxOptional ? { required:
|
|
2304
|
+
} }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
|
|
2304
2305
|
if (!value && !content.checkboxOptional) {
|
|
2305
2306
|
return content.errorMessage;
|
|
2306
2307
|
}
|