Skip to content

Commit 0f32844

Browse files
Ahmed QadriAhmed Qadri
Ahmed Qadri
authored and
Ahmed Qadri
committed
more updates
1 parent 8c0f7cf commit 0f32844

File tree

4 files changed

+152
-31
lines changed

4 files changed

+152
-31
lines changed

Diff for: .github/workflows/demo_provisioning_scripts/DemoBuilder.py

+132-4
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,18 @@ def create_flags(self):
192192
self.virtual_card_issuance()
193193
print(" - F19 - API Support for Third-Party Applications")
194194
self.api_support_for_third_party_applications()
195+
196+
# Temporary Feature Flags
197+
print(" - T1 - Beta Dark Mode")
198+
self.beta_dark_mode()
199+
print(" - T2 - Experimental Payment Gateway")
200+
self.experimental_payment_gateway()
201+
print(" - T3 - Limited Time Offer Banner")
202+
self.limited_time_offer_banner()
203+
print(" - T4 - Early Access Feature Toggle")
204+
self.early_access_feature_toggle()
205+
print(" - T5 - Debugging Mode for Developers")
206+
self.debugging_mode_for_developers()
195207

196208
print("Done")
197209
self.flags_created = True
@@ -274,7 +286,7 @@ def run_ecommerce_collection_banner_funnel_experiment(self):
274286
"production",
275287
"Turn on flag for experiment",
276288
)
277-
print(" - 09 - (Bayesian) Funnel Experiment: New Collection Promotion Banner")
289+
print(" - (Bayesian) Funnel Experiment: New Collection Promotion Banner")
278290
self.create_ecommerce_collection_banner_funnel_experiment()
279291
self.ldproject.start_exp_iteration("new-collection-promotion-banner", "production")
280292
print("Done")
@@ -306,7 +318,7 @@ def run_ecommerce_upsell_component_feature_experiment(self):
306318
"production",
307319
"Turn on flag for experiment",
308320
)
309-
print(" - 10 - (Bayesian) Feature Experiment: Suggested Items Carousel")
321+
print(" - (Bayesian) Feature Experiment: Suggested Items Carousel")
310322
self.create_ecommerce_upsell_component_feature_experiment()
311323
self.ldproject.start_exp_iteration("suggested-items-carousel", "production")
312324
print("Done")
@@ -338,7 +350,7 @@ def run_ecommerce_shorten_collection_funnel_experiment(self):
338350
"production",
339351
"Turn on flag for experiment",
340352
)
341-
print(" - 11 - (Frequentist) Funnel Experiment: New Shorten Collection Pages")
353+
print(" - (Frequentist) Funnel Experiment: New Shorten Collection Pages")
342354
self.create_ecommerce_shorten_collection_funnel_experiment()
343355
self.ldproject.start_exp_iteration("new-shorten-collection-pages", "production")
344356
print("Done")
@@ -370,7 +382,7 @@ def run_ecommerce_new_search_engine_feature_experiment(self):
370382
"production",
371383
"Turn on flag for experiment",
372384
)
373-
print(" - 12 - (Frequentist) Feature Experiment: New Search Engine")
385+
print(" - (Frequentist) Feature Experiment: New Search Engine")
374386
self.create_ecommerce_new_search_engine_feature_experiment()
375387
self.ldproject.start_exp_iteration("new-search-engine", "production")
376388
print("Done")
@@ -501,6 +513,11 @@ def add_userid_to_flags(self):
501513
res = self.ldproject.add_maintainer_to_flag("merchantRewardsIntegration")
502514
res = self.ldproject.add_maintainer_to_flag("virtualCardIssuance")
503515
res = self.ldproject.add_maintainer_to_flag("apiSupportForThirdPartyApplications")
516+
res = self.ldproject.add_maintainer_to_flag("betaDarkMode")
517+
res = self.ldproject.add_maintainer_to_flag("experimentalPaymentGateway")
518+
res = self.ldproject.add_maintainer_to_flag("limitedTimeOfferBanner")
519+
res = self.ldproject.add_maintainer_to_flag("earlyAccessFeatureToggle")
520+
res = self.ldproject.add_maintainer_to_flag("debuggingModeForDevelopers")
504521

