@saasquatch/mint-components 2.1.9-13 → 2.1.9-15

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.
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ function parseStates(states) {
4
+ if (typeof states === "string") {
5
+ try {
6
+ return JSON.parse(states);
7
+ }
8
+ catch (e) {
9
+ return undefined;
10
+ }
11
+ }
12
+ if (typeof states === "object")
13
+ return states;
14
+ }
15
+
16
+ exports.parseStates = parseStates;
@@ -33,6 +33,7 @@ const data = require('./data-e83f8a41.js');
33
33
  const keys = require('./keys-cff24974.js');
34
34
  require('./eventKeys-7af4df4d.js');
35
35
  const usePayoutStatus = require('./usePayoutStatus-cf050a03.js');
36
+ const parseStates = require('./parseStates-d1effc19.js');
36
37
 
37
38
  /**
38
39
  *
@@ -3214,19 +3215,6 @@ function PayoutStatusAlertView(props) {
3214
3215
  getButton(states.status))));
3215
3216
  }
3216
3217
 
3217
- function parseStates(states) {
3218
- if (typeof states === "string") {
3219
- try {
3220
- return JSON.parse(states);
3221
- }
3222
- catch (e) {
3223
- return undefined;
3224
- }
3225
- }
3226
- if (typeof states === "object")
3227
- return states;
3228
- }
3229
-
3230
3218
  const PayoutStatusAlert = class {
3231
3219
  constructor(hostRef) {
3232
3220
  index.registerInstance(this, hostRef);
@@ -3405,7 +3393,7 @@ const PayoutStatusAlert = class {
3405
3393
  }
3406
3394
  };
3407
3395
  function useDemoPayoutStatusAlert(props) {
3408
- const states = parseStates(props.stateController);
3396
+ const states = parseStates.parseStates(props.stateController);
3409
3397
  const formatted = Object.keys(states).reduce((prev, key) => key === "sqm-payout-status-alert"
3410
3398
  ? { ...prev, ...states[key] }
3411
3399
  : { ...prev, [`${key}_stateController`]: states[key] }, {});
@@ -5784,7 +5772,7 @@ function EmptySlot$1() {
5784
5772
  return (index.h("slot", { name: "empty" }, index.h("sqm-empty", { emptyStateImage: "https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_exchange2.png", emptyStateHeader: "Redeem rewards", emptyStateText: "Use your points to redeem rewards once they become available" })));
5785
5773
  }
5786
5774
  function useRewardExchangeListDemo(props) {
5787
- const states = parseStates(props.stateController);
5775
+ const states = parseStates.parseStates(props.stateController);
5788
5776
  const formatted = Object.keys(states).reduce((prev, key) => key === "sqm-reward-exchange-list"
5789
5777
  ? { ...prev, ...states[key] }
5790
5778
  : { ...prev, [`${key}_stateController`]: states[key] }, {});
@@ -7766,7 +7754,7 @@ function useDemoTaxAndCash(props) {
7766
7754
  namespace: data.TAX_CONTEXT_NAMESPACE,
7767
7755
  initialValue: "/1",
7768
7756
  });
7769
- const states = parseStates(props.stateController);
7757
+ const states = parseStates.parseStates(props.stateController);
7770
7758
  const formatted = Object.keys(states).reduce((prev, key) => key === "sqm-tax-and-cash"
7771
7759
  ? { ...prev, ...states[key] }
7772
7760
  : { ...prev, [`${key}_stateController`]: states[key] }, {});
@@ -8273,7 +8261,7 @@ const WidgetVerification = class {
8273
8261
  const dialogLabel = this.general_widgetHeaderWithPartnerCreation;
8274
8262
  const renderStepContent = () => {
8275
8263
  if (props.showPartnerModal) {
8276
- return (index.h("sqm-partner-info-modal", Object.assign({ inModal: true }, partnerText, { stateController: JSON.stringify(props["sqm-partner-info-modal_stateController"] || {}) })));
8264
+ return (index.h("sqm-partner-info-modal", Object.assign({ inModal: true }, partnerText, { stateController: props["sqm-partner-info-modal_stateController"] || "{}" })));
8277
8265
  }
8278
8266
  if (props.showCode) {
8279
8267
  return (index.h("sqm-code-verification", Object.assign({ onVerification: props.onVerification }, this.getStepTextProps("codeStep_"), extractProps(props, "sqm-code-verification_"))));
@@ -8300,7 +8288,7 @@ function useDemoWidgetVerificationInternal(props) {
8300
8288
  initialValue: undefined,
8301
8289
  });
8302
8290
  const setContext = index_module.En(keys.VERIFICATION_PARENT_NAMESPACE);
8303
- const states = parseStates(props.stateController);
8291
+ const states = parseStates.parseStates(props.stateController);
8304
8292
  const formatted = Object.keys(states).reduce((prev, key) => key === "sqm-widget-verification"
8305
8293
  ? { ...prev, ...states[key] }
8306
8294
  : { ...prev, [`${key}_stateController`]: states[key] }, {});
@@ -13,6 +13,7 @@ const sqmTextSpanView = require('./sqm-text-span-view-f274fdf2.js');
13
13
  const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-2d6e89a4.js');
14
14
  const keys = require('./keys-cff24974.js');
15
15
  const eventKeys = require('./eventKeys-7af4df4d.js');
16
+ const parseStates = require('./parseStates-d1effc19.js');
16
17
  const useVerificationEmail = require('./useVerificationEmail-994bc32f.js');
17
18
 
18
19
  const UpsertUserEmailMutation = index_module.dist.gql `
@@ -754,6 +755,8 @@ function useDemoPartnerInfoModal(props) {
754
755
  const [countryCode, setCountryCode] = domContextHooks_module.useState("US");
755
756
  const [currency, setCurrency] = domContextHooks_module.useState("");
756
757
  const [error, setError] = domContextHooks_module.useState("");
758
+ const parsed = parseStates.parseStates(props.stateController);
759
+ const stateOverride = (parsed === null || parsed === void 0 ? void 0 : parsed["sqm-partner-info-modal"]) || parsed || {};
757
760
  // @ts-ignore
758
761
  return cjs.cjs({
759
762
  states: {
@@ -808,7 +811,7 @@ function useDemoPartnerInfoModal(props) {
808
811
  supportDescriptionExistingPartner: props.supportDescriptionExistingPartner,
809
812
  modalHeaderExistingPartner: props.modalHeaderExistingPartner,
810
813
  },
811
- }, props.demoData || props.stateController || {}, { arrayMerge: (_, a) => a });
814
+ }, props.demoData || stateOverride, { arrayMerge: (_, a) => a });
812
815
  }
813
816
 
814
817
  exports.sqm_email_verification = WidgetEmailVerification;
@@ -2,13 +2,14 @@ import { isDemo } from "@saasquatch/component-boilerplate";
2
2
  import { useState, withHooks } from "@saasquatch/stencil-hooks";
3
3
  import { Component, Prop, h } from "@stencil/core";
4
4
  import deepmerge from "deepmerge";
5
+ import { parseStates } from "../../utils/parseStates";
5
6
  import { getProps } from "../../utils/utils";
6
7
  import { PartnerInfoModalContentView, PartnerInfoModalView, } from "./sqm-partner-info-modal-view";
7
8
  import { usePartnerInfoModal, } from "./usePartnerInfoModal";
8
9
  /**
9
10
  * @uiName Partner Info Modal
10
11
  * @exampleGroup Tax and Cash
11
- * @validParents ["sqm-portal-container", "sqm-portal-frame", "div", "sqb-program-section", "sqb-conditional-section"]
12
+ * @validParents ["sqm-portal-container", "sqm-portal-frame", "div", "sqm-divided-layout", "sqb-program-section", "sqb-conditional-section"]
12
13
  * @example Partner Info Modal - <sqm-partner-info-modal></sqm-partner-info-modal>
13
14
  */
