import { setProgramId } from "@saasquatch/component-boilerplate";
import { setUserIdentity, } from "@saasquatch/component-boilerplate";
import { useEffect } from "@saasquatch/universal-hooks";
import { h } from "@stencil/core";
import { createHookStory } from "../sqm-stencilbook/HookStoryAddon";
export default {
  title: "Hooks / useReferralTable",
};
function setupGraphQL() {
  const id = "testestest";
  const accountId = id;
  //@ts-ignore
  window.widgetIdent = {
    tenantAlias: "test_a8b41jotf8a1v",
    appDomain: "https://staging.referralsaasquatch.com",
  };
  useEffect(() => {
    setUserIdentity({
      accountId,
      id,
      jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InRlc3Rlc3Rlc3QiLCJpZCI6InRlc3Rlc3Rlc3QifX0.qYnU5hNeIj9C_G3NogfG7btgCPGZC7JRXY0MG6a63zs",
    });
    return () => {
      window.widgetIdent = undefined;
      setUserIdentity(undefined);
    };
  }, []);
  return { id, accountId };
}
function setupGraphQLKlip({ token, id }) {
  const accountId = id;
  // const programId = "klip-referral-program";
  //@ts-ignore
  window.widgetIdent = {
    tenantAlias: "test_a74miwdpofztj",
    appDomain: "https://staging.referralsaasquatch.com",
  };
  useEffect(() => {
    setUserIdentity({
      accountId,
      id,
      jwt: token,
    });
    return () => {
      window.widgetIdent = undefined;
      setUserIdentity(undefined);
    };
  }, []);
  return { id, accountId };
}
export const ReferralTable = createHookStory(() => {
  setupGraphQL();
  setProgramId("sam-partner-test-2");
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-referral-table", null,
    h("sqm-referral-table-user-column", null),
    h("sqm-referral-table-status-column", null),
    h("sqm-referral-table-date-column", null),
    h("sqm-referral-table-rewards-column", null)));
});
export const ReferralTableDemoHook = createHookStory(() => {
  // setupGraphQL();
  // setProgramId("sam-partner-test-2");
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-referral-table", null,
    h("sqm-referral-table-user-column", null),
    h("sqm-referral-table-status-column", null),
    h("sqm-referral-table-date-column", null),
    h("sqm-referral-table-rewards-column", null)));
});
export const ReferralTableDemoHookShowReferrer = createHookStory(() => {
  // setupGraphQL();
  // setProgramId("sam-partner-test-2");
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-referral-table", { "show-referrer": "true" },
    h("sqm-referral-table-user-column", null),
    h("sqm-referral-table-status-column", null),
    h("sqm-referral-table-date-column", null),
    h("sqm-referral-table-rewards-column", null)));
});
export const ReferralTableEn = createHookStory(() => {
  setupGraphQLKlip({
    token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbWVuZ2xpc2giLCJpZCI6InNhbWVuZ2xpc2gifX0._6OTVF3gcipu_ibgthUNr5UHwC-2E_lhCENI5HpYvcw",
    id: "samenglish",
  });
  setProgramId("klip-referral-program");
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-referral-table", { "per-page": "4" },
    h("sqm-referral-table-user-column", { "column-title": "User" }),
    h("sqm-referral-table-status-column", { "column-title": "Referral Status" }),
    h("sqm-referral-table-rewards-column", null),
    h("sqm-referral-table-date-column", { "column-title": "Date Referred", "date-shown": "dateReferralStarted" })));
});
export const ReferralTableTr = createHookStory(() => {
  setupGraphQLKlip({
    token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbXR1cmtleSIsImlkIjoic2FtdHVya2V5In19.usSMe0RWg8W5FtwcvJayvAlxTw6vMxjTyWXaP8jI8_U",
    id: "samturkey",
  });
  setProgramId("klip-referral-program");
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-referral-table", { "more-label": "Daha", "prev-label": "\u00D6ncesi", "empty-state-text": "Hen\u00FCz \u00D6d\u00FCl Yok", "per-page": "4" },
    h("sqm-referral-table-user-column", { "column-title": "Kullan\u0131c\u0131lar", "anonymous-user": "Anonim Kullan\u0131c\u0131", "deleted-user": "Silinmi\u015F Kullan\u0131c\u0131" }),
    h("sqm-referral-table-status-column", { "column-title": "Durumu", "converted-status-text": "D\u00F6n\u00FC\u015Ft\u00FCr", "in-progress-status-text": "Devam etmekte" }),
    h("sqm-referral-table-rewards-column", { "column-title": "\u00D6d\u00FCller", "status-text": "{status, select, AVAILABLE {Mevcut} CANCELLED {\u0130ptal edildi} PENDING {Bekliyor} EXPIRED {S\u00FCresi doldu} REDEEMED {Kullan\u0131ld\u0131} other {M\u00FCsait de\u011Fil} }", "status-long-text": "{status, select, AVAILABLE {\u00D6d\u00FCl s\u00FCresi doluyor} CANCELLED {\u00D6d\u00FCl iptal edildi} PENDING {\u00FCzerinde mevcut} EXPIRED {\u00D6d\u00FCl\u00FCn s\u00FCresi doldu} other {M\u00FCsait de\u011Fil} }", "reward-received-text": "\u00D6d\u00FCl \u015Fu tarihte al\u0131nd\u0131:" }),
    h("sqm-referral-table-date-column", { "column-title": "Tarih", "date-shown": "dateReferralStarted" })));
});
export const ReferralTableFr = createHookStory(() => {
  setupGraphQLKlip({
    token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbWZyZW5jaCIsImlkIjoic2FtZnJlbmNoIn19.cwhasHpfU5MLV4vGbCQcazb6p19iSw5pD2zyrVHgePg",
    id: "samfrench",
  });
  setProgramId("klip-referral-program");
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-referral-table", { "more-label": "Plus", "prev-label": "Pr\u00E9c\u00E9dent", "empty-state-text": "Aucune R\u00E9f\u00E9rence Maintenant", "per-page": "4" },
    h("sqm-referral-table-user-column", { "column-title": "Utilisateur", "anonymous-user": "Utilisateur Anonyme", "deleted-user": "Utilisateur Supprim\u00E9" }),
    h("sqm-referral-table-status-column", { "column-title": "Statut de Parrainage", "converted-status-text": "Converti", "in-progress-status-text": "En cours" }),
    h("sqm-referral-table-rewards-column", { "column-title": "R\u00E9compenses", "status-text": "{status, select, AVAILABLE {Disponible} CANCELLED {Annul\u00E9} PENDING {En attente} EXPIRED {Expir\u00E9} REDEEMED {Rachet\u00E9} other {Indisponible} }", "status-long-text": "{status, select, AVAILABLE {R\u00E9compense expirant sur} CANCELLED {R\u00E9compense annul\u00E9e sur} PENDING {Disponible sur} EXPIRED {R\u00E9compense expir\u00E9e sur} other {Indisponible} }", "reward-received-text": "R\u00E9compense re\u00E7ue" }),
    h("sqm-referral-table-date-column", { "column-title": "Date de R\u00E9f\u00E9rence", "date-shown": "dateReferralStarted" })));
});
