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 / useRewardsTable",
};
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 RewardTableDemoHook = createHookStory(() => {
  // setupGraphQL();
  // setProgramId("sam-partner-test-2");
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-rewards-table", { "per-page": "4" },
    h("sqm-rewards-table-reward-column", null),
    h("sqm-rewards-table-source-column", null),
    h("sqm-rewards-table-status-column", null),
    h("sqm-rewards-table-date-column", null)));
});
export const RewardsTableWithProgram = createHookStory(() => {
  setupGraphQL();
  setProgramId("sam-partner-test-2");
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-rewards-table", null,
    h("sqm-rewards-table-reward-column", null),
    h("sqm-rewards-table-status-column", null),
    h("sqm-rewards-table-source-column", null),
    h("sqm-rewards-table-date-column", null)));
});
export const RewardsTableNoProgram = createHookStory(() => {
  setupGraphQL();
  setProgramId(undefined);
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-rewards-table", null,
    h("sqm-rewards-table-reward-column", null),
    h("sqm-rewards-table-status-column", null),
    h("sqm-rewards-table-source-column", null),
    h("sqm-rewards-table-date-column", null)));
});
export const RewardsTableEn = createHookStory(() => {
  setupGraphQLKlip({
    token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbWVuZ2xpc2giLCJpZCI6InNhbWVuZ2xpc2gifX0._6OTVF3gcipu_ibgthUNr5UHwC-2E_lhCENI5HpYvcw",
    id: "samenglish",
  });
  setProgramId(undefined);
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-rewards-table", { "per-page": "4" },
    h("sqm-rewards-table-reward-column", null),
    h("sqm-rewards-table-status-column", null),
    h("sqm-rewards-table-source-column", null),
    h("sqm-rewards-table-date-column", null)));
});
export const RewardsTableTr = createHookStory(() => {
  setupGraphQLKlip({
    token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbXR1cmtleSIsImlkIjoic2FtdHVya2V5In19.usSMe0RWg8W5FtwcvJayvAlxTw6vMxjTyWXaP8jI8_U",
    id: "samturkey",
  });
  setProgramId(undefined);
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-rewards-table", { "per-page": "4", "more-label": "Daha", "prev-label": "\u00D6ncesi", "empty-state-text": "Hen\u00FCz Referans Yok" },
    h("sqm-rewards-table-reward-column", { "column-title": "\u00D6d\u00FCller", "redeemed-text": "{redeemedAmount} kullan\u0131ld\u0131", "available-text": "{availableAmount} mevcut" }),
    h("sqm-rewards-table-source-column", { "column-title": "Kullan\u0131c\u0131lar", "anonymous-user": "Anonim Kullan\u0131c\u0131", "deleted-user": "Silinmi\u015F Kullan\u0131c\u0131", "reward-exchange-text": "\u00D6d\u00FClleri Kulann\u0131n", "referral-text": "{rewardSource, select, FRIEND_SIGNUP {Referans} REFERRED {Y\u00F6nlendiren} other {}}", "reward-source-text": "{rewardSource, select, MANUAL {Manuel} AUTOMATED {Otomatik} other {}}" }),
    h("sqm-rewards-table-status-column", { "column-title": "Statut", "status-text": "{status, select, AVAILABLE {Mevcut} PENDING {Bekleniyor} EXPIRED {Ge\u00E7mi\u015F} REDEEMED {Kullan\u0131lm\u0131\u015F} CANCELED {\u0130ptal Edildi} other {Kullan\u0131lamaz} }", "expiry-text": "Bitiyor " }),
    h("sqm-rewards-table-date-column", { "column-title": "Tarih" })));
});
export const RewardsTableFr = createHookStory(() => {
  setupGraphQLKlip({
    token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbWZyZW5jaCIsImlkIjoic2FtZnJlbmNoIn19.cwhasHpfU5MLV4vGbCQcazb6p19iSw5pD2zyrVHgePg",
    id: "samfrench",
  });
  setProgramId(undefined);
  const props = {
    listType: "",
    render: () => { },
    disconnectedCallback: () => { },
    ignored: true,
  };
  return (h("sqm-rewards-table", { "per-page": "4", "more-label": "Plus", "prev-label": "Pr\u00E9c\u00E9dent", "empty-state-text": "Aucune R\u00E9compenses Maintenant" },
    h("sqm-rewards-table-reward-column", { "column-title": "R\u00E9compenses", "redeemed-text": "{redeemedAmount} rachet\u00E9e", "available-text": "{availableAmount} disponible" }),
    h("sqm-rewards-table-source-column", { "column-title": "Utilisateur", "anonymous-user": "Utilisateur Anonyme", "deleted-user": "Utilisateur Supprim\u00E9", "reward-exchange-text": "\u00C9change de R\u00E9compenses", "referral-text": "{rewardSource, select, FRIEND_SIGNUP {R\u00E9f\u00E9rence \u00E0} REFERRED {R\u00E9f\u00E9renc\u00E9 par} other {}}", "reward-source-text": "{rewardSource, select, MANUAL {Manuel} AUTOMATED {Automatique} other {}}" }),
    h("sqm-rewards-table-status-column", { "column-title": "Statut", "status-text": "{status, select, AVAILABLE {Disponible} PENDING {Pendant} EXPIRED {Expir\u00E9} REDEEMED {Rachet\u00E9} CANCELED {Annul\u00E9} other {Indisponible} }", "expiry-text": "Expire sur " }),
    h("sqm-rewards-table-date-column", { "column-title": "Date de R\u00E9ception" })));
});