14
15
  export class PartnerInfoModal {
@@ -520,6 +521,8 @@ function useDemoPartnerInfoModal(props) {
520
521
  const [countryCode, setCountryCode] = useState("US");
521
522
  const [currency, setCurrency] = useState("");
522
523
  const [error, setError] = useState("");
524
+ const parsed = parseStates(props.stateController);
525
+ const stateOverride = (parsed === null || parsed === void 0 ? void 0 : parsed["sqm-partner-info-modal"]) || parsed || {};
523
526
  // @ts-ignore
524
527
  return deepmerge({
525
528
  states: {
@@ -574,5 +577,5 @@ function useDemoPartnerInfoModal(props) {
574
577
  supportDescriptionExistingPartner: props.supportDescriptionExistingPartner,
575
578
  modalHeaderExistingPartner: props.modalHeaderExistingPartner,
576
579
  },
577
- }, props.demoData || props.stateController || {}, { arrayMerge: (_, a) => a });
580
+ }, props.demoData || stateOverride, { arrayMerge: (_, a) => a });
578
581
  }
@@ -243,7 +243,7 @@ export class WidgetVerification {
243
243
  const dialogLabel = this.general_widgetHeaderWithPartnerCreation;
244
244
  const renderStepContent = () => {
245
245
  if (props.showPartnerModal) {
246
- return (h("sqm-partner-info-modal", Object.assign({ inModal: true }, partnerText, { stateController: JSON.stringify(props["sqm-partner-info-modal_stateController"] || {}) })));
246
+ return (h("sqm-partner-info-modal", Object.assign({ inModal: true }, partnerText, { stateController: props["sqm-partner-info-modal_stateController"] || "{}" })));
247
247
  }
248
248
  if (props.showCode) {
249
249
  return (h("sqm-code-verification", Object.assign({ onVerification: props.onVerification }, this.getStepTextProps("codeStep_"), extractProps(props, "sqm-code-verification_"))));
@@ -0,0 +1,14 @@
1
+ function parseStates(states) {
2
+ if (typeof states === "string") {
3
+ try {
4
+ return JSON.parse(states);
5
+ }
6
+ catch (e) {
7
+ return undefined;
8
+ }
9
+ }
10
+ if (typeof states === "object")
11
+ return states;
12
+ }
13
+
14
+ export { parseStates as p };
@@ -29,6 +29,7 @@ import { T as TAX_CONTEXT_NAMESPACE, a as TAX_FORM_CONTEXT_NAMESPACE, U as USER_
29
29
  import { S as SHOW_CODE_NAMESPACE, a as VERIFICATION_EMAIL_NAMESPACE, V as VERIFICATION_PARENT_NAMESPACE } from './keys-db1897ae.js';
30
30
  import './eventKeys-f76b6a03.js';
31
31
  import { u as usePayoutStatus } from './usePayoutStatus-fa504d49.js';
32
+ import { p as parseStates } from './parseStates-ed75e224.js';
32
33
 
33
34
  /**
34
35
  *
@@ -3210,19 +3211,6 @@ function PayoutStatusAlertView(props) {
3210
3211
  getButton(states.status))));
3211
3212
  }
3212
3213
 
3213
- function parseStates(states) {
3214
- if (typeof states === "string") {
3215
- try {
3216
- return JSON.parse(states);
3217
- }
3218
- catch (e) {
3219
- return undefined;
3220
- }
3221
- }
3222
- if (typeof states === "object")
3223
- return states;
3224
- }
3225
-
3226
3214
  const PayoutStatusAlert = class {
3227
3215
  constructor(hostRef) {
3228
3216
  registerInstance(this, hostRef);
@@ -8269,7 +8257,7 @@ const WidgetVerification = class {
8269
8257
  const dialogLabel = this.general_widgetHeaderWithPartnerCreation;
8270
8258
  const renderStepContent = () => {
8271
8259
  if (props.showPartnerModal) {
8272
- return (h$1("sqm-partner-info-modal", Object.assign({ inModal: true }, partnerText, { stateController: JSON.stringify(props["sqm-partner-info-modal_stateController"] || {}) })));
8260
+ return (h$1("sqm-partner-info-modal", Object.assign({ inModal: true }, partnerText, { stateController: props["sqm-partner-info-modal_stateController"] || "{}" })));
8273
8261
  }
8274
8262
  if (props.showCode) {
8275
8263
  return (h$1("sqm-code-verification", Object.assign({ onVerification: props.onVerification }, this.getStepTextProps("codeStep_"), extractProps(props, "sqm-code-verification_"))));
@@ -9,6 +9,7 @@ import { T as TextSpanView } from './sqm-text-span-view-738acfb3.js';
9
9
  import { a as PartnerInfoModalContentView, P as PartnerInfoModalView } from './sqm-partner-info-modal-view-f85b5a08.js';
10
10
  import { S as SHOW_CODE_NAMESPACE, a as VERIFICATION_EMAIL_NAMESPACE, V as VERIFICATION_PARENT_NAMESPACE } from './keys-db1897ae.js';
11
11
  import { T as TAX_FORM_UPDATED_EVENT_KEY } from './eventKeys-f76b6a03.js';
12
+ import { p as parseStates } from './parseStates-ed75e224.js';
12
13
  import { u as useVerificationEmail } from './useVerificationEmail-cb3d51e3.js';
13
14
 
14
15
  const UpsertUserEmailMutation = dist.gql `
@@ -750,6 +751,8 @@ function useDemoPartnerInfoModal(props) {
750
751
  const [countryCode, setCountryCode] = useState("US");
751
752
  const [currency, setCurrency] = useState("");
752
753
  const [error, setError] = useState("");
754
+ const parsed = parseStates(props.stateController);
755
+ const stateOverride = (parsed === null || parsed === void 0 ? void 0 : parsed["sqm-partner-info-modal"]) || parsed || {};
753
756
  // @ts-ignore
754
757
  return cjs({
755
758
  states: {
@@ -804,7 +807,7 @@ function useDemoPartnerInfoModal(props) {
804
807
  supportDescriptionExistingPartner: props.supportDescriptionExistingPartner,
805
808
  modalHeaderExistingPartner: props.modalHeaderExistingPartner,
806
809
  },
807
- }, props.demoData || props.stateController || {}, { arrayMerge: (_, a) => a });
810
+ }, props.demoData || stateOverride, { arrayMerge: (_, a) => a });
808
811
  }
809
812
 
810
813
  export { WidgetEmailVerification as sqm_email_verification, PartnerInfoModal as sqm_partner_info_modal };
@@ -0,0 +1 @@
1
+ function parseStates(t){if(typeof t==="string"){try{return JSON.parse(t)}catch(t){return undefined}}if(typeof t==="object")return t}export{parseStates as p};