@saasquatch/mint-components 1.15.0-117 → 1.15.0-118
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-f1bd9b26.js → ShadowViewAddon-8fed996f.js} +1 -1
- package/dist/cjs/sqm-big-stat_43.cjs.entry.js +2 -2
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -1
- package/dist/collection/components/sqm-leaderboard/sqm-leaderboard-view.js +1 -1
- package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list.js +1 -1
- package/dist/esm/{ShadowViewAddon-c0600f22.js → ShadowViewAddon-928bfc1a.js} +1 -1
- package/dist/esm/sqm-big-stat_43.entry.js +2 -2
- package/dist/esm/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/{ShadowViewAddon-c0600f22.js → ShadowViewAddon-928bfc1a.js} +1 -1
- package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -1
- 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-ed69dc98.system.entry.js → p-10507209.system.entry.js} +1 -1
- package/dist/mint-components/{p-be770d69.system.entry.js → p-3f1f78c0.system.entry.js} +1 -1
- package/dist/mint-components/{p-f9f67437.entry.js → p-56a5e3b2.entry.js} +1 -1
- package/dist/mint-components/{p-bdc86ee3.system.js → p-84a5b46a.system.js} +1 -1
- package/dist/mint-components/{p-1276830a.entry.js → p-a0c8162d.entry.js} +2 -2
- package/dist/mint-components/p-a89baf7b.system.js +1 -1
- package/dist/mint-components/{p-6b904749.js → p-d278519f.js} +1 -1
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/dist/cjs/RewardExchangeListData-a787ce54.js +0 -1144
- package/dist/cjs/copy-text-view-f0313f78.js +0 -121
- package/dist/cjs/sqm-coupon-code-view-a869384e.js +0 -35
- package/dist/cjs/sqm-coupon-code.cjs.entry.js +0 -285
- package/dist/cjs/sqm-referral-code.cjs.entry.js +0 -177
- package/dist/cjs/sqm-reward-exchange-list.cjs.entry.js +0 -1018
- package/dist/cjs/sqm-share-code.cjs.entry.js +0 -147
- package/dist/cjs/sqm-share-link.cjs.entry.js +0 -102
- package/dist/esm/RewardExchangeListData-11c043e3.js +0 -1122
- package/dist/esm/copy-text-view-3129fb22.js +0 -119
- package/dist/esm/sqm-coupon-code-view-af016712.js +0 -33
- package/dist/esm/sqm-coupon-code.entry.js +0 -281
- package/dist/esm/sqm-referral-code.entry.js +0 -173
- package/dist/esm/sqm-reward-exchange-list.entry.js +0 -1014
- package/dist/esm/sqm-share-code.entry.js +0 -143
- package/dist/esm/sqm-share-link.entry.js +0 -98
- package/dist/esm-es5/RewardExchangeListData-11c043e3.js +0 -1
- package/dist/esm-es5/copy-text-view-3129fb22.js +0 -1
- package/dist/esm-es5/sqm-coupon-code-view-af016712.js +0 -1
- package/dist/esm-es5/sqm-coupon-code.entry.js +0 -1
- package/dist/esm-es5/sqm-referral-code.entry.js +0 -1
- package/dist/esm-es5/sqm-reward-exchange-list.entry.js +0 -1
- package/dist/esm-es5/sqm-share-code.entry.js +0 -1
- package/dist/esm-es5/sqm-share-link.entry.js +0 -1
- package/dist/mint-components/RewardExchangeListData-11c043e3.js +0 -1122
- package/dist/mint-components/RewardExchangeListData-546ffbb9.system.js +0 -1
- package/dist/mint-components/copy-text-view-3129fb22.js +0 -119
- package/dist/mint-components/copy-text-view-33cac657.system.js +0 -1
- package/dist/mint-components/sqm-coupon-code-view-40fd8d8b.system.js +0 -1
- package/dist/mint-components/sqm-coupon-code-view-af016712.js +0 -33
- package/dist/mint-components/sqm-coupon-code.entry.js +0 -281
- package/dist/mint-components/sqm-coupon-code.system.entry.js +0 -1
- package/dist/mint-components/sqm-referral-code.entry.js +0 -173
- package/dist/mint-components/sqm-referral-code.system.entry.js +0 -1
- package/dist/mint-components/sqm-reward-exchange-list.entry.js +0 -1014
- package/dist/mint-components/sqm-reward-exchange-list.system.entry.js +0 -1
- package/dist/mint-components/sqm-share-code.entry.js +0 -143
- package/dist/mint-components/sqm-share-code.system.entry.js +0 -1
- package/dist/mint-components/sqm-share-link.entry.js +0 -98
- package/dist/mint-components/sqm-share-link.system.entry.js +0 -1
- package/dist/mint-components/sqm-stencilbook.entry.js +0 -20330
- package/dist/mint-components/sqm-stencilbook.system.entry.js +0 -1
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h as h$1 } from './index-bfb7f924.js';
|
|
2
|
-
import { i as useState, o as h } from './dom-context-hooks.module-01c1b885.js';
|
|
3
|
-
import { d as dist, H, J, B, F as Fn, w as wn, $ as $e, i as isDemo } from './index.module-83586215.js';
|
|
4
|
-
import './jss-preset-default.esm-c36417f8.js';
|
|
5
|
-
import './JSS-8c381d8b.js';
|
|
6
|
-
import './mixins-acc245cc.js';
|
|
7
|
-
import { g as getProps } from './utils-93e14db3.js';
|
|
8
|
-
import { c as cjs } from './cjs-e829b75b.js';
|
|
9
|
-
import { R as REFERRAL_CODES_NAMESPACE, S as SET_CODE_COPIED } from './useReferralCodes-ec892d5c.js';
|
|
10
|
-
import { C as CopyTextView } from './copy-text-view-3129fb22.js';
|
|
11
|
-
|
|
12
|
-
const MessageLinkQuery = dist.gql `
|
|
13
|
-
query getReferralCode($programId: ID) {
|
|
14
|
-
user: viewer {
|
|
15
|
-
... on User {
|
|
16
|
-
referralCode(programId: $programId)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
const WIDGET_ENGAGEMENT_EVENT = dist.gql `
|
|
22
|
-
mutation loadEvent($eventMeta: UserAnalyticsEvent!) {
|
|
23
|
-
createUserAnalyticsEvent(eventMeta: $eventMeta)
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
function useReferralCode(props) {
|
|
27
|
-
var _a, _b;
|
|
28
|
-
const { programId = H() } = props;
|
|
29
|
-
const user = J();
|
|
30
|
-
const engagementMedium = B();
|
|
31
|
-
const contextData = Fn(REFERRAL_CODES_NAMESPACE);
|
|
32
|
-
const { data } = wn(MessageLinkQuery, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || (contextData === null || contextData === void 0 ? void 0 : contextData.referralCode) !== undefined);
|
|
33
|
-
const [sendLoadEvent] = $e(WIDGET_ENGAGEMENT_EVENT);
|
|
34
|
-
const [setCopied] = $e(SET_CODE_COPIED);
|
|
35
|
-
const copyString = (_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.referralCode) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.referralCode))) !== null && _b !== void 0 ? _b :
|
|
36
|
-
// Shown during loading
|
|
37
|
-
"...";
|
|
38
|
-
const [open, setOpen] = useState(false);
|
|
39
|
-
async function onClick() {
|
|
40
|
-
if (contextData) {
|
|
41
|
-
await setCopied({ referralCode: contextData.referralCode });
|
|
42
|
-
contextData.refresh();
|
|
43
|
-
}
|
|
44
|
-
// Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
|
|
45
|
-
// Only if called from a user-initiated event
|
|
46
|
-
navigator.clipboard.writeText(copyString);
|
|
47
|
-
setOpen(true);
|
|
48
|
-
setTimeout(() => setOpen(false), props.tooltiplifespan);
|
|
49
|
-
sendLoadEvent({
|
|
50
|
-
eventMeta: {
|
|
51
|
-
programId,
|
|
52
|
-
id: user === null || user === void 0 ? void 0 : user.id,
|
|
53
|
-
accountId: user === null || user === void 0 ? void 0 : user.accountId,
|
|
54
|
-
type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
|
|
55
|
-
meta: {
|
|
56
|
-
engagementMedium,
|
|
57
|
-
shareMedium: "DIRECT",
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
...props,
|
|
64
|
-
onClick,
|
|
65
|
-
open,
|
|
66
|
-
copyString: copyString,
|
|
67
|
-
isCopied: contextData === null || contextData === void 0 ? void 0 : contextData.isCopied,
|
|
68
|
-
showNotificationText: props.showNotificationText && !!(contextData === null || contextData === void 0 ? void 0 : contextData.singleUse),
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const ReferralCode = class {
|
|
73
|
-
constructor(hostRef) {
|
|
74
|
-
registerInstance(this, hostRef);
|
|
75
|
-
/**
|
|
76
|
-
* Shown inside a tooltip after someone has successfully copied the link to their clipboard
|
|
77
|
-
*
|
|
78
|
-
* @uiName Tooltip text
|
|
79
|
-
*/
|
|
80
|
-
this.tooltiptext = "Copied to Clipboard";
|
|
81
|
-
/**
|
|
82
|
-
* Boolean used to show notification text below input
|
|
83
|
-
*
|
|
84
|
-
* @uiName Show notification text
|
|
85
|
-
*/
|
|
86
|
-
this.showNotificationText = false;
|
|
87
|
-
/**
|
|
88
|
-
* Shown underneath single-use promo codes when the user has already copied the code
|
|
89
|
-
*
|
|
90
|
-
* @uiName Notification text
|
|
91
|
-
*/
|
|
92
|
-
this.notificationText = "You've copied this code before";
|
|
93
|
-
/**
|
|
94
|
-
* The number of milliseconds that the tooltip appears for
|
|
95
|
-
*
|
|
96
|
-
* @uiName Tooltip lifespan
|
|
97
|
-
*/
|
|
98
|
-
this.tooltiplifespan = 1000;
|
|
99
|
-
/**
|
|
100
|
-
* Change the text alignment
|
|
101
|
-
*
|
|
102
|
-
* @uiName Referral code alignment
|
|
103
|
-
* @uiType string
|
|
104
|
-
* @uiEnum ["left", "center", "right"]
|
|
105
|
-
* @uiEnumNames ["Left", "Center", "Right"]
|
|
106
|
-
* @uiGroup Style
|
|
107
|
-
*/
|
|
108
|
-
this.textAlign = "left";
|
|
109
|
-
/**
|
|
110
|
-
* @uiName Copy button label
|
|
111
|
-
*/
|
|
112
|
-
this.copyButtonLabel = "Copy Code";
|
|
113
|
-
/**
|
|
114
|
-
* Set the copy button style and placement
|
|
115
|
-
*
|
|
116
|
-
* @uiName Style
|
|
117
|
-
* @uiType string
|
|
118
|
-
* @uiEnum ["icon", "button-outside", "button-below"]
|
|
119
|
-
* @uiEnumNames ["Icon", "Button outside", "Button below"]
|
|
120
|
-
* @uiGroup Style
|
|
121
|
-
*/
|
|
122
|
-
this.buttonStyle = "icon";
|
|
123
|
-
/**
|
|
124
|
-
* The type of the button that is used (primary or secondary).
|
|
125
|
-
* @uiName Button Type
|
|
126
|
-
* @uiType string
|
|
127
|
-
* @uiEnum ["primary", "secondary"]
|
|
128
|
-
* @uiEnumNames ["Primary", "Secondary"]
|
|
129
|
-
* @uiGroup Style
|
|
130
|
-
*/
|
|
131
|
-
this.buttonType = "primary";
|
|
132
|
-
h(this);
|
|
133
|
-
}
|
|
134
|
-
disconnectedCallback() { }
|
|
135
|
-
render() {
|
|
136
|
-
const thisProps = getProps(this);
|
|
137
|
-
const props = isDemo()
|
|
138
|
-
? useDemoReferralCode(thisProps)
|
|
139
|
-
: useReferralCode(thisProps);
|
|
140
|
-
return h$1(CopyTextView, Object.assign({}, props));
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
function useDemoReferralCode(props) {
|
|
144
|
-
const [open, setOpen] = useState(false);
|
|
145
|
-
const copyString = "REFERRALCODE001";
|
|
146
|
-
return cjs({
|
|
147
|
-
copyString: copyString,
|
|
148
|
-
tooltiptext: props.tooltiptext,
|
|
149
|
-
textAlign: props.textAlign,
|
|
150
|
-
copyButtonLabel: props.copyButtonLabel,
|
|
151
|
-
buttonStyle: props.buttonStyle,
|
|
152
|
-
notificationText: props.notificationText,
|
|
153
|
-
showNotificationText: props.showNotificationText,
|
|
154
|
-
isCopied: props.showNotificationText,
|
|
155
|
-
borderColor: props.borderColor,
|
|
156
|
-
backgroundColor: props.backgroundColor,
|
|
157
|
-
textColor: props.textColor,
|
|
158
|
-
borderRadius: props.borderRadius,
|
|
159
|
-
buttonType: props.buttonType,
|
|
160
|
-
isUsed: false,
|
|
161
|
-
rewardStatus: "AVAILABLE",
|
|
162
|
-
open,
|
|
163
|
-
onClick: () => {
|
|
164
|
-
// Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
|
|
165
|
-
// Only if called from a user-initiated event
|
|
166
|
-
navigator.clipboard.writeText(copyString);
|
|
167
|
-
setOpen(true);
|
|
168
|
-
setTimeout(() => setOpen(false), props.tooltiplifespan);
|
|
169
|
-
},
|
|
170
|
-
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export { ReferralCode as sqm_referral_code };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject=this&&this.__makeTemplateObject||function(e,t){if(Object.defineProperty){Object.defineProperty(e,"raw",{value:t})}else{e.raw=t}return e};var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))e[o]=t[o]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r["throw"](e))}catch(e){i(e)}}function l(e){e.done?n(e.value):o(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return l([e,t])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;o=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){n.label=a[1];break}if(a[0]===6&&n.label<i[1]){n.label=i[1];i=a;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(a);break}if(i[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./index-bfed5e90.system.js","./dom-context-hooks.module-7cdc0e68.system.js","./index.module-3ae23e6a.system.js","./jss-preset-default.esm-62a04d6d.system.js","./JSS-840a8fea.system.js","./mixins-8c4521b7.system.js","./utils-e473b250.system.js","./cjs-f0ef8d23.system.js","./useReferralCodes-c5a6014c.system.js","./copy-text-view-33cac657.system.js"],(function(e){"use strict";var t,n,r,o,i,a,s,l,u,c,f,d,p,v,y,h,b;return{setters:[function(e){t=e.r;n=e.h},function(e){r=e.i;o=e.o},function(e){i=e.d;a=e.H;s=e.J;l=e.B;u=e.F;c=e.w;f=e.$;d=e.i},function(){},function(){},function(){},function(e){p=e.g},function(e){v=e.c},function(e){y=e.R;h=e.S},function(e){b=e.C}],execute:function(){var m=i.gql(__makeTemplateObject(["\n query getReferralCode($programId: ID) {\n user: viewer {\n ... on User {\n referralCode(programId: $programId)\n }\n }\n }\n"],["\n query getReferralCode($programId: ID) {\n user: viewer {\n ... on User {\n referralCode(programId: $programId)\n }\n }\n }\n"]));var g=i.gql(__makeTemplateObject(["\n mutation loadEvent($eventMeta: UserAnalyticsEvent!) {\n createUserAnalyticsEvent(eventMeta: $eventMeta)\n }\n"],["\n mutation loadEvent($eventMeta: UserAnalyticsEvent!) {\n createUserAnalyticsEvent(eventMeta: $eventMeta)\n }\n"]));function _(e){var t,n;var o=e.programId,i=o===void 0?a():o;var d=s();var p=l();var v=u(y);var b=c(m,{programId:i},!(d===null||d===void 0?void 0:d.jwt)||(v===null||v===void 0?void 0:v.referralCode)!==undefined).data;var _=f(g)[0];var w=f(h)[0];var x=(n=(v===null||v===void 0?void 0:v.referralCode)||((t=b===null||b===void 0?void 0:b.user)===null||t===void 0?void 0:t.referralCode))!==null&&n!==void 0?n:"...";var C=r(false),T=C[0],j=C[1];function E(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!v)return[3,2];return[4,w({referralCode:v.referralCode})];case 1:t.sent();v.refresh();t.label=2;case 2:navigator.clipboard.writeText(x);j(true);setTimeout((function(){return j(false)}),e.tooltiplifespan);_({eventMeta:{programId:i,id:d===null||d===void 0?void 0:d.id,accountId:d===null||d===void 0?void 0:d.accountId,type:"USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",meta:{engagementMedium:p,shareMedium:"DIRECT"}}});return[2]}}))}))}return __assign(__assign({},e),{onClick:E,open:T,copyString:x,isCopied:v===null||v===void 0?void 0:v.isCopied,showNotificationText:e.showNotificationText&&!!(v===null||v===void 0?void 0:v.singleUse)})}var w=e("sqm_referral_code",function(){function e(e){t(this,e);this.tooltiptext="Copied to Clipboard";this.showNotificationText=false;this.notificationText="You've copied this code before";this.tooltiplifespan=1e3;this.textAlign="left";this.copyButtonLabel="Copy Code";this.buttonStyle="icon";this.buttonType="primary";o(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=p(this);var t=d()?x(e):_(e);return n(b,Object.assign({},t))};return e}());function x(e){var t=r(false),n=t[0],o=t[1];var i="REFERRALCODE001";return v({copyString:i,tooltiptext:e.tooltiptext,textAlign:e.textAlign,copyButtonLabel:e.copyButtonLabel,buttonStyle:e.buttonStyle,notificationText:e.notificationText,showNotificationText:e.showNotificationText,isCopied:e.showNotificationText,borderColor:e.borderColor,backgroundColor:e.backgroundColor,textColor:e.textColor,borderRadius:e.borderRadius,buttonType:e.buttonType,isUsed:false,rewardStatus:"AVAILABLE",open:n,onClick:function(){navigator.clipboard.writeText(i);o(true);setTimeout((function(){return o(false)}),e.tooltiplifespan)}},e.demoData||{},{arrayMerge:function(e,t){return t}})}}}}));
|