@saasquatch/vanilla-components 1.2.4 → 1.2.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.
Files changed (84) hide show
  1. package/dist/cjs/{WidgetHost-d7b870ce.js → WidgetHost-fce29ef5.js} +420 -420
  2. package/dist/cjs/sqh-close-button.cjs.entry.js +25 -25
  3. package/dist/cjs/sqh-copy-button_12.cjs.entry.js +870 -971
  4. package/dist/cjs/sqh-referral-code.cjs.entry.js +22 -22
  5. package/dist/cjs/sqh-rewards-actions.cjs.entry.js +26 -26
  6. package/dist/collection/components/close-button/close-button.js +68 -68
  7. package/dist/collection/components/copy-button/copy-button.js +358 -358
  8. package/dist/collection/components/copy-link-button/copy-link-button.js +215 -215
  9. package/dist/collection/components/global-container/global-container.js +151 -151
  10. package/dist/collection/components/image-component/image-component.js +165 -165
  11. package/dist/collection/components/partner-stat-component/partner-stat-component.js +194 -194
  12. package/dist/collection/components/referral-code/referral-code.js +36 -36
  13. package/dist/collection/components/referral-component/referral-component.js +255 -255
  14. package/dist/collection/components/referral-list/referral-list.js +860 -860
  15. package/dist/collection/components/rewards-actions/rewards-actions.js +105 -105
  16. package/dist/collection/components/share-button/share-button.js +282 -282
  17. package/dist/collection/components/share-button-container/share-button-container.js +2384 -2384
  18. package/dist/collection/components/stat-component/stat-component.js +194 -194
  19. package/dist/collection/components/stats-container/stats-container.js +206 -206
  20. package/dist/collection/components/text-component/text-component.js +291 -291
  21. package/dist/collection/global/global.js +4 -4
  22. package/dist/collection/services/FormatJs.js +15 -15
  23. package/dist/collection/services/WidgetHost.js +426 -426
  24. package/dist/collection/utilities.js +81 -81
  25. package/dist/esm/{WidgetHost-a27e693d.js → WidgetHost-903fb7cc.js} +420 -420
  26. package/dist/esm/polyfills/core-js.js +0 -0
  27. package/dist/esm/polyfills/dom.js +0 -0
  28. package/dist/esm/polyfills/es5-html-element.js +0 -0
  29. package/dist/esm/polyfills/index.js +0 -0
  30. package/dist/esm/polyfills/system.js +0 -0
  31. package/dist/esm/sqh-close-button.entry.js +25 -25
  32. package/dist/esm/sqh-copy-button_12.entry.js +870 -971
  33. package/dist/esm/sqh-referral-code.entry.js +22 -22
  34. package/dist/esm/sqh-rewards-actions.entry.js +26 -26
  35. package/dist/esm-es5/{WidgetHost-a27e693d.js → WidgetHost-903fb7cc.js} +9432 -9432
  36. package/dist/esm-es5/_commonjsHelpers-1d681858.js +17 -17
  37. package/dist/esm-es5/css-shim-a659079f.js +122 -122
  38. package/dist/esm-es5/dom-4061ceba.js +468 -468
  39. package/dist/esm-es5/en-be593af0.js +1471 -1471
  40. package/dist/esm-es5/index-8ea8b6d8.js +1758 -1758
  41. package/dist/esm-es5/loader.mjs +11 -11
  42. package/dist/esm-es5/sqh-close-button.entry.js +35 -35
  43. package/dist/esm-es5/sqh-copy-button_12.entry.js +9535 -9624
  44. package/dist/esm-es5/sqh-referral-code.entry.js +29 -29
  45. package/dist/esm-es5/sqh-rewards-actions.entry.js +31 -31
  46. package/dist/esm-es5/widget-components.mjs +6 -6
  47. package/dist/types/components/close-button/close-button.d.ts +16 -16
  48. package/dist/types/components/copy-button/copy-button.d.ts +90 -90
  49. package/dist/types/components/copy-link-button/copy-link-button.d.ts +53 -53
  50. package/dist/types/components/global-container/global-container.d.ts +39 -39
  51. package/dist/types/components/image-component/image-component.d.ts +45 -45
  52. package/dist/types/components/partner-stat-component/partner-stat-component.d.ts +51 -51
  53. package/dist/types/components/referral-code/referral-code.d.ts +12 -12
  54. package/dist/types/components/referral-component/referral-component.d.ts +46 -46
  55. package/dist/types/components/referral-list/referral-list.d.ts +234 -234
  56. package/dist/types/components/rewards-actions/rewards-actions.d.ts +25 -25
  57. package/dist/types/components/share-button/share-button.d.ts +77 -77
  58. package/dist/types/components/share-button-container/share-button-container.d.ts +593 -593
  59. package/dist/types/components/stat-component/stat-component.d.ts +48 -48
  60. package/dist/types/components/stats-container/stats-container.d.ts +47 -47
  61. package/dist/types/components/text-component/text-component.d.ts +74 -74
  62. package/dist/types/components.d.ts +6 -6
  63. package/dist/types/global/global.d.ts +4 -4
  64. package/dist/types/services/FormatJs.d.ts +7 -7
  65. package/dist/types/services/WidgetHost.d.ts +45 -45
  66. package/dist/types/utilities.d.ts +7 -7
  67. package/dist/widget-components/{p-650d012d.entry.js → p-131a5c4a.entry.js} +1 -1
  68. package/dist/widget-components/p-1b8f2cfc.system.entry.js +8 -0
  69. package/dist/widget-components/p-24fc4ba9.js +1 -1
  70. package/dist/widget-components/p-46109683.js +3 -3
  71. package/dist/widget-components/{p-d4b27c72.entry.js → p-50ae8f2b.entry.js} +1 -1
  72. package/dist/widget-components/p-58be1132.system.js +1 -1
  73. package/dist/widget-components/{p-0bfec452.entry.js → p-8baa34a0.entry.js} +16 -16
  74. package/dist/widget-components/{p-c0cdba77.system.entry.js → p-b9fcb846.system.entry.js} +1 -1
  75. package/dist/widget-components/p-da180bcd.system.entry.js +1 -0
  76. package/dist/widget-components/{p-9adc7c50.system.js → p-e692beaf.system.js} +0 -0
  77. package/dist/widget-components/{p-9525bf4a.js → p-ffeb02d1.js} +0 -0
  78. package/dist/widget-components/widget-components.esm.js +1 -1
  79. package/dist/widget-components/widget-components.js +1 -1
  80. package/docs/raisins.json +1 -1
  81. package/package.json +1 -1
  82. package/CHANGELOG.md +0 -163
  83. package/dist/widget-components/p-796dc228.system.entry.js +0 -8
  84. package/dist/widget-components/p-908068c2.system.entry.js +0 -1