505522
# ############################################################################################################
506523

@@ -1621,6 +1638,117 @@ def api_support_for_third_party_applications(self):
16211638
on_variation=0,
16221639
off_variation=1,
16231640
)
1641+
1642+
############################################################################################################
1643+
############################################################################################################
1644+
1645+
## Creating Temporary Feature Flags for the demo
1646+
## These flags are not used in the demo
1647+
1648+
def beta_dark_mode(self):
1649+
res = self.ldproject.create_flag(
1650+
"betaDarkMode",
1651+
"T1 - Beta: Dark Mode",
1652+
"This feature flag will enable dark mode in ToggleBank",
1653+
[
1654+
{
1655+
"value": True,
1656+
"name": "Enable Dark Mode"
1657+
},
1658+
{
1659+
"value": False,
1660+
"name": "Disable Dark Mode"
1661+
}
1662+
],
1663+
tags=["temporary"],
1664+
on_variation=0,
1665+
off_variation=1,
1666+
temporary=True
1667+
)
1668+
1669+
def experimental_payment_gateway(self):
1670+
res = self.ldproject.create_flag(
1671+
"experimentalPaymentGateway",
1672+
"T2 - Experimental Payment Gateway",
1673+
"This feature flag will enable experimental payment gateway in ToggleBank",
1674+
[
1675+
{
1676+
"value": True,
1677+
"name": "Enable Experimental Payment Gateway"
1678+
},
1679+
{
1680+
"value": False,
1681+
"name": "Disable Experimental Payment Gateway"
1682+
}
1683+
],
1684+
tags=["temporary"],
1685+
on_variation=0,
1686+
off_variation=1,
1687+
temporary=True
1688+
)
1689+
1690+
def limited_time_offer_banner(self):
1691+
res = self.ldproject.create_flag(
1692+
"limitedTimeOfferBanner",
1693+
"T3 - Limited Time Offer Banner",
1694+
"This feature flag will enable limited time offer banner in ToggleBank",
1695+
[
1696+
{
1697+
"value": True,
1698+
"name": "Enable Limited Time Offer Banner"
1699+
},
1700+
{
1701+
"value": False,
1702+
"name": "Disable Limited Time Offer Banner"
1703+
}
1704+
],
1705+
tags=["temporary"],
1706+
on_variation=0,
1707+
off_variation=1,
1708+
temporary=True
1709+
)
1710+
1711+
def early_access_feature_toggle(self):
1712+
res = self.ldproject.create_flag(
1713+
"earlyAccessFeatureToggle",
1714+
"T4 - Early Access Feature Toggle",
1715+
"This feature flag will enable early access feature toggle in ToggleBank",
1716+
[
1717+
{
1718+
"value": True,
1719+
"name": "Enable Early Access Feature Toggle"
1720+
},
1721+
{
1722+
"value": False,
1723+
"name": "Disable Early Access Feature Toggle"
1724+
}
1725+
],
1726+
tags=["temporary"],
1727+
on_variation=0,
1728+
off_variation=1,
1729+
temporary=True
1730+
)
1731+
1732+
def debugging_mode_for_developers(self):
1733+
res = self.ldproject.create_flag(
1734+
"debuggingModeForDevelopers",
1735+
"T5 - Debugging Mode for Developers",
1736+
"This feature flag will enable debugging mode for developers in ToggleBank",
1737+
[
1738+
{
1739+
"value": True,
1740+
"name": "Enable Debugging Mode for Developers"
1741+
},
1742+
{
1743+
"value": False,
1744+
"name": "Disable Debugging Mode for Developers"
1745+
}
1746+
],
1747+
tags=["temporary"],
1748+
on_variation=0,
1749+
off_variation=1,
1750+
temporary=True
1751+
)
16241752

16251753
############################################################################################################
16261754
############################################################################################################

Diff for: .github/workflows/demo_provisioning_scripts/LDPlatform.py