@@ -9908,293 +9908,293 @@ gql.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables;
9908
9908
 
9909
9909
  var src = gql;
9910
9910
 
9911
- if (!window["widgetIdent"]) {
9912
- window["widgetIdent"] = {
9913
- env: "demo",
9914
- };
9915
- }
9916
- function widgetIdent() {
9917
- //@ts-ignore
9918
- return window.widgetIdent;
9919
- }
9920
- const today = new Date();
9921
- const demoUser = {
9922
- shareLink: "http://ssqt.co",
9923
- fueltankCode: "12AS3F",
9924
- referralcode: "RIDDIKULUS",
9925
- locale: "en_US",
9926
- messageLink: {
9927
- EMAIL: "http://short.staging.referralsaasquatch.com/mJjFXu",
9928
- FACEBOOK: "http://short.staging.referralsaasquatch.com/mwjFXu",
9929
- TWITTER: "http://short.staging.referralsaasquatch.com/mwjFXu",
9930
- SMS: "http://short.staging.referralsaasquatch.com/mwjFXu",
9931
- WHATSAPP: "http://short.staging.referralsaasquatch.com/mwjFXu",
9932
- LINKEDIN: "http://short.staging.referralsaasquatch.com/mwjFXu",
9933
- PINTEREST: "http://short.staging.referralsaasquatch.com/mwjFXu",
9934
- FBMESSENGER: "http://short.staging.referralsaasquatch.com/mwjFXu",
9935
- },
9936
- referrals: {
9937
- totalCount: 9,
9938
- data: [
9939
- {
9940
- dateReferralStarted: today.setDate(today.getDate() - 2),
9941
- referredUser: { firstName: "Remus", lastName: "Lupin" },
9942
- rewards: [
9943
- {
9944
- prettyValue: "$20.00",
9945
- dateExpires: today.setDate(today.getDate() + 4),
9946
- statuses: ["EXPIRED"],
9947
- meta: { message: "Applied to Invoice #1234" },
9948
- },
9949
- { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
9950
- { prettyValue: "$5.00", statuses: ["AVAILABLE"] },
9951
- ],
9952
- },
9953
- {
9954
- dateReferralStarted: today.setDate(today.getDate() - 1),
9955
- referredUser: { firstName: "Gellert", lastName: "Grindelwald" },
9956
- rewards: [],
9957
- },
9958
- // Blank string becomes an unknown user, which is editable
9959
- {
9960
- dateReferralStarted: today.setDate(today.getDate() - 1),
9961
- referredUser: { firstName: "", lastName: "" },
9962
- rewards: [
9963
- {
9964
- prettyValue: "$20.00",
9965
- dateExpires: today.setDate(today.getDate() - 2),
9966
- statuses: ["EXPIRED"],
9967
- },
9968
- ],
9969
- },
9970
- {
9971
- dateReferralStarted: today.setDate(today.getDate() - 5),
9972
- referredUser: { firstName: "Lavender", lastName: "Brown" },
9973
- rewards: [{ prettyValue: "$20.00", statuses: ["CANCELLED"] }],
9974
- },
9975
- {
9976
- dateReferralStarted: today.setDate(today.getDate() - 4),
9977
- referredUser: { firstName: "Blaise", lastName: "Zabini" },
9978
- rewards: [
9979
- { prettyValue: "$20.00", statuses: ["AVAILABLE"] },
9980
- { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
9981
- ],
9982
- },
9983
- {
9984
- dateReferralStarted: today.setDate(today.getDate() - 10),
9985
- referredUser: { firstName: "Argus", lastName: "Filch" },
9986
- rewards: [],
9987
- },
9988
- {
9989
- dateReferralStarted: today.setDate(today.getDate() - 15),
9990
- referredUser: { firstName: "Ron", lastName: "Weasley" },
9991
- rewards: [{ prettyValue: "$20.00", statuses: ["AVAILABLE"] }],
9992
- },
9993
- {
9994
- dateReferralStarted: today.setDate(today.getDate() - 2),
9995
- referredUser: { firstName: "Hermione", lastName: "Granger" },
9996
- rewards: [
9997
- { prettyValue: "$20.00", statuses: ["AVAILABLE"] },
9998
- { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
9999
- { prettyValue: "$5.00", statuses: ["AVAILABLE"] },
10000
- { prettyValue: "5%", statuses: ["AVAILABLE"] },
10001
- { prettyValue: "5%", statuses: ["AVAILABLE"] },
10002
- { prettyValue: "5%", statuses: ["AVAILABLE"] },
10003
- ],
10004
- },
10005
- {
10006
- dateConverted: 1606943971468,
10007
- dateReferralStarted: 1606943971468,
10008
- referredUser: {
10009
- imageUrl: "",
10010
- firstName: "Seamus",
10011
- lastName: "Finnigan",
10012
- },
10013
- rewards: [],
10014
- },
10015
- ],
10016
- },
10017
- referredByReferral: {
10018
- dateReferralStarted: today.setDate(today.getDate() - 2),
10019
- referrerUser: {
10020
- firstName: "Rubeus",
10021
- lastName: "Hagrid",
10022
- referralCode: "RUBEUSHAGRID12",
10023
- },
10024
- rewards: [
10025
- {
10026
- fuelTankCode: "CODE1234",
10027
- prettyValue: "$10.00",
10028
- statuses: ["AVAILABLE"],
10029
- },
10030
- ],
10031
- },
10032
- referralsMonth: { totalCount: 6 },
10033
- referralsWeek: { totalCount: 3 },
10034
- rewardsCount: { totalCount: 14 },
10035
- rewardsMonth: { totalCount: 7 },
10036
- rewardsWeek: { totalCount: 4 },
10037
- rewardBalancesGlobal: [
10038
- {
10039
- type: "CREDIT",
10040
- unit: "CENTS",
10041
- value: 17000,
10042
- prettyValue: "$170.00",
10043
- totalAssignedCredit: "17000",
10044
- totalRedeemedCredit: "1500",
10045
- prettyAssignedCredit: "$1000.00",
10046
- prettyRedeemedCredit: "$15.00",
10047
- },
10048
- { type: "PCT_DISCOUNT", unit: "%", value: 15, prettyValue: "15%" },
10049
- {
10050
- type: "CREDIT",
10051
- unit: "CASH/CAD",
10052
- count: 3,
10053
- totalPendingCredit: 20000,
10054
- totalAssignedCredit: 30000,
10055
- totalRedeemedCredit: 10000,
10056
- totalExpiredCredit: 0,
10057
- totalCancelledCredit: 0,
10058
- prettyPendingCredit: "$200.00",
10059
- prettyAssignedCredit: "$300.00",
10060
- prettyRedeemedCredit: "$100.00",
10061
- value: 30000,
10062
- prettyValue: "$300.00",
10063
- },
10064
- {
10065
- type: "CREDIT",
10066
- unit: "CASH/USD",
10067
- count: 6,
10068
- totalPendingCredit: 25000,
10069
- totalAssignedCredit: 40000,
10070
- totalRedeemedCredit: 10000,
10071
- totalExpiredCredit: 15000,
10072
- totalCancelledCredit: 10000,
10073
- prettyPendingCredit: "USD250.00",
10074
- prettyAssignedCredit: "USD400.00",
10075
- prettyRedeemedCredit: "USD150.00",
10076
- value: 40000,
10077
- prettyValue: "USD400.00",
10078
- },
10079
- ],
10080
- rewardBalances: [
10081
- {
10082
- type: "CREDIT",
10083
- unit: "CENTS",
10084
- value: 17000,
10085
- prettyValue: "$170.00",
10086
- totalAssignedCredit: "17000",
10087
- totalRedeemedCredit: "1500",
10088
- prettyAssignedCredit: "$170.00",
10089
- prettyRedeemedCredit: "$15.00",
10090
- },
10091
- { type: "PCT_DISCOUNT", unit: "%", value: 15, prettyValue: "15%" },
10092
- {
10093
- type: "CREDIT",
10094
- unit: "CASH/CAD",
10095
- count: 3,
10096
- totalPendingCredit: 20000,
10097
- totalAssignedCredit: 30000,
10098
- totalRedeemedCredit: 10000,
10099
- totalExpiredCredit: 0,
10100
- totalCancelledCredit: 0,
10101
- prettyPendingCredit: "$200.00",
10102
- prettyAssignedCredit: "$300.00",
10103
- prettyRedeemedCredit: "$100.00",
10104
- value: 30000,
10105
- prettyValue: "$300.00",
10106
- },
10107
- {
10108
- type: "CREDIT",
10109
- unit: "CASH/USD",
10110
- count: 6,
10111
- totalPendingCredit: 25000,
10112
- totalAssignedCredit: 40000,
10113
- totalRedeemedCredit: 10000,
10114
- totalExpiredCredit: 15000,
10115
- totalCancelledCredit: 10000,
10116
- prettyPendingCredit: "USD250.00",
10117
- prettyAssignedCredit: "USD400.00",
10118
- prettyRedeemedCredit: "USD150.00",
10119
- value: 40000,
10120
- prettyValue: "USD400.00",
10121
- },
10122
- ],
10123
- rewardBalanceDetails: [
10124
- {
10125
- prettyAvailableValue: "$5.00",
10126
- },
10127
- {
10128
- prettyAvailableValue: "18%",
10129
- },
10130
- ],
10131
- };
10132
- //@ts-ignore
10133
- const squatchJsApi = window.frameElement
10134
- ? window.frameElement.squatchJsApi
10135
- : {};
10136
- const apolloClient = () => {
10137
- const { tenantAlias, appDomain, token } = widgetIdent();
10138
- const uri = appDomain + "/api/v1/" + tenantAlias + "/graphql";
10139
- const headers = {
10140
- Authorization: `Bearer ${token}`,
10141
- };
10142
- const client = new ApolloClient({
10143
- link: new HttpLink({ uri, headers }),
10144
- cache: new InMemoryCache(),
10145
- });
10146
- return client;
10147
- };
10148
- const API = {
10149
- version: "Welcome to widget-host",
10150
- analytics: {
10151
- shareEvent(shareMedium) {
10152
- const widgetId = widgetIdent();
10153
- if (widgetId["env"] === "demo" || !widgetId)
10154
- return Promise.resolve({});
10155
- const { userId, accountId, programId = "classic", engagementMedium, } = widgetId;
10156
- const variables = {
10157
- eventMeta: {
10158
- id: userId,
10159
- accountId,
10160
- programId,
10161
- type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
10162
- meta: {
10163
- engagementMedium,
10164
- shareMedium,
10165
- },
10166
- },
10167
- };
10168
- return apolloClient()
10169
- .mutate({
9911
+ if (!window["widgetIdent"]) {
9912
+ window["widgetIdent"] = {
9913
+ env: "demo",
9914
+ };
9915
+ }
9916
+ function widgetIdent() {
9917
+ //@ts-ignore
9918
+ return window.widgetIdent;
9919
+ }
9920
+ const today = new Date();
9921
+ const demoUser = {
9922
+ shareLink: "http://ssqt.co",
9923
+ fueltankCode: "12AS3F",
9924
+ referralcode: "RIDDIKULUS",
9925
+ locale: "en_US",
9926
+ messageLink: {
9927
+ EMAIL: "http://short.staging.referralsaasquatch.com/mJjFXu",
9928
+ FACEBOOK: "http://short.staging.referralsaasquatch.com/mwjFXu",
9929
+ TWITTER: "http://short.staging.referralsaasquatch.com/mwjFXu",
9930
+ SMS: "http://short.staging.referralsaasquatch.com/mwjFXu",
9931
+ WHATSAPP: "http://short.staging.referralsaasquatch.com/mwjFXu",
9932
+ LINKEDIN: "http://short.staging.referralsaasquatch.com/mwjFXu",
9933
+ PINTEREST: "http://short.staging.referralsaasquatch.com/mwjFXu",
9934
+ FBMESSENGER: "http://short.staging.referralsaasquatch.com/mwjFXu",
9935
+ },
9936
+ referrals: {
9937
+ totalCount: 9,
9938
+ data: [
9939
+ {
9940
+ dateReferralStarted: today.setDate(today.getDate() - 2),
9941
+ referredUser: { firstName: "Remus", lastName: "Lupin" },
9942
+ rewards: [
9943
+ {
9944
+ prettyValue: "$20.00",
9945
+ dateExpires: today.setDate(today.getDate() + 4),
9946
+ statuses: ["EXPIRED"],
9947
+ meta: { message: "Applied to Invoice #1234" },
9948
+ },
9949
+ { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
9950
+ { prettyValue: "$5.00", statuses: ["AVAILABLE"] },
9951
+ ],
9952
+ },
9953
+ {
9954
+ dateReferralStarted: today.setDate(today.getDate() - 1),
9955
+ referredUser: { firstName: "Gellert", lastName: "Grindelwald" },
9956
+ rewards: [],
9957
+ },
9958
+ // Blank string becomes an unknown user, which is editable
9959
+ {
9960
+ dateReferralStarted: today.setDate(today.getDate() - 1),
9961
+ referredUser: { firstName: "", lastName: "" },
9962
+ rewards: [
9963
+ {
9964
+ prettyValue: "$20.00",
9965
+ dateExpires: today.setDate(today.getDate() - 2),
9966
+ statuses: ["EXPIRED"],
9967
+ },
9968
+ ],
9969
+ },
9970
+ {
9971
+ dateReferralStarted: today.setDate(today.getDate() - 5),
9972
+ referredUser: { firstName: "Lavender", lastName: "Brown" },
9973
+ rewards: [{ prettyValue: "$20.00", statuses: ["CANCELLED"] }],
9974
+ },
9975
+ {
9976
+ dateReferralStarted: today.setDate(today.getDate() - 4),
9977
+ referredUser: { firstName: "Blaise", lastName: "Zabini" },
9978
+ rewards: [
9979
+ { prettyValue: "$20.00", statuses: ["AVAILABLE"] },
9980
+ { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
9981
+ ],
9982
+ },
9983
+ {
9984
+ dateReferralStarted: today.setDate(today.getDate() - 10),
9985
+ referredUser: { firstName: "Argus", lastName: "Filch" },
9986
+ rewards: [],
9987
+ },
9988
+ {
9989
+ dateReferralStarted: today.setDate(today.getDate() - 15),
9990
+ referredUser: { firstName: "Ron", lastName: "Weasley" },
9991
+ rewards: [{ prettyValue: "$20.00", statuses: ["AVAILABLE"] }],
9992
+ },
9993
+ {
9994
+ dateReferralStarted: today.setDate(today.getDate() - 2),
9995
+ referredUser: { firstName: "Hermione", lastName: "Granger" },
9996
+ rewards: [
9997
+ { prettyValue: "$20.00", statuses: ["AVAILABLE"] },
9998
+ { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
9999
+ { prettyValue: "$5.00", statuses: ["AVAILABLE"] },
10000
+ { prettyValue: "5%", statuses: ["AVAILABLE"] },
10001
+ { prettyValue: "5%", statuses: ["AVAILABLE"] },
10002
+ { prettyValue: "5%", statuses: ["AVAILABLE"] },
10003
+ ],
10004
+ },
10005
+ {
10006
+ dateConverted: 1606943971468,
10007
+ dateReferralStarted: 1606943971468,
10008
+ referredUser: {
10009
+ imageUrl: "",
10010
+ firstName: "Seamus",
10011
+ lastName: "Finnigan",
10012
+ },
10013
+ rewards: [],
10014
+ },
10015
+ ],
10016
+ },
10017
+ referredByReferral: {
10018
+ dateReferralStarted: today.setDate(today.getDate() - 2),
10019
+ referrerUser: {
10020
+ firstName: "Rubeus",
10021
+ lastName: "Hagrid",
10022
+ referralCode: "RUBEUSHAGRID12",
10023
+ },
10024
+ rewards: [
10025
+ {
10026
+ fuelTankCode: "CODE1234",
10027
+ prettyValue: "$10.00",
10028
+ statuses: ["AVAILABLE"],
10029
+ },
10030
+ ],
10031
+ },
10032
+ referralsMonth: { totalCount: 6 },
10033
+ referralsWeek: { totalCount: 3 },
10034
+ rewardsCount: { totalCount: 14 },
10035
+ rewardsMonth: { totalCount: 7 },
10036
+ rewardsWeek: { totalCount: 4 },
10037
+ rewardBalancesGlobal: [
10038
+ {
10039
+ type: "CREDIT",
10040
+ unit: "CENTS",
10041
+ value: 17000,
10042
+ prettyValue: "$170.00",
10043
+ totalAssignedCredit: "17000",
10044
+ totalRedeemedCredit: "1500",
10045
+ prettyAssignedCredit: "$1000.00",
10046
+ prettyRedeemedCredit: "$15.00",
10047
+ },
10048
+ { type: "PCT_DISCOUNT", unit: "%", value: 15, prettyValue: "15%" },
10049
+ {
10050
+ type: "CREDIT",
10051
+ unit: "CASH/CAD",
10052
+ count: 3,
10053
+ totalPendingCredit: 20000,
10054
+ totalAssignedCredit: 30000,
10055
+ totalRedeemedCredit: 10000,
10056
+ totalExpiredCredit: 0,
10057
+ totalCancelledCredit: 0,
10058
+ prettyPendingCredit: "$200.00",
10059
+ prettyAssignedCredit: "$300.00",
10060
+ prettyRedeemedCredit: "$100.00",
10061
+ value: 30000,
10062
+ prettyValue: "$300.00",
10063
+ },
10064
+ {
10065
+ type: "CREDIT",
10066
+ unit: "CASH/USD",
10067
+ count: 6,
10068
+ totalPendingCredit: 25000,
10069
+ totalAssignedCredit: 40000,
10070
+ totalRedeemedCredit: 10000,
10071
+ totalExpiredCredit: 15000,
10072
+ totalCancelledCredit: 10000,
10073
+ prettyPendingCredit: "USD250.00",
10074
+ prettyAssignedCredit: "USD400.00",
10075
+ prettyRedeemedCredit: "USD150.00",
10076
+ value: 40000,
10077
+ prettyValue: "USD400.00",
10078
+ },
10079
+ ],
10080
+ rewardBalances: [
10081
+ {
10082
+ type: "CREDIT",
10083
+ unit: "CENTS",
10084
+ value: 17000,
10085
+ prettyValue: "$170.00",
10086
+ totalAssignedCredit: "17000",
10087
+ totalRedeemedCredit: "1500",
10088
+ prettyAssignedCredit: "$170.00",
10089
+ prettyRedeemedCredit: "$15.00",
10090
+ },
10091
+ { type: "PCT_DISCOUNT", unit: "%", value: 15, prettyValue: "15%" },
10092
+ {
10093
+ type: "CREDIT",
10094
+ unit: "CASH/CAD",
10095
+ count: 3,
10096
+ totalPendingCredit: 20000,
10097
+ totalAssignedCredit: 30000,
10098
+ totalRedeemedCredit: 10000,
10099
+ totalExpiredCredit: 0,
10100
+ totalCancelledCredit: 0,
10101
+ prettyPendingCredit: "$200.00",
10102
+ prettyAssignedCredit: "$300.00",
10103
+ prettyRedeemedCredit: "$100.00",
10104
+ value: 30000,
10105
+ prettyValue: "$300.00",
10106
+ },
10107
+ {
10108
+ type: "CREDIT",
10109
+ unit: "CASH/USD",
10110
+ count: 6,
10111
+ totalPendingCredit: 25000,
10112
+ totalAssignedCredit: 40000,
10113
+ totalRedeemedCredit: 10000,
10114
+ totalExpiredCredit: 15000,
10115
+ totalCancelledCredit: 10000,
10116
+ prettyPendingCredit: "USD250.00",
10117
+ prettyAssignedCredit: "USD400.00",
10118
+ prettyRedeemedCredit: "USD150.00",
10119
+ value: 40000,
10120
+ prettyValue: "USD400.00",
10121
+ },
10122
+ ],
10123
+ rewardBalanceDetails: [
10124
+ {
10125
+ prettyAvailableValue: "$5.00",
10126
+ },
10127
+ {
10128
+ prettyAvailableValue: "18%",
10129
+ },
10130
+ ],
10131
+ };
10132
+ //@ts-ignore
10133
+ const squatchJsApi = window.frameElement
10134
+ ? window.frameElement.squatchJsApi
10135
+ : {};
10136
+ const apolloClient = () => {
10137
+ const { tenantAlias, appDomain, token } = widgetIdent();
10138
+ const uri = appDomain + "/api/v1/" + tenantAlias + "/graphql";
10139
+ const headers = {
10140
+ Authorization: `Bearer ${token}`,
10141
+ };
10142
+ const client = new ApolloClient({
10143
+ link: new HttpLink({ uri, headers }),
10144
+ cache: new InMemoryCache(),
10145
+ });
10146
+ return client;
10147
+ };
10148
+ const API = {
10149
+ version: "Welcome to widget-host",
10150
+ analytics: {
10151
+ shareEvent(shareMedium) {
10152
+ const widgetId = widgetIdent();
10153
+ if (widgetId["env"] === "demo" || !widgetId)
10154
+ return Promise.resolve({});
10155
+ const { userId, accountId, programId = "classic", engagementMedium, } = widgetId;
10156
+ const variables = {
10157
+ eventMeta: {
10158
+ id: userId,
10159
+ accountId,
10160
+ programId,
10161
+ type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
10162
+ meta: {
10163
+ engagementMedium,
10164
+ shareMedium,
10165
+ },
10166
+ },
10167
+ };
10168
+ return apolloClient()
10169
+ .mutate({
10170
10170
  mutation: src `
10171
10171
  mutation ($eventMeta: UserAnalyticsEvent!) {
10172
10172
  createUserAnalyticsEvent(eventMeta: $eventMeta)
10173
10173
  }
10174
- `,
10175
- variables,
10176
- })
10177
- .then((result) => {
10178
- return result.data.createUserAnalyticsEvent;
10179
- });
10180
- },
10181
- loadEvent() {
10182
- return Promise.resolve({ event: "loadEvent" });
10183
- },
10184
- },
10185
- graphql: {
10186
- getClient() {
10187
- return apolloClient();
10188
- },
10189
- getUserFragment(userFragment, fragmentVariables) {
10174
+ `,
10175
+ variables,
10176
+ })
10177
+ .then((result) => {
10178
+ return result.data.createUserAnalyticsEvent;
10179
+ });
10180
+ },
10181
+ loadEvent() {
10182
+ return Promise.resolve({ event: "loadEvent" });
10183
+ },
10184
+ },
10185
+ graphql: {
10186
+ getClient() {
10187
+ return apolloClient();
10188
+ },
10189
+ getUserFragment(userFragment, fragmentVariables) {
10190
10190
  const fragment = src `
10191
10191
  fragment UserFragment on User {
10192
10192
  ${userFragment}
10193
- }`;
10194
- const { userId, accountId } = widgetIdent();
10195
- const variables = Object.assign(Object.assign({}, fragmentVariables), { userId,
10196
- accountId });
10197
- return this.getClient().query({
10193
+ }`;
10194
+ const { userId, accountId } = widgetIdent();
10195
+ const variables = Object.assign(Object.assign({}, fragmentVariables), { userId,
10196
+ accountId });
10197
+ return this.getClient().query({
10198
10198
  query: src `
10199
10199
  query ($userId: String!, $accountId: String!, $offset: Int) {
10200
10200
  user(id: $userId, accountId: $accountId) {
@@ -10202,23 +10202,23 @@ const API = {
10202
10202
  }
10203
10203
  }
10204
10204
  ${fragment}
10205
- `,
10206
- variables,
10207
- });
10208
- },
10209
- getShareLink() {
10210
- const widgetId = widgetIdent();
10211
- if (widgetId["env"] === "demo" || !widgetId)
10212
- return Promise.resolve(demoUser.shareLink);
10213
- const { userId, accountId, programId = null, engagementMedium, } = widgetId;
10214
- const variables = {
10215
- userId,
10216
- accountId,
10217
- programId,
10218
- engagementMedium,
10219
- };
10220
- return this.getClient()
10221
- .query({
10205
+ `,
10206
+ variables,
10207
+ });
10208
+ },
10209
+ getShareLink() {
10210
+ const widgetId = widgetIdent();
10211
+ if (widgetId["env"] === "demo" || !widgetId)
10212
+ return Promise.resolve(demoUser.shareLink);
10213
+ const { userId, accountId, programId = null, engagementMedium, } = widgetId;
10214
+ const variables = {
10215
+ userId,
10216
+ accountId,
10217
+ programId,
10218
+ engagementMedium,
10219
+ };
10220
+ return this.getClient()
10221
+ .query({
10222
10222
  query: src `
10223
10223
  query (
10224
10224
  $userId: String!
@@ -10235,33 +10235,33 @@ const API = {
10235
10235
  )
10236
10236
  }
10237
10237
  }
10238
- `,
10239
- variables,
10240
- })
10241
- .then((res) => res.data.user.shareLink);
10242
- },
10243
- getReferrals(showReferrer, offset = 0, limit = 3) {
10244
- const widgetId = widgetIdent();
10245
- if (widgetId["env"] === "demo" || !widgetId) {
10246
- const { referrals: refs, referredByReferral, locale } = demoUser;
10247
- const referrals = {
10248
- totalCount: refs.totalCount,
10249
- data: refs.data.slice(offset, offset + limit),
10250
- };
10251
- const user = { referrals, referredByReferral, locale };
10252
- return Promise.resolve(user);
10253
- }
10254
- const { userId, accountId, programId = null } = widgetId;
10255
- const variables = {
10256
- limit,
10257
- offset,
10258
- userId,
10259
- accountId,
10260
- programId,
10261
- programId_exists: programId ? true : false,
10262
- };
10263
- return this.getClient()
10264
- .query({
10238
+ `,
10239
+ variables,
10240
+ })
10241
+ .then((res) => res.data.user.shareLink);
10242
+ },
10243
+ getReferrals(showReferrer, offset = 0, limit = 3) {
10244
+ const widgetId = widgetIdent();
10245
+ if (widgetId["env"] === "demo" || !widgetId) {
10246
+ const { referrals: refs, referredByReferral, locale } = demoUser;
10247
+ const referrals = {
10248
+ totalCount: refs.totalCount,
10249
+ data: refs.data.slice(offset, offset + limit),
10250
+ };
10251
+ const user = { referrals, referredByReferral, locale };
10252
+ return Promise.resolve(user);
10253
+ }
10254
+ const { userId, accountId, programId = null } = widgetId;
10255
+ const variables = {
10256
+ limit,
10257
+ offset,
10258
+ userId,
10259
+ accountId,
10260
+ programId,
10261
+ programId_exists: programId ? true : false,
10262
+ };
10263
+ return this.getClient()
10264
+ .query({
10265
10265
  query: src `
10266
10266
  query (
10267
10267
  $userId: String!
@@ -10301,7 +10301,7 @@ const API = {
10301
10301
  }
10302
10302
  }
10303
10303
  }
10304
- ${showReferrer
10304
+ ${showReferrer
10305
10305
  ? `referredByReferral(programId: $programId) {
10306
10306
  referrerUser {
10307
10307
  firstName
@@ -10314,40 +10314,40 @@ const API = {
10314
10314
  prettyValue
10315
10315
  statuses
10316
10316
  }
10317
- }`
10317
+ }`
10318
10318
  : ""}
10319
10319
  }
10320
10320
  }
10321
- `,
10322
- variables,
10323
- })
10324
- .then((res) => res.data.user);
10325
- },
10326
- getStats() {
10327
- const widgetId = widgetIdent();
10328
- if (widgetId["env"] === "demo" || !widgetId) {
10329
- const { referrals: referralsCount, referralsMonth, referralsWeek, rewardsCount, rewardsMonth, rewardsWeek, rewardBalances, rewardBalancesGlobal, } = demoUser;
10330
- const user = {
10331
- referralsCount,
10332
- referralsMonth,
10333
- referralsWeek,
10334
- rewardsCount,
10335
- rewardsMonth,
10336
- rewardsWeek,
10337
- rewardBalances,
10338
- rewardBalancesGlobal,
10339
- };
10340
- return Promise.resolve(user);
10341
- }
10342
- const { userId, accountId, programId = null } = widgetId;
10343
- const variables = {
10344
- userId,
10345
- accountId,
10346
- programId,
10347
- programId_exists: programId ? true : false,
10348
- };
10349
- return this.getClient()
10350
- .query({
10321
+ `,
10322
+ variables,
10323
+ })
10324
+ .then((res) => res.data.user);
10325
+ },
10326
+ getStats() {
10327
+ const widgetId = widgetIdent();
10328
+ if (widgetId["env"] === "demo" || !widgetId) {
10329
+ const { referrals: referralsCount, referralsMonth, referralsWeek, rewardsCount, rewardsMonth, rewardsWeek, rewardBalances, rewardBalancesGlobal, } = demoUser;
10330
+ const user = {
10331
+ referralsCount,
10332
+ referralsMonth,
10333
+ referralsWeek,
10334
+ rewardsCount,
10335
+ rewardsMonth,
10336
+ rewardsWeek,
10337
+ rewardBalances,
10338
+ rewardBalancesGlobal,
10339
+ };
10340
+ return Promise.resolve(user);
10341
+ }
10342
+ const { userId, accountId, programId = null } = widgetId;
10343
+ const variables = {
10344
+ userId,
10345
+ accountId,
10346
+ programId,
10347
+ programId_exists: programId ? true : false,
10348
+ };
10349
+ return this.getClient()
10350
+ .query({
10351
10351
  query: src `
10352
10352
  query (
10353
10353
  $userId: String!
@@ -10412,51 +10412,51 @@ const API = {
10412
10412
  rewardBalancesGlobal: rewardBalances
10413
10413
  }
10414
10414
  }
10415
- `,
10416
- variables,
10417
- })
10418
- .then((res) => res.data.user);
10419
- },
10420
- async getReferralCode() {
10421
- const widgetId = widgetIdent();
10422
- if (widgetId["env"] === "demo" || !widgetId)
10423
- return demoUser.referralcode;
10424
- const { userId, accountId, programId } = widgetId;
10425
- const variables = {
10426
- userId,
10427
- accountId,
10428
- programId,
10429
- };
10430
- return this.getClient()
10431
- .query({
10415
+ `,
10416
+ variables,
10417
+ })
10418
+ .then((res) => res.data.user);
10419
+ },
10420
+ async getReferralCode() {
10421
+ const widgetId = widgetIdent();
10422
+ if (widgetId["env"] === "demo" || !widgetId)
10423
+ return demoUser.referralcode;
10424
+ const { userId, accountId, programId } = widgetId;
10425
+ const variables = {
10426
+ userId,
10427
+ accountId,
10428
+ programId,
10429
+ };
10430
+ return this.getClient()
10431
+ .query({
10432
10432
  query: src `
10433
10433
  query ($userId: String!, $accountId: String!, $programId: ID!) {
10434
10434
  user(id: $userId, accountId: $accountId) {
10435
10435
  referralCode(programId: $programId)
10436
10436
  }
10437
10437
  }
10438
- `,
10439
- variables,
10440
- })
10441
- .then((res) => res.data.user.referralCode);
10442
- },
10443
- async getFueltankCode(rewardKey) {
10444
- const widgetId = widgetIdent();
10445
- if (widgetId["env"] === "demo" || !widgetId) {
10446
- return {
10447
- referredByReferral: demoUser.referredByReferral,
10448
- rewards: { data: demoUser.referredByReferral.rewards },
10449
- };
10450
- }
10451
- const { userId, accountId, programId } = widgetId;
10452
- const variables = {
10453
- userId,
10454
- accountId,
10455
- programId,
10456
- rewardKey,
10457
- };
10458
- return this.getClient()
10459
- .query({
10438
+ `,
10439
+ variables,
10440
+ })
10441
+ .then((res) => res.data.user.referralCode);
10442
+ },
10443
+ async getFueltankCode(rewardKey) {
10444
+ const widgetId = widgetIdent();
10445
+ if (widgetId["env"] === "demo" || !widgetId) {
10446
+ return {
10447
+ referredByReferral: demoUser.referredByReferral,
10448
+ rewards: { data: demoUser.referredByReferral.rewards },
10449
+ };
10450
+ }
10451
+ const { userId, accountId, programId } = widgetId;
10452
+ const variables = {
10453
+ userId,
10454
+ accountId,
10455
+ programId,
10456
+ rewardKey,
10457
+ };
10458
+ return this.getClient()
10459
+ .query({
10460
10460
  query: src `
10461
10461
  query (
10462
10462
  $userId: String!
@@ -10484,24 +10484,24 @@ const API = {
10484
10484
  }
10485
10485
  }
10486
10486
  }
10487
- `,
10488
- variables,
10489
- })
10490
- .then((res) => res.data.user);
10491
- },
10492
- getMessageLinks(mediums) {
10493
- const widgetId = widgetIdent();
10494
- if (widgetId["env"] === "demo" || !widgetId)
10495
- return Promise.resolve(demoUser.messageLink);
10496
- const { userId, accountId, programId = null, engagementMedium, } = widgetId;
10497
- const variables = {
10498
- userId,
10499
- accountId,
10500
- programId,
10501
- engagementMedium,
10502
- };
10503
- return this.getClient()
10504
- .query({
10487
+ `,
10488
+ variables,
10489
+ })
10490
+ .then((res) => res.data.user);
10491
+ },
10492
+ getMessageLinks(mediums) {
10493
+ const widgetId = widgetIdent();
10494
+ if (widgetId["env"] === "demo" || !widgetId)
10495
+ return Promise.resolve(demoUser.messageLink);
10496
+ const { userId, accountId, programId = null, engagementMedium, } = widgetId;
10497
+ const variables = {
10498
+ userId,
10499
+ accountId,
10500
+ programId,
10501
+ engagementMedium,
10502
+ };
10503
+ return this.getClient()
10504
+ .query({
10505
10505
  query: src `
10506
10506
  query($userId: String!, $accountId: String!, $programId: ID, $engagementMedium: UserEngagementMedium!) {
10507
10507
  user(id: $userId, accountId: $accountId) {
@@ -10516,13 +10516,13 @@ const API = {
10516
10516
  ${mediums[8]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[8]})
10517
10517
  }
10518
10518
  }
10519
- `,
10520
- variables,
10521
- })
10522
- .then((res) => res.data.user);
10523
- },
10524
- },
10525
- ui: squatchJsApi,
10519
+ `,
10520
+ variables,
10521
+ })
10522
+ .then((res) => res.data.user);
10523
+ },
10524
+ },
10525
+ ui: squatchJsApi,
10526
10526
  };
10527
10527
 
10528
10528
  export { API as A, widgetIdent as w };