+15-7
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def create_flag(
150150
tags=[],
151151
migration_stages=0,
152152
prerequisites=[],
153+
temporary=False,
153154
):
154155
if self.flag_exists(flag_key):
155156
return
@@ -162,6 +163,7 @@ def create_flag(
162163
"usingEnvironmentId": True,
163164
"usingMobileKey": True,
164165
},
166+
"temporary": temporary,
165167
}
166168

167169
if len(variations) > 0:
@@ -722,18 +724,24 @@ def create_release_pipeline(self, pipeline_key, pipeline_name):
722724
print("Error creating release pipeline: " + data["message"])
723725
return response
724726

725-
def create_shortcut(self):
727+
def create_shortcut(self, name, key, icon, tags, env_key, sort_by="name"):
726728
payload = {
727-
"name": "another",
728-
"key": "another",
729-
"icon": "bolt",
729+
"name": name,
730+
"key": key,
731+
"icon": icon,
730732
"type": "flags",
731733
"context": {
732734
"projectKey": self.project_key,
733-
"environmentKeys": ["production", "test"],
734-
"selectedEnvironmentKey": "production",
735+
"environmentKeys": ["production"],
736+
"selectedEnvironmentKey": env_key,
735737
},
736-
"filters": {"filter": {"tags": ["AI"]}},
738+
"filters": {
739+
"filter": {
740+
"tags": tags
741+
},
742+
"state": "live",
743+
"sort": sort_by
744+
},
737745
"visibility": "me",
738746
}
739747
headers = {

Diff for: components/ui/marketcomponents/stores/storecart.tsx

+5-9
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export function StoreCart({ cart, setCart }: { cart: any; setCart: any }) {
128128
})
129129
) : (
130130
<TableRow key={1}>
131-
<TableCell className="">Add an Item!</TableCell>
131+
<TableCell className="text-md font-bold text-lg">No Items in Cart</TableCell>
132132
</TableRow>
133133
)}
134134
</TableBody>
@@ -141,16 +141,12 @@ export function StoreCart({ cart, setCart }: { cart: any; setCart: any }) {
141141
<p className="pb-4 font-sohne">Total:</p>
142142
<p className="pb-4 font-sohne">${totalCost.toFixed(2)}</p>
143143
</div>
144-
<SheetTrigger onClick={isLoggedIn ? checkOut : null} asChild className="shopping-cart-trigger">
144+
<SheetTrigger onClick={checkOut} asChild className="shopping-cart-trigger">
145145
<Button
146-
onClick={isLoggedIn ? checkOutTracking : null}
147-
className={`w-full ${
148-
isLoggedIn
149-
? "bg-gradient-experimentation"
150-
: "text-marketgray border-2 border-marketgray bg-transparent hover:bg-transparent"
151-
} hover:brightness-[120%] rounded-none`}
146+
onClick={checkOutTracking}
147+
className={`w-full bg-gradient-experimentation`}
152148
>
153-
{isLoggedIn ? "Checkout" : "Login to Continue Checkout"}
149+
"Checkout"
154150
</Button>
155151
</SheetTrigger>
156152
{cartSuggestedItems ? (

Diff for: pages/marketplace.tsx

-11
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ export default function Marketplace() {
7272
setCart([...cart, item]);
7373
};
7474

75-
const storeAccessed = () => {
76-
LDClient?.track("item-accessed", LDClient.getContext(), 1);
77-
logLDMetricSent("item-accessed");
78-
};
79-
8075
const handleOnSelect = (item: InventoryItem) => {
8176
let openShoppingCart: HTMLElement = document?.querySelector(
8277
".shopping-cart-trigger"
@@ -118,12 +113,6 @@ export default function Marketplace() {
118113
);
119114
};
120115

121-
useEffect(() => {
122-
if (isLoggedIn) {
123-
storeAccessed();
124-
}
125-
}, [isLoggedIn]);
126-
127116
return (
128117
<>
129118
<Toaster />

0 commit comments

Comments
 (0)